Sync with Forge server, rev fa044821f36dfdd47986c32a1357fc028984b385

feature/prepare-cross-merge
kaetemi 3 years ago
parent 7873a839ef
commit a3a074f455
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -70,7 +70,7 @@ public:
/// Set the value of a var
const std::string &set(const std::string &var, const std::string &value)
{
std::pair<TVarMap::iterator, bool> res = _Map.insert(std::make_pair(var, value));
std::pair<TVarMap::iterator, bool> res = _Map.insert(std::make_pair<std::string, std::string>(var, value));
if (!res.second)
(*(res.first)).second = value;
return (*(res.first)).second;

@ -95,7 +95,7 @@ public:
{
if (PrimZoneMap.find(primZone.getName()) == PrimZoneMap.end())
{
PrimZoneMap.insert(std::make_pair(primZone.getName(), primZone));
PrimZoneMap.insert(std::make_pair<std::string, NLLIGO::CPrimZone>(primZone.getName(), primZone));
nlinfo("Using PrimZone '%s'", primZone.getName().c_str());
}
else

@ -85,7 +85,8 @@ void CSpawnBot::setVisualPropertiesName()
// In ringshard we use npc with fauna sheet but we want to be enable to change theire name
if (! botRef.getFaunaBotUseBotName()) //false by default
// Ulu : Ring is dead but i keep this code below to prevent side effects. Just add a condition : always set the custom name if exists
if (! botRef.getFaunaBotUseBotName() && botRef.getCustomName().empty()) //getFaunaBotUseBotName is false by default
{
if (botRef.getSheet()->ForceDisplayCreatureName())
return;

@ -597,6 +597,9 @@ void CBotNpc::fillDescriptionMsg(RYMSG::TGenNpcDescMsg& msg) const
msg.getLootList().push_back(sheetRef);
}
if (_PrimAlias >= 900 && _PrimAlias <= 999) //Spawned bots
msg.getOptionalProperties().push_back("Name:"+getName());
CGroupNpc::TFactionAttackableSet const& factionAttackableAbove = grp().getFactionAttackableAbove();
FOREACHC(itFaction, CGroupNpc::TFactionAttackableSet, factionAttackableAbove)
msg.getOptionalProperties().push_back("FactionAttackableAbove:" + itFaction->first + ":" + NLMISC::toString(itFaction->second));

@ -376,6 +376,11 @@ void CSpawnGroup::checkRespawn()
// respawn if there is not too much dead .. (no more than one at each tick).
if (_BotsToRespawn.size()<=0)
return;
// Send url to EGS
std::string url = getUrl();
std::string actionName = getActionName();
CCreatureSetUrlMsg msg;
//FOREACH_NOINC(it, std::vector<CBotToSpawn>, _BotsToRespawn)
for(uint32 i = 0; i < _BotsToRespawn.size();)
@ -397,6 +402,11 @@ void CSpawnGroup::checkRespawn()
}
if (botPt->isSpawned() || botPt->reSpawn(false))
{
CSpawnBot* pbot = botPt->getSpawnObj();
if (pbot!=NULL)
{
msg.Entities.push_back(pbot->dataSetRow());
}
continue; // directly test the same it (the next in fact).
}
else
@ -406,6 +416,13 @@ void CSpawnGroup::checkRespawn()
}
++i;
}
if(url != "")
{
msg.ActionName = actionName;
msg.Url = url;
msg.send(egsString);
}
}

@ -153,6 +153,13 @@ public:
void setAggroMinimumFor(TDataSetRow const& bot, float aggro, bool forceReturnAggro, NLMISC::CSmartPtr<CAIPlace const> place = NLMISC::CSmartPtr<CAIPlace const>(NULL));
bool haveAggro() const;
bool haveAggroOrReturnPlace() const;
const std::string getActionName() const { return _ActionName; }
void setActionName(const std::string &name) { _ActionName = name; }
const std::string getUrl() const { return _Url; }
void setUrl(const std::string &url) { _Url = url; }
protected:
CProfilePtr _PunctualHoldMovingProfile;
@ -170,6 +177,9 @@ private:
CProfilePtr _MovingProfile;
CProfilePtr _ActivityProfile;
CProfilePtr _FightProfile;
std::string _ActionName;
std::string _Url;
};
//////////////////////////////////////////////////////////////////////////////

@ -1088,6 +1088,10 @@ void CGrpFauna::setType(TFaunaType type)
faction().removeProperties();
if (type==AITYPES::FaunaTypePredator)
faction().addProperty(AITYPES::CPropertyId("Predator"));
else if (type==AITYPES::FaunaTypeHerbivore)
faction().addProperty(AITYPES::CPropertyId("Herbivore"));
else if (type==AITYPES::FaunaTypePlant)
faction().addProperty(AITYPES::CPropertyId("Plant"));
_Type = type;
}

@ -1096,6 +1096,41 @@ void CGroupNpc::firstBotSpawned()
setFirstBotSpawned();
}
void CGroupNpc::setStateAlias(const std::string &state, uint32 alias)
{
TStatesToAlias::iterator it=_StatesToAlias.find(state);
if (it != _StatesToAlias.end())
it->second = alias;
else
_StatesToAlias.insert(make_pair(state, alias));
}
uint32 CGroupNpc::getStateAlias(const std::string &state)
{
TStatesToAlias::iterator it=_StatesToAlias.find(state);
if (it != _StatesToAlias.end())
return it->second;
return 0;
}
void CGroupNpc::setStateEventAlias(const std::string &stateEvent, uint32 alias)
{
TStatesToAlias::iterator it=_StateEventToAlias.find(stateEvent);
if (it != _StateEventToAlias.end())
it->second = alias;
else
_StateEventToAlias.insert(make_pair(stateEvent, alias));
}
uint32 CGroupNpc::getStateEventAlias(const std::string &state)
{
TStatesToAlias::iterator it=_StateEventToAlias.find(state);
if (it != _StateEventToAlias.end())
return it->second;
return 0;
}
void CGroupNpc::setColour(uint8 colour)
{
FOREACH(itBot, CCont<CBot>, bots())
@ -1116,26 +1151,26 @@ void CGroupNpc::setOutpostSide(OUTPOSTENUMS::TPVPSide side)
}
}
void CGroupNpc::setOutpostFactions(OUTPOSTENUMS::TPVPSide side)
void CGroupNpc::setOutpostFactions(const std::string &alias, OUTPOSTENUMS::TPVPSide side)
{
// Attack only the declared ennemies of the outpost
if (side == OUTPOSTENUMS::OutpostOwner)
{
// Bots factions
faction ().addProperty(NLMISC::toString("outpost:%s:bot_defender", getAliasString().c_str()));
friendFaction().addProperty(NLMISC::toString("outpost:%s:bot_defender", getAliasString().c_str()));
ennemyFaction().addProperty(NLMISC::toString("outpost:%s:bot_attacker", getAliasString().c_str()));
faction ().addProperty(NLMISC::toString("outpost:%s:bot_defender", alias.c_str()));
friendFaction().addProperty(NLMISC::toString("outpost:%s:bot_defender", alias.c_str()));
ennemyFaction().addProperty(NLMISC::toString("outpost:%s:bot_attacker", alias.c_str()));
// Players faction
ennemyFaction().addProperty(NLMISC::toString("outpost:%s:attacker", getAliasString().c_str()));
ennemyFaction().addProperty(NLMISC::toString("outpost:%s:attacker", alias.c_str()));
}
if (side == OUTPOSTENUMS::OutpostAttacker)
{
// Bots factions
faction ().addProperty(NLMISC::toString("outpost:%s:bot_attacker", getAliasString().c_str()));
friendFaction().addProperty(NLMISC::toString("outpost:%s:bot_attacker", getAliasString().c_str()));
ennemyFaction().addProperty(NLMISC::toString("outpost:%s:bot_defender", getAliasString().c_str()));
faction ().addProperty(NLMISC::toString("outpost:%s:bot_attacker", alias.c_str()));
friendFaction().addProperty(NLMISC::toString("outpost:%s:bot_attacker", alias.c_str()));
ennemyFaction().addProperty(NLMISC::toString("outpost:%s:bot_defender", alias.c_str()));
// Players faction
ennemyFaction().addProperty(NLMISC::toString("outpost:%s:defender", getAliasString().c_str()));
ennemyFaction().addProperty(NLMISC::toString("outpost:%s:defender", alias.c_str()));
}
}

