Search in sources :

Example 1 with DC_JewelryObj

use of eidolons.entity.item.DC_JewelryObj in project Eidolons by IDemiurge.

the class UnitShop method equip.

private static void equip(Unit unit, DC_HeroItemObj item, ITEM_SLOT slot) {
    if (slot != null) {
        if (!unit.equip(item, slot)) {
            LogMaster.log(1, unit.getName() + " failed to equip " + item.getName());
        }
    } else {
        if (item instanceof DC_JewelryObj) {
            unit.addJewelryItem((DC_JewelryObj) item);
        } else {
            if (item instanceof DC_QuickItemObj) {
                unit.getQuickItems().add((DC_QuickItemObj) item);
            } else {
                DC_HeroItemObj itemObj = ItemFactory.createItemObj(item.getType(), unit.getOriginalOwner(), unit.getGame(), unit.getRef(), true);
                unit.getQuickItems().add((DC_QuickItemObj) itemObj);
            }
        }
    }
}
Also used : DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) DC_JewelryObj(eidolons.entity.item.DC_JewelryObj)

Example 2 with DC_JewelryObj

use of eidolons.entity.item.DC_JewelryObj in project Eidolons by IDemiurge.

the class DC_HeroManager method addJewelryItem.

@Override
protected int addJewelryItem(Unit hero, Entity type) {
    DC_HeroItemObj item = null;
    if (type instanceof DC_JewelryObj) {
        item = (DC_HeroItemObj) type;
    } else {
        item = (DC_HeroItemObj) ObjUtilities.findObjByType(type, hero.getInventory());
    }
    int result = super.addJewelryItem(hero, type);
    if (result == 0) {
        return 0;
    }
    hero.addJewelryItem((DC_JewelryObj) item);
    hero.removeFromInventory(item);
    update(hero);
    return result;
}
Also used : DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) DC_JewelryObj(eidolons.entity.item.DC_JewelryObj)

Aggregations

DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)2 DC_JewelryObj (eidolons.entity.item.DC_JewelryObj)2 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)1