schikell
Active User
- Joined
- Apr 26, 2008
- Messages
- 148
- Reaction score
- 8
Jest to skrypt C++ ktory dodaje komende /giveskill
GM ma wtedy mozliwosc dodania graczowi skilla z: levelu, magic levelu, fist , club, axe, sword, distance, shielding, fishing.
GM ma wtedy mozliwosc dodania graczowi skilla z: levelu, magic levelu, fist , club, axe, sword, distance, shielding, fishing.
Kod:
commands.cpp:
Po:
Code:
{"/raid",&Commands::forceRaid},
Code:
#ifdef KILL_GIVESKILL
{"/giveskill", &Commands::addSkillValues},
#endif //KILL_GIVESKILL
Code:
#ifdef KILL_GIVESKILL
bool Commands::addSkillValues(Creature* creature, const std::string& cmd, const std::string& param)
{
Player* player = creature->getPlayer();
std::string skill = param;
int pos = param.find(",");
// skill.erase(0, pos+1);
Player* target = g_game.getPlayerByName(skill.substr(0, pos).c_str());
if(player){
if(target){
skill.erase(0, pos+1);
std::transform(skill.begin(), skill.end(), skill.begin(), tolower);
Vocation* playervoc = g_vocations.getVocation(target->getVocationId());
if(skill == "level"){
target->addExperience(target->getExpForLv(target->getLevel() + 1) - target->getExperience());
}
else if(skill == "magiclevel"){
if(target->getAccessLevel() != 0){
player->sendTextMessage(MSG_STATUS_CONSOLE_BLUE, "You can't give mlvl to players with access more than 0.");
}
else
{
target->addManaSpent(playervoc->getReqMana(target->getMagicLevel() + 1) - target->getManaSpent());
}
}
else if(skill == "fist"){
target->addSkillAdvance(SKILL_FIST, playervoc->getReqSkillTries(SKILL_FIST, target->getSkill(SKILL_FIST, SKILL_LEVEL) + 1));
}
else if(skill == "club"){
target->addSkillAdvance(SKILL_CLUB, playervoc->getReqSkillTries(SKILL_CLUB, target->getSkill(SKILL_CLUB, SKILL_LEVEL) + 1));
}
else if(skill == "sword"){
target->addSkillAdvance(SKILL_SWORD, playervoc->getReqSkillTries(SKILL_SWORD, target->getSkill(SKILL_SWORD, SKILL_LEVEL) + 1));
}
else if(skill == "axe"){
target->addSkillAdvance(SKILL_AXE, playervoc->getReqSkillTries(SKILL_AXE, target->getSkill(SKILL_AXE, SKILL_LEVEL) + 1));
}
else if(skill == "distance"){
target->addSkillAdvance(SKILL_DIST, playervoc->getReqSkillTries(SKILL_DIST, target->getSkill(SKILL_DIST, SKILL_LEVEL) + 1));
}
else if(skill == "shielding"){
target->addSkillAdvance(SKILL_SHIELD, playervoc->getReqSkillTries(SKILL_SHIELD, target->getSkill(SKILL_SHIELD, SKILL_LEVEL) + 1));
}
else if(skill == "fishing"){
target->addSkillAdvance(SKILL_FISH, playervoc->getReqSkillTries(SKILL_FISH, target->getSkill(SKILL_FISH, SKILL_LEVEL) + 1));
}
}
else{
player->sendTextMessage(MSG_STATUS_CONSOLE_BLUE, "Target not found.");
return false;
}
}
else{
return false;
}
}
#endif //KILL_GIVESKILL
Po:
Code:
bool forceRaid(Creature* creature, const std::string& cmd, const std::string& param);
Code:
#ifdef KILL_GETSKILL
bool addSkillValues(Creature* creature, const std::string& cmd, const std::string& param);
#endif //KILL_GETSKILL
Po:
Code:
uint32_t getVocationId() const;
Code:
#ifdef KILL_GETSKILL
int32_t getManaSpent() const {return manaSpent;}
#endif //KILL_GETSKILL
Code:
-DKILL_GETSKILL