From f34ce077c0b4729e17e6a5ccd479ef45ed13e610 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 23 Jun 2009 04:43:46 +0400 Subject: [PATCH] [8071] Restore work .modify tp command. Allow apply it to selected character's pet. --- sql/mangos.sql | 3 +- sql/updates/8071_01_mangos_command.sql | 6 ++++ sql/updates/Makefile.am | 2 ++ src/game/Level1.cpp | 41 +++++++++++++++++++------- src/shared/revision_nr.h | 2 +- 5 files changed, 42 insertions(+), 12 deletions(-) create mode 100644 sql/updates/8071_01_mangos_command.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 7bf0d2f9e..c2f727eca 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_8065_01_mangos_spell_proc_event` bit(1) default NULL + `required_8071_01_mangos_command` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -414,6 +414,7 @@ INSERT INTO `command` VALUES ('modify standstate',2,'Syntax: .modify standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'), ('modify swim',1,'Syntax: .modify swim #rate\r\n\r\nModify the swim speed of the selected player to \"normal swim speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'), ('modify titles',1,'Syntax: .modify titles #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field'), +('modify tp',1,'Syntax: .modify tp #amount\r\n\r\nSet free talent pointes for selected character or character\'s pet. It will be reset to default expected at next levelup/login/quest reward.'), ('movegens',3,'Syntax: .movegens\r\n Show movement generators stack for selected creature or player.'), ('mute',1,'Syntax: .mute [$playerName] $timeInMinutes\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.'), ('namego',1,'Syntax: .namego [$charactername]\r\n\r\nTeleport the given character to you. Character can be offline.'), diff --git a/sql/updates/8071_01_mangos_command.sql b/sql/updates/8071_01_mangos_command.sql new file mode 100644 index 000000000..4c4aefe8e --- /dev/null +++ b/sql/updates/8071_01_mangos_command.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_8065_01_mangos_spell_proc_event required_8071_01_mangos_command bit; + +DELETE FROM `command` WHERE `name` IN ('modify tp'); + +INSERT INTO `command` VALUES +('modify tp',1,'Syntax: .modify tp #amount\r\n\r\nSte free talent pointes for selected character or character\'s pet. It will be reset to default expected at next levelup/login/quest reward.'); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index efaae7be5..3ab64aa8b 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -232,6 +232,7 @@ pkgdata_DATA = \ 8060_01_mangos_spell_pet_auras.sql \ 8064_01_mangos_spell_chain.sql \ 8065_01_mangos_spell_proc_event.sql \ + 8071_01_mangos_command.sql \ README ## Additional files to include when running 'make dist' @@ -444,4 +445,5 @@ EXTRA_DIST = \ 8060_01_mangos_spell_pet_auras.sql \ 8064_01_mangos_spell_chain.sql \ 8065_01_mangos_spell_proc_event.sql \ + 8071_01_mangos_command.sql \ README diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index a8d6a003f..ba089c72d 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -1040,23 +1040,44 @@ bool ChatHandler::HandleModifyTalentCommand (const char* args) return false; int tp = atoi((char*)args); - if (tp>0) + if (tp < 0) + return false; + + Unit* target = getSelectedUnit(); + if(!target) { - Player* player = getSelectedPlayer(); - if(!player) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + if(target->GetTypeId()==TYPEID_PLAYER) + { // check online security - if (HasLowerSecurity(player, 0)) + if (HasLowerSecurity((Player*)target, 0)) return false; - player->SetFreeTalentPoints(tp); + ((Player*)target)->SetFreeTalentPoints(tp); + ((Player*)target)->SendTalentsInfoData(false); return true; } + else if(((Creature*)target)->isPet()) + { + Unit *owner = target->GetOwner(); + if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor((Player*)owner)) + { + // check online security + if (HasLowerSecurity((Player*)owner, 0)) + return false; + + ((Pet *)target)->SetFreeTalentPoints(tp); + ((Player*)owner)->SendTalentsInfoData(true); + return true; + } + } + + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); return false; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f4c061cf6..417c7adcc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8070" + #define REVISION_NR "8071" #endif // __REVISION_NR_H__