()
| 30 | ) |
| 31 | |
| 32 | func (u *UserRecord) GetCommandPrompt() string { |
| 33 | |
| 34 | promptOut := `` |
| 35 | |
| 36 | if u.activePrompt != nil { |
| 37 | |
| 38 | if activeQuestion := u.activePrompt.GetNextQuestion(); activeQuestion != nil { |
| 39 | promptOut = activeQuestion.String() |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | goAhead := `` |
| 44 | if connections.GetClientSettings(u.ConnectionId()).SendTelnetGoAhead { |
| 45 | goAhead = term.TelnetGoAhead.String() |
| 46 | } |
| 47 | |
| 48 | if len(promptOut) == 0 { |
| 49 | |
| 50 | if promptDefaultCompiled == `` { |
| 51 | promptDefaultCompiled = util.ConvertColorShortTags(configs.GetTextFormatsConfig().Prompt.String()) |
| 52 | } |
| 53 | |
| 54 | var customPrompt any = nil |
| 55 | var inCombat bool = u.Character.Aggro != nil |
| 56 | |
| 57 | if inCombat { |
| 58 | customPrompt = u.GetConfigOption(`fprompt-compiled`) |
| 59 | } |
| 60 | |
| 61 | // No other custom prompts? try the default setting |
| 62 | if customPrompt == nil { |
| 63 | customPrompt = u.GetConfigOption(`prompt-compiled`) |
| 64 | } |
| 65 | |
| 66 | if customPrompt != nil { |
| 67 | if ansiPrompt, ok := customPrompt.(string); ok { |
| 68 | promptOut = u.ProcessPromptString(ansiPrompt) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | // Still nothing? Default to ... default |
| 73 | if len(promptOut) == 0 { |
| 74 | promptOut = u.ProcessPromptString(promptDefaultCompiled) |
| 75 | } |
| 76 | |
| 77 | } |
| 78 | |
| 79 | unsent, suggested := u.GetUnsentText() |
| 80 | if len(suggested) > 0 { |
| 81 | suggested = `<ansi fg="suggested-text">` + suggested + `</ansi>` |
| 82 | } |
| 83 | return term.AnsiMoveCursorColumn.String() + term.AnsiEraseLine.String() + promptOut + unsent + suggested + goAhead |
| 84 | |
| 85 | } |
| 86 | |
| 87 | func (u *UserRecord) ProcessPromptString(promptStr string) string { |
| 88 |
no test coverage detected