L2JMobius

The Kamael Costume jewelry doesn't add MP

expert43 · 2 · 5143

Offline expert43

  • Vassal
  • *
    • Posts: 2
Costume jewelry does not add MP, however, as well as other items. As I understand it doesn't work on all your builds except HF
Code: [Select]
<item id="893" name="Majestic Ring" type="Armor">
<!-- Majestic Ring. Provides additional MP +17. -->
<set name="icon" val="icon.accessary_inferno_ring_i00" />
<set name="default_action" val="EQUIP" />
<set name="bodypart" val="rfinger;lfinger" />
<set name="immediate_effect" val="true" />
<set name="crystal_count" val="80" />
<set name="crystal_type" val="A" />
<set name="material" val="GOLD" />
<set name="weight" val="150" />
<set name="price" val="999000" />
<set name="commissionItemType" val="RING" />
<set name="enchant_enabled" val="1" />
<stats>
<stat type="mDef">42</stat>
<stat type="maxMp">17</stat>
</stats>
</item>

as I understand it the parameter doesn't work "<stat type="maxMp">17</stat>" although the same parameter "<stat type="mDef">42</stat>" work.
https://drive.google.com/open?id=1uGhk4qaWT-f9y3GN43HXYVz5Ah8p38Ph
https://drive.google.com/open?id=1gN-DB8MSWG6vNKbMQngN1gG2BDPJFhsC


Offline Helionar

  • Heir
  • **
    • Posts: 38
MaxMpFinalizer doesn't take the maxMP parameter of the items into account. Maybe it's calculated outside it in the private version, but it is not working at all on the Free one.

This should fix it:

Code: [Select]
diff --git a/java/org/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/java/org/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java
index 15296e78ea8056757ad8d3c0baf2c2f998fc2a24..59fb0d319dad9999d6f8516c537a4fe09808436d 100644
--- a/java/org/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java
+++ b/java/org/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java
@@ -21,6 +21,7 @@ import java.util.OptionalDouble;
 import org.l2jmobius.gameserver.model.actor.Creature;
 import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
 import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
 import org.l2jmobius.gameserver.model.stats.BaseStat;
 import org.l2jmobius.gameserver.model.stats.IStatFunction;
 import org.l2jmobius.gameserver.model.stats.Stat;
@@ -47,6 +48,12 @@ public class MaxMpFinalizer implements IStatFunction
  if (player != null)
  {
  baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
+
+ // Add MaxMP bonus from items
+ for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEquipped))
+ {
+ baseValue += item.getItem().getStats(stat, 0);
+ }
  }
  }
  final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;

Cheers!