28 lines
926 B
C#
28 lines
926 B
C#
// TakeCommand.cs
|
|
using System;
|
|
using TextRPG.PlayerSystem;
|
|
|
|
namespace TextRPG.Commands
|
|
{
|
|
public class TakeCommand : Command
|
|
{
|
|
public override string Name => "take";
|
|
public override string Description => "Picks up an item from the current location.";
|
|
public override string Usage => "take <item_name>";
|
|
|
|
public override void Execute(string[] args, Action<string> outputCallback)
|
|
{
|
|
if (args.Length == 0)
|
|
{
|
|
outputCallback($"Usage: {Usage}");
|
|
return;
|
|
}
|
|
|
|
string itemName = string.Join(" ", args);
|
|
// For demo, create a predefined item. In a real game, you'd fetch from the current room/zone.
|
|
var item = new Item(itemName, "A mysterious object.", 10, "misc");
|
|
Player.Instance.AddItem(item);
|
|
outputCallback($"You picked up: {itemName}.");
|
|
}
|
|
}
|
|
} |