Proper fix for invisible equipped consumables.

This commit is contained in:
MobiusDevelopment 2020-04-07 07:49:47 +00:00
parent 959e40b3e4
commit 9fb6fb32bd
2 changed files with 11 additions and 129 deletions

View File

@ -176,6 +176,7 @@ final class DocumentItem extends DocumentBase
if (className.equals("Weapon"))
{
int bodypart = _slots.get(_currentItem.set.getString("bodypart"));
_currentItem.type = _weaponTypes.get(_currentItem.set.getString("weapon_type"));
// lets see if this is a shield
@ -218,14 +219,16 @@ final class DocumentItem extends DocumentBase
}
}
_currentItem.set.set("bodypart", Item.SLOT_R_HAND);
bodypart = Item.SLOT_R_HAND;
}
_currentItem.set.set("bodypart", bodypart);
}
else if (className.equals("Armor"))
{
_currentItem.type = _armorTypes.get(_currentItem.set.getString("armor_type"));
final int bodypart = _slots.get(_currentItem.set.getString("bodypart"));
int bodypart = _slots.get(_currentItem.set.getString("bodypart"));
if ((bodypart == Item.SLOT_NECK) || (bodypart == Item.SLOT_HAIR) || (bodypart == Item.SLOT_FACE) || (bodypart == Item.SLOT_DHAIR) || ((bodypart & Item.SLOT_L_EAR) != 0) || ((bodypart & Item.SLOT_L_FINGER) != 0))
{
_currentItem.set.set("type1", Item.TYPE1_WEAPON_RING_EARRING_NECKLACE);
@ -265,8 +268,10 @@ final class DocumentItem extends DocumentBase
}
}
_currentItem.set.set("bodypart", Item.SLOT_CHEST);
bodypart = Item.SLOT_CHEST;
}
_currentItem.set.set("bodypart", bodypart);
}
else
{

View File

@ -170,6 +170,7 @@ public abstract class Item
_weight = set.getInt("weight", 0);
_crystallizable = set.getBoolean("crystallizable", false);
_stackable = set.getBoolean("stackable", false);
switch (set.getString("crystal_type", ""))
{
case "d":
@ -203,133 +204,9 @@ public abstract class Item
break;
}
}
_duration = set.getInt("duration", -1);
switch (set.getString("bodypart", ""))
{
case "chest":
{
_bodyPart = SLOT_CHEST;
break;
}
case "fullarmor":
{
_bodyPart = SLOT_FULL_ARMOR;
break;
}
case "head":
{
_bodyPart = SLOT_HEAD;
break;
}
case "hair":
{
_bodyPart = SLOT_HAIR;
break;
}
case "face":
{
_bodyPart = SLOT_FACE;
break;
}
case "dhair":
{
_bodyPart = SLOT_DHAIR;
break;
}
case "underwear":
{
_bodyPart = SLOT_UNDERWEAR;
break;
}
case "back":
{
_bodyPart = SLOT_BACK;
break;
}
case "neck":
{
_bodyPart = SLOT_NECK;
break;
}
case "legs":
{
_bodyPart = SLOT_LEGS;
break;
}
case "feet":
{
_bodyPart = SLOT_FEET;
break;
}
case "gloves":
{
_bodyPart = SLOT_GLOVES;
break;
}
case "chest,legs":
{
_bodyPart = SLOT_CHEST | SLOT_LEGS;
break;
}
case "rhand":
{
_bodyPart = SLOT_R_HAND;
break;
}
case "lhand":
{
_bodyPart = SLOT_L_HAND;
break;
}
case "lrhand":
{
_bodyPart = SLOT_LR_HAND;
break;
}
case "rear,lear":
{
_bodyPart = SLOT_R_EAR | SLOT_L_EAR;
break;
}
case "rfinger,lfinger":
{
_bodyPart = SLOT_R_FINGER | SLOT_L_FINGER;
break;
}
case "wolf":
{
_bodyPart = SLOT_WOLF;
break;
}
case "hatchling":
{
_bodyPart = SLOT_HATCHLING;
break;
}
case "strider":
{
_bodyPart = SLOT_STRIDER;
break;
}
case "babypet":
{
_bodyPart = SLOT_BABYPET;
break;
}
default: // "none"
{
if (_name.contains(" Arrow") || _name.contains(" Lure")) // Tempfix for invisible equipped consumables.
{
_bodyPart = Item.SLOT_L_HAND; // TODO: Should be done on XML.
}
else
{
_bodyPart = SLOT_NONE;
}
break;
}
}
_duration = set.getInt("duration", -1);
_bodyPart = set.getInt("bodypart", SLOT_NONE);
_referencePrice = set.getInt("price", 0);
_crystalCount = set.getInt("crystal_count", 0);
_sellable = set.getBoolean("sellable", true);