rename instances of HRP to HR

This commit is contained in:
wish
2024-02-25 22:20:12 +11:00
parent a0282bd11e
commit f5c772413e
10 changed files with 37 additions and 35 deletions

View File

@@ -56,7 +56,7 @@ func (s *Server) userIDFromToken(ctx context.Context, token string) (uint32, err
func (s *Server) createCharacter(ctx context.Context, userID uint32) (Character, error) {
var character Character
err := s.db.GetContext(ctx, &character,
"SELECT id, name, is_female, weapon_type, hrp, gr, last_login FROM characters WHERE is_new_character = true AND user_id = $1 LIMIT 1",
"SELECT id, name, is_female, weapon_type, hr, gr, last_login FROM characters WHERE is_new_character = true AND user_id = $1 LIMIT 1",
userID,
)
if err == sql.ErrNoRows {
@@ -68,10 +68,10 @@ func (s *Server) createCharacter(ctx context.Context, userID uint32) (Character,
err = s.db.GetContext(ctx, &character, `
INSERT INTO characters (
user_id, is_female, is_new_character, name, unk_desc_string,
hrp, gr, weapon_type, last_login
hr, gr, weapon_type, last_login
)
VALUES ($1, false, true, '', '', 0, 0, 0, $2)
RETURNING id, name, is_female, weapon_type, hrp, gr, last_login`,
RETURNING id, name, is_female, weapon_type, hr, gr, last_login`,
userID, uint32(time.Now().Unix()),
)
}
@@ -96,7 +96,7 @@ func (s *Server) getCharactersForUser(ctx context.Context, uid uint32) ([]Charac
var characters []Character
err := s.db.SelectContext(
ctx, &characters, `
SELECT id, name, is_female, weapon_type, hrp, gr, last_login
SELECT id, name, is_female, weapon_type, hr, gr, last_login
FROM characters
WHERE user_id = $1 AND deleted = false AND is_new_character = false ORDER BY id ASC`,
uid,

View File

@@ -37,7 +37,7 @@ type Character struct {
Name string `json:"name"`
IsFemale bool `json:"isFemale" db:"is_female"`
Weapon uint32 `json:"weapon" db:"weapon_type"`
HR uint32 `json:"hr" db:"hrp"`
HR uint32 `json:"hr" db:"hr"`
GR uint32 `json:"gr"`
LastLogin int32 `json:"lastLogin" db:"last_login"`
}