public void RefreshBoards() { if (Context.IsSplitScreen && !Context.IsMainPlayer) { return; } CustomBoard.todayQuests.Clear(); foreach (var boardTrigger in this._customBoardTriggers.Value.Where(OnlyUnlockedQuestsBoard)) { CustomBoard.LoadTodayQuestsIfNecessary(boardTrigger.BoardName); } if (Context.IsMainPlayer && SDate.Now().DayOfWeek == DayOfWeek.Monday) { var order_types = this._customBoardTriggers.Value.Where(OnlyUnlockedSpecialOrdersBoard) .Select(b => $"QF:{b.BoardName}") .Distinct() .ToArray(); SpecialOrder.UpdateAvailableSpecialOrders(true); SeedCustomAvailableSpecialOrders(order_types); } if (Context.IsMainPlayer) { ReseedNpcOfferedOrders(); } }
public SpecialOrdersBoard(string board_type = "") : base(0, 0, 0, 0, showUpperRightCloseButton: true) { SpecialOrder.UpdateAvailableSpecialOrders(force_refresh: false); boardType = board_type; if (boardType == "Qi") { billboardTexture = Game1.temporaryContent.Load <Texture2D>("LooseSprites\\SpecialOrdersBoard"); } else { billboardTexture = Game1.temporaryContent.Load <Texture2D>("LooseSprites\\SpecialOrdersBoard"); } width = 1352; height = 792; Vector2 center = Utility.getTopLeftPositionForCenteringOnScreen(width, height); xPositionOnScreen = (int)center.X; yPositionOnScreen = (int)center.Y; acceptLeftQuestButton = new ClickableComponent(new Rectangle(xPositionOnScreen + width / 4 - 128, yPositionOnScreen + height - 128, (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).X + 24, (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).Y + 24), "") { myID = 0, leftNeighborID = -99998, rightNeighborID = -99998, upNeighborID = -99998, downNeighborID = -99998 }; acceptRightQuestButton = new ClickableComponent(new Rectangle(xPositionOnScreen + width * 3 / 4 - 128, yPositionOnScreen + height - 128, (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).X + 24, (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).Y + 24), "") { myID = 1, leftNeighborID = -99998, rightNeighborID = -99998, upNeighborID = -99998, downNeighborID = -99998 }; leftOrder = Game1.player.team.GetAvailableSpecialOrder(0, GetOrderType()); rightOrder = Game1.player.team.GetAvailableSpecialOrder(1, GetOrderType()); upperRightCloseButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width - 20, yPositionOnScreen, 48, 48), Game1.mouseCursors, new Rectangle(337, 494, 12, 12), 4f); Game1.playSound("bigSelect"); UpdateButtons(); if (Game1.options.SnappyMenus) { populateClickableComponentList(); snapToDefaultClickableComponent(); } }
public CustomOrderBoard(string board_type = "", Texture2D customTexture = null) : base(0, 0, 0, 0, showUpperRightCloseButton: true) { SpecialOrder.UpdateAvailableSpecialOrders(force_refresh: false); this.boardType = board_type; if (customTexture != null) { this._billboardTexture = customTexture; } else { this._billboardTexture = Game1.temporaryContent.Load <Texture2D>("LooseSprites\\SpecialOrdersBoard"); } base.width = 1352; base.height = 792; Vector2 center = Utility.getTopLeftPositionForCenteringOnScreen(base.width, base.height); base.xPositionOnScreen = (int)center.X; base.yPositionOnScreen = (int)center.Y; Rectangle leftButtonBounds = new Rectangle( x: base.xPositionOnScreen + (base.width / 4) - 128, y: base.yPositionOnScreen + base.height - 128, width: (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).X + 24, height: (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).Y + 24 ); this.acceptLeftQuestButton = new ClickableComponent(leftButtonBounds, "") { myID = 0, leftNeighborID = -99998, rightNeighborID = -99998, upNeighborID = -99998, downNeighborID = -99998 }; Rectangle rightButtonBOunds = new Rectangle( x: base.xPositionOnScreen + base.width * 3 / 4 - 128, y: base.yPositionOnScreen + base.height - 128, width: (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).X + 24, height: (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).Y + 24 ); this.acceptRightQuestButton = new ClickableComponent(rightButtonBOunds, "") { myID = 1, leftNeighborID = -99998, rightNeighborID = -99998, upNeighborID = -99998, downNeighborID = -99998 }; this.leftOrder = Game1.player.team.GetAvailableSpecialOrder(0, this.GetOrderType()); this.rightOrder = Game1.player.team.GetAvailableSpecialOrder(1, this.GetOrderType()); base.upperRightCloseButton = new ClickableTextureComponent( bounds: new Rectangle(base.xPositionOnScreen + base.width - 20, base.yPositionOnScreen, 48, 48), texture: Game1.mouseCursors, sourceRect: new Rectangle(337, 494, 12, 12), scale: 4f ); Game1.playSound("bigSelect"); this.UpdateButtons(); if (Game1.options.SnappyMenus) { base.populateClickableComponentList(); this.snapToDefaultClickableComponent(); } }
private void refreshSpecialOrders() { SpecialOrder.UpdateAvailableSpecialOrders(force_refresh: true); }
public static void UpdateAvailableSpecialOrders(string[] validTypes) { SpecialOrder.UpdateAvailableSpecialOrders(true); var order_data = Game1.content.Load <Dictionary <string, SpecialOrderData> >("Data\\SpecialOrders"); var keys = new List <string>(order_data.Keys); for (int k = 0; k < keys.Count; k++) { string key = keys[k]; bool invalid = false; if (!invalid && order_data[key].Repeatable != "True" && Game1.MasterPlayer.team.completedSpecialOrders.ContainsKey(key)) { invalid = true; } if (Game1.dayOfMonth >= 16 && order_data[key].Duration == "Month") { invalid = true; } if (!invalid && !SpecialOrder.CheckTags(order_data[key].RequiredTags)) { invalid = true; } if (!invalid) { foreach (SpecialOrder specialOrder in Game1.player.team.specialOrders) { if (specialOrder.questKey.Value == key) { invalid = true; break; } } } if (invalid) { keys.RemoveAt(k); k--; } } Random r = new Random((int)Game1.uniqueIDForThisGame + (int)((float)Game1.stats.DaysPlayed * 1.3f)); foreach (string type_to_find in validTypes) { var typed_keys = new List <string>(); foreach (string key3 in keys) { if (order_data[key3].OrderType == type_to_find) { typed_keys.Add(key3); } } if (type_to_find != "Qi") { for (int j = 0; j < typed_keys.Count; j++) { if (Game1.player.team.completedSpecialOrders.ContainsKey(typed_keys[j])) { typed_keys.RemoveAt(j); j--; } } } var all_keys = new List <string>(typed_keys); for (int i = 0; i < 2; i++) { if (typed_keys.Count == 0) { if (all_keys.Count == 0) { break; } typed_keys = new List <string>(all_keys); } int index = r.Next(typed_keys.Count); string key2 = typed_keys[index]; Game1.player.team.availableSpecialOrders.Add(SpecialOrder.GetSpecialOrder(key2, r.Next())); typed_keys.Remove(key2); all_keys.Remove(key2); } } }