From f685184c3cc2028b54dd1c40459cad9886eaacee Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Tue, 7 Jan 2020 01:09:27 -0800 Subject: [PATCH] Changed some method names Renamed getEquipped to getSlot since this returns the equipped item at the specified slot Renamed getEquipped2 to getEquipped since this will return the item at the properly alternated slot (the equipped item) --- core/src/com/riiablo/CharData.java | 14 +++++++------- .../riiablo/engine/server/PlayerItemHandler.java | 8 ++++---- .../com/riiablo/screen/panel/InventoryPanel.java | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/src/com/riiablo/CharData.java b/core/src/com/riiablo/CharData.java index 1c8e9bc7..40772874 100644 --- a/core/src/com/riiablo/CharData.java +++ b/core/src/com/riiablo/CharData.java @@ -239,8 +239,8 @@ public class CharData { skills.clear(); skills.putAll(defaultSkills); - Item LARM = getEquipped(BodyLoc.getAlternate(BodyLoc.LARM, alternate)); - Item RARM = getEquipped(BodyLoc.getAlternate(BodyLoc.RARM, alternate)); + Item LARM = getEquipped(BodyLoc.LARM); + Item RARM = getEquipped(BodyLoc.RARM); if ((LARM != null && LARM.typeEntry.Throwable) || (RARM != null && RARM.typeEntry.Throwable)) { skills.put(throw_, 1); @@ -366,12 +366,12 @@ public class CharData { return store.get(storeLoc); } - public Item getEquipped(BodyLoc bodyLoc) { + public Item getSlot(BodyLoc bodyLoc) { return equipped.get(bodyLoc); } - public Item getEquipped2(BodyLoc bodyLoc) { - return getEquipped(BodyLoc.getAlternate(bodyLoc, d2s.header.alternate)); + public Item getEquipped(BodyLoc bodyLoc) { + return getSlot(BodyLoc.getAlternate(bodyLoc, d2s.header.alternate)); } public Item setEquipped(BodyLoc bodyLoc, Item item) { @@ -394,8 +394,8 @@ public class CharData { public void setAlternate(int alternate) { if (d2s.header.alternate != alternate) { d2s.header.alternate = alternate; - Item LH = getEquipped(alternate > 0 ? BodyLoc.LARM2 : BodyLoc.LARM); - Item RH = getEquipped(alternate > 0 ? BodyLoc.RARM2 : BodyLoc.RARM); + Item LH = getEquipped(BodyLoc.LARM); + Item RH = getEquipped(BodyLoc.RARM); updateStats(); notifyEquippedAlternated(alternate, LH, RH); } diff --git a/core/src/com/riiablo/engine/server/PlayerItemHandler.java b/core/src/com/riiablo/engine/server/PlayerItemHandler.java index e0f93392..c3816391 100644 --- a/core/src/com/riiablo/engine/server/PlayerItemHandler.java +++ b/core/src/com/riiablo/engine/server/PlayerItemHandler.java @@ -60,7 +60,7 @@ public class PlayerItemHandler extends BaseEntitySystem implements CharData.Equi private void updateWeaponClass(int entityId, CharData charData, CofReference reference) { Item RH = null, LH = null, SH = null; - Item rArm = charData.getEquipped2(BodyLoc.RARM); + Item rArm = charData.getEquipped(BodyLoc.RARM); if (rArm != null) { if (rArm.type.is(com.riiablo.item.Type.WEAP)) { RH = rArm; @@ -69,7 +69,7 @@ public class PlayerItemHandler extends BaseEntitySystem implements CharData.Equi } } - Item lArm = charData.getEquipped2(BodyLoc.LARM); + Item lArm = charData.getEquipped(BodyLoc.LARM); if (lArm != null) { if (lArm.type.is(com.riiablo.item.Type.WEAP)) { LH = lArm; @@ -135,11 +135,11 @@ public class PlayerItemHandler extends BaseEntitySystem implements CharData.Equi private void updateArmorClass(int entityId, CharData charData) { int transformFlags = 0; - Item head = charData.getEquipped(BodyLoc.HEAD); + Item head = charData.getSlot(BodyLoc.HEAD); cofs.setComponent(entityId, COF.Component.HD, head != null ? Class.Type.PLR.getComponent(head.base.alternateGfx) : CofComponents.COMPONENT_LIT); transformFlags |= cofs.setTransform(entityId, COF.Component.HD, head != null ? (byte) ((head.base.Transform << 5) | (head.charColorIndex & 0x1F)) : CofTransforms.TRANSFORM_NULL); - Item body = charData.getEquipped(BodyLoc.TORS); + Item body = charData.getSlot(BodyLoc.TORS); if (body != null) { Armor.Entry armor = body.getBase(); cofs.setComponent(entityId, COF.Component.TR, (armor.Torso + 1)); diff --git a/core/src/com/riiablo/screen/panel/InventoryPanel.java b/core/src/com/riiablo/screen/panel/InventoryPanel.java index a4bea18b..4ba4736e 100644 --- a/core/src/com/riiablo/screen/panel/InventoryPanel.java +++ b/core/src/com/riiablo/screen/panel/InventoryPanel.java @@ -215,7 +215,7 @@ public class InventoryPanel extends WidgetGroup implements Disposable { for (int i = BodyLocs.HEAD; i < BodyLocs.NUM_LOCS; i++) { if (bodyParts[i] == null) continue; bodyParts[i].slot = i; - bodyParts[i].item = Riiablo.charData.getEquipped(BodyLoc.valueOf(i)); + bodyParts[i].item = Riiablo.charData.getSlot(BodyLoc.valueOf(i)); bodyParts[i].setBodyPart(Riiablo.files.bodylocs.get(i).Code); }