aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorp0wer <none@none>2010-03-01 19:28:21 -0600
committerp0wer <none@none>2010-03-01 19:28:21 -0600
commit81f6779102561df0719b0471b101bb5c15d2609a (patch)
treea78192d7f7d3ef61b70dc936d39e5e4ae58fb48d
parent22d7ceaabb13d86d30986fe37808c38b98a74ff6 (diff)
Add command similar to pinfo but for gameobjects.
Displays Entry, Type, DisplayId, and Name. Created in response to issue #768. --HG-- branch : trunk
-rw-r--r--sql/updates/7465_world_command.sql1
-rw-r--r--sql/updates/7465_world_trinity_string.sql4
-rw-r--r--sql/world.sql5
-rw-r--r--src/game/Chat.cpp1
-rw-r--r--src/game/Chat.h1
-rw-r--r--src/game/Language.h6
-rw-r--r--src/game/Level2.cpp31
7 files changed, 48 insertions, 1 deletions
diff --git a/sql/updates/7465_world_command.sql b/sql/updates/7465_world_command.sql
new file mode 100644
index 00000000000..8d0fe064048
--- /dev/null
+++ b/sql/updates/7465_world_command.sql
@@ -0,0 +1 @@
+INSERT INTO comand VALUES ('gobject info', 2, 'Syntax: .gobject info [$object_entry]\r\n\r\nQuery Gameobject information for selected gameobject or given entry."); \ No newline at end of file
diff --git a/sql/updates/7465_world_trinity_string.sql b/sql/updates/7465_world_trinity_string.sql
new file mode 100644
index 00000000000..acb451dc38a
--- /dev/null
+++ b/sql/updates/7465_world_trinity_string.sql
@@ -0,0 +1,4 @@
+INSERT INTO trinity_string (`entry`, `content_default`) VALUES (5024, 'Entry: %u');
+INSERT INTO trinity_string (`entry`, `content_default`) VALUES (5025, 'Type: %u');
+INSERT INTO trinity_string (`entry`, `content_default`) VALUES (5026, 'DisplayID: %u');
+INSERT INTO trinity_string (`entry`, `content_default`) VALUES (5027, 'Name: %s');
diff --git a/sql/world.sql b/sql/world.sql
index 8d506e55f65..d4da956750d 100644
--- a/sql/world.sql
+++ b/sql/world.sql
@@ -403,6 +403,7 @@ INSERT INTO `command` VALUES
('gobject activate','2','Syntax: .gobject activate #guid\r\n\r\nActivates an object like a door or a button.'),
('gobject add','2','Syntax: .gobject add #id <spawntimeSecs>\r\n\r\nAdd a game object from game object templates to the world at your current location using the #id.\r\nspawntimesecs sets the spawntime, it is optional.\r\n\r\nNote: this is a copy of .gameobject.'),
('gobject delete','2','Syntax: .gobject delete #go_guid\r\nDelete gameobject with guid #go_guid.'),
+('gobject info', 2, 'Syntax: .gobject info [$object_entry]\r\n\r\nQuery Gameobject information for selected gameobject or given entry.');
('gobject move','2','Syntax: .gobject move #goguid [#x #y #z]\r\n\r\nMove gameobject #goguid to character coordinates (or to (#x,#y,#z) coordinates if its provide).'),
('gobject near','2','Syntax: .gobject near [#distance]\r\n\r\nOutput gameobjects at distance #distance from player. Output gameobject guids and coordinates sorted by distance from character. If #distance not provided use 10 as default value.'),
('gobject setphase','2','Syntax: .gobject setphase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'),
@@ -14791,6 +14792,10 @@ INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_
(5021, 'Armor: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(5022, 'Channel password not changed due to channel being marked public. GM Powers required.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(5023, 'Channel: %s publicity set to: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5024, 'Entry: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5025, 'Type: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5026, 'DisplayID: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(5027, 'Name: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(6613, '|cfff00000[GM Announcement]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(6614, 'Notification to GM''s - ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(6615, '|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index c23ee76ee7d..643b18b7e00 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -235,6 +235,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "activate", SEC_GAMEMASTER, false, &ChatHandler::HandleActivateObjectCommand, "", NULL },
{ "add", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectAddCommand, "", NULL },
{ "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectDeleteCommand, "", NULL },
+ { "info", SEC_GAMEMASTER, false, &ChatHandler::HandleGOInfoCommand, "", NULL },
{ "move", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectMoveCommand, "", NULL },
{ "near", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectNearCommand, "", NULL },
{ "state", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectStateCommand, "", NULL },
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 9d2d89d09de..8ecef9bbcc2 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -192,6 +192,7 @@ class ChatHandler
bool HandleGameObjectAddCommand(const char* args);
bool HandleGameObjectDeleteCommand(const char* args);
+ bool HandleGOInfoCommand(const char* args);
bool HandleGameObjectMoveCommand(const char* args);
bool HandleGameObjectNearCommand(const char* args);
bool HandleGameObjectPhaseCommand(const char* args);
diff --git a/src/game/Language.h b/src/game/Language.h
index f83ef222b6b..4e5e3de4a9d 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -879,7 +879,11 @@ enum TrinityStrings
LANG_NPCINFO_ARMOR = 5021,
LANG_CHANNEL_NOT_PUBLIC = 5022,
LANG_CHANNEL_PUBLIC_CHANGED = 5023,
- // Room for more Trinity strings 5024-9999
+ LANG_GOINFO_ENTRY = 5024,
+ LANG_GOINFO_TYPE = 5025,
+ LANG_GOINFO_DISPLAYID = 5026,
+ LANG_GOINFO_NAME = 5027,
+ // Room for more Trinity strings 5028-9999
// Used for GM Announcements
LANG_GM_BROADCAST = 6613,
LANG_GM_NOTIFY = 6614,
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index 62fc94b541a..56b28aabd9b 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -2123,6 +2123,37 @@ bool ChatHandler::HandleModifyPhaseCommand(const char* args)
return true;
}
+//show info of gameobject
+bool ChatHandler::HandleGOInfoCommand(const char* args)
+{
+ uint32 entry = atoi((char*)args);
+ uint32 type = 0;
+ uint32 displayid = 0;
+ std::string name;
+
+ if(!*args)
+ {
+ WorldObject * obj = getSelectedObject();
+ entry = obj->GetEntry();
+ }
+
+ QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT `type` `displayid` `name` FROM gameobject_template WHERE entry = %u", entry);
+
+ if(!result)
+ return false;
+
+ Field * fields = result->Fetch();
+ type = fields[0].GetUInt32();
+ displayid = fields[1].GetUInt32();
+ name = fields[3].GetString();
+
+ PSendSysMessage(LANG_GOINFO_ENTRY, entry);
+ PSendSysMessage(LANG_GOINFO_TYPE, type);
+ PSendSysMessage(LANG_GOINFO_DISPLAYID, displayid);
+ PSendSysMessage(LANG_GOINFO_NAME, name.c_str());
+
+ return true;
+}
//show info of player
bool ChatHandler::HandlePInfoCommand(const char* args)