onGetFormattedName appends the player's title (if any) to their formatted name.
(f characters.FormattedName)
| 996 | |
| 997 | // onGetFormattedName appends the player's title (if any) to their formatted name. |
| 998 | func (m *ElectionsModule) onGetFormattedName(f characters.FormattedName) characters.FormattedName { |
| 999 | if f.Type != `username` { |
| 1000 | return f |
| 1001 | } |
| 1002 | |
| 1003 | for _, w := range m.state.Winners { |
| 1004 | if strings.EqualFold(w.CharacterName, f.Name) { |
| 1005 | color := m.titleColor() |
| 1006 | if len(color) > 0 { |
| 1007 | if num, err := strconv.Atoi(color); err == nil { |
| 1008 | f.Title = fmt.Sprintf(`<ansi fg="%d">%s</ansi>`, num, w.Title) |
| 1009 | } else { |
| 1010 | f.Title = colorpatterns.ApplyColorPattern(w.Title, color) |
| 1011 | } |
| 1012 | } |
| 1013 | return f |
| 1014 | } |
| 1015 | } |
| 1016 | |
| 1017 | return f |
| 1018 | } |
nothing calls this directly
no test coverage detected