public IActionResult GetTop100ByCategory(int shardId, LotCategory lotCategory) { var api = Api.INSTANCE; using (var da = api.DAFactory.Get()) { var lots = da.LotTop100.GetByCategory(shardId, lotCategory).Take(100); if (lots == null) { return(ApiResponse.Json(HttpStatusCode.NotFound, new JSONLotError("Top100 lots not found"))); } List <JSONTop100Lot> top100Lots = new List <JSONTop100Lot>(); foreach (var top100Lot in lots) { top100Lots.Add(new JSONTop100Lot { category = top100Lot.category, rank = top100Lot.rank, shard_id = top100Lot.shard_id, lot_location = top100Lot.lot_location, lot_name = top100Lot.lot_name, lot_id = top100Lot.lot_id }); } var top100Json = new JSONTop100Lots(); top100Json.lots = top100Lots; return(ApiResponse.Json(HttpStatusCode.OK, top100Json)); } }
private void ChangeCategory(LotCategory cat) { if (CurrentLot != null && CurrentLot.Value != null && FindController <CoreGameScreenController>().IsMe(CurrentLot.Value.Lot_LeaderID)) { CurrentLot.Value.Lot_Category = (byte)cat; FindController <LotPageController>().SaveCategory(CurrentLot.Value); } }
public IEnumerable <DbLotTop100> GetByCategory(int shard_id, LotCategory category) { return(Context.Connection.Query <DbLotTop100>("SELECT top.*, l.name as lot_name, l.location as lot_location FROM fso_lot_top_100 top LEFT JOIN fso_lots l ON top.lot_id = l.lot_id WHERE top.category = @category AND top.shard_id = @shard_id", new { category = category.ToString(), shard_id = shard_id })); }
public void RequestFilter(LotCategory cat) { if (Gizmo.CurrentAvatar != null && Gizmo.CurrentAvatar.Value != null) { Gizmo.CurrentAvatar.Value.Avatar_Top100ListFilter.Top100ListFilter_Top100ListID = (uint)cat; DataService.Sync(Gizmo.CurrentAvatar.Value, new string[] { "Avatar_Top100ListFilter.Top100ListFilter_Top100ListID" }); } }
public List <DbLotStatus> Top100Filter(int shard_id, LotCategory category, int limit) { return(Context.Connection.Query <DbLotStatus>("SELECT b.location AS location, active " + "FROM fso.fso_lot_claims AS a " + "JOIN fso.fso_lots AS b " + "ON a.lot_id = b.lot_id " + "JOIN(SELECT location, COUNT(*) as active FROM fso_avatar_claims GROUP BY location) AS c " + "ON b.location = c.location WHERE a.shard_id = @shard_id " + "AND category = @category AND active > 0 " + "ORDER BY active DESC " + "LIMIT @limit", new { shard_id = shard_id, category = category.ToString(), limit = limit }).ToList()); }
public UILotSkillModeDialog(LotCategory category, uint originalValue) : base(UIDialogStyle.OK | UIDialogStyle.Close, true) { SetSize(400, 300); uint min = 0; if (!SkillGameplayCategory.TryGetValue(category, out min)) { min = 0; } Caption = GameFacade.Strings.GetString("f109", "5"); DescLabel = new UILabel { Caption = GameFacade.Strings.GetString("f109", "6") + ((min > 0) ? ("\n\n" + GameFacade.Strings.GetString("f109", "7")) : ""), Position = new Vector2(25, 40), Wrapped = true, Size = new Vector2(350, 200) }; Add(DescLabel); var vbox = new UIVBoxContainer(); for (uint i = 0; i < 3; i++) { var hbox = new UIHBoxContainer(); var radio = new UIRadioButton { RadioGroup = "skl", RadioData = i, Disabled = i < min, Selected = i == originalValue }; radio.OnButtonClick += Radio_OnButtonClick; hbox.Add(radio); hbox.Add(new UILabel { Caption = GameFacade.Strings.GetString("f109", (8 + i).ToString()) }); vbox.Add(hbox); } vbox.Position = new Vector2(25, 200); Add(vbox); vbox.AutoSize(); CloseButton.OnButtonClick += CloseButton_OnButtonClick; OKButton.OnButtonClick += OKButton_OnButtonClick; }
public static Top100Category FromLotCategory(LotCategory category) { switch (category) { case LotCategory.money: return(Top100Category.lot_money); case LotCategory.offbeat: return(Top100Category.lot_offbeat); case LotCategory.romance: return(Top100Category.lot_romance); case LotCategory.services: return(Top100Category.lot_services); case LotCategory.shopping: return(Top100Category.lot_shopping); case LotCategory.skills: return(Top100Category.lot_skills); case LotCategory.welcome: return(Top100Category.lot_welcome); case LotCategory.games: return(Top100Category.lot_games); case LotCategory.entertainment: return(Top100Category.lot_entertainment); case LotCategory.residence: return(Top100Category.lot_residence); } throw new Exception("Unknown lot category"); }
public void UpdateLotCategory(int lot_id, LotCategory category, uint skillMode) { Context.Connection.Query("UPDATE fso_lots SET category = @category, category_change_date = @time, skill_mode = @skillMode WHERE lot_id = @id", new { id = lot_id, category = category.ToString(), time = Epoch.Now, skillMode = skillMode }); }