@ -412,6 +412,7 @@ void CFameManager::savePlayerFame(const NLMISC::CEntityId &playerId, EGSPD::CFam
if ( entry = = NULL )
entry = fameContainer . addToEntries ( id ) ;
EGS_PD_AST ( entry ) ;
nlinfo ( " %d : %d " , it - > second - > Fames [ i ] ) ;
entry - > setFame ( it - > second - > Fames [ i ] ) ;
entry - > setLastFameChangeTrend ( fow - > LastFameChangeTrends [ i ] ) ;
}
@ -901,7 +902,7 @@ void CFameManager::addFameIndexed(const CEntityId &entityId, uint32 faction, sin
if ( c )
{
// Bound the fame based on current allegiance.
sint32 maxFame = getMaxFameByFactionIndex ( c - > getAllegiance ( ) , faction) ;
sint32 maxFame = getMaxFameByFactionIndex ( c - > getAllegiance ( ) , c- > getOrganization ( ) , faction) ;
clamp ( fame , FameAbsoluteMin , maxFame ) ;
// Check to make sure player still qualifies to be in declared allegiances.
c - > verifyClanAllegiance ( PVP_CLAN : : getClanFromIndex ( faction ) , sint32 ( fame ) ) ;
@ -932,7 +933,7 @@ void CFameManager::addFameIndexed(const CEntityId &entityId, uint32 faction, sin
if ( g )
{
// Bound the fame based on current allegiance.
sint32 maxFame = getMaxFameByFactionIndex ( g - > getAllegiance ( ) , faction ) ;
sint32 maxFame = getMaxFameByFactionIndex ( g - > getAllegiance ( ) , 0 , faction ) ;
clamp ( fame , FameAbsoluteMin , maxFame ) ;
g - > verifyClanAllegiance ( PVP_CLAN : : getClanFromIndex ( faction ) , sint32 ( fame ) ) ;
g - > setFameValueGuild ( faction , sint32 ( fame ) , maxFame , fow . LastFameChangeTrends [ faction ] ) ;
@ -1238,7 +1239,7 @@ void CFameManager::setEntityFame(const NLMISC::CEntityId & entityId, uint32 fact
{
nldebug ( " FAME: set fame for character %s as P:%d " , entityId . toString ( ) . c_str ( ) , fame ) ;
sint32 maxFame = getMaxFameByFactionIndex ( ch - > getAllegiance ( ) , faction) ;
sint32 maxFame = getMaxFameByFactionIndex ( ch - > getAllegiance ( ) , ch- > getOrganization ( ) , faction) ;
ch - > setFameValuePlayer ( faction , fame , maxFame , fow . LastFameChangeTrends [ faction ] ) ;
/*
@ -1255,7 +1256,7 @@ void CFameManager::setEntityFame(const NLMISC::CEntityId & entityId, uint32 fact
}
else if ( gu )
{
sint32 maxFame = getMaxFameByFactionIndex ( gu - > getAllegiance ( ) , faction ) ;
sint32 maxFame = getMaxFameByFactionIndex ( gu - > getAllegiance ( ) , 0 , faction ) ;
gu - > setFameValueGuild ( faction , fame , maxFame , fow . LastFameChangeTrends [ faction ] ) ;
}
else
@ -1279,8 +1280,20 @@ sint32 CFameManager::getStartFame(PVP_CLAN::TPVPClan playerClan, PVP_CLAN::TPVPC
}
// - getMaxFameByClan: playerClan must be Neutral or the same type (Cult or Clan) as targetClan, targetClan must be any non-neutral clan.
sint32 CFameManager : : getMaxFameByClan ( std : : pair < PVP_CLAN : : TPVPClan , PVP_CLAN : : TPVPClan > playerClans , PVP_CLAN: : TPVPClan targetClan )
sint32 CFameManager : : getMaxFameByClan ( std : : pair < PVP_CLAN : : TPVPClan , PVP_CLAN : : TPVPClan > playerClans , uint32 organization , PVP_CLAN: : TPVPClan targetClan )
{
if ( targetClan = = PVP_CLAN : : Marauder )
{
if ( organization = = 5 )
return 100 * kFameMultipler ;
return 30 * kFameMultipler ;
}
if ( organization = = 5 ) // marauder
{
return - 30 * kFameMultipler ;
}
// Local variables for the lookup values.
int playerLookup , targetLookup ;
@ -1337,18 +1350,19 @@ sint32 CFameManager::getMaxFameByClan(std::pair<PVP_CLAN::TPVPClan, PVP_CLAN::TP
}
}
// Wasn't caught above, probably a tribe. Return a default value.
return FameMaxDefault ;
}
sint32 CFameManager : : getMaxFameByFactionIndex ( std : : pair < PVP_CLAN : : TPVPClan , PVP_CLAN : : TPVPClan > allegiance , uint32 factionIndex)
sint32 CFameManager : : getMaxFameByFactionIndex ( std : : pair < PVP_CLAN : : TPVPClan , PVP_CLAN : : TPVPClan > allegiance , uint32 organization, uint32 factionIndex)
{
PVP_CLAN : : TPVPClan pvpClan ;
// try first with a clan
pvpClan = PVP_CLAN : : getClanFromIndex ( factionIndex ) ;
if ( pvpClan ! = PVP_CLAN : : Unknown )
return getMaxFameByClan ( allegiance , pvpClan) ;
return getMaxFameByClan ( allegiance , organization, pvpClan) ;
// search for tribe
else
{
@ -1373,6 +1387,14 @@ sint32 CFameManager::getMaxFameByFactionIndex(std::pair<PVP_CLAN::TPVPClan, PVP_
// get the
const CStaticFames : : CTribeCultThreshold * tc = 0 ;
if ( organization = = 5 ) // marauder
{
tc = & tribeThres [ ttIndex ] . Marauder ;
return tc - > getMarauder ( ) ;
}
else
{
switch ( allegiance . second )
{
case PVP_CLAN : : Matis :
@ -1412,6 +1434,7 @@ sint32 CFameManager::getMaxFameByFactionIndex(std::pair<PVP_CLAN::TPVPClan, PVP_
}
}
}
}
}
void CFameManager : : doInitTribeThresholdIndex ( )
@ -1433,7 +1456,7 @@ void CFameManager::doInitTribeThresholdIndex()
}
void CFameManager : : enforceFameCaps ( const NLMISC : : CEntityId & entityId , std: : pair < PVP_CLAN : : TPVPClan , PVP_CLAN : : TPVPClan > allegiance )
void CFameManager : : enforceFameCaps ( const NLMISC : : CEntityId & entityId , uint32 organization , std: : pair < PVP_CLAN : : TPVPClan , PVP_CLAN : : TPVPClan > allegiance )
{
const TDataSetRow rowId = TheFameDataset . getDataSetRow ( entityId ) ;
TFameContainer : : iterator it = _FamesOwners . find ( rowId ) ;
@ -1464,6 +1487,51 @@ void CFameManager::enforceFameCaps(const NLMISC::CEntityId &entityId, std::pair<
sint32 fame ;
sint32 maxFame ;
if ( organization = = 5 ) // marauder
{
for ( int looper = PVP_CLAN : : BeginCults ; looper < = PVP_CLAN : : EndCults ; looper + + )
{
theFactionIndex = PVP_CLAN : : getFactionIndex ( ( PVP_CLAN : : TPVPClan ) looper ) ;
fame = fow . Fames [ theFactionIndex ] ;
maxFame = - 30 * kFameMultipler ;
if ( fame ! = NO_FAME )
{
clamp ( fame , FameAbsoluteMin , maxFame ) ;
fow . Fames [ theFactionIndex ] = fame ;
}
if ( ch )
{
ch - > setFameValuePlayer ( theFactionIndex , fame , maxFame , fow . LastFameChangeTrends [ theFactionIndex ] ) ;
}
if ( gu )
{
gu - > setFameValueGuild ( theFactionIndex , fame , maxFame , fow . LastFameChangeTrends [ theFactionIndex ] ) ;
}
}
for ( int looper = PVP_CLAN : : BeginCivs ; looper < = PVP_CLAN : : EndCivs ; looper + + )
{
theFactionIndex = PVP_CLAN : : getFactionIndex ( ( PVP_CLAN : : TPVPClan ) looper ) ;
fame = fow . Fames [ theFactionIndex ] ;
maxFame = - 30 * kFameMultipler ;
if ( fame ! = NO_FAME )
{
clamp ( fame , FameAbsoluteMin , maxFame ) ;
fow . Fames [ theFactionIndex ] = fame ;
}
if ( ch )
{
ch - > setFameValuePlayer ( theFactionIndex , fame , maxFame , fow . LastFameChangeTrends [ theFactionIndex ] ) ;
}
if ( gu )
{
gu - > setFameValueGuild ( theFactionIndex , fame , maxFame , fow . LastFameChangeTrends [ theFactionIndex ] ) ;
}
}
return ;
}
// Check cults, first member of allegiance
PVP_CLAN : : TPVPClan theCult = allegiance . first ;
if ( theCult ! = PVP_CLAN : : None )
@ -1472,7 +1540,7 @@ void CFameManager::enforceFameCaps(const NLMISC::CEntityId &entityId, std::pair<
{
theFactionIndex = PVP_CLAN : : getFactionIndex ( ( PVP_CLAN : : TPVPClan ) looper ) ;
fame = fow . Fames [ theFactionIndex ] ;
maxFame = getMaxFameByClan ( allegiance , ( PVP_CLAN : : TPVPClan ) looper ) ;
maxFame = getMaxFameByClan ( allegiance , organization , ( PVP_CLAN : : TPVPClan ) looper ) ;
if ( fame ! = NO_FAME )
{
clamp ( fame , FameAbsoluteMin , maxFame ) ;
@ -1496,7 +1564,7 @@ void CFameManager::enforceFameCaps(const NLMISC::CEntityId &entityId, std::pair<
{
theFactionIndex = PVP_CLAN : : getFactionIndex ( ( PVP_CLAN : : TPVPClan ) looper ) ;
fame = fow . Fames [ theFactionIndex ] ;
maxFame = getMaxFameByClan ( allegiance , ( PVP_CLAN : : TPVPClan ) looper ) ;
maxFame = getMaxFameByClan ( allegiance , organization , ( PVP_CLAN : : TPVPClan ) looper ) ;
if ( fame ! = NO_FAME )
{
clamp ( fame , FameAbsoluteMin , maxFame ) ;
@ -1514,7 +1582,7 @@ void CFameManager::enforceFameCaps(const NLMISC::CEntityId &entityId, std::pair<
}
}
void CFameManager : : setAndEnforceTribeFameCap ( const NLMISC : : CEntityId & entityId , std: : pair < PVP_CLAN : : TPVPClan , PVP_CLAN : : TPVPClan > allegiance )
void CFameManager : : setAndEnforceTribeFameCap ( const NLMISC : : CEntityId & entityId , uint32 organization , std: : pair < PVP_CLAN : : TPVPClan , PVP_CLAN : : TPVPClan > allegiance )
{
const TDataSetRow rowId = TheFameDataset . getDataSetRow ( entityId ) ;
TFameContainer : : iterator it = _FamesOwners . find ( rowId ) ;
@ -1551,6 +1619,13 @@ void CFameManager::setAndEnforceTribeFameCap(const NLMISC::CEntityId &entityId,
{
theFactionIndex = ( * it ) . FameIndex ;
if ( organization = = 5 ) // marauder
{
tc = & ( * it ) . Marauder ;
threshold = tc - > getMarauder ( ) ;
}
else
{
switch ( allegiance . second )
{
case PVP_CLAN : : Matis :
@ -1588,6 +1663,7 @@ void CFameManager::setAndEnforceTribeFameCap(const NLMISC::CEntityId &entityId,
nlwarning ( " Character %s have bad cult allegiance...'%d/%s' ! " , entityId . toString ( ) . c_str ( ) , allegiance . first , PVP_CLAN : : toString ( allegiance . first ) . c_str ( ) ) ;
return ;
}
}
fame = fow . Fames [ theFactionIndex ] ;
if ( fame ! = NO_FAME )
@ -2251,7 +2327,7 @@ NLMISC_COMMAND (testit, "testit", "")
}
//int retval = CFameManager::getInstance().getStartFame(pCiv,tClan);
int retval = CFameManager : : getInstance ( ) . getMaxFameByClan ( std : : make_pair ( pCult , pCiv ) , tClan ) ;
int retval = CFameManager : : getInstance ( ) . getMaxFameByClan ( std : : make_pair ( pCult , pCiv ) , 0 , tClan ) ;
log . displayNL ( " Fame value = %d. " , retval ) ;
return true ;