[8071] Restore work .modify tp command. Allow apply it to selected

character's pet. Author: VladimirMangos.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-06-23 15:05:40 +02:00
parent f558a785fc
commit 0c36f2ab24
3 changed files with 36 additions and 12 deletions
+4
View File
@@ -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.');
+1 -1
View File
@@ -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.'),
+31 -11
View File
@@ -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;
}