/* Renders the actor's PaperDoll slots. */ void RenderEquipment(int x, int y) { if (manager.actor.doll == null) { return; } int iw = Width() / 4; int ih = Height() / 20; string str; PaperDoll doll = manager.actor.doll; Data eq = doll.Peek(PaperDoll.HEAD); str = "Head : " + (eq != null ? eq.displayName : ""); if (Button(str, x, y, iw, ih, 0, -5)) { doll.Store(PaperDoll.HEAD); } eq = manager.actor.doll.Peek(PaperDoll.TORSO); str = "Torso : " + (eq != null ? eq.displayName : ""); if (Button(str, x, y + ih, iw, ih, 0, -4)) { doll.Store(PaperDoll.TORSO); } eq = manager.actor.doll.Peek(PaperDoll.LEGS); str = "Legs : " + (eq != null ? eq.displayName : ""); if (Button(str, x, y + 2 * ih, iw, ih, 0, -3)) { doll.Store(PaperDoll.LEGS); } }
/* Deligates to actor */ void Equip(int slot, bool primary) { int status = inv.GetStatus(slot); PaperDoll doll = manager.actor.doll; Data dat = null; if (status == Inventory.EMPTY) { return; } else if (status == Inventory.STORED) { manager.actor.Equip(slot); } else { switch (status) { case Inventory.PRIMARY: arms.Store(EquipSlot.RIGHT); break; case Inventory.SECONDARY: arms.Store(EquipSlot.LEFT); break; case Inventory.HEAD: dat = doll.Peek(PaperDoll.HEAD); if (dat != null) { doll.Store(PaperDoll.HEAD); } break; case Inventory.TORSO: dat = doll.Peek(PaperDoll.HEAD); if (dat != null) { doll.Store(PaperDoll.TORSO); } break; case Inventory.LEGS: dat = doll.Peek(PaperDoll.HEAD); if (dat != null) { doll.Store(PaperDoll.LEGS); } break; } } }
/* Unequips item found at this index. */ void UnequipByIndex(int index) { Inventory inv = manager.actor.inventory; int status = inv.GetStatus(index); PaperDoll doll = manager.actor.doll; switch (status) { case Inventory.PRIMARY: manager.actor.arms.Store(EquipSlot.RIGHT); break; case Inventory.SECONDARY: manager.actor.arms.Store(EquipSlot.LEFT); break; case Inventory.HEAD: doll.Store(PaperDoll.HEAD); break; case Inventory.TORSO: doll.Store(PaperDoll.TORSO); break; case Inventory.LEGS: doll.Store(PaperDoll.LEGS); break; } }