mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Core/Misc: Reduce differences between branches
This commit is contained in:
@@ -29,6 +29,7 @@ EndScriptData */
|
||||
#include "Language.h"
|
||||
#include "Map.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.h"
|
||||
#include "WaypointDefines.h"
|
||||
@@ -245,43 +246,45 @@ public:
|
||||
|
||||
static bool HandleWpUnLoadCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
|
||||
Creature* target = handler->getSelectedCreature();
|
||||
WorldDatabasePreparedStatement* stmt = nullptr;
|
||||
|
||||
if (!target)
|
||||
{
|
||||
handler->PSendSysMessage("%s%s|r", "|cff33ffff", "You must select target.");
|
||||
handler->PSendSysMessage("%s%s|r", "|cff33ffff", "You must select a target.");
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 guildLow = target->GetSpawnId();
|
||||
|
||||
if (target->GetCreatureAddon())
|
||||
ObjectGuid::LowType guidLow = target->GetSpawnId();
|
||||
if (!guidLow)
|
||||
{
|
||||
if (target->GetCreatureAddon()->path_id != 0)
|
||||
{
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
|
||||
stmt->setUInt32(0, guildLow);
|
||||
WorldDatabase.Execute(stmt);
|
||||
|
||||
target->UpdateCurrentWaypointInfo(0, 0);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE);
|
||||
stmt->setUInt8(0, uint8(IDLE_MOTION_TYPE));
|
||||
stmt->setUInt32(1, guildLow);
|
||||
WorldDatabase.Execute(stmt);
|
||||
|
||||
target->LoadPath(0);
|
||||
target->SetDefaultMovementType(IDLE_MOTION_TYPE);
|
||||
target->GetMotionMaster()->MoveTargetedHome();
|
||||
target->GetMotionMaster()->Initialize();
|
||||
target->Say("Path unloaded.", LANG_UNIVERSAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
handler->PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path.");
|
||||
handler->PSendSysMessage("%s%s|r", "|cffff33ff", "Target is not saved to DB.");
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAddon const* addon = sObjectMgr->GetCreatureAddon(guidLow);
|
||||
if (!addon || addon->path_id == 0)
|
||||
{
|
||||
handler->PSendSysMessage("%s%s|r", "|cffff33ff", "Target does not have a loaded path.");
|
||||
return true;
|
||||
}
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
|
||||
stmt->setUInt32(0, guidLow);
|
||||
WorldDatabase.Execute(stmt);
|
||||
|
||||
target->UpdateCurrentWaypointInfo(0, 0);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE);
|
||||
stmt->setUInt8(0, uint8(IDLE_MOTION_TYPE));
|
||||
stmt->setUInt32(1, guidLow);
|
||||
WorldDatabase.Execute(stmt);
|
||||
|
||||
target->LoadPath(0);
|
||||
target->SetDefaultMovementType(IDLE_MOTION_TYPE);
|
||||
target->GetMotionMaster()->MoveTargetedHome();
|
||||
target->GetMotionMaster()->Initialize();
|
||||
target->Say("Path unloaded.", LANG_UNIVERSAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user