Skip to content

Commit

Permalink
Mining Skill - Test
Browse files Browse the repository at this point in the history
  • Loading branch information
vllworldbuilding committed Oct 30, 2024
1 parent 66fffa1 commit 9427a81
Show file tree
Hide file tree
Showing 19 changed files with 82 additions and 30 deletions.
9 changes: 9 additions & 0 deletions data/XML/vocations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<skill id="4" multiplier="2.0" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
<skill id="7" multiplier="1.1" />
</vocation>
<vocation id="1" clientid="3" baseid="1" name="Sorcerer" description="a sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12000" gainhpamount="1" gainmanaticks="3000" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="110" soulmax="100" gainsoulticks="120000" fromvoc="1" avatarlooktype="1595">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
Expand All @@ -23,6 +24,7 @@
<skill id="4" multiplier="2.0" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
<skill id="7" multiplier="1.1" />
</vocation>
<vocation id="2" clientid="4" baseid="2" name="Druid" description="a druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12000" gainhpamount="1" gainmanaticks="3000" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="110" soulmax="100" gainsoulticks="120000" fromvoc="2" avatarlooktype="1596">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
Expand All @@ -35,6 +37,7 @@
<skill id="4" multiplier="1.8" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
<skill id="7" multiplier="1.1" />
</vocation>
<vocation id="3" clientid="2" baseid="3" name="Paladin" description="a paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8000" gainhpamount="1" gainmanaticks="4000" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="110" soulmax="100" gainsoulticks="120000" fromvoc="3" avatarlooktype="1594">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
Expand All @@ -47,6 +50,7 @@
<skill id="4" multiplier="1.1" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
<skill id="7" multiplier="1.1" />
</vocation>
<vocation id="4" clientid="1" baseid="4" name="Knight" description="a knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6000" gainhpamount="1" gainmanaticks="6000" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="110" soulmax="100" gainsoulticks="120000" fromvoc="4" avatarlooktype="1593">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
Expand All @@ -59,6 +63,7 @@
<skill id="4" multiplier="1.4" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
<skill id="7" multiplier="1.1" />
</vocation>
<vocation id="5" clientid="13" baseid="1" name="Master Sorcerer" description="a master sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12000" gainhpamount="1" gainmanaticks="2000" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="110" soulmax="200" gainsoulticks="15000" fromvoc="1" avatarlooktype="1595">
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
Expand All @@ -71,6 +76,7 @@
<skill id="4" multiplier="2.0" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
<skill id="7" multiplier="1.1" />
<gem quality="0" name="lesser sage gem" />
<gem quality="1" name="sage gem" />
<gem quality="2" name="greater sage gem" />
Expand All @@ -86,6 +92,7 @@
<skill id="4" multiplier="1.8" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
<skill id="7" multiplier="1.1" />
<gem quality="0" name="lesser mystic gem" />
<gem quality="1" name="mystic gem" />
<gem quality="2" name="greater mystic gem" />
Expand All @@ -101,6 +108,7 @@
<skill id="4" multiplier="1.1" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
<skill id="7" multiplier="1.1" />
<gem quality="0" name="lesser marksman gem" />
<gem quality="1" name="marksman gem" />
<gem quality="2" name="greater marksman gem" />
Expand All @@ -116,6 +124,7 @@
<skill id="4" multiplier="1.4" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
<skill id="7" multiplier="1.1" />
<gem quality="0" name="lesser guardian gem" />
<gem quality="1" name="guardian gem" />
<gem quality="2" name="greater guardian gem" />
Expand Down
5 changes: 5 additions & 0 deletions data/scripts/actions/items/hireling_foods.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

local hasteCondition = Condition(CONDITION_HASTE)
hasteCondition:setParameter(CONDITION_PARAM_TICKS, 60 * 60 * 1000)
hasteCondition:setParameter(CONDITION_PARAM_SPEED, 80)
Expand All @@ -6,6 +7,10 @@ local fishingCondition = Condition(CONDITION_ATTRIBUTES)
fishingCondition:setParameter(CONDITION_PARAM_TICKS, 60 * 60 * 1000)
fishingCondition:setParameter(CONDITION_PARAM_SKILL_FISHING, 30)

local miningCondition = Condition(CONDITION_ATTRIBUTES)
miningCondition:setParameter(CONDITION_PARAM_TICKS, 60 * 60 * 1000)
miningCondition:setParameter(CONDITION_PARAM_SKILL_MINING, 30)

