Merge stuff from atys branch

ryzomclassic-develop
kaetemi 3 years ago
parent 6a79a5bf0f
commit 678d888b5c
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -429,6 +429,9 @@ CCharacter::CCharacter(): CEntityBase(false),
#ifdef RYZOM_FORGE #ifdef RYZOM_FORGE
_PvpPoint = 0; _PvpPoint = 0;
_GuildPoints = 0;
_TodayGuildPoints = 0;
_NextTodayGuildPointsReset = 0;
#endif #endif
_PVPFlagLastTimeChange = 0; _PVPFlagLastTimeChange = 0;
@ -441,6 +444,8 @@ CCharacter::CCharacter(): CEntityBase(false),
_Organization = 0; _Organization = 0;
_OrganizationStatus = 0; _OrganizationStatus = 0;
_OrganizationPoints = 0; _OrganizationPoints = 0;
// refill pact automatically
_doPact = false;
#endif #endif
// do not start berserk // do not start berserk
@ -1272,6 +1277,24 @@ uint32 CCharacter::tickUpdate()
// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.PLAYER_LEVEL, skillBaseValue ); // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.PLAYER_LEVEL, skillBaseValue );
CBankAccessor_PLR::getTARGET().getBARS().setPLAYER_LEVEL(_PropertyDatabase, checkedCast<uint8>(skillBaseValue) ); CBankAccessor_PLR::getTARGET().getBARS().setPLAYER_LEVEL(_PropertyDatabase, checkedCast<uint8>(skillBaseValue) );
} }
#ifdef RYZOM_FORGE
else
{
CCreature *creature = dynamic_cast<CCreature *>(target);
if (creature)
{
if (creature->getLockLoot() != CTEAM::InvalidTeamId)
{
if (creature->getLockLoot() == _TeamId)
CBankAccessor_PLR::getTARGET().getBARS().setPLAYER_LEVEL(_PropertyDatabase, 2);
else
CBankAccessor_PLR::getTARGET().getBARS().setPLAYER_LEVEL(_PropertyDatabase, 1);
}
else
CBankAccessor_PLR::getTARGET().getBARS().setPLAYER_LEVEL(_PropertyDatabase, 0);
}
}
#endif
if( !checkCharacterStillValide("<CCharacter::tickUpdate> Character corrupted : after update target HP/STA/SAP !!!") ) if( !checkCharacterStillValide("<CCharacter::tickUpdate> Character corrupted : after update target HP/STA/SAP !!!") )
return (uint32)-1; return (uint32)-1;
@ -1386,7 +1409,8 @@ uint32 CCharacter::tickUpdate()
if ( _LastTickNpcControlUpdated + TickFrequencyNpcControlUpdate.get() <= CTickEventHandler::getGameCycle() ) if ( _LastTickNpcControlUpdated + TickFrequencyNpcControlUpdate.get() <= CTickEventHandler::getGameCycle() )
{ {
// _LastTickNpcControlUpdated = CTickEventHandler::getGameCycle(); is done in setNpcControl // _LastTickNpcControlUpdated = CTickEventHandler::getGameCycle(); is done in setNpcControl
{ // Update npc control {
// Update npc control
setNpcControl(_NpcControlEid); setNpcControl(_NpcControlEid);
} }
} }
@ -1544,10 +1568,10 @@ uint32 CCharacter::tickUpdate()
} }
uint32 nextUpdate = 16; uint32 nextUpdate = 16;
if( oldHp != _PhysScores._PhysicalScores[ SCORES::hit_points ].Current || if (oldHp != _PhysScores._PhysicalScores[SCORES::hit_points].Current
oldSta != _PhysScores._PhysicalScores[ SCORES::stamina].Current || || oldSta != _PhysScores._PhysicalScores[SCORES::stamina].Current
oldSap != _PhysScores._PhysicalScores[ SCORES::sap ].Current || || oldSap != _PhysScores._PhysicalScores[SCORES::sap].Current
oldFocus != _PhysScores._PhysicalScores[ SCORES::focus].Current ) || oldFocus != _PhysScores._PhysicalScores[SCORES::focus].Current)
{ {
nextUpdate = 8; nextUpdate = 8;
} }
@ -3741,17 +3765,10 @@ void CCharacter::setTargetBotchatProgramm( CEntityBase * target, const CEntityId
// send the web page url // send the web page url
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal); SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
string url = c->getWebPage();
#ifdef RYZOM_FORGE #ifdef RYZOM_FORGE
// add ? or & with params[0].Literal = c->getWebPage();
if ( url.find('?') == string::npos ) #else
url += NLMISC::toString("?urlidx=%d", getUrlIndex()); string url = c->getWebPage();
else
url += NLMISC::toString("&urlidx=%d", getUrlIndex());
setUrlIndex(getUrlIndex()+1);
#endif
url += "&player_eid="+getId().toString(); url += "&player_eid="+getId().toString();
@ -3763,7 +3780,8 @@ void CCharacter::setTargetBotchatProgramm( CEntityBase * target, const CEntityId
nlinfo(url.c_str()); nlinfo(url.c_str());
string control = "&hmac="+NLMISC::getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString(); string control = "&hmac="+NLMISC::getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString();
params[0].Literal= url+control; params[0].Literal = url + control;
#endif
text = STRING_MANAGER::sendStringToClient(_EntityRowId, "LITERAL", params ); text = STRING_MANAGER::sendStringToClient(_EntityRowId, "LITERAL", params );
// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:WEB_PAGE_URL" , text ); // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:WEB_PAGE_URL" , text );
@ -6891,7 +6909,43 @@ void CCharacter::sendAnimalCommand( uint8 petIndexCode, uint8 command )
} }
#ifdef RYZOM_FORGE_PET_NAME #ifdef RYZOM_FORGE_PET_NAME
void CCharacter::setAnimalName( uint8 petIndex, ucstring customName ) void CCharacter::setAnimalSheetId(uint8 petIndex, CSheetId sheetId)
{
if (petIndex < 0 || petIndex >= MAX_INVENTORY_ANIMAL)
{
nlwarning("<CCharacter::setAnimalName> Incorect animal index '%d'.", petIndex);
return;
}
CPetAnimal &animal = _PlayerPets[petIndex];
animal.setSheetId(sheetId);
}
void CCharacter::setAnimalSize(uint8 petIndex, uint8 size)
{
if (petIndex < 0 || petIndex >= MAX_INVENTORY_ANIMAL)
{
nlwarning("<CCharacter::setAnimalName> Incorect animal index '%d'.", petIndex);
return;
}
CPetAnimal &animal = _PlayerPets[petIndex];
animal.setSize(size);
}
void CCharacter::setAnimalPosition(uint8 petIndex, sint32 x, sint32 y)
{
if (petIndex < 0 || petIndex >= MAX_INVENTORY_ANIMAL)
{
nlwarning("<CCharacter::setAnimalName> Incorect animal index '%d'.", petIndex);
return;
}
CPetAnimal &animal = _PlayerPets[petIndex];
animal.setPosition(x, y);
}
void CCharacter::setAnimalName(uint8 petIndex, ucstring customName)
{ {
if (petIndex < 0 || petIndex >= MAX_INVENTORY_ANIMAL) if (petIndex < 0 || petIndex >= MAX_INVENTORY_ANIMAL)
{ {
@ -6903,14 +6957,37 @@ void CCharacter::setAnimalName( uint8 petIndex, ucstring customName )
animal.setCustomName(customName); animal.setCustomName(customName);
sendPetCustomNameToClient(petIndex); sendPetCustomNameToClient(petIndex);
if ( ! customName.empty())
{
TDataSetRow row = animal.SpawnedPets; TDataSetRow row = animal.SpawnedPets;
NLNET::CMessage msgout("CHARACTER_NAME"); NLNET::CMessage msgout("CHARACTER_NAME");
msgout.serial(row); msgout.serial(row);
msgout.serial(customName); msgout.serial(customName);
sendMessageViaMirror("IOS", msgout); sendMessageViaMirror("IOS", msgout);
}
void CCharacter::setAnimalTitle(uint8 petIndex, string title)
{
if (petIndex < 0 || petIndex >= MAX_INVENTORY_ANIMAL)
{
nlwarning("<CCharacter::setAnimalName> Incorect animal index '%d'.", petIndex);
return;
}
CPetAnimal &animal = _PlayerPets[petIndex];
string name = animal.getCustomName().toUtf8();
if (name.find('$') != string::npos)
{
name = name.substr(0, name.find('$'));
} }
ucstring customName;
customName.fromUtf8(name + "$" + title);
animal.setCustomName(customName);
sendPetCustomNameToClient(petIndex);
TDataSetRow row = animal.SpawnedPets;
NLNET::CMessage msgout("CHARACTER_NAME");
msgout.serial(row);
msgout.serial(customName);
sendMessageViaMirror("IOS", msgout);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -6924,6 +7001,7 @@ void CCharacter::sendPetCustomNameToClient(uint8 petIndex)
uint32 userId = PlayerManager.getPlayerId(_Id); uint32 userId = PlayerManager.getPlayerId(_Id);
textId = STRING_MANAGER::sendStringToUser(userId, "LITERAL", params); textId = STRING_MANAGER::sendStringToUser(userId, "LITERAL", params);
} }
CBankAccessor_PLR::getPACK_ANIMAL().getBEAST(petIndex).setNAME(_PropertyDatabase, textId); CBankAccessor_PLR::getPACK_ANIMAL().getBEAST(petIndex).setNAME(_PropertyDatabase, textId);
} }
#endif #endif
@ -10257,7 +10335,8 @@ void CCharacter::spendMoney( const uint64 & price )
setMoney(0); setMoney(0);
else else
setMoney(_Money - price); setMoney(_Money - price);
// _PropertyDatabase.setProp( "INVENTORY:MONEY", _Money );
// _PropertyDatabase.setProp( "INVENTORY:MONEY", _Money );
} // spend // } // spend //
@ -10390,7 +10469,20 @@ void CCharacter::setNewTitle(const string &title) {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CCharacter::setTagPvPA(const string &tag) { void CCharacter::setTagA(const string &tag)
{
_TagA = tag;
}
//-----------------------------------------------------------------------------
void CCharacter::setTagB(const string &tag)
{
_TagB = tag;
}
//-----------------------------------------------------------------------------
void CCharacter::setTagPvPA(const string &tag)
{
_TagPvPA = tag; _TagPvPA = tag;
} }
@ -10400,13 +10492,170 @@ void CCharacter::setTagPvPB(const string &tag) {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CCharacter::setTagA(const string &tag) { void CCharacter::setDontTranslate(const string &langs)
_TagA = tag; {
_DontTranslate = langs;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CCharacter::setTagB(const string &tag) { CSBrickParamJewelAttrs CCharacter::getJewelAttrs(const string &attribute, SLOT_EQUIPMENT::TSlotEquipment slot, CSheetId &usedSheet)
_TagB = tag; {
string contName;
string regionName;
const CRegion *region = NULL;
const CContinent *cont = NULL;
CZoneManager::getInstance().getRegion(getState().X, getState().Y, &region, &cont);
if (region)
regionName = region->getName();
if (cont)
contName = cont->getName();
CSBrickParamJewelAttrs returnSBrickParam;
CSBrickParamJewelAttrs *boostSBrickParam = NULL;
CInventoryPtr inv = getInventory(INVENTORIES::equipment);
if (inv)
{
if (slot == SLOT_EQUIPMENT::UNDEFINED)
{
for (uint8 s = 0; s < SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT; ++s)
{
const CGameItemPtr item = inv->getItem(s);
if (item != NULL)
{
vector<CSheetId> enchant = item->getEnchantment();
for (uint i = 0; i < enchant.size(); i++)
{
const CStaticBrick *brick = CSheets::getSBrickForm(enchant[i]);
if (brick && brick->Family == BRICK_FAMILIES::BSGMCB)
{
if (brick->Params.size() > 0)
{
const TBrickParam::IId *param = brick->Params[0];
boostSBrickParam = (CSBrickParamJewelAttrs *)param;
}
}
else if (brick && brick->Family == BRICK_FAMILIES::BSGMC)
{
if (brick->Params.size() > 0)
{
const TBrickParam::IId *param = brick->Params[0];
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs *)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute)
{
bool valid = true;
// Check required fame (if no required faction, check are ok)
if (!checkRequiredFame(sbrickParam->RequiredFaction, sbrickParam->RequiredFame))
valid = false;
// Require a faction/nation/org only for fame up to 30
else if (sbrickParam->RequiredFame >= 30 && !checkRequiredFaction(sbrickParam->RequiredFaction))
valid = false;
if (!sbrickParam->RequiredZones.empty())
{
bool zoneValid = false;
vector<string> zones;
NLMISC::splitString(sbrickParam->RequiredZones, ",", zones);
for (uint z = 0; z < zones.size(); z++)
{
if (zones[z] == contName || zones[z] == regionName)
zoneValid = true;
}
if (!zoneValid)
valid = false;
}
if (valid)
{
usedSheet = enchant[i];
returnSBrickParam.copy(*sbrickParam);
}
}
}
}
}
}
}
}
else
{
const CGameItemPtr item = inv->getItem(slot);
if (item != NULL)
{
vector<CSheetId> enchant = item->getEnchantment();
for (uint i = 0; i < enchant.size(); i++)
{
const CStaticBrick *brick = CSheets::getSBrickForm(enchant[i]);
if (brick && brick->Family == BRICK_FAMILIES::BSGMCB)
{
if (brick->Params.size() > 0)
{
const TBrickParam::IId *param = brick->Params[0];
boostSBrickParam = (CSBrickParamJewelAttrs *)param;
}
}
else if (brick && brick->Family == BRICK_FAMILIES::BSGMC)
{
if (brick->Params.size() > 0)
{
const TBrickParam::IId *param = brick->Params[0];
CSBrickParamJewelAttrs *sbrickParam = (CSBrickParamJewelAttrs *)param;
if (param->id() == TBrickParam::JEWEL_ATTRS && sbrickParam->Attribute == attribute)
{
bool valid = true;
// Check required fame (if no required faction, check are ok)
if (!checkRequiredFame(sbrickParam->RequiredFaction, sbrickParam->RequiredFame))
{
valid = false;
}
else if (sbrickParam->RequiredFame >= 30 && !checkRequiredFaction(sbrickParam->RequiredFaction))
{
valid = false;
}
if (!sbrickParam->RequiredZones.empty())
{
bool zoneValid = false;
vector<string> zones;
NLMISC::splitString(sbrickParam->RequiredZones, ",", zones);
for (uint z = 0; z < zones.size(); z++)
{
if (zones[z] == contName || zones[z] == regionName)
{
zoneValid = true;
}
}
if (!zoneValid)
{
valid = false;
}
}
if (valid)
{
usedSheet = enchant[i];
returnSBrickParam.copy(*sbrickParam);
}
}
}
}
}
}
}
}
if (boostSBrickParam)
returnSBrickParam.Modifier *= boostSBrickParam->Modifier;
return returnSBrickParam;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -10414,12 +10663,28 @@ void CCharacter::setOrganization(uint32 org)
{ {
if (org == _Organization) if (org == _Organization)
return; return;
_Organization = org; _Organization = org;
_OrganizationStatus = 0; _OrganizationStatus = 0;
_OrganizationPoints = 0; _OrganizationPoints = 0;
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(1).setVALUE(_PropertyDatabase, _Organization ); CBankAccessor_PLR::getUSER().getRRPS_LEVELS(1).setVALUE(_PropertyDatabase, _Organization);
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(2).setVALUE(_PropertyDatabase, _OrganizationStatus ); CBankAccessor_PLR::getUSER().getRRPS_LEVELS(2).setVALUE(_PropertyDatabase, _OrganizationStatus);
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(3).setVALUE(_PropertyDatabase, _OrganizationPoints ); CBankAccessor_PLR::getUSER().getRRPS_LEVELS(3).setVALUE(_PropertyDatabase, _OrganizationPoints);
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());
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -10436,7 +10701,8 @@ void CCharacter::changeOrganizationStatus(sint32 status)
_OrganizationStatus = 0; _OrganizationStatus = 0;
else else
_OrganizationStatus += status; _OrganizationStatus += status;
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(2).setVALUE(_PropertyDatabase, _OrganizationStatus );
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(2).setVALUE(_PropertyDatabase, _OrganizationStatus);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -10446,7 +10712,8 @@ void CCharacter::changeOrganizationPoints(sint32 points)
_OrganizationPoints = 0; _OrganizationPoints = 0;
else else
_OrganizationPoints += points; _OrganizationPoints += points;
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(3).setVALUE(_PropertyDatabase, _OrganizationPoints );
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(3).setVALUE(_PropertyDatabase, _OrganizationPoints);
} }
@ -12077,8 +12344,8 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis
bool processed = false; bool processed = false;
bool firstEvent = true; bool firstEvent = true;
CGuild *guild = NULL; CGuild *guild = CGuildManager::getInstance()->getGuildFromId(_GuildId);
while ( !eventList.empty() ) while (!eventList.empty())
{ {
bool eventProcessed = false; bool eventProcessed = false;
CMissionEvent & event = *(*eventList.begin()); CMissionEvent & event = *(*eventList.begin());
@ -12101,7 +12368,6 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis
else else
{ {
// We find the guild and each guild members and we instanciate the mission for them // We find the guild and each guild members and we instanciate the mission for them
guild = CGuildManager::getInstance()->getGuildFromId(_GuildId);
if (guild) if (guild)
{ {
for ( std::map<EGSPD::TCharacterId, EGSPD::CGuildMemberPD*>::iterator it = guild->getMembersBegin(); for ( std::map<EGSPD::TCharacterId, EGSPD::CGuildMemberPD*>::iterator it = guild->getMembersBegin();
@ -13322,23 +13588,16 @@ void CCharacter::setPlaces(const std::vector<const CPlace*> & places)
//----------------------------------------------- //-----------------------------------------------
bool CCharacter::isSpawnValid(bool inVillage, bool inOutpost, bool inStable, bool inAtys) bool CCharacter::isSpawnValid(bool inVillage, bool inOutpost, bool inStable, bool inAtys)
{ {
if (inVillage)
nlinfo("inVillage");
if (inOutpost)
nlinfo("inOutpost");
if (inStable)
nlinfo("inStable");
if (inAtys)
nlinfo("inAtys");
const uint size = (uint)_Places.size(); const uint size = (uint)_Places.size();
for ( uint i = 0; i < size; i++ )
for (uint i = 0; i < size; i++)
{ {
CPlace * p = CZoneManager::getInstance().getPlaceFromId( _Places[i] ); CPlace *p = CZoneManager::getInstance().getPlaceFromId(_Places[i]);
if (p) if (p)
{ {
PLACE_TYPE::TPlaceType place_type = p->getPlaceType(); PLACE_TYPE::TPlaceType place_type = p->getPlaceType();
nlinfo("Place type = %s", PLACE_TYPE::toString(p->getPlaceType()).c_str());
if (!inVillage && (place_type == PLACE_TYPE::Village || place_type == PLACE_TYPE::Capital)) if (!inVillage && (place_type == PLACE_TYPE::Village || place_type == PLACE_TYPE::Capital))
{ {
CCharacter::sendDynamicSystemMessage( _EntityRowId, "NO_ACTION_IN_VILLAGE" ); CCharacter::sendDynamicSystemMessage( _EntityRowId, "NO_ACTION_IN_VILLAGE" );
@ -13346,6 +13605,7 @@ bool CCharacter::isSpawnValid(bool inVillage, bool inOutpost, bool inStable, boo
} }
TAIAlias outpostAlias = getOutpostAlias(); TAIAlias outpostAlias = getOutpostAlias();
if (!inOutpost && outpostAlias != 0) if (!inOutpost && outpostAlias != 0)
{ {
CSmartPtr<COutpost> outpost = COutpostManager::getInstance().getOutpostFromAlias( outpostAlias ); CSmartPtr<COutpost> outpost = COutpostManager::getInstance().getOutpostFromAlias( outpostAlias );
@ -13921,27 +14181,45 @@ void CCharacter::sendDynamicMessage(const string &phrase, const string &message)
PHRASE_UTILITIES::sendDynamicSystemMessage( _EntityRowId, phrase, messageParams ); PHRASE_UTILITIES::sendDynamicSystemMessage( _EntityRowId, phrase, messageParams );
} }
void CCharacter::sendUrl(const string &url)
void CCharacter::sendUrl(const string &url, const string &salt)
{ {
string control; string control;
if (!salt.empty()) string salt = toString(getLastConnectedDate()) + ArkSalt.get();
string playerPos = getPositionInfos();
while (strFindReplace(playerPos, " ", "%20"))
;
string targetInfos = getTargetInfos();
string serverInfos = getServerInfos(getState().X / 1000., getState().Y / 1000.);
while (strFindReplace(targetInfos, " ", "%20"))
;
string final_url;
if (url.find("$(") != string::npos)
{ {
control = "&hmac="+NLMISC::getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString(); final_url = url;
strFindReplace(final_url, "$(pos)", playerPos);
strFindReplace(final_url, "$(target)", targetInfos);
strFindReplace(final_url, "$(server)", serverInfos);
strFindReplace(final_url, "$(hands)", getEquipementInfos(INVENTORIES::handling));
strFindReplace(final_url, "$(equiped)", getEquipementInfos(INVENTORIES::equipment));
final_url += toString("&urlidx=%d", getUrlIndex());
} }
else else
{ {
string defaultSalt = toString(getLastConnectedDate()); final_url = url + toString("&urlidx=%d", getUrlIndex()) + "&player_pos=" + playerPos + "&target_infos=" + targetInfos + "&server_infos=" + serverInfos;
control = "&hmac="+NLMISC::getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString();
} }
nlinfo(url.c_str()); while (strFindReplace(final_url, "#", "%23"))
;
while (strFindReplace(final_url, "$", "%24"))
;
uint32 userId = PlayerManager.getPlayerId(getId()); control = "&hmac=" + getHMacSHA1((uint8 *)&final_url[0], (uint32)final_url.size(), (uint8 *)&salt[0], (uint32)salt.size()).toString();
uint32 userId = PlayerManager.getPlayerId(getId());
SM_STATIC_PARAMS_1(textParams, STRING_MANAGER::literal); SM_STATIC_PARAMS_1(textParams, STRING_MANAGER::literal);
textParams[0].Literal= "WEB : "+url+control; textParams[0].Literal = "WEB : " + final_url + control;
nlinfo("URL: %s", final_url.c_str());
TVectorParamCheck titleParams; TVectorParamCheck titleParams;
uint32 titleId = STRING_MANAGER::sendStringToUser(userId, "web_transactions", titleParams); uint32 titleId = STRING_MANAGER::sendStringToUser(userId, "web_transactions", titleParams);
uint32 textId = STRING_MANAGER::sendStringToClient(_EntityRowId, "LITERAL", textParams ); uint32 textId = STRING_MANAGER::sendStringToClient(_EntityRowId, "LITERAL", textParams );
@ -13950,7 +14228,7 @@ void CCharacter::sendUrl(const string &url, const string &salt)
void CCharacter::validateDynamicMissionStep(const string &url) void CCharacter::validateDynamicMissionStep(const string &url)
{ {
sendUrl(url+"&player_eid="+getId().toString()+"&event=mission_step_finished", getSalt()); sendUrl(url + "&player_eid=" + getId().toString() + "&event=mission_step_finished");
} }
/// set custom mission param /// set custom mission param
@ -13975,11 +14253,6 @@ void CCharacter::addCustomMissionParam(const string &missionName, const string &
vector<string> CCharacter::getCustomMissionParams(const string &missionName) vector<string> CCharacter::getCustomMissionParams(const string &missionName)
{ {
vector<string> params; vector<string> params;
if (_CustomMissionsParams.empty())
{
return params;
}
if (!_CustomMissionsParams.empty() && _CustomMissionsParams.find(missionName) != _CustomMissionsParams.end()) if (!_CustomMissionsParams.empty() && _CustomMissionsParams.find(missionName) != _CustomMissionsParams.end())
{ {
if (!_CustomMissionsParams[missionName].empty()) if (!_CustomMissionsParams[missionName].empty())
@ -14003,9 +14276,53 @@ string CCharacter::getCustomMissionText(const string &missionName)
return ""; return "";
} }
#endif /// add Ark position check
void CCharacter::addPositionCheck(sint32 x, sint32 y, uint32 r, const std::string &name, bool use_compass)
{
if (x == 0 && y == 0)
{
for (vector<SCheckPosCoordinate>::iterator it = _CheckPos.begin(); it != _CheckPos.end();)
{
if ((*it).Name == name)
it = _CheckPos.erase(it);
else
++it;
}
#ifdef RYZOM_FORGE return;
}
SCheckPosCoordinate poscheck;
poscheck.X = x;
poscheck.Y = y;
poscheck.Radius = r;
poscheck.Name = name;
_CheckPos.push_back(poscheck);
}
/// get Ark position check
void CCharacter::getPositionCheck(const string &name, sint32 &x, sint32 &y, string &textName)
{
x = 0;
y = 0;
textName = "EMPTY";
for (vector<SCheckPosCoordinate>::iterator it = _CheckPos.begin(); it != _CheckPos.end();)
{
if ((*it).Name == name)
{
textName = getCustomMissionText((*it).Name + "_COMPASS_TEXT");
if (!textName.empty())
{
x = (*it).X;
y = (*it).Y;
}
}
++it;
}
}
// !!! Deprecated !!! // !!! Deprecated !!!
void CCharacter::addWebCommandCheck(const string &url, const string &data, const string &salt) void CCharacter::addWebCommandCheck(const string &url, const string &data, const string &salt)
{ {
@ -14028,7 +14345,7 @@ void CCharacter::addWebCommandCheck(const string &url, const string &data, const
item->setCustomText(ucstring(url)); item->setCustomText(ucstring(url));
vector<string> infos; vector<string> infos;
NLMISC::splitString(url, "\n", infos); NLMISC::splitString(url, "\n", infos);
sendUrl(infos[0]+"&player_eid="+getId().toString()+"&event=command_added", salt); sendUrl(infos[0] + "&player_eid=" + getId().toString() + "&event=command_added");
} }
else else
{ {
@ -14039,8 +14356,8 @@ void CCharacter::addWebCommandCheck(const string &url, const string &data, const
{ {
finalData += ","+randomString+infos[i]; finalData += ","+randomString+infos[i];
} }
item->setCustomText(ucstring(url+"\n"+finalData)); item->setCustomText(ucstring(url + "\n" + finalData));
sendUrl(url+"&player_eid="+getId().toString()+"&event=command_added&transaction_id="+randomString, salt); sendUrl(url + "&player_eid=" + getId().toString() + "&event=command_added&transaction_id=" + randomString);
} }
} }
} }
@ -14062,7 +14379,7 @@ void CCharacter::addWebCommandCheck(const string &url, const string &data, const
NLMISC::splitString(cText, "\n", infos); NLMISC::splitString(cText, "\n", infos);
vector<string> datas; vector<string> datas;
NLMISC::splitString(infos[1], ",", datas); NLMISC::splitString(infos[1], ",", datas);
sendUrl(infos[0]+"&player_eid="+getId().toString()+"&event=command_added&transaction_id="+datas[0].substr(0, 8), salt); sendUrl(infos[0] + "&player_eid=" + getId().toString() + "&event=command_added&transaction_id=" + datas[0].substr(0, 8));
} }
} }
} }
@ -15294,6 +15611,26 @@ const NLMISC::CEntityId& CCharacter::getInRoomOfPlayer()
return _inRoomOfPlayer; return _inRoomOfPlayer;
} }
void CCharacter::setPowoCell(sint32 cell)
{
_PowoCell = cell;
}
void CCharacter::setPowoScope(const string &scope)
{
_PowoScope = scope;
}
sint32 CCharacter::getPowoCell() const
{
return _PowoCell;
}
const string &CCharacter::getPowoScope() const
{
return _PowoScope;
}
//-------------------------------------------------------------- //--------------------------------------------------------------
// CCharacter::havePlayerRoomAccess // CCharacter::havePlayerRoomAccess
//-------------------------------------------------------------- //--------------------------------------------------------------
@ -15649,16 +15986,26 @@ void CCharacter::removeRoomAccesToPlayer(const NLMISC::CEntityId &id, bool kick)
if (kick & (target->getInRoomOfPlayer().getShortId() == getId().getShortId())) if (kick & (target->getInRoomOfPlayer().getShortId() == getId().getShortId()))
{ {
target->setInRoomOfPlayer(CEntityId::Unknown); target->setInRoomOfPlayer(CEntityId::Unknown);
if (!TheDataset.isAccessible(getEntityRowId())) if (!TheDataset.isAccessible(getEntityRowId()))
return; return;
const CTpSpawnZone * zone = CZoneManager::getInstance().getTpSpawnZone(target->getBuildingExitZone()); CVector buildingExitPos = target->getBuildingExitPos();
if (buildingExitPos.x != 0 && buildingExitPos.y != 0)
{
target->tpWanted(buildingExitPos.x, buildingExitPos.y, 0);
target->setBuildingExitPos(0, 0, 0);
}
else
{
const CTpSpawnZone *zone = CZoneManager::getInstance().getTpSpawnZone(target->getBuildingExitZone());
if (zone) if (zone)
{ {
sint32 x,y,z; sint32 x, y, z;
float heading; float heading;
zone->getRandomPoint(x,y,z,heading); zone->getRandomPoint(x, y, z, heading);
target->tpWanted(x,y,z,true,heading); target->tpWanted(x, y, z, true, heading);
}
} }
} }
} }

Loading…
Cancel
Save