zc
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using Verse;
|
||||
using WulaFallenEmpire.EventSystem.AI.UI;
|
||||
|
||||
namespace WulaFallenEmpire.EventSystem.AI.Tools
|
||||
{
|
||||
public class Tool_ChangeExpression : AITool
|
||||
{
|
||||
public override string Name => "change_expression";
|
||||
public override string Description => "Changes your visual expression/portrait to match your current mood or reaction.";
|
||||
public override string UsageSchema => "{\"expression_id\": \"int (1-6)\"}";
|
||||
|
||||
public override string Execute(string args)
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = SimpleJsonParser.Parse(args);
|
||||
int id = 0;
|
||||
if (json.TryGetValue("expression_id", out string idStr) && int.TryParse(idStr, out id))
|
||||
{
|
||||
var window = Find.WindowStack.WindowOfType<Dialog_AIConversation>();
|
||||
if (window != null)
|
||||
{
|
||||
window.SetPortrait(id);
|
||||
return $"Expression changed to {id}.";
|
||||
}
|
||||
return "Error: Dialog window not found.";
|
||||
}
|
||||
return "Error: Invalid arguments. 'expression_id' must be an integer.";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"Error executing tool: {ex.Message}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,6 +108,36 @@ namespace WulaFallenEmpire.EventSystem.AI.Tools
|
||||
{
|
||||
sb.AppendLine($" Mood: {pawn.needs.mood.CurLevelPercentage:P0} ({pawn.needs.mood.MoodString})");
|
||||
}
|
||||
|
||||
// Equipment
|
||||
if (pawn.equipment?.Primary != null)
|
||||
{
|
||||
sb.AppendLine($" Weapon: {pawn.equipment.Primary.LabelCap}");
|
||||
}
|
||||
|
||||
// Apparel
|
||||
if (pawn.apparel?.WornApparelCount > 0)
|
||||
{
|
||||
sb.Append(" Apparel: ");
|
||||
foreach (var apparel in pawn.apparel.WornApparel)
|
||||
{
|
||||
sb.Append($"{apparel.LabelCap}, ");
|
||||
}
|
||||
sb.Length -= 2; // Remove trailing comma
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
// Inventory
|
||||
if (pawn.inventory != null && pawn.inventory.innerContainer.Count > 0)
|
||||
{
|
||||
sb.Append(" Inventory: ");
|
||||
foreach (var item in pawn.inventory.innerContainer)
|
||||
{
|
||||
sb.Append($"{item.LabelCap}, ");
|
||||
}
|
||||
sb.Length -= 2; // Remove trailing comma
|
||||
sb.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
|
||||
@@ -24,15 +24,17 @@ namespace WulaFallenEmpire.EventSystem.AI.Tools
|
||||
{
|
||||
// Parse args: {"request": "..."}
|
||||
string request = "";
|
||||
var cleanArgs = args.Trim('{', '}').Replace("\"", "");
|
||||
var parts = cleanArgs.Split(':');
|
||||
if (parts.Length >= 2)
|
||||
try
|
||||
{
|
||||
request = parts[1].Trim();
|
||||
var parsed = SimpleJsonParser.Parse(args);
|
||||
if (parsed.TryGetValue("request", out string req))
|
||||
{
|
||||
request = req;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
// Fallback: treat the whole args string as the request if not JSON format
|
||||
// Fallback for non-json args
|
||||
request = args.Trim('"');
|
||||
}
|
||||
|
||||
@@ -69,6 +71,10 @@ namespace WulaFallenEmpire.EventSystem.AI.Tools
|
||||
if (thingsToDrop.Count > 0)
|
||||
{
|
||||
DropPodUtility.DropThingsNear(dropSpot, map, thingsToDrop);
|
||||
|
||||
Faction faction = Find.FactionManager.FirstFactionOfDef(WulaDefOf.Wula_PIA_Legion_Faction);
|
||||
Messages.Message("Wula_ResourceDrop".Translate(faction.Named("FACTION")), new LookTargets(dropSpot, map), MessageTypeDefOf.PositiveEvent);
|
||||
|
||||
resultLog.Length -= 2; // Remove trailing comma
|
||||
resultLog.Append($" at {dropSpot}.");
|
||||
return resultLog.ToString();
|
||||
|
||||
Reference in New Issue
Block a user