public void OnDisconnect() { try { CharacterTable.Update(this); if (this.myMap != null && this.Client != null && this.Client.GetState() == WorldState.STATE_IN_GAME) { this.DestroyFromMap(); } if (InventoryCache != null) { foreach (var item in InventoryCache.ItemsCache) { if (item.Value.SpeakingItem != null) { SpeakingTable.Add(item.Value.SpeakingItem); SpeakingTable.Cache.Remove(item.Value.SpeakingID); } InventoryItemTable.Items.Remove(item.Key); } } CharacterTable.DelCharacter(this); this.Client = null; } catch (Exception e) { Logger.Error(e); } }
public void OnDisconnect() { AccountTable.UpdateLogged(ID, false); foreach (Player character in Characters.Values) { CharacterTable.DelCharacter(character); } if (Data != null) { Data.Save(); } this.curPlayer = null; }