[7796] Implement .lookup taxinode and .go taxinode commands. Author: VladimirMangos
--HG-- branch : trunk
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
// |color|Hskill:skill_id|h[name]|h|r
|
||||
// |color|Hspell:spell_id|h[name]|h|r - client, spellbook spell icon shift-click
|
||||
// |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click
|
||||
// |color|Htaxinode:id|h[name]|h|r
|
||||
// |color|Htele:id|h[name]|h|r
|
||||
// |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click
|
||||
|
||||
@@ -194,6 +195,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "graveyard", SEC_MODERATOR, false, &ChatHandler::HandleGoGraveyardCommand, "", NULL },
|
||||
{ "grid", SEC_MODERATOR, false, &ChatHandler::HandleGoGridCommand, "", NULL },
|
||||
{ "object", SEC_MODERATOR, false, &ChatHandler::HandleGoObjectCommand, "", NULL },
|
||||
{ "taxinode", SEC_MODERATOR, false, &ChatHandler::HandleGoTaxinodeCommand, "", NULL },
|
||||
{ "trigger", SEC_MODERATOR, false, &ChatHandler::HandleGoTriggerCommand, "", NULL },
|
||||
{ "zonexy", SEC_MODERATOR, false, &ChatHandler::HandleGoZoneXYCommand, "", NULL },
|
||||
{ "xy", SEC_MODERATOR, false, &ChatHandler::HandleGoXYCommand, "", NULL },
|
||||
@@ -301,6 +303,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable },
|
||||
{ "skill", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSkillCommand, "", NULL },
|
||||
{ "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL },
|
||||
{ "taxinode", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupTaxiNodeCommand, "", NULL },
|
||||
{ "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
@@ -195,6 +195,7 @@ class ChatHandler
|
||||
bool HandleGoGraveyardCommand(const char* args);
|
||||
bool HandleGoGridCommand(const char* args);
|
||||
bool HandleGoObjectCommand(const char* args);
|
||||
bool HandleGoTaxinodeCommand(const char* args);
|
||||
bool HandleGoTriggerCommand(const char* args);
|
||||
bool HandleGoXYCommand(const char* args);
|
||||
bool HandleGoXYZCommand(const char* args);
|
||||
@@ -247,6 +248,7 @@ class ChatHandler
|
||||
bool HandleLookupQuestCommand(const char* args);
|
||||
bool HandleLookupSkillCommand(const char* args);
|
||||
bool HandleLookupSpellCommand(const char* args);
|
||||
bool HandleLookupTaxiNodeCommand(const char * args);
|
||||
bool HandleLookupTeleCommand(const char * args);
|
||||
|
||||
bool HandleModifyKnownTitlesCommand(const char* args);
|
||||
|
||||
@@ -1517,7 +1517,7 @@ struct TaxiNodesEntry
|
||||
float x; // 2 m_x
|
||||
float y; // 3 m_y
|
||||
float z; // 4 m_z
|
||||
//char* name[16]; // 5-21 m_Name_lang
|
||||
char* name[16]; // 5-21 m_Name_lang
|
||||
// 22 string flags
|
||||
uint32 MountCreatureID[2]; // 23-24 m_MountCreatureID[2]
|
||||
};
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ const char StableSlotPricesfmt[] = "ni";
|
||||
const char SummonPropertiesfmt[] = "niiiii";
|
||||
const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";
|
||||
const char TalentTabEntryfmt[]="nxxxxxxxxxxxxxxxxxxxiiix";
|
||||
const char TaxiNodesEntryfmt[]="nifffxxxxxxxxxxxxxxxxxii";
|
||||
const char TaxiNodesEntryfmt[]="nifffssssssssssssssssxii";
|
||||
const char TaxiPathEntryfmt[]="niii";
|
||||
const char TaxiPathNodeEntryfmt[]="diiifffiixx";
|
||||
const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
|
||||
|
||||
+6
-4
@@ -328,7 +328,8 @@ enum TrinityStrings
|
||||
LANG_YOU_ALREADY_HAVE_PET = 344,
|
||||
LANG_CUSTOMIZE_PLAYER = 345,
|
||||
LANG_CUSTOMIZE_PLAYER_GUID = 346,
|
||||
// Room for more level 2 345-399 not used
|
||||
LANG_COMMAND_GOTAXINODENOTFOUND = 347,
|
||||
// Room for more level 2 348-399 not used
|
||||
|
||||
// level 3 chat
|
||||
LANG_SCRIPTS_RELOADED = 400,
|
||||
@@ -403,8 +404,7 @@ enum TrinityStrings
|
||||
LANG_COMMAND_TP_ADDED = 463,
|
||||
LANG_COMMAND_TP_ADDEDERR = 464,
|
||||
LANG_COMMAND_TP_DELETED = 465,
|
||||
// 466, // not used
|
||||
|
||||
LANG_COMMAND_NOTAXINODEFOUND = 466,
|
||||
LANG_COMMAND_TARGET_LISTAURAS = 467,
|
||||
LANG_COMMAND_TARGET_AURADETAIL = 468,
|
||||
LANG_COMMAND_TARGET_LISTAURATYPE = 469,
|
||||
@@ -765,7 +765,9 @@ enum TrinityStrings
|
||||
LANG_COMMAND_LEARN_PET_TALENTS = 1125,
|
||||
LANG_RESET_PET_TALENTS = 1126,
|
||||
LANG_RESET_PET_TALENTS_ONLINE = 1127,
|
||||
// Room for more level 3 1128-1199 not used
|
||||
LANG_TAXINODE_ENTRY_LIST_CHAT = 1128,
|
||||
LANG_TAXINODE_ENTRY_LIST_CONSOLE = 1129,
|
||||
// Room for more level 3 1130-1199 not used
|
||||
|
||||
// Debug commands
|
||||
LANG_CINEMATIC_NOT_EXIST = 1200,
|
||||
|
||||
@@ -2753,6 +2753,51 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleGoTaxinodeCommand(const char* args)
|
||||
{
|
||||
Player* _player = m_session->GetPlayer();
|
||||
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* cNodeId = extractKeyFromLink((char*)args,"Htaxinode");
|
||||
if (!cNodeId)
|
||||
return false;
|
||||
|
||||
int32 i_nodeId = atoi(cNodeId);
|
||||
if (!i_nodeId)
|
||||
return false;
|
||||
|
||||
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i_nodeId);
|
||||
if (!node)
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND,i_nodeId);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (node->x == 0.0f && node->y == 0.0f && node->z == 0.0f ||
|
||||
!MapManager::IsValidMapCoord(node->map_id,node->x,node->y,node->z))
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TARGET_COORD,node->x,node->y,node->map_id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// stop flight if need
|
||||
if (_player->isInFlight())
|
||||
{
|
||||
_player->GetMotionMaster()->MovementExpired();
|
||||
_player->m_taxi.ClearTaxiDestinations();
|
||||
}
|
||||
// save only in non-flight case
|
||||
else
|
||||
_player->SaveRecallPosition();
|
||||
|
||||
_player->TeleportTo(node->map_id, node->x, node->y, node->z, _player->GetOrientation());
|
||||
return true;
|
||||
}
|
||||
|
||||
//teleport at coordinates
|
||||
bool ChatHandler::HandleGoXYCommand(const char* args)
|
||||
{
|
||||
|
||||
@@ -3694,6 +3694,68 @@ bool ChatHandler::HandleLookupObjectCommand(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
std::string namepart = args;
|
||||
std::wstring wnamepart;
|
||||
|
||||
if(!Utf8toWStr(namepart,wnamepart))
|
||||
return false;
|
||||
|
||||
// converting string that we try to find to lower case
|
||||
wstrToLower( wnamepart );
|
||||
|
||||
uint32 counter = 0; // Counter for figure out that we found smth.
|
||||
|
||||
// Search in TaxiNodes.dbc
|
||||
for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
|
||||
{
|
||||
TaxiNodesEntry const *nodeEntry = sTaxiNodesStore.LookupEntry(id);
|
||||
if(nodeEntry)
|
||||
{
|
||||
int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
|
||||
std::string name = nodeEntry->name[loc];
|
||||
if(name.empty())
|
||||
continue;
|
||||
|
||||
if (!Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
loc = 0;
|
||||
for(; loc < MAX_LOCALE; ++loc)
|
||||
{
|
||||
if(m_session && loc==m_session->GetSessionDbcLocale())
|
||||
continue;
|
||||
|
||||
name = nodeEntry->name[loc];
|
||||
if(name.empty())
|
||||
continue;
|
||||
|
||||
if (Utf8FitTo(name, wnamepart))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(loc < MAX_LOCALE)
|
||||
{
|
||||
// send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
|
||||
if (m_session)
|
||||
PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(),localeNames[loc],
|
||||
nodeEntry->map_id,nodeEntry->x,nodeEntry->y,nodeEntry->z);
|
||||
else
|
||||
PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc],
|
||||
nodeEntry->map_id,nodeEntry->x,nodeEntry->y,nodeEntry->z);
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief GM command level 3 - Create a guild.
|
||||
*
|
||||
* This command allows a GM (level 3) to create a guild.
|
||||
|
||||
@@ -6534,4 +6534,4 @@ void Spell::EffectRenamePet(uint32 /*eff_idx*/)
|
||||
return;
|
||||
|
||||
unitTarget->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user