local magicPointsCondition = Condition(CONDITION_ATTRIBUTES)
magicPointsCondition:setParameter(CONDITION_PARAM_TICKS, 60 * 60 * 1000)
magicPointsCondition:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
Expand Down
2 changes: 2 additions & 0 deletions data/scripts/talkactions/god/add_skill.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ local function getSkillId(skillName)
return SKILL_DISTANCE
elseif skillName:sub(1, 6) == "shield" then
return SKILL_SHIELD
elseif skillName:sub(1, 4) == "mining" then
return SKILL_MINING
elseif skillName:sub(1, 4) == "fish" then
return SKILL_FISHING
else
Expand Down
10 changes: 10 additions & 0 deletions src/creatures/combat/condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,16 @@ bool ConditionAttributes::setParam(ConditionParam_t param, int32_t value) {
return true;
}

case CONDITION_PARAM_SKILL_MINING: {
skills[SKILL_MINING] = value;
return true;
}

case CONDITION_PARAM_SKILL_MININGPERCENT: {
skillsPercent[SKILL_MINING] = value;
return true;
}

case CONDITION_PARAM_SKILL_FISHING: {
skills[SKILL_FISHING] = value;
return true;
Expand Down
21 changes: 12 additions & 9 deletions src/creatures/creatures_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ enum ConditionParam_t {
CONDITION_PARAM_INCREASE_MANADRAINPERCENT = 80,
CONDITION_PARAM_INCREASE_DROWNPERCENT = 81,
CONDITION_PARAM_CHARM_CHANCE_MODIFIER = 82,
CONDITION_PARAM_SKILL_MINING = 83,
CONDITION_PARAM_SKILL_MININGPERCENT = 84,
};

enum stats_t {
Expand Down Expand Up @@ -412,15 +414,16 @@ enum skills_t : int8_t {
SKILL_DISTANCE = 4,
SKILL_SHIELD = 5,
SKILL_FISHING = 6,
SKILL_CRITICAL_HIT_CHANCE = 7,
SKILL_CRITICAL_HIT_DAMAGE = 8,
SKILL_LIFE_LEECH_CHANCE = 9,
SKILL_LIFE_LEECH_AMOUNT = 10,
SKILL_MANA_LEECH_CHANCE = 11,
SKILL_MANA_LEECH_AMOUNT = 12,

SKILL_MAGLEVEL = 13,
SKILL_LEVEL = 14,
SKILL_MINING = 7,
SKILL_CRITICAL_HIT_CHANCE = 8,
SKILL_CRITICAL_HIT_DAMAGE = 9,
SKILL_LIFE_LEECH_CHANCE = 10,
SKILL_LIFE_LEECH_AMOUNT = 11,
SKILL_MANA_LEECH_CHANCE = 12,
SKILL_MANA_LEECH_AMOUNT = 13,
SKILL_MAGLEVEL = 14,
SKILL_LEVEL = 15,


SKILL_FIRST = SKILL_FIST,
SKILL_LAST = SKILL_MANA_LEECH_AMOUNT
Expand Down
2 changes: 2 additions & 0 deletions src/creatures/players/imbuements/imbuements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ bool Imbuements::loadFromXml(bool /* reloading */) {
skillId = SKILL_DISTANCE;
} else if (tmpStrValue == "fish") {
skillId = SKILL_FISHING;
} else if (tmpStrValue == "mining") {
skillId = SKILL_MINING;
} else if (tmpStrValue == "shield") {
skillId = SKILL_SHIELD;
} else if (tmpStrValue == "fist") {
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/players/vocations/vocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ uint16_t Vocations::getPromotedVocation(uint16_t vocationId) const {
return VOCATION_NONE;
}

uint32_t Vocation::skillBase[SKILL_LAST + 1] = { 50, 50, 50, 50, 30, 100, 20 };
uint32_t Vocation::skillBase[SKILL_LAST + 1] = { 50, 50, 50, 50, 30, 100, 20, 20 };
const uint16_t minSkillLevel = 10;

absl::uint128 Vocation::getTotalSkillTries(uint8_t skill, uint16_t level) {
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/players/vocations/vocation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Vocation {
std::string name = "none";
std::string description;

float skillMultipliers[SKILL_LAST + 1] = { 1.5f, 2.0f, 2.0f, 2.0f, 2.0f, 1.5f, 1.1f };
float skillMultipliers[SKILL_LAST + 1] = { 1.5f, 2.0f, 2.0f, 2.0f, 2.0f, 1.5f, 1.1f, 1.1f };
float manaMultiplier = 4.0f;

uint32_t gainHealthTicks = 6;
Expand Down
4 changes: 4 additions & 0 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ Game::Game() {
{ static_cast<uint8_t>(HighscoreCategories_t::DISTANCE_FIGHTING), "Distance Fighting" },
{ static_cast<uint8_t>(HighscoreCategories_t::DROME), "Drome Score" },
{ static_cast<uint8_t>(HighscoreCategories_t::EXPERIENCE), "Experience Points" },
{ static_cast<uint8_t>(HighscoreCategories_t::MINING), "Mining" },
{ static_cast<uint8_t>(HighscoreCategories_t::FISHING), "Fishing" },
{ static_cast<uint8_t>(HighscoreCategories_t::FIST_FIGHTING), "Fist Fighting" },
{ static_cast<uint8_t>(HighscoreCategories_t::GOSHNAR), "Goshnar's Taint" },
Expand All @@ -359,6 +360,7 @@ Game::Game() {
HighscoreCategory("Axe Fighting", static_cast<uint8_t>(HighscoreCategories_t::AXE_FIGHTING)),
HighscoreCategory("Distance Fighting", static_cast<uint8_t>(HighscoreCategories_t::DISTANCE_FIGHTING)),
HighscoreCategory("Shielding", static_cast<uint8_t>(HighscoreCategories_t::SHIELDING)),
HighscoreCategory("Mining", static_cast<uint8_t>(HighscoreCategories_t::MINING)),
HighscoreCategory("Fishing", static_cast<uint8_t>(HighscoreCategories_t::FISHING)),
HighscoreCategory("Magic Level", static_cast<uint8_t>(HighscoreCategories_t::MAGIC_LEVEL))
};
Expand Down Expand Up @@ -8614,6 +8616,8 @@ std::string Game::getSkillNameById(uint8_t &skill) {
return "skill_dist";
case HighscoreCategories_t::SHIELDING:
return "skill_shielding";
case HighscoreCategories_t::MINING:
return "skill_mining";
case HighscoreCategories_t::FISHING:
return "skill_fishing";
case HighscoreCategories_t::MAGIC_LEVEL:
Expand Down
15 changes: 8 additions & 7 deletions src/game/game_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ enum class HighscoreCategories_t : uint8_t {
DISTANCE_FIGHTING = 5,
SHIELDING = 6,
FISHING = 7,
MAGIC_LEVEL = 8,
LOYALTY = 9,
ACHIEVEMENTS = 10,
CHARMS = 11,
DROME = 12,
GOSHNAR = 13,
BOSS_POINTS = 14,
MINING = 8,
MAGIC_LEVEL = 9,
LOYALTY = 10,
ACHIEVEMENTS = 11,
CHARMS = 12,
DROME = 13,
GOSHNAR = 14,
BOSS_POINTS = 15,
};

enum HighscoreType_t : uint8_t {
Expand Down
4 changes: 2 additions & 2 deletions src/io/functions/iologindata_load_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ void IOLoginDataLoad::loadPlayerSkill(std::shared_ptr<Player> player, DBResult_p
return;
}

static const std::array<std::string, 13> skillNames = { "skill_fist", "skill_club", "skill_sword", "skill_axe", "skill_dist", "skill_shielding", "skill_fishing", "skill_critical_hit_chance", "skill_critical_hit_damage", "skill_life_leech_chance", "skill_life_leech_amount", "skill_mana_leech_chance", "skill_mana_leech_amount" };
static const std::array<std::string, 13> skillNameTries = { "skill_fist_tries", "skill_club_tries", "skill_sword_tries", "skill_axe_tries", "skill_dist_tries", "skill_shielding_tries", "skill_fishing_tries", "skill_critical_hit_chance_tries", "skill_critical_hit_damage_tries", "skill_life_leech_chance_tries", "skill_life_leech_amount_tries", "skill_mana_leech_chance_tries", "skill_mana_leech_amount_tries" };
static const std::array<std::string, 14> skillNames = { "skill_fist", "skill_club", "skill_sword", "skill_axe", "skill_dist", "skill_shielding", "skill_fishing", "skill_mining", "skill_critical_hit_chance", "skill_critical_hit_damage", "skill_life_leech_chance", "skill_life_leech_amount", "skill_mana_leech_chance", "skill_mana_leech_amount" };
static const std::array<std::string, 14> skillNameTries = { "skill_fist_tries", "skill_club_tries", "skill_sword_tries", "skill_axe_tries", "skill_dist_tries", "skill_shielding_tries", "skill_fishing_tries", "skill_mining_tries", "skill_critical_hit_chance_tries", "skill_critical_hit_damage_tries", "skill_life_leech_chance_tries", "skill_life_leech_amount_tries", "skill_mana_leech_chance_tries", "skill_mana_leech_amount_tries" };
for (size_t i = 0; i < skillNames.size(); ++i) {
uint16_t skillLevel = result->getNumber<uint16_t>(skillNames[i]);
uint64_t skillTries = result->getNumber<uint64_t>(skillNameTries[i]);
Expand Down
2 changes: 2 additions & 0 deletions src/io/functions/iologindata_save_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ bool IOLoginDataSave::savePlayerFirst(std::shared_ptr<Player> player) {
query << "`skill_shielding_tries` = " << player->skills[SKILL_SHIELD].tries << ",";
query << "`skill_fishing` = " << player->skills[SKILL_FISHING].level << ",";
query << "`skill_fishing_tries` = " << player->skills[SKILL_FISHING].tries << ",";
query << "`skill_mining` = " << player->skills[SKILL_MINING].level << ",";
query << "`skill_mining_tries` = " << player->skills[SKILL_MINING].tries << ",";
query << "`skill_critical_hit_chance` = " << player->skills[SKILL_CRITICAL_HIT_CHANCE].level << ",";
query << "`skill_critical_hit_chance_tries` = " << player->skills[SKILL_CRITICAL_HIT_CHANCE].tries << ",";
query << "`skill_critical_hit_damage` = " << player->skills[SKILL_CRITICAL_HIT_DAMAGE].level << ",";
Expand Down
2 changes: 2 additions & 0 deletions src/items/functions/item/item_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ void ItemParse::parseSkills(const std::string &tmpStrValue, pugi::xml_attribute
itemType.getAbilities().skills[SKILL_DISTANCE] = pugi::cast<int32_t>(valueAttribute.value());
} else if (stringValue == "skillfish") {
itemType.getAbilities().skills[SKILL_FISHING] = pugi::cast<int32_t>(valueAttribute.value());
} else if (stringValue == "skillmining") {
itemType.getAbilities().skills[SKILL_MINING] = pugi::cast<int32_t>(valueAttribute.value());
} else if (stringValue == "skillshield") {
itemType.getAbilities().skills[SKILL_SHIELD] = pugi::cast<int32_t>(valueAttribute.value());
} else if (stringValue == "skillfist") {
Expand Down
1 change: 1 addition & 0 deletions src/items/functions/item/item_parse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const phmap::flat_hash_map<std::string, ItemParseAttributes_t> ItemParseAttribut
{ "skillclub", ITEM_PARSE_SKILLCLUB },
{ "skilldist", ITEM_PARSE_SKILLDIST },
{ "skillfish", ITEM_PARSE_SKILLFISH },
{ "skillmining", ITEM_PARSE_SKILLMINING },
{ "skillshield", ITEM_PARSE_SKILLSHIELD },
{ "skillfist", ITEM_PARSE_SKILLFIST },
{ "criticalhitchance", ITEM_PARSE_CRITICALHITCHANCE },
Expand Down
10 changes: 5 additions & 5 deletions src/items/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr<Item> item /*= nullptr
skillBoost = true;
}

for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_MINING; i++) {
if (!it.abilities->skills[i]) {
continue;
}
Expand Down Expand Up @@ -1646,7 +1646,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr<Item> item /*= nullptr
skillBoost = true;
}

for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_MINING; i++) {
if (!it.abilities->skills[i]) {
continue;
}
Expand Down Expand Up @@ -2098,7 +2098,7 @@ std::string Item::parseShowAttributesDescription(std::shared_ptr<Item> item, con
}

if (itemType.abilities) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_MINING; i++) {
if (!itemType.abilities->skills[i]) {
continue;
}
Expand Down Expand Up @@ -2396,7 +2396,7 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std::
}

if (it.abilities) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_MINING; i++) {
if (!it.abilities->skills[i]) {
continue;
}
Expand Down Expand Up @@ -2664,7 +2664,7 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std::
}

if (it.abilities) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_MINING; i++) {
if (!it.abilities->skills[i]) {
continue;
}
Expand Down
2 changes: 2 additions & 0 deletions src/items/items_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ enum ReturnValue {
RETURNVALUE_NOTENOUGHDISTANCELEVEL,
RETURNVALUE_NOTENOUGHSHIELDLEVEL,
RETURNVALUE_NOTENOUGHFISHLEVEL,
RETURNVALUE_NOTENOUGHMININGLEVEL,
RETURNVALUE_REWARDCHESTISEMPTY,
RETURNVALUE_REWARDCONTAINERISEMPTY,
RETURNVALUE_CONTACTADMINISTRATOR,
Expand Down Expand Up @@ -538,6 +539,7 @@ enum ItemParseAttributes_t {
ITEM_PARSE_SKILLCLUB,
ITEM_PARSE_SKILLDIST,
ITEM_PARSE_SKILLFISH,
ITEM_PARSE_SKILLMINING,
ITEM_PARSE_SKILLSHIELD,
ITEM_PARSE_SKILLFIST,
ITEM_PARSE_CRITICALHITCHANCE,
Expand Down
3 changes: 3 additions & 0 deletions src/lua/functions/core/game/lua_enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ void LuaEnums::initConditionParamEnums(lua_State* L) {
registerEnum(L, CONDITION_PARAM_SKILL_DISTANCE);
registerEnum(L, CONDITION_PARAM_SKILL_SHIELD);
registerEnum(L, CONDITION_PARAM_SKILL_FISHING);
registerEnum(L, CONDITION_PARAM_SKILL_MINING);
registerEnum(L, CONDITION_PARAM_SKILL_CRITICAL_HIT_CHANCE);
registerEnum(L, CONDITION_PARAM_SKILL_CRITICAL_HIT_DAMAGE);
registerEnum(L, CONDITION_PARAM_SKILL_LIFE_LEECH_CHANCE);
Expand All @@ -401,6 +402,7 @@ void LuaEnums::initConditionParamEnums(lua_State* L) {
registerEnum(L, CONDITION_PARAM_SKILL_DISTANCEPERCENT);
registerEnum(L, CONDITION_PARAM_SKILL_SHIELDPERCENT);
registerEnum(L, CONDITION_PARAM_SKILL_FISHINGPERCENT);
registerEnum(L, CONDITION_PARAM_SKILL_MININGPERCENT);
registerEnum(L, CONDITION_PARAM_BUFF_SPELL);
registerEnum(L, CONDITION_PARAM_SUBID);
registerEnum(L, CONDITION_PARAM_FIELD);
Expand Down Expand Up @@ -965,6 +967,7 @@ void LuaEnums::initSkillEnums(lua_State* L) {
registerEnum(L, SKILL_DISTANCE);
registerEnum(L, SKILL_SHIELD);
registerEnum(L, SKILL_FISHING);
registerEnum(L, SKILL_MINING);
registerEnum(L, SKILL_CRITICAL_HIT_CHANCE);
registerEnum(L, SKILL_CRITICAL_HIT_DAMAGE);
registerEnum(L, SKILL_LIFE_LEECH_CHANCE);
Expand Down
10 changes: 5 additions & 5 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3503,9 +3503,9 @@ void ProtocolGame::sendCyclopediaCharacterGeneralStats() {
msg.add<uint16_t>(player->getBaseMagicLevel());
msg.add<uint16_t>(player->getLoyaltyMagicLevel());
msg.add<uint16_t>(player->getMagicLevelPercent() * 100);

/*HARDCODED? the values are right?*/
for (uint8_t i = SKILL_FIRST; i < SKILL_CRITICAL_HIT_CHANCE; ++i) {
static const uint8_t HardcodedSkillIds[] = { 11, 9, 8, 10, 7, 6, 13 };
static const uint8_t HardcodedSkillIds[] = { 12, 10, 9, 11, 8, 7, 14 };
const auto skill = static_cast<skills_t>(i);
msg.addByte(HardcodedSkillIds[i]);
msg.add<uint16_t>(std::min<int32_t>(player->getSkillLevel(skill), std::numeric_limits<uint16_t>::max()));
Expand Down Expand Up @@ -5844,7 +5844,7 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId, uint8_t tier) {
std::ostringstream ss;
bool separator = false;

for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_MINING; i++) {
if (!it.abilities->skills[i]) {
continue;
}
Expand Down Expand Up @@ -7804,7 +7804,7 @@ void ProtocolGame::AddPlayerSkills(NetworkMessage &msg) {
msg.addByte(0xA1);

if (oldProtocol) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; ++i) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_MINING; ++i) {
skills_t skill = static_cast<skills_t>(i);
msg.add<uint16_t>(std::min<int32_t>(player->getSkillLevel(skill), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(player->getBaseSkill(skill));
Expand All @@ -7816,7 +7816,7 @@ void ProtocolGame::AddPlayerSkills(NetworkMessage &msg) {
msg.add<uint16_t>(player->getLoyaltyMagicLevel());
msg.add<uint16_t>(player->getMagicLevelPercent() * 100);

for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; ++i) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_MINING; ++i) {
skills_t skill = static_cast<skills_t>(i);
msg.add<uint16_t>(std::min<int32_t>(player->getSkillLevel(skill), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(player->getBaseSkill(skill));
Expand Down
Loading

0 comments on commit 9427a81

Please sign in to comment.