1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
29 #include "server_share/log_character_gen.h"
36 std::string ForwardToservice
;
45 void initCommandsPrivileges(const std::string
& fileName
);
46 void initPositionFlags(const std::string
& fileName
);
47 void getUCstringFromHash(const std::string
& hash
, ucstring
& finaltext
);
48 std::string
getStringFromHash(const std::string
&hash
);
49 bool getAIInstanceFromGroupName(std::string
& groupName
, uint32
& instanceNumber
);
51 CAdminCommand
* findAdminCommand(const std::string
& name
);
53 extern void GET_CHARACTER_Helper(std::string
& command
, const NLMISC::CEntityId
& id
, const std::string
& adminCommand
);
56 if (args.size() < 1) { nlwarning ("Missing argument number 0 that should be the eid"); return false; } \
57 CEntityId eid(args[0]); \
58 if (eid == CEntityId::Unknown) \
60 TLogContext_Character_AdminCommand commandContext(eid); \
61 CEntityBase *e = CEntityBaseManager::getEntityBasePtr(eid); \
64 nlwarning ("Unknown entity '%s'", eid.toString().c_str()); \
67 if(!TheDataset.isAccessible(e->getEntityRowId())) \
69 nlwarning ("'%s' is not valid in mirror", eid.toString().c_str()); \
73 #define GET_CHARACTER \
74 if (args.size() < 1) { nlwarning ("Missing argument number 0 that should be the eid"); return false; } \
75 CEntityId eid(args[0]); \
76 if (eid == CEntityId::Unknown) \
78 TLogContext_Character_AdminCommand commandContext(eid); \
79 CCharacter *c = PlayerManager.getChar(eid); \
82 log.displayNL ("Unknown player '%s' (%s)", eid.toString().c_str(), args[0].c_str()); \
85 if(!c->getEnterFlag()) \
87 log.displayNL ("'%s' is not entered", eid.toString().c_str()); \
90 if(!TheDataset.isAccessible(c->getEntityRowId())) \
92 log.displayNL ("'%s' is not valid in mirror", eid.toString().c_str()); \
98 std::string command; \
99 std::string adminCommand; \
100 adminCommand = getName(); \
101 for( uint i = 0; i < args.size(); i++ ) \
103 adminCommand += string(" \"") + args[i] + string("\""); \
105 GET_CHARACTER_Helper( command, eid, adminCommand ); \
110 #define GET_ACTIVE_CHARACTER \
111 if (args.size() < 1) { nlwarning ("ERR: Missing argument number 0 that should be the uid"); return false; } \
113 NLMISC::fromString(args[0], uid); \
114 CCharacter *c = CPlayerManager::getInstance().getActiveChar(uid); \
117 log.displayNL ("ERR: Unknown player '%u' (%s)", uid, args[0].c_str()); \
120 CEntityId eid = c->getId(); \
121 TLogContext_Character_AdminCommand commandContext(eid); \
122 if(!c->getEnterFlag()) \
124 log.displayNL ("ERR: '%s' is not entered", eid.toString().c_str()); \
127 if(!TheDataset.isAccessible(c->getEntityRowId())) \
129 log.displayNL ("ERR: '%s' is not valid in mirror", eid.toString().c_str()); \
133 #define GET_ACTIVE_CHARACTER2 \
134 if (args.size() < 1) { nlwarning ("ERR: Missing argument number 0 that should be the uid"); return false; } \
136 NLMISC::fromString(args[0], uid); \
137 c = CPlayerManager::getInstance().getActiveChar(uid); \
140 log.displayNL ("ERR: Unknown player '%u' (%s)", uid, args[0].c_str()); \
143 CEntityId eid = c->getId(); \
144 TLogContext_Character_AdminCommand commandContext(eid); \
145 if(!c->getEnterFlag()) \
147 log.displayNL ("ERR: '%s' is not entered", eid.toString().c_str()); \
150 if(!TheDataset.isAccessible(c->getEntityRowId())) \
152 log.displayNL ("ERR: '%s' is not valid in mirror", eid.toString().c_str()); \
156 //#define GET_CHARACTER1 \
157 // if (args.size() < 2) { nlwarning ("Missing argument number 1 that should be the eid"); return false; } \
158 // CEntityId eid = CEntityIdTranslator::getInstance()->getByEntity(args[1]); \
159 // if (eid == CEntityId::Unknown) \
161 // CCharacter *c = PlayerManager.getChar(eid); \
164 // log.displayNL ("Unknown player '%s' (%s)", eid.toString().c_str(), args[0].c_str()); \
167 // if(!c->getEnterFlag()) \
169 // log.displayNL ("'%s' is not entered", eid.toString().c_str()); \
172 // if(!TheDataset.isAccessible(c->getEntityRowId())) \
174 // log.displayNL ("'%s' is not valid in mirror", eid.toString().c_str()); \
180 // std::string command; \
181 // std::string adminCommand; \
182 // adminCommand = getName(); \
183 // for( uint i = 0; i < args.size(); i++ ) \
185 // adminCommand += string(" \"") + args[i] + string("\""); \
187 // GET_CHARACTER_Helper( command, eid, adminCommand ); \