52 throw CustomError (
"Correct Usage: /search [text]");
55 const std::string& query = args.
arg(1);
58 if (query.length() == 0)
61 std::map<uint32, std::string> matches;
65 std::string result(std::to_string(matches.size()));
66 result +=
" matches found.<br>";
68 std::map<uint32, std::string>::iterator cur, end;
69 cur = matches.begin();
71 for(; cur != end; cur++) {
72 result += std::to_string(cur->first);
74 result += cur->second;
78 if (10 < matches.size()) {
80 std::string subject(
"Search results for ");
85 return new PyString(
"Results sent via evemail.");
94 throw CustomError (
"Correct Usage: /giveisk [entityID ('me'=self)] [amount]");
98 std::string target =
"";
101 target = args.
arg(1);
103 throw CustomError (
"Argument 1 should be an entity ID ('me'=self)");
109 entity = atol(args.
arg(1).c_str());
114 throw CustomError (
"Argument 2 should be an amount of ISK");
115 double amount = strtod(args.
arg(2).c_str(), NULL);
122 throw CustomError (
"Unable to find character %u", entity);
125 throw CustomError (
"Invalid entityID for characters %u", entity);
129 return new PyString(
"Operation successful.");
135 throw CustomError (
"Correct Usage: /pop [message type] [key] [text]");
141 const std::string& msgType = args.
arg(1);
142 const std::string&
key = args.
arg(2);
143 const std::string& text = args.
arg(3);
145 Notify_OnRemoteMessage n;
153 return new PyString(
"Message sent.");
160 std::string actualTypeName =
"";
162 uint32 actualCategoryID = 0;
163 double actualRadius = 0.0;
175 throw CustomError (
"LOL, we don't know the correct usage of /spawnn, sorry you're S.O.L., BUT it should have 4 arguments.");
181 throw CustomError (
"Argument 3 should be an item type ID");
183 typeID = atoi(args.
arg(3).c_str());
188 throw CustomError (
"You must be in space to spawn things.");
191 if (!db->
ItemSearch(typeID, actualTypeID, actualTypeName, actualGroupID, actualCategoryID, actualRadius)) {
192 return new PyString(
"Unknown typeID or typeName returned no matches.");
198 double radius = (actualRadius * 5.0) * (double)(
MakeRandomInt(1, 3));
207 actualTypeName.c_str(),
212 if (item.get() ==
nullptr)
213 throw CustomError (
"Unable to spawn item of type %u.", typeID);
217 entity.
groupID = actualGroupID;
218 entity.
itemID = item->itemID();
220 entity.
typeID = actualTypeID;
230 return new PyString(
"Spawn Failed: typeID or typeName not supported.");
232 sLog.Yellow(
"Command",
"%s: Spawned %u.", who->
GetName(), typeID);
234 return new PyString(
"Spawn successful.");
241 uint32 maximumSpawnCountAllowed = 100;
243 std::string actualTypeName =
"";
245 uint32 actualCategoryID = 0;
246 double actualRadius = 0.0;
250 bool offsetLocationSet =
false;
251 std::string
usage =
"Correct Usage: <br><br> /spawn [typeID(int)/typeName(string)] <br><br>With optional spawn count: <br> /spawn [typeID(int)/typeName(string)] [count] <br><br>With optional count and (X,Y,Z) coordinate: <br> /spawn [typeID(int/typeName(string)] [count] [x(float)] [y(float)] [z(float)]";
254 throw CustomError (
"You must be in space to spawn things.");
261 throw CustomError (
"Argument 1 should be an item type ID");
263 int typeID = atoi(args.
arg(1).c_str());
266 if (!(db->
ItemSearch(typeID, actualTypeID, actualTypeName, actualGroupID, actualCategoryID, actualRadius)))
268 return new PyString(
"Unknown typeID or typeName returned no matches.");
274 throw CustomError (
"Argument 3 should be the number of spawns of this type you want to create");
276 spawnCount = atoi(args.
arg(2).c_str());
277 if (spawnCount > maximumSpawnCountAllowed)
278 throw CustomError (
"Argument 3, spawn count, is allowed to be no more than 100");
286 throw CustomError (
"Argument 4 should be the X distance from your ship in meters you want the item spawned");
291 throw CustomError (
"Argument 5 should be the Y distance from your ship in meters you want the item spawned");
294 throw CustomError (
"TOO FEW PARAMETERS: %s", usage.c_str());
299 throw CustomError (
"Argument 6 should be the Z distance from your ship in meters you want the item spawned");
302 throw CustomError (
"TOO FEW PARAMETERS: %s", usage.c_str());
304 offsetLocation.
x = atoll(args.
arg(3).c_str());
305 offsetLocation.
y = atoll(args.
arg(4).c_str());
306 offsetLocation.
z = atoll(args.
arg(5).c_str());
307 offsetLocationSet =
true;
312 for(spawnIndex=0; spawnIndex < spawnCount; ++spawnIndex)
316 if (offsetLocationSet)
320 loc.
x += offsetLocation.
x;
321 loc.
y += offsetLocation.
y;
322 loc.
z += offsetLocation.
z;
328 radius = (actualRadius * 5.0) * (double)(
MakeRandomInt(1, 3));
338 actualTypeName.c_str(),
343 if (item.get() ==
nullptr)
344 throw CustomError (
"Unable to spawn item of type %u.", typeID);
348 entity.
groupID = actualGroupID;
349 entity.
itemID = item->itemID();
351 entity.
typeID = actualTypeID;
354 switch (actualCategoryID) {
381 return new PyString(
"Spawn Failed: typeID or typeName not supported.");
385 sLog.Yellow(
"Command_spawn",
"%s: Spawned %u in space, %u times", pClient->
GetName(), typeID, spawnCount);
387 return new PyString(
"Spawn successful.");
395 throw CustomError (
"Correct Usage: /setbpattr [blueprintID] [0 (not copy) or 1 (copy)] [material level] [productivity level] [remaining runs]");
397 throw CustomError (
"Argument 1 must be blueprint ID. (got %s)", args.
arg(1).c_str());
398 if (
"0" != args.
arg(2) &&
"1" != args.
arg(2))
399 throw CustomError (
"Argument 2 must be 0 (original) or 1 (copy). (got %s)", args.
arg(2).c_str());
401 throw CustomError (
"Argument 3 must be material level. (got %s)", args.
arg(3).c_str());
403 throw CustomError (
"Argument 4 must be productivity level. (got %s)", args.
arg(4).c_str());
405 throw CustomError (
"Argument 5 must be remaining licensed production runs. (got %s)", args.
arg(5).c_str());
407 int blueprintID = atoi(args.
arg(1).c_str());
410 throw CustomError (
"Failed to load blueprint %u.", blueprintID);
413 bp->SetCopy((atoi(args.
arg(2).c_str()) ?
true :
false));
414 bp->SetMLevel(atoi(args.
arg(3).c_str()));
415 bp->SetPLevel(atoi(args.
arg(4).c_str()));
416 bp->SetRuns(atoi(args.
arg(5).c_str()));
418 return new PyString(
"Properties modified.");
449 throw CustomError (
"Correct Usage: /setattr [itemID] [attributeID] [value]");
454 std::string target =
"";
457 target = args.
arg(1);
458 if (target !=
"myship")
459 throw CustomError (
"1st argument should be an entity ID ('myship'=current ship) (got %s).", args.
arg(1).c_str());
466 itemID = atoi(args.
arg(1).c_str());
470 throw CustomError (
"2nd argument must be attributeID (got %s).", args.
arg(2).c_str());
474 throw CustomError (
"3rd argument must be value (got %s).", args.
arg(3).c_str());
478 throw CustomError (
"1st argument must be a valid 'entity' table itemID that MUST be larger >= 140000000. (got %s)", args.
arg(1).c_str());
481 if (item.get() ==
nullptr)
482 throw CustomError (
"Failed to load item %u.", itemID);
485 sLog.Warning(
"GMCommands: Command_setattr()",
"This command will modify attribute and send change to client, but change does not take effect in client for some reason.");
488 return new PyString(
"Operation successful.");
495 throw CustomError (
"This command is currently disabled.");
560 ownerID = atoi(args.
arg(1).c_str());
563 throw CustomError (
"ERROR: Cannot find character #%d", ownerID);
565 character = pTarget->GetChar();
566 }
else if (args.
arg(1) ==
"me") {
571 throw CustomError (
"The use of string based Character names for this command is not yet supported! Use 'me' instead or the entityID of the character to which you wish to give skills.");
581 throw CustomError (
"Argument 1 must be Character ID or Character Name ");
583 throw CustomError (
"Correct Usage: /giveallskills [Character Name or ID]");
586 if (character.
get()) {
588 std::vector<uint32> skillList;
596 std::vector<uint32>::const_iterator cur = skillList.begin();
597 for (; cur != skillList.end(); ++cur) {
601 }
else if (character->
HasSkill(skillID)) {
602 skill = character->
GetSkill(skillID);
614 if (item.
get() ==
nullptr) {
629 pTarget->
SendErrorMsg(
"You need to relog for skills to get saved and show in character sheet.");
630 return new PyString (
"Gifting skills complete");
633 return new PyString (
"Skill Gifting Failure");
650 ownerID = atoi(args.
arg(1).c_str());
651 character =
sEntityList.FindClientByCharID(ownerID)->GetChar();
652 pTarget = character->GetClient();
653 }
else if (args.
arg(1) ==
"me") {
658 throw CustomError (
"The use of string based Character names for this command is not yet supported! Use 'me' instead or the entityID of the character to which you wish to give skills.");
668 throw CustomError (
"Argument 1 must be Character ID or Character Name ");
676 level = atoi(args.
arg(3).c_str());
681 throw CustomError (
"Correct Usage: .giveskill [me/CharacterID] [skillID] [level]");
684 if ((pTarget ==
nullptr) or (character.
get() ==
nullptr))
685 throw CustomError (
"ERROR: Unable to validate character object.");
694 if (skill.
get() ==
nullptr){
696 return new PyString (
"Skill Gifting Failure - Unable to get item for skillID %u.",
skillID);
698 newPoints = skill->GetSPForLevel(level);
705 std::ostringstream str;
706 str <<
"Skill Gift by ";
710 if (skill.get() ==
nullptr)
713 newPoints = skill->GetSPForLevel(level);
716 skill->ChangeSingleton(
true);
724 OnAdminSkillChange oasc;
725 oasc.skillItemID = skill->itemID();
727 oasc.newSP = newPoints;
731 _log(SKILL__MESSAGE,
"GiveSkill - skill %u set to level %u with %u SP.",
skillID, level, newPoints);
739 if (strcmp(
"me", args.
arg(1).c_str())!=0)
741 throw CustomError (
"Argument 1 should be an entity ID or me (me=self)");
742 uint32 entity = atoi(args.
arg(1).c_str());
745 if (strcmp(
"me", args.
arg(1).c_str())==0)
751 throw CustomError (
"Unable to find character %u", entity);
755 tgt->GetShip()->OnlineAll();
757 throw CustomError (
"Command failed: You can't activate modules while in a pod");
759 return(
new PyString(
"All modules have been put Online"));
762 throw CustomError (
"Command failed: You got the arguments all wrong.");
772 if (strcmp(
"me", args.
arg(1).c_str())!=0)
775 throw CustomError (
"Argument 1 should be an entity ID or me (me=self)");
777 entityID = atoi(args.
arg(1).c_str());
781 if (strcmp(
"all", args.
arg(2).c_str())!=0)
783 throw CustomError (
"Argument 2 should be an item ID or all");
784 itemID = atoi(args.
arg(2).c_str());
789 if (strcmp(
"me", args.
arg(1).c_str())==0)
796 throw CustomError (
"Unable to find character %u", entityID );
803 if (args.
argCount() == 3 && strcmp(
"all", args.
arg(2).c_str())!=0)
806 if (args.
argCount() == 3 && strcmp(
"all", args.
arg(2).c_str())==0)
809 return(
new PyString(
"All Modules have been unloaded"));
812 throw CustomError (
"Command failed: You got the arguments all wrong.");
822 throw CustomError (
"Argument 1 should be a character ID");
823 uint32 charID = atoi(args.
arg(1).c_str());
827 throw CustomError (
"Cannot find CharacterID %u", charID);
828 target->GetShip()->RepairModules();
831 return(
new PyString(
"Modules repaired successful."));
839 throw CustomError (
"Correct Usage: /dogma [itemID|me] [attributeName] = [value]");
844 throw CustomError (
"/dogma Second argument must be a string");
847 if (args.
arg(3) !=
"=") {
848 throw CustomError (
"/dogma You didn't use an '=' in between your attribute name and value.");
851 throw CustomError (
"/dogma The last argument must be a number");
854 const char *attributeName = args.
arg(2).c_str();
855 float attributeValue = atof(args.
arg(4).c_str());
858 if (args.
arg(1) ==
"me") {
865 i->SetAttribute(db->
GetAttributeID(attributeName), attributeValue);
876 int id = atoi(args.
arg(1).c_str());
879 const char *name = args.
arg(1).c_str();
888 std::string name = args.
arg(1) +
" " + args.
arg(2);
889 target =
sEntityList.FindClientByName(name.c_str()) ;
891 throw CustomError (
"Correct Usage: /kick [Character Name]");
894 if (target == NULL) {
912 const char *name = args.
arg(1).c_str();
916 throw CustomError (
"Correct Usage: /ban [Character Name]");
924 std::string name = args.
arg(1) +
" " + args.
arg(2);
925 target =
sEntityList.FindClientByName(name.c_str()) ;
928 throw CustomError (
"Correct Usage: /ban [Character Name]");
946 const char *name = args.
arg(1).c_str();
950 throw CustomError (
"Correct Usage: /ban [Character Name]");
958 std::string name = args.
arg(1) +
" " + args.
arg(2);
962 throw CustomError (
"Correct Usage: /unban [Character Name / Character ID]");
int GetAccountID(std::string name)
SkillRef GetSkill(uint16 skillTypeID) const
void SendNotification(const PyAddress &dest, EVENotificationStream ¬i, bool seq=true)
PyResult Command_giveskills(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
uint32 GetLocationID() const
void SendErrorMsg(const char *fmt,...)
#define _log(type, fmt,...)
bool ItemSearch(const char *query, std::map< uint32, std::string > &into)
const std::string & arg(size_t index) const
ModuleManager * GetModuleManager()
void UnfitModule(uint32 itemID)
void SaveSkillHistory(uint16 eventID, double logDate, uint32 characterID, uint16 skillTypeID, uint8 skillLevel, uint32 absolutePoints)
uint32 GetRegionID() const
PyResult Command_getattr(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
void QueueDestinyEvent(PyTuple **multiEvent)
PyResult Command_ban(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
int32 GetCharacterID() const
int32 GetWarFactionID() const
PyResult Command_pop(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
int32 GetCorporationID() const
bool FullSkillList(std::vector< uint32 > &skillList)
static void SetAccountBanStatus(uint32 accountID, bool banned=false)
Separates string to arguments.
CharacterRef GetChar() const
bool BuildDynamicEntity(const DBSystemDynamicEntity &entity, uint32 launcherID=0)
PyResult Command_giveallskills(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
Advanced version of UserError that allows to send a full custom message.
itemID[count] Create count or of the specified item(from Insider)" ) COMMAND( goto
void SelfEveMail(const char *subject, const char *fmt,...)
int32 GetAllianceID() const
const GPoint & GetPosition() const
PyResult Command_unban(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_setbpattr(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
#define sLog
Evaluates to a NewLog instance.
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()()() itemID() itemID Fits selected item to active ship() skillID(level)-gives skillID to specified level." ) COMMAND( online
int GetAttributeID(const char *attributeName)
PyResult Command_fit(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_kick(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
bool isHexNumber(size_t index) const
SystemManager * SystemMgr() const
const uint8 MAXSKILLLEVEL
PyResult Command_repairmodules(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_setattr(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_online(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_search(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
ShipItemRef GetShip() const
const char * GetName() const
itemID[count] Create count or of the specified() x() entityID Translocate to the specified entity Immediately stops ship
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
PyResult Command_unload(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
std::string GetCharName()
PyResult Command_dogma(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
bool HasSkillTrainedToLevel(uint16 skillTypeID, uint8 skillLevel) const
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
PyResult Command_spawn(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
bool isNumber(size_t index) const
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()() itemID(attributeID)-Retrieves attribute value." ) COMMAND( setattr
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type() key(value)-Send an OnRemoteMessage" ) COMMAND( setbpattr
PyResult Command_giveskill(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
void MakeRandomPointOnSphere(double radius)
void RepairModules(std::vector< InventoryItemRef > &itemRefVec, float fraction)
void RemoveFromQueue(SkillRef sRef)
PyResult Command_giveisk(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_spawnn(Client *who, CommandDB *db, PyServiceMgr *services, const Seperator &args)
bool HasSkill(uint16 skillTypeID) const