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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations