mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 23:50:44 +01:00
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:
File diff suppressed because one or more lines are too long
7
sql/updates/auth/4.3.4/2017_04_02_00_auth.sql
Normal file
7
sql/updates/auth/4.3.4/2017_04_02_00_auth.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
--
|
||||
UPDATE `rbac_permissions` SET `name`='Command: event info' WHERE `id`=367;
|
||||
DELETE FROM `rbac_permissions` WHERE `id` = 845;
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES (845, 'Command: go offset');
|
||||
DELETE FROM `rbac_linked_permissions` WHERE `id` = 198 AND `linkedId` = 845;
|
||||
INSERT INTO `rbac_linked_permissions` (`id`, `linkedId`) VALUES (198, 845);
|
||||
--
|
||||
21
sql/updates/world/4.3.4/2017_04_02_00_world.sql
Normal file
21
sql/updates/world/4.3.4/2017_04_02_00_world.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
--
|
||||
UPDATE `command` SET `help`='Syntax: .gobject turn [guid|link] [oz [oy [ox]]]\r\n\r\nSet the orientation of the gameobject to player\'s orientation or the given orientation.' WHERE `name`='gobject turn';
|
||||
UPDATE `trinity_string` SET `content_default`='>> Add Game Object \'%u\' (%s) (GUID: %u) added at \'%f %f %f\'.' WHERE `entry`=525;
|
||||
UPDATE `command` SET `name`='event info', `help`='Syntax: .event info #event_id\r\nShow details about event with #event_id.' WHERE `name`='event';
|
||||
|
||||
DELETE FROM `trinity_string` WHERE `entry` IN (84, 85, 86);
|
||||
INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES
|
||||
(84, 'Size: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(85, 'Faction: %u Flags: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(86, 'Model dimensions from center: Max X %f Y %f Z %f Min X %f Y %f Z %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
DELETE FROM `command` WHERE `name` = "go";
|
||||
DELETE FROM `command` WHERE `name` = "go offset";
|
||||
INSERT INTO `command` (`name`, `permission`, `help`) VALUES ('go offset', 845, 'Syntax: .go offset [x[ y[ z[ o]]]]\nTeleports the player by given offset from his current coordinates.');
|
||||
|
||||
UPDATE `command` SET `help`='Syntax: .gobject info [$entry|$link | guid [$guid|$link]\r \r Query Gameobject information for given gameobject entry, guid or link.\rFor example .gobject info 36\ror .gobject info guid 100' WHERE `name`='gobject info';
|
||||
|
||||
ALTER TABLE `waypoint_data` CHANGE COLUMN `wpguid` `wpguid` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `action_chance`;
|
||||
|
||||
UPDATE `command` SET `help`='Syntax: .wp show $option\nOptions:\non $pathid (or selected creature with loaded path) - Show path\nfirst $pathid (or selected creature with loaded path) - Show first waypoint in path\nlast $pathid (or selected creature with loaded path) - Show last waypoint in path\noff - Hide all paths\ninfo $selected_waypoint - Show info for selected waypoint.' WHERE `name`='wp show';
|
||||
--
|
||||
@@ -749,6 +749,7 @@ enum RBACPermissions
|
||||
RBAC_PERM_COMMAND_RELOAD_CHARACTER_TEMPLATE = 842, // not on 3.3.5a or 4.3.4
|
||||
RBAC_PERM_COMMAND_RELOAD_QUEST_GREETING = 843, // not on 3.3.5a or 4.3.4
|
||||
RBAC_PERM_COMMAND_DEBUG_SEND_PLAYSCENE = 844, // not on 3.3.5a or 4.3.4
|
||||
RBAC_PERM_COMMAND_GO_OFFSET = 845,
|
||||
|
||||
// custom permissions 1000+
|
||||
RBAC_PERM_MAX
|
||||
|
||||
@@ -900,22 +900,31 @@ GameObject* ChatHandler::GetNearbyGameObject()
|
||||
return obj;
|
||||
}
|
||||
|
||||
GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(ObjectGuid::LowType lowguid, uint32 entry)
|
||||
GameObject* ChatHandler::GetObjectFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
|
||||
{
|
||||
if (!m_session)
|
||||
return nullptr;
|
||||
auto bounds = m_session->GetPlayer()->GetMap()->GetGameObjectBySpawnIdStore().equal_range(lowguid);
|
||||
if (bounds.first != bounds.second)
|
||||
return bounds.first->second;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Player* pl = m_session->GetPlayer();
|
||||
GameObject* obj = pl->GetMap()->GetGameObject(ObjectGuid(HighGuid::GameObject, entry, lowguid));
|
||||
|
||||
if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object
|
||||
Creature* ChatHandler::GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
|
||||
{
|
||||
if (!m_session)
|
||||
return nullptr;
|
||||
// Select the first alive creature or a dead one if not found
|
||||
Creature* creature = nullptr;
|
||||
auto bounds = m_session->GetPlayer()->GetMap()->GetCreatureBySpawnIdStore().equal_range(lowguid);
|
||||
for (auto it = bounds.first; it != bounds.second; ++it)
|
||||
{
|
||||
auto bounds = pl->GetMap()->GetGameObjectBySpawnIdStore().equal_range(lowguid);
|
||||
if (bounds.first != bounds.second)
|
||||
obj = bounds.first->second;
|
||||
creature = it->second;
|
||||
if (it->second->IsAlive())
|
||||
break;
|
||||
}
|
||||
|
||||
return obj;
|
||||
return creature;
|
||||
}
|
||||
|
||||
enum SpellLinkType
|
||||
@@ -1005,9 +1014,9 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text)
|
||||
|
||||
enum GuidLinkType
|
||||
{
|
||||
SPELL_LINK_PLAYER = 0, // must be first for selection in not link case
|
||||
SPELL_LINK_CREATURE = 1,
|
||||
SPELL_LINK_GAMEOBJECT = 2
|
||||
GUID_LINK_PLAYER = 0, // must be first for selection in not link case
|
||||
GUID_LINK_CREATURE = 1,
|
||||
GUID_LINK_GAMEOBJECT = 2
|
||||
};
|
||||
|
||||
static char const* const guidKeys[] =
|
||||
@@ -1018,7 +1027,7 @@ static char const* const guidKeys[] =
|
||||
nullptr
|
||||
};
|
||||
|
||||
ObjectGuid ChatHandler::extractGuidFromLink(char* text)
|
||||
ObjectGuid::LowType ChatHandler::extractLowGuidFromLink(char* text, HighGuid& guidHigh)
|
||||
{
|
||||
int type = 0;
|
||||
|
||||
@@ -1027,46 +1036,41 @@ ObjectGuid ChatHandler::extractGuidFromLink(char* text)
|
||||
// |color|Hplayer:name|h[name]|h|r
|
||||
char* idS = extractKeyFromLink(text, guidKeys, &type);
|
||||
if (!idS)
|
||||
return ObjectGuid::Empty;
|
||||
return 0;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SPELL_LINK_PLAYER:
|
||||
case GUID_LINK_PLAYER:
|
||||
{
|
||||
guidHigh = HighGuid::Player;
|
||||
std::string name = idS;
|
||||
if (!normalizePlayerName(name))
|
||||
return ObjectGuid::Empty;
|
||||
return 0;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerByName(name))
|
||||
return player->GetGUID();
|
||||
return player->GetGUID().GetCounter();
|
||||
|
||||
if (ObjectGuid guid = sWorld->GetCharacterGuidByName(name))
|
||||
return guid;
|
||||
return guid.GetCounter();
|
||||
|
||||
return ObjectGuid::Empty;
|
||||
return 0;
|
||||
}
|
||||
case SPELL_LINK_CREATURE:
|
||||
case GUID_LINK_CREATURE:
|
||||
{
|
||||
guidHigh = HighGuid::Unit;
|
||||
ObjectGuid::LowType lowguid = atoul(idS);
|
||||
|
||||
if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
|
||||
return ObjectGuid(HighGuid::Unit, data->id, lowguid);
|
||||
else
|
||||
return ObjectGuid::Empty;
|
||||
return lowguid;
|
||||
}
|
||||
case SPELL_LINK_GAMEOBJECT:
|
||||
case GUID_LINK_GAMEOBJECT:
|
||||
{
|
||||
guidHigh = HighGuid::GameObject;
|
||||
ObjectGuid::LowType lowguid = atoul(idS);
|
||||
|
||||
if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
|
||||
return ObjectGuid(HighGuid::GameObject, data->id, lowguid);
|
||||
else
|
||||
return ObjectGuid::Empty;
|
||||
return lowguid;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown type?
|
||||
return ObjectGuid::Empty;
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string ChatHandler::extractPlayerNameFromLink(char* text)
|
||||
|
||||
@@ -131,7 +131,7 @@ class TC_GAME_API ChatHandler
|
||||
char* extractQuotedArg(char* args);
|
||||
|
||||
uint32 extractSpellIdFromLink(char* text);
|
||||
ObjectGuid extractGuidFromLink(char* text);
|
||||
ObjectGuid::LowType extractLowGuidFromLink(char* text, HighGuid& guidHigh);
|
||||
GameTele const* extractGameTeleFromLink(char* text);
|
||||
bool GetPlayerGroupAndGUIDByName(char const* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline = false);
|
||||
std::string extractPlayerNameFromLink(char* text);
|
||||
@@ -142,7 +142,8 @@ class TC_GAME_API ChatHandler
|
||||
std::string GetNameLink(Player* chr) const;
|
||||
|
||||
GameObject* GetNearbyGameObject();
|
||||
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(ObjectGuid::LowType lowguid, uint32 entry);
|
||||
GameObject* GetObjectFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid);
|
||||
Creature* GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid);
|
||||
bool HasSentErrorMessage() const { return sentErrorMessage; }
|
||||
void SetSentErrorMessage(bool val){ sentErrorMessage = val; }
|
||||
|
||||
|
||||
@@ -114,7 +114,10 @@ enum TrinityStrings
|
||||
LANG_PVPSTATS_DISABLED = 81,
|
||||
LANG_COMMAND_NEARGRAVEYARD = 82,
|
||||
LANG_COMMAND_NEARGRAVEYARD_NOTFOUND = 83,
|
||||
// Free 84 - 95
|
||||
LANG_GOINFO_SIZE = 84,
|
||||
LANG_GOINFO_ADDON = 85,
|
||||
LANG_GOINFO_MODEL = 86,
|
||||
// Free 87 - 95
|
||||
|
||||
|
||||
LANG_GUILD_RENAME_ALREADY_EXISTS = 96,
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
if (!achievementId)
|
||||
{
|
||||
if (char* id = handler->extractKeyFromLink((char*)args, "Hachievement"))
|
||||
achievementId = atoi(id);
|
||||
achievementId = atoul(id);
|
||||
if (!achievementId)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
{ "activelist", rbac::RBAC_PERM_COMMAND_EVENT_ACTIVELIST, true, &HandleEventActiveListCommand, "" },
|
||||
{ "start", rbac::RBAC_PERM_COMMAND_EVENT_START, true, &HandleEventStartCommand, "" },
|
||||
{ "stop", rbac::RBAC_PERM_COMMAND_EVENT_STOP, true, &HandleEventStopCommand, "" },
|
||||
{ "", rbac::RBAC_PERM_COMMAND_EVENT, true, &HandleEventInfoCommand, "" },
|
||||
{ "info", rbac::RBAC_PERM_COMMAND_EVENT, true, &HandleEventInfoCommand, "" },
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
{
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
uint32 eventId = atoi(id);
|
||||
uint32 eventId = atoul(id);
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
int32 eventId = atoi(id);
|
||||
int32 eventId = atoul(id);
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
int32 eventId = atoi(id);
|
||||
int32 eventId = atoul(id);
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
{ "zonexy", rbac::RBAC_PERM_COMMAND_GO_ZONEXY, false, &HandleGoZoneXYCommand, "" },
|
||||
{ "xyz", rbac::RBAC_PERM_COMMAND_GO_XYZ, false, &HandleGoXYZCommand, "" },
|
||||
{ "ticket", rbac::RBAC_PERM_COMMAND_GO_TICKET, false, &HandleGoTicketCommand, "" },
|
||||
{ "", rbac::RBAC_PERM_COMMAND_GO, false, &HandleGoXYZCommand, "" },
|
||||
{ "offset", rbac::RBAC_PERM_COMMAND_GO_OFFSET, false, &HandleGoOffsetCommand,
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
int32 entry = atoi(id);
|
||||
uint32 entry = atoul(id);
|
||||
if (!entry)
|
||||
return false;
|
||||
|
||||
@@ -104,17 +104,17 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 guid = atoi(param1);
|
||||
ObjectGuid::LowType guidLow = atoul(param1);
|
||||
|
||||
// Number is invalid - maybe the user specified the mob's name
|
||||
if (!guid)
|
||||
if (!guidLow)
|
||||
{
|
||||
std::string name = param1;
|
||||
WorldDatabase.EscapeString(name);
|
||||
whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name " _LIKE_" '" << name << '\'';
|
||||
}
|
||||
else
|
||||
whereClause << "WHERE guid = '" << guid << '\'';
|
||||
whereClause << "WHERE guid = '" << guidLow << '\'';
|
||||
}
|
||||
|
||||
QueryResult result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z, orientation, map FROM creature %s", whereClause.str().c_str());
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
if (!gyId)
|
||||
return false;
|
||||
|
||||
int32 graveyardId = atoi(gyId);
|
||||
uint32 graveyardId = atoul(gyId);
|
||||
|
||||
if (!graveyardId)
|
||||
return false;
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
if (!gridX || !gridY)
|
||||
return false;
|
||||
|
||||
uint32 mapId = id ? (uint32)atoi(id) : player->GetMapId();
|
||||
uint32 mapId = id ? atoul(id) : player->GetMapId();
|
||||
|
||||
// center of grid
|
||||
float x = ((float)atof(gridX) - CENTER_GRID_ID + 0.5f) * SIZE_OF_GRIDS;
|
||||
@@ -264,15 +264,15 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
int32 guid = atoi(id);
|
||||
if (!guid)
|
||||
ObjectGuid::LowType guidLow = atoul(id);
|
||||
if (!guidLow)
|
||||
return false;
|
||||
|
||||
float x, y, z, o;
|
||||
uint32 mapId;
|
||||
|
||||
// by DB guid
|
||||
if (GameObjectData const* goData = sObjectMgr->GetGOData(guid))
|
||||
if (GameObjectData const* goData = sObjectMgr->GetGOData(guidLow))
|
||||
{
|
||||
x = goData->posX;
|
||||
y = goData->posY;
|
||||
@@ -319,7 +319,7 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
int32 nodeId = atoi(id);
|
||||
uint32 nodeId = atoul(id);
|
||||
if (!nodeId)
|
||||
return false;
|
||||
|
||||
@@ -364,7 +364,7 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
int32 areaTriggerId = atoi(id);
|
||||
uint32 areaTriggerId = atoul(id);
|
||||
|
||||
if (!areaTriggerId)
|
||||
return false;
|
||||
@@ -422,7 +422,7 @@ public:
|
||||
if ((x == 0.0f && *zoneX != '0') || (y == 0.0f && *zoneY != '0'))
|
||||
return false;
|
||||
|
||||
uint32 areaId = id ? (uint32)atoi(id) : player->GetZoneId();
|
||||
uint32 areaId = id ? atoul(id) : player->GetZoneId();
|
||||
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
|
||||
|
||||
@@ -492,7 +492,7 @@ public:
|
||||
float y = (float)atof(goY);
|
||||
float z;
|
||||
float ort = port ? (float)atof(port) : player->GetOrientation();
|
||||
uint32 mapId = id ? (uint32)atoi(id) : player->GetMapId();
|
||||
uint32 mapId = id ? atoul(id) : player->GetMapId();
|
||||
|
||||
if (goZ)
|
||||
{
|
||||
@@ -539,7 +539,7 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
uint32 ticketId = atoi(id);
|
||||
uint32 ticketId = atoul(id);
|
||||
if (!ticketId)
|
||||
return false;
|
||||
|
||||
@@ -564,6 +564,51 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static bool HandleGoOffsetCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
char* goX = strtok((char*)args, " ");
|
||||
char* goY = strtok(NULL, " ");
|
||||
char* goZ = strtok(NULL, " ");
|
||||
char* port = strtok(NULL, " ");
|
||||
|
||||
float x, y, z, o;
|
||||
player->GetPosition(x, y, z, o);
|
||||
if (goX)
|
||||
x += atof(goX);
|
||||
if (goY)
|
||||
y += atof(goY);
|
||||
if (goZ)
|
||||
z += atof(goZ);
|
||||
if (port)
|
||||
o += atof(port);
|
||||
|
||||
if (!Trinity::IsValidMapCoord(x, y, z, o))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, player->GetMapId());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// stop flight if need
|
||||
if (player->IsInFlight())
|
||||
{
|
||||
player->GetMotionMaster()->MovementExpired();
|
||||
player->CleanupAfterTaxiFlight();
|
||||
}
|
||||
// save only in non-flight case
|
||||
else
|
||||
player->SaveRecallPosition();
|
||||
|
||||
player->TeleportTo(player->GetMapId(), x, y, z, o);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_go_commandscript()
|
||||
{
|
||||
new go_commandscript();
|
||||
|
||||
@@ -77,16 +77,11 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType guidLow = atoi(id);
|
||||
ObjectGuid::LowType guidLow = atoul(id);
|
||||
if (!guidLow)
|
||||
return false;
|
||||
|
||||
GameObject* object = NULL;
|
||||
|
||||
// by DB guid
|
||||
if (GameObjectData const* goData = sObjectMgr->GetGOData(guidLow))
|
||||
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, goData->id);
|
||||
|
||||
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
|
||||
@@ -154,7 +149,7 @@ public:
|
||||
|
||||
if (spawntimeSecs)
|
||||
{
|
||||
uint32 value = atoi((char*)spawntimeSecs);
|
||||
int32 value = atoi((char*)spawntimeSecs);
|
||||
object->SetRespawnTime(value);
|
||||
}
|
||||
|
||||
@@ -197,10 +192,10 @@ public:
|
||||
uint32 spawntm = 300;
|
||||
|
||||
if (spawntime)
|
||||
spawntm = atoi((char*)spawntime);
|
||||
spawntm = atoul(spawntime);
|
||||
|
||||
G3D::Quat rotation = G3D::Matrix3::fromEulerAnglesZYX(player->GetOrientation(), 0.f, 0.f);
|
||||
uint32 objectId = atoi(id);
|
||||
uint32 objectId = atoul(id);
|
||||
|
||||
if (!sObjectMgr->GetGameObjectTemplate(objectId))
|
||||
{
|
||||
@@ -314,7 +309,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HighGuid::GameObject, id, guidLow));
|
||||
GameObject* target = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->name.c_str(), guidLow, id, x, y, z, mapId, o, phase);
|
||||
|
||||
@@ -340,16 +335,11 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType guidLow = atoi(id);
|
||||
ObjectGuid::LowType guidLow = atoul(id);
|
||||
if (!guidLow)
|
||||
return false;
|
||||
|
||||
GameObject* object = NULL;
|
||||
|
||||
// by DB guid
|
||||
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
|
||||
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
|
||||
|
||||
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
|
||||
@@ -363,7 +353,7 @@ public:
|
||||
Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid);
|
||||
if (!owner || !ownerGuid.IsPlayer())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), object->GetGUID().GetCounter());
|
||||
handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), guidLow);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -375,7 +365,7 @@ public:
|
||||
object->Delete();
|
||||
object->DeleteFromDB();
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, object->GetGUID().GetCounter());
|
||||
handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, object->GetSpawnId());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -388,16 +378,11 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType guidLow = atoi(id);
|
||||
ObjectGuid::LowType guidLow = atoul(id);
|
||||
if (!guidLow)
|
||||
return false;
|
||||
|
||||
GameObject* object = NULL;
|
||||
|
||||
// by DB guid
|
||||
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
|
||||
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
|
||||
|
||||
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
|
||||
@@ -444,16 +429,11 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType guidLow = atoi(id);
|
||||
ObjectGuid::LowType guidLow = atoul(id);
|
||||
if (!guidLow)
|
||||
return false;
|
||||
|
||||
GameObject* object = NULL;
|
||||
|
||||
// by DB guid
|
||||
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
|
||||
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
|
||||
|
||||
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
|
||||
@@ -504,16 +484,11 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType guidLow = atoi(id);
|
||||
ObjectGuid::LowType guidLow = atoul(id);
|
||||
if (!guidLow)
|
||||
return false;
|
||||
|
||||
GameObject* object = NULL;
|
||||
|
||||
// by DB guid
|
||||
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
|
||||
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
|
||||
|
||||
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
|
||||
@@ -590,13 +565,28 @@ public:
|
||||
uint32 lootId = 0;
|
||||
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* param1 = handler->extractKeyFromLink((char*)args, "Hgameobject_entry");
|
||||
if (!param1)
|
||||
return false;
|
||||
|
||||
if (strcmp(param1, "guid") == 0)
|
||||
{
|
||||
if (WorldObject* object = handler->getSelectedObject())
|
||||
entry = object->GetEntry();
|
||||
else
|
||||
entry = atoi((char*)args);
|
||||
} else
|
||||
entry = atoi((char*)args);
|
||||
char* tail = strtok(nullptr, "");
|
||||
char* cValue = handler->extractKeyFromLink(tail, "Hgameobject");
|
||||
if (!cValue)
|
||||
return false;
|
||||
ObjectGuid::LowType guidLow = atoul(cValue);
|
||||
const GameObjectData* data = sObjectMgr->GetGOData(guidLow);
|
||||
if (!data)
|
||||
return false;
|
||||
entry = data->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = atoul(param1);
|
||||
}
|
||||
|
||||
GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry);
|
||||
|
||||
@@ -616,7 +606,14 @@ public:
|
||||
handler->PSendSysMessage(LANG_GOINFO_LOOTID, lootId);
|
||||
handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayId);
|
||||
handler->PSendSysMessage(LANG_GOINFO_NAME, name.c_str());
|
||||
handler->PSendSysMessage(LANG_GOINFO_SIZE, gameObjectInfo->size);
|
||||
|
||||
if (GameObjectTemplateAddon const* addon = sObjectMgr->GetGameObjectTemplateAddon(entry))
|
||||
handler->PSendSysMessage(LANG_GOINFO_ADDON, addon->faction, addon->flags);
|
||||
|
||||
if (GameObjectDisplayInfoEntry const* modelInfo = sGameObjectDisplayInfoStore.LookupEntry(displayId))
|
||||
handler->PSendSysMessage(LANG_GOINFO_MODEL, modelInfo->maxX, modelInfo->maxY, modelInfo->maxZ, modelInfo->minX, modelInfo->minY, modelInfo->minZ);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -627,15 +624,11 @@ public:
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType guidLow = atoi(id);
|
||||
ObjectGuid::LowType guidLow = atoul(id);
|
||||
if (!guidLow)
|
||||
return false;
|
||||
|
||||
GameObject* object = NULL;
|
||||
|
||||
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
|
||||
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
|
||||
|
||||
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
|
||||
|
||||
@@ -164,24 +164,54 @@ public:
|
||||
|
||||
static bool HandleGPSCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
WorldObject* object = NULL;
|
||||
WorldObject* object = nullptr;
|
||||
if (*args)
|
||||
{
|
||||
ObjectGuid guid = handler->extractGuidFromLink((char*)args);
|
||||
if (guid)
|
||||
object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
|
||||
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
HighGuid guidHigh;
|
||||
ObjectGuid::LowType guidLow = handler->extractLowGuidFromLink((char*)args, guidHigh);
|
||||
if (!guidLow)
|
||||
return false;
|
||||
switch (guidHigh)
|
||||
{
|
||||
case HighGuid::Player:
|
||||
{
|
||||
object = sObjectMgr->GetPlayerByLowGUID(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HighGuid::Unit:
|
||||
{
|
||||
object = handler->GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_NOCREATUREFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HighGuid::GameObject:
|
||||
{
|
||||
object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (!object)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
object = handler->getSelectedUnit();
|
||||
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
@@ -763,26 +793,55 @@ public:
|
||||
|
||||
static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
WorldObject* obj = NULL;
|
||||
|
||||
WorldObject* object = nullptr;
|
||||
if (*args)
|
||||
{
|
||||
ObjectGuid guid = handler->extractGuidFromLink((char*)args);
|
||||
if (guid)
|
||||
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
||||
|
||||
if (!obj)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
HighGuid guidHigh;
|
||||
ObjectGuid::LowType guidLow = handler->extractLowGuidFromLink((char*)args, guidHigh);
|
||||
if (!guidLow)
|
||||
return false;
|
||||
switch (guidHigh)
|
||||
{
|
||||
case HighGuid::Player:
|
||||
{
|
||||
object = sObjectMgr->GetPlayerByLowGUID(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HighGuid::Unit:
|
||||
{
|
||||
object = handler->GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_NOCREATUREFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HighGuid::GameObject:
|
||||
{
|
||||
object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (!object)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = handler->getSelectedUnit();
|
||||
|
||||
if (!obj)
|
||||
object = handler->getSelectedUnit();
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
@@ -790,7 +849,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj));
|
||||
handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(object), handler->GetSession()->GetPlayer()->GetDistance2d(object), handler->GetSession()->GetPlayer()->GetExactDist(object), handler->GetSession()->GetPlayer()->GetExactDist2d(object));
|
||||
return true;
|
||||
}
|
||||
// Teleport player to last position
|
||||
@@ -2178,8 +2237,8 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 guid = atoi(guidStr);
|
||||
if (!guid)
|
||||
ObjectGuid::LowType guidLow = atoul(guidStr);
|
||||
if (!guidLow)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
@@ -2204,14 +2263,10 @@ public:
|
||||
|
||||
if (Player* player = handler->GetSession()->GetPlayer())
|
||||
{
|
||||
GameObject* go = NULL;
|
||||
|
||||
if (GameObjectData const* goData = sObjectMgr->GetGOData(guid))
|
||||
go = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guid, goData->id);
|
||||
|
||||
GameObject* go = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!go)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guid);
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -2224,7 +2279,7 @@ public:
|
||||
}
|
||||
|
||||
go->ModifyHealth(-damage, player);
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_DAMAGED, go->GetName().c_str(), guid, -damage, go->GetGOValue()->Building.Health);
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_DAMAGED, go->GetName().c_str(), guidLow, -damage, go->GetGOValue()->Building.Health);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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