mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Change: Regardless of whether or not an IMP is created via old/new method or by loading an existing callsign, gear costs exceeding IMP_PROFILE_COST are deducted extra.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8638 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+26
-11
@@ -323,7 +323,7 @@ void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason)
|
|||||||
|
|
||||||
// silversurfer: We need to store the profile cost here because right now our new IMP doesn't occupy a slot yet.
|
// silversurfer: We need to store the profile cost here because right now our new IMP doesn't occupy a slot yet.
|
||||||
// However function iGetProfileCost() will already calculate price including that slot. We would charge too much money after the IMP is created below.
|
// However function iGetProfileCost() will already calculate price including that slot. We would charge too much money after the IMP is created below.
|
||||||
INT32 iIMPCost = iGetProfileCost();
|
INT32 iIMPCost = GetProfileCost(TRUE);
|
||||||
if( LaptopSaveInfo.iCurrentBalance < iIMPCost )
|
if( LaptopSaveInfo.iCurrentBalance < iIMPCost )
|
||||||
{
|
{
|
||||||
// not enough
|
// not enough
|
||||||
@@ -580,6 +580,21 @@ void DistributeInitialGear(MERCPROFILESTRUCT *pProfile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT32 GetEquippedGearCost( MERCPROFILESTRUCT *pProfile )
|
||||||
|
{
|
||||||
|
INT32 cost = 0;
|
||||||
|
|
||||||
|
for ( int i = INV_START_POS; i<NUM_INV_SLOTS; ++i )
|
||||||
|
{
|
||||||
|
if ( pProfile->inv[i] != NOTHING )
|
||||||
|
{
|
||||||
|
cost += pProfile->bInvNumber[i] * Item[pProfile->inv[i]].usPrice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cost;
|
||||||
|
}
|
||||||
|
|
||||||
void GiveItemsToPC( UINT8 ubProfileId )
|
void GiveItemsToPC( UINT8 ubProfileId )
|
||||||
{
|
{
|
||||||
MERCPROFILESTRUCT *pProfile;
|
MERCPROFILESTRUCT *pProfile;
|
||||||
@@ -1517,14 +1532,7 @@ BOOLEAN LoadImpCharacter( STR nickName )
|
|||||||
if (iProfileId != -1)
|
if (iProfileId != -1)
|
||||||
{
|
{
|
||||||
LaptopSaveInfo.iIMPIndex = iProfileId;
|
LaptopSaveInfo.iIMPIndex = iProfileId;
|
||||||
|
|
||||||
// silversurfer: Store current IMP cost. Function iGetProfileCost() already takes the new slot into account.
|
|
||||||
// If we create the IMP first we would charge too much.
|
|
||||||
INT32 iIMPCost = iGetProfileCost();
|
|
||||||
|
|
||||||
// read in the profile
|
|
||||||
//if ( !gMercProfiles[ iProfileId ].Load(hFile, false) )
|
|
||||||
|
|
||||||
// anv: before loading profile we need to set guiCurrentSaveGameVersion to profile's version
|
// anv: before loading profile we need to set guiCurrentSaveGameVersion to profile's version
|
||||||
// and set it back to SAVE_GAME_VERSION right after or else new saves will be broken!
|
// and set it back to SAVE_GAME_VERSION right after or else new saves will be broken!
|
||||||
guiCurrentSaveGameVersion = version;
|
guiCurrentSaveGameVersion = version;
|
||||||
@@ -1555,6 +1563,13 @@ BOOLEAN LoadImpCharacter( STR nickName )
|
|||||||
//CHRISL: At this point, we need to resort profile inventory so that NewInv items don't accidentally appear in OldInv
|
//CHRISL: At this point, we need to resort profile inventory so that NewInv items don't accidentally appear in OldInv
|
||||||
DistributeInitialGear(&gMercProfiles[iProfileId]);
|
DistributeInitialGear(&gMercProfiles[iProfileId]);
|
||||||
|
|
||||||
|
// silversurfer: Store current IMP cost. Function iGetProfileCost() already takes the new slot into account.
|
||||||
|
// If we create the IMP first we would charge too much.
|
||||||
|
INT32 iIMPCost = GetProfileCost(FALSE);
|
||||||
|
|
||||||
|
// Flugente: as we do not store the cost of the gear in the IMP file, we have to determine the cost here
|
||||||
|
iIMPCost += max(0, GetEquippedGearCost( &gMercProfiles[iProfileId] ) - gGameExternalOptions.iIMPProfileCost );
|
||||||
|
|
||||||
// Changed to find actual IMP cost - SANDRO
|
// Changed to find actual IMP cost - SANDRO
|
||||||
if( LaptopSaveInfo.iCurrentBalance < iIMPCost )
|
if( LaptopSaveInfo.iCurrentBalance < iIMPCost )
|
||||||
{
|
{
|
||||||
@@ -1748,10 +1763,10 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SANDRO - Function to determine actual cost of profile
|
// SANDRO - Function to determine actual cost of profile
|
||||||
INT32 iGetProfileCost()
|
INT32 GetProfileCost( BOOLEAN aWithGearCost )
|
||||||
{
|
{
|
||||||
// Flugente: aditional imp gear cost
|
// Flugente: aditional imp gear cost
|
||||||
INT32 impgearcost = GetIMPGearCost();
|
INT32 impgearcost = aWithGearCost ? GetIMPGearCost() : 0;
|
||||||
|
|
||||||
if (gGameExternalOptions.fDynamicIMPProfileCost)
|
if (gGameExternalOptions.fDynamicIMPProfileCost)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void ResetIMPCharactersEyesAndMouthOffsets( UINT8 ubMercProfileID );
|
|||||||
|
|
||||||
BOOLEAN ImpExists ( STR fileName );
|
BOOLEAN ImpExists ( STR fileName );
|
||||||
|
|
||||||
INT32 iGetProfileCost( void ); // added by SANDRO
|
INT32 GetProfileCost( BOOLEAN aWithGearCost ); // added by SANDRO
|
||||||
|
|
||||||
void MakeProfileInvItemAnySlot( MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany );
|
void MakeProfileInvItemAnySlot( MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany );
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -568,7 +568,7 @@ void BtnIMPGearFinishCallback( GUI_BUTTON *btn, INT32 reason )
|
|||||||
INT32 GetIMPGearCost( )
|
INT32 GetIMPGearCost( )
|
||||||
{
|
{
|
||||||
if ( IsIMPGearUsed( ) )
|
if ( IsIMPGearUsed( ) )
|
||||||
return max( 0, gIMPGearCost - 3000 );
|
return max( 0, gIMPGearCost - gGameExternalOptions.iIMPProfileCost );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ void BtnIMPMainPageBeginCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE )
|
//if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE )
|
||||||
if( LaptopSaveInfo.iCurrentBalance < iGetProfileCost() ) // SANDRO - changed to find actual profile cost in IMPConfirm
|
if( LaptopSaveInfo.iCurrentBalance < GetProfileCost(TRUE) ) // SANDRO - changed to find actual profile cost in IMPConfirm
|
||||||
{
|
{
|
||||||
DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 3 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack);
|
DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 3 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack);
|
||||||
|
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ void PrintImpText( void )
|
|||||||
//LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 145, ( 200 ), IMP_CON_3 , FONT12ARIAL, FONT_WHITE, TRUE, 0);
|
//LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 145, ( 200 ), IMP_CON_3 , FONT12ARIAL, FONT_WHITE, TRUE, 0);
|
||||||
// SANDRO - changed to show exact cost of profile
|
// SANDRO - changed to show exact cost of profile
|
||||||
CHAR16 chPayCost[1000];
|
CHAR16 chPayCost[1000];
|
||||||
swprintf( chPayCost, gzIMPProfileCostText[ 0 ], iGetProfileCost() );
|
swprintf( chPayCost, gzIMPProfileCostText[ 0 ], GetProfileCost(TRUE) );
|
||||||
DisplayWrappedString( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 145, ( 200 ), 2, FONT12ARIAL, FONT_WHITE, chPayCost,FONT_BLACK,FALSE,LEFT_JUSTIFIED);
|
DisplayWrappedString( LAPTOP_SCREEN_UL_X + 160, LAPTOP_SCREEN_WEB_UL_Y + 145, ( 200 ), 2, FONT12ARIAL, FONT_WHITE, chPayCost,FONT_BLACK,FALSE,LEFT_JUSTIFIED);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user