Fix .go creature command (#115)
Allow you to teleport to a moving npc which has waypoinst defined. It will require two teleports if your are teleporting from a different map compared to the npc WARNING : THIS CORE UPDATE NEEDS DB UPDATE 21_22_20_Fix_go_creature_command
This commit is contained in:
parent
a78c1b6e0b
commit
efcac00443
@ -1047,6 +1047,7 @@ bool ChatHandler::HandleGoCreatureCommand(char* args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player* _player = m_session->GetPlayer();
|
Player* _player = m_session->GetPlayer();
|
||||||
|
ObjectGuid targetMobGuid;
|
||||||
|
|
||||||
// "id" or number or [name] Shift-click form |color|Hcreature:creature_id|h[name]|h|r
|
// "id" or number or [name] Shift-click form |color|Hcreature:creature_id|h[name]|h|r
|
||||||
int crType;
|
int crType;
|
||||||
@ -1106,6 +1107,7 @@ bool ChatHandler::HandleGoCreatureCommand(char* args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = &dataPair->second;
|
data = &dataPair->second;
|
||||||
|
targetMobGuid = data->GetObjectGuid(dataPair->first);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CREATURE_LINK_GUID:
|
case CREATURE_LINK_GUID:
|
||||||
@ -1117,12 +1119,15 @@ bool ChatHandler::HandleGoCreatureCommand(char* args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = sObjectMgr.GetCreatureData(lowguid);
|
data = sObjectMgr.GetCreatureData(lowguid);
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
|
SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
targetMobGuid = data->GetObjectGuid(lowguid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CREATURE_LINK_RAW:
|
case CREATURE_LINK_RAW:
|
||||||
@ -1131,12 +1136,15 @@ bool ChatHandler::HandleGoCreatureCommand(char* args)
|
|||||||
if (ExtractUInt32(&pParam1, lowguid))
|
if (ExtractUInt32(&pParam1, lowguid))
|
||||||
{
|
{
|
||||||
data = sObjectMgr.GetCreatureData(lowguid);
|
data = sObjectMgr.GetCreatureData(lowguid);
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
|
SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
targetMobGuid = data->GetObjectGuid(lowguid);
|
||||||
}
|
}
|
||||||
// Number is invalid - maybe the user specified the mob's name
|
// Number is invalid - maybe the user specified the mob's name
|
||||||
else
|
else
|
||||||
@ -1179,12 +1187,28 @@ bool ChatHandler::HandleGoCreatureCommand(char* args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = &dataPair->second;
|
data = &dataPair->second;
|
||||||
|
targetMobGuid = data->GetObjectGuid(dataPair->first);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HandleGoHelper(_player, data->mapid, data->posX, data->posY, data->posZ);
|
// If we are on the same map then we can teleport to the creature
|
||||||
|
Creature* targetMob = _player->GetMap()->GetAnyTypeCreature(targetMobGuid);
|
||||||
|
if (targetMob)
|
||||||
|
{
|
||||||
|
HandleGoHelper(_player, targetMob->GetMapId(), targetMob->GetPositionX(), targetMob->GetPositionY(), targetMob->GetPositionZ(), _player->GetOrientation());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Go to creature initial pos to be on teh right Map
|
||||||
|
HandleGoHelper(_player, data->mapid, data->posX, data->posY, data->posZ);
|
||||||
|
|
||||||
|
// Inform player that he will need to make the command another time to go directly to the NPC
|
||||||
|
PSendSysMessage(LANG_COMMAND_EXECUTE_GOCRE_ANOTHER_TIME, targetMobGuid.GetCounter());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// teleport to gameobject
|
// teleport to gameobject
|
||||||
|
@ -868,6 +868,7 @@ Faction Template: %u. */
|
|||||||
LANG_COMMAND_AURAGROUP_CANNOT_UNAURA_DEAD_PLAYER = 1703, /* Cannot remove aura(s) from %s because the player is dead. */
|
LANG_COMMAND_AURAGROUP_CANNOT_UNAURA_DEAD_PLAYER = 1703, /* Cannot remove aura(s) from %s because the player is dead. */
|
||||||
LANG_COMMAND_AURAGROUP_ALL_AURA_REMOVED = 1704, /* All auras have been removed from %s. */
|
LANG_COMMAND_AURAGROUP_ALL_AURA_REMOVED = 1704, /* All auras have been removed from %s. */
|
||||||
LANG_COMMAND_AURAGROUP_AURA_REMOVED_FOR_SPELL = 1705, /* Aura from spell %u has been removedfrom %s */
|
LANG_COMMAND_AURAGROUP_AURA_REMOVED_FOR_SPELL = 1705, /* Aura from spell %u has been removedfrom %s */
|
||||||
|
LANG_COMMAND_EXECUTE_GOCRE_ANOTHER_TIME = 1706, /* You will have to execute your command another time to get to the real moving npc position (.go creature %u) */
|
||||||
|
|
||||||
// FREE IDS 1701-9999
|
// FREE IDS 1701-9999
|
||||||
// Use for not-in-official-sources patches
|
// Use for not-in-official-sources patches
|
||||||
|
Loading…
x
Reference in New Issue
Block a user