@ -167,6 +167,15 @@ public:
bool botsAreNamed() { return _BotsAreNamed; }
void setBotsAreNamedFlag() { _BotsAreNamed = true; }
void clrBotsAreNamedFlag() { _BotsAreNamed = false; }
// States to Alias
void setStateAlias(const std::string &state, uint32 alias);
uint32 getStateAlias(const std::string &state);
// States Events to Alias
void setStateEventAlias(const std::string &stateEvent, uint32 alias);
uint32 getStateEventAlias(const std::string &stateEvent);
// Parameter management -------------------------------------
void clearParameters();
@ -227,11 +236,12 @@ public:
void setSpawnZone(const CNpcZone *zone) { _SpawnZone = zone; }
const CNpcZone *getSpawnZone() const { return _SpawnZone; }
void setColour(uint8 colour);
void setOutpostSide(OUTPOSTENUMS::TPVPSide side);
void setOutpostFactions(OUTPOSTENUMS::TPVPSide side);
void setOutpostFactions(std::string const& alias, OUTPOSTENUMS::TPVPSide side);
bool isRingGrp() const { return _RingGrp;}
private:
@ -251,7 +261,7 @@ private:
uint32 _RespawnTime;
/// Despawn time in ticks
uint32 _DespawnTime;
AITYPES::CPropertySetWithExtraList<TAllianceId> _faction;
@ -269,6 +279,9 @@ private:
TNamedEntityListenerList _namedEntityListeners;
typedef std::multimap<std::pair<std::string, std::string>, std::string> TNamedEntityListenerList2;
TNamedEntityListenerList2 _namedEntityListeners2;
typedef std::map <std::string, uint32> TStatesToAlias;
TStatesToAlias _StatesToAlias;
TStatesToAlias _StateEventToAlias;
struct SHandle
{

@ -1,9 +1,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2018-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -20,6 +17,7 @@
#include "stdpch.h"
#include "server_share/r2_vision.h"
#include "ai_instance.h"
#include "ais_actions.h"
#include "ai_player.h"
#include "ai_grp_npc.h"
@ -29,6 +27,8 @@
#include "ai_instance_inline.h"
#include "nel/ligo/primitive_utils.h"
#include "commands.h"
#include "messages.h"
@ -36,6 +36,10 @@ using namespace std;
using namespace NLMISC;
using namespace NLNET;
using namespace MULTI_LINE_FORMATER;
using namespace NLLIGO;
NLLIGO::CLigoConfig CAIInstance::_LigoConfig;
CAIInstance::CAIInstance(CAIS* owner)
: CChild<CAIS>(owner)
@ -212,6 +216,9 @@ void CAIInstance::initInstance(string const& continentName, uint32 instanceNumbe
_ContinentName = continentName;
_InstanceNumber = instanceNumber;
_LastSpawnAlias = (900 + _InstanceNumber) << LigoConfig.getDynamicAliasSize();
_LastStateAlias = 0;
sendInstanceInfoToEGS();
if (!EGSHasMirrorReady)
@ -288,13 +295,21 @@ void CAIInstance::addGroupInfo(CGroup* grp)
{
string const& name = grp->aliasTreeOwner()->getName();
uint32 alias = grp->aliasTreeOwner()->getAlias();
if (!name.empty())
_GroupFromNames[name].push_back(grp);
if (alias)
_GroupFromAlias[alias] = grp;
}
void CAIInstance::addGroupInfo(CGroup* grp, const string &name, uint32 alias)
{
if (!name.empty())
_GroupFromNames[name].push_back(grp);
if (alias)
_GroupFromAlias[alias] = grp;
}
void CAIInstance::removeGroupInfo(CGroup* grp, CAliasTreeOwner* grpAliasTreeOwner)
{
string const& name = grpAliasTreeOwner->getName();
@ -639,7 +654,7 @@ static CAIVector randomPos(double dispersionRadius)
{
return CAIVector(0., 0.);
}
static const uint32 maxLimit = std::numeric_limits<uint32>::max() >> 1;
const uint32 maxLimit = std::numeric_limits<uint32>::max() >> 1;
double rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[
double r = dispersionRadius*sqrt(rval);
rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[
@ -675,7 +690,10 @@ CGroupNpc* CAIInstance::eventCreateNpcGroup(uint nbBots, NLMISC::CSheetId const&
_EventNpcManager->groups().addAliasChild(grp);
// Set the group parameters
grp->setAutoSpawn(false);
grp->setName(NLMISC::toString("event_group_%u", grp->getChildIndex()));
string name = botsName.empty() ? NLMISC::toString("event_group_%u", grp->getChildIndex()):botsName;
grp->setName(name);
grp->clearParameters();
grp->setPlayerAttackable(true);
grp->setBotAttackable(true);
@ -684,15 +702,21 @@ CGroupNpc* CAIInstance::eventCreateNpcGroup(uint nbBots, NLMISC::CSheetId const&
grp->clrBotsAreNamedFlag();
addGroupInfo(grp, name, grp->getAlias());
{
// build unnamed bot
for (uint i=0; i<nbBots; ++i)
for (uint i=0; i<nbBots; ++i)
{
grp->bots().addChild(new CBotNpc(grp, 0, botsName.empty() ? grp->getName():botsName), i); // Doub: 0 instead of getAlias()+i otherwise aliases are wrong
_LastSpawnAlias++;
nlinfo("Spawn with alias : %d (%s)", _LastSpawnAlias, _LigoConfig.aliasToString(_LastSpawnAlias).c_str());
grp->bots().addChild(new CBotNpc(grp, _LastSpawnAlias, name), i); // Doub: 0 instead of getAlias()+i otherwise aliases are wrong
CBotNpc* const bot = NLMISC::safe_cast<CBotNpc*>(grp->bots()[i]);
bot->setSheet(sheet);
bot->setPrimAlias(900+_InstanceNumber);
if (!look.empty())
bot->setClientSheet(look);
bot->equipmentInit();
@ -744,6 +768,25 @@ CGroupNpc* CAIInstance::eventCreateNpcGroup(uint nbBots, NLMISC::CSheetId const&
destZone->setPosAndRadius(AITYPES::vp_auto, CAIPos(pos, 0, 0), (uint32)(dispersionRadius*1000.));
spawnGroup->movingProfile().setAIProfile(new CGrpProfileWanderNoPrim(spawnGroup, destZone));
if (!botsName.empty())
{
CStateMachine* sm = _EventNpcManager->getStateMachine();
uint32 stateAlias = grp->getStateAlias("start");
CAIStatePositional* statePositional;
if (stateAlias == 0)
{
_LastStateAlias++;
statePositional = new CAIStatePositional(sm, _LastStateAlias, "start");
grp->setStateAlias("start", statePositional->getAlias());
sm->states().addChild(statePositional);
}
else
{
statePositional = safe_cast<CAIStatePositional*>(sm->states().getChildByAlias(stateAlias));
}
grp->setNextState(statePositional);
}
if (spawnBots)
grp->getSpawnObj()->spawnBots();
@ -942,28 +985,27 @@ void cbEventNpcGroupScript( NLNET::CMessage& msgin, const std::string &serviceNa
if (firstCommand[0] == '(') // Old eventNpcGroupScript command : (boteid, commands...)
{
nlinfo("Event group script with %d strings :", nbString);
strings.resize(nbString);
strings[0] = eid;
nlinfo(" %d '%s'", 0, strings[0].c_str());
strings[1] = firstCommand;
nlinfo(" %d '%s'", 1, strings[1].c_str());
for (uint32 i=2; i<nbString-2; ++i)
{
msgin.serial(strings[i]);
nlinfo(" %d '%s'", i, strings[i].c_str());
}
}
else
{
nlinfo("Event group script with %d strings :", nbString-1);
CEntityId playerId(eid);
CEntityId playerId;
if (!eid.empty())
playerId = CEntityId(eid);
strings.resize(nbString-1);
NLMISC::CSString groupname = CSString(firstCommand);
CSString groupname = CSString(firstCommand);
if (firstCommand[0] == '#' && firstCommand[1] == '(')
{
NLMISC::CEntityId botEId = NLMISC::CEntityId(firstCommand.substr(1));
if (botEId==NLMISC::CEntityId::Unknown)
CEntityId botEId = CEntityId(firstCommand.substr(1));
if (botEId==CEntityId::Unknown)
return;
CAIEntityPhysical* entity = CAIEntityPhysicalLocator::getInstance()->getEntity(botEId);
CSpawnBotNpc* bot = dynamic_cast<CSpawnBotNpc*>(entity);
@ -976,13 +1018,14 @@ void cbEventNpcGroupScript( NLNET::CMessage& msgin, const std::string &serviceNa
}
else
{
strings[0] = (string)groupname.replace("#last", _PlayersLastCreatedNpcGroup[playerId].c_str());
if (!eid.empty())
strings[0] = (string)groupname.replace("#last", _PlayersLastCreatedNpcGroup[playerId].c_str());
else
strings[0] = (string)groupname;
}
nlinfo(" %d '%s'", 0, strings[0].c_str());
for (uint32 i=1; i<nbString-1; ++i)
{
msgin.serial(strings[i]);
nlinfo(" %d '%s'", i, strings[i].c_str());
}
}
scriptCommands2.push_back(strings);
@ -1569,5 +1612,3 @@ NLMISC_COMMAND(simulateMsgDespawnEasterEgg, "", "<service_id> <ai_instance> <eas
return true;
}
#include "event_reaction_include.h"

@ -1,9 +1,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -168,6 +165,7 @@ public:
//-------------------------------------------------------------------
// group name/alias retreiver
void addGroupInfo(CGroup* grp);
void addGroupInfo(CGroup* grp, const std::string &name, uint32 alias);
void removeGroupInfo(CGroup* grp, CAliasTreeOwner* grpAliasTreeOwner);
CGroup* findGroup(uint32 alias);
void findGroup(std::vector<CGroup*>& result, std::string const& name);
@ -190,7 +188,7 @@ public:
/// Store mapping 'name:variant' -> squad to be used later by getSquadByVariantName()
void registerSquadVariant(const std::string& nameAndVariant, CGroupDesc<COutpostSquadFamily> *squad )
{
if ( ! _SquadVariantNameToGroupDesc.insert( std::make_pair( NLMISC::toLowerAscii( nameAndVariant ), squad ) ).second )
if ( ! _SquadVariantNameToGroupDesc.insert( std::make_pair( NLMISC::toLower( nameAndVariant ), squad ) ).second )
nlwarning( "Duplicate squad template / squad variant '%s'", nameAndVariant.c_str() );
}
@ -203,7 +201,7 @@ public:
/// Get a squad by name:variant (works only during primitive parsing), or NULL if not found. Not case-sensitive.
CGroupDesc<COutpostSquadFamily> *getSquadByVariantName(const std::string& nameAndVariant)
{
std::map<std::string, NLMISC::CSmartPtr< CGroupDesc<COutpostSquadFamily> > >::iterator it = _SquadVariantNameToGroupDesc.find( NLMISC::toLowerAscii( nameAndVariant ) );
std::map<std::string, NLMISC::CSmartPtr< CGroupDesc<COutpostSquadFamily> > >::iterator it = _SquadVariantNameToGroupDesc.find( NLMISC::toLower( nameAndVariant ) );
if ( it != _SquadVariantNameToGroupDesc.end() )
return (*it).second;
else
@ -231,6 +229,8 @@ private:
CAliasCont<CManager> _Managers;
//@}
static NLLIGO::CLigoConfig _LigoConfig;
/// The ai instance continent name (multi ai system)
std::string _ContinentName;
/// The ai instance number (multi ai system)
@ -245,6 +245,10 @@ private:
CManagerPlayer* _PlayerManager;
/// event npc Manager.
CMgrNpc* _EventNpcManager;
uint32 _LastSpawnAlias;
uint32 _LastStateAlias;
/// easter egg manager
NLMISC::CRefPtr<CMgrNpc> _EasterEggManager;

@ -233,10 +233,11 @@ void CPetSpawnMsgImp::callback(std::string const& name, NLNET::TServiceId id)
#endif
return;
}
CAIPos position;
// calc a valid spawn position.
{
CAIPos position;
CAIEntityPhysical const* const phys = CAIS::instance().getEntityPhysical(CMirrors::DataSet->getDataSetRow(petOwnerId));
// TSpawnMode
@ -294,12 +295,10 @@ void CPetSpawnMsgImp::callback(std::string const& name, NLNET::TServiceId id)
botPet->setSheet(sheet);
#ifdef RYZOM_FORGE_PET_NAME
if (!CustomName.empty())
{
botPet->setCustomName(CustomName);
}
#endif
if (!botPet->spawn())
{
@ -325,6 +324,26 @@ void CPetSpawnMsgImp::callback(std::string const& name, NLNET::TServiceId id)
return;
}
CEntityId id = botPet->getSpawn()->getEntityId();
float t = 0;
uint8 cont = 0;
uint8 one = 1;
sint32 x = position.x();
sint32 y = position.y();
sint32 z = position.h();
NLMISC::TGameCycle tick = CTickEventHandler::getGameCycle() + 1;
CMessage msgout2("ENTITY_TELEPORTATION");
msgout2.serial( id );
msgout2.serial( x );
msgout2.serial( y );
msgout2.serial( z );
msgout2.serial( t );
msgout2.serial( tick );
msgout2.serial( cont );
msgout2.serial( Cell );
msgout2.serial( one );
sendMessageViaMirror("GPMS", msgout2);
botPet->getSpawn()->setAIProfile(new CAIPetProfileStand(botPet->getSpawn()));
confirmMsg.PetMirrorRow = botPet->getSpawn()->dataSetRow();

@ -877,13 +877,12 @@ void COutpost::createSquad(CGroupDesc<COutpostSquadFamily> const* groupDesc, COu
}*/
grp->setOutpostSide(side);
grp->setOutpostFactions(side);
grp->setOutpostFactions(getAliasString(), side);
grp->_AggroRange = 25;
grp->_UpdateNbTicks = 10;
grp->respawnTime() = respawTimeGC;
grp->getDebugHistory()->setRecording(true); // FIXME: https://github.com/kaetemi/ryzomclassic/issues/152
grp->updateStateInstance(); // Directly call his first state (to retrieve associated params).
if (createOrder!=0)
@ -903,6 +902,10 @@ void COutpost::createSquad(CGroupDesc<COutpostSquadFamily> const* groupDesc, COu
void COutpost::spawnSquad(uint32 groupId)
{
OUTPOST_DBG( "Outpost %s: Spawning squad 0x%08x", getName().c_str(), groupId );
setAttackerAlliance(_AttackerAllianceId);
FOREACH(itManager, CAliasCont<COutpostManager>, _Managers)
{
COutpostManager* manager = *itManager;
@ -1157,7 +1160,7 @@ NLMISC_COMMAND(displayOutposts, "list the available outpost", "")
if (args.size() > 0)
return false;
static const uint32 instanceNumber = std::numeric_limits<uint32>::max();
uint32 instanceNumber = std::numeric_limits<uint32>::max();
for (uint i=0; i<CAIS::instance().AIList().size(); ++i)
{
CAIInstance *const aii = CAIS::instance().AIList()[i];

@ -3066,6 +3066,8 @@ void CGrpProfileWanderNoPrim::updateProfile(uint ticksSinceLastUpdate)
}
wbs->setTimer(uint32(waitMin+CAIS::rand32(uint32(waitMax-waitMin))));
}
pgrp.processStateEvent(pgrp.mgr().EventDestinationReachedFirst);
pgrp.processStateEvent(pgrp.mgr().EventDestinationReachedAll);
}
continue;
}

@ -88,7 +88,8 @@ void CAIPetProfileFollowPlayer::updateProfile(uint ticksSinceLastUpdate)
return;
CPathCont& pathCont = _Bot->spawnGrp().getPathCont();
if ((pathCont.getDestination()-_Bot->wpos().toAIVector()).quickNorm()>6.f) // follow only if > 6 meters.
if (_Bot->getPersistent().getSheet()->Scale() <= .5f || (pathCont.getDestination()-_Bot->wpos().toAIVector()).quickNorm() > 6.f) // follow only if > 6 meters or it's a tiny creature.
{
// Handle the hunger of the animal
CSpeedLimit speedLimit( TheDataset, _Bot->dataSetRow() );

@ -1066,7 +1066,7 @@ void CFightScript::add(CFightScriptCompReader *reader)
}
CFightScriptCompReader *CFightScriptCompReader::getScriptReader (const string &str)
CFightScriptCompReader* CFightScriptCompReader::getScriptReader(const string &str)
{
CFightScript::TFightScriptMap::iterator it=CFightScript::_ScriptCompList.find(str);
if (it==CFightScript::_ScriptCompList.end())

@ -128,12 +128,15 @@ string CAIScriptDataManager::makePdrFileName()
{
string aisName;
// get the AIS local path
CConfigFile::CVar *var = IService::getInstance()->ConfigFile.getVarPtr("AESAliasName");
if (var)
aisName = var->asString(0);
else
//CConfigFile::CVar *var = IService::getInstance()->ConfigFile.getVarPtr("AESAliasName");
// aisName must be get from getServiceAliasName to manage "-N AIS_NAME" command line arg
aisName = IService::getInstance()->getServiceAliasName();
if (aisName.empty())
aisName = "unamed_ais";
return string("ai_script_data/")+aisName+"_pdr.bin";
}

@ -239,6 +239,8 @@ private:
{
CAIEntityPhysical const* phys = const_cast<T*>(&*it)->getSpawnObj();
CMirrorPropValueRO<uint32> cell( TheDataset, phys->dataSetRow(), DSPropertyCELL );
if (phys && phys->aipos().quickDistTo(aiVectorXy) < playerRadiusInMeters)
{
_players.push_back(const_cast<T*>(&*it));

@ -91,7 +91,8 @@ DEFINE_ACTION(ContextGlobal,USR_MDL)
std::vector<CAIActions::CArg>::const_iterator it = args.begin();
uint32 primAlias;
string modelId;
for (it = args.begin(); it != args.end();++it)
{
if (it == args.begin())
@ -102,9 +103,9 @@ DEFINE_ACTION(ContextGlobal,USR_MDL)
}
continue;
}
std::string modelId(it->toString());
std::string sheetId((++it)->toString());
std::string script((++it)->toString());
modelId = it->toString();
string sheetId((++it)->toString());
string script((++it)->toString());
//will contain all script info and the base sheet id
TScriptContent scriptContent;
@ -134,7 +135,10 @@ DEFINE_ACTION(ContextGlobal,USR_MDL)
//send msg to EGS if EGS up
if (EGSHasMirrorReady)
{
CAIUserModelManager::getInstance()->sendUserModels();
if (modelId.size() > 4 && modelId[0] == 'A' && modelId[1] == 'R' && modelId[2] == 'K' && modelId[3] == '_') // Ark user model (only one)
CAIUserModelManager::getInstance()->sendUserModel(primAlias, modelId);
else
CAIUserModelManager::getInstance()->sendUserModels();
}
}
@ -303,6 +307,14 @@ void CAIUserModelManager::addToUserModels(uint32 primAlias,
const std::string &userModelId,
const TScriptContent &userModel)
{
if (userModelId.size() > 4 && userModelId[0] == 'A' && userModelId[1] == 'R' && userModelId[2] == 'K' && userModelId[3] == '_') // Ark user model (can be updated)
{
CCustomElementId id(primAlias, userModelId);
TScripts::iterator it = _UserModels.Scripts.find(id);
if (it != _UserModels.Scripts.end())
_UserModels.Scripts.erase(it);
}
bool inserted = _UserModels.Scripts.insert(make_pair(CCustomElementId(primAlias, userModelId), userModel)).second;
if (!inserted)
{
@ -312,6 +324,23 @@ void CAIUserModelManager::addToUserModels(uint32 primAlias,
nldebug("<AIUserModelManager::addToUserModels> Added usermodel '%s' with alias '%u'", userModelId.c_str(), primAlias);
}
void CAIUserModelManager::sendUserModel(uint32 primAlias, const std::string &userModelId)
{
NLNET::CMessage msgout("USER_MODEL");
CCustomElementId id(primAlias, userModelId);
TScripts::iterator it = _UserModels.Scripts.find(id);
if (it == _UserModels.Scripts.end())
return;
CScriptData scriptData;
scriptData.Scripts.insert(make_pair(id, it->second));
msgout.serial(const_cast<CScriptData&>(scriptData));
nlinfo("Sending %u user models to EGS", scriptData.Scripts.size());
sendMessageViaMirror("EGS", msgout);
}
void CAIUserModelManager::sendUserModels()
{
NLNET::CMessage msgout("USER_MODELS");

@ -41,6 +41,7 @@ public:
/** send user models to EGS for script parsing and modified CStaticCreatures instanciation
*/
void sendUserModels();
void sendUserModel(uint32 primAlias, const std::string &userModelId);
/** send custom loot table script and info to EGS for script parsing and custom CStaticLootTable instanciation
*/

File diff suppressed because it is too large Load Diff

@ -0,0 +1,58 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#error "Deprecated"
#ifndef RYAI_BOT_CHAT_INTERFACE_H
#define RYAI_BOT_CHAT_INTERFACE_H
// Nel Misc
#include "nel/misc/types_nl.h"
#include "nel/misc/entity_id.h"
#include "game_share/news_types.h"
#include "game_share/bot_chat_types.h"
// the class
class CBotChatInterface
{
public:
// the callback type for user callbacks for start of bot chat
// returns the name of the bot chat automaton to use
// if an empty string is returned no bot chat is launched
typedef std::string (*TCallbackBegin)(NLMISC::CEntityId player,NLMISC::CEntityId bot);
// the callback types for user callback for end of bot chat
// called just after the chat session has been closed
typedef void (*TCallbackEnd)(NLMISC::CEntityId player,NLMISC::CEntityId bot);
public:
// classic init() and release()
static void init(TCallbackBegin cbBegin=NULL,TCallbackEnd cbEnd=NULL);
static void release();
// build a vector of the players currently chatting with a given bot
// this routine may not be very fast as the entire bot chat map is
// parsed in order to build the vector
static void getBotChatPartners(NLMISC::CEntityId bot,std::vector<NLMISC::CEntityId> &result);
// routines to force the end of a bot chat
static void endChatForPlayer(NLMISC::CEntityId player);
static void endAllChatForBot(NLMISC::CEntityId bot);
};
#endif

@ -82,8 +82,8 @@ void CBSAIEventReportMsg::callback(const std::string &name, NLNET::TServiceId id
{
uint8 actionType=ActionType[i];
if ( ( actionType!=ACTNATURE::FIGHT
&& actionType!=ACTNATURE::OFFENSIVE_MAGIC
&& actionType!=ACTNATURE::CURATIVE_MAGIC )
|| actionType!=ACTNATURE::OFFENSIVE_MAGIC
|| actionType!=ACTNATURE::CURATIVE_MAGIC )
&& AggroAdd[i]==0 )
continue;

@ -1710,19 +1710,6 @@ NLMISC_COMMAND(script2,"execute a script for groups containing a bot matching th
return true;
}
static std::string scriptHex_decode(std::string str)
{
std::string output;
for (size_t i=0; i<(str.length()-1); i+=2)
{
char c1 = str[i], c2 = str[i+1];
char buffer[3] = { c1, c2, '\0' };
char c = (char)strtol(buffer, NULL, 16);
output.push_back(c);
}
return output;
}
NLMISC_COMMAND(scriptHex,"execute a hex-encoded script for a group in the given aIInstance [buffered]","<groupName> <hexcode>")
{
vector<string> _args = args;

@ -66,6 +66,14 @@ void CAIEventReaction::setState(uint32 alias)
_eventMgr->addReaction(this);
}
uint32 CAIEventReaction::getState()
{
if (_states.empty())
return 0;
return _states[0];
}
void CAIEventReaction::setGroup(uint32 alias)
{
if (!_eventMgr.isNULL())

@ -85,12 +85,13 @@ public:
void setEvent (const std::string &eventName,CStateMachine *container);// this causes the event reaction to be linked to an event manager
void setState (uint32 alias); // used for events that apply to a specific state
uint32 getState (); // used for events that apply to a specific state
void setGroup (uint32 alias); // used for events that apply to a specific group
// the following routine shouldn't be needed it should be superceded by a better alternative
// in the event manager
template <class TState>
bool testCompatibility(CStateInstance *const stateInstance, const TState *const state) const;
bool testCompatibility(CStateInstance *const stateInstance, const TState *const state) const;
protected:
// protected data ---------------------------------------------------

@ -27,7 +27,10 @@ class CStateMachine
#endif
{
public:
CStateMachine() { }
CStateMachine()
{
_LastStateEventAlias = 0;
}
virtual ~CStateMachine()
{
clearEventContainerContent ();
@ -171,7 +174,10 @@ public:
CAliasCont<CAIState>& states() { return _states; }
CAliasCont<CAIState> const& cstStates() const { return _states; }
uint32 getLastStateEventAlias() { return ++_LastStateEventAlias; }
protected:
uint32 _LastStateEventAlias;
CAliasCont<CAIState> _states;
CAliasCont<CAIEventReaction> _eventReactions;
std::map<std::string,NLMISC::CDbgPtr<CAIEvent> > _eventNameMap;

@ -38,6 +38,7 @@
#include "ai_profile_fauna.h" // for CCorpseFaunaProfile
#include "dyn_mission.h"
#include "mirrors.h"
#include "commands.h"
#include "game_share/tick_event_handler.h"
@ -684,6 +685,8 @@ void CMessages::init()
TRANSPORT_CLASS_REGISTER (CAILostAggroMsg);
TRANSPORT_CLASS_REGISTER (CAIGainAggroMsg);
TRANSPORT_CLASS_REGISTER (CAINotifyDeathMsg);
TRANSPORT_CLASS_REGISTER (CAIPlayerRespawnMsgImp);
TRANSPORT_CLASS_REGISTER (CAIAskForInfosOnEntityImp);
@ -1022,7 +1025,7 @@ void CBSAIDeathReport::callback(const std::string &name, NLNET::TServiceId id)
continue;
CAIEntityPhysical* ep = CAIS::instance().getEntityPhysical(aggroIt->first);
if (!ep)
continue;
continue;
CBotPlayer const* const player = NLMISC::safe_cast<CBotPlayer const*>(ep);
if (!player)
continue;
@ -1031,7 +1034,6 @@ void CBSAIDeathReport::callback(const std::string &name, NLNET::TServiceId id)
playerAggroable.push_back(aggroIt->first);
}
#ifdef RYZOM_FORGE
NLNET::CMessage msgout("TRIGGER_WEBIG");
if (!eventBotKilled.empty())
msgout.serial(eventBotKilled);
@ -1045,7 +1047,6 @@ void CBSAIDeathReport::callback(const std::string &name, NLNET::TServiceId id)
msgout.serial(playerAggroable[i]);
}
sendMessageViaMirror("EGS", msgout);
#endif
}
}
break;
@ -1149,9 +1150,37 @@ void sAggroGain(TDataSetRow playerBot, TDataSetRow targetBot)
|| CMirrors::getEntityId(playerBot).getType()!=RYZOMID::player)
return;
CAIGainAggroMsg msg(targetBot, playerBot);
CAIGainAggroMsg msg(targetBot, playerBot, false);
msg.send("EGS");
CAIEntityPhysical *botEntity = CAIEntityPhysicalLocator::getInstance()->getEntity(targetBot);
CSpawnBotNpc* bot = dynamic_cast<CSpawnBotNpc*>(botEntity);
if (bot && bot->getPersistent().getOwner()) {
std::string groupName = bot->getPersistent().getOwner()->getName();
if (groupName.substr(0, 6) == "group_") {
if (groupName.find("_guardian_") != std::string::npos) {
strFindReplace(groupName, "_guardian_", "_boss_");
std::vector<CBot*> bots;
/// try to find the bot name
buildFilteredBotList(bots, groupName);
if (!bots.empty())
{
FOREACH(itBot, std::vector<CBot*>, bots)
{
CBot* bot = *itBot;
CSpawnBot *const sp = bot->getSpawnObj();
if (sp && sp->isAlive())
{
CAIGainAggroMsg msg(sp->dataSetRow(), playerBot, true);
msg.send("EGS");
}
}
}
}
}
}
CBotPlayer *player=NLMISC::safe_cast<CBotPlayer*>(entity);
if (!player)
return;

@ -1630,11 +1630,13 @@ Arguments: s(actionName),s(url) ->
// CGroup
void setUrl_ss_(CStateInstance* entity, CScriptStack& stack)
{
CGroup* group = entity->getGroup();
std::string url = (std::string)stack.top();stack.pop();
std::string actionName = (std::string)stack.top();stack.pop();
CCreatureSetUrlMsg msg;
FOREACH(botIt, CCont<CBot>, entity->getGroup()->bots())
FOREACH(botIt, CCont<CBot>, group->bots())
{
CSpawnBot* pbot = botIt->getSpawnObj();
if (pbot!=NULL)
@ -1642,7 +1644,9 @@ void setUrl_ss_(CStateInstance* entity, CScriptStack& stack)
msg.Entities.push_back(pbot->dataSetRow());
}
}
CSpawnGroup* spawnGroup = group->getSpawnObj();
spawnGroup->setActionName(actionName);
spawnGroup->setUrl(url);
msg.ActionName = actionName;
msg.Url = url;
msg.send(egsString);

@ -153,7 +153,7 @@ void setOupostMode_ss_(CStateInstance* entity, CScriptStack& stack)
}
npcGroup->setOutpostSide(side);
npcGroup->setOutpostFactions(side);
npcGroup->setOutpostFactions(aliasStr, side);
FOREACH(botIt, CCont<CBot>, npcGroup->bots())
{
CBot* bot = *botIt;
@ -1610,7 +1610,6 @@ Then user events are triggered on the group to inform it about what happens:
- user_event_3: triggered after the player has given the mission items to the npc.
Warning: this function can only be called after the event "player_target_npc".
Warning: only works on an R2 shard for R2 plot items.
Arguments: s(missionItems), s(missionText), c(groupToNotify) ->
@param[in] missionItems is the list of mission items, the string format is "item1:qty1;item2:qty2;...".
@ -1713,6 +1712,36 @@ void receiveMissionItems_ssc_(CStateInstance* entity, CScriptStack& stack)
DEBUG_STOP;
return;
}
// if LD use this the function outside a ring shard
if (IsRingShard)
{
// Here we destroy the item: so we do not want that a user create a scenario where we destroy
// other players precious items
static std::set<CSheetId> r2PlotItemSheetId; // :TODO: use R2Share::CRingAccess
// lazy intialisation
if (r2PlotItemSheetId.empty())
{
for (uint32 i = 0 ; i <= 184 ; ++i)
{
r2PlotItemSheetId.insert( CSheetId( NLMISC::toString("r2_plot_item_%d.sitem", i)));
}
}
// A npc give a mission to take an item given by another npc
// but the item instead of being a r2_plot_item is a normal item like system_mp or big armor
if ( r2PlotItemSheetId.find(sheetId) == r2PlotItemSheetId.end())
{
nlwarning("!!!!!!!!!!!!");
nlwarning("!!!!!!!!!!!! Someone is trying to hack us");
nlwarning("!!!!!!!!!!!!");
nlwarning("ERROR/HACK : an npc is trying to give to a player a item that is not a plot item SheetId='%s' sheetIdAsInt=%u",sheetId.toString().c_str(), sheetId.asInt());
nlwarning("His ai instanceId is %u, use log to know the sessionId and the user ", msg.InstanceId );
nlwarning("!!!!!!!!!!!!");
nlwarning("!!!!!!!!!!!!");
return ;
}
}
uint32 quantity;
NLMISC::fromString(itemAndQty[1], quantity);
@ -1746,7 +1775,6 @@ Then user events are triggered on the group to inform it about what happens:
- user_event_1: triggered after the player has received the mission items from the npc.
Warning: this function can only be called after the event "player_target_npc".
Warning: only works on an R2 shard for R2 plot items.
Arguments: s(missionItems), s(missionText), c(groupToNotify) ->
@param[in] missionItems is the list of mission items, the string format is "item1:qty1;item2:qty2;...".
@ -1850,6 +1878,36 @@ void giveMissionItems_ssc_(CStateInstance* entity, CScriptStack& stack)
return;
}
// if LD use this the function outside a ring shard
if (IsRingShard)
{
static std::set<CSheetId> r2PlotItemSheetId; // :TODO: use R2Share::CRingAccess
// lazy intialisation
if (r2PlotItemSheetId.empty())
{
for (uint32 i = 0 ; i <= 184 ; ++i)
{
r2PlotItemSheetId.insert( CSheetId( NLMISC::toString("r2_plot_item_%d.sitem", i)));
}
}
// A npc give a mission to give a item to another npc
// but the item instead of being a r2_plot_item is a normal item like system_mp or big armor
if ( r2PlotItemSheetId.find(sheetId) == r2PlotItemSheetId.end())
{
nlwarning("!!!!!!!!!!!!");
nlwarning("!!!!!!!!!!!! Someone is trying to hack us");
nlwarning("!!!!!!!!!!!!");
nlwarning("ERROR/HACK : an npc is trying to give to a player a item that is not a plot item SheetId='%s' sheetIdAsInt=%u",sheetId.toString().c_str(), sheetId.asInt());
nlwarning("His ai instanceId is %u, use log to know the sessionId and the user ", msg.InstanceId );
nlwarning("!!!!!!!!!!!!");
nlwarning("!!!!!!!!!!!!");
return ;
}
}
uint32 quantity;
NLMISC::fromString(itemAndQty[1], quantity);
if (quantity == 0)
@ -2605,7 +2663,7 @@ void rename_s_(CStateInstance* entity, CScriptStack& stack)
msgout.serial(row);
msgout.serial(name);
sendMessageViaMirror("IOS", msgout);
bot->setCustomName(name);
spawnBot->getPersistent().setCustomName(name);
}
}
}
@ -2668,6 +2726,182 @@ void maxHitRange_f_(CStateInstance* entity, CScriptStack& stack)
}
}
//----------------------------------------------------------------------------
/** @page code
@subsection addUserModel_sss_
Arguments: ->
arg0: is the user model id (a name)
arg1: is the base sheet
arg3: is the script (in hex)
@code
()addUserModel("toto", "ccbha1", "xxxxx");
@endcode
*/
void addUserModel_sss_(CStateInstance* entity, CScriptStack& stack)
{
string script = stack.top();
stack.pop();
string baseSheet = stack.top();
stack.pop();
string userModelId = stack.top(); // prefix with ARK_ to prevent stupid overwrite
stack.pop();
IManagerParent* const managerParent = entity->getGroup()->getOwner()->getOwner();
CAIInstance* const aiInstance = dynamic_cast<CAIInstance*>(managerParent);
if (!aiInstance)
return;
std::vector<CAIActions::CArg> args;
args.push_back(CAIActions::CArg(900+aiInstance->getInstanceNumber()));
args.push_back(CAIActions::CArg("ARK_"+userModelId));
args.push_back(CAIActions::CArg(baseSheet));
args.push_back(CAIActions::CArg(scriptHex_decode(script)));
CAIActions::execute("USR_MDL", args);
}
//----------------------------------------------------------------------------
/** @page code
@subsection addCustomLoot_ss_
Arguments: ->
arg0: is the custom table id (a name)
arg1: is the script with syntax : <PROBA_1>:<hex:LOOT_SET_1>,<PROBA_2>:<hex:LOOT_SET_2>,...
@code
()addUserModel("toto", "<PROBA_1>:<hex:LOOT_SET_1>,<PROBA_2>:<hex:LOOT_SET_2>,...");
@endcode
*/
void addCustomLoot_ss_(CStateInstance* entity, CScriptStack& stack)
{
string script = stack.top();
stack.pop();
string customTableId = stack.top();
stack.pop();
std::vector<std::string> loots;
NLMISC::splitString(script, ",", loots);
if (loots.empty())
return;
IManagerParent* const managerParent = entity->getGroup()->getOwner()->getOwner();
CAIInstance* const aiInstance = dynamic_cast<CAIInstance*>(managerParent);
if (!aiInstance)
return;
std::vector<CAIActions::CArg> args;
uint32 nbTables = 1;
args.push_back(CAIActions::CArg(nbTables));
args.push_back(CAIActions::CArg(900+aiInstance->getInstanceNumber()));
uint32 lootSets = loots.size();
args.push_back(CAIActions::CArg(lootSets));
args.push_back(CAIActions::CArg(customTableId));
float moneyProba = 0.0;
args.push_back(CAIActions::CArg(moneyProba));
float moneyFactor = 0.0;
args.push_back(CAIActions::CArg(moneyFactor));
uint32 moneyBase = 0;
args.push_back(CAIActions::CArg(moneyBase));
FOREACHC(it, std::vector<std::string>, loots)
{
std::vector<string> lootSet;
NLMISC::splitString(*it, ":", lootSet);
if (lootSet.size() == 2)
{
args.push_back(CAIActions::CArg(lootSet[0]));
args.push_back(CAIActions::CArg(scriptHex_decode(lootSet[1])));
}
}
CAIActions::execute("CUSTOMLT", args);
}
//----------------------------------------------------------------------------
/** @page code
@subsection setUserModel_s_
Set the user model of a creature
Arguments: -> s(userModel)
@code
()setUserModel('my_model');
@endcode
*/
void setUserModel_s_(CStateInstance* entity, CScriptStack& stack)
{
string userModel = stack.top();
stack.pop();
CGroup* group = entity->getGroup();
FOREACH(botIt, CCont<CBot>, group->bots())
{
CBot* bot = *botIt;
//if (!bot->isSpawned()) return;
if (bot->getRyzomType() == RYZOMID::npc)
{
CBotNpc* botNpc = NLMISC::safe_cast<CBotNpc*>(bot);
botNpc->setUserModelId("ARK_"+userModel);
}
}
}
//----------------------------------------------------------------------------
/** @page code
@subsection setCustomLoot_s_
Set the custom loot of a creature
Arguments: -> s(customTable)
@code
()setUserModel('my_loot_table');
@endcode
*/
void setCustomLoot_s_(CStateInstance* entity, CScriptStack& stack)
{
string customTable = stack.top();
stack.pop();
CGroup* group = entity->getGroup();
FOREACH(botIt, CCont<CBot>, group->bots())
{
CBot* bot = *botIt;
//if (!bot->isSpawned()) return;
if (bot->getRyzomType() == RYZOMID::npc)
{
CBotNpc* botNpc = NLMISC::safe_cast<CBotNpc*>(bot);
botNpc->setCustomLootTableId(customTable);
}
}
}
////----------------------------------------------------------------------------
///** @page code
//
@ -2728,6 +2962,135 @@ void maxHitRange_f_(CStateInstance* entity, CScriptStack& stack)
// }
//}
//----------------------------------------------------------------------------
/** @page code
@subsection setEventCode_sss
Sets and event to execute when event triggers
Arguments:
s(event) -> @param[in] The name of the state
s(event) -> @param[in] The name of the event
s(code) -> @param[in] The string to execute code in hex
@code
()maxHitRange(50); // Set the max hit range in 50 meters all npc in group
@endcode
*/
// CBotNpc
void setEventCode_sss_(CStateInstance* entity, CScriptStack& stack)
{
string code = stack.top();
stack.pop();
string event_name = stack.top();
stack.pop();
string state_name = stack.top();
stack.pop();
//////////// Special Cases for Ark
if (event_name == "notify_on_death")
{
strFindReplace(code, "http://", "");
strFindReplace(code, "https://", "");
strFindReplace(code, "/index.php?", " ");
CGroup* group = entity->getGroup();
FOREACH(botIt, CCont<CBot>, group->bots())
{
CBot* bot = *botIt;
if (!bot->isSpawned()) return;
CBotNpc* botNpc = NLMISC::safe_cast<CBotNpc*>(bot);
if (botNpc)
{
CSpawnBotNpc* spawnBotNpc = botNpc->getSpawn();
if (spawnBotNpc)
{
CAINotifyDeathMsg *msg = new CAINotifyDeathMsg;
msg->Url = code;
msg->TargetRowId = spawnBotNpc->dataSetRow();
msg->send("EGS");
}
}
}
return;
}
///////////////////////////////////////////////////////
CAIEventDescription eventDescription;
CAIEventActionNode::TSmartPtr eventAction;
CAIEventReaction* event;
// Create event handler
eventDescription.EventType = event_name;
// Create event action
eventAction = new CAIEventActionNode;
eventAction->Action = "code";
eventAction->Weight = 1;
code = scriptHex_decode(code);
vector<string> lines_of_code;
NLMISC::splitString(code, "\n", lines_of_code);
if (!lines_of_code.empty())
{
FOREACHC(it, vector<string>, lines_of_code)
{
nlinfo("Code: %s", (*it).c_str());
eventAction->Args.push_back(*it);
}
}
// Register event action
eventDescription.Action = eventAction;
eventAction = NULL;
CGroup* group = entity->getGroup();
CGroupNpc* npcGroup = NLMISC::safe_cast<CGroupNpc*>(group);
CStateMachine* sm = &npcGroup->getEventContainer();
CAIStatePositional* statePositional;
uint32 stateAlias = npcGroup->getStateAlias(state_name);
if (stateAlias == 0)
{
nlinfo("STATE %s not found !", state_name.c_str());
statePositional = new CAIStatePositional(sm, 0, state_name);
npcGroup->setStateAlias(state_name, statePositional->getAlias());
sm->states().addChild(statePositional);
}
else
{
statePositional = safe_cast<CAIStatePositional*>(sm->states().getChildByAlias(stateAlias));
}
uint32 stateEventAlias = npcGroup->getStateEventAlias(event_name);
/*if (stateEventAlias != 0)
{
CAIEventReaction er = sm->eventReactions().getChildByAlias(stateEventAlias);
er->setGroup(0);
}*/
// sm->eventReactions().removeChildByIndex(sm->eventReactions().getChildIndexByAlias(stateEventAlias));
// Register event handler
stateEventAlias = sm->getLastStateEventAlias();
event = new CAIEventReaction(sm, stateEventAlias, eventDescription.EventType);
event->processEventDescription(&eventDescription, sm);
event->setGroup(npcGroup->getAlias());
nlinfo("Add Event: %s(%d) in State : %d", event_name.c_str(), stateEventAlias, statePositional->getAlias());
event->setState(statePositional->getAlias());
npcGroup->setStateEventAlias(event_name, stateEventAlias);
sm->eventReactions().addChild(event);
event = NULL;
}
std::map<std::string, FScrptNativeFunc> nfGetNpcGroupNativeFunctions()
{
@ -2793,6 +3156,13 @@ std::map<std::string, FScrptNativeFunc> nfGetNpcGroupNativeFunctions()
REGISTER_NATIVE_FUNC(functions, maxHitRange_f_);
REGISTER_NATIVE_FUNC(functions, setEventCode_sss_);
REGISTER_NATIVE_FUNC(functions, addUserModel_sss_);
REGISTER_NATIVE_FUNC(functions, addCustomLoot_ss_);
REGISTER_NATIVE_FUNC(functions, setUserModel_s_);
REGISTER_NATIVE_FUNC(functions, setCustomLoot_s_);
// REGISTER_NATIVE_FUNC(functions, hideMissionStepIcon_b_);
// REGISTER_NATIVE_FUNC(functions, hideMissionGiverIcon_b_);

@ -537,6 +537,45 @@ void import_s_(CStateInstance* entity, CScriptStack& stack)
nlwarning("unknown library %s", LibName.c_str());
}
void setVar_sf_(CStateInstance* entity, CScriptStack& stack)
{
float value = (float)stack.top();
stack.pop();
std::string varName = (std::string)stack.top();
TStringId varId=CStringMapper::map(varName);
stack.pop();
entity->setLogicVar(varId, value);
}
void getVar_s_f(CStateInstance* entity, CScriptStack& stack)
{
std::string varName = (std::string)stack.top();
TStringId varId=CStringMapper::map(varName);
stack.top() = entity->getLogicVar(varId);
}
void setVar_ss_(CStateInstance* entity, CScriptStack& stack)
{
std::string value = (std::string)stack.top();
stack.pop();
std::string varName = (std::string)stack.top();
TStringId varId=CStringMapper::map(varName);
stack.pop();
entity->setStrLogicVar(varId, value);
}
void getVar_s_s(CStateInstance* entity, CScriptStack& stack)
{
std::string varName = (std::string)stack.top();
TStringId varId=CStringMapper::map(varName);
stack.top() = entity->getStrLogicVar(varId);
}
//----------------------------------------------------------------------------
/** @page code
@ -804,6 +843,10 @@ std::map<std::string, FScrptNativeFunc> nfGetStateInstanceNativeFunctions()
REGISTER_NATIVE_FUNC(functions, setNelVar_ss_);
REGISTER_NATIVE_FUNC(functions, getNelVar_s_s);
REGISTER_NATIVE_FUNC(functions, delNelVar_ss_);
REGISTER_NATIVE_FUNC(functions, setVar_sf_);
REGISTER_NATIVE_FUNC(functions, getVar_s_f);
REGISTER_NATIVE_FUNC(functions, setVar_ss_);
REGISTER_NATIVE_FUNC(functions, getVar_s_s);
REGISTER_NATIVE_FUNC(functions, setGlobalNelVar_sf_);
REGISTER_NATIVE_FUNC(functions, setGlobalNelVar_ss_);
REGISTER_NATIVE_FUNC(functions, getStateName__s);

@ -719,7 +719,17 @@ bool CNpcChatProfileImp::parseChatArgs(CAIInstance *aiInstance, const std::strin
// split to webpage name and the true webpage
_WebPageName.clear();
AI_SHARE::stringToWordAndTail(tail, _WebPageName, tail);
_WebPage = tail;
//replace &nbsp& by space (hack for Ark)
size_t pos = 0;
while((pos = _WebPage.find("&nbsp&", pos)) != string::npos)
{
_WebPage.replace(pos, 6, " ");
pos++;
}
}
// guild creator

@ -19,6 +19,20 @@
#include "script_vm.h"
static std::string scriptHex_decode(std::string str)
{
std::string output;
for (size_t i=0; i<(str.length()-1); i+=2)
{
char c1 = str[i], c2 = str[i+1];
char buffer[3] = { c1, c2, '\0' };
char c = (char)strtol(buffer, NULL, 16);
output.push_back(c);
}
return output;
}
// Forward declarations
class CStateInstance;

@ -653,4 +653,5 @@ void CPersistentStateInstance::setStartState(CAIState* state)
CStateInstance::init(_StartState);
}
#include "event_reaction_include.h"
#endif

File diff suppressed because it is too large Load Diff

@ -44,8 +44,11 @@ struct CAdminCommand
void initAdmin ();
void initCommandsPrivileges(const std::string & fileName);
void initPositionFlags(const std::string & fileName);
void initSalt();
const std::string &getSalt();
void getUCstringFromHash(const std::string & hash, ucstring & finaltext);
std::string getStringFromHash(const std::string &hash);
bool getAIInstanceFromGroupName(std::string& groupName, uint32& instanceNumber);
CAdminCommand * findAdminCommand(const std::string & name);
@ -129,6 +132,29 @@ extern void GET_CHARACTER_Helper(std::string& command, const NLMISC::CEntityId&
return false; \
} \
#define GET_ACTIVE_CHARACTER2 \
if (args.size() < 1) { nlwarning ("ERR: Missing argument number 0 that should be the uid"); return false; } \
uint32 uid; \
NLMISC::fromString(args[0], uid); \
c = CPlayerManager::getInstance().getActiveChar(uid); \
if(c == 0) \
{ \
log.displayNL ("ERR: Unknown player '%u' (%s)", uid, args[0].c_str()); \
return false; \
} \
CEntityId eid = c->getId(); \
TLogContext_Character_AdminCommand commandContext(eid); \
if(!c->getEnterFlag()) \
{ \
log.displayNL ("ERR: '%s' is not entered", eid.toString().c_str()); \
return false; \
} \
if(!TheDataset.isAccessible(c->getEntityRowId())) \
{ \
log.displayNL ("ERR: '%s' is not valid in mirror", eid.toString().c_str()); \
return false; \
} \
//#define GET_CHARACTER1 \
// if (args.size() < 2) { nlwarning ("Missing argument number 1 that should be the eid"); return false; } \
// CEntityId eid = CEntityIdTranslator::getInstance()->getByEntity(args[1]); \

@ -0,0 +1,66 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2016 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "admin_log.h"
#include "nel/misc/displayer.h"
using namespace std;
using namespace NLMISC;
CAdminLog AdminLog;
//-----------------------------------------------
// CAdminLog init
//-----------------------------------------------
void CAdminLog::init(const std::string & logFile)
{
_LogFile = logFile;
if ( logFile.empty() )
Log = NLMISC::WarningLog;
else
{
Log = new NLMISC::CLog;
_Fd.setParam ( logFile, true);
Log->addDisplayer (&_Fd);
}
}// CAdminLog init
//-----------------------------------------------
// CAdminLog release
//-----------------------------------------------
void CAdminLog::release()
{
if ( Log != NLMISC::WarningLog )
delete Log;
}// CAdminLog release
//-----------------------------------------------
//-----------------------------------------------
void CAdminLog::display(const char *format, ...)
{
if (Log == NULL) return;
char *str;
NLMISC_CONVERT_VARGS (str, format, 256);
string toDisp = str;
toDisp = string(IDisplayer::dateToHumanString()) + string(" ") + toDisp;
Log->displayRawNL(toDisp.c_str());
}

@ -0,0 +1,82 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2016 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RY_ADMIN_LOG_H
#define RY_ADMIN_LOG_H
#include "nel/misc/log.h"
#include "nel/misc/debug.h"
#include "nel/misc/variable.h"
/**
* separate log system for admin commands. Logs are in egs_mission.log. use ADMINLOG to log in this file
* \author Ulukyn
* \date 2016
*/
class CAdminLog
{
public:
/// init the log
void init(const std::string & logFile);
///release the log
void release();
///\return the name of the log file
inline const std::string & getLogFile(){return _LogFile;}
void display(const char *format, ...);
/// the NEL log used for in the mission log
NLMISC::CLog *Log;
private:
/// the file displayer used to log the mission information
NLMISC::CFileDisplayer _Fd;
/// log file name
std::string _LogFile;
};
/// the mission log
extern CAdminLog AdminLog;
/// macro used to log missions script error
#define ADMINLOG AdminLog.display
#endif // RY_ADMIN_LOG_H
/* End of admin_log.h */

@ -32,7 +32,6 @@ namespace BACK_COMPAT
{
// !!! DO NOT EDIT THIS TABLE !!!
/*
static const string OldPlaces[] =
{
"region_groveofconfusion",
@ -555,11 +554,10 @@ static const string OldPlaces[] =
};
static vector<uint16> OldToNewPlaceId;
*/
void initPlacesCompat()
{
/* static bool initialized = false;
static bool initialized = false;
if (initialized)
return;
@ -579,14 +577,13 @@ void initPlacesCompat()
}
initialized = true;
*/
}
uint16 oldToNewPlaceId(uint16 oldId)
{
// BOMB_IF( (oldId >= OldToNewPlaceId.size()), "<oldToNewPlaceId> invalid old place index", return 0xffff );
// return OldToNewPlaceId[oldId];
return oldId;
BOMB_IF( (oldId >= OldToNewPlaceId.size()), "<oldToNewPlaceId> invalid old place index", return 0xffff );
return OldToNewPlaceId[oldId];
}
} // namespace BACK_COMPAT

@ -27,7 +27,7 @@ using namespace NLMISC;
using namespace NLNET;
using namespace std;
/*
namespace BACK_COMPAT
{
@ -648,4 +648,4 @@ uint16 oldToNewSpawnZoneId(uint16 oldId)
}
} // namespace BACK_COMPAT
*/

@ -16,7 +16,7 @@
#ifndef RY_SPAWN_ZONES_BACK_COMPAT_H
#define RY_SPAWN_ZONES_BACK_COMPAT_H
/*
namespace BACK_COMPAT
{
@ -24,7 +24,7 @@ void initSpawnZonesCompat();
uint16 oldToNewSpawnZoneId(uint16 oldId);
} // namespace BACK_COMPAT
*/
#endif // RY_SPAWN_ZONES_BACK_COMPAT_H

@ -39,6 +39,7 @@
#include "guild_manager/guild_manager.h"
#include "guild_manager/guild.h"
#include "guild_manager/guild_member_module.h"
#include "world_instances.h"
#include "egs_sheets/egs_sheets.h"
@ -63,7 +64,6 @@ void cbLiftIn( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TS
TDataSetRow rowId;
msgin.serial(triggerId);
msgin.serial(rowId);
CBuildingManager::getInstance()->addTriggerRequest( rowId, triggerId );
}
/// a player left a lift
@ -388,6 +388,7 @@ void CBuildingManager::addTriggerRequest( const TDataSetRow & rowId, sint32 trig
nlwarning("<BUILDING> row %u is invalid",rowId.getIndex() );
return;
}
// build a request for our user
@ -395,56 +396,71 @@ void CBuildingManager::addTriggerRequest( const TDataSetRow & rowId, sint32 trig
request.Page = 0;
request.Session = 0;
CTriggerRequestEntry entry;
const uint destCount = (uint)trigger.Destinations.size();
for ( uint i = 0; i < destCount; i++ )
// Get the custom trigger (if exists)
std::string url = getCustomTrigger(triggerId);
if (url.empty()) // No custom trigger, build it from parsed primitives
{
entry.Destination = trigger.Destinations[i];
if (entry.Destination == NULL)
{
nlwarning("<BUILDING> NULL destination in trigger");
return;
}
const uint16 ownerCount = entry.Destination->getEntryCount();
bool addSession = false;
for ( uint16 j = 0; j < ownerCount; j++ )
CTriggerRequestEntry entry;
const uint destCount = (uint)trigger.Destinations.size();
for ( uint i = 0; i < destCount; i++ )
{
if ( entry.Destination->isUserAllowed(user,j) )
entry.Destination = trigger.Destinations[i];
if (entry.Destination == NULL)
{
entry.OwnerIndex = j;
request.Entries.push_back( entry );
addSession = true;
nlwarning("<BUILDING> NULL destination in trigger");
return;
}
const uint16 ownerCount = entry.Destination->getEntryCount();
bool addSession = false;
for ( uint16 j = 0; j < ownerCount; j++ )
{
if ( entry.Destination->isUserAllowed(user,j) )
{
entry.OwnerIndex = j;
request.Entries.push_back( entry );
addSession = true;
}
}
if ( addSession )
request.Session += entry.Destination->getStateCounter();
}
if ( request.Entries.empty() )
{
return;
}
if ( addSession )
request.Session += entry.Destination->getStateCounter();
}
if ( request.Entries.empty() )
{
return;
}
request.Timer = new CTimer;
request.Timer->setRemaining( TriggerRequestTimout, new CTriggerRequestTimoutEvent(rowId) );
// add the request to our manager
_TriggerRequests.insert( make_pair( rowId, request ) );
// if it is an auto teleport, force entity teleportation
if ( trigger.AutoTeleport )
// Don't teleport when it's a custom trigger, send url instead
if (!url.empty())
{
triggerTeleport( user , 0);
return;
user->sendUrl(url);
}
else
{
// tell client
NLNET::CMessage msgout( "IMPULSION_ID" );
CEntityId id = user->getId();
msgout.serial( id );
CBitMemStream bms;
nlverify( GenericMsgManager.pushNameToStream( "GUILD:ASCENSOR", bms) );
// if it is an auto teleport, force entity teleportation
if ( trigger.AutoTeleport )
{
triggerTeleport( user , 0);
return;
}
msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());
sendMessageViaMirror( NLNET::TServiceId(id.getDynamicId()), msgout );
// tell client
NLNET::CMessage msgout( "IMPULSION_ID" );
CEntityId id = user->getId();
msgout.serial( id );
CBitMemStream bms;
nlverify( GenericMsgManager.pushNameToStream( "GUILD:ASCENSOR", bms) );
msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());
sendMessageViaMirror( NLNET::TServiceId(id.getDynamicId()), msgout );
}
}
@ -615,16 +631,20 @@ void CBuildingManager::registerPlayer( CCharacter * user )
}
//----------------------------------------------------------------------------
void CBuildingManager::removePlayerFromRoom( CCharacter * user )
void CBuildingManager::removePlayerFromRoom( CCharacter * user, bool send_url )
{
#ifdef NL_DEBUG
nlassert(user);
#endif
CMirrorPropValueRO<TYPE_CELL> mirrorCell( TheDataset, user->getEntityRowId(), DSPropertyCELL );
sint32 cell = mirrorCell;
if ( !isRoomCell(cell) )
return;
CVector buildingExitPos = user->getBuildingExitPos();
uint idx = getRoomIdxFromCell( cell );
if ( idx >= _RoomInstances.size() )
{
@ -637,19 +657,84 @@ void CBuildingManager::removePlayerFromRoom( CCharacter * user )
return;
}
// remove a reference from the room
_RoomInstances[idx].Ptr->removeUser( user );
_RoomInstances[idx].Ptr->removeUser( user, send_url, _RoomInstances[idx].Persistant);
if (!_RoomInstances[idx].Persistant)
{
nlinfo("remove and delete room");
deleteRoom(cell);
}
else
{
nlinfo("remove NO delete room");
}
/*// Remove all pets from room
vector< CPetAnimal > &pets = user->getPlayerPets();
nlinfo("remove PETS");
for (uint16 i = 0; i < (uint16)pets.size(); ++i)
{
nlinfo("Checking pet %d", i);
if (pets[i].PetStatus == CPetAnimal::landscape)
{
nlinfo("pet in landscape");
CContinent * cont = CZoneManager::getInstance().getContinent(pets[i].Landscape_X, pets[i].Landscape_Y);
if (!cont)
continue;
CONTINENT::TContinent continent = (CONTINENT::TContinent)cont->getId();
if (continent == CONTINENT::R2_ROOTS ||
continent == CONTINENT::R2_FOREST ||
continent == CONTINENT::R2_DESERT ||
continent == CONTINENT::R2_LAKES ||
continent == CONTINENT::R2_JUNGLE ||
continent == CONTINENT::INDOORS
)
{
nlinfo("pet in a powo/indoor");
pets[i].IsFollowing = true;
}
}
}*/
}
//----------------------------------------------------------------------------
void CBuildingManager::deleteRoom(sint32 cell)
{
if ( !isRoomCell(cell) )
return;
uint idx = getRoomIdxFromCell( cell );
if ( idx >= _RoomInstances.size() )
{
nlwarning("<BUILDING>cell %d is not a valid room ( count is %u)", cell,_RoomInstances.size() );
return;
}
if ( !_RoomInstances[idx].Ptr )
{
nlwarning("<BUILDING>cell %d is not a valid room!", cell);
return;
}
// if there is nobody in the room, remove it
if ( !_RoomInstances[idx].Ptr->isValid() )
{
delete _RoomInstances[idx].Ptr;
_RoomInstances[idx].Ptr = NULL;
_RoomInstances[idx].NextFreeId = _FirstFreeRoomId;
_RoomInstances[idx].Persistant = false;
_FirstFreeRoomId = idx;
}
}
//----------------------------------------------------------------------------
IRoomInstance * CBuildingManager::allocateRoom( sint32 & cellRet, BUILDING_TYPES::TBuildingType type)
IRoomInstance * CBuildingManager::allocateRoom( sint32 & cellRet, BUILDING_TYPES::TBuildingType type, bool persistant)
{
// update room vector
if ( _FirstFreeRoomId >= _RoomInstances.size() )
@ -668,6 +753,8 @@ IRoomInstance * CBuildingManager::allocateRoom( sint32 & cellRet, BUILDING_TYPE
nlwarning("<BUILDING>invalid room type %d",type);
return NULL;
}
_RoomInstances[idx].Persistant = persistant;
return _RoomInstances[idx].Ptr;
}
@ -689,6 +776,7 @@ inline void CBuildingManager::reallocRooms()
{
_RoomInstances[i].NextFreeId =i+1 ;
_RoomInstances[i].Ptr = NULL;
_RoomInstances[i].Persistant = false;
//allocate the cell in GPMS ( here cell values must be > 0 )
NLNET::CMessage msgout("CREATE_INDOOR_UNIT");
sint32 cellId = -getRoomCellFromIdx(i);
@ -703,6 +791,7 @@ inline void CBuildingManager::reallocRooms()
{
_RoomInstances[i].NextFreeId = i+1;
_RoomInstances[i].Ptr = NULL;
_RoomInstances[i].Persistant = false;
}
}
@ -722,8 +811,6 @@ void CBuildingManager::triggerTeleport(CCharacter * user, uint16 index)
return;
}
// check if sessions mactch between user and system
uint16 session = 0;
const uint16 destCount = (uint16)(*it).second.Entries.size();
@ -824,11 +911,13 @@ void CBuildingManager::triggerTeleport(CCharacter * user, uint16 index)
if ( cellId )
{
user->tpWanted(x,y,z,true,heading,0xFF,cellId);
if ( dest->isGuildRoomDestination() )
if ( dest->isGuildRoomDestination() || (user->getPowoCell() != 0 && user->getPowoFlag("guild_inv")))
PlayerManager.sendImpulseToClient(user->getId(), "GUILD:OPEN_INVENTORY");
}
else
user->tpWanted(x,y,z,true,heading);
{
user->tpWanted(x,y,z,true,heading,0xFF,0,true);
}
}
else
{
@ -840,6 +929,27 @@ void CBuildingManager::triggerTeleport(CCharacter * user, uint16 index)
}
}
//----------------------------------------------------------------------------
void CBuildingManager::setCustomTrigger(sint32 triggerId, const std::string & url)
{
std::map<sint,std::string>::iterator it = _CustomTriggers.find( triggerId );
if (it != _CustomTriggers.end())
_CustomTriggers.erase(it);
if (!url.empty())
_CustomTriggers.insert(make_pair(triggerId, url));
}
//----------------------------------------------------------------------------
std::string CBuildingManager::getCustomTrigger(sint32 triggerId)
{
std::map<sint,std::string>::iterator it = _CustomTriggers.find( triggerId );
if ( it != _CustomTriggers.end() )
return (*it).second;
return "";
}
//----------------------------------------------------------------------------
IBuildingPhysical * CBuildingManager::getBuildingPhysicalsByAlias( TAIAlias alias )
{
@ -854,7 +964,7 @@ IBuildingPhysical * CBuildingManager::getBuildingPhysicalsByAlias( TAIAlias alia
//----------------------------------------------------------------------------
IBuildingPhysical* CBuildingManager::getBuildingPhysicalsByName( const std::string & name )
{
std::map<std::string,IBuildingPhysical*>::iterator it = _BuildingPhysicalsName.find( name );
std::map<std::string,IBuildingPhysical*>::iterator it = _BuildingPhysicalsName.find( name );
if ( it != _BuildingPhysicalsName.end() )
{
if( (*it).second == NULL )

@ -71,6 +71,10 @@ public:
void removeTriggerRequest( const TDataSetRow & rowId);
/// teleport a user through a lift
void triggerTeleport(CCharacter * user, uint16 index);
/// pacs trigger will launch an url and no more teleport a player
void setCustomTrigger(sint32 triggerId, const std::string & url);
/// get url from CustomTrigger
std::string getCustomTrigger(sint32 triggerId);
//@}
@ -89,9 +93,11 @@ public:
/// get a building destination from its name.
IBuildingPhysical* getBuildingPhysicalsByName( const std::string & name );
/// remove a player from a room
void removePlayerFromRoom( CCharacter * user );
void removePlayerFromRoom( CCharacter * user, bool send_url = true );
/// delete a room
void deleteRoom(sint32 cell);
/// alocate a new room instance. Fills the room cell passed a sparam and returns a pointer on the instance
IRoomInstance * allocateRoom( sint32 & cellRet, BUILDING_TYPES::TBuildingType type );
IRoomInstance * allocateRoom( sint32 & cellRet, BUILDING_TYPES::TBuildingType type, bool persistant = false );
/// get a room instance from its cell
IRoomInstance * getRoomInstanceFromCell( sint32 cellId )
{
@ -198,6 +204,9 @@ private:
/// container of triggers
CHashMap< sint,CTrigger > _Triggers;
/// container of custom triggers
std::map< sint,std::string > _CustomTriggers;
/// trigger requests of the players
typedef CHashMap< TDataSetRow , CTriggerRequest , TDataSetRow::CHashCode > TTriggerRequestCont;
TTriggerRequestCont _TriggerRequests;
@ -212,6 +221,7 @@ private:
struct CRoomInstanceEntry
{
uint32 NextFreeId;
bool Persistant;
IRoomInstance* Ptr;
};
std::vector< CRoomInstanceEntry > _RoomInstances;

@ -78,7 +78,7 @@ bool IBuildingPhysical::build( const NLLIGO::IPrimitive* prim, CBuildingParseDat
}
//----------------------------------------------------------------------------
bool IBuildingPhysical::addUser(CCharacter * user, uint16 roomIdx, uint16 ownerIdx, sint32 & cellId)
bool IBuildingPhysical::addUser(CCharacter * user, uint16 roomIdx, uint16 ownerIdx, sint32 & cellId, bool persistant, bool send_url)
{
/// simply get the cell matching the parameters
if ( roomIdx >= _Rooms.size() )
@ -86,60 +86,66 @@ bool IBuildingPhysical::addUser(CCharacter * user, uint16 roomIdx, uint16 ownerI
nlwarning("<BUILDING>Invalid room %u count is %u",roomIdx,_Rooms.size() );
return false;
}
if ( ownerIdx >= _Rooms[roomIdx].Cells.size() )
{
nlwarning("<BUILDING>Invalid owner idx %u count is %u",ownerIdx,_Rooms[roomIdx].Cells.size());
return false;
}
if (user->currentHp() <= 0 )
{
nlwarning("<BUILDING>user %s is dead",user->getId().toString().c_str());
return false;
}
CCharacter *owner;
CEntityId owner;
if (ownerIdx < _Players.size())
{
owner = PlayerManager.getChar(_Players[ownerIdx] );
}
owner = _Players[ownerIdx];
else
{
owner = user;
}
owner = user->getId();
nlinfo("<BUILDING>owner are %s", owner.toString().c_str());
IRoomInstance * roomInstance;
if (_Rooms[roomIdx].Cells[ownerIdx] != 0) {
roomInstance = CBuildingManager::getInstance()->getRoomInstanceFromCell(_Rooms[roomIdx].Cells[ownerIdx]);
nlinfo("ok");
}
// if the room is not already instanciated, we have to do it
if ( _Rooms[roomIdx].Cells[ownerIdx] == 0 )
if ( _Rooms[roomIdx].Cells[ownerIdx] == 0 || roomInstance == NULL)
{
// create a new room of the appropriate type
IRoomInstance * roomInstance = CBuildingManager::getInstance()->allocateRoom(_Rooms[roomIdx].Cells[ownerIdx],_Template->Type);
if (persistant)
nlinfo("create persistant");
else
nlinfo("create temp");
// create a new room of the appropriate type,
roomInstance = CBuildingManager::getInstance()->allocateRoom(_Rooms[roomIdx].Cells[ownerIdx],_Template->Type, persistant);
if ( roomIdx >= _Template->Rooms.size() )
{
nlwarning("<BUILDING>Invalid room idx %u count is %u. Mismatch between template and instance?",ownerIdx,_Template->Rooms.size());
return false;
}
nlinfo("created room : %i", _Rooms[roomIdx].Cells[ownerIdx]);
// init the room
if( !roomInstance->create(this,roomIdx,ownerIdx, _Rooms[roomIdx].Cells[ownerIdx]) )
return false;
roomInstance->addUser(user, owner);
}
else
{
IRoomInstance * roomInstance = CBuildingManager::getInstance()->getRoomInstanceFromCell(_Rooms[roomIdx].Cells[ownerIdx]);
if ( roomInstance == NULL )
{
nlwarning("<BUILDING>%s invalid room cell %d.",user->getId().toString().c_str(),_Rooms[roomIdx].Cells[ownerIdx]);
if( !roomInstance->create(this,roomIdx,ownerIdx, _Rooms[roomIdx].Cells[ownerIdx]) ) {
nlinfo("error...");
return false;
}
roomInstance->addUser(user, owner);
}
nlinfo("add user");
roomInstance->addUser(user, owner, send_url);
user->setBuildingExitZone( _DefaultExitSpawn );
_UsersInside.push_back( user->getEntityRowId() );
cellId = _Rooms[roomIdx].Cells[ownerIdx];
nlinfo("Cell are from roomIdx/ownerIdx = %d/%d", roomIdx, ownerIdx);
cellId = _Rooms[roomIdx].Cells[ownerIdx];
return true;
}
@ -548,15 +554,11 @@ bool CBuildingPhysicalPlayer::isUserAllowed(CCharacter * user, uint16 ownerId, u
if (user->isDead())
return false;
#ifdef RYZOM_FORGE_ROOM
CCharacter * owner = PlayerManager.getChar( _Players[ownerId] );
if (owner)
return ( (user->getId() == _Players[ownerId]) || owner->playerHaveRoomAccess(user->getId()) );
else
return false;
#else
return (user->getId() == _Players[ownerId]);
#endif
}
//----------------------------------------------------------------------------

@ -64,7 +64,7 @@ public:
/// get the cell id of a physical room of this building. Return true if no error.
/// If the room was not already instanciated, this method instanciate it
/// ownerIdx is the index of the owner ( player / guild ) in the room owner vector
bool addUser(CCharacter * user, uint16 roomIdx,uint16 ownerIdx, sint32 & cellId);
bool addUser(CCharacter * user, uint16 roomIdx,uint16 ownerIdx, sint32 & cellId, bool persistant = false, bool send_url = true);
/// return false if the user was not present in the building
inline bool removeUser(const TDataSetRow & row);
/// return true if user is in building

@ -38,7 +38,7 @@ NL_INSTANCE_COUNTER_IMPL(CRoomInstanceGuild);
NL_INSTANCE_COUNTER_IMPL(CRoomInstancePlayer);
//----------------------------------------------------------------------------
void CRoomInstanceCommon::removeUser( CCharacter* user )
void CRoomInstanceCommon::removeUser( CCharacter* user, bool send_url, bool keep_room )
{
BOMB_IF( !user, "<BUILDING> null character!", return );
@ -56,13 +56,14 @@ void CRoomInstanceCommon::removeUser( CCharacter* user )
--_RefCount;
if ( _RefCount == 0 )
{
commonBuilding->resetRoomCell( _RoomIdx );
if (!keep_room)
commonBuilding->resetRoomCell( _RoomIdx );
release();
}
}
//----------------------------------------------------------------------------
void CRoomInstanceCommon::addUser( CCharacter* user, CCharacter* owner )
void CRoomInstanceCommon::addUser( CCharacter* user, const NLMISC::CEntityId & owner, bool send_url )
{
BOMB_IF( !user, "<BUILDING> null character!", return );
@ -76,7 +77,7 @@ std::string CRoomInstanceCommon::getRoomDescription() const
}
//----------------------------------------------------------------------------
void CRoomInstanceGuild::removeUser( CCharacter* user )
void CRoomInstanceGuild::removeUser( CCharacter* user, bool send_url, bool keep_room )
{
BOMB_IF( !user, "<BUILDING> null character!", return );
@ -94,26 +95,29 @@ void CRoomInstanceGuild::removeUser( CCharacter* user )
return;
}
user->sendUrl("app_ryzhome action=quit_guild_room&room_name="+guildBuilding->getName());
--_RefCount;
if ( _RefCount == 0 )
{
guildBuilding->resetRoomCell( _RoomIdx, _GuildId );
if (!keep_room)
guildBuilding->resetRoomCell( _RoomIdx, _GuildId );
release();
}
}
//----------------------------------------------------------------------------
void CRoomInstanceGuild::addUser( CCharacter* user, CCharacter* owner )
void CRoomInstanceGuild::addUser( CCharacter* user, const NLMISC::CEntityId & owner, bool send_url )
{
BOMB_IF( !user, "<BUILDING> null character!", return );
#ifdef RYZOM_FORGE_ROOM
CBuildingPhysicalGuild * guildBuilding = dynamic_cast<CBuildingPhysicalGuild *>( _Building );
BOMB_IF( !guildBuilding, "<BUILDING> building type does not match with room type", return );
#endif
// open guild inventory window
PlayerManager.sendImpulseToClient(user->getId(), "GUILD:OPEN_INVENTORY");
user->sendUrl("app_ryzhome action=open_guild_room&owner="+ owner.toString()+"&room_name="+guildBuilding->getName());
++_RefCount;
}
@ -131,7 +135,7 @@ std::string CRoomInstanceGuild::getRoomDescription() const
}
//----------------------------------------------------------------------------
void CRoomInstancePlayer::removeUser( CCharacter* user )
void CRoomInstancePlayer::removeUser( CCharacter* user, bool send_url, bool keep_room )
{
BOMB_IF( !user, "<BUILDING> null character!", return );
@ -148,47 +152,46 @@ void CRoomInstancePlayer::removeUser( CCharacter* user )
);
return;
}
if (send_url)
user->sendUrl(toString("app_ryzhome action=quit_player_room&room_name=%s&powo=%d", playerBuilding->getName().c_str(), user->getPowoCell()));
--_RefCount;
if ( _RefCount == 0 )
{
#ifdef RYZOM_FORGE_ROOM
playerBuilding->resetRoomCell( _RoomIdx , user->getInRoomOfPlayer());
#else
playerBuilding->resetRoomCell( _RoomIdx , user->getId() );
#endif
if (!keep_room)
playerBuilding->resetRoomCell( _RoomIdx , user->getInRoomOfPlayer());
release();
}
#ifdef RYZOM_FORGE_ROOM
user->setInRoomOfPlayer(CEntityId::Unknown);
#endif
}
//----------------------------------------------------------------------------
void CRoomInstancePlayer::addUser( CCharacter* user, CCharacter* owner )
void CRoomInstancePlayer::addUser( CCharacter* user, const NLMISC::CEntityId & owner, bool send_url )
{
BOMB_IF( !user, "<BUILDING> null character!", return );
#ifdef RYZOM_FORGE_ROOM
CBuildingPhysicalPlayer * playerBuilding = dynamic_cast<CBuildingPhysicalPlayer *>( _Building );
BOMB_IF( !playerBuilding, "<BUILDING> building type does not match with room type", return );
#endif
// open room inventory window
// TODO: Does a visiting user have access to the inventory? -Kaetemi
PlayerManager.sendImpulseToClient(user->getId(), "ITEM:OPEN_ROOM_INVENTORY");
#ifdef RYZOM_FORGE_ROOM
if (owner)
{
owner->removeRoomAccesToPlayer(user->getId(),false);
user->setInRoomOfPlayer(owner->getId());
}
else
// open room inventory window if not in powo or in powo and have access
if (user->getPowoCell() == 0 || user->getPowoFlag("room_inv"))
PlayerManager.sendImpulseToClient(user->getId(), "ITEM:OPEN_ROOM_INVENTORY");
// open guild inventory window if in powo and have access (in powo all are player rooms)
if (user->getPowoCell() != 0 && user->getPowoFlag("guild_inv"))
PlayerManager.sendImpulseToClient(user->getId(), "GUILD:OPEN_INVENTORY");
if (owner != CEntityId::Unknown)
{
// Very rare case
owner = user;
CCharacter * o = PlayerManager.getChar(owner);
if (o)
o->removeRoomAccesToPlayer(user->getId(), false);
user->setInRoomOfPlayer(owner);
}
#endif
if (send_url)
user->sendUrl(toString("app_ryzhome action=open_player_room&owner=%s&room_name=%s&powo=%d", owner.toString().c_str(), playerBuilding->getName().c_str(), user->getPowoCell()));
++_RefCount;
}

@ -35,9 +35,9 @@ public:
/// ctor
inline IRoomInstance();
/// remove a user from the room
virtual void removeUser( CCharacter* user ) = 0;
virtual void removeUser( CCharacter* user, bool send_url=true, bool keep_room=false ) = 0;
/// add a user in the room
virtual void addUser( CCharacter* user, CCharacter* owner ) = 0;
virtual void addUser( CCharacter* user, const NLMISC::CEntityId & owner, bool send_url=true) = 0;
/// create the room from a building
virtual bool create( IBuildingPhysical * building, uint16 roomIdx, uint16 ownerIdx , sint32 cell);
/// return true if the room is valid
@ -78,8 +78,8 @@ public:
virtual std::string getRoomDescription() const;
private:
virtual void removeUser( CCharacter* user );
virtual void addUser( CCharacter* user, CCharacter* owner );
virtual void removeUser( CCharacter* user, bool send_url=true, bool keep_room=false );
virtual void addUser( CCharacter* user, const NLMISC::CEntityId & owner, bool send_url=true );
};
/// a guild room
@ -98,8 +98,8 @@ public:
private:
virtual bool create( IBuildingPhysical * building, uint16 roomIdx, uint16 ownerIdx , sint32 cell);
virtual void removeUser( CCharacter* user );
virtual void addUser( CCharacter* user, CCharacter* owner );
virtual void removeUser( CCharacter* user, bool send_url=true, bool keep_room=false );
virtual void addUser( CCharacter* user, const NLMISC::CEntityId & owner, bool send_url=true );
EGSPD::TGuildId _GuildId;
};
@ -116,8 +116,8 @@ public:
private:
virtual bool create( IBuildingPhysical * building, uint16 roomIdx, uint16 ownerIdx , sint32 cell);
virtual void removeUser( CCharacter* user );
virtual void addUser( CCharacter* user, CCharacter* owner );
virtual void removeUser( CCharacter* user, bool send_url=true, bool keep_room=false);
virtual void addUser( CCharacter* user, const NLMISC::CEntityId & owner, bool send_url=true);
/// owner player
NLMISC::CEntityId _Player;
};

@ -29,6 +29,7 @@
#include "character_structure/pact_class.h"
#include "character_structure/character_sentence.h"
#include "character_structure/known_brick_info.h"
#include "game_item_manager/game_item.h"
/**
@ -75,7 +76,7 @@ public:
//std::vector< CCharacterSentence * > _MemorizedSentencesSpecial;
/// inventory of known bricks (map Id to Latency end date)
//std::map< NLMISC::CSheetId, CKnownBrickInfo > _KnownBricks;
std::map< NLMISC::CSheetId, CKnownBrickInfo > _KnownBricks;
/// the known faber plans for that player (directly the reflect of the database)
// std::vector<uint64> _KnownFaberPlans;

@ -31,7 +31,7 @@ public:
std::vector<uint8> BricksIndexInSentence;
/// Serialisation
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( Name );
f.serialCont( BricksIds );

@ -0,0 +1,49 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RY_KNOWN_BRICK_INFO_H
#define RY_KNOWN_BRICK_INFO_H
// ---------------------------------------------------------------------------
class CStaticGameBrick;
// ---------------------------------------------------------------------------
struct CKnownBrickInfo
{
const CStaticGameBrick* Form;
uint32 LatencyEndDate;
bool OldLatentState;
CKnownBrickInfo( const CStaticGameBrick *form = NULL ) : Form(form)
{
LatencyEndDate = 0;
OldLatentState = false;
}
/// Serialisation
void serial(class NLMISC::IStream &f)
{
// f.serial( LatencyEndDate );
// f.serial( OldLatentState );
// nothing to serial here, the date are no longer meaningful, all bricks are available when the character connects to the game
// and the Form is set while setting the databse in the setDatabase() method
}
};
#endif // RY_KNOWN_BRICK_INFO_H
/* known_brick_info.h */

@ -128,7 +128,7 @@ void cbClientItemEquip( NLNET::CMessage& msgin, const std::string &serviceName,
// if player is stunned or dead cancel action
if (c->isDead() || c->isStunned())
return;
c->equipCharacter( INVENTORIES::TInventory(equippedInventory), equippedSlot, bagSlot, true );
c->equipCharacter( INVENTORIES::TInventory(equippedInventory), equippedSlot, bagSlot, false );
}
}
@ -154,7 +154,7 @@ void cbClientItemUnequip( NLNET::CMessage& msgin, const std::string &serviceName
if (c->isDead() || c->isStunned())
return;
c->unequipCharacter( INVENTORIES::TInventory(equippedInventory), equippedSlot, true );
c->unequipCharacter( INVENTORIES::TInventory(equippedInventory), equippedSlot, false );
}
}
@ -354,171 +354,6 @@ void cbClientItemStopUseXpCat( CMessage& msgin, const std::string &serviceName,
character->stopUseItem( isRingCatalyser );
}
void cbClientItemLock(NLNET::CMessage &msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
{
CEntityId eid;
INVENTORIES::TInventory inventory;
uint16 slot;
bool lock;
msgin.serial(eid);
msgin.serialShortEnum(inventory);
msgin.serial(slot);
msgin.serial(lock);
CCharacter *character = PlayerManager.getChar(eid);
DROP_IF(!character, "Character not found", return);
DROP_IF(inventory == INVENTORIES::UNDEFINED, "Inventory is undefined", return);
CInventoryPtr invent = character->getInventory(inventory);
DROP_IF(slot >= invent->getSlotCount(), "Invalid slot specified", return);
CGameItemPtr item = invent->getItem(slot);
DROP_IF(item == NULL, "Item does not exist", return);
item->setLockedByOwner(lock);
}
void cbClientItemRename(NLNET::CMessage &msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
{
CEntityId eid;
INVENTORIES::TInventory inventory;
uint16 slot;
bool literal;
string text;
msgin.serial(eid);
msgin.serialShortEnum(inventory);
msgin.serial(slot);
msgin.serial(literal);
msgin.serial(text);
CCharacter *character = PlayerManager.getChar(eid);
DROP_IF(!character, "Character not found", return);
DROP_IF(inventory == INVENTORIES::UNDEFINED, "Inventory is undefined", return);
CInventoryPtr invent = character->getInventory(inventory);
DROP_IF(slot >= invent->getSlotCount(), "Invalid slot specified", return);
CGameItemPtr item = invent->getItem(slot);
DROP_IF(item == NULL, "Item does not exist", return);
if (!character->havePriv(":DEV:SGM:GM:EM:"))
{
// TODO: Some special rights to name items :)
const NLMISC::CEntityId &crafterEId = item->getCreator();
const NLMISC::CEntityId &userEId = character->getId();
DROP_IF(crafterEId != userEId, "Item name can only be set by the crafter", return);
}
/*
const CStaticItem *form = item->getStaticForm();
DROP_IF(!form, "Item does not have a static form", return);
ITEMFAMILY::EItemFamily family = form->Family;
DROP_IF(!ITEMFAMILY::isTextCustomizable(family), "Item text cannot be changed", return);
*/
if (literal)
{
text = capitalizeFirst(text); // Require first character to be capitalized
if (text.size() >= 255) // Limit literal text length
text = text.substr(0, 255);
}
item->setPhraseId(text, literal);
}
/// returns 0 on success, anything else is error:
/// -1: Invalid inventory
/// -2: Invalid slot
/// -3: Empty slot
sint32 clientItemWrite(CCharacter* character, INVENTORIES::TInventory inventory, uint32 slot, ucstring const& text)
{
if (inventory==INVENTORIES::UNDEFINED)
{
return -1;
}
CInventoryPtr invent = character->getInventory(inventory);
if (slot >= invent->getSlotCount())
{
return -2;
}
if (invent->getItem(slot) == NULL)
{
return -3;
}
CGameItemPtr item = invent->getItem(slot);
item->setCustomText(text.toUtf8());
// Following line was commented out by trap, reason unknown
character->incSlotVersion(inventory, slot); // this ensures re-fetch of info window, unusual case
return 0;
}
void cbClientItemWrite( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId )
{
CEntityId eid;
INVENTORIES::TInventory inventory;
uint16 slot;
string text;
msgin.serial(eid);
msgin.serialShortEnum(inventory);
msgin.serial(slot);
msgin.serial(text);
CCharacter* character = PlayerManager.getChar(eid);
if(!character) return;
if (!character->havePriv(":DEV:SGM:GM:EM:"))
{
// it should be the crafter of the item, check
if (inventory==INVENTORIES::UNDEFINED) return;
CInventoryPtr invent = character->getInventory(inventory);
if (slot >= invent->getSlotCount()) return;
if (invent->getItem(slot) == NULL) return;
CGameItemPtr item = invent->getItem(slot);
const NLMISC::CEntityId &crafterEId = item->getCreator();
const NLMISC::CEntityId &userEId = character->getId();
if(crafterEId != userEId)
{
string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString();
nlwarning("HACK: %s %s tries to set custom text on an item he didn't crafted", userEId.toString().c_str(), name.c_str());
return;
}
// text must not be too big
if(text.size() > 256)
{
string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString();
nlwarning("HACK: %s %s tries to set custom text of a size > 256 (%d)", userEId.toString().c_str(), name.c_str(), text.size());
return;
}
// the item must have the good family
const CStaticItem * form = item->getStaticForm();
if (!form) return;
ITEMFAMILY::EItemFamily family = form->Family;
if (!ITEMFAMILY::isTextCustomizable(family))
{
string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString();
nlwarning("HACK: %s %s tries to set custom text on a item that is not text customizable (%s)", userEId.toString().c_str(), name.c_str(), ITEMFAMILY::toString(family).c_str());
return;
}
// prevent use of @WEB at begin
if (NLMISC::startsWith(text, "@WEB"))
text = text.substr(4);
// force that the begin of the text for non admin is %mfc
if(!text.empty() && text.substr(0, 4) != string("%mfc"))
{
text = string("%mfc") + text;
}
}
clientItemWrite(character, inventory, slot, text);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -983,7 +818,28 @@ void cbClientCombatDodge( NLNET::CMessage& msgin, const std::string &serviceName
}
}
void cbClientAutoPact( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
{
H_AUTO(cbClientAutoPact);
CEntityId charId;
msgin.serial(charId);
bool activate = false;
CCharacter *character = PlayerManager.getChar(charId);
if (character && character->getEnterFlag())
{
uint8 bval;
msgin.serial(bval);
if (bval)
activate = true;
character->doPact(activate);
}
else
nlwarning("%s is invalid", charId.toString().c_str());
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -2124,7 +1980,7 @@ void cbClientSendCustomEmote( NLNET::CMessage& msgin, const std::string &service
return;
}
if (behaviour >= (MBEHAV::EMOTE_BEGIN + 80) && behaviour <= (MBEHAV::EMOTE_BEGIN + 109))
if(behaviour >= 140 && behaviour <= 169)
{
string name = CEntityIdTranslator::getInstance()->getByEntity(id).toString();
nlwarning("HACK: %s %s tries to launch a firework %d", id.toString().c_str(), name.c_str(), behaviour);
@ -2815,7 +2671,6 @@ void cbClientGuildQuit( NLNET::CMessage& msgin, const std::string & serviceName,
void cbClientGuildPutMoney( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId );
/// money : guild to bag
void cbClientGuildTakeMoney( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId );
void cbClientGuildItemAccess( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId );
/// outpost callbacks (implemented in guild_client_callbacks.cpp)
void cbClientOutpostSetSquad(NLNET::CMessage & msgin, const std::string & serviceName, NLNET::TServiceId serviceId);
@ -2906,8 +2761,7 @@ void cbClientSetCharacterTitle( NLNET::CMessage& msgin, const std::string & serv
}
// kxu: TODO: check validity of title chosen by player
// TODO: Checking validity here is important! This can be easily hacked clientside. -Kaetemi
c->setTitle((CHARACTER_TITLE::ECharacterTitle)title);
c->setNewTitle(CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)title));
c->registerName();
}
@ -3227,6 +3081,8 @@ void cbClientQuitGameRequest( NLNET::CMessage& msgin, const std::string & servic
try
{
msgin.serial(charId);
CPlayer *player = PlayerManager.getPlayer(uint32(charId.getShortId()) >> 4);
if (IsRingShard)
bypassDisconnectionTimer = true;
else
@ -3238,14 +3094,15 @@ void cbClientQuitGameRequest( NLNET::CMessage& msgin, const std::string & servic
H_AUTO(BypassDiscoTimer);
CSecurityCheckForFastDisconnection securityCheck;
securityCheck.receiveSecurityCode(msgin);
CPlayer *player = PlayerManager.getPlayer(uint32(charId.getShortId()) >> 4);
if (player)
securityCheck.setCookie(player->getLoginCookie()); // if not set (null player), the check won't pass
// TODO_RYZOMCLASSIC: There used to be a value here. -Kaetemi
securityCheck.check("");
securityCheck.check("QtXp1o1t?");
}
}
if (player != NULL && player->havePriv( ":DEV:SGM:GM:" ))
bypassDisconnectionTimer = true;
}
catch (const Exception &e) // will catch any serialization/security exception
{
@ -3257,7 +3114,7 @@ void cbClientQuitGameRequest( NLNET::CMessage& msgin, const std::string & servic
TDataSetRow rowId = TheDataset.getDataSetRow(charId);
const uint32 playerId = PlayerManager.getPlayerId(charId);
if (rowId.isNull() || !rowId.isValid())
if (!rowId.isValid())
{
PlayerManager.disconnectPlayer(playerId);
}
@ -3304,6 +3161,114 @@ void cbClientReturnToMainland( NLNET::CMessage& msgin, const std::string & servi
}
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// CLIENT:EVENT
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
/// returns 0 on success, anything else is error:
/// -1: Invalid inventory
/// -2: Invalid slot
/// -3: Empty slot
sint32 clientEventSetItemCustomText(CCharacter* character, INVENTORIES::TInventory inventory, uint32 slot, ucstring const& text)
{
if (inventory==INVENTORIES::UNDEFINED)
{
return -1;
}
CInventoryPtr invent = character->getInventory(inventory);
if (slot >= invent->getSlotCount())
{
return -2;
}
if (invent->getItem(slot) == NULL)
{
return -3;
}
CGameItemPtr item = invent->getItem(slot);
item->setCustomText(text);
// Following line was commented out by trap, reason unknown
character->incSlotVersion(inventory, slot);
return 0;
}
void cbClientEventSetItemCustomText( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId )
{
CEntityId eid;
INVENTORIES::TInventory inventory;
uint32 uiInventory;
uint32 slot;
ucstring text;
msgin.serial(eid);
msgin.serial(uiInventory);
inventory = (INVENTORIES::TInventory)uiInventory;
msgin.serial(slot);
msgin.serial(text);
CCharacter* character = PlayerManager.getChar(eid);
if(!character) return;
if (!character->havePriv(":DEV:SGM:GM:EM:"))
{
// it should be the crafter of the item, check
if (inventory==INVENTORIES::UNDEFINED) return;
CInventoryPtr invent = character->getInventory(inventory);
if (slot >= invent->getSlotCount()) return;
if (invent->getItem(slot) == NULL) return;
CGameItemPtr item = invent->getItem(slot);
const NLMISC::CEntityId &crafterEId = item->getCreator();
const NLMISC::CEntityId &userEId = character->getId();
if(crafterEId != userEId)
{
string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString();
nlwarning("HACK: %s %s tries to set custom text on an item he didn't crafted", userEId.toString().c_str(), name.c_str());
return;
}
// text must not be too big
if(text.size() > 256)
{
string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString();
nlwarning("HACK: %s %s tries to set custom text of a size > 256 (%d)", userEId.toString().c_str(), name.c_str(), text.size());
return;
}
// the item must have the good family
const CStaticItem * form = item->getStaticForm();
if (!form) return;
ITEMFAMILY::EItemFamily family = form->Family;
if (!ITEMFAMILY::isTextCustomizable(family))
{
string name = CEntityIdTranslator::getInstance()->getByEntity(userEId).toString();
nlwarning("HACK: %s %s tries to set custom text on a item that is not text customizable (%s)", userEId.toString().c_str(), name.c_str(), ITEMFAMILY::toString(family).c_str());
return;
}
// prevent use of @WEB at begin
if (text.size() > 3 && text[0]=='@' && text[1]=='W' && text[2]=='E' && text[3]=='B')
text = text.substr(4, text.size() - 4);
// prevent use of @LUA at begin
if (text.size() > 3 && text[0]=='@' && text[1]=='L' && text[2]=='U' && text[3]=='A')
text = text.substr(4, text.size() - 4);
// force that the begin of the text for non admin is %mfc
if(!text.empty() && text.substr(0, 4) != ucstring("%mfc"))
{
text = ucstring("%mfc") + text;
}
}
clientEventSetItemCustomText(character, inventory, slot, text);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// CLIENT:TOTEM
@ -3485,9 +3450,6 @@ TUnifiedCallbackItem CbClientArray[]=
{ "CLIENT:ITEM:ENCHANT", cbClientItemEnchant },
{ "CLIENT:ITEM:USE_ITEM", cbClientItemUseItem },
{ "CLIENT:ITEM:STOP_USE_XP_CAT", cbClientItemStopUseXpCat },
{ "CLIENT:ITEM:LOCK", cbClientItemLock },
{ "CLIENT:ITEM:RENAME", cbClientItemRename },
{ "CLIENT:ITEM:WRITE", cbClientItemWrite },
{ "CLIENT:ITEM_INFO:GET", cbClientItemInfos },
@ -3577,6 +3539,7 @@ TUnifiedCallbackItem CbClientArray[]=
{ "CLIENT:COMMAND:AFK", cbClientSendAfk },
{ "CLIENT:COMMAND:RANDOM", cbClientRollDice },
{ "CLIENT:COMMAND:GUILDMOTD", cbClientGuildMotd },
{ "CLIENT:COMMAND:AUTOPACT", cbClientAutoPact },
// For all these commented commands, now you have to use the CLIENT:COMMAND:ADMIN message using /a client command
@ -3657,7 +3620,6 @@ TUnifiedCallbackItem CbClientArray[]=
//{ "CLIENT:GUILD:GUILD_TO_BAG", cbClientGuildToBag },
{ "CLIENT:GUILD:PUT_MONEY", cbClientGuildPutMoney },
{ "CLIENT:GUILD:TAKE_MONEY", cbClientGuildTakeMoney },
{ "CLIENT:GUILD:ITEM_ACCESS", cbClientGuildItemAccess },
// outpost related messages
{ "CLIENT:OUTPOST:SET_SQUAD", cbClientOutpostSetSquad },
@ -3689,16 +3651,9 @@ TUnifiedCallbackItem CbClientArray[]=
{ "CLIENT:DUEL:REFUSE", cbClientDuelRefuse },
{ "CLIENT:DUEL:ABANDON", cbClientDuelAbandon },
#ifdef RYZOM_FORGE
// FIXME
{ "CLIENT:PVP_CHALLENGE:ASK", cbClientLeagueJoinProposal },
{ "CLIENT:PVP_CHALLENGE:ACCEPT", cbClientLeagueJoin },
{ "CLIENT:PVP_CHALLENGE:REFUSE", cbClientLeagueJoinProposalDecline },
#else
{ "CLIENT:PVP_CHALLENGE:ASK", cbClientPVPChallengeAsked },
{ "CLIENT:PVP_CHALLENGE:ACCEPT", cbClientPVPChallengeAccept },
{ "CLIENT:PVP_CHALLENGE:REFUSE", cbClientPVPChallengeRefuse },
#endif
{ "CLIENT:PVP_CHALLENGE:ABANDON", cbClientPVPChallengeAbandon },
// { "CLIENT:PVP_VERSUS:CLAN", cbClientPvpChooseClan },
@ -3710,7 +3665,7 @@ TUnifiedCallbackItem CbClientArray[]=
{ "CLIENT:MISSION:WAKE", cbClientMissionWake },
{ "CLIENT:MISSION:GROUP_WAKE", cbClientMissionGroupWake },
// { "CLIENT:EVENT:SET_ITEM_CUSTOM_TEXT", cbClientEventSetItemCustomText },
{ "CLIENT:EVENT:SET_ITEM_CUSTOM_TEXT", cbClientEventSetItemCustomText },
{ "CLIENT:TOTEM:BUILD", cbTotemBuild },

@ -95,6 +95,7 @@ CCreature::CCreature() : CEntityBase(true)
_AIGroupAlias = CAIAliasTranslator::Invalid;
_AIAlias = CAIAliasTranslator::Invalid;
_PrimAlias = 0;
_LootInventory = 0;
// harvestable( false );
_EntityLooter = CEntityId::Unknown;
@ -119,6 +120,7 @@ CCreature::CCreature() : CEntityBase(true)
_FilterExplicitActionTradeByBotRace= true;
_NbOfPlayersInAggroList = 0;
_NbOfGuardiansKillers = 0;
_Form = 0;
@ -146,6 +148,10 @@ CCreature::CCreature() : CEntityBase(true)
_MaxHitRangeForPC = -1.f;
_Organization = 0;
_LockedLoot = CTEAM::InvalidTeamId;
_LockedLootTime = 0;
// _MissionIconFlags.IsMissionStepIconDisplayable = true;
// _MissionIconFlags.IsMissionGiverIconDisplayable = true;
}
@ -204,6 +210,10 @@ CCreature::~CCreature()
PROGRESSIONPVP::CCharacterProgressionPVP::getInstance()->removeCreature(this);
CAIAliasTranslator::getInstance()->removeAssociation(_Id);
if (_PrimAlias >= 900 && _PrimAlias <= 999) // Spawned Bots
{
CAIAliasTranslator::getInstance()->removeNPCAlias(_AIAlias);
}
if(_Merchant)
{
@ -1461,8 +1471,16 @@ void CCreature::setBotDescription( const CGenNpcDescMsgImp& description )
nlwarning("parseBotOption -> invalid parameter '%s' for 'altar' command in bot %u", result[i].c_str(), _AIAlias );
}
}
}
else
}
else if ( NLMISC::strlwr(result[0]) == "name" )
{
if ( result.size() != 2 )
nlwarning("parseBotOption -> invalid number of params in command '%s' for bot %u", result[0].c_str(), _AIAlias );
else
{
CAIAliasTranslator::getInstance()->setNameForNPCAliases(result[1], _AIAlias);
}
} else
nlwarning("parseBotOption -> invalid command '%s' in bot %u", result[0].c_str(), _AIAlias );
}
// if the bot has a special trade list, it can trade
@ -1797,7 +1815,7 @@ void CCreature::kill(TDataSetRow killerRowId)
//-----------------------------------------------
// CCreature::::tpWanted a tp wanted, check if tp is regular and send a server tp command
//-----------------------------------------------
void CCreature::tpWanted( sint32 x, sint32 y, sint32 z , bool useHeading , float heading , uint8 continent , sint32 cell )
void CCreature::tpWanted( sint32 x, sint32 y, sint32 z , bool useHeading , float heading , uint8 continent , sint32 cell, bool tpWanted )
{
CPhraseManager::getInstance().removeEntity(TheDataset.getDataSetRow(_Id), false);
@ -1827,33 +1845,46 @@ uint32 CCreature::getMagicResistance(EFFECT_FAMILIES::TEffectFamily effectFamily
{
nlassert(_Form);
uint32 value;
switch(effectFamily)
{
case EFFECT_FAMILIES::Root:
return _Form->getResists().Root + _ResistModifiers.Root;
value = _Form->getResists().Root + _ResistModifiers.Root;
break;
case EFFECT_FAMILIES::Mezz:
return _Form->getResists().Sleep + _ResistModifiers.Sleep;
value = _Form->getResists().Sleep + _ResistModifiers.Sleep;
break;
case EFFECT_FAMILIES::Stun:
return _Form->getResists().Stun + _ResistModifiers.Stun;
value = _Form->getResists().Stun + _ResistModifiers.Stun;
break;
case EFFECT_FAMILIES::Blind:
return _Form->getResists().Blind + _ResistModifiers.Blind;
value = _Form->getResists().Blind + _ResistModifiers.Blind;
break;
case EFFECT_FAMILIES::SlowMove:
return _Form->getResists().Snare + _ResistModifiers.Snare;
value = _Form->getResists().Snare + _ResistModifiers.Snare;
break;
case EFFECT_FAMILIES::SlowMelee:
case EFFECT_FAMILIES::SlowRange:
case EFFECT_FAMILIES::SlowMagic:
case EFFECT_FAMILIES::SlowAttack:
return _Form->getResists().Slow + _ResistModifiers.Slow;
value = _Form->getResists().Slow + _ResistModifiers.Slow;
break;
case EFFECT_FAMILIES::Fear:
return _Form->getResists().Fear + _ResistModifiers.Fear;
value = _Form->getResists().Fear + _ResistModifiers.Fear;
break;
case EFFECT_FAMILIES::MadnessMelee:
case EFFECT_FAMILIES::MadnessMagic:
case EFFECT_FAMILIES::MadnessRange:
case EFFECT_FAMILIES::Madness:
return _Form->getResists().Madness + _ResistModifiers.Madness;
value = _Form->getResists().Madness + _ResistModifiers.Madness;
break;
default:
return 0;
value = 0;
};
if (value >= 10000)
value = CCreatureResists::ImmuneScore;
return value;
} // getResistScore //
//--------------------------------------------------------------
@ -1863,25 +1894,37 @@ uint32 CCreature::getMagicResistance(DMGTYPE::EDamageType dmgType)
{
nlassert(_Form);
uint32 value;
switch(dmgType)
{
case DMGTYPE::ACID:
return _Form->getResists().Acid + _ResistModifiers.Acid;
value = _Form->getResists().Acid + _ResistModifiers.Acid;
break;
case DMGTYPE::COLD:
return _Form->getResists().Cold + _ResistModifiers.Cold;
value = _Form->getResists().Cold + _ResistModifiers.Cold;
break;
case DMGTYPE::ELECTRICITY:
return _Form->getResists().Electricity + _ResistModifiers.Electricity;
value = _Form->getResists().Electricity + _ResistModifiers.Electricity;
break;
case DMGTYPE::FIRE:
return _Form->getResists().Fire + _ResistModifiers.Fire;
value = _Form->getResists().Fire + _ResistModifiers.Fire;
break;
case DMGTYPE::POISON:
return _Form->getResists().Poison + _ResistModifiers.Poison;
value = _Form->getResists().Poison + _ResistModifiers.Poison;
break;
case DMGTYPE::ROT:
return _Form->getResists().Rot + _ResistModifiers.Rot;
value = _Form->getResists().Rot + _ResistModifiers.Rot;
break;
case DMGTYPE::SHOCK:
return _Form->getResists().Shockwave + _ResistModifiers.Shockwave;
value = _Form->getResists().Shockwave + _ResistModifiers.Shockwave;
break;
default:
return 0;
};
if (value >=10000)
value = CCreatureResists::ImmuneScore;
return value;
} // getResistScore //
@ -1991,6 +2034,24 @@ void CCreature::setOutpostBuilding(COutpostBuilding *pOB)
}
}
//--------------------------------------------------------------
// Add guardian killer in list
//--------------------------------------------------------------
void CCreature::addGuardianKiller( TDataSetRow PlayerRowId )
{
CCharacter * pChar = PlayerManager.getChar(PlayerRowId);
if ( pChar != NULL )
{
// Update _LockedLootTime each time a player is aggro by a boss guardian (increase the end of the lock)
_LockedLootTime = CTickEventHandler::getGameCycle();
if( _GuardiansKillers.find( PlayerRowId ) == _GuardiansKillers.end() )
{
_GuardiansKillers.insert( PlayerRowId );
++_NbOfGuardiansKillers;
}
}
}
//--------------------------------------------------------------
// keep aggressiveness of a creature against player character
//--------------------------------------------------------------
@ -2079,8 +2140,103 @@ uint32 CCreature::tickUpdate()
}
}
if (_LockedLootTime != 0 && _LockedLootTime + 900 < CTickEventHandler::getGameCycle())
{
nlinfo("Boss unlocked : %s at %d", _Id.toString().c_str(), CTickEventHandler::getGameCycle());
_LockedLootTime = 0;
_NbOfGuardiansKillers = 0;
_GuardiansKillers.clear();
}
if (!isDead() && (_NbOfGuardiansKillers || _NbOfPlayersInAggroList || _LockedLoot != CTEAM::InvalidTeamId))
{
if (_LockedLoot != CTEAM::InvalidTeamId)
{
if (_LockedLootTime == 0)
{
bool keepLock = false;
for ( set<TDataSetRow>::iterator it = _Agressiveness.begin(); it != _Agressiveness.end(); ++it )
{
CCharacter * pChar = PlayerManager.getChar( *it );
if (pChar && pChar->getTeamId() == _LockedLoot)
{
keepLock = true;
break;
}
}
if (!keepLock)
{
_LockedLoot = CTEAM::InvalidTeamId;
nlinfo("unlock me");
}
}
}
else
{
vector< uint16 > teams;
// It's a Boss creature with Guardians killers
if (_LockedLootTime != 0)
{
// Check if 2 guardians killers are in same team and so lock the loot
for ( set<TDataSetRow>::iterator it = _GuardiansKillers.begin(); it != _GuardiansKillers.end(); ++it )
{
CCharacter * pChar = PlayerManager.getChar( *it );
if (pChar && pChar->getTeamId() != CTEAM::InvalidTeamId)
{
uint16 pTeam = pChar->getTeamId();
for( vector< uint16 >::const_iterator itTeam = teams.begin(); itTeam != teams.end(); ++itTeam )
{
if (pTeam == *itTeam)
{
_LockedLoot = *itTeam;
break;
}
}
teams.push_back(pTeam);
}
if (_LockedLoot != CTEAM::InvalidTeamId) {
nlinfo("locked by guardians killers");
break;
}
}
}
// If not locked with guardians killers, check with players in aggro list
if (_LockedLoot == CTEAM::InvalidTeamId)
{
for ( set<TDataSetRow>::iterator it = _Agressiveness.begin(); it != _Agressiveness.end(); ++it )
{
CCharacter * pChar = PlayerManager.getChar( *it );
if (pChar && pChar->getTeamId() != CTEAM::InvalidTeamId)
{
uint16 pTeam = pChar->getTeamId();
for( vector< uint16 >::const_iterator itTeam = teams.begin(); itTeam != teams.end(); ++itTeam )
{
if (pTeam == *itTeam)
{
_LockedLoot = *itTeam;
break;
}
}
teams.push_back(pTeam);
}
if (_LockedLoot != CTEAM::InvalidTeamId) {
nlinfo("locked by killers");
break;
}
}
}
}
}
if (currentHp()!=maxHp() && !isDead()) return 12;
return 24;
return 24;
} // tickUpdate //
//---------------------------------------------------

