public void IgnoreAccount(DbAccount acc, int lockId) { try { List <int> x = acc.Ignored.ToList(); if (!x.Contains(lockId)) { x.Add(lockId); int[] result = x.ToArray(); acc.Ignored = result; acc.Flush(); acc.Reload(); } else { x.Remove(lockId); int[] result = x.ToArray(); acc.Ignored = result; acc.Flush(); acc.Reload(); } } catch { List <int> x = new List <int>(); x.Add(lockId); int[] result = x.ToArray(); acc.Ignored = result; acc.Flush(); acc.Reload(); } }
// Market public void RemovePlayerOffer(DbAccount acc, int id) { acc.Reload("marketOffers"); var gList = acc.MarketOffers.ToList(); gList.Remove(id); acc.MarketOffers = gList.ToArray(); acc.FlushAsync(); }
public void AddPackage(DbAccount acc, int package) { List <int> packageList = acc.PurchasedPackages.ToList(); packageList.Add(package); int[] result = packageList.ToArray(); acc.PurchasedPackages = result; acc.Flush(); acc.Reload(); }
public void AddMysteryBox(DbAccount acc, int box) { List <int> boxList = acc.PurchasedBoxes.ToList(); boxList.Add(box); int[] result = boxList.ToArray(); acc.PurchasedBoxes = result; acc.Flush(); acc.Reload(); }
public void AddSkin(DbAccount acc, int skin) { List <int> skinList = acc.OwnedSkins.ToList(); skinList.Add(skin); int[] result = skinList.ToArray(); acc.OwnedSkins = result; acc.Flush(); acc.Reload(); }
public void AddGifts(DbAccount acc, IEnumerable <ushort> items) { acc.Reload("gifts"); var gList = acc.Gifts.ToList(); gList.AddRange(items); acc.Gifts = gList.ToArray(); acc.FlushAsync(); }
public void AddPlayerOffers(DbAccount acc, IEnumerable <int> ids) { acc.Reload("marketOffers"); var gList = acc.MarketOffers.ToList(); gList.AddRange(ids); acc.MarketOffers = gList.ToArray(); acc.FlushAsync(); }
public bool RemoveGift(DbAccount acc, ushort item, ITransaction transaction = null) { acc.Reload("gifts"); var gList = acc.Gifts.ToList(); gList.Remove(item); var giftBytes = GetGiftBytes(gList.ToArray()); return(SetGifts(acc, giftBytes, transaction)); }
public bool AddGifts(DbAccount acc, IEnumerable <ushort> items, ITransaction transaction = null) { acc.Reload("gifts"); // not ideal but will work for now var gList = acc.Gifts.ToList(); gList.AddRange(items); var giftBytes = GetGiftBytes(gList.ToArray()); return(SetGifts(acc, giftBytes, transaction)); }
public void UpdateTokens(DbAccount acc, int amount) { if (amount > 0) { WaitAll(Hashes.Increment(0, acc.Key, "fortuneTokens", amount)); } else { Hashes.Increment(0, acc.Key, "fortuneTokens", amount).Wait(); } acc.Flush(); acc.Reload(); }
public void UpdateFame(DbAccount acc, int amount) { if (amount > 0) { WaitAll( Hashes.Increment(0, acc.Key, "totalFame", amount), Hashes.Increment(0, acc.Key, "fame", amount)); } else { Hashes.Increment(0, acc.Key, "fame", amount).Wait(); } acc.Flush(); acc.Reload(); }
public void ChangeClassAvailability(DbAccount acc, XmlData data, ushort type) { int price; if (acc.Credits < (price = data.ObjectDescs[type].UnlockCost)) { return; } Hashes.Set(0, $"classAvailability.{acc.AccountId}", type.ToString(), JsonConvert.SerializeObject(new DbClassAvailabilityEntry() { Id = data.ObjectTypeToId[type], Restricted = "unrestricted" })); UpdateCredit(acc, -price); acc.Flush(); acc.Reload(); }
public void ReloadAccount(DbAccount acc) { acc.FlushAsync(); acc.Reload(); }
public void VerifyAge(DbAccount acc) { Hashes.Set(0, acc.Key, "isAgeVerified", "1"); acc.Flush(); acc.Reload(); }
public void BanAccount(DbAccount acc) { Hashes.Set(0, acc.Key, "banned", "1"); acc.Flush(); acc.Reload(); }
public void UnmuteAccount(DbAccount acc) { Hashes.Set(0, acc.Key, "muted", "0"); acc.Flush(); acc.Reload(); }