@ -423,16 +423,21 @@ CCharacter::CCharacter(): CEntityBase(false),
for ( uint i = 0 ; i < ( PVP_CLAN : : EndClans - PVP_CLAN : : BeginClans + 1 ) ; + + i )
_FactionPoint [ i ] = 0 ;
# ifdef RYZOM_FORGE
_PvpPoint = 0 ;
# endif
_PVPFlagLastTimeChange = 0 ;
_PVPFlagTimeSettedOn = 0 ;
_PvPDatabaseCounter = 0 ;
_PVPFlag = false ;
_PVPRecentActionTime = 0 ;
# ifdef RYZOM_FORGE
_Organization = 0 ;
_OrganizationStatus = 0 ;
_OrganizationPoints = 0 ;
# endif
// do not start berserk
_IsBerserk = false ;
@ -660,7 +665,9 @@ CCharacter::CCharacter(): CEntityBase(false),
// For client/server contact list communication
_ContactIdPool = 0 ;
# ifdef RYZOM_FORGE_ROOM
_inRoomOfPlayer = CEntityId : : Unknown ;
# endif
for ( uint i = 0 ; i < BRICK_FAMILIES : : NbFamilies ; + + i )
_BrickFamilyBitField [ i ] = 0 ;
@ -669,16 +676,20 @@ CCharacter::CCharacter(): CEntityBase(false),
_LastTickNpcControlUpdated = CTickEventHandler : : getGameCycle ( ) ;
# ifdef RYZOM_FORGE
_LastWebCommandIndex = 0 ;
_LastUrlIndex = 0 ;
_CustomMissionsParams . clear ( ) ;
# endif
_FriendVisibility = VisibleToAll ;
# ifdef RYZOM_FORGE
_LangChannel = " en " ;
_NewTitle = " Refugee " ;
# endif
initDatabase ( ) ;
} // CCharacter //
@ -704,7 +715,9 @@ void CCharacter::clear()
_ForbidAuraUseStartDate = 0 ;
_ForbidAuraUseEndDate = 0 ;
_Title = CHARACTER_TITLE : : Refugee ;
# ifdef RYZOM_FORGE
_NewTitle = " Refugee " ;
# endif
SET_STRUCT_MEMBER ( _VisualPropertyA , PropertySubData . HatModel , 0 ) ;
SET_STRUCT_MEMBER ( _VisualPropertyA , PropertySubData . HatColor , 0 ) ;
@ -3027,6 +3040,7 @@ void CCharacter::postLoadTreatment()
computeMiscBonus ( ) ;
}
// Always enable XP Catalyaer for non-trial accounts
CPlayer * p = PlayerManager . getPlayer ( PlayerManager . getPlayerId ( getId ( ) ) ) ;
if ( ! p - > isTrialPlayer ( ) )
{
@ -3708,7 +3722,7 @@ void CCharacter::setTargetBotchatProgramm( CEntityBase * target, const CEntityId
{
// send the web page title
uint32 text ;
if ( c - > getWebPageName ( ) .find ( " MENU_ " ) = = 0 )
if ( NLMISC : : startsWith ( c - > getWebPageName ( ) , " MENU_ " ) ) // TODO: What is this?
{
text = STRING_MANAGER : : sendStringToClient ( _EntityRowId , c - > getWebPageName ( ) , TVectorParamCheck ( ) ) ;
}
@ -3725,6 +3739,7 @@ void CCharacter::setTargetBotchatProgramm( CEntityBase * target, const CEntityId
SM_STATIC_PARAMS_1 ( params , STRING_MANAGER : : literal ) ;
string url = c - > getWebPage ( ) ;
# ifdef RYZOM_FORGE
// add ? or & with
if ( url . find ( ' ? ' ) = = string : : npos )
url + = NLMISC : : toString ( " ?urlidx=%d " , getUrlIndex ( ) ) ;
@ -3732,6 +3747,7 @@ void CCharacter::setTargetBotchatProgramm( CEntityBase * target, const CEntityId
url + = NLMISC : : toString ( " &urlidx=%d " , getUrlIndex ( ) ) ;
setUrlIndex ( getUrlIndex ( ) + 1 ) ;
# endif
url + = " &player_eid= " + getId ( ) . toString ( ) ;
@ -3895,16 +3911,10 @@ void CCharacter::sendBetaTesterStatus()
sendReservedTitleStatus ( CHARACTER_TITLE : : FBT , p - > isBetaTester ( ) ) ;
/*if (!p->isBetaTester() && _Title == CHARACTER_TITLE::FBT)
if ( ! p - > isBetaTester ( ) & & _Title = = CHARACTER_TITLE : : FBT )
{
_Title = CHARACTER_TITLE : : Refugee ;
registerName ( ) ;
} */
if ( ! p - > isBetaTester ( ) & & _NewTitle = = " FBT " )
{
_NewTitle = " Refugee " ;
registerName ( ) ;
}
}
@ -3919,16 +3929,10 @@ void CCharacter::sendWindermeerStatus()
sendReservedTitleStatus ( CHARACTER_TITLE : : WIND , p - > isWindermeerCommunity ( ) ) ;
/*if ( !p->isWindermeerCommunity() && _Title == CHARACTER_TITLE::WIND)
if ( ! p - > isWindermeerCommunity ( ) & & _Title = = CHARACTER_TITLE : : WIND )
{
_Title = CHARACTER_TITLE : : Refugee ;
registerName ( ) ;
} */
if ( ! p - > isWindermeerCommunity ( ) & & _NewTitle = = " WIND " )
{
_NewTitle = " Refugee " ;
registerName ( ) ;
}
}
@ -8094,7 +8098,9 @@ void CCharacter::setStartStatistics( const CCreateCharMsg& createCharMsg )
_Race = ( EGSPD : : CPeople : : TPeople ) createCharMsg . People ;
_Gender = createCharMsg . Sex ;
_Title = CHARACTER_TITLE : : Refugee ;
# ifdef RYZOM_FORGE
_NewTitle = " Refugee " ;
# endif
// fame information
// Players start out as Neutral in their declared clans
@ -9042,7 +9048,9 @@ void CCharacter::setDatabase()
_IneffectiveAuras . activate ( ) ;
_ConsumableOverdoseEndDates . activate ( ) ;
// init the RRPs
//RingRewardPoints.initDb();
# ifdef RYZOM_RING_REACTIVATE
RingRewardPoints . initDb ( ) ;
# endif
} // setDatabase //
@ -9105,7 +9113,7 @@ void CCharacter::startTradeItemSession( uint16 session )
fame = MinFameToTrade ;
}
if ( ( bot - > getOrganization ( ) = = 0 & & fame < MinFameToTrade ) | | ( bot - > getOrganization ( ) ! = 0 & & bot - > getOrganization ( ) ! = getOrganization ( ) ) )
else if ( fame < MinFameToTrade )
{
SM_STATIC_PARAMS_1 ( params , STRING_MANAGER : : bot ) ;
params [ 0 ] . setEIdAIAlias ( _CurrentInterlocutor , CAIAliasTranslator : : getInstance ( ) - > getAIAlias ( _CurrentInterlocutor ) ) ;
@ -9113,8 +9121,6 @@ void CCharacter::startTradeItemSession( uint16 session )
npcTellToPlayerEx ( bot - > getEntityRowId ( ) , _EntityRowId , txt ) ;
return ;
}
else if ( bot - > getOrganization ( ) ! = 0 & & bot - > getOrganization ( ) = = getOrganization ( ) )
fame = 0 ;
float fameFactor = 1.0f ;
@ -9213,8 +9219,7 @@ void CCharacter::startTradePhrases(uint16 session)
{
nlwarning ( " fame %u is INVALID " , ( uint ) bot - > getRace ( ) ) ;
}
if ( ( bot - > getOrganization ( ) = = 0 & & fame < MinFameToTrade ) | | ( bot - > getOrganization ( ) ! = 0 & & bot - > getOrganization ( ) ! = getOrganization ( ) ) )
if ( fame < MinFameToTrade )
{
SM_STATIC_PARAMS_1 ( params , STRING_MANAGER : : bot ) ;
params [ 0 ] . setEIdAIAlias ( _CurrentInterlocutor , CAIAliasTranslator : : getInstance ( ) - > getAIAlias ( _CurrentInterlocutor ) ) ;
@ -9942,7 +9947,11 @@ bool CCharacter::queryItemPrice( const CGameItemPtr item, uint32& price )
quality = theItem - > quality ( ) ;
if ( theItem - > maxDurability ( ) )
wornFactor = float ( theItem - > durability ( ) ) / float ( theItem - > maxDurability ( ) ) ;
# ifdef RYZOM_FORGE
price = ( uint32 ) ( CShopTypeManager : : computeBasePrice ( theItem , quality ) * wornFactor * 0.02 ) ;
# else
price = ( uint32 ) ( CShopTypeManager : : computeBasePrice ( theItem , quality ) * wornFactor ) ;
# endif
return true ;
}
@ -9984,7 +9993,7 @@ void CCharacter::sellItem( INVENTORIES::TInventory inv, uint32 slot, uint32 quan
fame = MinFameToTrade ;
}
if ( ( bot - > getOrganization ( ) = = 0 & & fame < MinFameToTrade ) | | ( bot - > getOrganization ( ) ! = 0 & & bot - > getOrganization ( ) ! = getOrganization ( ) ) )
else if ( fame < MinFameToTrade )
{
SM_STATIC_PARAMS_1 ( params , STRING_MANAGER : : bot ) ;
params [ 0 ] . setEIdAIAlias ( _CurrentInterlocutor , CAIAliasTranslator : : getInstance ( ) - > getAIAlias ( _CurrentInterlocutor ) ) ;
@ -9996,8 +10005,6 @@ void CCharacter::sellItem( INVENTORIES::TInventory inv, uint32 slot, uint32 quan
return ;
}
else if ( bot - > getOrganization ( ) ! = 0 & & bot - > getOrganization ( ) = = getOrganization ( ) )
fame = 0 ;
CInventoryPtr child = _Inventory [ inv ] ;
if ( child - > getSlotCount ( ) > slot & & child - > getItem ( slot ) ! = NULL )
@ -10033,13 +10040,6 @@ void CCharacter::sellItem( INVENTORIES::TInventory inv, uint32 slot, uint32 quan
return ;
}
// You cannot exchange genesis named items
if ( item - > getPhraseId ( ) . find ( " genesis_ " ) = = 0 )
{
nlwarning ( " Character %s tries to sell '%s' " , _Id . toString ( ) . c_str ( ) , item - > getPhraseId ( ) . c_str ( ) ) ;
return ;
}
if ( ! ITEMFAMILY : : isSellableByPlayer ( itemForm - > Family ) )
{
nlwarning ( " <CCharacter sellItem> character %s try to sell an unsealable item %s, must not permited by client " , _Id . toString ( ) . c_str ( ) , sheet . toString ( ) . c_str ( ) ) ;
@ -10342,7 +10342,7 @@ void CCharacter::initFactionPointDb()
}
}
# ifdef RYZOM_FORGE
//-----------------------------------------------
// setPvpPoint : set the number of pvp point
//
@ -10447,7 +10447,7 @@ void CCharacter::initOrganizationInfos()
CBankAccessor_PLR : : getUSER ( ) . getRRPS_LEVELS ( 2 ) . setVALUE ( _PropertyDatabase , _OrganizationStatus ) ;
CBankAccessor_PLR : : getUSER ( ) . getRRPS_LEVELS ( 3 ) . setVALUE ( _PropertyDatabase , _OrganizationPoints ) ;
}
# endif
//-----------------------------------------------------------------------------
void CCharacter : : sendFactionPointGainMessage ( PVP_CLAN : : TPVPClan clan , uint32 fpGain )
@ -11682,7 +11682,12 @@ void CCharacter::setBerserkFlag(bool isBerserk)
}
else
{
# ifdef RYZOM_FORGE
sint8 percentTmp = sint8 ( ( 127.0 * ( target - > getPhysScores ( ) . _PhysicalScores [ SCORES : : hit_points ] . Current ) ) / ( target - > getPhysScores ( ) . _PhysicalScores [ SCORES : : hit_points ] . Max ) ) ;
# else
// TODO: Find out why this was changed to 127?
sint8 percentTmp = sint8 ( ( 100.0 * ( target - > getPhysScores ( ) . _PhysicalScores [ SCORES : : hit_points ] . Current ) ) / ( target - > getPhysScores ( ) . _PhysicalScores [ SCORES : : hit_points ] . Max ) ) ;
# endif
if ( percentTmp < 0 )
percent = 0 ;
else
@ -12062,7 +12067,7 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis
bool processed = false ;
bool firstEvent = true ;
CGuild * guild = CGuildManager : : getInstance ( ) - > getGuildFromId ( _GuildId ) ;
CGuild * guild = NULL ;
while ( ! eventList . empty ( ) )
{
bool eventProcessed = false ;
@ -12086,6 +12091,7 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis
else
{
// We find the guild and each guild members and we instanciate the mission for them
guild = CGuildManager : : getInstance ( ) - > getGuildFromId ( _GuildId ) ;
if ( guild )
{
for ( std : : map < EGSPD : : TCharacterId , EGSPD : : CGuildMemberPD * > : : iterator it = guild - > getMembersBegin ( ) ;
@ -12867,7 +12873,7 @@ void CCharacter::updateSavedMissions()
TVectorParamCheck params ( 1 ) ;
sint32 x = 0 ;
sint32 y = 0 ;
string msg ;
const char * msg ;
CCreature * c = CreatureManager . getCreature ( CAIAliasTranslator : : getInstance ( ) - > getEntityId ( ( * itCompass ) . second . getBotId ( ) ) ) ;
if ( c )
{
@ -13126,7 +13132,7 @@ void CCharacter::registerName(const ucstring &newName)
CMessage msgName ( " CHARACTER_NAME_LANG " ) ;
msgName . serial ( _EntityRowId ) ;
string sTitle = getFullTitle( ) ;
string sTitle = CHARACTER_TITLE: : toString ( _Title ) ;
ucstring RegisteredName ;
if ( newName . empty ( ) )
RegisteredName = getName ( ) + string ( " $ " ) + sTitle + string ( " $ " ) ;
@ -13300,6 +13306,7 @@ void CCharacter::setPlaces(const std::vector<const CPlace*> & places)
}
}
# ifdef RYZOM_FORGE
//-----------------------------------------------
// isSpawnValid
//-----------------------------------------------
@ -13359,6 +13366,7 @@ bool CCharacter::isSpawnValid(bool inVillage, bool inOutpost, bool inStable, boo
return true ;
}
# endif
//-----------------------------------------------
// memorize
@ -13887,6 +13895,7 @@ uint16 CCharacter::getFirstFreeSlotInKnownPhrase()
return ( uint16 ) _KnownPhrases . size ( ) - 1 ;
} // getFirstFreeSlotInKnownPhrase //
# ifdef RYZOM_FORGE
void CCharacter : : sendDynamicMessage ( const string & phrase , const string & message )
{
@ -13984,6 +13993,8 @@ string CCharacter::getCustomMissionText(const string &missionName)
return " " ;
}
# endif
# ifdef RYZOM_FORGE
// !!! Deprecated !!!
void CCharacter : : addWebCommandCheck ( const string & url , const string & data , const string & salt )
@ -14326,6 +14337,7 @@ bool CCharacter::pickUpRawMaterial( uint32 indexInTempInv, bool * lastMaterial )
// Send url for Arcc triggers
# ifdef RYZOM_FORGE
vector < string > params = getCustomMissionParams ( " __LOOT_SHEET__ " ) ;
if ( params . size ( ) > = 2 )
{
@ -14367,6 +14379,8 @@ bool CCharacter::pickUpRawMaterial( uint32 indexInTempInv, bool * lastMaterial )
}
}
}
# endif
// first slots are filled with loot items, quarter items are not in temp inv but only info in DB
uint32 rawMaterialIndex = indexInTempInv - creature - > getLootSlotCount ( ) ;
const CCreatureRawMaterial * mp = creature - > getCreatureRawMaterial ( rawMaterialIndex ) ;
@ -14592,15 +14606,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 ( ) , getAllegiance ( ) ) ; // TODO: Remove allegiance
CFameManager : : getInstance ( ) . setAndEnforceTribeFameCap ( getId ( ) , getAllegiance ( ) ) ; // TODO: Remove allegiance
}
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 ( ) , i ) ; // TODO: Remove allegiance
setFameValuePlayer ( i , fame , maxFame , 0 ) ;
}
}
@ -15242,7 +15256,7 @@ void CCharacter::syncContactListWithCharNameChanges(const std::vector<NLMISC::CE
sendContactListInit ( ) ;
}
# ifdef RYZOM_FORGE_ROOM
void CCharacter : : setInRoomOfPlayer ( const NLMISC : : CEntityId & id )
{
_inRoomOfPlayer = id ;
@ -15298,6 +15312,7 @@ void CCharacter::addRoomAccessToPlayer(const NLMISC::CEntityId &id)
uint32 playerId = PlayerManager . getPlayerId ( id ) ;
_RoomersList . push_back ( id ) ;
}
# endif
//--------------------------------------------------------------
// CCharacter::addPlayerToFriendList()
@ -15513,7 +15528,7 @@ void CCharacter::addPlayerToIgnoreList(const NLMISC::CEntityId &id)
// update ios state
uint32 playerId = PlayerManager . getPlayerId ( id ) ;
CPlayer * player = PlayerManager . getPlayer ( playerId ) ;
if ( ( ! player ) | | ( ! player - > havePriv ( " :SGM:GM:VG:SG:G: EM:EG: " ) ) ) // if online, messages from CSRs can't be ignored
if ( ( ! player ) | | ( ! player - > havePriv ( " :SGM:GM:VG:SG:G: " ) ) ) // if online, messages from CSRs can't be ignored
{
CEntityId senderId = getId ( ) ;
CEntityId ignoredId = id ;
@ -15584,6 +15599,7 @@ void CCharacter::removePlayerFromIgnoreListByIndex(uint16 index)
sendMessageViaMirror ( " IOS " , msgName ) ;
}
# ifdef RYZOM_FORGE_ROOM
//--------------------------------------------------------------
// CCharacter::removeRoomAccesToPlayer()
//--------------------------------------------------------------
@ -15619,6 +15635,7 @@ void CCharacter::removeRoomAccesToPlayer(const NLMISC::CEntityId &id, bool kick)
}
}
}
# endif
//--------------------------------------------------------------
// CCharacter::removePlayerFromFriendListByEntityId()
@ -16092,7 +16109,7 @@ void CCharacter::online(bool onlineStatus)
// if the character has a CSR grade, remove from all ignore lists
if ( onlineStatus & & ( ! _IsIgnoredBy . empty ( ) ) & & havePriv ( " :SGM:GM:VG:SG:G: EM:EG: " ) )
if ( onlineStatus & & ( ! _IsIgnoredBy . empty ( ) ) & & havePriv ( " :SGM:GM:VG:SG:G: " ) )
{
CMessage msgout ( " UNIGNORE_ALL " ) ;
msgout . serial ( _Id ) ;
@ -16282,13 +16299,16 @@ void CCharacter::onConnection()
{
// Add all handledAIGroups for all missions of the player
spawnAllHandledAIGroup ( ) ;
// Add character to event channel if event occurs
CGameEventManager : : getInstance ( ) . addCharacterToChannelEvent ( this ) ;
// update for the unified entity locator
// U pdate for the unified entity locator
if ( IShardUnifierEvent : : getInstance ( ) ! = NULL )
{
IShardUnifierEvent : : getInstance ( ) - > charConnected ( _Id , getLastDisconnectionDate ( ) ) ;
}
// Notify PvP manager
CPVPManager2 : : getInstance ( ) - > playerConnects ( this ) ;
}
@ -17183,6 +17203,7 @@ void CCharacter::checkScoresValues( SCORES::TScores score, CHARACTERISTICS::TCha
sint32 base = ( _PhysCharacs . _PhysicalCharacteristics [ charac ] . Base + PhysicalCharacteristicsBaseValue ) * PhysicalCharacteristicsFactor + _ScorePermanentModifiers [ score ] ;
if ( _PhysScores . _PhysicalScores [ score ] . Base ! = base )
{
// TODO: What's this?
nlwarning ( " BADCHECK For player %s, for %s, player should have %u and he has %u ! " , _Id . toString ( ) . c_str ( ) , SCORES : : toString ( score ) . c_str ( ) , base , _PhysScores . _PhysicalScores [ score ] . Base ) ;
//vl _PhysScores._PhysicalScores[ score ].Base = base;
}
@ -17194,6 +17215,7 @@ void CCharacter::checkScoresValues( SCORES::TScores score, CHARACTERISTICS::TCha
baseRegenerateAction + = RegenOffset ;
if ( fabs ( ( _PhysScores . _PhysicalScores [ score ] . BaseRegenerateRepos * 100.0f ) - ( 100.0f * baseRegenerateRepos ) ) > 0.001 )
{
// TODO: What's this?
nlwarning ( " BADCHECK For player %s, for %s regen, player should have %f and he has %f ! " , _Id . toString ( ) . c_str ( ) , SCORES : : toString ( score ) . c_str ( ) , baseRegenerateRepos , _PhysScores . _PhysicalScores [ score ] . BaseRegenerateRepos ) ;
//vl _PhysScores._PhysicalScores[ score ].BaseRegenerateRepos = baseRegenerateRepos;
//vl _PhysScores._PhysicalScores[ score ].BaseRegenerateAction = baseRegenerateAction;
@ -17259,6 +17281,7 @@ void CCharacter::checkCharacAndScoresValues()
// compare
if ( _PhysCharacs . _PhysicalCharacteristics [ charac ] . Base ! = tvalue )
{
// TODO: What's this?
nlwarning ( " BADCHECK For player %s, for charac %s, player should have %u and he has %u ! " , _Id . toString ( ) . c_str ( ) , CHARACTERISTICS : : toString ( charac ) . c_str ( ) , tvalue , _PhysCharacs . _PhysicalCharacteristics [ charac ] . Base ) ;
//vl _PhysCharacs._PhysicalCharacteristics[charac].Base = tvalue;
@ -19466,7 +19489,7 @@ void CCharacter::setStartupInstance(uint32 instanceId)
void CCharacter : : setTitle ( CHARACTER_TITLE : : ECharacterTitle title )
{
setNewTitle( CHARACTER_TITLE : : toString ( title ) ) ;
_Title = title ;
}