mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Fix: if DYNAMIC_IMP_PROFILE_COST is TRUE, the IMP cost is too high(by sun_alf)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8831 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -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 = GetProfileCost(TRUE);
|
INT32 iIMPCost = GetProfileCost(TRUE, FALSE);
|
||||||
if( LaptopSaveInfo.iCurrentBalance < iIMPCost )
|
if( LaptopSaveInfo.iCurrentBalance < iIMPCost )
|
||||||
{
|
{
|
||||||
// not enough
|
// not enough
|
||||||
@@ -1565,7 +1565,7 @@ BOOLEAN LoadImpCharacter( STR nickName )
|
|||||||
|
|
||||||
// silversurfer: Store current IMP cost. Function iGetProfileCost() already takes the new slot into account.
|
// 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.
|
// If we create the IMP first we would charge too much.
|
||||||
INT32 iIMPCost = GetProfileCost(FALSE);
|
INT32 iIMPCost = GetProfileCost(FALSE, TRUE);
|
||||||
|
|
||||||
// Flugente: as we do not store the cost of the gear in the IMP file, we have to determine the cost here
|
// 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 );
|
iIMPCost += max(0, GetEquippedGearCost( &gMercProfiles[iProfileId] ) - gGameExternalOptions.iIMPProfileCost );
|
||||||
@@ -1763,19 +1763,18 @@ 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 GetProfileCost( BOOLEAN aWithGearCost )
|
INT32 GetProfileCost( BOOLEAN aWithGearCost, BOOLEAN profileSlotAllocated )
|
||||||
{
|
{
|
||||||
// Flugente: aditional imp gear cost
|
// Flugente: aditional imp gear cost
|
||||||
INT32 impgearcost = aWithGearCost ? GetIMPGearCost() : 0;
|
INT32 impgearcost = aWithGearCost ? GetIMPGearCost() : 0;
|
||||||
|
INT32 impProfileCost = gGameExternalOptions.iIMPProfileCost;
|
||||||
|
|
||||||
if (gGameExternalOptions.fDynamicIMPProfileCost)
|
if (gGameExternalOptions.fDynamicIMPProfileCost)
|
||||||
{
|
{
|
||||||
// silversurfer: When we create an IMP he doesn't occupy a slot yet so we need to add 1 to get the correct price in advance.
|
// sun_alf: if the IMP profile already occupies a slot, CountFilledIMPSlots() return the number we want to multiply on,
|
||||||
INT32 iIMPProfileCost = gGameExternalOptions.iIMPProfileCost * (CountFilledIMPSlots() + 1);
|
// but if a slot is not allocated still, we need to add 1 to get the correct price in advance.
|
||||||
|
impProfileCost *= profileSlotAllocated ? CountFilledIMPSlots() : CountFilledIMPSlots() + 1;
|
||||||
if ( iIMPProfileCost + impgearcost >= gGameExternalOptions.iIMPProfileCost )
|
|
||||||
return iIMPProfileCost + impgearcost;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gGameExternalOptions.iIMPProfileCost + impgearcost;
|
return impProfileCost + impgearcost;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void ResetIMPCharactersEyesAndMouthOffsets( UINT8 ubMercProfileID );
|
|||||||
|
|
||||||
BOOLEAN ImpExists ( STR fileName );
|
BOOLEAN ImpExists ( STR fileName );
|
||||||
|
|
||||||
INT32 GetProfileCost( BOOLEAN aWithGearCost ); // added by SANDRO
|
INT32 GetProfileCost( BOOLEAN aWithGearCost, BOOLEAN profileSlotAllocated ); // added by SANDRO
|
||||||
|
|
||||||
void MakeProfileInvItemAnySlot( MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany );
|
void MakeProfileInvItemAnySlot( MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany );
|
||||||
|
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ void BtnIMPMainPageBeginCallback(GUI_BUTTON *btn,INT32 reason)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( LaptopSaveInfo.iCurrentBalance < GetProfileCost(FALSE) ) // SANDRO - changed to find actual profile cost in IMPConfirm
|
if( LaptopSaveInfo.iCurrentBalance < GetProfileCost(FALSE, FALSE) ) // 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 ], GetProfileCost(TRUE) );
|
swprintf( chPayCost, gzIMPProfileCostText[ 0 ], GetProfileCost(TRUE, FALSE) );
|
||||||
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