aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/4215_world.sql4
-rw-r--r--sql/world.sql2
-rw-r--r--src/game/Level1.cpp42
3 files changed, 36 insertions, 12 deletions
diff --git a/sql/updates/4215_world.sql b/sql/updates/4215_world.sql
new file mode 100644
index 00000000000..352596306a0
--- /dev/null
+++ b/sql/updates/4215_world.sql
@@ -0,0 +1,4 @@
+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/world.sql b/sql/world.sql
index 46fbfab5237..f96d43b66d9 100644
--- a/sql/world.sql
+++ b/sql/world.sql
@@ -467,7 +467,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,'.modify tp $parameter\nModify the amount of talent points to be used for selected player. If no player is selected, modify your talents.'),
+('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.'),
('modify',1,'Syntax: .modify $subcommand\nType .modify to see the list of possible subcommands or .help modify $subcommand to see info on subcommands'),
('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.'),
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index cb06b2fe273..88d65f783fa 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -1468,23 +1468,43 @@ 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;
}