Reworked available brooch jewel logic.
This commit is contained in:
@@ -21,26 +21,28 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2);
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -57,4 +59,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-44
@@ -8949,55 +8949,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
@@ -840,6 +840,23 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] == null;
|
return _paperdoll[slot] == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPaperdollSlotNotEmpty(int slot)
|
||||||
|
{
|
||||||
|
return _paperdoll[slot] != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(int slot)
|
public static int getPaperdollIndex(int slot)
|
||||||
{
|
{
|
||||||
switch (slot)
|
switch (slot)
|
||||||
|
|||||||
@@ -21,26 +21,28 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2);
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -57,4 +59,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-44
@@ -8956,55 +8956,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
@@ -870,6 +870,23 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] == null;
|
return _paperdoll[slot] == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPaperdollSlotNotEmpty(int slot)
|
||||||
|
{
|
||||||
|
return _paperdoll[slot] != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(int slot)
|
public static int getPaperdollIndex(int slot)
|
||||||
{
|
{
|
||||||
switch (slot)
|
switch (slot)
|
||||||
|
|||||||
@@ -21,28 +21,30 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
GREATER_RUBY(47688, 17817, 0.2),
|
GREATER_RUBY(47688, 18715, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2),
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false),
|
||||||
GREATER_SHAPPHIRE(47689, 17821, 0.2);
|
GREATER_SHAPPHIRE(47689, 18718, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -59,4 +61,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-52
@@ -8958,63 +8958,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.GREATER_RUBY);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.GREATER_SHAPPHIRE);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
@@ -870,6 +870,23 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] == null;
|
return _paperdoll[slot] == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPaperdollSlotNotEmpty(int slot)
|
||||||
|
{
|
||||||
|
return _paperdoll[slot] != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(int slot)
|
public static int getPaperdollIndex(int slot)
|
||||||
{
|
{
|
||||||
switch (slot)
|
switch (slot)
|
||||||
|
|||||||
@@ -21,28 +21,30 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
GREATER_RUBY(47688, 17817, 0.2),
|
GREATER_RUBY(47688, 18715, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2),
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false),
|
||||||
GREATER_SHAPPHIRE(47689, 17821, 0.2);
|
GREATER_SHAPPHIRE(47689, 18718, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -59,4 +61,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-52
@@ -8956,63 +8956,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.GREATER_RUBY);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.GREATER_SHAPPHIRE);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
@@ -870,6 +870,23 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] == null;
|
return _paperdoll[slot] == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPaperdollSlotNotEmpty(int slot)
|
||||||
|
{
|
||||||
|
return _paperdoll[slot] != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(int slot)
|
public static int getPaperdollIndex(int slot)
|
||||||
{
|
{
|
||||||
switch (slot)
|
switch (slot)
|
||||||
|
|||||||
@@ -21,28 +21,30 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
GREATER_RUBY(47688, 17817, 0.2),
|
GREATER_RUBY(47688, 18715, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2),
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false),
|
||||||
GREATER_SHAPPHIRE(47689, 17821, 0.2);
|
GREATER_SHAPPHIRE(47689, 18718, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -59,4 +61,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-52
@@ -8942,63 +8942,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.GREATER_RUBY);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.GREATER_SHAPPHIRE);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
@@ -909,6 +909,18 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] != null;
|
return _paperdoll[slot] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(long slot)
|
public static int getPaperdollIndex(long slot)
|
||||||
{
|
{
|
||||||
if (slot == Item.SLOT_UNDERWEAR)
|
if (slot == Item.SLOT_UNDERWEAR)
|
||||||
|
|||||||
@@ -21,28 +21,30 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
GREATER_RUBY(47688, 17817, 0.2),
|
GREATER_RUBY(47688, 18715, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2),
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false),
|
||||||
GREATER_SHAPPHIRE(47689, 17821, 0.2);
|
GREATER_SHAPPHIRE(47689, 18718, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -59,4 +61,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-52
@@ -8942,63 +8942,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.GREATER_RUBY);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.GREATER_SHAPPHIRE);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
@@ -978,6 +978,18 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] != null;
|
return _paperdoll[slot] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(long slot)
|
public static int getPaperdollIndex(long slot)
|
||||||
{
|
{
|
||||||
if (slot == Item.SLOT_UNDERWEAR)
|
if (slot == Item.SLOT_UNDERWEAR)
|
||||||
|
|||||||
@@ -21,28 +21,38 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
GREATER_RUBY(47688, 17817, 0.2),
|
GREATER_RUBY_LV1(47688, 18715, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
GREATER_RUBY_LV2(48771, 18715, 0.235, true),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
GREATER_RUBY_LV3(48772, 18715, 0.275, true),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
GREATER_RUBY_LV4(48773, 18715, 0.325, true),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
GREATER_RUBY_LV5(48774, 18715, 0.4, true),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
GREATER_SHAPPHIRE(47689, 17821, 0.2);
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false),
|
||||||
|
GREATER_SHAPPHIRE_LV1(47689, 18718, 0.2, false),
|
||||||
|
GREATER_SHAPPHIRE_LV2(48775, 18718, 0.235, false),
|
||||||
|
GREATER_SHAPPHIRE_LV3(48776, 18718, 0.275, false),
|
||||||
|
GREATER_SHAPPHIRE_LV4(48777, 18718, 0.325, false),
|
||||||
|
GREATER_SHAPPHIRE_LV5(48778, 18718, 0.4, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -59,4 +69,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-52
@@ -8943,63 +8943,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_RUBY.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.GREATER_RUBY);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.GREATER_SHAPPHIRE.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.GREATER_SHAPPHIRE);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
@@ -978,6 +978,18 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] != null;
|
return _paperdoll[slot] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(long slot)
|
public static int getPaperdollIndex(long slot)
|
||||||
{
|
{
|
||||||
if (slot == Item.SLOT_UNDERWEAR)
|
if (slot == Item.SLOT_UNDERWEAR)
|
||||||
|
|||||||
+18
-11
@@ -21,26 +21,28 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2);
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -57,4 +59,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-44
@@ -8894,55 +8894,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
@@ -870,6 +870,23 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] == null;
|
return _paperdoll[slot] == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPaperdollSlotNotEmpty(int slot)
|
||||||
|
{
|
||||||
|
return _paperdoll[slot] != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(int slot)
|
public static int getPaperdollIndex(int slot)
|
||||||
{
|
{
|
||||||
switch (slot)
|
switch (slot)
|
||||||
|
|||||||
@@ -21,26 +21,28 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2);
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -57,4 +59,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-44
@@ -8895,55 +8895,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
@@ -870,6 +870,23 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] == null;
|
return _paperdoll[slot] == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPaperdollSlotNotEmpty(int slot)
|
||||||
|
{
|
||||||
|
return _paperdoll[slot] != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(int slot)
|
public static int getPaperdollIndex(int slot)
|
||||||
{
|
{
|
||||||
switch (slot)
|
switch (slot)
|
||||||
|
|||||||
+18
-11
@@ -21,26 +21,28 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2);
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -57,4 +59,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-44
@@ -8880,55 +8880,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
@@ -909,6 +909,18 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] != null;
|
return _paperdoll[slot] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(long slot)
|
public static int getPaperdollIndex(long slot)
|
||||||
{
|
{
|
||||||
if (slot == Item.SLOT_UNDERWEAR)
|
if (slot == Item.SLOT_UNDERWEAR)
|
||||||
|
|||||||
+18
-11
@@ -21,26 +21,28 @@ package com.l2jmobius.gameserver.enums;
|
|||||||
*/
|
*/
|
||||||
public enum BroochJewel
|
public enum BroochJewel
|
||||||
{
|
{
|
||||||
RUBY_LV1(38855, 17814, 0.01),
|
RUBY_LV1(38855, 17814, 0.01, true),
|
||||||
RUBY_LV2(38856, 17814, 0.035),
|
RUBY_LV2(38856, 17814, 0.035, true),
|
||||||
RUBY_LV3(38857, 17815, 0.075),
|
RUBY_LV3(38857, 17815, 0.075, true),
|
||||||
RUBY_LV4(38858, 17816, 0.125),
|
RUBY_LV4(38858, 17816, 0.125, true),
|
||||||
RUBY_LV5(38859, 17817, 0.2),
|
RUBY_LV5(38859, 17817, 0.2, true),
|
||||||
SHAPPHIRE_LV1(38927, 17818, 0.01),
|
SHAPPHIRE_LV1(38927, 17818, 0.01, false),
|
||||||
SHAPPHIRE_LV2(38928, 17818, 0.035),
|
SHAPPHIRE_LV2(38928, 17818, 0.035, false),
|
||||||
SHAPPHIRE_LV3(38929, 17819, 0.075),
|
SHAPPHIRE_LV3(38929, 17819, 0.075, false),
|
||||||
SHAPPHIRE_LV4(38930, 17820, 0.125),
|
SHAPPHIRE_LV4(38930, 17820, 0.125, false),
|
||||||
SHAPPHIRE_LV5(38931, 17821, 0.2);
|
SHAPPHIRE_LV5(38931, 17821, 0.2, false);
|
||||||
|
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private int _effectId;
|
private int _effectId;
|
||||||
private double _bonus;
|
private double _bonus;
|
||||||
|
private boolean _isRuby; // If not, it is sapphire.
|
||||||
|
|
||||||
private BroochJewel(int itemId, int effectId, double bonus)
|
private BroochJewel(int itemId, int effectId, double bonus, boolean isRuby)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_effectId = effectId;
|
_effectId = effectId;
|
||||||
_bonus = bonus;
|
_bonus = bonus;
|
||||||
|
_isRuby = isRuby;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemId()
|
public int getItemId()
|
||||||
@@ -57,4 +59,9 @@ public enum BroochJewel
|
|||||||
{
|
{
|
||||||
return _bonus;
|
return _bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRuby()
|
||||||
|
{
|
||||||
|
return _isRuby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-44
@@ -8880,55 +8880,28 @@ public final class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void updateActiveBroochJewel()
|
public void updateActiveBroochJewel()
|
||||||
{
|
{
|
||||||
|
final BroochJewel[] broochJewels = BroochJewel.values();
|
||||||
// Update active Ruby jewel.
|
// Update active Ruby jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.RUBY_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(BroochJewel.RUBY_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveRubyJewel(null);
|
setActiveRubyJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveRubyJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update active Sapphire jewel.
|
// Update active Sapphire jewel.
|
||||||
if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV2.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV2);
|
|
||||||
}
|
|
||||||
else if ((_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()) != null) && (_inventory.getItemByItemId(BroochJewel.SHAPPHIRE_LV1.getItemId()).isEquipped()))
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setActiveShappireJewel(null);
|
setActiveShappireJewel(null);
|
||||||
|
for (int i = broochJewels.length - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
final BroochJewel jewel = broochJewels[i];
|
||||||
|
if (!jewel.isRuby() && _inventory.isItemEquipped(jewel.getItemId()))
|
||||||
|
{
|
||||||
|
setActiveShappireJewel(jewel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
@@ -978,6 +978,18 @@ public abstract class Inventory extends ItemContainer
|
|||||||
return _paperdoll[slot] != null;
|
return _paperdoll[slot] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isItemEquipped(int itemId)
|
||||||
|
{
|
||||||
|
for (ItemInstance item : getItemsByItemId(itemId))
|
||||||
|
{
|
||||||
|
if (item.isEquipped())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPaperdollIndex(long slot)
|
public static int getPaperdollIndex(long slot)
|
||||||
{
|
{
|
||||||
if (slot == Item.SLOT_UNDERWEAR)
|
if (slot == Item.SLOT_UNDERWEAR)
|
||||||
|
|||||||
Reference in New Issue
Block a user