// Ryzom - MMORPG Framework
// 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 .
#include "stdpch.h"
#include "nel/misc/types_nl.h"
#include "nel/misc/common.h"
#include "nel/misc/command.h"
#include "nel/misc/path.h"
#include "npc_description_messages.h"
#include "../../server/src/ai_share/ai_share.h"
using namespace NLMISC;
using namespace std;
//---------------------------------------------------------------------------------------
// Stuff used for management of log messages
bool VerboseNpcDescriptionMsgLog=false;
#define LOG if (!VerboseNpcDescriptionMsgLog) {} else nlinfo
CNpcChatProfile::CNpcChatProfile(const CNpcChatProfile &other0, const CNpcChatProfile &other1)
{
uint i,j;
// run through shop types in other0 - trying to add to output shop type list
for (i=0;i tmpVal;
f.serial(tmpKey);
f.serialCont(tmpVal);
Scripts.insert(make_pair(tmpKey,tmpVal));
}
}
else
{
size = (uint16)Scripts.size();
f.serial(size);
for (TScripts::iterator it = Scripts.begin(); it != Scripts.end(); ++it)
{
//std::string tmp = it->first;
nlWrite(f, serial, it->first);
nlWrite(f, serialCont, it->second);
}
}
}
void CCustomLootTable::serial(NLMISC::IStream &f)
{
f.serial(LootSets);
f.serial(MoneyFactor);
f.serial(MoneyProba);
f.serial(MoneyBase);
}
void CCustomLootTableManager::serial(NLMISC::IStream &f)
{
uint16 size;
if (f.isReading())
{
Tables.clear();
f.serial(size);
uint32 i = 0;
for (; i < size; ++i)
{
//std::string tmpKey;
CCustomElementId tmpKey;
CCustomLootTable tmpVal;
f.serial(tmpKey);
f.serial(tmpVal);
Tables.insert(make_pair(tmpKey,tmpVal));
}
}
else
{
size = (uint16)Tables.size();
f.serial(size);
for (TCustomLootTable::iterator it = Tables.begin(); it != Tables.end(); ++it)
{
nlWrite(f, serial, it->first);
nlWrite(f, serial, it->second);
}
}
}
//---------------------------------------------------------------------------------------
// Control over verbose nature of logging
//---------------------------------------------------------------------------------------
NLMISC_COMMAND(verboseNpcDescriptionMsgLog,"Turn on or off or check the state of verbose AI->EGS NPC description message logging","")
{
if(args.size()>1)
return false;
if(args.size()==1)
{
if(args[0]==string("on")||args[0]==string("ON")||args[0]==string("true")||args[0]==string("TRUE")||args[0]==string("1"))
VerboseNpcDescriptionMsgLog=true;
if(args[0]==string("off")||args[0]==string("OFF")||args[0]==string("false")||args[0]==string("FALSE")||args[0]==string("0"))
VerboseNpcDescriptionMsgLog=false;
}
nlinfo("verbose Logging is %s",VerboseNpcDescriptionMsgLog?"ON":"OFF");
return true;
}