Merge branch 'marauder_fame'

feature/prepare-cross-merge
Nuno 4 years ago committed by kaetemi
parent 9b5a4d94cf
commit 08393ea94d
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -5131,10 +5131,10 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (command_args.size() == 4 || (command_args.size () == 5 && command_args[4] != "0"))
{
// Make sure fame values are properly capped.
CFameManager::getInstance().enforceFameCaps(c->getId(), c->getAllegiance());
CFameManager::getInstance().enforceFameCaps(c->getId(), c->getOrganization(), c->getAllegiance());
// set tribe fame threshold and clamp fame if necessary
CFameManager::getInstance().setAndEnforceTribeFameCap(c->getId(), c->getAllegiance());
CFameManager::getInstance().setAndEnforceTribeFameCap(c->getId(), c->getOrganization(), c->getAllegiance());
}
}

@ -90,7 +90,7 @@ void CFameContainer::serial(NLMISC::IStream &f)
{
uint32 size = _FactionInfos.size();
f.serial(size);
std::map<uint32, TFameContainerEntry>::iterator first(_FactionInfos.begin()), last(_FactionInfos.end());
for (; first != last; ++first)
{
@ -105,7 +105,7 @@ void CFameContainer::serial(NLMISC::IStream &f)
}
}
else
{
{
// serial old fame save
vector<sint32> fames;
vector<sint32> memories;
@ -154,9 +154,9 @@ CFameManager::CFameManager()
//array of callback items
NLNET::TUnifiedCallbackItem _cbArray[] =
{
{ "FAME_DELTA", cbFameDelta },
{ "FAME_DELTA", cbFameDelta },
};
// register call back for fame manager
CUnifiedNetwork::getInstance()->addCallbackArray( _cbArray, sizeof(_cbArray) / sizeof(_cbArray[0]) );
@ -234,7 +234,7 @@ void CFameManager::mirrorIsReady()
const static std::string fameMemory("FameMemory");
const static std::string firstFame("Fame_0");
// Mirror.declareEntityTypeOwner( RYZOMID::guild, 5000 ); // max number of guild
// Mirror.declareEntityTypeOwner( RYZOMID::civilisation, 10 ); // max number of civilisation
@ -245,7 +245,7 @@ void CFameManager::mirrorIsReady()
TheFameDataset.declareProperty( civilisation, PSOReadWrite );
TheFameDataset.declareProperty( guild, PSOReadWrite );
TheFameDataset.declareProperty( fameMemory, PSOReadWrite );
for (uint i=0; i<MAX_FACTION; ++i)
{
string propName = toString("Fame_%u", i);
@ -305,7 +305,7 @@ void CFameManager::addPlayer(const CEntityId &playerId, const EGSPD::CFameContai
TFameOwnerWrite *fow = new TFameOwnerWrite(TheFameDataset, entityIndex);
_FamesOwners.insert(make_pair(entityIndex, fow));
fow->FameMemory = memoryIndex;
// restore the fame value
for ( map<CSheetId,EGSPD::CFameContainerEntryPD>::const_iterator it = fameContainer.getEntriesBegin(); it != fameContainer.getEntriesEnd(); ++it )
{
@ -331,7 +331,7 @@ void CFameManager::addPlayer(const CEntityId &playerId, const EGSPD::CFameContai
// fow->Fames[faction] = CStaticFames::getInstance().getStaticFameIndexed(PVP_CLAN::getFactionIndex(playerRace), faction);
}
}
fow->LastGuildStatusChange = fameContainer.getLastGuildStatusChange();
/// update the guild memory
updatePlayerFame(entityIndex);
@ -393,7 +393,7 @@ void CFameManager::savePlayerFame(const NLMISC::CEntityId &playerId, EGSPD::CFam
EGS_PD_AST(entry);
entry->setFameMemory( it->second->Fames[i] );
}
// fameContainer._FamesMemory.resize(MAX_FACTION);
// for (uint i=0; i<MAX_FACTION; ++i)
// fameContainer._FamesMemory[i] = it->second->Fames[i];
@ -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] );
}
@ -578,7 +579,7 @@ void CFameManager::saveGuildFame(const NLMISC::CEntityId &guildId, EGSPD::CFameC
entry->setLastFameChangeTrend( it->second->LastFameChangeTrends[i] );
}
}
// fameContainer._Fames.resize(MAX_FACTION);
// fameContainer._Fames[i] = it->second->Fames[i];
}
@ -629,7 +630,7 @@ void CFameManager::removeGuild(const CEntityId &guildId)
void CFameManager::setGuildCivilisation( const NLMISC::CEntityId & guildId, EGSPD::CPeople::TPeople civilisation )
{
TDataSetRow guildIndex = TheFameDataset.getDataSetRow(guildId);
// check if the civ exists
uint8 id = EGSPD::getCivilisationId( civilisation );
if ( id == 0xFF )
@ -639,14 +640,14 @@ void CFameManager::setGuildCivilisation( const NLMISC::CEntityId & guildId, EGSP
}
CEntityId civId(RYZOMID::civilisation, id);
TDataSetRow civIndex = TheFameDataset.getDataSetRow(civId);
TFameContainer::iterator it = _FamesOwners.find( civIndex );
if ( it == _FamesOwners.end() )
{
nlwarning("FAME:setPlayerCivilisation-> unknown civ eId %s", civId.toString().c_str(), id );
return;
}
// check if the player exists
it = _FamesOwners.find( guildIndex );
if ( it == _FamesOwners.end() )
@ -675,7 +676,7 @@ void CFameManager::setPlayerCivilisation( const NLMISC::CEntityId & playerId, EG
}
CEntityId civId(RYZOMID::civilisation, id);
TDataSetRow civIndex = TheFameDataset.getDataSetRow(civId);
TFameContainer::iterator it = _FamesOwners.find( civIndex );
if ( it == _FamesOwners.end() )
{
@ -795,7 +796,7 @@ void CFameManager::cbFameDelta( NLNET::CMessage& msgin, const std::string &servi
msgin.serial(propagate);
getInstance().addFameIndexed(entityId, faction, deltaFame, serviceName, propagate);
// We don't inform the client right now, the timer will take care of this
//character->sendEventForMissionAvailabilityCheck();
}
@ -841,7 +842,7 @@ void CFameManager::addFameIndexed(const CEntityId &entityId, uint32 faction, sin
CCharacter* character = PlayerManager.getChar( entityId );
bool isMarauder = (character && character->getOrganization() == 5);
if (fame == NO_FAME)
{
if (character)
@ -872,10 +873,10 @@ void CFameManager::addFameIndexed(const CEntityId &entityId, uint32 faction, sin
if (realDeltaFame > 3*6000)
realDeltaFame = 3*6000;
if (realDeltaFame < -3*6000)
realDeltaFame = -3*6000;
if (!isMarauder && realDeltaFame < 0)
realDeltaFame /= 10;
@ -895,13 +896,13 @@ void CFameManager::addFameIndexed(const CEntityId &entityId, uint32 faction, sin
entityId.toString().c_str(),
sint32(fame));
// just update one player DB
// retreive the char info
// retreive the char info
CCharacter *c = PlayerManager.getChar(entityId);
// See if still qualify to have declaration
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]);
@ -957,7 +958,7 @@ void CFameManager::addFameIndexed(const CEntityId &entityId, uint32 faction, sin
{
gf = fi.getFameIndexed(TheFameDataset.getEntityId(fow->Guild()), faction, false, true);
}
nldebug("FAME: Updating guild fame for entityId %s as G:%d",
entityId.toString().c_str(),
sint32(fame));
@ -1088,7 +1089,7 @@ sint32 CFameManager::getFameIndexed(const CEntityId &entityId, uint32 factionInd
else
fame = 0;
}
// clamp fame upper bound to neutral max if entity is declared as "None"
if( character)
{
@ -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]);
/*
@ -1252,10 +1253,10 @@ void CFameManager::setEntityFame(const NLMISC::CEntityId & entityId, uint32 fact
else
CCharacter::sendDynamicSystemMessage( ch->getEntityRowId(), "FAME_LOST_CHAR", params );
*/
}
}
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,25 +1350,26 @@ 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
{
// No allegiance? => Max
if( allegiance.first == PVP_CLAN::None || allegiance.second == PVP_CLAN::None )
return FameAbsoluteMax;
// look up in the tribe threshold clamp array
const vector<CStaticFames::CTribeCultThresholdPerCiv> &tribeThres= CStaticFames::getInstance().getTribeThresholdVector();
if(tribeThres.empty())
@ -1370,45 +1384,54 @@ sint32 CFameManager::getMaxFameByFactionIndex(std::pair<PVP_CLAN::TPVPClan, PVP_
if(ttIndex>=tribeThres.size())
return FameMaxDefault;
// get the
// get the
const CStaticFames::CTribeCultThreshold * tc = 0;
switch( allegiance.second )
if (organization == 5) // marauder
{
case PVP_CLAN::Matis:
tc = &tribeThres[ttIndex].Matis;
break;
case PVP_CLAN::Fyros:
tc = &tribeThres[ttIndex].Fyros;
break;
case PVP_CLAN::Tryker:
tc = &tribeThres[ttIndex].Tryker;
break;
case PVP_CLAN::Zorai:
tc = &tribeThres[ttIndex].Zorai;
break;
case PVP_CLAN::Neutral:
tc = &tribeThres[ttIndex].Neutral;
break;
default:
//nlwarning("Character %s have bad civilization allegiance...'%d/%s' !", entityId.toString().c_str(), allegiance.second, PVP_CLAN::toString(allegiance.second).c_str());
return FameMaxDefault;
tc = &tribeThres[ttIndex].Marauder;
return tc->getMarauder();
}
switch(allegiance.first)
else
{
case PVP_CLAN::Kami:
return tc->getKami();
break;
case PVP_CLAN::Karavan:
return tc->getKaravan();
break;
case PVP_CLAN::Neutral:
return tc->getNeutral();
break;
default:
//nlwarning("Character %s have bad cult allegiance...'%d/%s' !", entityId.toString().c_str(), allegiance.first, PVP_CLAN::toString(allegiance.first).c_str());
return FameMaxDefault;
switch( allegiance.second )
{
case PVP_CLAN::Matis:
tc = &tribeThres[ttIndex].Matis;
break;
case PVP_CLAN::Fyros:
tc = &tribeThres[ttIndex].Fyros;
break;
case PVP_CLAN::Tryker:
tc = &tribeThres[ttIndex].Tryker;
break;
case PVP_CLAN::Zorai:
tc = &tribeThres[ttIndex].Zorai;
break;
case PVP_CLAN::Neutral:
tc = &tribeThres[ttIndex].Neutral;
break;
default:
//nlwarning("Character %s have bad civilization allegiance...'%d/%s' !", entityId.toString().c_str(), allegiance.second, PVP_CLAN::toString(allegiance.second).c_str());
return FameMaxDefault;
}
switch(allegiance.first)
{
case PVP_CLAN::Kami:
return tc->getKami();
break;
case PVP_CLAN::Karavan:
return tc->getKaravan();
break;
case PVP_CLAN::Neutral:
return tc->getNeutral();
break;
default:
//nlwarning("Character %s have bad cult allegiance...'%d/%s' !", entityId.toString().c_str(), allegiance.first, PVP_CLAN::toString(allegiance.first).c_str());
return FameMaxDefault;
}
}
}
}
@ -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,12 +1564,12 @@ 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);
fow.Fames[theFactionIndex] = fame;
}
}
if (ch)
{
ch->setFameValuePlayer(theFactionIndex, fame, maxFame, fow.LastFameChangeTrends[theFactionIndex]);
@ -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);
@ -1550,45 +1618,53 @@ void CFameManager::setAndEnforceTribeFameCap(const NLMISC::CEntityId &entityId,
for( vector<CStaticFames::CTribeCultThresholdPerCiv>::const_iterator it = CStaticFames::getInstance().getTribeThresholdVector().begin(); it != CStaticFames::getInstance().getTribeThresholdVector().end(); ++it )
{
theFactionIndex = (*it).FameIndex;
switch( allegiance.second )
if (organization == 5) // marauder
{
case PVP_CLAN::Matis:
tc = &(*it).Matis;
break;
case PVP_CLAN::Fyros:
tc = &(*it).Fyros;
break;
case PVP_CLAN::Tryker:
tc = &(*it).Tryker;
break;
case PVP_CLAN::Zorai:
tc = &(*it).Zorai;
break;
case PVP_CLAN::Neutral:
tc = &(*it).Neutral;
break;
default:
nlwarning("Character %s have bad civilization allegiance...'%d/%s' !", entityId.toString().c_str(), allegiance.second, PVP_CLAN::toString(allegiance.second).c_str());
return;
tc = &(*it).Marauder;
threshold = tc->getMarauder();
}
switch(allegiance.first)
else
{
case PVP_CLAN::Kami:
threshold = tc->getKami();
break;
case PVP_CLAN::Karavan:
threshold = tc->getKaravan();
break;
case PVP_CLAN::Neutral:
threshold = tc->getNeutral();
break;
default:
nlwarning("Character %s have bad cult allegiance...'%d/%s' !", entityId.toString().c_str(), allegiance.first, PVP_CLAN::toString(allegiance.first).c_str());
return;
switch( allegiance.second )
{
case PVP_CLAN::Matis:
tc = &(*it).Matis;
break;
case PVP_CLAN::Fyros:
tc = &(*it).Fyros;
break;
case PVP_CLAN::Tryker:
tc = &(*it).Tryker;
break;
case PVP_CLAN::Zorai:
tc = &(*it).Zorai;
break;
case PVP_CLAN::Neutral:
tc = &(*it).Neutral;
break;
default:
nlwarning("Character %s have bad civilization allegiance...'%d/%s' !", entityId.toString().c_str(), allegiance.second, PVP_CLAN::toString(allegiance.second).c_str());
return;
}
switch(allegiance.first)
{
case PVP_CLAN::Kami:
threshold = tc->getKami();
break;
case PVP_CLAN::Karavan:
threshold = tc->getKaravan();
break;
case PVP_CLAN::Neutral:
threshold = tc->getNeutral();
break;
default:
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 )
{
@ -1618,10 +1694,10 @@ void CFameManager::thresholdChanged(NLMISC::IVariable &var)
// TDataSetRow index;
// if ( Mirror.mirrorIsReady() )
// index = TheFameDataset.getDataSetRow(eId);
//
//
// std::string name;
// uint32 value;
//
//
// f.xmlPush("fames");
//
// if ( f.isReading() )
@ -1644,13 +1720,13 @@ void CFameManager::thresholdChanged(NLMISC::IVariable &var)
// }
// else
// {
// const std::vector<NLMISC::TStringId> & fameIds = CStaticFames::getInstance().getFactionNames();
// const std::vector<NLMISC::TStringId> & fameIds = CStaticFames::getInstance().getFactionNames();
// uint32 size = fameIds.size();
//
// f.xmlPush("size");
// f.serial(size);
// f.xmlPop();
//
//
// for (uint i = 0; i < size; i++ )
// {
// std::string name = CStringMapper::unmap( fameIds[i] );
@ -1777,8 +1853,8 @@ void CFameManager::updateFameTrend(const TDataSetRow &entityIndex)
CCharacter *character = PlayerManager.getChar(eid);
if (character == NULL)
{
nlwarning("Can't find character '%s' (from fame row index %u) in player manager !",
eid.toString().c_str(),
nlwarning("Can't find character '%s' (from fame row index %u) in player manager !",
eid.toString().c_str(),
entityIndex.toString().c_str());
return;
}
@ -1788,8 +1864,8 @@ void CFameManager::updateFameTrend(const TDataSetRow &entityIndex)
CGuild *guild = CGuildManager::getInstance()->getGuildFromId((uint32)(eid.getShortId()));
if (guild == NULL)
{
nlwarning("Can't find guild '%s' (from fame row index %u) in guild manager !",
eid.toString().c_str(),
nlwarning("Can't find guild '%s' (from fame row index %u) in guild manager !",
eid.toString().c_str(),
entityIndex.toString().c_str());
return;
}
@ -1803,7 +1879,7 @@ void CFameManager::updatePlayerFame(const TDataSetRow &playerIndex)
CCharacter *character = NULL;
TFameContainer::iterator it(_FamesOwners.find(playerIndex));
double alpha = 1.0f;
if (it == _FamesOwners.end())
{
@ -1843,7 +1919,7 @@ void CFameManager::updatePlayerFame(const TDataSetRow &playerIndex)
TheFameDataset.getEntityId(playerIndex).toString().c_str());
return;
}
TFameOwnerWrite *guildFame = it->second;
if (now - fow->LastGuildStatusChange > FameMemoryInterpolation)
@ -1865,7 +1941,7 @@ void CFameManager::updatePlayerFame(const TDataSetRow &playerIndex)
for (uint i=0; i<MAX_FACTION; ++i)
{
sint32 gf = guildFame->Fames[i];
sint32 gf = guildFame->Fames[i];
sint32 hf = fow->LastGuildFame[i];
if (gf == NO_FAME && hf == NO_FAME)
@ -2022,7 +2098,7 @@ NLMISC_COMMAND (declareCharacterCult, "Make character declare a specific cult.",
// Second argument is a clan.
PVP_CLAN::TPVPClan theClan = PVP_CLAN::fromString(args[1]);
if (theClan == PVP_CLAN::Unknown)
{
log.displayNL("Invalid clan name specified.");
@ -2059,7 +2135,7 @@ NLMISC_COMMAND (declareCharacterCiv, "Make character declare a specific civiliza
// Second argument is a clan.
PVP_CLAN::TPVPClan theClan = PVP_CLAN::fromString(args[1]);
if (theClan == PVP_CLAN::Unknown)
{
log.displayNL("Invalid clan name specified.");
@ -2089,7 +2165,7 @@ NLMISC_COMMAND (adjustCharacterFame, "For a character, adjust a specific clan by
// Second argument is a clan.
PVP_CLAN::TPVPClan theClan = PVP_CLAN::fromString(args[1]);
uint32 factionIndex;
if (theClan == PVP_CLAN::Unknown)
@ -2143,7 +2219,7 @@ NLMISC_COMMAND (declareGuildCult, "Make guild declare a specific cult", "<Guild
// Second argument is a clan.
PVP_CLAN::TPVPClan theClan = PVP_CLAN::fromString(args[1]);
if (theClan == PVP_CLAN::Unknown)
{
log.displayNL("Invalid clan name specified.");
@ -2179,7 +2255,7 @@ NLMISC_COMMAND (declareGuildCiv, "Make guild declare a specific civilization", "
// Second argument is a clan.
PVP_CLAN::TPVPClan theClan = PVP_CLAN::fromString(args[1]);
if (theClan == PVP_CLAN::Unknown)
{
log.displayNL("Invalid clan name specified.");
@ -2216,7 +2292,7 @@ NLMISC_COMMAND (adjustGuildFame, "For a guild, adjust a specific clan by indicat
// Second argument is a clan.
PVP_CLAN::TPVPClan theClan = PVP_CLAN::fromString(args[1]);
if (theClan == PVP_CLAN::Unknown)
{
log.displayNL("Invalid clan name specified.");
@ -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;

@ -147,14 +147,14 @@ public:
sint32 getStartFame(PVP_CLAN::TPVPClan playerClan, PVP_CLAN::TPVPClan targetClan);
// - getMaxFameByClan: playerClan must be Neutral or the same type (Cult or Clan) as targetClan,
// targetClan must be any non-neutral clan.
sint32 getMaxFameByClan(std::pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> playerClans, PVP_CLAN::TPVPClan targetClan);
sint32 getMaxFameByFactionIndex(std::pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> playerClans, uint32 factionIndex);
sint32 getMaxFameByClan(std::pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> playerClans, uint32 organization, PVP_CLAN::TPVPClan targetClan);
sint32 getMaxFameByFactionIndex(std::pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> playerClans, uint32 organization, uint32 factionIndex);
// Ensures that the fame values are properly capped based on allegiance.
void enforceFameCaps(const NLMISC::CEntityId &entityId, std::pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> allegiance);
void enforceFameCaps(const NLMISC::CEntityId &entityId, uint32 organization, std::pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> allegiance);
// Set tribe fame cap and ensures fame values are properly capped, based on allegiance
void setAndEnforceTribeFameCap(const NLMISC::CEntityId &entityId, std::pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> allegiance);
void setAndEnforceTribeFameCap(const NLMISC::CEntityId &entityId, uint32 organization, std::pair<PVP_CLAN::TPVPClan, PVP_CLAN::TPVPClan> allegiance);
// Callback function for when one of the threshold CVariables are changed.
static void thresholdChanged(NLMISC::IVariable &var);
@ -201,10 +201,10 @@ private:
/// declare the 100 fame mirror value
CMirrorPropValueAlice<sint32> Fames[MAX_FACTION];
/** Fame memory. Used for player to remember guild fame status when they change/join/quit guild
/** Fame memory. Used for player to remember guild fame status when they change/join/quit guild
* The reason for this is to reduce the resulting fame variation when the player change/join/quit a guild.
* The table will receive the current evaluated player guild fame when the player guild status change.
* Then, a progressive interpolation will slop the evaluated player guild fame from the new player guild fame
* Then, a progressive interpolation will slop the evaluated player guild fame from the new player guild fame
* value.
*/
sint32 LastGuildFame[MAX_FACTION];
@ -226,7 +226,7 @@ private:
FameMemory = TDataSetRow::createFromRawIndex(INVALID_DATASET_ROW );
LastGuildStatusChange = 0;
LastFameChangeDate = 0;
for (uint i=0; i<MAX_FACTION; ++i)
{
Fames[i].init(dataSet, entityRow, FirstFamePropIndex+i);

@ -115,8 +115,8 @@ const ucstring & CGuild::getDescription()const
//----------------------------------------------------------------------------
uint8 CGuild::getMembersSession()const
{
return _MembersSession;
}
return _MembersSession;
}
//----------------------------------------------------------------------------
void CGuild::spendXP( uint32 xp )
@ -306,7 +306,7 @@ void CGuild::onGuildStringUpdated(ICDBStructNode *node)
{
CGuildMember * member = EGS_PD_CAST<CGuildMember*>( (*it).second );
EGS_PD_AST( member );
// continue if the player is offline
CGuildMemberModule * module = NULL;
if ( member->getReferencingModule(module) )
@ -421,7 +421,7 @@ void CGuild::initNonPDMembers()
// build entity id
_EId = CEntityId( RYZOMID::guild, _Id );
_EId.setCreatorId(0);
{
H_AUTO(resizeInitNonPDMembers);
_GradeCounts.resize(EGSPD::CGuildGrade::EndGuildGrade);
@ -477,8 +477,8 @@ void CGuild::setDescription(const ucstring & str)
//----------------------------------------------------------------------------
void CGuild::dumpGuildInfos( NLMISC::CLog & log )
{
log.displayNL("<GUILD_DUMP> Guild id: %s %s, name: '%s', eid: %s",
guildIdToString(getId()).c_str(),
log.displayNL("<GUILD_DUMP> Guild id: %s %s, name: '%s', eid: %s",
guildIdToString(getId()).c_str(),
getId()>>20 == IService::getInstance()->getShardId() ? "(Local)" : "(Foreign)",
getName().toUtf8().c_str(), getEId().toString().c_str() );
log.displayNL("\tDescription: '%s'", getDescription().toUtf8().c_str() );
@ -621,7 +621,7 @@ void CGuild::registerGuild()
/// todo guild : name
//CEntityIdTranslator::getInstance()->registerEntity(_EId,guild->getGuildName(),0,0,"");
if ( _Building != CAIAliasTranslator::Invalid )
CBuildingManager::getInstance()->registerGuild( _Id, _Building );
@ -637,7 +637,7 @@ void CGuild::registerGuild()
void CGuild::openGuildChatGroup()
{
H_AUTO(openGuildChatGroup);
// we need to wait for IOS up message before openning
// we need to wait for IOS up message before openning
if (!IOSIsUp)
return;
@ -914,7 +914,7 @@ bool CGuild::isInGuildBuilding( const TDataSetRow & user )
IBuildingPhysical * guildBuilding = CBuildingManager::getInstance()->getBuildingPhysicalsByAlias(CGuildPD::getBuilding());
if (guildBuilding == NULL)
return false;
return guildBuilding->isUserInsideBuilding(user);
}
@ -937,7 +937,7 @@ bool CGuild::canAccessToGuildInventory( CCharacter * user )
// TODO ULU : add here position check of GH on atys
return false;
}
@ -959,7 +959,7 @@ void CGuild::putItem( CCharacter * user, uint32 slot, uint32 quantity, uint16 se
// The item session is incremented and the highest session value is then sent to the clients
// sessions are reseted when nobody uses the inventory
nlassert( user );
if( canAccessToGuildInventory( user ) == false )
{
CCharacter::sendDynamicSystemMessage(user->getEntityRowId(), "CANT_ACCESS_GUILD_INVENTORY");
@ -1164,13 +1164,13 @@ uint CGuild::destroyItems(const std::vector<CItemSlotId> &itemSlotIns, uint32 ma
void CGuild::takeMoney( CCharacter * user, uint64 money, uint16 session )
{
nlassert(user);
if( canAccessToGuildInventory( user ) == false )
{
CCharacter::sendDynamicSystemMessage(user->getEntityRowId(), "CANT_ACCESS_GUILD_INVENTORY");
return;
}
if ( money > _Money )
{
nlwarning( "takeMoney guild %u user %s : money = %" NL_I64 "u, max = %" NL_I64 "u",_Id,user->getId().toString().c_str(),money,_Money);
@ -1191,7 +1191,7 @@ void CGuild::takeMoney( CCharacter * user, uint64 money, uint16 session )
_GuildInventoryView->updateSessionForMoneyTransaction();
user->giveMoney( money );
_Money -= money;
// setClientDBProp( "GUILD:INVENTORY:MONEY", _Money );
CBankAccessor_GUILD::getGUILD().getINVENTORY().setMONEY(_DbGroup, _Money);
@ -1201,13 +1201,13 @@ void CGuild::takeMoney( CCharacter * user, uint64 money, uint16 session )
void CGuild::putMoney( CCharacter * user, uint64 money, uint16 session )
{
nlassert(user);
if( canAccessToGuildInventory( user ) == false )
{
CCharacter::sendDynamicSystemMessage(user->getEntityRowId(), "CANT_ACCESS_GUILD_INVENTORY");
return;
}
if ( money > user->getMoney() )
{
nlwarning( "putMoney guild %u user %s : money = %" NL_I64 "u, max = %" NL_I64 "u",_Id,user->getId().toString().c_str(),money,_Money);
@ -1269,8 +1269,8 @@ void CGuild::removeMember(const EGSPD::TCharacterId &id)
CGuildMemberModule * module = NULL;
if (character != NULL && character->getEnterFlag() && character->getModuleParentWrap().getModule( module ))
{
nlinfo("CGuild::removeMember : remove online member %s from guild %s",
guildMember->getId().toString().c_str(),
nlinfo("CGuild::removeMember : remove online member %s from guild %s",
guildMember->getId().toString().c_str(),
guildIdToString(getId()).c_str());
// online character, let the module do the job
@ -1279,8 +1279,8 @@ void CGuild::removeMember(const EGSPD::TCharacterId &id)
}
else
{
nlinfo("CGuild::removeMember : remove offline member %s from guild %s",
guildMember->getId().toString().c_str(),
nlinfo("CGuild::removeMember : remove offline member %s from guild %s",
guildMember->getId().toString().c_str(),
guildIdToString(getId()).c_str());
// offline character, do it the raw way
@ -1308,16 +1308,16 @@ void CGuild::deleteMember( CGuildMember* member )
setMemberOffline( member );
incMemberSession();
uint16 idx = member->getMemberIndex();
// update grade counts
_GradeCounts[member->getGrade()]--;
TDataSetRow row = TheDataset.getDataSetRow( member->getIngameEId() );
CGuildManager::getInstance()->removeCharToGuildAssoc(member->getIngameEId(), getId());
deleteFromMembers( member->getIngameEId() );
_FreeMemberIndexes.insert( idx );
// clear database entry
// std::string dbBase = NLMISC::toString( "GUILD:MEMBERS:%u:",idx );
CBankAccessor_GUILD::TGUILD::TMEMBERS::TArray &memberElem = CBankAccessor_GUILD::getGUILD().getMEMBERS().getArray(idx);
@ -1349,7 +1349,7 @@ uint16 CGuild::getMaxGradeCount(EGSPD::CGuildGrade::TGuildGrade grade)const
uint16 count = 0;
for ( uint i = 0; i < size; ++i )
count+=_GradeCounts[i];
switch (grade)
{
case EGSPD::CGuildGrade::Leader:
@ -1414,7 +1414,7 @@ void CGuild::setMemberOnline( CGuildMember * member, uint8 dynamicId )
module->getProxy(proxy);
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal= _MessageOfTheDay;
proxy.sendDynamicMessageToChatGroup("GMOTD", CChatGroup::guild, params);
proxy.sendDynamicMessageToChatGroup("GMOTD", CChatGroup::guild, params);
}
}
// Link guild inventory in CCharacter to the shared inventory
@ -1437,7 +1437,7 @@ void CGuild::sendMessageToGuildMembers( const std::string & msg, const TVectorP
{
CGuildMember * member = EGS_PD_CAST<CGuildMember*>( (*it).second );
EGS_PD_AST( member );
// continue if the player is offline
CGuildMemberModule * module = NULL;
if ( member->getReferencingModule(module) )
@ -1476,10 +1476,10 @@ void CGuild::setMemberClientDB( CGuildMember* member )
{
// get a module pointing on the member
nlassert( member );
//const ucstring memberName = NLMISC::CEntityIdTranslator::getInstance()->getByEntity(member->getIngameEId() );
const uint32 nameId = NLMISC::CEntityIdTranslator::getInstance()->getEntityNameStringId( member->getIngameEId() );
// std::string dbBase = NLMISC::toString( "GUILD:MEMBERS:%u:",member->getMemberIndex() );
CBankAccessor_GUILD::TGUILD::TMEMBERS::TArray &memberElem = CBankAccessor_GUILD::getGUILD().getMEMBERS().getArray(member->getMemberIndex());
@ -1516,7 +1516,7 @@ void CGuild::setMemberClientDB( CGuildMember* member )
// even if it still returned by PlayerManager.getChar()
return;
}
// Set guild-related mirror and client database properties of the character
TDataSetRow row = TheDataset.getDataSetRow( member->getIngameEId() );
if ( TheDataset.isAccessible( row ) )
@ -1540,7 +1540,7 @@ void CGuild::setMemberClientDB( CGuildMember* member )
//----------------------------------------------------------------------------
const EGSPD::TCharacterId CGuild::getHighestGradeOnlineUser() const
{
// best successor is the member with best grade. If more than 1 user fits, take the older in the guild
// best successor is the member with best grade. If more than 1 user fits, take the older in the guild
const CGuildMember * best = NULL;
for (std::map<EGSPD::TCharacterId, EGSPD::CGuildMemberPD*>::const_iterator it = getMembersBegin();
it != getMembersEnd();
@ -1548,7 +1548,7 @@ const EGSPD::TCharacterId CGuild::getHighestGradeOnlineUser() const
{
const CGuildMember * member = EGS_PD_CAST<CGuildMember*>( (*it).second );
EGS_PD_AST( member );
// check if the current member is the successor
if ( best == NULL ||
member->getGrade() < best->getGrade() ||
@ -1718,7 +1718,7 @@ uint8 CGuild::getAndSyncItemInfoVersion( uint32 slot, const NLMISC::CEntityId& c
CGuildMemberModule *onlineMember = NULL;
if ( member->getReferencingModule( onlineMember ) ) // contains slow dynamic cast :(
onlineMember->setLastSentInfoVersion( slot, infoVersion );
return infoVersion;
}
@ -1807,7 +1807,7 @@ void CGuild::removeOwnedOutpost(TAIAlias outpostAlias)
PlayerManager.sendImpulseToClient(user->getId(), "GUILD:CLOSE_INVENTORY");
}
}
uint i = 0;
while (i < _OwnedOutposts.size())
{
@ -2047,8 +2047,8 @@ bool CGuild::updateOutpostDB(uint32 outpostIndex)
//-----------------------------------------------------------------------------
CGuild::TAllegiances CGuild::getAllegiance() const
{
return std::make_pair( _DeclaredCult, _DeclaredCiv );
{
return std::make_pair( _DeclaredCult, _DeclaredCiv );
}
//-----------------------------------------------------------------------------
@ -2056,13 +2056,13 @@ bool CGuild::setDeclaredCult(PVP_CLAN::TPVPClan newClan, bool noCheck)
{
if (newClan == PVP_CLAN::None || newClan == PVP_CLAN::Neutral
|| ((newClan >= PVP_CLAN::BeginCults && newClan <= PVP_CLAN::EndCults)
&& (noCheck
|| (CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)) >= FameMinToDeclare)
&& (noCheck
|| (CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)) >= FameMinToDeclare)
|| _DeclaredCult == PVP_CLAN::None) ))
{
if( newClan != PVP_CLAN::None
&& newClan != PVP_CLAN::Neutral
&& CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)) < FameMinToDeclare
if( newClan != PVP_CLAN::None
&& newClan != PVP_CLAN::Neutral
&& CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)) < FameMinToDeclare
&& _DeclaredCult == PVP_CLAN::None)
{
CFameInterface::getInstance().addFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan), FameMinToDeclare - CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)));
@ -2071,7 +2071,7 @@ bool CGuild::setDeclaredCult(PVP_CLAN::TPVPClan newClan, bool noCheck)
//character->sendEventForMissionAvailabilityCheck();
}
_DeclaredCult = newClan;
CFameManager::getInstance().enforceFameCaps(getEId(), getAllegiance());
CFameManager::getInstance().enforceFameCaps(getEId(), 0, getAllegiance());
// Go through membership list, change anyone who doesn't fit in guild to "None".
verifyGuildmembersAllegiance();
@ -2090,13 +2090,13 @@ bool CGuild::setDeclaredCiv(PVP_CLAN::TPVPClan newClan, bool noCheck)
{
if (newClan == PVP_CLAN::None || newClan == PVP_CLAN::Neutral
|| ((newClan >= PVP_CLAN::BeginCivs && newClan <= PVP_CLAN::EndCivs)
&& (noCheck
|| (CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)) >= FameMinToDeclare)
&& (noCheck
|| (CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)) >= FameMinToDeclare)
|| _DeclaredCiv == PVP_CLAN::None) ))
{
if( newClan != PVP_CLAN::None
&& newClan != PVP_CLAN::Neutral
&& CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)) < FameMinToDeclare
if( newClan != PVP_CLAN::None
&& newClan != PVP_CLAN::Neutral
&& CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)) < FameMinToDeclare
&& _DeclaredCiv == PVP_CLAN::None)
{
CFameInterface::getInstance().addFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan), FameMinToDeclare - CFameInterface::getInstance().getFameIndexed(getEId(),PVP_CLAN::getFactionIndex(newClan)));
@ -2105,7 +2105,7 @@ bool CGuild::setDeclaredCiv(PVP_CLAN::TPVPClan newClan, bool noCheck)
//character->sendEventForMissionAvailabilityCheck();
}
_DeclaredCiv = newClan;
CFameManager::getInstance().enforceFameCaps(getEId(), getAllegiance());
CFameManager::getInstance().enforceFameCaps(getEId(), 0, getAllegiance());
// Go through membership list, change anyone who doesn't fit in guild to "None".
verifyGuildmembersAllegiance();
@ -2144,7 +2144,7 @@ void CGuild::setAllegianceFromIndeterminedStatus(PVP_CLAN::TPVPClan allegiance)
}
nlwarning("Only guild with indefinined status in there civ allegiance can do that for become neutral, check the client code !");
return;
default:
nlwarning("Received wrong allegiance '%s'", PVP_CLAN::toString(allegiance).c_str());
return;
@ -2176,7 +2176,7 @@ bool CGuild::verifyClanAllegiance(PVP_CLAN::TPVPClan theClan, sint32 newFameValu
}
}
}
return true;
}
@ -2227,12 +2227,12 @@ void CGuild::resetFameDatabase()
{
H_AUTO(resetFameDatabase);
CFameInterface &fi = CFameInterface::getInstance();
for (uint i=0; i< CStaticFames::getInstance().getNbFame(); ++i)
{
// update player fame info
sint32 fame = fi.getFameIndexed(getEId(), i);
sint32 maxFame = CFameManager::getInstance().getMaxFameByFactionIndex(getAllegiance(), i);
sint32 maxFame = CFameManager::getInstance().getMaxFameByFactionIndex(getAllegiance(), 0, i);
setFameValueGuild(i, fame, maxFame, 0);
}
}
@ -2265,7 +2265,7 @@ void CGuild::setStartFameAndAllegiance( const CEntityId& guildCreator )
CFameManager::getInstance().setEntityFame(getEId(), i, 0);
}
}
CFameManager::getInstance().enforceFameCaps( getEId(), allegiance );
CFameManager::getInstance().enforceFameCaps( getEId(), 0, allegiance );
}

@ -11880,9 +11880,21 @@ void CCharacter::setOrganization(uint32 org)
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(1).setVALUE(_PropertyDatabase, _Organization);
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(2).setVALUE(_PropertyDatabase, _OrganizationStatus);
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(3).setVALUE(_PropertyDatabase, _OrganizationPoints);
CPVPManager2::getInstance()->updateFactionChannel(this);
if (org != 0)
{
setDeclaredCult(PVP_CLAN::Neutral);
setDeclaredCiv(PVP_CLAN::Neutral);
}
CPVPManager2::getInstance()->updateFactionChannel(this);
updateJewelsTags(false);
// Make sure fame values are properly capped.
CFameManager::getInstance().enforceFameCaps(getId(), org, getAllegiance());
// set tribe fame threshold and clamp fame if necessary
CFameManager::getInstance().setAndEnforceTribeFameCap(getId(), org, getAllegiance());
}
//-----------------------------------------------------------------------------
@ -16541,7 +16553,7 @@ void CCharacter::setFameValuePlayer(uint32 factionIndex, sint32 playerFame, sint
sint32 marauderFame = CFameInterface::getInstance().getFameIndexed(_Id, marauderIdx);
if (factionIndex != marauderIdx)
{
sint32 maxOtherfame = -100*6000;
sint32 maxOtherfame = -100*kFameMultipler;
for (uint8 fameIdx = 0; fameIdx < 7; fameIdx++)
{
if (fameIdx == marauderIdx)
@ -16553,11 +16565,16 @@ void CCharacter::setFameValuePlayer(uint32 factionIndex, sint32 playerFame, sint
maxOtherfame = fame;
}
// Marauder fame is when player have negative fame in other clans
maxOtherfame = -maxOtherfame;
if (marauderFame < 50 * 6000 || maxOtherfame < 50 * 6000) {
CFameManager::getInstance().setEntityFame(_Id, marauderIdx, maxOtherfame, false);
if (marauderFame < 50*kFameMultipler)
{
if (maxOtherfame < -50*kFameMultipler) // Cap to 50
maxOtherfame = -50*kFameMultipler;
CFameManager::getInstance().setEntityFame(_Id, marauderIdx, -maxOtherfame, false);
}
else
{
if (maxOtherfame > -40*kFameMultipler)
CFameManager::getInstance().setEntityFame(_Id, marauderIdx, -maxOtherfame, false);
}
}
@ -16642,15 +16659,15 @@ void CCharacter::resetFameDatabase()
// Check fames and fix bad values
if (!haveAnyPrivilege())
{
CFameManager::getInstance().enforceFameCaps(getId(), getAllegiance());
CFameManager::getInstance().setAndEnforceTribeFameCap(getId(), getAllegiance());
CFameManager::getInstance().enforceFameCaps(getId(), getOrganization(), getAllegiance());
CFameManager::getInstance().setAndEnforceTribeFameCap(getId(), getOrganization(), getAllegiance());
}
for (uint i = 0; i < CStaticFames::getInstance().getNbFame(); ++i)
{
// update player fame info
sint32 fame = fi.getFameIndexed(_Id, i, false, true);
sint32 maxFame = CFameManager::getInstance().getMaxFameByFactionIndex(getAllegiance(), i);
sint32 maxFame = CFameManager::getInstance().getMaxFameByFactionIndex(getAllegiance(), getOrganization(), i);
setFameValuePlayer(i, fame, maxFame, 0);
}
}
@ -20297,9 +20314,9 @@ bool CCharacter::setDeclaredCult(PVP_CLAN::TPVPClan newClan)
{
// No problems, let the change happen.
// Make sure fame values are properly capped.
CFameManager::getInstance().enforceFameCaps(this->getId(), this->getAllegiance());
CFameManager::getInstance().enforceFameCaps(this->getId(), this->getOrganization(), this->getAllegiance());
// set tribe fame threshold and clamp fame if necessary
CFameManager::getInstance().setAndEnforceTribeFameCap(this->getId(), this->getAllegiance());
CFameManager::getInstance().setAndEnforceTribeFameCap(this->getId(), this->getOrganization(), this->getAllegiance());
// handle with faction channel
CPVPManager2::getInstance()->updateFactionChannel(this);
// write new allegiance in database
@ -20358,9 +20375,9 @@ bool CCharacter::setDeclaredCiv(PVP_CLAN::TPVPClan newClan)
{
// No problems, let the change happen.
// Make sure fame values are properly capped.
CFameManager::getInstance().enforceFameCaps(this->getId(), this->getAllegiance());
CFameManager::getInstance().enforceFameCaps(this->getId(), this->getOrganization(), this->getAllegiance());
// set tribe fame threshold and clamp fame if necessary
CFameManager::getInstance().setAndEnforceTribeFameCap(this->getId(), this->getAllegiance());
CFameManager::getInstance().setAndEnforceTribeFameCap(this->getId(), this->getOrganization(), this->getAllegiance());
// handle with faction channel
CPVPManager2::getInstance()->updateFactionChannel(this);
// write new allegiance in database

@ -191,7 +191,7 @@ void CCharacter::initInventoriesDb()
CPlayer* p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
if (p->isTrialPlayer() && _BaseParryLevel > 125)
_BaseParryLevel = 125;
_CurrentParryLevel = max(sint32(0), _BaseParryLevel + _ParryModifier);
// _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.ParryBase, _BaseParryLevel);
CBankAccessor_PLR::getCHARACTER_INFO().getPARRY().setBase(
@ -1168,7 +1168,7 @@ void CCharacter::unequipCharacter(INVENTORIES::TInventory invId, uint32 slot, bo
CPlayer* p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
if (p->isTrialPlayer() && _BaseParryLevel > 125)
_BaseParryLevel = 125;
_CurrentParryLevel = max(sint32(0), _BaseParryLevel + _ParryModifier);
// _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.ParryBase, _BaseParryLevel);
CBankAccessor_PLR::getCHARACTER_INFO().getPARRY().setBase(
@ -1510,7 +1510,7 @@ bool CCharacter::checkPreRequired(const CGameItemPtr &item, bool equipCheck)
requiredRespected = false;
}
}
if (requiredRespected == false && equipCheck)
{
PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "REQUIRED_EQUIP");
@ -3331,6 +3331,11 @@ void CCharacter::useItem(uint32 slot)
fx.Aura = MAGICFX::NoAura;
}
}
else if (getOrganization() == 5 && CFameInterface::getInstance().getFameIndexed(_Id, PVP_CLAN::getFactionIndex(PVP_CLAN::Marauder)))
>= 600000)
{
fx.Aura = MAGICFX::MarauderKami;
}
else
{
fx.Aura = MAGICFX::NoAura;

Loading…
Cancel
Save