aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-08 18:47:27 -0500
committermegamage <none@none>2009-05-08 18:47:27 -0500
commite85e4c386b76e345cf615c743a3268408d72bffb (patch)
tree59cc055dd1497363fbaff40a8996287080a73af8
parent6fbebffbafc123b4948ad23303743e2b10f2ded4 (diff)
[7796] Implement .lookup taxinode and .go taxinode commands. Author: VladimirMangos
--HG-- branch : trunk
-rw-r--r--sql/mangos.sql8
-rw-r--r--sql/updates/7782_01_mangos_spell_proc_event.sql.obs4
-rw-r--r--sql/updates/7796_01_mangos_command.sql7
-rw-r--r--sql/updates/7796_02_mangos_mangos_string.sql8
-rw-r--r--src/game/Chat.cpp3
-rw-r--r--src/game/Chat.h2
-rw-r--r--src/game/DBCStructure.h2
-rw-r--r--src/game/DBCfmt.h2
-rw-r--r--src/game/Language.h10
-rw-r--r--src/game/Level1.cpp45
-rw-r--r--src/game/Level3.cpp62
-rw-r--r--src/game/SpellEffects.cpp2
12 files changed, 147 insertions, 8 deletions
diff --git a/sql/mangos.sql b/sql/mangos.sql
index 0a036be48a3..077f617b7c1 100644
--- a/sql/mangos.sql
+++ b/sql/mangos.sql
@@ -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_7777_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';
--
@@ -322,6 +322,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.'),
@@ -384,6 +385,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.'),
@@ -2688,6 +2690,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),
@@ -2753,6 +2756,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),
@@ -3052,6 +3056,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 */;
diff --git a/sql/updates/7782_01_mangos_spell_proc_event.sql.obs b/sql/updates/7782_01_mangos_spell_proc_event.sql.obs
new file mode 100644
index 00000000000..8efa5573b3c
--- /dev/null
+++ b/sql/updates/7782_01_mangos_spell_proc_event.sql.obs
@@ -0,0 +1,4 @@
+ALTER TABLE db_version CHANGE COLUMN required_7777_01_mangos_spell_proc_event required_7782_01_mangos_spell_proc_event bit;
+
+DELETE FROM spell_proc_event WHERE entry = 34074;
+INSERT INTO spell_proc_event VALUES (34074, 0, 9, 522819, 8917121, 513, 0, 0, 0, 0, 0); \ No newline at end of file
diff --git a/sql/updates/7796_01_mangos_command.sql b/sql/updates/7796_01_mangos_command.sql
new file mode 100644
index 00000000000..0a5c7c34221
--- /dev/null
+++ b/sql/updates/7796_01_mangos_command.sql
@@ -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.');
diff --git a/sql/updates/7796_02_mangos_mangos_string.sql b/sql/updates/7796_02_mangos_mangos_string.sql
new file mode 100644
index 00000000000..ae47b9803a5
--- /dev/null
+++ b/sql/updates/7796_02_mangos_mangos_string.sql
@@ -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);
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 1bc6eb304e4..bf8ee9d3a77 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -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 }
};
diff --git a/src/game/Chat.h b/src/game/Chat.h
index cc7de6731a6..97570d2f250 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -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);
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index 8c8195c018b..3798785ca03 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -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]
};
diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h
index ea2198ef22c..170fd25dd9f 100644
--- a/src/game/DBCfmt.h
+++ b/src/game/DBCfmt.h
@@ -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";
diff --git a/src/game/Language.h b/src/game/Language.h
index 69bfbf00159..8bc01a7deea 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -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,
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index 963e79f8829..832f2ada5e3 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -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)
{
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 474a79c5680..1130bcec070 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -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.
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 14b012b6f73..c411ea69bff 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6534,4 +6534,4 @@ void Spell::EffectRenamePet(uint32 /*eff_idx*/)
return;
unitTarget->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED);
-}
+} \ No newline at end of file