(userId int)
| 319 | } |
| 320 | |
| 321 | func SetLinkDeadUser(userId int) { |
| 322 | userManagerMu.Lock() |
| 323 | u, ok := userManager.Users[userId] |
| 324 | userManagerMu.Unlock() |
| 325 | |
| 326 | if !ok { |
| 327 | return |
| 328 | } |
| 329 | |
| 330 | u.Character.RemoveBuff(0) |
| 331 | u.Character.SetAdjective(`zombie`, true) |
| 332 | |
| 333 | // Special case for `newbieguide` module exported function check |
| 334 | // If module was loaded, this function should exist. |
| 335 | if fn, ok := GetExportedFunction(`PlayerGuideMobId`); ok { |
| 336 | guideMobId := 0 |
| 337 | if guideMobIdFn, ok := fn.(func() int); ok { |
| 338 | guideMobId = guideMobIdFn() |
| 339 | } |
| 340 | |
| 341 | // Prevent guide mob dupes |
| 342 | for _, miid := range u.Character.CharmedMobs { |
| 343 | if m := mobs.GetInstance(miid); m != nil { |
| 344 | if m.MobId == mobs.MobId(guideMobId) && m.Character.Charmed != nil { |
| 345 | m.Character.Charmed.RoundsRemaining = 0 |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | userManagerMu.Lock() |
| 352 | if _, ok := userManager.LinkDeadConnections[u.connectionId]; !ok { |
| 353 | u.isLinkDead = true |
| 354 | userManager.LinkDeadConnections[u.connectionId] = util.GetTurnCount() |
| 355 | } |
| 356 | userManagerMu.Unlock() |
| 357 | } |
| 358 | |
| 359 | func SaveAllUsers(isAutoSave ...bool) { |
| 360 | userManagerMu.RLock() |
no test coverage detected