mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
Add hospital revival, Robbie bandit, MW/shop fixes, float64 scoring
- St. Guildmore's Memorial Hospital: !hospital command with Nurse Joy, procedural itemized billing, same-day revival, 6-hour dead timer, hospital ad after death, 2-hour nudge follow-up - Robbie the Friendly Bandit: automated inventory cleaner, random daily visits (8-21 UTC, 40% chance), collects sub-tier gear at €50/item, donates to community pot, drops Get Out of Medical Debt Free card - Fix MW auto-equip: T1 MW no longer replaces better equipped gear - Fix shop MW block: allow purchasing upgrades over lower-tier MW - Float64 equipment scoring: advEffectiveTier and advEquipmentScore return float64, no mid-calculation truncation (MW 1.25x, Arena 1.5x) - Fix markdown rendering: convert *asterisk* to _underscore_ italics across all flavor text files (shop, blacksmith, rival, hospital) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -65,8 +65,10 @@ func (c *Client) IsValidWord(word, lang string) (bool, error) {
|
||||
}
|
||||
|
||||
// RandomWord returns a random word for a language with optional filters.
|
||||
// pos can be empty. min/max of 0 means no filter.
|
||||
func (c *Client) RandomWord(lang, pos string, min, max int) (string, error) {
|
||||
// pos can be empty. min/max of 0 means no filter. minFreq of 0 means no
|
||||
// frequency filter; values > 0 pass min_freq to the server and also veto
|
||||
// results that come back below the threshold (belt-and-suspenders).
|
||||
func (c *Client) RandomWord(lang, pos string, min, max, minFreq int) (string, error) {
|
||||
params := url.Values{"lang": {lang}}
|
||||
if pos != "" {
|
||||
params.Set("pos", pos)
|
||||
@@ -77,6 +79,9 @@ func (c *Client) RandomWord(lang, pos string, min, max int) (string, error) {
|
||||
if max > 0 {
|
||||
params.Set("max", strconv.Itoa(max))
|
||||
}
|
||||
if minFreq > 0 {
|
||||
params.Set("min_freq", strconv.Itoa(minFreq))
|
||||
}
|
||||
|
||||
u := c.baseURL + "/random?" + params.Encode()
|
||||
resp, err := c.httpClient.Get(u)
|
||||
@@ -93,11 +98,18 @@ func (c *Client) RandomWord(lang, pos string, min, max int) (string, error) {
|
||||
}
|
||||
|
||||
var result struct {
|
||||
Word string `json:"word"`
|
||||
Word string `json:"word"`
|
||||
Frequency int `json:"frequency"`
|
||||
}
|
||||
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
|
||||
return "", fmt.Errorf("dreamdict: random: decode: %w", err)
|
||||
}
|
||||
|
||||
// Client-side veto in case the server doesn't support min_freq yet.
|
||||
if minFreq > 0 && result.Frequency > 0 && result.Frequency < minFreq {
|
||||
return "", fmt.Errorf("dreamdict: random: word below frequency threshold")
|
||||
}
|
||||
|
||||
return result.Word, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user