Equipment: slots, gear traits, archetype limits and stat bonuses, equip actions and schema
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
f834d1e914
28 files changed
+1065
No files matched your search
@@ -0,0 +1,32 @@
|
||||
namespace Cthangover.Mods.Equipment
|
||||
{
|
||||
using Cthangover.Core.Actions;
|
||||
|
||||
/// <summary>
|
||||
/// <c>action equip.put item=<id> [who=player|<id>] [slot=weapon] [give=1]</c>:
|
||||
/// 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 <c>give=1</c> it is
|
||||
/// granted instead (it need not be in the bag).
|
||||
/// </summary>
|
||||
public class EquipPutAction : IScenarioAction
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string Name => "equip.put";
|
||||
|
||||
/// <inheritdoc />
|
||||
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)");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user