namespace Cthangover.Mods.Equipment { using Cthangover.Core.Actions; /// /// action equip.put item=<id> [who=player|<id>] [slot=weapon] [give=1]: /// puts an item on a character from a scenario — the starting gear of a class, a gift /// the hero wears at once. The item comes from the inventory; with give=1 it is /// granted instead (it need not be in the bag). /// public class EquipPutAction : IScenarioAction { /// public string Name => "equip.put"; /// public void Run(IActionContext ctx) { var item = ctx.GetParam("item"); if (string.IsNullOrWhiteSpace(item)) { ctx.LogWarning("EQUIPMENT", "equip.put: missing 'item'"); return; } var slot = ctx.GetParam("slot"); var give = ctx.GetParam("give"); var fromInventory = string.IsNullOrWhiteSpace(give) || give.Trim() == "0"; if (!EquipmentService.Equip(ctx.GetParam("who"), item.Trim(), string.IsNullOrWhiteSpace(slot) ? null : slot.Trim(), fromInventory)) ctx.LogWarning("EQUIPMENT", $"equip.put: '{item}' was not put on (not gear, no fitting slot, not allowed or not in the inventory)"); } } }