mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 16:42:41 +00:00
Adv 2.0 L4f-prep: flip DisplayName readers to loadDisplayName
Swap all char.DisplayName / c.DisplayName reader sites in internal/plugin/ to loadDisplayName(userID). Touches 12 files across combat (combat_bridge, dnd_zone_combat, dnd_zone_cmd, dnd_expedition_combat), arena, hospital, events, render, masterwork, robbie, scheduler, and adventure.go. Only intentional char.DisplayName references remaining are in adventure_character.go (scan + save + dual-write) and the player_meta.go doc comment. go vet + go test ./internal/plugin/... clean. Unblocks deferred L2 step 9 (arena AdvCharacter import drop) once L4 hospital/pets/render also lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -699,8 +699,9 @@ func (p *AdventurePlugin) handleAdminRevive(ctx MessageContext, target string) e
|
||||
return p.SendReply(ctx.RoomID, ctx.EventID, "That user has no adventurer.")
|
||||
}
|
||||
|
||||
displayName, _ := loadDisplayName(targetID)
|
||||
if char.Alive {
|
||||
return p.SendReply(ctx.RoomID, ctx.EventID, fmt.Sprintf("%s is already alive.", char.DisplayName))
|
||||
return p.SendReply(ctx.RoomID, ctx.EventID, fmt.Sprintf("%s is already alive.", displayName))
|
||||
}
|
||||
|
||||
char.Alive = true
|
||||
@@ -713,7 +714,7 @@ func (p *AdventurePlugin) handleAdminRevive(ctx MessageContext, target string) e
|
||||
if p.achievements != nil {
|
||||
p.achievements.GrantAchievement(targetID, "adv_revived")
|
||||
}
|
||||
return p.SendReply(ctx.RoomID, ctx.EventID, fmt.Sprintf("✅ %s has been revived.", char.DisplayName))
|
||||
return p.SendReply(ctx.RoomID, ctx.EventID, fmt.Sprintf("✅ %s has been revived.", displayName))
|
||||
}
|
||||
|
||||
func (p *AdventurePlugin) handleAdminSummary(ctx MessageContext) error {
|
||||
@@ -982,6 +983,8 @@ func (p *AdventurePlugin) resolveRest(ctx MessageContext, char *AdventureCharact
|
||||
|
||||
logAdvActivity(char.UserID, string(AdvActivityRest), "", "rest", 0, 0, "")
|
||||
|
||||
dispName, _ := loadDisplayName(char.UserID)
|
||||
|
||||
// Compute reset countdown
|
||||
now := time.Now().UTC()
|
||||
midnight := time.Date(now.Year(), now.Month(), now.Day()+1, 0, 0, 0, 0, time.UTC)
|
||||
@@ -998,7 +1001,7 @@ func (p *AdventurePlugin) resolveRest(ctx MessageContext, char *AdventureCharact
|
||||
"Morning DM: %02d:00 UTC\n"+
|
||||
"Evening summary: %02d:00 UTC\n\n"+
|
||||
"The Arena is always open: `!arena`",
|
||||
char.DisplayName, hours, minutes, p.morningHour, p.summaryHour)
|
||||
dispName, hours, minutes, p.morningHour, p.summaryHour)
|
||||
|
||||
if err := p.SendDM(ctx.Sender, restMsg); err != nil {
|
||||
slog.Error("adventure: failed to send rest DM", "user", ctx.Sender, "err", err)
|
||||
@@ -1210,8 +1213,9 @@ func (p *AdventurePlugin) announceTreasureToRoom(char *AdventureCharacter, def *
|
||||
if gr == "" {
|
||||
return
|
||||
}
|
||||
displayName, _ := loadDisplayName(char.UserID)
|
||||
announce := advSubstituteFlavor(def.RoomAnnounce, map[string]string{
|
||||
"{name}": char.DisplayName,
|
||||
"{name}": displayName,
|
||||
"{location}": loc.Name,
|
||||
})
|
||||
p.SendMessage(id.RoomID(gr), announce)
|
||||
@@ -1221,8 +1225,9 @@ func (p *AdventurePlugin) announceTreasureToRoom(char *AdventureCharacter, def *
|
||||
|
||||
func (p *AdventurePlugin) selectFlavorText(char *AdventureCharacter, result *AdvActionResult) (string, string) {
|
||||
loc := result.Location
|
||||
displayName, _ := loadDisplayName(char.UserID)
|
||||
vars := map[string]string{
|
||||
"{name}": char.DisplayName,
|
||||
"{name}": displayName,
|
||||
"{location}": loc.Name,
|
||||
"{value}": fmt.Sprintf("%d", result.TotalLootValue),
|
||||
"{xp}": fmt.Sprintf("%d", result.XPGained),
|
||||
|
||||
Reference in New Issue
Block a user