aboutsummaryrefslogtreecommitdiff
path: root/internal/behavior
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-10 17:02:13 -0400
committerhistoria <[not public]>2026-07-10 17:02:13 -0400
commitd02f0d2cdf67f1445a9ccae86b99a2578adab585 (patch)
treefc2caae674d20b9ac31aa0da41f4f600f8f801a9 /internal/behavior
parent18d46f9c336d37d0282eb7191bb7ff930163d18f (diff)
downloadthehouseoficarus-d02f0d2cdf67f1445a9ccae86b99a2578adab585.tar.gz
feat(admin): update search to use standard condition/action framework rather than bespoke implementation
Diffstat (limited to 'internal/behavior')
-rw-r--r--internal/behavior/behavior.go51
-rw-r--r--internal/behavior/types.go25
2 files changed, 35 insertions, 41 deletions
diff --git a/internal/behavior/behavior.go b/internal/behavior/behavior.go
index 75f836b..9152f8c 100644
--- a/internal/behavior/behavior.go
+++ b/internal/behavior/behavior.go
@@ -55,21 +55,22 @@ type TalkOption struct {
// scheduler and ignores the per-step Condition (its gating is done at the
// parent Trigger level instead).
type Step struct {
- Condition *Condition `yaml:"condition,omitempty"`
- Wait int `yaml:"wait,omitempty"`
- Messages []string `yaml:"messages,omitempty"`
- Broadcast string `yaml:"broadcast,omitempty"`
- BroadcastGlobal string `yaml:"broadcast_global,omitempty"`
- SpawnMob *SpawnMobConfig `yaml:"spawn_mob,omitempty"`
- DespawnMob string `yaml:"despawn_mob,omitempty"`
- SetGlobalFlags map[string]any `yaml:"set_global_flags,omitempty"`
- SetPlayerFlags map[string]any `yaml:"set_player_flags,omitempty"`
- GiveItem string `yaml:"give_item,omitempty"`
- TakeItem string `yaml:"take_item,omitempty"`
- Teleport int `yaml:"teleport,omitempty"`
- Heal int `yaml:"heal,omitempty"`
- Credits int `yaml:"credits,omitempty"`
- ApsNode bool `yaml:"aps_node,omitempty"`
+ Condition *Condition `yaml:"condition,omitempty" json:"condition,omitempty"`
+ Wait int `yaml:"wait,omitempty" json:"wait,omitempty"`
+ Messages []string `yaml:"messages,omitempty" json:"messages,omitempty"`
+ Broadcast string `yaml:"broadcast,omitempty" json:"broadcast,omitempty"`
+ BroadcastGlobal string `yaml:"broadcast_global,omitempty" json:"broadcast_global,omitempty"`
+ SpawnMob *SpawnMobConfig `yaml:"spawn_mob,omitempty" json:"spawn_mob,omitempty"`
+ DespawnMob string `yaml:"despawn_mob,omitempty" json:"despawn_mob,omitempty"`
+ SetGlobalFlags map[string]any `yaml:"set_global_flags,omitempty" json:"set_global_flags,omitempty"`
+ SetPlayerFlags map[string]any `yaml:"set_player_flags,omitempty" json:"set_player_flags,omitempty"`
+ GiveItem string `yaml:"give_item,omitempty" json:"give_item,omitempty"`
+ TakeItem string `yaml:"take_item,omitempty" json:"take_item,omitempty"`
+ Teleport int `yaml:"teleport,omitempty" json:"teleport,omitempty"`
+ Heal int `yaml:"heal,omitempty" json:"heal,omitempty"`
+ Credits int `yaml:"credits,omitempty" json:"credits,omitempty"`
+ ApsNode bool `yaml:"aps_node,omitempty" json:"aps_node,omitempty"`
+ DropTable []DropEntry `yaml:"drop_table,omitempty" json:"drop_table,omitempty"`
}
// HasEffects reports whether the step carries any effect beyond a pure wait.
@@ -78,7 +79,7 @@ func (s Step) HasEffects() bool {
s.SpawnMob != nil || s.DespawnMob != "" ||
len(s.SetGlobalFlags) > 0 || len(s.SetPlayerFlags) > 0 ||
s.GiveItem != "" || s.TakeItem != "" || s.Teleport != 0 || s.Heal != 0 ||
- s.Credits != 0 || s.ApsNode
+ s.Credits != 0 || s.ApsNode || len(s.DropTable) > 0
}
// Trigger is the one conditional wrapper used by every event block in the
@@ -211,13 +212,13 @@ func (c *ShopConfig) FindItem(itemID string) *ShopItem {
// Not inverter. Room matches when the triggering player is currently in that
// room (ignored for global-flag triggers with no player).
type Condition struct {
- GlobalFlag string `yaml:"global_flag,omitempty"`
- PlayerFlag string `yaml:"player_flag,omitempty"`
- Room int `yaml:"room,omitempty"`
- Value any `yaml:"value,omitempty"`
- Not bool `yaml:"not,omitempty"`
- HasItem string `yaml:"has_item,omitempty"`
- MinCredits int `yaml:"min_credits,omitempty"`
- AllOf []Condition `yaml:"all_of,omitempty"`
- AnyOf []Condition `yaml:"any_of,omitempty"`
+ GlobalFlag string `yaml:"global_flag,omitempty" json:"global_flag,omitempty"`
+ PlayerFlag string `yaml:"player_flag,omitempty" json:"player_flag,omitempty"`
+ Room int `yaml:"room,omitempty" json:"room,omitempty"`
+ Value any `yaml:"value,omitempty" json:"value,omitempty"`
+ Not bool `yaml:"not,omitempty" json:"not,omitempty"`
+ HasItem string `yaml:"has_item,omitempty" json:"has_item,omitempty"`
+ MinCredits int `yaml:"min_credits,omitempty" json:"min_credits,omitempty"`
+ AllOf []Condition `yaml:"all_of,omitempty" json:"all_of,omitempty"`
+ AnyOf []Condition `yaml:"any_of,omitempty" json:"any_of,omitempty"`
}
diff --git a/internal/behavior/types.go b/internal/behavior/types.go
index 7aba045..86115a7 100644
--- a/internal/behavior/types.go
+++ b/internal/behavior/types.go
@@ -33,7 +33,6 @@ const (
TypeTalk ActionType = "talk"
TypeBurn ActionType = "burn"
TypeStoke ActionType = "stoke"
- TypeSearch ActionType = "search"
TypeIdentify ActionType = "identify"
TypePlant ActionType = "plant"
TypeHarvest ActionType = "harvest"
@@ -165,12 +164,6 @@ type FarmData struct {
MaxYield float64
}
-type SearchData struct {
- ItemID string
- SlotIdx int
- Started bool
-}
-
type CombineData struct {
ItemID string
Phase int
@@ -205,15 +198,15 @@ type TriggerModuleData struct {
}
type DropEntry struct {
- ItemID string `yaml:"item_id"`
- Table string `yaml:"table"`
- Tool string `yaml:"tool,omitempty"`
- Weight int `yaml:"weight"`
- Quantity int `yaml:"quantity"`
- Depletes bool `yaml:"depletes"`
- SuccessMessage string `yaml:"success_message"`
- Level int `yaml:"level"`
- XP int `yaml:"xp"`
+ ItemID string `yaml:"item_id" json:"item_id"`
+ Table string `yaml:"table" json:"table"`
+ Tool string `yaml:"tool,omitempty" json:"tool,omitempty"`
+ Weight int `yaml:"weight" json:"weight"`
+ Quantity int `yaml:"quantity" json:"quantity"`
+ Depletes bool `yaml:"depletes" json:"depletes"`
+ SuccessMessage string `yaml:"success_message" json:"success_message"`
+ Level int `yaml:"level" json:"level"`
+ XP int `yaml:"xp" json:"xp"`
}
type DropTableDef struct {