Search in sources :

Example 6 with DC_HeroItemObj

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

the class ContainerClickHandler method cellClicked.

@Override
public boolean cellClicked(CELL_TYPE cell_type, int clickCount, boolean rightClick, boolean altClick, Entity cellContents) {
    boolean result = false;
    // }
    if (cellContents == null) {
        GuiEventManager.trigger(GuiEventType.SHOW_LOOT_PANEL, null);
        return false;
    }
    if (unit.isInventoryFull()) {
        FloatingTextMaster.getInstance().createFloatingText(TEXT_CASES.DEFAULT, "Inventory is full!", unit);
        return false;
    }
    DC_HeroItemObj item = (DC_HeroItemObj) cellContents;
    container.getItems().remove(item);
    unit.addItemToInventory(item);
    result = true;
    if (result) {
        Pair<InventoryDataSource, ContainerDataSource> param = new ImmutablePair<>(new InventoryDataSource(unit), new ContainerDataSource(container, unit));
        GuiEventManager.trigger(GuiEventType.SHOW_LOOT_PANEL, param);
        GuiEventManager.trigger(GuiEventType.SHOW_LOOT_PANEL, param);
    }
    return result;
}
Also used : InventoryDataSource(eidolons.libgdx.gui.panels.dc.inventory.datasource.InventoryDataSource) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Example 7 with DC_HeroItemObj

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

the class HungItemMaster method actionActivated.

@Override
protected boolean actionActivated(HUNG_ITEM_ACTION sub, Unit unit, DungeonObj obj) {
    if (!(obj instanceof HungItem))
        return false;
    HungItem hungObj = ((HungItem) obj);
    switch(sub) {
        case TAKE:
            DC_HeroItemObj item = hungObj.getItem();
            if (item == null) {
                item = generateItem(hungObj);
            }
            // quick slot?
            if (!unit.isQuickSlotsFull() && item instanceof DC_QuickItemObj) {
                unit.addQuickItem((DC_QuickItemObj) item);
            } else {
                unit.addItemToInventory(item);
            }
            GuiEventManager.trigger(GuiEventType.ITEM_TAKEN, hungObj);
            // take animation
            obj.kill(obj, false, true);
            break;
        case USE:
            break;
    }
    return true;
}
Also used : DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj)

Example 8 with DC_HeroItemObj

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

the class DroppedItemManager method findDroppedItem.

public DC_HeroItemObj findDroppedItem(String typeName, Coordinates coordinates) {
    Obj cell = game.getCellByCoordinate(coordinates);
    Obj item = new ListMaster<Obj>().findType(typeName, new ArrayList<>(getDroppedItems(cell)));
    return (DC_HeroItemObj) item;
}
Also used : Obj(main.entity.obj.Obj) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Example 9 with DC_HeroItemObj

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

the class DroppedItemManager method pickUp.

public boolean pickUp(Unit hero, Entity type) {
    Obj cell = game.getCellByCoordinate(hero.getCoordinates());
    DC_HeroItemObj item = (DC_HeroItemObj) ObjUtilities.findObjByType(type, getDroppedItems(cell));
    if (item == null) {
        return false;
    }
    pickUp(cell, item);
    return true;
}
Also used : Obj(main.entity.obj.Obj) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Example 10 with DC_HeroItemObj

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

the class DC_HeroManager method removeJewelryItem.

@Override
public void removeJewelryItem(Unit hero, Entity type) {
    DC_HeroItemObj item = (DC_HeroItemObj) ObjUtilities.findObjByType(type, hero.getJewelry());
    hero.removeJewelryItem(item);
    hero.addItemToInventory(item);
    update(hero);
}
Also used : DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj)

Aggregations

DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)29 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)7 Obj (main.entity.obj.Obj)6 Ref (main.entity.Ref)5 ObjType (main.entity.type.ObjType)5 DC_JewelryObj (eidolons.entity.item.DC_JewelryObj)3 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)3 Unit (eidolons.entity.obj.unit.Unit)3 ArrayList (java.util.ArrayList)3 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)2 Coordinates (main.game.bf.Coordinates)2 RandomWizard (main.system.auxiliary.RandomWizard)2 WeightMap (main.system.datatypes.WeightMap)2 CanActCondition (eidolons.ability.conditions.special.CanActCondition)1 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 DC_SpellObj (eidolons.entity.active.DC_SpellObj)1 DC_ArmorObj (eidolons.entity.item.DC_ArmorObj)1 DC_Cell (eidolons.entity.obj.DC_Cell)1