mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
New "mini" Feature: Added possibility to set optional Tag <mAbsolutePrice> in MercStartingGear.xml to define absolute prices for gearkits (by Tais)
- I put both (startup and gearkit selection in BR's) the initializations for gearkit prices into if's that will check if the absolute price is higher than -1 and lower or equal to 32000 (INT16) - I also added the reading of the tag in xml_mercstartinggear.cpp, to be able to support zero priced gearkits in absolute prices I set the absolute price of a gearkit to -1 on opening tag of a gearkit, if there's an mAbsolutePrice tag set in the gearkit it will override the value, if not nothing happens and all will behave normal - so nothing will change in 1.13 as it is, it will just give modders the ability to set absolute prices with a new tag TODO: Maybe we should also add this optional <mAbsolutePrice> tag to the XML Editor in the future. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4868 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -710,35 +710,42 @@ BOOLEAN LoadMercProfiles(void)
|
||||
OverwriteMercProfileWithXMLData( uiLoop );
|
||||
OverwriteMercOpinionsWithXMLData( uiLoop );
|
||||
}
|
||||
|
||||
|
||||
//tais: moved initial price calculation down to this spot because PROFEX overwrites my gearkit prices
|
||||
//with old binary file optional gear prices which got ported into MercProfiles.xml
|
||||
gMercProfiles[ uiLoop ].usOptionalGearCost = 0;
|
||||
UINT16 tempGearCost = 0;
|
||||
for ( uiLoop2 = 0; uiLoop2< gMercProfiles[ uiLoop ].inv.size(); uiLoop2++ )
|
||||
|
||||
//tais: new tag in gearkit that sets an absolute price for gearkit that will override item value and price modifier if it's a sensible value between 0 and 32000
|
||||
if(gMercProfileGear[uiLoop][0].AbsolutePrice >= 0 && gMercProfileGear[uiLoop][0].AbsolutePrice <= 32000)
|
||||
{
|
||||
if ( gMercProfiles[ uiLoop ].inv[ uiLoop2 ] != NOTHING )
|
||||
{
|
||||
//get the item
|
||||
usItem = gMercProfiles[ uiLoop ].inv[ uiLoop2 ];
|
||||
|
||||
//add the cost
|
||||
tempGearCost += Item[ usItem ].usPrice;
|
||||
}
|
||||
}
|
||||
//tais: added optional price modifier for gearkits, reads the xml tag mPriceMod from MercStartingGear.xml
|
||||
if(gMercProfileGear[uiLoop][0].PriceModifier != 0 &&
|
||||
gMercProfileGear[uiLoop][0].PriceModifier <= 200 &&
|
||||
gMercProfileGear[uiLoop][0].PriceModifier >= -100)
|
||||
{
|
||||
FLOAT mod;
|
||||
mod = (FLOAT) (gMercProfileGear[uiLoop][0].PriceModifier + 100) / 100.0f;
|
||||
gMercProfiles[ uiLoop ].usOptionalGearCost = (UINT16)(tempGearCost * mod);
|
||||
gMercProfiles[ uiLoop ].usOptionalGearCost = gMercProfileGear[uiLoop][0].AbsolutePrice;
|
||||
}
|
||||
else
|
||||
{
|
||||
gMercProfiles[ uiLoop ].usOptionalGearCost = tempGearCost;
|
||||
//tais: moved initial price calculation down to this spot because PROFEX overwrites my gearkit prices
|
||||
//with old binary file optional gear prices which got ported into MercProfiles.xml
|
||||
gMercProfiles[ uiLoop ].usOptionalGearCost = 0;
|
||||
UINT16 tempGearCost = 0;
|
||||
for ( uiLoop2 = 0; uiLoop2< gMercProfiles[ uiLoop ].inv.size(); uiLoop2++ )
|
||||
{
|
||||
if ( gMercProfiles[ uiLoop ].inv[ uiLoop2 ] != NOTHING )
|
||||
{
|
||||
//get the item
|
||||
usItem = gMercProfiles[ uiLoop ].inv[ uiLoop2 ];
|
||||
|
||||
//add the cost
|
||||
tempGearCost += Item[ usItem ].usPrice;
|
||||
}
|
||||
}
|
||||
//tais: added optional price modifier for gearkits, reads the xml tag mPriceMod from MercStartingGear.xml
|
||||
if(gMercProfileGear[uiLoop][0].PriceModifier != 0 &&
|
||||
gMercProfileGear[uiLoop][0].PriceModifier <= 200 &&
|
||||
gMercProfileGear[uiLoop][0].PriceModifier >= -100)
|
||||
{
|
||||
FLOAT mod;
|
||||
mod = (FLOAT) (gMercProfileGear[uiLoop][0].PriceModifier + 100) / 100.0f;
|
||||
gMercProfiles[ uiLoop ].usOptionalGearCost = (UINT16)(tempGearCost * mod);
|
||||
}
|
||||
else
|
||||
{
|
||||
gMercProfiles[ uiLoop ].usOptionalGearCost = tempGearCost;
|
||||
}
|
||||
}
|
||||
|
||||
// ----- WANNE.PROFILE: New Profile Loading - BEGIN
|
||||
|
||||
Reference in New Issue
Block a user