aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorVincent_Michael <Vincent_Michael@gmx.de>2014-01-18 20:43:06 +0100
committerVincent_Michael <Vincent_Michael@gmx.de>2014-01-18 20:43:06 +0100
commite26dcbe2f5b5b48351117052e65c474da7992913 (patch)
tree2b1de5422cb41c1d1c45095797db517816b9e20c /src/server/scripts
parent20c3eebfa70d07b4020f44dafdeb36a331a9d7d7 (diff)
parent68af9376f642dd2e4ff82678928288e9c09f68ca (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/scripts/Commands/cs_misc.cpp
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index ba355d08d0c..1b6a5fd9b22 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1336,23 +1336,20 @@ public:
return false;
}
- std::string tNameLink = handler->GetNameLink(target);
+ bool targetHasSkill = target->GetSkillValue(skill);
- if (!target->GetSkillValue(skill))
- {
- handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill);
+ // If our target does not yet have the skill they are trying to add to them, the chosen level also becomes
+ // the max level of the new profession.
+ uint16 max = maxPureSkill ? atol(maxPureSkill) : targetHasSkill ? target->GetPureMaxSkillValue(skill) : uint16(level);
if (level <= 0 || level > max || max <= 0)
return false;
- target->SetSkill(skill, target->GetSkillStep(skill), level, max);
- handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name, tNameLink.c_str(), level, max);
-
+ // If the player has the skill, we get the current skill step. If they don't have the skill, we
+ // add the skill to the player's book with step 1 (which is the first rank, in most cases something
+ // like 'Apprentice <skill>'.
+ target->SetSkill(skill, targetHasSkill ? target->GetSkillStep(skill) : 1, level, max);
+ handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name, handler->GetNameLink(target).c_str(), level, max);
return true;
}
@@ -1839,7 +1836,7 @@ public:
target->GetSession()->m_muteTime = muteTime;
stmt->setInt64(0, muteTime);
std::string nameLink = handler->playerLink(targetName);
-
+
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
{
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());