L2JMobius

Free Users => Solved/Invalid Bug Reports => Topic started by: veriongt on April 13, 2024, 06:41:18 PM

Title: Stats not updating
Post by: veriongt on April 13, 2024, 06:41:18 PM
I wish to bring to your attention an issue regarding the updating of  player statistics upon entering world.
It has come to my notice that there is a discrepancy wherein the player statistics fail to update accurately in accordance with the items equipped.
The statistics fail to reflect the changes until a manual process of unequipping and re-equipping the weapon or shirt is performed.
Anyone has any idea why?
Title: Re: Stats not updating
Post by: veriongt on April 14, 2024, 04:28:18 AM
Found the solution about the problem not updating the stats on enter world mainly for weapon passive and jews e.t.c on items.java

Link with the patch : https://mega.nz/file/gUdQwbia#Zv7fBU_E6-Hn7ePbMqDPMpasOTOOrafqUrTvKgPsz08 (https://mega.nz/file/gUdQwbia#Zv7fBU_E6-Hn7ePbMqDPMpasOTOOrafqUrTvKgPsz08)
Title: Re: Stats not updating
Post by: Mobius on April 14, 2024, 04:39:15 AM
This part is a packet spam hazard.
Code: [Select]
player.sendPacket(new SkillCoolTime(player));Did you test without it? SkillCoolTime is already sent with EnterWorld packet.

hasPassiveSkills must be called before getActingPlayer.


Code: [Select]
Index: java/org/l2jmobius/gameserver/model/item/instance/Item.java
===================================================================
--- java/org/l2jmobius/gameserver/model/item/instance/Item.java (revision 13723)
+++ java/org/l2jmobius/gameserver/model/item/instance/Item.java (working copy)
@@ -2049,23 +2049,36 @@
 
  public void giveSkillsToOwner()
  {
- if (!hasPassiveSkills())
+ if (!isEquipped() && !hasPassiveSkills())
  {
  return;
  }
 
  final Player player = getActingPlayer();
- if (player != null)
+ if (player == null)
  {
- _itemTemplate.forEachSkill(ItemSkillType.NORMAL, holder ->
+ return;
+ }
+
+ _itemTemplate.forEachSkill(ItemSkillType.NORMAL, holder ->
+ {
+ final Skill skill = holder.getSkill();
+ if (skill.isPassive())
  {
- final Skill skill = holder.getSkill();
- if (skill.isPassive())
- {
- player.addSkill(skill, false);
- }
- });
- }
+ player.addSkill(skill, false);
+ }
+ });
+
+ _itemTemplate.forEachSkill(ItemSkillType.ON_ENCHANT, holder ->
+ {
+ final Skill skill = holder.getSkill();
+ if (skill.isPassive() && (getEnchantLevel() >= holder.getValue()))
+ {
+ player.addSkill(skill, false);
+ }
+ });
+
+ // player.sendPacket(new SkillCoolTime(player));
  }
 
  public void removeSkillsFromOwner()
Title: Re: Stats not updating
Post by: veriongt on April 14, 2024, 05:24:32 AM
Worked as intended thanks for the correction
Title: Re: Stats not updating
Post by: Mobius on April 15, 2024, 12:35:08 AM
Fixed with https://bitbucket.org/MobiusDev/l2j_mobius/commits/19522ce00e559c33426e2a28d7f7c24699c5e8f4
Thanks :D