| 58 | } |
| 59 | |
| 60 | func NewUserRecord(userId int, connectionId uint64) *UserRecord { |
| 61 | |
| 62 | c := configs.GetGamePlayConfig() |
| 63 | |
| 64 | u := &UserRecord{ |
| 65 | connectionId: connectionId, |
| 66 | UserId: userId, |
| 67 | Role: RoleUser, |
| 68 | Username: "", |
| 69 | Password: "", |
| 70 | Macros: make(map[string]string), |
| 71 | Character: characters.New(), |
| 72 | ConfigOptions: map[string]any{}, |
| 73 | Joined: time.Now(), |
| 74 | connectionTime: time.Now(), |
| 75 | tempDataStore: make(map[string]any), |
| 76 | EventLog: UserLog{}, |
| 77 | } |
| 78 | |
| 79 | if c.Death.PermaDeath { |
| 80 | u.Character.ExtraLives = int(c.LivesStart) |
| 81 | } |
| 82 | |
| 83 | return u |
| 84 | } |
| 85 | |
| 86 | func (u *UserRecord) ClientSettings() connections.ClientSettings { |
| 87 | return connections.GetClientSettings(u.connectionId) |