Scripts/Commands: Fix guid usage and enhance commands
- Fix targeting gameobjects and creatures for .dist and .gps. The old code used DB guid to search from core generated guid lists. - Fix some error messages saying 'no player found' even if creatures and gameobjects and players were searched - Change atoi to atoul when receiving lowguids as string or other uint32 values - Use ObjectGuid::LowType instead of uint32 for lowguid type - Allow .gob info to take in gameobject guid link as well as entry link in addition to gameobject entry and update the documentation of the command - Change .gob delete to post the spawnid (dbguid) instead of the ingame generated guid (which is basically never seen or used by the player in any other commands that I see) - Allow spawntimesecs to be negative when spawning a gameobject - Disable searching by ingame spawn id in commands. (it makes little sense for a user to provide a number which is then attempted to be used as DB guid and non DB guid when both could have a match) - Update .gob turn documentation to tell about possibility to provide orientation in command - Correct the types in .gob add command result trinity_string - Correct the creature search for .npc del - Change .event to .event info - Add .go offset command - Remove the .go command for empty string (no subcommand given) because it just used .go xyz - Extend .gob info to show size, faction, flags and model dimensions - Remove some unnecessary casts - Document .wp show better (first and last were not documented) - Insert spawnid to .wp show info error message - Fix spawntime printing for .gobject target - Fix guid targetting for .npc set movetype - Fix query by spawnid for .wp show info - Fix deleting of existing waypoints when twice doing the command .wp show on - Fix deleting of existing waypoints when doing the command .wp show off - Change wpguid column in DB and in core to uint32, which is what the spawnid type is in core and db.
This commit is contained in:
1 parent
e24178406d
commit
2d54defdf0
14 files changed
+301
-174
No files matched your search
@@ -246,7 +246,7 @@ public:
|
||||
if (!charID)
|
||||
return false;
|
||||
|
||||
uint32 id = atoi(charID);
|
||||
uint32 id = atoul(charID);
|
||||
if (!sObjectMgr->GetCreatureTemplate(id))
|
||||
return false;
|
||||
|
||||
@@ -373,7 +373,7 @@ public:
|
||||
char* guidStr = strtok((char*)args, " ");
|
||||
char* waitStr = strtok((char*)nullptr, " ");
|
||||
|
||||
ObjectGuid::LowType lowGuid = atoi((char*)guidStr);
|
||||
ObjectGuid::LowType lowGuid = atoul((char*)guidStr);
|
||||
|
||||
// attempt check creature existence by DB data
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(lowGuid);
|
||||
@@ -422,7 +422,7 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 newEntryNum = atoi(args);
|
||||
uint32 newEntryNum = atoul(args);
|
||||
if (!newEntryNum)
|
||||
return false;
|
||||
|
||||
@@ -447,7 +447,7 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint8 lvl = (uint8) atoi((char*)args);
|
||||
uint8 lvl = (uint8) atoi(args);
|
||||
if (lvl < 1 || lvl > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) + 3)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
@@ -482,12 +482,10 @@ public:
|
||||
if (!cId)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType lowguid = atoi(cId);
|
||||
ObjectGuid::LowType lowguid = atoul(cId);
|
||||
if (!lowguid)
|
||||
return false;
|
||||
|
||||
if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid))
|
||||
unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Unit, cr_data->id, lowguid));
|
||||
unit = handler->GetCreatureFromPlayerMapByDbGuid(lowguid);
|
||||
}
|
||||
else
|
||||
unit = handler->getSelectedCreature();
|
||||
@@ -553,7 +551,7 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 factionId = (uint32) atoi((char*)args);
|
||||
uint32 factionId = atoul(args);
|
||||
|
||||
if (!sFactionTemplateStore.LookupEntry(factionId))
|
||||
{
|
||||
@@ -596,7 +594,7 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 npcFlags = (uint32) atoi((char*)args);
|
||||
uint32 npcFlags = (uint32) atoi(args);
|
||||
|
||||
Creature* creature = handler->getSelectedCreature();
|
||||
|
||||
@@ -796,7 +794,7 @@ public:
|
||||
if (!cId)
|
||||
return false;
|
||||
|
||||
lowguid = atoi(cId);
|
||||
lowguid = atoul(cId);
|
||||
|
||||
// Attempting creature load from DB data
|
||||
CreatureData const* data = sObjectMgr->GetCreatureData(lowguid);
|
||||
@@ -882,7 +880,7 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 displayId = (uint32) atoi((char*)args);
|
||||
uint32 displayId = atoul(args);
|
||||
|
||||
Creature* creature = handler->getSelectedCreature();
|
||||
|
||||
@@ -976,12 +974,10 @@ public:
|
||||
}
|
||||
else // case .setmovetype #creature_guid $move_type (with selected creature)
|
||||
{
|
||||
lowguid = atoi((char*)guid_str);
|
||||
lowguid = atoul(guid_str);
|
||||
|
||||
/* impossible without entry
|
||||
if (lowguid)
|
||||
creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), MAKE_GUID(lowguid, HighGuid::Unit));
|
||||
*/
|
||||
creature = handler->GetCreatureFromPlayerMapByDbGuid(lowguid);
|
||||
|
||||
// attempt check creature existence by DB data
|
||||
if (!creature)
|
||||
@@ -1084,7 +1080,7 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 phase = (uint32) atoi((char*)args);
|
||||
uint32 phase = atoul(args);
|
||||
|
||||
Creature* creature = handler->getSelectedCreature();
|
||||
if (!creature || creature->IsPet())
|
||||
@@ -1160,7 +1156,7 @@ public:
|
||||
if (!stime)
|
||||
return false;
|
||||
|
||||
int spawnTime = atoi((char*)stime);
|
||||
int spawnTime = atoi(stime);
|
||||
|
||||
if (spawnTime < 0)
|
||||
{
|
||||
@@ -1359,7 +1355,7 @@ public:
|
||||
|
||||
Player* chr = handler->GetSession()->GetPlayer();
|
||||
|
||||
uint32 id = atoi(charID);
|
||||
uint32 id = atoul(charID);
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
@@ -1488,7 +1484,7 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType leaderGUID = (uint32) atoi((char*)args);
|
||||
ObjectGuid::LowType leaderGUID = atoul(args);
|
||||
Creature* creature = handler->getSelectedCreature();
|
||||
|
||||
if (!creature || !creature->GetSpawnId())
|
||||
@@ -1540,7 +1536,7 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType linkguid = (uint32) atoi((char*)args);
|
||||
ObjectGuid::LowType linkguid = atoul(args);
|
||||
|
||||
Creature* creature = handler->getSelectedCreature();
|
||||
|
||||
|
||||
Reference in new issue
Block a user