mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 16:42:41 +00:00
Add action economy split and cross-plugin chat level lookup (Adventure 2.5 steps 1-2)
Action economy: replace single daily action with 1 combat + 3 harvest actions per day. Holidays grant +1 to each bucket. Rest consumes all remaining actions. Arena remains outside both buckets. - Add CombatActionsUsed/HarvestActionsUsed counters to AdventureCharacter - Add CanDoCombat/CanDoHarvest/AllActionsUsed/HasActedToday helpers - Update all 14 ActionTakenToday check sites across adventure, scheduler, babysit, twinbee, events, and render - Morning DM shows action budget and grays out exhausted categories - Activity resolution checks per-bucket availability before proceeding - Midnight reset zeros both counters - Post-action nudge shows remaining actions instead of holiday prompt Cross-plugin lookup: export XPPlugin.GetLevel(), wire into AdventurePlugin via p.chatLevel(userID) for upcoming chat level perks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,6 +106,16 @@ func (p *XPPlugin) OnMessage(ctx MessageContext) error {
|
||||
}
|
||||
|
||||
// GrantXP awards XP to a user from an external plugin and returns (newXP, leveledUp, newLevel).
|
||||
// GetLevel returns the chat level for the given user, or 0 if unknown.
|
||||
func (p *XPPlugin) GetLevel(userID id.UserID) int {
|
||||
d := db.Get()
|
||||
var level int
|
||||
if err := d.QueryRow(`SELECT level FROM users WHERE user_id = ?`, string(userID)).Scan(&level); err != nil {
|
||||
return 0
|
||||
}
|
||||
return level
|
||||
}
|
||||
|
||||
func (p *XPPlugin) GrantXP(userID id.UserID, amount int, reason string) (int, bool, int) {
|
||||
return p.grantXPInternal(userID, amount, reason)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user