37 throw CustomError (
"Correct Usage: /goto [x coord] [y coor] [z coord]");
41 atoll(args.
arg(2).c_str()),
42 atoll(args.
arg(3).c_str()));
45 return new PyString(
"Goto successful.");
80 if (pClient ==
nullptr)
81 throw CustomError (
"Translocate: Invalid Caller - Client sent NULL.");
84 throw CustomError (
"Translocate: Missing Arguments (use '.tr help' for usage)");
86 Client* pOtherClient(
nullptr);
87 const char* Help =
"help";
88 bool me =
false,
item =
false, player =
false,
fleet =
false;
95 locationID = atoi(args.
arg(1).c_str());
96 }
else if (strcmp(args.
arg(1).c_str(), Help) == 0) {
98 std::ostringstream str;
99 str <<
".tr [required first arg] [optional second arg] [optional third arg] [optional fourth arg]<br>";
100 str <<
"1st arg = help|me|fleet|player name|shipID|itemID|locationID<br>";
101 str <<
"2nd arg = help|me|fleet|home|last|shipID|itemID|locationID|x coord|moon|planet<br>";
102 str <<
"3ed arg = me|fleet|home|last|shipID|itemID|locationID|y coords|moon|planet <br>";
103 str <<
"4th arg = fleet|home|last|shipID|itemID|locationID|z coords|moon|planet <br>";
104 str <<
"typical use is .tr locationID<br>";
105 str <<
"<br>As there are too many options to explain in this msg, a full usage list can be found on our forums.<br>";
108 snprintf(reply, size, str.str().c_str());
116 throw CustomError (
"Location contains invalid characters");
118 if (!
sDataMgr.IsSolarSystem(locationID)) {
120 if (!
sDataMgr.IsStation(locationID))
121 throw CustomError (
"Translocate: Name Argument is neither SolarSystem nor StationName");
126 if ((strcmp(args.
arg(1).c_str(), Help) == 0)
127 or (strcmp(args.
arg(2).c_str(), Help) == 0))
128 throw CustomError (
"Translocate: Invalid Arguments - 'help' not avalible for this command.");
132 int objectID = atoi(args.
arg(1).c_str());
134 pOtherClient =
sEntityList.FindClientByCharID(objectID);
138 if (iRef.
get() ==
nullptr)
139 throw CustomError (
"Translocate: Invalid Arguments - target object was not found.");
141 }
else if (
IsNPC(objectID)) {
142 throw CustomError (
"Translocate: Invalid Object - You really wanna relocate an NPC?");
144 throw CustomError (
"Translocate: Invalid Object - %i is neither a character nor a ship", objectID);
145 }
else if (strcmp(args.
arg(1).c_str(),
"me") == 0) {
149 }
else if (strcmp(args.
arg(1).c_str(),
"ship") == 0) {
152 }
else if (strcmp(args.
arg(1).c_str(),
"item") == 0) {
155 }
else if (strcmp(args.
arg(1).c_str(),
"fleet") == 0) {
160 throw CustomError (
"Translocate: Fleet Move - You are not in a fleet.");
161 throw CustomError (
"Translocate: Fleet Move - This command is currently incomplete.");
165 if (pOtherClient ==
nullptr)
166 throw CustomError (
"Translocate: Bad Name - %s is not online or is not a valid player name", args.
arg(1).c_str());
171 locationID = atoi(args.
arg(2).c_str());
172 }
else if (strcmp(args.
arg(2).c_str(),
"me") == 0) {
176 locationID = myLocationID;
177 }
else if (strcmp(args.
arg(2).c_str(),
"home") == 0) {
179 throw CustomError (
"Translocate: Fleet Move - You cannot tr a fleet 'home'...yet.");
181 }
else if (strcmp(args.
arg(2).c_str(),
"ship") == 0) {
184 throw CustomError (
"Translocate: Ship Move - You cannot tr one ship to another ship...yet.");
186 }
else if (strcmp(args.
arg(2).c_str(),
"last") == 0) {
189 throw CustomError (
"Translocate: Fleet Move - You cannot tr a fleet to last docked station...yet.");
191 if (pOtherClient !=
nullptr)
195 }
else if (strcmp(args.
arg(2).c_str(),
"moon") == 0) {
200 }
else if (strcmp(args.
arg(2).c_str(),
"planet") == 0) {
211 throw CustomError (
"Location contains invalid characters");
213 if (!
sDataMgr.IsSolarSystem(locationID)) {
215 if (!
sDataMgr.IsStation(locationID))
216 throw CustomError (
"Translocate: Name Argument is neither SolarSystem nor StationName");
220 throw CustomError (
"Translocate: Missing Arguments");
225 if ((strcmp(args.
arg(1).c_str(), Help) == 0)
226 or (strcmp(args.
arg(2).c_str(), Help) == 0)
227 or (strcmp(args.
arg(3).c_str(), Help) == 0))
228 throw CustomError (
"Translocate: Invalid Arguments - 'help' not avalible for this command.");
234 throw CustomError (
"Translocate: Coords in current system - Use '.goto {x,y,z}' instead of this.");
238 int objectID = atoi(args.
arg(1).c_str());
240 pOtherClient =
sEntityList.FindClientByCharID(objectID);
243 pOtherClient =
sEntityList.FindClientByCharID(objectID);
245 throw CustomError (
"Translocate: Invalid Object - %i is neither a character nor a ship", objectID);
246 }
else if (strcmp(args.
arg(1).c_str(),
"me") == 0) {
250 }
else if (strcmp(args.
arg(1).c_str(),
"fleet") == 0) {
255 throw CustomError (
"Translocate: Invalid Arguments - searching by player name is incomplete at this time.");
260 locationID = atoi(args.
arg(2).c_str());
261 }
else if (strcmp(args.
arg(2).c_str(),
"fleet") == 0) {
263 throw CustomError (
"Translocate: Fleet Move - You cannot tr a fleet to 'fleet'.");
266 }
else if (strcmp(args.
arg(2).c_str(),
"me") == 0) {
269 locationID = myLocationID;
270 }
else if (strcmp(args.
arg(2).c_str(),
"ship") == 0) {
273 throw CustomError (
"Translocate: Ship Move - You cannot tr one ship to another ship...yet.");
275 }
else if (strcmp(args.
arg(2).c_str(),
"home") == 0) {
278 throw CustomError (
"Translocate: Fleet Move - You cannot tr a fleet 'home'...yet.");
280 }
else if (strcmp(args.
arg(2).c_str(),
"last") == 0) {
282 throw CustomError (
"Translocate: Fleet Move - You cannot tr a fleet to last docked station...yet.");
286 if (pOtherClient !=
nullptr)
290 }
else if (strcmp(args.
arg(2).c_str(),
"moon") == 0) {
295 }
else if (strcmp(args.
arg(2).c_str(),
"planet") == 0) {
302 throw CustomError (
"Translocate: Invalid Arguments");
308 locationID = atoi(args.
arg(2).c_str());
309 }
else if (strcmp(args.
arg(3).c_str(),
"last") == 0) {
311 throw CustomError (
"Translocate: Fleet Move - You cannot tr a fleet to last docked station...yet.");
315 if (pOtherClient !=
nullptr)
319 }
else if (strcmp(args.
arg(3).c_str(),
"moon") == 0) {
324 }
else if (strcmp(args.
arg(3).c_str(),
"planet") == 0) {
331 throw CustomError (
"Translocate: Invalid Arguments");
336 if ((strcmp(args.
arg(1).c_str(), Help) == 0)
337 or (strcmp(args.
arg(2).c_str(), Help) == 0)
338 or (strcmp(args.
arg(3).c_str(), Help) == 0)
339 or (strcmp(args.
arg(4).c_str(), Help) == 0))
340 throw CustomError (
"Translocate: Invalid Arguments - 'help' not avalible for this command.");
348 locationID = atoi(args.
arg(1).c_str());
349 if (!
sDataMgr.IsSolarSystem(locationID))
350 throw CustomError (
"Translocate: Invalid Arguments - locationID %u is not a SolarSystemID.", locationID);
351 pt =
GPoint(atoi(args.
arg(2).c_str()), atoi(args.
arg(3).c_str()), atoi(args.
arg(4).c_str()));
360 throw CustomError (
"Translocate: 4 args - This command is currently incomplete.");
363 if ((strcmp(args.
arg(1).c_str(), Help) == 0)
364 or (strcmp(args.
arg(2).c_str(), Help) == 0)
365 or (strcmp(args.
arg(3).c_str(), Help) == 0)
366 or (strcmp(args.
arg(4).c_str(), Help) == 0)
367 or (strcmp(args.
arg(5).c_str(), Help) == 0))
368 throw CustomError (
"Translocate: Invalid Arguments - 'help' not avalible for this command.");
370 throw CustomError (
"Translocate: 5 args - This command is currently incomplete.");
372 throw CustomError (
"Translocate: Too Many Arguments");
377 throw CustomError (
"Translocate: Fleet Move - This command is currently incomplete.");
389 if (pClient2 ==
nullptr) {
403 else if (!
sDataMgr.IsStation(locationID) and !
sDataMgr.IsSolarSystem(locationID)) {
404 throw CustomError (
"Translocate: Invalid Location %i", locationID);
407 if (pOtherClient !=
nullptr) {
423 typeID = atoi(args.
arg(1).c_str());
428 throw CustomError (
"Name contains invalid characters");
429 std::map<uint32_t, std::string> matches;
433 if (matches.size() > 1) {
434 auto c = matches.begin();
435 auto e = matches.end();
436 for (; c != e; c++) {
437 _log(COMMAND__MESSAGE,
"Got match: %s\n", c->second.c_str());
444 throw CustomError (
"Item name is ambiguous. Please use a full item name");
446 }
else if (matches.size() == 1) {
447 auto cur = matches.begin();
448 _log(COMMAND__MESSAGE,
449 "ItemSearch returned type: \"%s\" given \"%s\"\n",
450 cur->second.c_str(), args.
arg(1).c_str());
455 throw CustomError (
"Unable to find valid type to create");
463 qty = atoi(args.
arg(2).c_str());
466 _log(COMMAND__MESSAGE,
"Create %s %u times", args.
arg(1).c_str(), qty);
489 if (iRef.get() ==
nullptr)
490 throw CustomError (
"Unable to create item of type %s.", args.
arg(1).c_str());
496 iRef->Move(locationID, flag,
true);
500 return new PyInt(iRef.get()->itemID());
505 throw CustomError (
"Correct Usage: /create [typeID|\"Type Name\"] [qty] [where]");
512 throw CustomError (
"Correct Usage: /createitem [typeID|\"Type Name\"] [qty] [where]");
522 throw CustomError (
"Argument 1 should be a character ID");
524 int entity = atoi(args.
arg(1).c_str());
527 if (itemRef.get() == NULL)
528 throw CustomError (
"/kill NOT supported on non-ship types at this time");
531 if (shipEntity ==
nullptr) {
532 throw CustomError (
"/kill cannot process this object");
533 sLog.Error(
"GMCommands - Command_kill()",
"Cannot process this object, aborting kill: %s [%u]", itemRef->name(), itemRef->itemID());
539 npcEntity->
Killed(fatal_blow);
543 shipEntity->
Killed(fatal_blow);
548 throw CustomError (
"Correct Usage: /kill <entityID>");
564 std::map< uint32, SystemEntity* > entityVec;
566 for (
auto cur : entityVec) {
567 if (cur.second ==
nullptr)
569 if (cur.second->IsNPCSE()) {
571 cur.second->GetNPCSE()->Killed(fatal_blow);
580 #define DEFAULT_RANGE 500000
582 throw CustomError (
"You must be in space to unspawn things.");
586 throw CustomError (
"/unspawn failed. You don't appear to have a ship?");
590 if (target_index > 0) {
592 throw CustomError (
"/unspawn called with non number");
594 target = atoi(args.
arg(target_index).c_str());
600 codelog(COMMAND__ERROR,
"unspawn got: %s %s %u",
601 range_str.c_str(), only_str.c_str(), target);
605 if (range_str.size() > 0) {
607 throw CustomError (
"/unspawn with range=x must be a number");
609 range = atoi(range_str.c_str());
613 only_str.size() > 0) and
615 throw CustomError (
"/unspawn cannot be called with an explcit target and either range= or only=");
621 if (sys_entity ==
nullptr) {
622 throw CustomError (
"/unspawn failed. Item %u not found.", target);
627 codelog(COMMAND__MESSAGE,
"/unspawn called with single target successful");
631 if (only_str.size() == 0) {
632 throw CustomError (
"/unspawn usage:<br> /unspawn [itemID]<br>/unspawn only=category|group<br>If using only the default range is 10k. You can set this by adding range=x in meters");
635 bool is_category_match =
false;
636 bool is_group_match =
false;
639 if (strcmp(only_str.c_str(),
"categoryDrone") == 0) {
641 is_category_match =
true;
642 }
else if (strcmp(only_str.c_str(),
"groupWreck") == 0) {
644 is_group_match =
true;
646 throw CustomError (
"only='%s' not a supported group or category", only_str.c_str());
650 if (pBubble ==
nullptr) {
651 throw CustomError (
"/unspawn failed. You don't appear to be in a bubble. Try /update");
656 std::map< uint32, SystemEntity* > entMap;
658 for (
auto cur : entMap) {
659 if (is_group_match and match_id != cur.second->GetGroupID()) {
660 codelog(COMMAND__ERROR,
"m: g%d c%d skipping match_id %u groupID %u",
661 is_group_match, is_category_match, match_id, cur.second->GetGroupID());
664 if (is_category_match and match_id != cur.second->GetCategoryID()) {
665 codelog(COMMAND__ERROR,
"m: g%d c%d skipping match_id %u categoryID %u",
666 is_group_match, is_category_match, match_id, cur.second->GetGroupID());
670 if (player_pos.
distance(cur.second->GetPosition()) > range)
673 cur.second->Delete();
692 if (pBubble ==
nullptr) {
703 "SystemID: %u BubbleID: %u<br>"
727 pClient->
SendInfoModalMsg(
"Session Change Active. Wait %u seconds before issuing another command.",
729 return new PyString(
"SessionChange Active. Request Denied.");
735 return new PyString(
"Position synchronized.");
747 pClient->
SendInfoModalMsg(
"Session Change Active. Wait %u seconds before issuing another command.",
749 return new PyString(
"SessionChange Active. Request Denied.");
755 return new PyString(
"All Positions synchronized.");
766 pClient->
SendInfoModalMsg(
"Session Change Active. Wait %u seconds before issuing another command.",
768 return new PyString(
"SessionChange Active. Request Denied.");
774 if (pBubble ==
nullptr) {
783 return new PyString(
"Update sent.");
794 pClient->
SendInfoModalMsg(
"Session Change Active. Wait %u seconds before issuing another command.",
796 return new PyString(
"SessionChange Active. Request Denied.");
802 return new PyString(
"Update sent.");
814 if (pBubble ==
nullptr) {
820 return new PyString(
"Update sent.");
832 if (pBubble ==
nullptr) {
838 return new PyString(
"Update sent.");
850 throw CustomError (
"ERROR! You MUST be in space to cloak!");
866 sLog.Warning(
"GMCommands: Command_sov()",
"This command passes args.argCount() = %u.", args.
argCount());
PyResult Command_unspawn(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_sendstate(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
SystemEntity * GetSE(uint32 entityID) const
uint32 GetLocationID() const
GaExpInl GaFloat length() const
uint32 GetSystemID() const
#define _log(type, fmt,...)
void SendAddBalls(SystemEntity *to_who)
bool ItemSearch(const char *query, std::map< uint32, std::string > &into)
PyResult Command_tr(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
const std::string & arg(size_t index) const
const GPoint GetRandPointOnMoon(uint32 systemID)
uint32_t GetSolarSystem(const char *name)
static PyResult generic_createitem(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
virtual void Killed(Damage &fatal_blow)
void JumpOutEffect(uint32 locationID)
void MoveToLocation(uint32 location, const GPoint &pt)
PyResult Command_hop(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
const GPoint & position() const
SystemBubble * SysBubble()
void GetEntities(std::map< uint32, SystemEntity * > &into) const
void SendAddBalls2(SystemEntity *to_who)
void SendInfoModalMsg(const char *fmt,...)
const GVector & GetVelocity() const
int32 GetCharacterID() const
std::string cmd_parse_eq_arg(const Seperator &args, const char *name)
uint32 GetSessionChangeTime()
Separates string to arguments.
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 SendSetState() const
const GPoint & GetPosition() const
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in bubble
PyResult Command_create(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
const GPoint GetRandPointOnPlanet(uint32 systemID)
void MoveToPosition(const GPoint &pt)
PyResult Command_goto(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
#define sLog
Evaluates to a NewLog instance.
DestinyManager * DestinyMgr()
#define IsPlayerItem(itemID)
#define codelog(type, fmt,...)
SystemManager * SystemMgr() const
PyResult Command_update(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
static const GPoint NULL_ORIGIN(0, 0, 0)
void RemoveEntity(SystemEntity *pSE)
PyResult Command_cloak(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
uint32 locationID() const
ShipItemRef GetShip() const
PyResult Command_sov(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
int cmd_find_nth_noneq(const Seperator &args, int n)
void SetStateSent(bool set=false)
#define IsCharacterID(itemID)
bool IsNumber(char c)
Checks whether character is a number.
void SetPosition(const GPoint &pt, bool update=false)
int32 GetCloneStationID() const
uint32 GetDockStationID()
PyResult Command_kill(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_addball2(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
static const std::array< std::string, 16 > badCharsSearch
void SetDestiny(const GPoint &pt, bool update=false)
PyResult Command_location(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_pos(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
bool isNumber(size_t index) const
PyResult Command_createitem(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
const GPoint & GetPosition() const
uint32 AddItemByFlag(EVEItemFlags flag, InventoryItemRef iRef, Client *pClient=nullptr)
int32 GetStationID() const
void EnterSystem(uint32 systemID)
GaExpInl GaFloat distance(const GaVec3 &oth) const
virtual void Killed(Damage &fatal_blow)
void MakeRandomPointOnSphere(double radius)
PyResult Command_syncpos(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_syncloc(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
PyResult Command_killallnpcs(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
uint32_t GetStation(const char *name)
PyResult Command_addball(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)
bool icontains(std::string data, std::string toSearch, size_t pos=0)
PyResult Command_translocate(Client *pClient, CommandDB *db, PyServiceMgr *services, const Seperator &args)