use of eidolons.entity.item.DC_WeaponObj in project Eidolons by IDemiurge.
the class InventoryTransactionManager method equipOriginalItems.
public static void equipOriginalItems(Unit to, Obj from) {
for (Obj i : to.getGame().getDroppedItemManager().getDroppedItems(to.getGame().getCellByCoordinate(to.getCoordinates()))) {
if (i.getRef().getSourceObj() == from) {
ITEM_SLOT slot = null;
if (i.getOBJ_TYPE_ENUM() == DC_TYPE.ARMOR) {
slot = ItemEnums.ITEM_SLOT.ARMOR;
} else {
if (from.getRef().getObj(KEYS.WEAPON) == i) {
slot = ItemEnums.ITEM_SLOT.MAIN_HAND;
} else if (from.getRef().getObj(KEYS.OFFHAND) == i) {
slot = ItemEnums.ITEM_SLOT.OFF_HAND;
}
}
if (slot == null) {
if (i instanceof DC_WeaponObj) {
DC_WeaponObj weaponObj = (DC_WeaponObj) i;
if (weaponObj.getWeaponClass() == ItemEnums.WEAPON_CLASS.MAIN_HAND_ONLY || weaponObj.getWeaponClass() == ItemEnums.WEAPON_CLASS.TWO_HANDED || weaponObj.getWeaponClass() == ItemEnums.WEAPON_CLASS.DOUBLE) {
slot = ItemEnums.ITEM_SLOT.MAIN_HAND;
} else if (to.getMainWeapon() != null) {
slot = ItemEnums.ITEM_SLOT.OFF_HAND;
} else {
slot = ItemEnums.ITEM_SLOT.MAIN_HAND;
}
}
}
// ITEM_SLOT.MAIN_HAND;
to.getGame().getDroppedItemManager().pickedUp(i);
i.setRef(to.getRef());
// equip() !
if (slot == null) {
to.getQuickItems().add((DC_QuickItemObj) i);
} else {
to.equip((DC_HeroItemObj) i, slot);
}
}
}
}
use of eidolons.entity.item.DC_WeaponObj in project Eidolons by IDemiurge.
the class AnimMaster3d method preloadAtlases.
public static void preloadAtlases(Unit unit) {
DC_WeaponObj weapon = unit.getWeapon(false);
if (weapon != null)
preloadAtlas(weapon);
weapon = unit.getWeapon(true);
if (weapon != null)
preloadAtlas(weapon);
weapon = unit.getNaturalWeapon(false);
if (weapon != null)
preloadAtlas(weapon);
weapon = unit.getNaturalWeapon(true);
if (weapon != null)
preloadAtlas(weapon);
for (DC_QuickItemObj sub : unit.getQuickItems()) {
if (sub.isAmmo()) {
preloadAtlas(sub.getWrappedWeapon());
} else {
if (sub.getWrappedWeapon() == null) {
String path = getPotionAtlasPath(sub.getActive());
preloadAtlas(path);
}
}
}
}
Aggregations