public void EditAccountList(RealmTime time, EditAccountListPacket pkt) { List<int> list; if (pkt.AccountListId == LOCKED_LIST_ID) list = locked; else if (pkt.AccountListId == IGNORED_LIST_ID) list = ignored; else return; Player player = Owner.GetEntity(pkt.ObjectId) as Player; if (player == null) return; int accId = player.psr.Account.AccountId; if (pkt.Add && list.Count < 6) list.Add(accId); else list.Remove(accId); SendAccountList(list, pkt.AccountListId); }
public void EditAccountList(RealmTime time, EditAccountListPacket pkt) { List<int> list; if (pkt.AccountListId == LOCKED_LIST_ID) list = Locked; else if (pkt.AccountListId == IGNORED_LIST_ID) list = Ignored; else return; if (list == null) list = new List<int>(); var player = Owner.GetEntity(pkt.ObjectId) as Player; if (player == null) return; var accId = player.psr.Account.AccountId; var dbx = new Database(); //if (pkt.Add && list.Count < 6) // list.Add(accId); //else // list.Remove(accId); if (pkt.Add) { list.Add(accId); if (pkt.AccountListId == LOCKED_LIST_ID) dbx.AddLock(psr.Account.AccountId, accId); if (pkt.AccountListId == IGNORED_LIST_ID) dbx.AddIgnore(psr.Account.AccountId, accId); } else { list.Remove(accId); if (pkt.AccountListId == LOCKED_LIST_ID) dbx.RemoveLock(psr.Account.AccountId, accId); if (pkt.AccountListId == IGNORED_LIST_ID) dbx.RemoveIgnore(psr.Account.AccountId, accId); } SendAccountList(list, pkt.AccountListId); }