mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[2008_10_29_04_mangos_mangos_string.sql 2008_10_29_05_mangos_command.sql] Added new command: .npc follow - Makes the selected NPC follow you around like a pet
Signed-off-by: dythzer <micke223@gmail.com> * Also implement .npc unfollow for cancel following. * Help and mangos strings. * Unrelated small fixes in mangos.sql. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
affb0722d6
commit
569032d907
8 changed files with 95 additions and 4 deletions
|
|
@ -330,6 +330,7 @@ INSERT INTO `command` VALUES
|
||||||
('npc delitem',2,'Syntax: .npc delitem #itemId\r\n\r\nRemove item #itemid from item list of selected vendor.'),
|
('npc delitem',2,'Syntax: .npc delitem #itemId\r\n\r\nRemove item #itemid from item list of selected vendor.'),
|
||||||
('npc factionid',2,'Syntax: .npc factionid #factionid\r\n\r\nSet the faction of the selected creature to #factionid.'),
|
('npc factionid',2,'Syntax: .npc factionid #factionid\r\n\r\nSet the faction of the selected creature to #factionid.'),
|
||||||
('npc flag',2,'Syntax: .npc flag #npcflag\r\n\r\nSet the NPC flags of creature template of the selected creature and selected creature to #npcflag. NPC flags will applied to all creatures of selected creature template after server restart or grid unload/load.'),
|
('npc flag',2,'Syntax: .npc flag #npcflag\r\n\r\nSet the NPC flags of creature template of the selected creature and selected creature to #npcflag. NPC flags will applied to all creatures of selected creature template after server restart or grid unload/load.'),
|
||||||
|
('npc follow',2,'Syntax: .npc follow\r\n\r\nSelected creature start follow you until death/fight/etc.'),
|
||||||
('npc info',3,'Syntax: .npc info\r\n\r\nDisplay a list of details for the selected creature.\r\n\r\nThe list includes:\r\n- GUID, Faction, NPC flags, Entry ID, Model ID,\r\n- Level,\r\n- Health (current/maximum),\r\n\r\n- Field flags, dynamic flags, faction template, \r\n- Position information,\r\n- and the creature type, e.g. if the creature is a vendor.'),
|
('npc info',3,'Syntax: .npc info\r\n\r\nDisplay a list of details for the selected creature.\r\n\r\nThe list includes:\r\n- GUID, Faction, NPC flags, Entry ID, Model ID,\r\n- Level,\r\n- Health (current/maximum),\r\n\r\n- Field flags, dynamic flags, faction template, \r\n- Position information,\r\n- and the creature type, e.g. if the creature is a vendor.'),
|
||||||
('npc move',2,'Syntax: .npc move [#creature_guid]\r\n\r\nMove the targeted creature spawn point to your coordinates.'),
|
('npc move',2,'Syntax: .npc move [#creature_guid]\r\n\r\nMove the targeted creature spawn point to your coordinates.'),
|
||||||
('npc name',2,'Syntax: .npc name $name\r\n\r\nChange the name of the selected creature or character to $name.\r\n\r\nCommand disabled.'),
|
('npc name',2,'Syntax: .npc name $name\r\n\r\nChange the name of the selected creature or character to $name.\r\n\r\nCommand disabled.'),
|
||||||
|
|
@ -341,6 +342,7 @@ INSERT INTO `command` VALUES
|
||||||
('npc subname',2,'Syntax: .npc subname $Name\r\n\r\nChange the subname of the selected creature or player to $Name.\r\n\r\nCommand disabled.'),
|
('npc subname',2,'Syntax: .npc subname $Name\r\n\r\nChange the subname of the selected creature or player to $Name.\r\n\r\nCommand disabled.'),
|
||||||
('npc textemote',3,'Syntax: .npc textemote #emoteid\r\n\r\nMake the selected creature to do textemote with an emote of id #emoteid.'),
|
('npc textemote',3,'Syntax: .npc textemote #emoteid\r\n\r\nMake the selected creature to do textemote with an emote of id #emoteid.'),
|
||||||
('npc whisper',1,'Syntax: .npc whisper #playerguid #text\r\nMake the selected npc whisper #text to #playerguid.'),
|
('npc whisper',1,'Syntax: .npc whisper #playerguid #text\r\nMake the selected npc whisper #text to #playerguid.'),
|
||||||
|
('npc unfollow',2,'Syntax: .npc unfollow\r\n\r\nSelected creature (non pet) stop follow you.'),
|
||||||
('password',0,'Syntax: .password $old_password $new_password $new_password\r\n\r\nChange your account password.'),
|
('password',0,'Syntax: .password $old_password $new_password $new_password\r\n\r\nChange your account password.'),
|
||||||
('pdump write',3,'Syntax is: pdump write $filename $playerNameOrGUID\r\nWrite character dump with name/guid $playerNameOrGUID to file $filename.'),
|
('pdump write',3,'Syntax is: pdump write $filename $playerNameOrGUID\r\nWrite character dump with name/guid $playerNameOrGUID to file $filename.'),
|
||||||
('pdump load',3,'Syntax is: pdump load $filename $account [$newname] [$newguid]\r\nLoad character dump from dump file into character list of $account with saved or $newname, with saved (or first free) or $newguid guid.'),
|
('pdump load',3,'Syntax is: pdump load $filename $account [$newname] [$newguid]\r\nLoad character dump from dump file into character list of $account with saved or $newname, with saved (or first free) or $newguid guid.'),
|
||||||
|
|
@ -397,7 +399,7 @@ INSERT INTO `command` VALUES
|
||||||
('unban ip',3,'Syntax is: unban ip $Ip\r\nUnban accounts for IP pattern.'),
|
('unban ip',3,'Syntax is: unban ip $Ip\r\nUnban accounts for IP pattern.'),
|
||||||
('unlearn',3,'Syntax: .unlearn #startspell #endspell\r\n\r\nUnlearn for selected player the range of spells between id #startspell and #endspell. If no #endspell is provided, just unlearn spell of id #startspell.'),
|
('unlearn',3,'Syntax: .unlearn #startspell #endspell\r\n\r\nUnlearn for selected player the range of spells between id #startspell and #endspell. If no #endspell is provided, just unlearn spell of id #startspell.'),
|
||||||
('unmute',1,'Syntax: .unmute $playerName\r\n\r\nRestore chat messaging for any character from account of character $playerName.'),
|
('unmute',1,'Syntax: .unmute $playerName\r\n\r\nRestore chat messaging for any character from account of character $playerName.'),
|
||||||
('waterwalk',3,'Syntax: .waterwalk on/off\r\n\r\nSet on/off waterwalk state for selected player.'),
|
('waterwalk',2,'Syntax: .waterwalk on/off\r\n\r\nSet on/off waterwalk state for selected player.'),
|
||||||
('wchange',3,'Syntax: .wchange #weathertype #status\r\n\r\nSet current weather to #weathertype with an intensity of #status.\r\n\r\n#weathertype can be 1 for rain, 2 for snow, and 3 for sand. #status can be 0 for disabled, and 1 for enabled.'),
|
('wchange',3,'Syntax: .wchange #weathertype #status\r\n\r\nSet current weather to #weathertype with an intensity of #status.\r\n\r\n#weathertype can be 1 for rain, 2 for snow, and 3 for sand. #status can be 0 for disabled, and 1 for enabled.'),
|
||||||
('whispers',1,'Syntax: .whispers on|off\r\nEnable/disable accepting whispers by GM from players. By default use mangosd.conf setting.'),
|
('whispers',1,'Syntax: .whispers on|off\r\nEnable/disable accepting whispers by GM from players. By default use mangosd.conf setting.'),
|
||||||
('wp',2,'Using WP Command:\r\nEach Waypoint Command has it\'s own description!'),
|
('wp',2,'Using WP Command:\r\nEach Waypoint Command has it\'s own description!'),
|
||||||
|
|
@ -803,7 +805,7 @@ CREATE TABLE `db_version` (
|
||||||
LOCK TABLES `db_version` WRITE;
|
LOCK TABLES `db_version` WRITE;
|
||||||
/*!40000 ALTER TABLE `db_version` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `db_version` DISABLE KEYS */;
|
||||||
INSERT INTO `db_version` VALUES
|
INSERT INTO `db_version` VALUES
|
||||||
('Mangos default database.');
|
('Mangos default database.',NULL);
|
||||||
/*!40000 ALTER TABLE `db_version` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `db_version` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
|
@ -2410,6 +2412,9 @@ INSERT INTO `mangos_string` VALUES
|
||||||
(337,'All your items repaired by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(337,'All your items repaired by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(338,'You set waterwalk mode %s for %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(338,'You set waterwalk mode %s for %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(339,'Your waterwalk mode %s by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(339,'Your waterwalk mode %s by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(340,'%s is now following you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(341,'%s is not following you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(342,'%s is now not following you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(400,'|cffff0000[System Message]:|rScripts reloaded',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),
|
(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),
|
(402,'%s changed your security level to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
|
|
||||||
8
sql/updates/2008_10_29_04_mangos_mangos_string.sql
Normal file
8
sql/updates/2008_10_29_04_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_2008_10_29_03_mangos_db_version required_2008_10_29_04_mangos_mangos_string bit;
|
||||||
|
|
||||||
|
DELETE FROM mangos_string WHERE entry IN (340,341,342);
|
||||||
|
|
||||||
|
INSERT INTO mangos_string VALUES
|
||||||
|
(340,'%s is now following you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(341,'%s is not following you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(342,'%s is now not following you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||||
8
sql/updates/2008_10_29_05_mangos_command.sql
Normal file
8
sql/updates/2008_10_29_05_mangos_command.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_2008_10_29_04_mangos_mangos_string required_2008_10_29_05_mangos_command bit;
|
||||||
|
|
||||||
|
DELETE FROM command WHERE name IN ('npc follow','npc unfollow','waterwalk');
|
||||||
|
|
||||||
|
INSERT INTO command VALUES
|
||||||
|
('npc follow',2,'Syntax: .npc follow\r\n\r\nSelected creature start follow you until death/fight/etc.'),
|
||||||
|
('npc unfollow',2,'Syntax: .npc unfollow\r\n\r\nSelected creature (non pet) stop follow you.'),
|
||||||
|
('waterwalk',2,'Syntax: .waterwalk on/off\r\n\r\nSet on/off waterwalk state for selected player.');
|
||||||
|
|
@ -116,6 +116,8 @@ pkgdata_DATA = \
|
||||||
2008_10_29_01_mangos_mangos_string.sql \
|
2008_10_29_01_mangos_mangos_string.sql \
|
||||||
2008_10_29_02_mangos_command.sql \
|
2008_10_29_02_mangos_command.sql \
|
||||||
2008_10_29_03_mangos_db_version.sql \
|
2008_10_29_03_mangos_db_version.sql \
|
||||||
|
2008_10_29_04_mangos_mangos_string.sql \
|
||||||
|
2008_10_29_05_mangos_command.sql \
|
||||||
README
|
README
|
||||||
|
|
||||||
## Additional files to include when running 'make dist'
|
## Additional files to include when running 'make dist'
|
||||||
|
|
@ -213,4 +215,6 @@ EXTRA_DIST = \
|
||||||
2008_10_29_01_mangos_mangos_string.sql \
|
2008_10_29_01_mangos_mangos_string.sql \
|
||||||
2008_10_29_02_mangos_command.sql \
|
2008_10_29_02_mangos_command.sql \
|
||||||
2008_10_29_03_mangos_db_version.sql \
|
2008_10_29_03_mangos_db_version.sql \
|
||||||
|
2008_10_29_04_mangos_mangos_string.sql \
|
||||||
|
2008_10_29_05_mangos_command.sql \
|
||||||
README
|
README
|
||||||
|
|
|
||||||
|
|
@ -377,6 +377,8 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||||
{ "changeentry", SEC_ADMINISTRATOR, false, &ChatHandler::HandleChangeEntryCommand, "", NULL },
|
{ "changeentry", SEC_ADMINISTRATOR, false, &ChatHandler::HandleChangeEntryCommand, "", NULL },
|
||||||
{ "info", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcInfoCommand, "", NULL },
|
{ "info", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcInfoCommand, "", NULL },
|
||||||
{ "playemote", SEC_ADMINISTRATOR, false, &ChatHandler::HandlePlayEmoteCommand, "", NULL },
|
{ "playemote", SEC_ADMINISTRATOR, false, &ChatHandler::HandlePlayEmoteCommand, "", NULL },
|
||||||
|
{ "follow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFollowCommand, "", NULL },
|
||||||
|
{ "unfollow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcUnFollowCommand, "", NULL },
|
||||||
|
|
||||||
//{ TODO: fix or remove this commands
|
//{ TODO: fix or remove this commands
|
||||||
{ "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNameCommand, "", NULL },
|
{ "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNameCommand, "", NULL },
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,9 @@ class ChatHandler
|
||||||
bool HandleModifyRepCommand(const char* args);
|
bool HandleModifyRepCommand(const char* args);
|
||||||
bool HandleModifyArenaCommand(const char* args);
|
bool HandleModifyArenaCommand(const char* args);
|
||||||
|
|
||||||
|
bool HandleNpcFollowCommand(const char* args);
|
||||||
|
bool HandleNpcUnFollowCommand(const char* args);
|
||||||
|
|
||||||
bool HandleReloadCommand(const char* args);
|
bool HandleReloadCommand(const char* args);
|
||||||
bool HandleReloadAllCommand(const char* args);
|
bool HandleReloadAllCommand(const char* args);
|
||||||
bool HandleReloadAllAreaCommand(const char* args);
|
bool HandleReloadAllAreaCommand(const char* args);
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,10 @@ enum MangosStrings
|
||||||
LANG_YOUR_ITEMS_REPAIRED = 337,
|
LANG_YOUR_ITEMS_REPAIRED = 337,
|
||||||
LANG_YOU_SET_WATERWALK = 338,
|
LANG_YOU_SET_WATERWALK = 338,
|
||||||
LANG_YOUR_WATERWALK_SET = 339,
|
LANG_YOUR_WATERWALK_SET = 339,
|
||||||
// Room for more level 2 340-399 not used
|
LANG_CREATURE_FOLLOW_YOU_NOW = 340,
|
||||||
|
LANG_CREATURE_NOT_FOLLOW_YOU = 341,
|
||||||
|
LANG_CREATURE_NOT_FOLLOW_YOU_NOW = 342,
|
||||||
|
// Room for more level 2 343-399 not used
|
||||||
|
|
||||||
// level 3 chat
|
// level 3 chat
|
||||||
LANG_SCRIPTS_RELOADED = 400,
|
LANG_SCRIPTS_RELOADED = 400,
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "GlobalEvents.h"
|
#include "GlobalEvents.h"
|
||||||
|
|
||||||
|
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
|
||||||
|
|
||||||
static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
||||||
{
|
{
|
||||||
LANG_REP_HATED, LANG_REP_HOSTILE, LANG_REP_UNFRIENDLY, LANG_REP_NEUTRAL,
|
LANG_REP_HATED, LANG_REP_HOSTILE, LANG_REP_UNFRIENDLY, LANG_REP_NEUTRAL,
|
||||||
|
|
@ -4048,7 +4050,7 @@ bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleRepairitemsCommand(const char* args)
|
bool ChatHandler::HandleRepairitemsCommand(const char* /*args*/)
|
||||||
{
|
{
|
||||||
Player *target = getSelectedPlayer();
|
Player *target = getSelectedPlayer();
|
||||||
|
|
||||||
|
|
@ -4097,3 +4099,59 @@ bool ChatHandler::HandleWaterwalkCommand(const char* args)
|
||||||
ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, GetName());
|
ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, GetName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ChatHandler::HandleNpcFollowCommand(const char* /*args*/)
|
||||||
|
{
|
||||||
|
Player *player = m_session->GetPlayer();
|
||||||
|
Creature *creature = getSelectedCreature();
|
||||||
|
|
||||||
|
if(!creature)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_SELECT_CREATURE);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Follow player - Using pet's default dist and angle
|
||||||
|
creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
|
||||||
|
{
|
||||||
|
Player *player = m_session->GetPlayer();
|
||||||
|
Creature *creature = getSelectedCreature();
|
||||||
|
|
||||||
|
if(!creature)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_SELECT_CREATURE);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (creature->GetMotionMaster()->empty() ||
|
||||||
|
creature->GetMotionMaster()->GetCurrentMovementGeneratorType ()!=TARGETED_MOTION_TYPE)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetedMovementGenerator<Creature> const* mgen
|
||||||
|
= static_cast<TargetedMovementGenerator<Creature> const*>((creature->GetMotionMaster()->top()));
|
||||||
|
|
||||||
|
if(mgen->GetTarget()!=player)
|
||||||
|
{
|
||||||
|
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset movement
|
||||||
|
creature->GetMotionMaster()->MovementExpired(true);
|
||||||
|
|
||||||
|
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue