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)
This commit is contained in:
Collin Smith
2020-01-07 01:09:27 -08:00
parent ec63e6806d
commit f685184c3c
3 changed files with 12 additions and 12 deletions

View File

@ -239,8 +239,8 @@ public class CharData {
skills.clear(); skills.clear();
skills.putAll(defaultSkills); skills.putAll(defaultSkills);
Item LARM = getEquipped(BodyLoc.getAlternate(BodyLoc.LARM, alternate)); Item LARM = getEquipped(BodyLoc.LARM);
Item RARM = getEquipped(BodyLoc.getAlternate(BodyLoc.RARM, alternate)); Item RARM = getEquipped(BodyLoc.RARM);
if ((LARM != null && LARM.typeEntry.Throwable) if ((LARM != null && LARM.typeEntry.Throwable)
|| (RARM != null && RARM.typeEntry.Throwable)) { || (RARM != null && RARM.typeEntry.Throwable)) {
skills.put(throw_, 1); skills.put(throw_, 1);
@ -366,12 +366,12 @@ public class CharData {
return store.get(storeLoc); return store.get(storeLoc);
} }
public Item getEquipped(BodyLoc bodyLoc) { public Item getSlot(BodyLoc bodyLoc) {
return equipped.get(bodyLoc); return equipped.get(bodyLoc);
} }
public Item getEquipped2(BodyLoc bodyLoc) { public Item getEquipped(BodyLoc bodyLoc) {
return getEquipped(BodyLoc.getAlternate(bodyLoc, d2s.header.alternate)); return getSlot(BodyLoc.getAlternate(bodyLoc, d2s.header.alternate));
} }
public Item setEquipped(BodyLoc bodyLoc, Item item) { public Item setEquipped(BodyLoc bodyLoc, Item item) {
@ -394,8 +394,8 @@ public class CharData {
public void setAlternate(int alternate) { public void setAlternate(int alternate) {
if (d2s.header.alternate != alternate) { if (d2s.header.alternate != alternate) {
d2s.header.alternate = alternate; d2s.header.alternate = alternate;
Item LH = getEquipped(alternate > 0 ? BodyLoc.LARM2 : BodyLoc.LARM); Item LH = getEquipped(BodyLoc.LARM);
Item RH = getEquipped(alternate > 0 ? BodyLoc.RARM2 : BodyLoc.RARM); Item RH = getEquipped(BodyLoc.RARM);
updateStats(); updateStats();
notifyEquippedAlternated(alternate, LH, RH); notifyEquippedAlternated(alternate, LH, RH);
} }

View File

@ -60,7 +60,7 @@ public class PlayerItemHandler extends BaseEntitySystem implements CharData.Equi
private void updateWeaponClass(int entityId, CharData charData, CofReference reference) { private void updateWeaponClass(int entityId, CharData charData, CofReference reference) {
Item RH = null, LH = null, SH = null; Item RH = null, LH = null, SH = null;
Item rArm = charData.getEquipped2(BodyLoc.RARM); Item rArm = charData.getEquipped(BodyLoc.RARM);
if (rArm != null) { if (rArm != null) {
if (rArm.type.is(com.riiablo.item.Type.WEAP)) { if (rArm.type.is(com.riiablo.item.Type.WEAP)) {
RH = rArm; 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 != null) {
if (lArm.type.is(com.riiablo.item.Type.WEAP)) { if (lArm.type.is(com.riiablo.item.Type.WEAP)) {
LH = lArm; LH = lArm;
@ -135,11 +135,11 @@ public class PlayerItemHandler extends BaseEntitySystem implements CharData.Equi
private void updateArmorClass(int entityId, CharData charData) { private void updateArmorClass(int entityId, CharData charData) {
int transformFlags = 0; 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); 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); 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) { if (body != null) {
Armor.Entry armor = body.getBase(); Armor.Entry armor = body.getBase();
cofs.setComponent(entityId, COF.Component.TR, (armor.Torso + 1)); cofs.setComponent(entityId, COF.Component.TR, (armor.Torso + 1));

View File

@ -215,7 +215,7 @@ public class InventoryPanel extends WidgetGroup implements Disposable {
for (int i = BodyLocs.HEAD; i < BodyLocs.NUM_LOCS; i++) { for (int i = BodyLocs.HEAD; i < BodyLocs.NUM_LOCS; i++) {
if (bodyParts[i] == null) continue; if (bodyParts[i] == null) continue;
bodyParts[i].slot = i; 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); bodyParts[i].setBodyPart(Riiablo.files.bodylocs.get(i).Code);
} }