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
@@ -751,7 +751,7 @@ public:
|
||||
if (target)
|
||||
handler->SendSysMessage(LANG_WAYPOINT_CREATSELECTED);
|
||||
|
||||
pathid = atoi((char*)guid_str);
|
||||
pathid = atoul(guid_str);
|
||||
}
|
||||
|
||||
std::string show = show_str;
|
||||
@@ -770,12 +770,12 @@ public:
|
||||
}
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID);
|
||||
stmt->setUInt32(0, target->GetGUID().GetCounter());
|
||||
stmt->setUInt32(0, target->GetSpawnId());
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
handler->SendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM);
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, target->GetSpawnId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -830,7 +830,7 @@ public:
|
||||
{
|
||||
Field* fields = result2->Fetch();
|
||||
uint32 wpguid = fields[0].GetUInt32();
|
||||
Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Unit, VISUAL_WAYPOINT, wpguid));
|
||||
Creature* creature = handler->GetCreatureFromPlayerMapByDbGuid(wpguid);
|
||||
|
||||
if (!creature)
|
||||
{
|
||||
@@ -885,7 +885,7 @@ public:
|
||||
|
||||
// Set "wpguid" column to the visual waypoint
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID);
|
||||
stmt->setInt32(0, int32(wpCreature->GetSpawnId()));
|
||||
stmt->setUInt32(0, wpCreature->GetSpawnId());
|
||||
stmt->setUInt32(1, pathid);
|
||||
stmt->setUInt32(2, point);
|
||||
WorldDatabase.Execute(stmt);
|
||||
@@ -1031,15 +1031,16 @@ public:
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
ObjectGuid::LowType guid = fields[0].GetUInt32();
|
||||
Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HighGuid::Unit, VISUAL_WAYPOINT, guid));
|
||||
ObjectGuid::LowType lowguid = fields[0].GetUInt32();
|
||||
|
||||
Creature* creature = handler->GetCreatureFromPlayerMapByDbGuid(lowguid);
|
||||
if (!creature)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, lowguid);
|
||||
hasError = true;
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
|
||||
stmt->setUInt32(0, guid);
|
||||
stmt->setUInt32(0, lowguid);
|
||||
WorldDatabase.Execute(stmt);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user