68 {
"go", goCommandTable },
112 for (
auto const& pair :
sObjectMgr->GetAllCreatureData())
114 if (pair.second.id != *cId)
118 spawnpoint = &pair.second;
152 for (
auto const& pair :
sObjectMgr->GetAllGameObjectData())
154 if (pair.second.id != goId)
158 spawnpoint = &pair.second;
227 Map const* map =
sMapMgr->CreateBaseMap(mapId);
267 if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry)
330 Map const* map =
sMapMgr->CreateBaseMap(mapId);
334 return DoTeleport(handler, { x, y, *z, o.value_or(0.0f) }, mapId);
361 loc.
RelocateOffset({ dX, dY.value_or(0.0f), dZ.value_or(0.0f), dO.value_or(0.0f) });
372 std::multimap<uint32, std::tuple<uint16, char const*, char const*>> matches;
373 for (
auto const& pair :
sObjectMgr->GetInstanceTemplates())
376 std::string
const& scriptName =
sObjectMgr->GetScriptName(pair.second.ScriptId);
378 for (std::string_view label : labels)
383 matches.emplace(count,
decltype(matches)::mapped_type(pair.first, mapName, scriptName.c_str()));
392 auto it = matches.crbegin(), end = matches.crend();
393 uint32 const maxCount = it->first;
394 if ((++it) != end && it->first == maxCount)
400 while (((++it) != end) && (it->first == maxCount));
405 it = matches.crbegin();
406 uint32 const mapId = std::get<0>(it->second);
407 char const*
const mapName = std::get<1>(it->second);
418 if (player->
TeleportTo(exit->target_mapId, exit->target_X, exit->target_Y, exit->target_Z, exit->target_Orientation +
M_PI))
425 uint32 const parentMapId = exit->target_mapId;
436 if (player->
TeleportTo(entrance->target_mapId, entrance->target_X, entrance->target_Y, entrance->target_Z, entrance->target_Orientation))
456 std::multimap<uint32, CreatureTemplate const*> matches;
457 std::unordered_map<uint32, std::vector<CreatureData const*>> spawnLookup;
460 for (
auto const& pair :
sObjectMgr->GetCreatureTemplates())
468 for (std::string_view label : needles)
474 matches.emplace(count, &data);
475 (void)spawnLookup[data.
Entry];
479 if (!matches.empty())
482 for (
auto const& pair :
sObjectMgr->GetAllCreatureData())
485 auto it = spawnLookup.find(data.
id);
486 if (it != spawnLookup.end())
487 it->second.push_back(&data);
491 Trinity::Containers::EraseIf(matches, [&spawnLookup](
decltype(matches)::value_type
const& pair) {
return spawnLookup[pair.second->Entry].empty(); });
503 auto it = matches.crbegin(), end = matches.crend();
504 uint32 const maxCount = it->first;
505 if ((++it) != end && it->first == maxCount)
511 while (((++it) != end) && (it->first == maxCount));
517 std::vector<CreatureData const*>
const& spawns = spawnLookup[boss->
Entry];
520 if (spawns.size() > 1)
525 uint32 const mapId = spawn->mapId;
541 if (!player->
TeleportTo({ mapId, spawn->spawnPoint }))
@ CREATURE_FLAG_EXTRA_DUNGEON_BOSS
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsEntryfmt)
void Zone2MapCoordinates(float &x, float &y, uint32 zone)
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerEntryfmt)
DBCStorage< TaxiNodesEntry > sTaxiNodesStore(TaxiNodesEntryfmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
#define ASSERT_NOTNULL(pointer)
@ LANG_COMMAND_INSTANCE_NO_ENTRANCE
@ LANG_COMMAND_GO_INSTANCE_START_FAILED
@ LANG_COMMAND_NO_BOSSES_MATCH
@ LANG_COMMAND_GO_BOSS_FAILED
@ LANG_COMMAND_GOCREATNOTFOUND
@ LANG_COMMAND_BOSS_MULTIPLE_SPAWNS
@ LANG_COMMAND_GRAVEYARDNOEXIST
@ LANG_COMMAND_NO_INSTANCES_MATCH
@ LANG_COMMAND_GOAREATRNOTFOUND
@ LANG_COMMAND_WENT_TO_INSTANCE_GATE
@ LANG_COMMAND_MULTIPLE_INSTANCES_ENTRY
@ LANG_COMMAND_GOTAXINODENOTFOUND
@ LANG_COMMAND_MULTIPLE_INSTANCES_MATCH
@ LANG_COMMAND_GOOBJNOTFOUND
@ LANG_COMMAND_WENT_TO_INSTANCE_START
@ LANG_INVALID_TARGET_COORD
@ LANG_COMMAND_INSTANCE_NO_EXIT
@ LANG_COMMAND_MULTIPLE_BOSSES_MATCH
@ LANG_COMMAND_GOCREATMULTIPLE
@ LANG_COMMAND_BOSS_MULTIPLE_SPAWN_ETY
@ LANG_COMMAND_TICKETNOTEXIST
@ LANG_COMMAND_WENT_TO_BOSS
@ LANG_INVALID_ZONE_COORD
@ LANG_COMMAND_GO_INSTANCE_GATE_FAILED
@ LANG_COMMAND_MULTIPLE_BOSSES_ENTRY
std::optional< T > Optional
Optional helper class to wrap optional values within.
Role Based Access Control related classes definition.
bool StringContainsStringI(std::string_view haystack, std::string_view needle)
WorldSession * GetSession()
virtual LocaleConstant GetSessionDbcLocale() const
void SetSentErrorMessage(bool val)
void PSendSysMessage(char const *fmt, Args &&... args)
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
void TeleportTo(Player *player) const
static bool IsValidMapCoord(uint32 mapid, float x, float y)
float GetWaterLevel(float x, float y) const
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
bool Instanceable() const
char const * GetMapName() const
void SaveRecallPosition()
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Player * GetPlayer() const
static bool HandleGoAreaTriggerCommand(ChatHandler *handler, Variant< Hyperlink< areatrigger >, uint32 > areaTriggerId)
static bool HandleGoGameObjectGOIdCommand(ChatHandler *handler, uint32 goId)
static bool HandleGoGraveyardCommand(ChatHandler *handler, uint32 gyId)
static bool HandleGoInstanceCommand(ChatHandler *handler, std::vector< std::string_view > labels)
ChatCommandTable GetCommands() const override
static bool HandleGoOffsetCommand(ChatHandler *handler, float dX, Optional< float > dY, Optional< float > dZ, Optional< float > dO)
static bool HandleGoTaxinodeCommand(ChatHandler *handler, Variant< Hyperlink< taxinode >, uint32 > nodeId)
static bool DoTeleport(ChatHandler *handler, Position pos, uint32 mapId=MAPID_INVALID)
static bool HandleGoBossCommand(ChatHandler *handler, std::vector< std::string_view > needles)
static bool HandleGoGridCommand(ChatHandler *handler, float gridX, float gridY, Optional< uint32 > oMapId)
static bool HandleGoTicketCommand(ChatHandler *handler, uint32 ticketId)
static bool HandleGoCreatureSpawnIdCommand(ChatHandler *handler, Variant< Hyperlink< creature >, ObjectGuid::LowType > spawnId)
static bool HandleGoZoneXYCommand(ChatHandler *handler, float x, float y, Optional< Variant< Hyperlink< area >, uint32 > > areaIdArg)
static bool HandleGoGameObjectSpawnIdCommand(ChatHandler *handler, uint32 spawnId)
static bool HandleGoXYZCommand(ChatHandler *handler, float x, float y, Optional< float > z, Optional< uint32 > id, Optional< float > o)
static bool HandleGoCreatureCIdCommand(ChatHandler *handler, Variant< Hyperlink< creature_entry >, uint32 > cId)
void AddSC_go_commandscript()
std::vector< ChatCommandBuilder > ChatCommandTable
void EraseIf(Container &c, Predicate p)
char const * AreaName[16]
float GetOrientation() const
float GetPositionX() const
void GetPosition(float &x, float &y) const
float GetPositionY() const
void RelocateOffset(Position const &offset)