public async Task SetActiveSlotAsync(MarketType marketType, SlotType slotType) { var key = GetActiveSlotKey(marketType); await _database.StringSetAsync(key, slotType.ToString()); _activeSlot = slotType; }
public static PlayerInvite Create(string email, TeamIDType team, SlotType?slot) { var pi = new PlayerInvite(); pi.InviteString = email; pi.Team = team; pi.Slot = slot; return(pi); }
public static PlayerInvite Create(PlayerIDType id, TeamIDType team, SlotType?slot) { var pi = new PlayerInvite(); pi.InviteString = "00" + id + "00"; pi.Team = team; pi.Slot = slot; return(pi); }
public SlotViewer(Slot slot, bool?editing, SlotType?slotType) { InitializeComponent(); DisplayedSlot = slot; if (slotType.HasValue) { this.slotType = slotType.Value; } SetEditingMode(editing.HasValue && editing.Value); }
public SlotViewer(Slot slot, bool?editing, SlotType?slotType) { InitializeComponent(); this.displayedSlot = slot; fillValues(slot); if (slotType.HasValue) { this.slotType = slotType.Value; } if (editing.HasValue) { setEditingMode(editing.Value); } else { setEditingMode(false); } }
internal static string GetSlotPicture(SlotType?slot, RaceType race, GenderType gender, byte augLevel) { string result = "Resources\\Bodies\\" + race.ToString() + "\\" + gender.ToString() + "\\" + slot.ToString(); switch (augLevel) { case 0: break; case 1: { result += "_Mod"; break; } case 2: default: { result += "_Aug"; break; } } return(result += ".png"); }
public async Task <SlotType> GetActiveSlotAsync(MarketType marketType) { if (_activeSlot != null) { return(_activeSlot.Value); } var key = GetActiveSlotKey(marketType); var value = await _database.StringGetAsync(key); if (value.HasValue) { _activeSlot = Enum.Parse <SlotType>(value); } else { await _database.StringSetAsync(key, SlotType.Slot0.ToString()); _activeSlot = SlotType.Slot0; } return(_activeSlot.Value); }
public void Load(MySqlConnection connection, SlotType?slotType = null) { using (var command = connection.CreateCommand()) { if (slotType == null) { command.CommandText = "SELECT * FROM items WHERE `owner` = @owner"; } else { command.CommandText = "SELECT * FROM items WHERE `owner` = @owner AND `slot_type` = @slot_type"; command.Parameters.AddWithValue("@slot_type", slotType); } command.Parameters.AddWithValue("@owner", Owner.Id); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var type = reader.GetString("type"); Type nClass = null; try { nClass = Type.GetType(type); } catch (Exception ex) { _log.Error(ex); } if (nClass == null) { _log.Error("Item type {0} not found!", type); continue; } Item item; try { item = (Item)Activator.CreateInstance(nClass); } catch (Exception ex) { _log.Error(ex); _log.Error(ex.InnerException); item = new Item(); } item.Id = reader.GetUInt64("id"); item.TemplateId = reader.GetUInt32("template_id"); item.Template = ItemManager.Instance.GetTemplate(item.TemplateId); item.SlotType = (SlotType)Enum.Parse(typeof(SlotType), reader.GetString("slot_type"), true); item.Slot = reader.GetInt32("slot"); item.Count = reader.GetInt32("count"); item.LifespanMins = reader.GetInt32("lifespan_mins"); item.MadeUnitId = reader.GetUInt32("made_unit_id"); item.UnsecureTime = reader.GetDateTime("unsecure_time"); item.UnpackTime = reader.GetDateTime("unpack_time"); item.CreateTime = reader.GetDateTime("created_at"); var details = (PacketStream)(byte[])reader.GetValue("details"); item.ReadDetails(details); if (item.Template.FixedGrade >= 0) { item.Grade = (byte)item.Template.FixedGrade; // Overwrite Fixed-grade items, just to make sure } else if (item.Template.Gradable) { item.Grade = reader.GetByte("grade"); // Load from our DB if the item is gradable } if (item.SlotType == SlotType.Equipment) { Equip[item.Slot] = item; } else if (item.SlotType == SlotType.Inventory) { Items[item.Slot] = item; } else if (item.SlotType == SlotType.Bank) { Bank[item.Slot] = item; } } } } if (slotType == null || slotType == SlotType.Equipment) { foreach (var item in Equip.Where(x => x != null)) { item.Template = ItemManager.Instance.GetTemplate(item.TemplateId); } } if (slotType == null || slotType == SlotType.Inventory) { foreach (var item in Items.Where(x => x != null)) { item.Template = ItemManager.Instance.GetTemplate(item.TemplateId); } _freeSlot = CheckFreeSlot(SlotType.Inventory); } if (slotType == null || slotType == SlotType.Bank) { foreach (var item in Bank.Where(x => x != null)) { item.Template = ItemManager.Instance.GetTemplate(item.TemplateId); } _freeBankSlot = CheckFreeSlot(SlotType.Bank); } }
/// <summary> /// Obtains candles history from cache, doing time interval remap and read persistent history if needed /// </summary> public async Task <IEnumerable <ICandle> > GetCandlesAsync(string assetPairId, CandlePriceType priceType, CandleTimeInterval timeInterval, DateTime fromMoment, DateTime toMoment, SlotType?activeSlot = null) { CheckupAssetPairOrFail(assetPairId); var alignedFromMoment = fromMoment.TruncateTo(timeInterval); var alignedToMoment = toMoment.TruncateTo(timeInterval); if (alignedFromMoment == alignedToMoment) { alignedToMoment = alignedFromMoment.AddIntervalTicks(1, timeInterval); } if (!activeSlot.HasValue) { activeSlot = await GetActiveSlotAsync(); } if (Constants.StoredIntervals.Contains(timeInterval)) { return(await GetStoredCandlesAsync(assetPairId, priceType, timeInterval, alignedFromMoment, alignedToMoment, activeSlot.Value)); } return(Array.Empty <ICandle>()); }
internal static string GetDefaultSlotPicture(SlotType?slot, byte augLevel = 0) => slot == null ? Controller.NotFoundImagePath : GetSlotPicture(slot, RaceType.Human, GenderType.Male, augLevel);
internal static string GetSlotPicture(SlotType?slot, RaceType race, GenderType gender) => GetSlotPicture(slot, race, gender, 0);
internal static string GetSlotPictureEmpty(SlotType?slot) => "Resources\\Bodies\\Empty\\" + slot.ToString() + ".png";