Additional work for Issue , added skills last night now item stats are now added to the skill base

This commit is contained in:
Emagi 2022-07-05 07:30:15 -04:00
parent 3ee72ae22e
commit 5c969ba508
3 changed files with 27 additions and 2 deletions
EQ2/source/WorldServer

View file

@ -721,7 +721,14 @@ int8 Entity::DetermineHit(Spawn* victim, int8 damage_type, float ToHitBonus, boo
Skill* master_skill = GetSkillByID(lua_spell->spell->GetSpellData()->mastery_skill, true);
if(master_skill && (lua_spell->spell->GetSpellData()->spell_book_type == SPELL_BOOK_TYPE_TRADESKILL ||
((master_skill->name.data == "Subjugation" || master_skill->name.data == "Disruption" || master_skill->name.data == "Ordination" || master_skill->name.data == "Aggression")))) {
bonus += master_skill->current_val / master_skill_reduce;
float item_stat_bonus = 0.0f;
int32 item_stat = master_item_list.GetItemStatIDByName(::ToLower(master_skill->name.data));
if(item_stat != 0xFFFFFFFF) {
MStats.lock();
item_stat_bonus = GetStat(item_stat);
MStats.unlock();
}
bonus += (master_skill->current_val + item_stat_bonus) / master_skill_reduce;
}
}

View file

@ -1808,6 +1808,15 @@ public:
sint32 CalculateFormulaByStat(sint32 value, int16 stat);
int32 CalculateFormulaByStat(int32 value, int16 stat);
int32 CalculateFormulaBonus(int32 value, float percent_bonus);
float GetStat(int32 item_stat) {
float item_chance_or_skill = 0.0f;
MStats.lock();
item_chance_or_skill = stats[item_stat];
MStats.unlock();
return item_chance_or_skill;
}
// when PacketStruct is fixed for C++17 this should become a shared_mutex and handle read/write lock
std::mutex MEquipment;
std::mutex MStats;

View file

@ -1263,7 +1263,16 @@ int16 Spell::GetPowerRequired(Spawn* spawn){
int32 ministration_skill_reduce = rule_manager.GetGlobalRule(R_Spells, MinistrationPowerReductionSkill)->GetInt32();
if(ministration_skill_reduce < 1)
ministration_skill_reduce = 25;
float reduction = skill->current_val / ministration_skill_reduce;
float item_stat_bonus = 0.0f;
int32 item_stat = master_item_list.GetItemStatIDByName(::ToLower(skill->name.data));
if(item_stat != 0xFFFFFFFF) {
((Entity*)spawn)->MStats.lock();
item_stat_bonus = ((Entity*)spawn)->GetStat(item_stat);
((Entity*)spawn)->MStats.unlock();
}
float reduction = (skill->current_val + item_stat_bonus) / ministration_skill_reduce;
if(reduction > ministry_reduction_percent)
reduction = ministry_reduction_percent;