Skip to content
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a344521
crash
PkllonG Oct 10, 2025
6f61630
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 10, 2025
52b215e
ObjectGuid const&
PkllonG Oct 10, 2025
54a0e9d
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 11, 2025
1fdccaa
Update Spell.cpp
PkllonG Oct 11, 2025
bad110b
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 11, 2025
4ccc606
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 11, 2025
f4f4d75
optimization
PkllonG Oct 12, 2025
762785d
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 13, 2025
3decde6
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 13, 2025
7952f51
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 14, 2025
e5cc732
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 16, 2025
c9e7e17
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 18, 2025
2c37be6
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 23, 2025
eb48cae
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 25, 2025
b73d1b5
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 26, 2025
03d1bba
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 27, 2025
eaa66eb
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 28, 2025
d1fa1c7
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 30, 2025
2701fb5
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 30, 2025
20cd7b8
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 31, 2025
084d3bb
Merge branch 'master' into Fix-the-crash-2
PkllonG Oct 31, 2025
1ae56f6
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 2, 2025
982f785
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 5, 2025
1226450
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 5, 2025
f5018bb
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 6, 2025
761ff83
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 7, 2025
3806c1e
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 8, 2025
618db3f
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 9, 2025
d2bb794
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 10, 2025
20b89b8
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 11, 2025
0744bfd
Merge branch 'master' into Fix-the-crash-2
PkllonG Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/server/game/Entities/Player/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -2071,8 +2071,8 @@ class Player : public Unit, public GridObject<Player>
void UpdateLocalChannels(uint32 newZone);

void UpdateDefense();
void UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* item = nullptr);
void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, Item* item = nullptr);
void UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, ObjectGuid const& itemGuid = ObjectGuid::Empty);
void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, ObjectGuid const& itemGuid = ObjectGuid::Empty);

void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal);
[[nodiscard]] uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus
Expand Down
13 changes: 8 additions & 5 deletions src/server/game/Entities/Player/PlayerUpdates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
return false;
}

void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* item /*= nullptr*/)
void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, ObjectGuid const& itemGuid /*= ObjectGuid::Empty*/)
{
if (IsInFeralForm())
return; // always maximized SKILL_FERAL_COMBAT in fact
Expand All @@ -992,9 +992,12 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* ite
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);

Item* tmpitem = GetWeaponForAttack(attType, true);
if (item && item != tmpitem && !item->IsBroken())
ObjectGuid tmpitemGUID = tmpitem ? tmpitem->GetGUID() : ObjectGuid::Empty;
if (itemGuid != ObjectGuid::Empty && itemGuid != tmpitemGUID)
{
tmpitem = item;
Item* item = GetItemByGuid(itemGuid);
if (item && !item->IsBroken())
tmpitem = item;
}

if (!tmpitem && attType == BASE_ATTACK)
Expand Down Expand Up @@ -1022,7 +1025,7 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* ite
UpdateAllCritPercentages();
}

void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, Item* item /*= nullptr*/)
void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, ObjectGuid const& itemGuid /*= ObjectGuid::Empty*/)
{
uint8 playerLevel = GetLevel();
uint16 currentSkillValue = defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType);
Expand Down Expand Up @@ -1071,7 +1074,7 @@ void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool def
}
else
{
UpdateWeaponSkill(victim, attType, item);
UpdateWeaponSkill(victim, attType, itemGuid);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16081,7 +16081,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
// On melee based hit/miss/resist/parry/dodge need to update skill (for victim and attacker)
if (procExtra & (PROC_EX_NORMAL_HIT | PROC_EX_MISS | PROC_EX_RESIST | PROC_EX_PARRY | PROC_EX_DODGE))
{
ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItem : nullptr);
ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItemGUID : ObjectGuid::Empty);
}
// Update defence if player is victim and we block - TODO: confirm that blocked attacks only have a chance to increase defence skill
else if (isVictim && procExtra & (PROC_EX_BLOCK))
Expand Down
7 changes: 5 additions & 2 deletions src/server/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags,
// xinef:
_spellTargetsSelected = false;

m_weaponItem = nullptr;
m_weaponItemGUID = ObjectGuid::Empty;
}

Spell::~Spell()
Expand Down Expand Up @@ -7691,7 +7691,10 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND;
}

m_weaponItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true);
if (Item* weaponItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true))
m_weaponItemGUID = weaponItem->GetGUID();
else
m_weaponItemGUID = ObjectGuid::Empty;
}

return SPELL_CAST_OK;
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Spells/Spell.h
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ class Spell

SpellInfo const* const m_spellInfo;
Item* m_CastItem;
Item* m_weaponItem;
ObjectGuid m_weaponItemGUID;
ObjectGuid m_castItemGUID;
uint8 m_cast_count;
uint32 m_glyphIndex;
Expand Down