New feature: We can now create non-profile-based merchants via lua.scripts.

Requires GameDir >= r2320.

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23061&goto=345526&#msg_345526

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8212 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-05-15 17:11:29 +00:00
parent d594ba0e67
commit 7bb401b1fb
27 changed files with 295 additions and 296 deletions
+35
View File
@@ -99,6 +99,7 @@
#include "Facilities.h" // added by Flugente
#include "Cheats.h" // added by Flugente
#include "MilitiaIndividual.h" // added by Flugente
#include "Arms Dealer Init.h" // added by Flugente for armsDealerInfo[]
#endif
#include "ub_config.h"
@@ -20512,6 +20513,40 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid
HandleSurrenderOffer( pTSoldier );
return(FALSE);
}
else if ( pTSoldier->sNonNPCTraderID > 0 )
{
UINT8 ubTownID = StrategicMap[CALCULATE_STRATEGIC_INDEX( pTSoldier->sSectorX, pTSoldier->sSectorY )].bNameId;
// not possible if this guy is hostile towards us
// however, if we are covert as a soldier, this check does not apply - merchants know better than do defy the army
if ( !pTSoldier->aiData.bNeutral && !(this->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER) )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, szNonProfileMerchantText[0] );
}
// not possible if this guy is incapitated
else if ( pTSoldier->bCollapsed || pTSoldier->bBreathCollapsed || pTSoldier->stats.bLife < OKLIFE )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, szNonProfileMerchantText[1] );
}
// not possible in combat
else if ( gTacticalStatus.uiFlags & INCOMBAT )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, szNonProfileMerchantText[2] );
}
// not possible of loyalty too low
// however, if we are covert as a soldier, this check does not apply - merchants know better than do defy the army
else if ( ubTownID != BLANK_SECTOR && gTownLoyalty[ubTownID].ubRating < armsDealerInfo[pTSoldier->sNonNPCTraderID].nonprofile_loyaltyrequired && !(this->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER) )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, szNonProfileMerchantText[3] );
}
// if we passed the above check, we can trade
else
{
EnterShopKeeperInterfaceScreen_NonNPC( pTSoldier->sNonNPCTraderID, pTSoldier->ubID );
}
return FALSE;
}
else
{
// Flugente: if this guy is a potential volunteer, we might be able to sway him