MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / configSlice

Method configSlice

modules/automission/admin_api.go:55–104  ·  view source on GitHub ↗

configSlice reads a complex config key, checking plugin storage first, then falling back to the overlay config (for defaults from config.yaml).

(key string)

Source from the content-addressed store, hash-verified

53// configSlice reads a complex config key, checking plugin storage first,
54// then falling back to the overlay config (for defaults from config.yaml).
55func (m *AutoMissionModule) configSlice(key string) []any {
56 cc := m.loadComplexConfig()
57
58 switch key {
59 case "EscortMobIds":
60 return intsToAny(cc.EscortMobIds)
61 case "KillMobEasyRewards":
62 return rewardsToAny(cc.KillMobEasyRewards)
63 case "KillMobHardRewards":
64 return rewardsToAny(cc.KillMobHardRewards)
65 case "FindItemEasyRewards":
66 return rewardsToAny(cc.FindItemEasyRewards)
67 case "FindItemHardRewards":
68 return rewardsToAny(cc.FindItemHardRewards)
69 case "ExploreEasyRewards":
70 return rewardsToAny(cc.ExploreEasyRewards)
71 case "ExploreHardRewards":
72 return rewardsToAny(cc.ExploreHardRewards)
73 case "EscortEasyRewards":
74 return rewardsToAny(cc.EscortEasyRewards)
75 case "EscortHardRewards":
76 return rewardsToAny(cc.EscortHardRewards)
77 case "KillMobEasyRewardItems":
78 return intsToAny(cc.KillMobEasyRewardItems)
79 case "KillMobHardRewardItems":
80 return intsToAny(cc.KillMobHardRewardItems)
81 case "FindItemEasyRewardItems":
82 return intsToAny(cc.FindItemEasyRewardItems)
83 case "FindItemHardRewardItems":
84 return intsToAny(cc.FindItemHardRewardItems)
85 case "ExploreEasyRewardItems":
86 return intsToAny(cc.ExploreEasyRewardItems)
87 case "ExploreHardRewardItems":
88 return intsToAny(cc.ExploreHardRewardItems)
89 case "EscortEasyRewardItems":
90 return intsToAny(cc.EscortEasyRewardItems)
91 case "EscortHardRewardItems":
92 return intsToAny(cc.EscortHardRewardItems)
93 }
94
95 // Fall back to overlay config for any key not managed here.
96 v := m.plug.Config.Get(key)
97 if v == nil {
98 return nil
99 }
100 if s, ok := v.([]any); ok {
101 return s
102 }
103 return nil
104}
105
106// apiGetConfig handles GET /admin/api/v1/automission-config.
107func (m *AutoMissionModule) apiGetConfig(r *http.Request) (int, bool, any) {

Callers 2

selectRewardMethod · 0.95
escortMobIdsMethod · 0.95

Calls 4

loadComplexConfigMethod · 0.95
intsToAnyFunction · 0.85
rewardsToAnyFunction · 0.85
GetMethod · 0.45

Tested by

no test coverage detected