@ -315,6 +315,9 @@ public:
/// get the welcome chat message
inline const std::string & getWelcomeMessage() { return _WelcomePhrase; }
inline const std::string & getUrlForDeathNotification() { return _UrlForDeathNotification; }
inline void setUrlForDeathNotification(const std::string &url) { _UrlForDeathNotification = url; }
/**
* apply the effect of the armor/shield on damage. Update the armor items if necessary
* \return the remaining damages
@ -357,7 +360,7 @@ public:
}
// tp wanted for an entity
void tpWanted( sint32 x, sint32 y, sint32 z , bool useHeading = false, float heading = 0.0f , uint8 continent = 0xFF, sint32 cell = 0);
void tpWanted( sint32 x, sint32 y, sint32 z , bool useHeading = false, float heading = 0.0f , uint8 continent = 0xFF, sint32 cell = 0, bool tpWanted = false);
/// request a despawn after a number of game cycles
void requestDespawn(NLMISC::TGameCycle waitCycles = 0);
@ -379,6 +382,12 @@ public:
/// enable loot rights for given team
void enableLootRights(uint16 teamId);
inline void lockLoot(uint16 teamId) { _LockedLoot = teamId; }
inline uint16 getLockLoot() { return _LockedLoot; }
inline NLMISC::TGameCycle getLockLootTime() { return _LockedLootTime; }
/// get the resist value associated to effect type
uint32 getMagicResistance(EFFECT_FAMILIES::TEffectFamily effectFamily);
@ -415,6 +424,11 @@ public:
void deathReportSent() { _DeathReportHasBeenSent = true; }
//#endif
/// Add guardian killer in list
void addGuardianKiller(TDataSetRow PlayerRowId);
/// keep aggressiveness of a creature against player character
void addAggressivenessAgainstPlayerCharacter( TDataSetRow PlayerRowId );
@ -612,6 +626,8 @@ private:
// loot rights management
std::vector< TDataSetRow > _LootRight; // list of CCharacter have loot right after creature death, if emty all have loot right
NLMISC::TGameCycle _LootRightDuration; // Duration of loot right before all have loot right
uint16 _LockedLoot; // Loot is locked by the player
NLMISC::TGameCycle _LockedLootTime; // Time of lock of loot (for bosses)
//#ifdef NL_DEBUG
// Looking for a 'Zombie' bug (creature dead on EGS, but not on AIS)
@ -634,6 +650,12 @@ private:
// creature agressiveness against player character
std::set< TDataSetRow > _Agressiveness;
// players attacking the boss guardians
std::set< TDataSetRow > _GuardiansKillers;
// keep nb of guardians killers
uint16 _NbOfGuardiansKillers;
// keep nb of players in creature aggro list (as aggro list also contains npcs or creatures)
uint16 _NbOfPlayersInAggroList;
@ -669,6 +691,8 @@ private:
std::string _CustomLootTableId;
//if the creature has a user model, this is the alias of the primitive where the model is defined
uint32 _PrimAlias;
std::string _UrlForDeathNotification;
};
typedef NLMISC::CSmartPtr<CCreature> CCreaturePtr;

@ -277,15 +277,13 @@ void CCreatureSetUrlImp::callback(const string &, NLNET::TServiceId sid)
(string &)wp = "";
program &= ~(1 << BOTCHATTYPE::WebPageFlag);
c->setBotChatProgram(program);
return;
continue;
}
else
(string &)wp = Url;
const string &wpn = c->getWebPageName();
(string &)wpn = ActionName;
return;
}
}
}
@ -661,6 +659,14 @@ void CAIGainAggroMsgImp::callback (const std::string &name, NLNET::TServiceId id
if( creature )
{
// creature->getCreatureOpponent().storeAggressor(PlayerRowId,0);
creature->addAggressivenessAgainstPlayerCharacter( PlayerRowId );
if (IsBoss)
{
creature->addGuardianKiller(PlayerRowId);
nlinfo("Player is a guardian killer");
}
else
{
creature->addAggressivenessAgainstPlayerCharacter( PlayerRowId );
}
}
}

@ -59,7 +59,7 @@ public:
{}
/// serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( Name );
f.serial( AssociatedItemName );

@ -2,9 +2,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -19,7 +16,18 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
//
//
//
//
//
// WARNING : this is a generated file, don't change it !
//
//
//
//
//
//
/////////////////////////////////////////////////////////////////
#include "stdpch.h"
@ -143,7 +151,7 @@ void CBankAccessor_GUILD::TGUILD::TFAME::init(ICDBStructNode *parent)
// branch init
for (uint i=0; i<6; ++i)
for (uint i=0; i<7; ++i)
{
node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("%u", i)), false );
nlassert(node != NULL);
@ -514,7 +522,7 @@ void CBankAccessor_GUILD::TGUILD::TOUTPOST::TO::TSQUADS::init(ICDBStructNode *pa
{
node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("SP%u", i)), false );
nlassert(node != NULL);
C_SP[i].init(node, i);
_SP[i].init(node, i);
}
for (uint i=0; i<24; ++i)

@ -1,11 +1,10 @@
#ifndef INCLUDED_database_GUILD_H
#define INCLUDED_database_GUILD_H
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -20,12 +19,20 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
//
//
//
//
//
// WARNING : this is a generated file, don't change it !
//
//
//
//
//
//
/////////////////////////////////////////////////////////////////
#ifndef INCLUDED_DATABASE__GUILD_H
#define INCLUDED_DATABASE__GUILD_H
#include "nel/misc/string_common.h"
#include "cdb_group.h"
#include "player_manager/cdb.h"
@ -251,7 +258,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
ICDBStructNode *_CULT_ALLEGIANCE;
ICDBStructNode *_CIV_ALLEGIANCE;
TArray _Array[6];
TArray _Array[7];
public:
@ -311,7 +318,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
}
TArray &getArray(uint32 index)
{
nlassert(index < 6);
nlassert(index < 7);
return _Array[index];
}
@ -970,7 +977,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
private:
ICDBStructNode *_BranchNode;
TSP C_SP[24];
TSP _SP[24];
TT _T[24];
@ -986,7 +993,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
TSP &getSP(uint32 index)
{
nlassert(index < 24);
return C_SP[index];
return _SP[index];
}
TT &getT(uint32 index)
{
@ -1850,4 +1857,4 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
};
#endif // INCLUDED_DATABASE__GUILD_H
#endif // INCLUDED_database_GUILD_H

@ -1,10 +1,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -21,7 +17,6 @@
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
#include "stdpch.h"
#include "database_outpost.h"

@ -1,11 +1,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -19,13 +14,13 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef INCLUDED_database_OUTPOST_H
#define INCLUDED_database_OUTPOST_H
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
#ifndef INCLUDED_DATABASE__OUTPOST_H
#define INCLUDED_DATABASE__OUTPOST_H
#include "nel/misc/string_common.h"
#include "cdb_group.h"
#include "player_manager/cdb.h"
@ -145,11 +140,11 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
class TOUTPOST_SELECTED
{
{
public:
class TGUILD
{
{
public:
@ -670,4 +665,4 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
};
#endif // INCLUDED_DATABASE__OUTPOST_H
#endif // INCLUDED_database_OUTPOST_H

@ -2,9 +2,6 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This source file has been modified by the following contributors:
// Copyright (C) 2014-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
@ -19,7 +16,18 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
//
//
//
//
//
// WARNING : this is a generated file, don't change it !
//
//
//
//
//
//
/////////////////////////////////////////////////////////////////
#include "stdpch.h"
@ -46,6 +54,7 @@ CBankAccessor_PLR::TASCENSOR CBankAccessor_PLR::_ASCENSOR;
CBankAccessor_PLR::TCHOOSE_MISSIONS CBankAccessor_PLR::_CHOOSE_MISSIONS;
CBankAccessor_PLR::TTRADING CBankAccessor_PLR::_TRADING;
CBankAccessor_PLR::TBRICK_FAMILY CBankAccessor_PLR::_BRICK_FAMILY;
CBankAccessor_PLR::TFABER_PLANS CBankAccessor_PLR::_FABER_PLANS;
CBankAccessor_PLR::TMISSIONS CBankAccessor_PLR::_MISSIONS;
CBankAccessor_PLR::TEXECUTE_PHRASE CBankAccessor_PLR::_EXECUTE_PHRASE;
CBankAccessor_PLR::TCHARACTER_INFO CBankAccessor_PLR::_CHARACTER_INFO;
@ -157,6 +166,11 @@ void CBankAccessor_PLR::init()
// call sub branch init
_BRICK_FAMILY.init(node);
node = bank->getICDBStructNodeFromName( BankTag, "FABER_PLANS" );
nlassert(node != NULL);
// call sub branch init
_FABER_PLANS.init(node);
node = bank->getICDBStructNodeFromName( BankTag, "MISSIONS" );
nlassert(node != NULL);
// call sub branch init
@ -376,7 +390,7 @@ void CBankAccessor_PLR::TUSER::init(ICDBStructNode *parent)
_SKILL_POINTS_[i].init(node, i);
}
for (uint i=0; i<6; ++i)
for (uint i=0; i<7; ++i)
{
node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("FACTION_POINTS_%u", i)), false );
nlassert(node != NULL);
@ -1197,13 +1211,17 @@ void CBankAccessor_PLR::TEXCHANGE::TGIVE::TArray::init(ICDBStructNode *parent, u
nlassert(node != NULL);
_QUANTITY = node;
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
node = parent->getNode( ICDBStructNode::CTextId("CREATE_TIME"), false );
nlassert(node != NULL);
_USER_COLOR = node;
_CREATE_TIME = node;
node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false );
node = parent->getNode( ICDBStructNode::CTextId("SERIAL"), false );
nlassert(node != NULL);
_CHARAC_BUFFS = node;
_SERIAL = node;
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
nlassert(node != NULL);
_USER_COLOR = node;
node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false );
nlassert(node != NULL);
@ -1213,6 +1231,10 @@ void CBankAccessor_PLR::TEXCHANGE::TGIVE::TArray::init(ICDBStructNode *parent, u
nlassert(node != NULL);
_NAMEID = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
node = parent->getNode( ICDBStructNode::CTextId("ENCHANT"), false );
nlassert(node != NULL);
_ENCHANT = node;
@ -1229,14 +1251,6 @@ void CBankAccessor_PLR::TEXCHANGE::TGIVE::TArray::init(ICDBStructNode *parent, u
nlassert(node != NULL);
_PREREQUISIT_VALID = node;
node = parent->getNode( ICDBStructNode::CTextId("WORNED"), false );
nlassert(node != NULL);
_WORNED = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
// branch init
@ -1284,13 +1298,17 @@ void CBankAccessor_PLR::TEXCHANGE::TRECEIVE::TArray::init(ICDBStructNode *parent
nlassert(node != NULL);
_QUANTITY = node;
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
node = parent->getNode( ICDBStructNode::CTextId("CREATE_TIME"), false );
nlassert(node != NULL);
_USER_COLOR = node;
_CREATE_TIME = node;
node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false );
node = parent->getNode( ICDBStructNode::CTextId("SERIAL"), false );
nlassert(node != NULL);
_CHARAC_BUFFS = node;
_SERIAL = node;
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
nlassert(node != NULL);
_USER_COLOR = node;
node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false );
nlassert(node != NULL);
@ -1300,6 +1318,10 @@ void CBankAccessor_PLR::TEXCHANGE::TRECEIVE::TArray::init(ICDBStructNode *parent
nlassert(node != NULL);
_NAMEID = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
node = parent->getNode( ICDBStructNode::CTextId("ENCHANT"), false );
nlassert(node != NULL);
_ENCHANT = node;
@ -1316,14 +1338,6 @@ void CBankAccessor_PLR::TEXCHANGE::TRECEIVE::TArray::init(ICDBStructNode *parent
nlassert(node != NULL);
_PREREQUISIT_VALID = node;
node = parent->getNode( ICDBStructNode::CTextId("WORNED"), false );
nlassert(node != NULL);
_WORNED = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
// branch init
@ -1499,13 +1513,17 @@ void CBankAccessor_PLR::TINVENTORY::TTEMP::TArray::init(ICDBStructNode *parent,
nlassert(node != NULL);
_QUANTITY = node;
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
node = parent->getNode( ICDBStructNode::CTextId("CREATE_TIME"), false );
nlassert(node != NULL);
_USER_COLOR = node;
_CREATE_TIME = node;
node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false );
node = parent->getNode( ICDBStructNode::CTextId("SERIAL"), false );
nlassert(node != NULL);
_CHARAC_BUFFS = node;
_SERIAL = node;
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
nlassert(node != NULL);
_USER_COLOR = node;
node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false );
nlassert(node != NULL);
@ -1515,6 +1533,10 @@ void CBankAccessor_PLR::TINVENTORY::TTEMP::TArray::init(ICDBStructNode *parent,
nlassert(node != NULL);
_NAMEID = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
node = parent->getNode( ICDBStructNode::CTextId("ENCHANT"), false );
nlassert(node != NULL);
_ENCHANT = node;
@ -1531,14 +1553,6 @@ void CBankAccessor_PLR::TINVENTORY::TTEMP::TArray::init(ICDBStructNode *parent,
nlassert(node != NULL);
_PREREQUISIT_VALID = node;
node = parent->getNode( ICDBStructNode::CTextId("WORNED"), false );
nlassert(node != NULL);
_WORNED = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
// branch init
@ -1597,13 +1611,17 @@ void CBankAccessor_PLR::TINVENTORY::TSHARE::TArray::init(ICDBStructNode *parent,
nlassert(node != NULL);
_QUANTITY = node;
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
node = parent->getNode( ICDBStructNode::CTextId("CREATE_TIME"), false );
nlassert(node != NULL);
_USER_COLOR = node;
_CREATE_TIME = node;
node = parent->getNode( ICDBStructNode::CTextId("SERIAL"), false );
nlassert(node != NULL);
_SERIAL = node;
node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false );
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
nlassert(node != NULL);
_CHARAC_BUFFS = node;
_USER_COLOR = node;
node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false );
nlassert(node != NULL);
@ -1613,6 +1631,10 @@ void CBankAccessor_PLR::TINVENTORY::TSHARE::TArray::init(ICDBStructNode *parent,
nlassert(node != NULL);
_NAMEID = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
node = parent->getNode( ICDBStructNode::CTextId("ENCHANT"), false );
nlassert(node != NULL);
_ENCHANT = node;
@ -1629,10 +1651,6 @@ void CBankAccessor_PLR::TINVENTORY::TSHARE::TArray::init(ICDBStructNode *parent,
nlassert(node != NULL);
_PREREQUISIT_VALID = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
node = parent->getNode( ICDBStructNode::CTextId("NB_MEMBER"), false );
nlassert(node != NULL);
_NB_MEMBER = node;
@ -2153,13 +2171,17 @@ void CBankAccessor_PLR::TTRADING::TArray::init(ICDBStructNode *parent, uint inde
nlassert(node != NULL);
_QUANTITY = node;
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
node = parent->getNode( ICDBStructNode::CTextId("CREATE_TIME"), false );
nlassert(node != NULL);
_USER_COLOR = node;
_CREATE_TIME = node;
node = parent->getNode( ICDBStructNode::CTextId("CHARAC_BUFFS"), false );
node = parent->getNode( ICDBStructNode::CTextId("SERIAL"), false );
nlassert(node != NULL);
_CHARAC_BUFFS = node;
_SERIAL = node;
node = parent->getNode( ICDBStructNode::CTextId("USER_COLOR"), false );
nlassert(node != NULL);
_USER_COLOR = node;
node = parent->getNode( ICDBStructNode::CTextId("WEIGHT"), false );
nlassert(node != NULL);
@ -2169,6 +2191,10 @@ void CBankAccessor_PLR::TTRADING::TArray::init(ICDBStructNode *parent, uint inde
nlassert(node != NULL);
_NAMEID = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
node = parent->getNode( ICDBStructNode::CTextId("ENCHANT"), false );
nlassert(node != NULL);
_ENCHANT = node;
@ -2185,10 +2211,6 @@ void CBankAccessor_PLR::TTRADING::TArray::init(ICDBStructNode *parent, uint inde
nlassert(node != NULL);
_PREREQUISIT_VALID = node;
node = parent->getNode( ICDBStructNode::CTextId("INFO_VERSION"), false );
nlassert(node != NULL);
_INFO_VERSION = node;
node = parent->getNode( ICDBStructNode::CTextId("CURRENCY"), false );
nlassert(node != NULL);
_CURRENCY = node;
@ -2282,6 +2304,45 @@ void CBankAccessor_PLR::TBRICK_FAMILY::TArray::init(ICDBStructNode *parent, uint
}
void CBankAccessor_PLR::TFABER_PLANS::init(ICDBStructNode *parent)
{
ICDBStructNode *node = parent;
_BranchNode = node;
// leaf init
// branch init
for (uint i=0; i<64; ++i)
{
node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("%u", i)), false );
nlassert(node != NULL);
_Array[i].init(node, i);
}
}
void CBankAccessor_PLR::TFABER_PLANS::TArray::init(ICDBStructNode *parent, uint index)
{
ICDBStructNode *node = parent;
_BranchNode = node;
// leaf init
node = parent->getNode( ICDBStructNode::CTextId("KNOWN"), false );
nlassert(node != NULL);
_KNOWN = node;
// branch init
}
void CBankAccessor_PLR::TMISSIONS::init(ICDBStructNode *parent)
{
ICDBStructNode *node = parent;
@ -2547,6 +2608,10 @@ void CBankAccessor_PLR::TEXECUTE_PHRASE::TLINK::TArray::init(ICDBStructNode *par
nlassert(node != NULL);
_PHRASE = node;
node = parent->getNode( ICDBStructNode::CTextId("COUNTER"), false );
nlassert(node != NULL);
_COUNTER = node;
node = parent->getNode( ICDBStructNode::CTextId("HP_COST"), false );
nlassert(node != NULL);
_HP_COST = node;
@ -2575,10 +2640,6 @@ void CBankAccessor_PLR::TEXECUTE_PHRASE::TLINK::TArray::init(ICDBStructNode *par
nlassert(node != NULL);
_TARGET_STA = node;
node = parent->getNode( ICDBStructNode::CTextId("COUNTER"), false );
nlassert(node != NULL);
_COUNTER = node;
// branch init
@ -3082,7 +3143,7 @@ void CBankAccessor_PLR::TPACK_ANIMAL::init(ICDBStructNode *parent)
// branch init
for (uint i=0; i<4; ++i)
for (uint i=0; i<7; ++i)
{
node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("BEAST%u", i)), false );
nlassert(node != NULL);
@ -3315,7 +3376,7 @@ void CBankAccessor_PLR::TFAME::init(ICDBStructNode *parent)
// branch init
for (uint i=0; i<6; ++i)
for (uint i=0; i<7; ++i)
{
node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("PLAYER%u", i)), false );
nlassert(node != NULL);

File diff suppressed because it is too large Load Diff

@ -24,7 +24,6 @@
#include "entities_game_service.h"
#include "egs_globals.h"
#include "nel/misc/noise_value.h"
#include "nel/misc/common.h"
#include "nel/misc/variable.h"
#include "nel/misc/words_dictionary.h"
#include "game_share/time_weather_season/time_date_season_manager.h"
@ -36,7 +35,6 @@
#include "game_share/multi_target.h"
#include "phrase_manager/s_effect.h"
#include "projectile_stats.h"
#include "primitives_parser.h"
using namespace std;
using namespace NLMISC;
@ -294,10 +292,11 @@ struct TCompareStaticItemPtrBySheetId : public std::binary_function<CStaticItem*
//-----------------------------------------------------------------------------
// Parse primitive file for one deposit
//-----------------------------------------------------------------------------
bool CDeposit::build( const NLLIGO::CPrimZone* zone)
bool CDeposit::build( const NLLIGO::CPrimZone* zone )
{
if ( IsRingShard )
return false;
//_Id =id;
*( (NLLIGO::CPrimZone*)this ) = *zone;
@ -305,11 +304,7 @@ bool CDeposit::build( const NLLIGO::CPrimZone* zone)
string name;
if ( ! zone->getPropertyByName( "name", name ) ) return malformed( "name", name );
_Name = name;
// Read alias
if(!CPrimitivesParser::getAlias(zone, _Alias))
{
nlwarning("<CDeposit::build> Could not find an alias for deposit %s", _Name.c_str());
}
// Read exact raw material codes to add
vector<string> *exactRMCodesS = NULL;
if ( ! (zone->getPropertyByName( "exact_mp_item", exactRMCodesS ) && exactRMCodesS) ) return malformed( "exact_mp_item", name );
@ -473,21 +468,6 @@ bool CDeposit::build( const NLLIGO::CPrimZone* zone)
return true;
}
CDepositState CDeposit::currentState()
{
CDepositState out;
//If we don't have an alias, don't send any information (it's better to be missing information than having wrong information)
if(_Alias == 0)
return out;
// We should never save the state of a spot without quantity constraint, this is just an additional safeguard against it
if(!_QuantityConstraintsPt)
return out;
out.alias = _Alias;
out.currentQuantity = _QuantityConstraintsPt->getCurrentQuantity();
out.nextRespawnDay = _QuantityConstraintsPt->NextRespawnDay;
return out;
}
/*
* Select the raw materials, using the specified filters and _Ecotype
@ -606,7 +586,7 @@ void CDeposit::selectRMsByFilters( std::vector<std::string>& exactRMCodesS, cons
if ( ! depositReportCreated )
{
depositReportCreated = true;
depositReportFile = nlfopen( "deposit_contents.csv", "wt" ); // fclose() auto?
depositReportFile = fopen( "deposit_contents.csv", "wt" ); // fclose() auto?
if ( depositReportFile )
{
fprintf( depositReportFile, "Deposit;RM;When in year;When in day;Weather;\n" );

@ -195,29 +195,6 @@ namespace NLMISC
class CWordsDictionary;
}
struct CDepositState {
uint32 alias;
float currentQuantity;
uint32 nextRespawnDay;
CDepositState() : alias(0), currentQuantity(0.f), nextRespawnDay(0) {}
void serial(NLMISC::IStream &f)
{
if(f.isXML())
{
f.xmlSerial(alias, "ALIAS");
f.xmlSerial(currentQuantity, "CURRENT_QUANTITY");
f.xmlSerial(nextRespawnDay, "NEXT_RESPAWN_DAY");
}
else
{
f.serial(alias);
f.serial(currentQuantity);
f.serial(nextRespawnDay);
}
}
};
/**
* \author Nicolas Brigand, Alain Saffray, Olivier Cado
* \author Nevrax France
@ -228,7 +205,7 @@ class CDeposit : public NLLIGO::CPrimZone, public NLMISC::CRefCount
public:
/// Constructor
CDeposit() : _AutoSpawnSourcePt(NULL), _QuantityConstraintsPt(NULL), _Ecotype(ECOSYSTEM::common_ecosystem), _FilterPhase(0), _KamiAnger(0.0f), _MinQuality(-1), _MaxQuality(-1), _SourceFXIndex(0), _CanProspect(false), _Enabled(false), _CurrentNbAutoSpawnedSources(0), _AllowDepletionRisk(true), _Alias(0) {}
CDeposit() : _AutoSpawnSourcePt(NULL), _QuantityConstraintsPt(NULL), _Ecotype(ECOSYSTEM::common_ecosystem), _FilterPhase(0), _KamiAnger(0.0f), _MinQuality(-1), _MaxQuality(-1), _SourceFXIndex(0), _CanProspect(false), _Enabled(false), _CurrentNbAutoSpawnedSources(0), _AllowDepletionRisk(true) {}
/// Destructor
~CDeposit();
@ -237,7 +214,7 @@ public:
static void addEcotype( CEcotypeZone *ecotypeZone ) { _EcotypeZones.push_back( ecotypeZone ); }
/// Init deposit
bool build(const NLLIGO::CPrimZone* zone );
bool build( const NLLIGO::CPrimZone* zone );
/// Clear all ecotype information, after having built the deposits
static void clearEcotypes();
@ -342,7 +319,7 @@ public:
float getMaxQuantity() { return _QuantityConstraintsPt ? _QuantityConstraintsPt->getCurrentQuantity() : FLT_MAX; }
/// Consume. Return the actual consumed quantity (may be lower if there is no more to get)
float consumeQuantity( float requested ) { if ( _QuantityConstraintsPt )return _QuantityConstraintsPt->consumeQuantity( requested ); else return requested; }
float consumeQuantity( float requested ) { if ( _QuantityConstraintsPt ) return _QuantityConstraintsPt->consumeQuantity( requested ); else return requested; }
/**
* Get a random RM from the neighbourhood of the specified position.
@ -369,13 +346,6 @@ public:
// For auto-spawn source minimum number. Internaly used by CHarvestSource only
void decreaseAutoSpawnedSources();
void increaseAutoSpawnedSources();
/// Used to save the deposit
bool needSave() const { return _QuantityConstraintsPt && (_QuantityConstraintsPt->CurrentQuantity != _QuantityConstraintsPt->InitialQuantity || _QuantityConstraintsPt->NextRespawnDay != 0); }
CDepositState currentState();
uint32 getAlias() const { return _Alias;}
void setCurrentQuantity(uint32 currentQuantity) { _QuantityConstraintsPt->CurrentQuantity = currentQuantity; }
void setNextRespawnDay(uint32 nextRespawnDay) { _QuantityConstraintsPt->NextRespawnDay = nextRespawnDay; }
protected:
@ -459,9 +429,6 @@ private:
/// Current Number of AutoSpawned Sources in this deposit
uint32 _CurrentNbAutoSpawnedSources;
/// CPrimAlias, needed to identify a deposit to restore its state between shutdown of the EGS
uint32 _Alias;
};

@ -34,7 +34,7 @@ struct CDepositRawMaterial
}
/// serialize
// void serial(NLMISC::IStream &f)
// void serial(class NLMISC::IStream &f)
// {
// }
};

@ -19,6 +19,7 @@
#include "entity_manager/entity_manager.h"
#include "entity_manager/entity_base.h"
#include "player_manager/character.h"
#include "server_share/mongo_wrapper.h"
//
#include "nel/net/message.h"
@ -174,6 +175,10 @@ bool CDynChatEGS::removeChan(TChanID chanID)
_DynChat.removeChan(chanID);
if (_ChanNames.getB(chanID))
_ChanNames.removeWithA(chanID);
#ifdef HAVE_MONGO
CMongo::remove("ryzom_channels", toString("{'ryzomId': '%s'}", chanID.toString().c_str()));
#endif
// send msg to IOS
iosRemoveChan(chanID);
return true;

@ -51,7 +51,15 @@ void CDynamicSheetManager::release()
*/
void cbGetUserModels( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
{
CDynamicSheetManager::getInstance()->getUserModelsFromMsg(msgin, serviceId);
CDynamicSheetManager::getInstance()->getUserModelsFromMsg(msgin, serviceId, false);
}
/**
* callbacks applied when receiving ai messages (user models & custom loot table) from aiscript command (can be updated)
*/
void cbGetUserModel( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
{
CDynamicSheetManager::getInstance()->getUserModelsFromMsg(msgin, serviceId, true);
}
void cbGetCustomLootTables(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
@ -77,7 +85,7 @@ bool CDynamicSheetManager::isAlreadyStored(CCustomElementId id)
/**
* for each user model, instanciate the matching dynamic sheet
*/
void CDynamicSheetManager::getUserModelsFromMsg(NLNET::CMessage &msgin, NLNET::TServiceId serviceId)
void CDynamicSheetManager::getUserModelsFromMsg(NLNET::CMessage &msgin, NLNET::TServiceId serviceId, bool update)
{
nldebug("Receiving UserModels from AIS");
CScriptData scriptData;
@ -87,12 +95,17 @@ void CDynamicSheetManager::getUserModelsFromMsg(NLNET::CMessage &msgin, NLNET::T
{
if (isAlreadyStored(it->first))
{
nlwarning("User model '%s' already defined, skipping it.", it->first.Id.c_str());
}
else
{
instanciateDynamicSheet(it->first, it->second, serviceId);
if (update)
{
removeDynamicSheet(it->first);
}
else
{
nlwarning("User model '%s' already defined, skipping it.", it->first.Id.c_str());
return;
}
}
instanciateDynamicSheet(it->first, it->second, serviceId);
}
}
@ -176,6 +189,7 @@ void CDynamicSheetManager::init()
NLNET::TUnifiedCallbackItem _cbArray[] =
{
{ "USER_MODELS", cbGetUserModels },
{ "USER_MODEL", cbGetUserModel },
{ "CUSTOM_LOOT_TABLES", cbGetCustomLootTables },
{ "DELCUSTOM", cbDeleteCustomDataByPrimAlias }
};
@ -230,6 +244,22 @@ void CDynamicSheetManager::instanciateDynamicSheet(CCustomElementId modelId,
_UserModelLoadingErrors.insert(make_pair(modelId, errors));
}
/**
* remove a dynamic sheet by id
*/
void CDynamicSheetManager::removeDynamicSheet(CCustomElementId modelId)
{
TModifiedCreaturesMap::iterator model = _CreaturesMap.find(modelId);
if (model == _CreaturesMap.end())
{
nlwarning("Sheet '%s' not present in manager", modelId.Id.c_str());
return;
}
_CreaturesMap.erase(model);
}
CStaticCreatures *CDynamicSheetManager::getDynamicSheet(uint32 primAlias, const std::string &userModelId)
{
CCustomElementId id(primAlias, userModelId);

@ -36,6 +36,9 @@ struct CCustomLootTables
/** callback called when receiving USR_MDL msg sent by AIS */
void cbGetUserModels( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
/** callback called when receiving ARK_USR_MDL msg sent by AIS */
void cbGetUserModel( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
/** callback called when receiving CUSTOMLT msg sent by AIS */
void cbGetCustomLootTables(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
@ -58,8 +61,9 @@ public:
/** Add user models into manager's structures upon reception of the AIS msg
* @param msgin the AIS CMessage containing custom loot table info
* @param serviceId id of the AIS that sent the msg
* @param update update an existing user_model
*/
void getUserModelsFromMsg(NLNET::CMessage &f, NLNET::TServiceId serviceId);
void getUserModelsFromMsg(NLNET::CMessage &f, NLNET::TServiceId serviceId, bool update = false);
/** Add custom loot tables into manager's structures upon reception of the AIS msg
* @param msgin the AIS CMessage containing custom loot table info
@ -73,7 +77,8 @@ public:
* @param serviceId id of the AIS that sent the datas
*/
void instanciateDynamicSheet(CCustomElementId modelId, std::vector<std::string> scriptData, NLNET::TServiceId serviceId);
void removeDynamicSheet(CCustomElementId modelId);
/** Returns the modified CStaticCreature associated to a UserModel
* @param userModelId the id of the user model
*/

@ -906,6 +906,13 @@ void CSheets::reloadXPTable(const std::string &wildcardFilter)
reloadCommonSheets(_StaticSheets._StaticXpStageTable, "xp_table", wildcardFilter);
}
// ***************************************************************************
void CSheets::reloadAiactions(const std::string &wildcardFilter)
{
reloadCommonSheets(_StaticSheets._AiActions, "aiaction", wildcardFilter);
}
// ***************************************************************************
std::string extendWildcard(const std::string &in)
{
@ -937,6 +944,7 @@ CMD_RELOAD_SHEET(reloadSBrick)
CMD_RELOAD_SHEET(reloadSPhrase)
CMD_RELOAD_SHEET(reloadSuccessChancesTable)
CMD_RELOAD_SHEET(reloadXPTable)
CMD_RELOAD_SHEET(reloadAiactions)

@ -94,6 +94,7 @@ public:
// Get item form map reference
static inline const CAllStaticItems& getItemMapForm() { return _StaticSheets._StaticItems; }
static inline CAllStaticItems& getItemMapFormNoConst() { return _StaticSheets._StaticItems; }
// Get form for brick
// static const CStaticGameBrick* getBrickForm( const NLMISC::CSheetId& sheetId );
@ -200,6 +201,7 @@ public:
static void reloadSPhrase(const std::string &wildcardFilter);
static void reloadSuccessChancesTable(const std::string &wildcardFilter);
static void reloadXPTable(const std::string &wildcardFilter);
static void reloadAiactions(const std::string &wildcardFilter);
// @}
public:

@ -206,7 +206,7 @@ namespace DURATION_TYPE
//--------------------------------------------------------------
// CCombatParams::serial
//--------------------------------------------------------------
void CCombatParams::serial(NLMISC::IStream &f)
void CCombatParams::serial(class NLMISC::IStream &f)
{
f.serial(Melee);
f.serial(SpeedFactor);
@ -325,7 +325,7 @@ void CCombatParams::readForm (const UFormElm &root, const NLMISC::CSheetId &shee
//--------------------------------------------------------------
// CSpellParams::serial
//--------------------------------------------------------------
void CSpellParams::serial(NLMISC::IStream &f)
void CSpellParams::serial(class NLMISC::IStream &f)
{
f.serial(CastingTime);
f.serial(PostActionTime);
@ -336,6 +336,7 @@ void CSpellParams::serial(NLMISC::IStream &f)
f.serial(SpellParamValue2);
f.serial(SpellPowerFactor);
f.serial(SpellLevel);
f.serial(Fx);
if (f.isReading())
{
string val;
@ -396,13 +397,22 @@ void CSpellParams::readForm (const UFormElm &root, const NLMISC::CSheetId &sheet
if (root.getValueByName( value, "Behaviour" ))
Behaviour = MBEHAV::stringToBehaviour(value);
string fx = "";
CSheetId fxSheet;
root.getValueByName( fx, "FX" );
if (!fx.empty())
fxSheet = CSheetId(fx);
Fx = fxSheet.asInt();
// type specialization
switch(type)
{
case AI_ACTION::DamageSpell:
case AI_ACTION::DoTSpell:
root.getValueByName( SpellParamValue2, "DamageVampirismValue" );
case AI_ACTION::ToxicCloud:
root.getValueByName( SpellParamValue, "DamageValue" );
root.getValueByName( SpellPowerFactor, "SpellPowerFactor" );
if ( root.getValueByName( value, "DamageType" ) )
@ -454,7 +464,7 @@ void COTSpellParams::readForm (const UFormElm &root, const NLMISC::CSheetId &she
//--------------------------------------------------------------
// CEffectSpellParams::serial
//--------------------------------------------------------------
void CEffectSpellParams::serial(NLMISC::IStream &f)
void CEffectSpellParams::serial(class NLMISC::IStream &f)
{
CSpellParams::serial(f);
@ -500,7 +510,7 @@ void CEffectSpellParams::readForm (const UFormElm &root, const NLMISC::CSheetId
//--------------------------------------------------------------
// COTEffectSpellParams::serial
//--------------------------------------------------------------
void COTEffectSpellParams::serial(NLMISC::IStream &f)
void COTEffectSpellParams::serial(class NLMISC::IStream &f)
{
COTSpellParams::serial(f);
@ -534,7 +544,7 @@ void COTEffectSpellParams::readForm (const UFormElm &root, const NLMISC::CSheetI
//--------------------------------------------------------------
// TAiArea::serial
//--------------------------------------------------------------
void TAiArea::serial(NLMISC::IStream &f)
void TAiArea::serial(class NLMISC::IStream &f)
{
if (f.isReading() )
{
@ -674,7 +684,7 @@ void CStaticAiAction::readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &fo
//--------------------------------------------------------------
// CStaticAiAction::readGeorges
//--------------------------------------------------------------
void CStaticAiAction::serial(NLMISC::IStream &f)
void CStaticAiAction::serial(class NLMISC::IStream &f)
{
f.serial(_SheetId);
@ -723,3 +733,13 @@ void CStaticAiAction::serial(NLMISC::IStream &f)
_Area.serial(f);
} // CStaticAiAction::serial //
//--------------------------------------------------------------
// reloadSheet
//--------------------------------------------------------------
void CStaticAiAction::reloadSheet(const CStaticAiAction &o)
{
// nothing special
*this= o;
}

@ -145,7 +145,7 @@ struct CCombatParams
}
/// Serial
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// read params from georges
void readForm (const NLGEORGES::UFormElm &root, const NLMISC::CSheetId &sheetId, AI_ACTION::TAiActionType type);
@ -204,10 +204,11 @@ struct CSpellParams
Behaviour = MBEHAV::UNKNOWN_BEHAVIOUR;
Stackable = false;
SpellLevel = 0.0f;
Fx = 0;
}
/// Serial
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// read params from georges
void readForm (const NLGEORGES::UFormElm &root, const NLMISC::CSheetId &sheetId, AI_ACTION::TAiActionType type);
@ -223,7 +224,7 @@ struct CSpellParams
float SpellPowerFactor;
bool Stackable;
float SpellLevel;
uint32 Fx;
// dmg spell
DMGTYPE::EDamageType DamageType;
@ -253,7 +254,7 @@ struct COTSpellParams : public CSpellParams
}
/// Serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
CSpellParams::serial(f);
f.serial(UpdateFrequency);
@ -300,7 +301,7 @@ struct CEffectSpellParams : public CSpellParams
}
/// Serial
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// read params from georges
void readForm (const NLGEORGES::UFormElm &root, const NLMISC::CSheetId &sheetId, AI_ACTION::TAiActionType type);
@ -329,7 +330,7 @@ struct COTEffectSpellParams : public COTSpellParams
}
/// Serial
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// read params from georges
void readForm (const NLGEORGES::UFormElm &root, const NLMISC::CSheetId &sheetId, AI_ACTION::TAiActionType type);
@ -362,7 +363,7 @@ struct TAiArea
{}
/// Serial
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// read params from georges
void readForm (const NLGEORGES::UFormElm &root, const NLMISC::CSheetId &sheetId, AI_ACTION::TAiActionType type);
@ -408,7 +409,9 @@ public:
inline static uint getVersion () { return 21; }
/// Serial
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
void reloadSheet(const CStaticAiAction &o);
/// Removed
void removed() {}

@ -90,7 +90,7 @@ CStaticBrick::~CStaticBrick()
//--------------------------------------------------------------
// serial()
//--------------------------------------------------------------
void CStaticBrick::serial(NLMISC::IStream &f)
void CStaticBrick::serial(class NLMISC::IStream &f)
{
f.serial( Name );
f.serial( SheetId );
@ -1754,10 +1754,10 @@ void CStaticBrick::loadFaber( const UFormElm &root, const CSheetId &sheetId )
for (uint i = 1 ; i <= 5 ; ++i)
{
propName = "faber.Create.MP "+toString(i);
if (root.getValueByName( value, propName ) && !value.empty() )
if (root.getValueByName( value, propName.c_str() ) && !value.empty() )
{
propName = "faber.Create.Quantity "+toString(i);
if ( root.getValueByName( quantity, propName ) && quantity > 0)
if ( root.getValueByName( quantity, propName.c_str() ) && quantity > 0)
{
CFaber::TRawMaterial mp;
mp.MpType = RM_FABER_TYPE::toFaberType( value );

@ -104,7 +104,7 @@ public:
// Quantity of this Mp needed
uint16 Quantity;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialEnum( MpType );
f.serial( Quantity );
@ -118,7 +118,7 @@ public:
// Quantity of this Mp needed
uint16 Quantity;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( MpType );
f.serial( Quantity );
@ -176,7 +176,7 @@ public:
AllowPartialSuccess= true;
}
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( CraftedItem );
f.serial( NbItemsPerUnit );
@ -428,7 +428,7 @@ public:
virtual ~CStaticBrick();
/// Serialisation
virtual void serial(NLMISC::IStream &f);
virtual void serial(class NLMISC::IStream &f);
/// read georges sheet
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId);

@ -39,7 +39,7 @@ public:
NLMISC::CSheetId MaterialSheet;
//uint16 MaxAmount;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( MaterialSheet );
//f.serial( MaxAmount );
@ -71,7 +71,7 @@ public :
void removed() {}
/// Serialize deposit
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{}
};*/

@ -40,7 +40,7 @@ public:
/// Return the version of this class, increments this value when the content of this class has changed
inline static uint getVersion () { return 1; }
/// Serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialCont( _Anims );
if (f.isReading())

@ -46,7 +46,7 @@ public:
/// Return the version of this class, increments this value when the content of this class has changed
inline static uint getVersion () { return 1; }
/// Serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( AlbumNumber );
f.serial( Title );
@ -87,7 +87,7 @@ public:
/// Return the version of this class, increments this value when the content of this class has changed
inline static uint getVersion () { return 1; }
/// Serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( ThemaNumber );
f.serial( Title );

@ -92,7 +92,7 @@ namespace GUILD_OPTION
}
//--------------------------------------------------------------
void CCosmetics::serial(NLMISC::IStream &f)
void CCosmetics::serial(class NLMISC::IStream &f)
{
f.serial( VPValue );
}
@ -110,7 +110,7 @@ IItemServiceData * IItemServiceData::buildItemServiceData(ITEM_SERVICE_TYPE::TIt
}
//--------------------------------------------------------------
void CConsumable::serial(NLMISC::IStream &f)
void CConsumable::serial(class NLMISC::IStream &f)
{
f.serial(LoopTimer);
f.serial(MaxNbLoops);
@ -158,7 +158,7 @@ void CConsumable::serial(NLMISC::IStream &f)
//--------------------------------------------------------------
void CXpCatalyser::serial(NLMISC::IStream &f)
void CXpCatalyser::serial(class NLMISC::IStream &f)
{
f.serial(IsRingCatalyser);
f.serial(XpBonus);
@ -215,7 +215,7 @@ bool SItemSpecialEffect::build(std::string const& str)
return false;
}
void SItemSpecialEffect::serial(NLMISC::IStream &f)
void SItemSpecialEffect::serial(class NLMISC::IStream &f)
{
// Don't forget to change the SItem version and the code here if no more 4.
nlctassert(MaxEffectPerItem==4);
@ -232,7 +232,7 @@ void SItemSpecialEffect::serial(NLMISC::IStream &f)
f.serial( EffectArgString[3] );
}
void SItemSpecialEffects::serial(NLMISC::IStream &f)
void SItemSpecialEffects::serial(class NLMISC::IStream &f)
{
f.serialCont(Effects);
}
@ -252,7 +252,7 @@ void CStaticItem::init(bool doDelete)
CraftingToolType = TOOL_TYPE::Unknown;
Origin = ITEM_ORIGIN::UNKNOWN;
Sack.clear();
Sack = std::string("");
Stackable = 1;
Color = -2;
SlotCount = 0;
@ -1226,7 +1226,7 @@ void loadCommandTicket( NLGEORGES::UFormElm &root, CStaticItem *item, const NLMI
//--------------------------------------------------------------
// serial()
//--------------------------------------------------------------
void CStaticItem::serial(NLMISC::IStream &f)
void CStaticItem::serial(class NLMISC::IStream &f)
{
f.serial( SheetId );
f.serialEnum( Origin );

@ -61,7 +61,7 @@ struct TCommandTicket
NL_INSTANCE_COUNTER_DECL(TCommandTicket);
public:
virtual void serial(NLMISC::IStream &f)
virtual void serial(class NLMISC::IStream &f)
{
f.serial( Command );
f.serial( Priviledge );
@ -111,7 +111,7 @@ struct CGuildOption
NL_INSTANCE_COUNTER_DECL(CGuildOption);
public:
virtual void serial(NLMISC::IStream &f)
virtual void serial(class NLMISC::IStream &f)
{
// f.serial( XpCost );
f.serial( MoneyCost );
@ -145,7 +145,7 @@ public:
CConsumable() : Family(0), LoopTimer(0), MaxNbLoops(1), OverdoseTimer(0), Data(0), ConsumptionTime(0) {}
virtual void serial(NLMISC::IStream &f);
virtual void serial(class NLMISC::IStream &f);
uint16 Family; // consumable family, this is NOT PERSISTENT, use FAMILY AS A STRING
@ -212,7 +212,7 @@ public:
CXpCatalyser() : IsRingCatalyser(false), XpBonus(100) {}
virtual void serial(NLMISC::IStream &f);
virtual void serial(class NLMISC::IStream &f);
// true if this catalyser comes from ring session
bool IsRingCatalyser;
@ -226,7 +226,7 @@ struct CCosmetics
NL_INSTANCE_COUNTER_DECL(CCosmetics);
public:
virtual void serial(NLMISC::IStream &f);
virtual void serial(class NLMISC::IStream &f);
uint32 VPValue;
};
@ -241,7 +241,7 @@ struct SItemSpecialEffect
SItemSpecialEffect() { }
// return false if the effect cannot be built. + warning inside
bool build(std::string const& str);
virtual void serial(NLMISC::IStream &f);
virtual void serial(class NLMISC::IStream &f);
};
struct SItemSpecialEffects
@ -250,7 +250,7 @@ struct SItemSpecialEffects
public:
std::vector<SItemSpecialEffect> Effects;
virtual void serial(NLMISC::IStream &f);
virtual void serial(class NLMISC::IStream &f);
};
struct SWeapon
@ -273,7 +273,7 @@ struct SWeapon
// damage factor (if fixed)
float DamageFactor;
virtual void serial(NLMISC::IStream &f)
virtual void serial(class NLMISC::IStream &f)
{
f.serialEnum( WeaponType );
f.serialEnum( DamageType );
@ -304,7 +304,7 @@ public:
/// 'length' value of the weapon (french 'allonge')
uint8 ReachValue;
virtual void serial(NLMISC::IStream &f)
virtual void serial(class NLMISC::IStream &f)
{
SWeapon::serial( f );
f.serial( RateOfFire );
@ -320,7 +320,7 @@ public:
virtual ~SRangeWeapon() {}
virtual void serial(NLMISC::IStream &f)
virtual void serial(class NLMISC::IStream &f)
{
SWeapon::serial( f );
f.serialEnum(AreaType);
@ -392,7 +392,7 @@ public:
// ammo type (1 or 2)
uint8 AmmoType;
virtual void serial(NLMISC::IStream &f)
virtual void serial(class NLMISC::IStream &f)
{
SWeapon::serial( f );
f.serial( ShortRangeLimit );
@ -413,7 +413,7 @@ public:
inline SArmor() : ArmorType( ARMORTYPE::UNKNOWN ),Protections(DMGTYPE::NBTYPES){}
// serial
virtual void serial(NLMISC::IStream &f)
virtual void serial(class NLMISC::IStream &f)
{
f.serialEnum( ArmorType );
f.serialCont( Protections );
@ -434,7 +434,7 @@ public:
inline SShield() : SArmor(),ShieldType(SHIELDTYPE::NONE),Unbreakable(false){}
virtual void serial(NLMISC::IStream &f)
virtual void serial(class NLMISC::IStream &f)
{
SArmor::serial(f);
f.serialEnum( ShieldType );
@ -583,7 +583,7 @@ public:
FocusBuff = 0;
}
inline void serial(NLMISC::IStream &f)
inline void serial(class NLMISC::IStream &f)
{
f.serial( Durability );
f.serial( Weight );
@ -650,7 +650,7 @@ public:
};
};
inline void serial(NLMISC::IStream &f)
inline void serial(class NLMISC::IStream &f)
{
f.serial( (uint32&)Family ); // The number never changes
f.serialEnum( Ecosystem );
@ -758,7 +758,7 @@ public:
MaxDonkeys = 0;
}
inline void serial(NLMISC::IStream &f)
inline void serial(class NLMISC::IStream &f)
{
f.serialEnum( Type );
f.serial( CommandRange );
@ -827,7 +827,7 @@ public:
virtual ~CStaticItem();
/// Serialisation
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// read georges sheet
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId);

@ -198,7 +198,7 @@ void CStaticGameBrick::readGeorges( const CSmartPtr<UForm> &form, const CSheetId
// serial CStaticGameBrick
//
//-----------------------------------------------
void CStaticGameBrick::serial( NLMISC::IStream &f )
void CStaticGameBrick::serial( NLMISC::IStream &f)
{
f.serial( FamilyId );
f.serial( IndexInFamily );
@ -328,7 +328,7 @@ void CStaticXpStagesTable::readGeorges( const CSmartPtr<UForm> &form, const CShe
}
// Serial SXpStage structure
void CStaticXpStagesTable::SXpStage::serial(NLMISC::IStream &f)
void CStaticXpStagesTable::SXpStage::serial(class NLMISC::IStream &f)
{
f.serial( SkillLevel );
f.serial( XpForPointSkill );
@ -336,13 +336,13 @@ void CStaticXpStagesTable::SXpStage::serial(NLMISC::IStream &f)
}
// Serial SStageTable structure
void CStaticXpStagesTable::SStageTable::serial(NLMISC::IStream &f)
void CStaticXpStagesTable::SStageTable::serial(class NLMISC::IStream &f)
{
f.serialCont( StageTable );
}
// Serial XpStagesTables structure
void CStaticXpStagesTable::serial(NLMISC::IStream &f)
void CStaticXpStagesTable::serial(class NLMISC::IStream &f)
{
f.serialCont( XpStagesTables );
}
@ -691,7 +691,7 @@ void CStaticCreatures::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &f
for( i = 0; i < SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT; ++i )
{
root.getValueByName( sheetName, (string("Basics.Equipment.") + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + string(".Item" )).c_str() );
if( !sheetName.empty() && sheetName.find(".item") != std::string::npos )
if( sheetName != string("") && sheetName.find(".item") != std::string::npos )
{
sheet = CSheetId( sheetName );
_Items[ i ].IdSheet = sheet.asInt();
@ -913,7 +913,7 @@ uint CStaticCreatures::getVersion()
}
///////////////////////////////////////////////////////////////////////////
void CStaticCreatures::serial(NLMISC::IStream &f)
void CStaticCreatures::serial(class NLMISC::IStream &f)
{
CStaticHarvestable::serial(f);
@ -1137,14 +1137,14 @@ bool CStaticCreatures::applyUserModel(CCustomElementId userModelId, const std::v
splitString(scriptData[i], " ", scriptLine);
if (scriptLine.size() < 2
|| toLowerAscii(scriptLine[0]) == "protect" && scriptLine.size() < 3)
|| toLower(scriptLine[0]) == "protect" && scriptLine.size() < 3)
{
nlwarning("<CStaticCreatures::applyUserModel> error while reading a script line (uncommented line %i), ignoring it.", i);
errors = true;
continue;
}
switch (attributeMap.find(toLowerAscii(scriptLine[0])))
switch (attributeMap.find(toLower(scriptLine[0])))
{
//FIXME: test attributes value before applying, if error set to default value and errors=true
@ -1773,12 +1773,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
for( i = 0; i < SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT; ++i )
{
root.getValueByName( sheetName, "Basics.Equipment." + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + ".Item" );
if (!sheetName.empty())
root.getValueByName( sheetName, (string("Basics.Equipment.") + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + string(".Item" )).c_str() );
if( sheetName != string("") )
{
sheet = CSheetId( sheetName );
Items[ i ].IdSheet = sheet.asInt();
root.getValueByName( Items[ i ].Quality, "Basics.Equipment." + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + ".Quality" );
root.getValueByName( Items[ i ].Quality, (string("Basics.Equipment.") + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + string(".Quality")).c_str() );
}
else
{
@ -1792,12 +1792,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
///////////////////////////////////////////////////////
/* for( i = 0; i < NB_SHEATH; ++i )
{
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "LeftHand.Item" );
if( !sheetName.empty() )
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("LeftHand.Item" )).c_str() );
if( sheetName != string("") )
{
sheet = CSheetId( sheetName );
Sheaths[ i ].Left.IdSheet = sheet.asInt();
root.getValueByName( Sheaths[ i ].Left.Quality, "Basics.Equipment.Sheath" + toString( i ) + "LeftHand.Quality" );
root.getValueByName( Sheaths[ i ].Left.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("LeftHand.Quality")).c_str() );
}
else
{
@ -1805,12 +1805,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
Sheaths[ i ].Left.Quality = 0;
}
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "RightHand.Item" );
if( !sheetName.empty() )
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("RightHand.Item" )).c_str() );
if( sheetName != string("") )
{
sheet = CSheetId( sheetName );
Sheaths[ i ].Right.IdSheet = sheet.asInt();
root.getValueByName( Sheaths[ i ].Right.Quality, "Basics.Equipment.Sheath" + toString( i ) + "RightHand.Quality" );
root.getValueByName( Sheaths[ i ].Right.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("RightHand.Quality")).c_str() );
}
else
{
@ -1818,12 +1818,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
Sheaths[ i ].Right.Quality = 0;
}
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "Ammo0.Item" );
if( !sheetName.empty() )
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo0.Item" )).c_str() );
if( sheetName != string("") )
{
sheet = CSheetId( sheetName );
Sheaths[ i ].Ammo0.IdSheet = sheet.asInt();
root.getValueByName( Sheaths[ i ].Ammo0.Quality, "Basics.Equipment.Sheath" + toString( i ) + "Ammo0.Quality" );
root.getValueByName( Sheaths[ i ].Ammo0.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo0.Quality")).c_str() );
}
else
{
@ -1831,12 +1831,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
Sheaths[ i ].Ammo0.Quality = 0;
}
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "Ammo1.Item" );
if( !sheetName.empty() )
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo1.Item" )).c_str() );
if( sheetName != string("") )
{
sheet = CSheetId( sheetName );
Sheaths[ i ].Ammo1.IdSheet = sheet.asInt();
root.getValueByName( Sheaths[ i ].Ammo1.Quality, "Basics.Equipment.Sheath" + toString( i ) + "Ammo1.Quality" );
root.getValueByName( Sheaths[ i ].Ammo1.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo1.Quality")).c_str() );
}
else
{
@ -1844,12 +1844,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
Sheaths[ i ].Ammo1.Quality = 0;
}
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "Ammo2.Item" );
if( !sheetName.empty() )
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo2.Item" )).c_str() );
if( sheetName != string("") )
{
sheet = CSheetId( sheetName );
Sheaths[ i ].Ammo2.IdSheet = sheet.asInt();
root.getValueByName( Sheaths[ i ].Ammo2.Quality, "Basics.Equipment.Sheath" + toString( i ) + "Ammo2.Quality" );
root.getValueByName( Sheaths[ i ].Ammo2.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo2.Quality")).c_str() );
}
else
{
@ -2205,7 +2205,7 @@ void CStaticRaceStats::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &f
int i;
for( i = 0; i < CHARACTERISTICS::NUM_CHARACTERISTICS; ++i )
{
root.getValueByName( Characteristics[ (CHARACTERISTICS::TCharacteristics)i ], "Characteristics." + CHARACTERISTICS::toString( (CHARACTERISTICS::TCharacteristics)i ) );
root.getValueByName( Characteristics[ (CHARACTERISTICS::TCharacteristics)i ], ( string("Characteristics.") + CHARACTERISTICS::toString( (CHARACTERISTICS::TCharacteristics)i ) ).c_str() );
}
///////////////////////////////////////////////////////
@ -2213,7 +2213,7 @@ void CStaticRaceStats::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &f
///////////////////////////////////////////////////////
for( i = 0; i < SCORES::NUM_SCORES; ++i )
{
root.getValueByName( Scores[ i ], "Scores." + SCORES::toString( i ), UFormElm::Formula );
root.getValueByName( Scores[ i ], ( string("Scores.") + SCORES::toString( i ) ).c_str(), UFormElm::Formula );
}
///////////////////////////////////////////////////////
@ -2309,7 +2309,7 @@ void CStaticRole::readGeorgesSentenceAndEquipment( UFormElm& root, const NLMISC:
{
string value;
const UFormElm *sentenceArray = NULL;
if (root.getNodeByName (&sentenceArray, SentenceString) && sentenceArray)
if (root.getNodeByName (&sentenceArray, SentenceString.c_str()) && sentenceArray)
{
// Get array size
uint size;
@ -2355,12 +2355,12 @@ void CStaticRole::readGeorgesSentenceAndEquipment( UFormElm& root, const NLMISC:
for( int i = 0; i < SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT; ++i )
{
root.getValueByName( sheetName, EquipmentString + "." + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + ".Item" );
if (!sheetName.empty())
root.getValueByName( sheetName, ( EquipmentString + string(".") + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + string(".Item" )).c_str() );
if( sheetName != string("") )
{
sheet = CSheetId( sheetName );
Items[ i ].IdSheet = sheet.asInt();
root.getValueByName( Items[ i ].Quality, EquipmentString + "." + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + ".Quality" );
root.getValueByName( Items[ i ].Quality, ( EquipmentString + string(".") + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + string(".Quality")).c_str() );
}
else
{

@ -129,7 +129,7 @@ public :
}
/// serial
void serial( NLMISC::IStream &f );
void serial( NLMISC::IStream &f);
/// called when the sheet is removed
void removed() {}
@ -160,13 +160,13 @@ public :
uint32 XpForPointSkill;
float SpPointMultiplier;
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
};
struct SStageTable
{
std::vector< SXpStage > StageTable;
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
};
@ -177,7 +177,7 @@ public :
static uint getVersion () { return 2; }
/// serialize
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
// return a reference on Xp stage corresponding to level and stage table
const SXpStage* getXpStage( uint32 level, uint16 stage ) const;
@ -209,7 +209,7 @@ public :
uint16 StageType;
float Coeff;
void serial(NLMISC::IStream &f) { f.serial( StageType); f.serial( Coeff ); }
void serial(class NLMISC::IStream &f) { f.serial( StageType); f.serial( Coeff ); }
};
/// read sheet
@ -219,7 +219,7 @@ public :
static uint getVersion () { return 2 + ( SKILLS::NUM_SKILLS << 16 ); }
/// serialize
void serial(NLMISC::IStream &f) { f.serialCont( SkillToStageType ); }
void serial(class NLMISC::IStream &f) { f.serialCont( SkillToStageType ); }
/// destructor
virtual ~CStaticStagesTypeSkillTable() {}
@ -248,7 +248,7 @@ public:
uint16 LoseSkillsLevel;
NLMISC::TGameCycle Duration;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( LoseHitPointsLevel);
f.serial( LoseStaminaLevel );
@ -265,7 +265,7 @@ public:
static uint getVersion () { return 2; }
/// serialize
void serial(NLMISC::IStream &f) { f.serialCont( PactLose ); }
void serial(class NLMISC::IStream &f) { f.serialCont( PactLose ); }
/// destructor
virtual ~CStaticPacts() {}
@ -645,7 +645,7 @@ public:
static uint getVersion ();
/// serialize
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// called when the sheet is removed
void removed() { }
@ -676,7 +676,7 @@ public:
std::vector<NLMISC::CSheetId> BricksIds;
/// Serialisation
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( Name );
f.serialCont( BricksIds );
@ -701,7 +701,7 @@ public:
SMirrorEquipment Ammo1;
SMirrorEquipment Ammo2;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( Right );
f.serial( Left );
@ -733,7 +733,7 @@ public:
float RunSpeed;
/// serialize
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialEnum( Race );
f.serial( Gender );
@ -803,7 +803,7 @@ public:
uint16 Quantity;
/// serialize
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( Item );
f.serial( Level );
@ -814,7 +814,7 @@ public:
std::vector< SItemLoot > ItemLoot;
/// serialize
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialCont( ItemLoot );
}
@ -860,7 +860,7 @@ public:
float MoneyDropProbability;
/// serialize
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialCont( LootSets );
f.serial( MoneyLvlFactor );
@ -911,7 +911,7 @@ public:
uint16 QuantityMax;
/// serialize
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( Item );
f.serial( Probability );
@ -926,7 +926,7 @@ public:
std::vector< SItemLoot > ItemLoot;
/// serialize
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialCont( ItemLoot );
}
@ -965,7 +965,7 @@ public:
std::string DefaultFeet;
std::string DefaultHair;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( DefaultFace );
f.serial( DefaultChest );
@ -993,7 +993,7 @@ public:
SDefaultEquipment FemaleDefaultEquipment;
/// serialize
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialEnum( Race );
for( int c = 0; c < CHARACTERISTICS::NUM_CHARACTERISTICS; ++c )
@ -1051,7 +1051,7 @@ public:
NLMISC::CSheetId sentence;
// MEM_SET_TYPES::TMemorizationSetType memory;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( sentence );
// f.serialEnum( memory );
@ -1070,7 +1070,7 @@ public:
/// serialize
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( Role );
f.serialEnum( Race );
@ -1130,7 +1130,7 @@ public :
SKILLS::ESkills ParentSkill;
std::vector<SKILLS::ESkills> ChildSkills;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialEnum( Skill );
f.serial( SkillCode );
@ -1167,7 +1167,7 @@ public :
static uint getVersion () { return 1 + ( SKILLS::NUM_SKILLS << 16 ); }
/// serialize
void serial(NLMISC::IStream &f) { f.serialCont( SkillsTree ); }
void serial(class NLMISC::IStream &f) { f.serialCont( SkillsTree ); }
/// destructor
virtual ~CStaticSkillsTree() {}

@ -56,7 +56,7 @@ void CStaticGuildOption::readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm>
}
}
void CStaticGuildOption::serial(NLMISC::IStream &f)
void CStaticGuildOption::serial(class NLMISC::IStream &f)
{
f.serial(Price);
if ( f.isReading() )

@ -64,7 +64,7 @@ public:
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId);
/// Serial
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// Return the version of this class, increments this value when the content of this class has changed
inline static uint getVersion () { return 1; }

@ -86,8 +86,8 @@ static void getVarListFromParents (const NLGEORGES::UForm *form, std::set<NLGEOR
const NLGEORGES::UFormElm &item=form->getRootNode();
NLGEORGES::UFormElm *elem=NULL;
const_cast<NLGEORGES::UFormElm*>(&item)->getNodeByName(&elem, varName);
if (elem!=NULL) // item.getValueByName(temp, varName))
const_cast<NLGEORGES::UFormElm*>(&item)->getNodeByName(&elem, varName.c_str());
if (elem!=NULL) // item.getValueByName(temp, varName.c_str()))
{
varList.insert (elem);
}
@ -126,7 +126,7 @@ void CStaticHarvestable::loadFromGeorges( const UForm &form, const NLMISC::CShee
*/
{
string value;
if ( form.getRootNode().getValueByName( value, "Harvest.Skill" )
if ( form.getRootNode().getValueByName( value, (string("Harvest.")+"Skill").c_str() )
&& !value.empty() )
{
_HarvestSkill = SKILLS::toSkill( value );
@ -142,22 +142,22 @@ void CStaticHarvestable::loadFromGeorges( const UForm &form, const NLMISC::CShee
const string mpName=NLMISC::toString("MP%u",i);
CStaticCreatureRawMaterial mp;
if( form.getRootNode().getValueByName( mp.MpCommon.AssociatedItemName, "Harvest." +mpName+".AssociatedItem")
if( form.getRootNode().getValueByName( mp.MpCommon.AssociatedItemName, ("Harvest." +mpName+".AssociatedItem").c_str())
&& !mp.MpCommon.AssociatedItemName.empty() )
{
if (VerboseQuartering)
nldebug("QRTR: %s=%s", mpName.c_str(), mp.MpCommon.AssociatedItemName.c_str());
form.getRootNode().getValueByName( mp.MpCommon.Name, "Harvest." +mpName+".Name" );
form.getRootNode().getValueByName( mp.MpCommon.Name, ("Harvest." +mpName+".Name").c_str() );
uint16 sheetQuantity;
form.getRootNode().getValueByName( sheetQuantity, "Harvest." +mpName+".Quantity" );
form.getRootNode().getValueByName( sheetQuantity, ("Harvest." +mpName+".Quantity").c_str() );
if ( sheetQuantity != 0 )
{
nlwarning( "Quantity set to %hu in %s", sheetQuantity, sheetId.toString().c_str() );
}
form.getRootNode().getValueByName( mp.MpCommon.MinQuality, "Harvest." +mpName+".MinQuality" );
form.getRootNode().getValueByName( mp.MpCommon.MaxQuality, "Harvest." +mpName+".MaxQuality" );
// harvest->getValueByName( mp.PresenceProbabilities, mpName+".PresenceProbabilities" );
form.getRootNode().getValueByName( mp.MpCommon.MinQuality, ("Harvest." +mpName+".MinQuality").c_str() );
form.getRootNode().getValueByName( mp.MpCommon.MaxQuality, ("Harvest." +mpName+".MaxQuality").c_str() );
// harvest->getValueByName( mp.PresenceProbabilities, (mpName+".PresenceProbabilities").c_str() );
mp.ItemId = mp.MpCommon.AssociatedItemName;
if ( mp.MpCommon.MinQuality == 0)

@ -142,12 +142,12 @@ void CStaticOutpostBuilding::CDriller::readGeorges (const NLGEORGES::UFormElm *p
TotalMP = 0.0f;
for (uint i = 0; i < 20; ++i)
{
string namePath = NLMISC::toString("mp%u.name", i);
string quantityPath = NLMISC::toString("mp%u.quantity", i);
string namePath = NLMISC::toString("mp%d.name", i);
string quantityPath = NLMISC::toString("mp%d.quantity", i);
string name;
float quantity;
pElt->getValueByName (name, namePath);
pElt->getValueByName (quantity, quantityPath);
pElt->getValueByName (name, namePath.c_str());
pElt->getValueByName (quantity, quantityPath.c_str());
if(!name.empty() && quantity>0.f)
{
CSheetId mpSheetId = CSheetId(name);
@ -165,7 +165,7 @@ void CStaticOutpostBuilding::CDriller::readGeorges (const NLGEORGES::UFormElm *p
}
//----------------------------------------------------------------------------
void CStaticOutpostBuilding::CDriller::serial(NLMISC::IStream &f)
void CStaticOutpostBuilding::CDriller::serial(class NLMISC::IStream &f)
{
for (uint i = 0; i < DRILLER_NB_LEVEL; ++i)
f.serial(QualityFactor[i]);

@ -117,7 +117,7 @@ public:
/// Read georges sheet
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId);
/// Serial
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// Return the version of this class, increments this value when the content of this class has changed
static uint getVersion ();
@ -151,7 +151,7 @@ public:
/// Read georges sheet
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId);
/// Serial
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// Return the version of this class, increments this value when the content of this class has changed
static uint getVersion ();

@ -48,7 +48,7 @@ public:
{}
/// serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( Name );
f.serial( AssociatedItemName );

@ -41,7 +41,7 @@ void CStaticRolemasterPhrase::readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UF
uint i = 0;
while ( i < 100 )
{
bool res = form->getRootNode().getValueByName( sbrickSheetName, toString( "brick %u", i ) );
bool res = form->getRootNode().getValueByName( sbrickSheetName, toString( "brick %u", i ).c_str() );
if ( (! res) || sbrickSheetName.empty() )
{
++i;

@ -43,7 +43,7 @@ public:
inline static uint getVersion () { return 4; }
/// Serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialCont( Bricks );
std::vector<NLMISC::CSheetId>::const_iterator ib;

@ -134,7 +134,7 @@ void CStaticSuccessTable::initTables()
//--------------------------------------------------------------
// serial
//--------------------------------------------------------------
void CStaticSuccessTable::serial(NLMISC::IStream &f)
void CStaticSuccessTable::serial(class NLMISC::IStream &f)
{
f.serial(_MaxSuccessFactor);
f.serial(_MaxPartialSuccessFactor);

@ -66,7 +66,7 @@ struct CSuccessXpLine
uint8 PartialSuccessMaxDraw;
float XpGain;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial(RelativeLevel);
f.serial(SuccessProbability);
@ -85,7 +85,7 @@ class CStaticSuccessTable
{
public:
/// Serialisation
virtual void serial(NLMISC::IStream &f);
virtual void serial(class NLMISC::IStream &f);
/// read georges sheet
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId);

@ -69,7 +69,7 @@ public:
/// true if this emote can be launched from client UI
bool UsableFromClientUI;
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serial( EmoteId );
f.serial( TargetCrowd );
@ -92,7 +92,7 @@ public:
/// Return the version of this class, increments this value when the content of this class has changed
inline static uint getVersion () { return 2; }
/// Serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialCont( _Phrases );
if (f.isReading())

@ -40,7 +40,7 @@ public:
/// Return the version of this class, increments this value when the content of this class has changed
inline static uint getVersion () { return 1; }
/// Serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialCont( Continents );
}
@ -68,7 +68,7 @@ public:
/// Return the version of this class, increments this value when the content of this class has changed
inline static uint getVersion () { return 1; }
/// Serial
void serial(NLMISC::IStream &f)
void serial(class NLMISC::IStream &f)
{
f.serialCont(Outposts);
}

@ -29,7 +29,7 @@ using namespace NLGEORGES;
//--------------------------------------------------------------
// serial
//--------------------------------------------------------------
void CStaticXpFactorTable::serial(NLMISC::IStream &f)
void CStaticXpFactorTable::serial(class NLMISC::IStream &f)
{
f.serialCont(_XpFactorTable);
} // serial //

@ -36,7 +36,7 @@ class CStaticXpFactorTable
{
public:
/// Serialisation
virtual void serial(NLMISC::IStream &f);
virtual void serial(class NLMISC::IStream &f);
/// read georges sheet
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId);

@ -27,7 +27,7 @@ class CStaticWorld
{
public:
/// Serialisation
void serial(NLMISC::IStream &f);
void serial(class NLMISC::IStream &f);
/// read georges sheet
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId);

@ -332,10 +332,6 @@ CVariable<float> DodgeFactorForForageSkills("egs","DodgeFactorForForageSkills"
CVariable<float> ForageExtractionTimeMinGC( "egs", "ForageExtractionTimeMinGC", "Minimum time of extraction in ticks", 230.0f, 0, true );
CVariable<float> ForageExtractionTimeSlopeGC( "egs", "ForageExtractionTimeSlopeGC", "Slope of base extraction time curve", 2.0f, 0, true );
CVariable<bool> RefillDepositOnStartup("egs", "RefillDepositOnStartup", "Ignore saved CurrentQuantity / NextRespawnDay in deposits", false, 0, true);
CVariable<uint32> DepositSaveInterval("egs", "DepositSaveInterval", "time *in tick* between two saves of a deposit", 10 * 60 * 10, 0, true);
CVariable<bool> DepositStateUseXml("egs", "DepositStateUseXml", "Use xml instead of binary file to save deposit state", true, 0, true);
CVariable<float> ForageQuantityBaseRate( "egs", "ForageQuantityBaseRate", "Base of extraction rate", 0.23f, 0, true ); // 0.23 doubles the previous minimum setting
@ -571,9 +567,7 @@ CVariable<NLMISC::TGameCycle> OutpostLeavePeriod("egs","OutpostLeavePeriod", "ti
CVariable<bool> VerboseFactionPoint("egs", "VerboseFactionPoint", "set if faction point system is verbose or not", false, 0, true);
#ifdef RYZOM_FORGE
CVariable<bool> UseNewNewbieLandStartingPoint("egs", "UseNewNewbieLandStartingPoint", "set if create new character start at new noobland or old", false, 0, true);
#endif
// Fame
// - Limits

@ -283,9 +283,6 @@ extern NLMISC::CVariable<float> ForageQuantityXPDeltaLevelBonusRate;
extern NLMISC::CVariable<float> ForageExtractionTimeMinGC;
extern NLMISC::CVariable<float> ForageExtractionTimeSlopeGC;
extern NLMISC::CVariable<bool> RefillDepositOnStartup;
extern NLMISC::CVariable<uint32> DepositSaveInterval;
extern NLMISC::CVariable<bool> DepositStateUseXml;
// QUARTERING
extern NLMISC::CVariable<float> QuarteringQuantityAverageForCraftHerbivore;
@ -402,9 +399,7 @@ extern NLMISC::CVariable<NLMISC::TGameCycle> OutpostLeavePeriod;
extern NLMISC::CVariable<bool> VerboseFactionPoint;
// Newbieland
#ifdef RYZOM_FORGE
extern NLMISC::CVariable<bool> UseNewNewbieLandStartingPoint;
#endif
// New fame system

@ -50,6 +50,7 @@
#include "game_share/mainland_summary.h"
#include "game_share/shard_names.h"
#include "server_share/handy_commands.h"
#include "server_share/mongo_wrapper.h"
// egs
#include "game_item_manager/game_item_manager.h"
@ -989,10 +990,6 @@ void CPlayerService::egsAddMonkeyPlayer()
}
idx++;
}
else
{
return;
}
}
if( PlayerManager.getPlayer( userId ) != 0 )
@ -1240,19 +1237,16 @@ void CPlayerService::initConfigFileVars()
MaxNbNpcSpawnedByEGS = varMaxNbNpcSpawnedByEGS->asInt();
else
MaxNbNpcSpawnedByEGS = 50;
CConfigFile::CVar *varMaxNbForageSources = ConfigFile.getVarPtr("NbForageSourcesLimit");
if ( varMaxNbForageSources )
MaxNbForageSources = varMaxNbForageSources->asInt();
else
MaxNbForageSources = 2000;
CConfigFile::CVar *varMaxNbToxicClouds = ConfigFile.getVarPtr("NbToxicCloudsLimit");
if ( varMaxNbToxicClouds )
MaxNbToxicClouds = varMaxNbToxicClouds->asInt();
else
MaxNbToxicClouds = 1000;
nlinfo( "NbPlayersLimit=%u NbObjectsLimit=%u NbNpcSpawnedByEGSLimit=%u NbForageSourcesLimit=%u NbToxicCloudsLimit=%u NbGuildLimit=%u", MaxNbPlayers, MaxNbObjects, MaxNbNpcSpawnedByEGS, MaxNbForageSources, MaxNbToxicClouds, MaxNbGuilds );
CConfigFile::CVar *varExportDepositContents = ConfigFile.getVarPtr("ExportDepositContents");
@ -1333,6 +1327,10 @@ void CPlayerService::init()
initAdmin ();
#ifdef HAVE_MONGO
CMongo::init();
#endif
//uint16 i = SKILLS::NUM_SKILLS;
// Init mirror
@ -1381,6 +1379,7 @@ void CPlayerService::init()
TRANSPORT_CLASS_REGISTER (CBSAIDeathReport);
TRANSPORT_CLASS_REGISTER (CAILostAggroMsgImp);
TRANSPORT_CLASS_REGISTER (CAIGainAggroMsgImp);
TRANSPORT_CLASS_REGISTER (CAINotifyDeathMsgImp);
TRANSPORT_CLASS_REGISTER (CSetBotHeadingMsg);
TRANSPORT_CLASS_REGISTER (CAIPlayerRespawnMsg);
@ -1625,7 +1624,7 @@ nlassert(nodeLeaf->getType() == ICDBStructNode::TEXT);
// {
// if( args.size() == 0 )
// return false;
//
//
// NLMEMORY::StatisticsReport( args[0].c_str(), args.size() > 1 );
// return true;
//}
@ -1905,7 +1904,7 @@ void CPlayerService::release()
//---------------------------------------------------
void cbConnection( const std::string &serviceName, NLNET::TServiceId serviceId, void *arg )
{
// inform player about the service event that occurred
// inform player about the service event that occured
#if !FINAL_VERSION
PlayerManager.broadcastMessage( 1, 0, 0, string("System event : Service UP : ")+serviceName);
#endif
@ -2029,8 +2028,11 @@ void cbMirrorUp( const std::string &serviceName, NLNET::TServiceId serviceId, vo
{
IOSIsUp = true;
nlinfo("IOS connection, serviceId %d",serviceId.get());
DynChatEGS.iosConnection();
CGuildManager::getInstance()->onIOSConnection();
CPVPManager2::getInstance()->onIOSMirrorUp();
// add all teams to chat groups
TeamManager.addAllTeamsToChatGroup();
PlayerManager.registerCharacterName();
@ -2038,7 +2040,6 @@ void cbMirrorUp( const std::string &serviceName, NLNET::TServiceId serviceId, vo
// PlayerManager.addAllCharForStringIdRequest();
CZoneManager::getInstance().iosConnection();
// RY_PDS::CPDStringManager::buildStringAssociation();
DynChatEGS.iosConnection();
CAIAliasTranslator::getInstance()->sendAliasToIOS();
// update all the 'TEXT' property in the database
@ -3726,7 +3727,7 @@ NLMISC_COMMAND( createItemInBagTest," create_item_in_bag", "player id(id:type:cr
{
string sheetName = args[1];
if (sheetName.find(".") == string::npos)
sheetName += string(".sitem");
sheetName += string(".item");
sheet = CSheetId(sheetName.c_str());
}
uint quantity, quality;
@ -3880,7 +3881,7 @@ NLMISC_COMMAND(displayDatabaseEntry," display a database entry value","<entity i
}
else
{
log.displayNL("Unknown entity %s ", id.toString().c_str());
log.displayNL("Unknown entity %s ",id.toString().c_str());
}
return true;
}
@ -3923,8 +3924,7 @@ NLMISC_COMMAND( db, "Display or set the value of a property in the database", "<
{
// Set
sint64 value;
fromString(args[2], value);
sscanf( args[2].c_str(), "%" NL_I64 "d", &value );
if ( (args.size() > 3) && (args[3]!="0") )
{
res = e->_PropertyDatabase.x_setPropButDontSend( entry, value );
@ -4779,7 +4779,7 @@ NLMISC_COMMAND(setHPBar,"set the value of an entity HP bar (0..100)","<entity id
sint32 barValue;
NLMISC::fromString(args[1], barValue);
entity->setScoreBar( SCORES::hit_points, (uint32)(barValue * 1023 / 100) );
entity->setScoreBar( SCORES::hit_points, (uint32)(barValue * 1023 / 127) );
log.displayNL("for entity id %s, new hpBar value : %d", id.toString().c_str(), barValue );
return true;

@ -123,7 +123,7 @@ CEquipmentSlots::CEquipmentSlots()
// serial CEquipmentSlots properties:
//
//-----------------------------------------------
void CEquipmentSlots::serial( NLMISC::IStream &f )
void CEquipmentSlots::serial( NLMISC::IStream &f)
{
f.serial( Headdress );
f.serial( Head );
@ -397,7 +397,7 @@ void CEntityBase::setTarget( const NLMISC::CEntityId& targetId, bool sendMessage
// lookupStat :
//
//---------------------------------------------------
sint32& CEntityBase::lookupStat( const string& var)
sint32& CEntityBase::lookupStat(const string& var)
{
// TODO Alain: optimize this...
uint i;
@ -1580,15 +1580,12 @@ void CEntityBase::serial(NLMISC::IStream &f)
{
// select starting point
RYZOM_STARTING_POINT::TStartPoint sp;
#ifdef RYZOM_FORGE
// if(UseNewNewbieLandStartingPoint)
// {
{
sp= RYZOM_STARTING_POINT::starting_city;
// }
// else
#else
// {
}
/* else
{
switch( _Race )
{
case EGSPD::CPeople::Fyros:
@ -1606,9 +1603,8 @@ void CEntityBase::serial(NLMISC::IStream &f)
default:
sp = RYZOM_STARTING_POINT::aegus;
}
// }
#endif
}
*/
// set the character initial state
TAIAlias bot,mission;
const CTpSpawnZone * zone = CZoneManager::getInstance().getStartPoint( (uint16)sp,bot,mission );

@ -143,7 +143,7 @@ public:
_ExceptionString = std::string("<CEntityBase> : Invalid stat name ") + var;
return _ExceptionString.c_str();
}
virtual ~EInvalidStat() NL_OVERRIDE {}
virtual ~EInvalidStat() throw() {}
private:
mutable std::string _ExceptionString;
};
@ -356,7 +356,7 @@ public:
* Set the value of a var
* \param var is the name of the variable
* \param value is the new value for the variable
* \return true if the value has been set, false if an error occurred
* \return true if the value has been set, false if an error occured
*/
bool setValue( const std::string& var, const std::string& value );
@ -364,7 +364,7 @@ public:
* Modify the value of a var
* \param var is the name of the variable
* \param value is the modification value
* \return true if the value has been changed, false if an error occurred
* \return true if the value has been changed, false if an error occured
*/
bool modifyValue( const std::string& var, const std::string& value );
@ -524,7 +524,7 @@ public:
* \param var is the name of the variable
* \return ref on the stat value
*/
sint32& lookupStat( const std::string& stat);
sint32& lookupStat(const std::string& stat);
/**
* get a reference on a characterristics value
@ -848,7 +848,7 @@ public:
inline void decPreventEntityMove() { if (_PreventEntityMoves>0) --_PreventEntityMoves; }
// tp wanted for an entity
virtual void tpWanted( sint32 x, sint32 y, sint32 z , bool useHeading = false, float heading = 0.0f , uint8 continent = 0xFF, sint32 cell = 0) = 0;
virtual void tpWanted( sint32 x, sint32 y, sint32 z , bool useHeading = false, float heading = 0.0f , uint8 continent = 0xFF, sint32 cell = 0, bool fromVortex = false) = 0;
// memorize xp gain per agressor for offensive action
// void addAgressorXp( const NLMISC::CEntityId& agressor, double xp, const std::string& Skill );

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save