[7796] Implement .lookup taxinode and .go taxinode commands.

This commit is contained in:
VladimirMangos 2009-05-07 19:25:17 +04:00
parent 3279b77b09
commit a587590ab5
13 changed files with 148 additions and 9 deletions

View file

@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`required_7782_01_mangos_spell_proc_event` bit(1) default NULL
`required_7796_02_mangos_mangos_string` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -323,6 +323,7 @@ INSERT INTO `command` VALUES
('go graveyard',1,'Syntax: .go graveyard #graveyardId\r\n Teleport to graveyard with the graveyardId specified.'),
('go grid',1,'Syntax: .go grid #gridX #gridY [#mapId]\r\n\r\nTeleport the gm to center of grid with provided indexes at map #mapId (or current map if it not provided).'),
('go object',1,'Syntax: .go object #object_guid\r\nTeleport your character to gameobject with guid #object_guid'),
('go taxinode',1,'Syntax: .go taxinode #taxinode\r\n\r\nTeleport player to taxinode coordinates. You can look up zone using .lookup taxinode $namepart'),
('go trigger',1,'Syntax: .go trigger #trigger_id\r\n\r\nTeleport your character to areatrigger with id #trigger_id. Character will be teleported to trigger target if selected areatrigger is telporting trigger.'),
('go xy',1,'Syntax: .go xy #x #y [#mapid]\r\n\r\nTeleport player to point with (#x,#y) coordinates at ground(water) level at map #mapid or same map if #mapid not provided.'),
('go xyz',1,'Syntax: .go xyz #x #y #z [#mapid]\r\n\r\nTeleport player to point with (#x,#y,#z) coordinates at ground(water) level at map #mapid or same map if #mapid not provided.'),
@ -385,6 +386,7 @@ INSERT INTO `command` VALUES
('lookup quest',3,'Syntax: .lookup quest $namepart\r\n\r\nLooks up a quest by $namepart, and returns all matches with their quest ID\'s.'),
('lookup skill',3,'Syntax: .lookup skill $$namepart\r\n\r\nLooks up a skill by $namepart, and returns all matches with their skill ID\'s.'),
('lookup spell',3,'Syntax: .lookup spell $namepart\r\n\r\nLooks up a spell by $namepart, and returns all matches with their spell ID\'s.'),
('lookup taxinode',3,'Syntax: .lookup taxinode $substring\r\n\r\nSearch and output all taxinodes with provide $substring in name.'),
('lookup tele',1,'Syntax: .lookup tele $substring\r\n\r\nSearch and output all .tele command locations with provide $substring in name.'),
('maxskill',3,'Syntax: .maxskill\r\nSets all skills of the targeted player to their maximum VALUESfor its current level.'),
('modify arena',1,'Syntax: .modify arena #value\r\nAdd $amount arena points to the selected player.'),
@ -2689,6 +2691,7 @@ INSERT INTO `mangos_string` VALUES
(344,'You already have pet.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(345,'Forced customize for player %s will be requested at next login.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(346,'Forced customize for player %s (GUID #%u) will be requested at next login.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(347,'TaxiNode ID %u not found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(400,'|cffff0000[System Message]:|rScripts reloaded',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(401,'You change security level of account %s to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(402,'%s changed your security level to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
@ -2754,6 +2757,7 @@ INSERT INTO `mangos_string` VALUES
(463,'Teleport location added.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(464,'Teleport location NOT added: database error.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(465,'Teleport location deleted.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(466,'No taxinodes found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(467,'Target unit has %d auras:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(468,'id: %d eff: %d type: %d duration: %d maxduration: %d name: %s%s%s caster: %s %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(469,'Target unit has %d auras of type %d:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
@ -3053,6 +3057,8 @@ INSERT INTO `mangos_string` VALUES
(1125,'Your pet learned all talents',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1126,'Your pet talents have been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1127,'Talents of %s\'s pet reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1128,'%d - |cffffffff|Htaxinode:%u|h[%s %s]|h|r (Map:%u X:%f Y:%f Z:%f)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1129,'%d - %s %s (Map:%u X:%f Y:%f Z:%f)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;

View file

@ -0,0 +1,7 @@
ALTER TABLE db_version CHANGE COLUMN required_7782_01_mangos_spell_proc_event required_7796_01_mangos_command bit;
DELETE FROM `command` WHERE `name` IN ('go taxinode','lookup taxinode');
INSERT INTO `command` VALUES
('go taxinode',1,'Syntax: .go taxinode #taxinode\r\n\r\nTeleport player to taxinode coordinates. You can look up zone using .lookup taxinode $namepart'),
('lookup taxinode',3,'Syntax: .lookup taxinode $substring\r\n\r\nSearch and output all taxinodes with provide $substring in name.');

View file

@ -0,0 +1,8 @@
ALTER TABLE db_version CHANGE COLUMN required_7796_01_mangos_command required_7796_02_mangos_mangos_string bit;
DELETE FROM mangos_string WHERE entry IN(347,466,1128,1129);
INSERT INTO mangos_string VALUES
(347,'TaxiNode ID %u not found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(466,'No taxinodes found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1128,'%d - |cffffffff|Htaxinode:%u|h[%s %s]|h|r (Map:%u X:%f Y:%f Z:%f)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1129,'%d - %s %s (Map:%u X:%f Y:%f Z:%f)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

View file

@ -180,6 +180,8 @@ pkgdata_DATA = \
7776_01_mangos_npc_spellclick_spells.sql \
7777_01_mangos_spell_proc_event.sql \
7782_01_mangos_spell_proc_event.sql \
7796_01_mangos_command.sql \
7796_02_mangos_mangos_string.sql \
README
## Additional files to include when running 'make dist'
@ -340,4 +342,6 @@ EXTRA_DIST = \
7776_01_mangos_npc_spellclick_spells.sql \
7777_01_mangos_spell_proc_event.sql \
7782_01_mangos_spell_proc_event.sql \
7796_01_mangos_command.sql \
7796_02_mangos_mangos_string.sql \
README

View file

@ -46,6 +46,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
@ -186,6 +187,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 },
@ -279,6 +281,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 }
};

View file

@ -173,6 +173,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);
@ -223,6 +224,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);

View file

@ -1505,7 +1505,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]
};

View file

@ -94,7 +94,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";

View file

@ -332,7 +332,8 @@ enum MangosStrings
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,
@ -407,8 +408,7 @@ enum MangosStrings
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,
@ -764,7 +764,9 @@ enum MangosStrings
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,

View file

@ -2319,6 +2319,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)
{

View file

@ -3085,6 +3085,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.

View file

@ -6631,4 +6631,4 @@ void Spell::EffectRenamePet(uint32 /*eff_idx*/)
return;
unitTarget->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED);
}
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7795"
#define REVISION_NR "7796"
#endif // __REVISION_NR_H__