internal async Task <(string, Embed)> SendSuggestion(string content, IUser author) { sendSuggestions = sendSuggestions ?? (ISocketMessageChannel)LoadSuggestionSettings(); if (sendSuggestions == null) { throw NeitsilliaError.ReplyError("Bot suggestions are currently deactivated."); } EmbedBuilder embed = DUtils.BuildEmbed(null, content, author.Id.ToString(), new Color(Program.rng.Next(256), Program.rng.Next(256), Program.rng.Next(256)), DUtils.NewField("Status", "Pending")); embed.WithAuthor(author); Embed e = embed.Build(); var reply = await sendSuggestions.SendMessageAsync(embed : e); await reply.ModifyAsync(x => { x.Content = $"Use `suggest` in my DMs or in the support server to make a suggestion to the support server." + Environment.NewLine + $"Id: `{reply.Id}`"; }); await reply.AddReactionsAsync(new[] { EUI.ToEmote(EUI.ok), EUI.ToEmote(EUI.cancel) }); return(reply.GetJumpUrl(), e); }
private static EmbedBuilder ListItems(Player player, int page, NPC n) { List <string> itemList = new List <string>(); string current = null; for (int i = ((page - 1) * 15); i < n.inventory.Count && i < (page * 15); i++) { StackedItems inst = n.inventory.inv[i]; current += $"{i + 1}|{inst} {EUI.ItemType(inst.item.type)}{inst.item.CompareTo(player.equipment)}| " + $"{GetPrice(inst.item.GetValue(), n.stats.PriceMod(), player.stats.PriceMod(), -1)}" + $"Kuts" + Environment.NewLine; if (current.Length > 1000) { itemList.Add(current); current = null; } } itemList.Add(current); EmbedBuilder embed = new EmbedBuilder(); embed.WithTitle($"{n.name}'s Inventory"); embed.Fields = itemList.Select(s => DUtils.NewField("Items", s)).ToList(); return(embed); }
//Bug Report internal async Task <(string, Embed)> SendBugReport(string content, IUser author) { if (BugReportChannel == null) { throw NeitsilliaError.ReplyError("Bot bug report are currently deactivated."); } EmbedBuilder embed = DUtils.BuildEmbed(null, content, author.Id.ToString(), new Color(Program.rng.Next(256), Program.rng.Next(256), Program.rng.Next(256)), DUtils.NewField("Status", "Pending")); embed.WithAuthor(author); Embed e = embed.Build(); var reply = await BugReportChannel.SendMessageAsync(embed : e); await reply.ModifyAsync(x => { x.Content = $"Use `BugReport` to report the a bug to the support server." + Environment.NewLine + $"Id: `{reply.Id}`"; }); await reply.AddReactionsAsync(new[] { EUI.ToEmote(EUI.ok), EUI.ToEmote(EUI.cancel) }); return(reply.GetJumpUrl(), e); }
public void Close(EUI eUI) { UIBase uIBase; if (!TryGetUIBase(eUI, out uIBase)) { return; } //取出界面,执行OnExit函数 QLog.LogEditor(StringPool.Format("{0} 执行OnExit函数", uIBase.eUI.ToString())); uIBase.OnExit(); UIBasePool.Remove(uIBase); GameObject.Destroy(uIBase.CacheGameObject); uIBase = null; //取出最后的界面,执行OnResume函数 UIBase lastUIBase; if (TryGetLastUIBase(out lastUIBase)) { QLog.LogEditor(StringPool.Format("{0} 执行OnResume函数", lastUIBase.eUI.ToString())); lastUIBase.OnResume(); } }
internal string GetInfo_DmgRes() { string s = null; for (int i = 0; i < ReferenceData.DmgType.Length; i++) { long res = Resistance(i); long dmg = Damage(i); if (dmg > 0 || res != 0) { s += $"{EUI.GetElement((ReferenceData.DamageType)i)}: "; if (dmg > 0) { s += $"{EUI.attack}: {dmg} |-"; } if (res != 0) { s += $"-| {EUI.shield}: {res}"; } s += Environment.NewLine; } } return(s); }
internal static async Task StarterAbilities(Player player, IMessageChannel chan, int page, int firstPick = -1, int firstpickpage = -1) { EmbedBuilder embed = new EmbedBuilder(); embed.WithDescription("**You may select 2 out of these 9 abilities**"); player.UserEmbedColor(embed); switch (page) { case 0: embed.Title = "Simple Abilities"; break; case 1: embed.Title = "Medium Abilities"; break; case 2: embed.Title = "Complex Abilities"; break; } for (int i = 0; i < 3; i++) { Ability a = Ability.Load(LoadAbility.Starters[page, i]); if (player.HasAbility(a.name, out _)) { firstPick = i; firstpickpage = page; } else { embed.AddField($"{EUI.GetNum(i)} {a.name}", a.type.ToString() + Environment.NewLine + a.description + Environment.NewLine + a.GetStats()); } } embed.AddField("Commands", "Use ``~ability level #level 'ability name'`` to get the stats for a specific level." + " ex: ``~ability level 5 Shelter`` displays the stats of Shelter at level 5"); embed.WithFooter($"Cycle through the ability type pages using {EUI.prev} {EUI.next}"); await player.NewUI(null, embed.Build(), chan, MsgType.StarterAbilities, $"{page}/{firstPick}/{firstpickpage}"); }
internal static async Task ChooseRace(Player player, IMessageChannel channel) { EmbedBuilder race = new EmbedBuilder(); race.WithTitle($"{player.name}'s Race"); race.WithDescription("Select a race using the reactions, each has a unique perk. You may not change this option later."); // race.AddField($"{EUI.GetLetter(7)} | **Human** {Environment.NewLine}", $"Basic Humans{Environment.NewLine}" + $"Perk: {PerkLoad.Load("Human Adaptation").desc}{Environment.NewLine}"); // race.AddField($"{EUI.GetLetter(19)} | **Tsiun** {Environment.NewLine}", $"Black or dark color skinned, thin, pointy ears, large eyes and pupils which fill " + $"the entire eye, prefer darker areas, learn well by observing others{Environment.NewLine}" + $"Perk: {PerkLoad.Load("Tsiun Trickery").desc}{Environment.NewLine}"); // race.AddField($"{EUI.GetLetter(20)} | **Uskavian** {Environment.NewLine}", $"Large creatures, not known as a smart race, not very creative and usually does" + $" what they know works, brown or darker skin color with some patterns sometimes{Environment.NewLine}" + $"Perk: {PerkLoad.Load("Uskavian Learning").desc}{Environment.NewLine}"); // race.AddField($"{EUI.GetLetter(12)} | **Miganan** {Environment.NewLine}", $"Similar to humans but with only pale skin variants, mostly white up to grey-ish" + $" with a touch of slight beige, very strong skin, grows no hair{Environment.NewLine}" + $"Perk: {PerkLoad.Load("Migana Skin").desc}{Environment.NewLine}"); // race.AddField($"{EUI.GetLetter(8)} | **Ireskian** {Environment.NewLine}", $"Usually around a feet or two shorter than humans, like to craft and creating things," + $" artistic folks, longingly keep their young appearance{Environment.NewLine}" + $"Perk: {PerkLoad.Load("Ireskian Talent").desc}{Environment.NewLine}"); await player.NewUI(null, race.Build(), channel, MsgType.ChooseRace); }
internal EmbedBuilder EvolveOptions(EmbedBuilder evolveField) { if (evolveField == null) { evolveField = new EmbedBuilder(); } string value = ""; if (evolves != null) { for (int i = 0; i < evolves.Length; i++) { Ability a = Load(evolves[i]); value += $"{EUI.GetNum(i)} | **{a.name}**{Environment.NewLine}" + $"*{a.description}*{Environment.NewLine}" + $"`{a.GetStats()}`{Environment.NewLine}"; } if (level < maxLevel) { value += $"{Environment.NewLine}{Environment.NewLine}{name} is not ready to evolve: {level}/{maxLevel}"; } } else { value = "No Evolves Available"; } evolveField.AddField($"{name} Evolve Options", value); return(evolveField); }
internal async Task <(string, Embed)> SendSuggestion(string content, IUser author, IGuild guild) { EmbedBuilder embed = DUtils.BuildEmbed(null, content, author.Id.ToString(), new Color(Program.rng.Next(256), Program.rng.Next(256), Program.rng.Next(256)), DUtils.NewField("Status", "Pending")); embed.WithAuthor(author); ITextChannel sendSuggestions = (ITextChannel)await guild.GetChannelAsync(suggestionChannel.id); Embed e = embed.Build(); var reply = await sendSuggestions.SendMessageAsync(guildID == 637709809671471118? "<@&717444744812167239>" : null, embed : e); await reply.AddReactionsAsync(new[] { EUI.ToEmote(EUI.ok), EUI.ToEmote(EUI.cancel) }); System.Threading.Thread.Sleep(500); await reply.ModifyAsync(x => { x.Content = $"Use `{prefix}suggest` in any channel to make a suggestion to this server, " + $"or in my DMs to make a suggestion to my support server." + Environment.NewLine + $"Id: `{reply.Id}`"; }); return(reply.GetJumpUrl(), e); }
internal EmbedBuilder PerkListEmbed(Player player, out string available) { EmbedBuilder e = new EmbedBuilder(); List <string> perks = GetPerkList(); available = ""; for (int i = 0; i < perks.Count; i++) { string r = null; if (player.HasPerk(perks[i]) > -1) { r = " [Owned]"; } else if (specPoints < 20) { r += $" [Missing {20 - specPoints} Spec Points]"; } else { available += $";{i}"; } e.AddField($"{EUI.GetNum(i)} {perks[i]} {r}", PerkLoad.Load(perks[i]).desc); } e.WithFooter($"{specPoints} Specialization Points"); return(e); }
public static UIBase GetUI(EUI eUI) { if (dUIs.ContainsKey(eUI)) { return(dUIs[eUI]); } return(null); }
public void SetDepth(EUI eUI, EUIDepth eUIDepth, int Depth) { this.eUI = eUI; this.eUIDepth = eUIDepth; this.Depth = Depth; CacheCanvas.sortingOrder = Depth; }
internal static async Task TavernGames(Player player, IMessageChannel chan) { EmbedBuilder games = DUtils.BuildEmbed("Tavern Games", "Hello, Traveler. Would you like a gambling table?", null, player.userSettings.Color, DUtils.NewField("Dice Games", $"{EUI.Dice(1)} Even Odd"), DUtils.NewField("Card Games", $"{EUI.GetNum(0)} Blackjack") ); await player.EditUI(null, games.Build(), chan, MsgType.GamblingGames, "Tavern"); }
internal static async Task DiceGame_EvenOdd(Player player, ISocketMessageChannel chan, int bet = -1, int coins = 10, int streak = 0) { if (player.Area.type != Areas.AreaType.Tavern) { throw NeitsilliaError.ReplyError("You are no longer in a Tavern. You must be in a tavern to play these games."); } if (player.KCoins < coins) { throw NeitsilliaError.ReplyError("You don't have the funds to make this bet."); } EmbedBuilder embed = DUtils.BuildEmbed("Dice Game : Even Odds", "Bet your kuts on the dice's result being an even number or an odd number.", null, player.userSettings.Color); if (bet > 0 && player.ui?.type == MsgType.DiceGame) { int roll = rng.Next(6) + 1; bool even = roll % 2 == 0; embed.AddField("Bet Placed", $"Bet: {(bet == 2 ? "Even" : "Odd")} " + $"{Environment.NewLine} Dice Roll: {roll} {Environment.NewLine} Win Streak : {streak} "); string result; if ((bet == 2 && even) || (bet == 1 && !even)) { int reward = coins; result = $"You won your bet! +{coins} Kuts"; if (streak > 0) { result += Environment.NewLine + $"With a bonus {streak * coins} Kuts for your winning streak!"; reward += streak * coins; } player.KCoins += reward; streak++; } else { result = $"You lost your bet! -{coins} Kuts"; if (streak > 0) { result += Environment.NewLine + $"You lost your {streak} winning streak! :("; } player.KCoins -= coins; streak = 0; } embed.AddField(DUtils.NewField("Bet Result", result)); } embed.AddField(DUtils.NewField("**Place Your Bet**", $"Current betting amount: {coins} Kuts" + Environment.NewLine + $"{EUI.two} : Multiply bet by 2" + Environment.NewLine + $"{EUI.five} : Multiply bet by 5" + Environment.NewLine + $"{EUI.zero} : Multiply bet by 10" + Environment.NewLine + $"{EUI.prev} : Reduce bet by 10 kuts" + Environment.NewLine + $"{EUI.next} : Increase bet by 10 kuts" + Environment.NewLine + $"{EUI.Dice(1)} : Bet on **Odd**" + Environment.NewLine + $"{EUI.Dice(2)} : Bet on **Even**" )); await player.EditUI("Place your bets, Traveler.", embed.Build(), chan, MsgType.DiceGame, $"{coins};{streak}"); }
public void Close() { UIBase lastUIBase; if (TryGetLastUIBase(out lastUIBase)) { EUI eUI = lastUIBase.eUI; QLog.LogEditor(StringPool.Format("统一关闭 {0} .", eUI.ToString())); Close(eUI); } }
public bool TryGetUIBase(EUI eUI, out UIBase iBase) { for (int i = 0; i < UIBasePool.Count; i++) { UIBase uIBase = UIBasePool[i]; if (uIBase.eUI == eUI) { iBase = uIBase; return(true); } } iBase = null; return(false); }
internal static async Task SkillUpgradePage(Player player, ISocketMessageChannel chan) { EmbedBuilder em = new EmbedBuilder(); em.WithTitle(player.name); em.WithFooter($"Skill Points: {player.skillPoints}{Environment.NewLine}"); em.WithDescription($"Use the reactions to select on which stat to spend your skill point." + $"{Environment.NewLine}{EUI.GetLetter(4)} {ReferenceData.EnduranceInfo()}" + $"{Environment.NewLine}{EUI.GetLetter(8)} {ReferenceData.IntelligenceInfo()}" + $"{Environment.NewLine}{EUI.GetLetter(18)} {ReferenceData.StrengthInfo()}" + $"{Environment.NewLine}{EUI.GetLetter(2)} {ReferenceData.CharismaInfo()}" + $"{Environment.NewLine}{EUI.GetLetter(3)} {ReferenceData.DexterityInfo()}" + $"{Environment.NewLine}{EUI.GetLetter(15)} {ReferenceData.PerceptionInfo()}" + ""); await player.NewUI(await chan.SendMessageAsync(embed: em.Build()), MsgType.Skills); }
// Encodes the label information to the required specifications of Lowes and returns the encoded string public string EncodeLowesManufacturingInformation() { int modelEncodingNumber = 0; ulong encodedLabelNumber = 0; // Check to see if this is a test label if (!this.Product.SKU.Equals(TestSku)) { modelEncodingNumber = (int)Product.ModelEncodingNumber; if (modelEncodingNumber == InvalidModelEncodingNumber) { return(string.Empty); } } // Takes the information of the label and encodes it into the required Lowes format encodedLabelNumber |= ((ulong)this.Tester); encodedLabelNumber |= ((ulong)this.Station << StationOffset); encodedLabelNumber |= ((ulong)this.Site << SiteOffset); // Get the last two digits of the year (2015 = 15) encodedLabelNumber |= ((ulong)(this.Date.Year % 100) << DateYearOffset); encodedLabelNumber |= ((ulong)this.Date.Day << DateDayOffset); // Month encoding starts at 0 (Jan) encodedLabelNumber |= ((ulong)(this.Date.Month - 1) << DateMonthOffset); // Board Revision is being passed in as a character, and therefore needs to be converted back to an int encodedLabelNumber |= ((ulong)(BoardRevision.CharToRevision((char)this.HardwareVersion)) << HWRevisionOffset); encodedLabelNumber |= ((ulong)modelEncodingNumber << ModelEncodingNumberOffset); byte[] encodedLabelNumberBytesArray = BitConverter.GetBytes(encodedLabelNumber); // Put the encodedLabelNumberBytesArray into a big endian format Array.Reverse(encodedLabelNumberBytesArray); // Array for final encoded information byte[] euiEncodedLabelNumber = new byte[encodedLabelNumberBytesArray.Length + EUI.Length]; // Concatenate the two arrays together EUI.CopyTo(euiEncodedLabelNumber, 0); encodedLabelNumberBytesArray.CopyTo(euiEncodedLabelNumber, EUI.Length); // Convert the Byte array into a string of hex digits return(BitConverter.ToString(euiEncodedLabelNumber).Replace("-", "")); }
public static async Task SelectIntensity(Player player, ISocketMessageChannel chan, int quest) { Intensity[] diffs = (Intensity[])Enum.GetValues(typeof(Intensity)); EmbedFieldBuilder[] fields = new EmbedFieldBuilder[diffs.Length]; for (int i = 0; i < fields.Length; i++) { fields[i] = DUtils.NewField($"{EUI.GetNum(i + 1)} {diffs[i]}", $"Encounter rate: ~{(int)diffs[i]} minutes" + Environment.NewLine + $"{1 + (MultiplierReference - (int)diffs[i])/Percentage}x Damage Taken" ); } EmbedBuilder embed = DUtils.BuildEmbed($"{player.name}'s Planned Adventure", "Select the adventure's difficulty." + Environment.NewLine + "**If defeated, all loot, coins and xp collected during the adventure will be lost**", null, player.userSettings.Color, fields); await player.EditUI("Select a difficulty", embed.Build(), chan, MsgType.Adventure, $"{quest}"); }
public static async Task ViewInbox(BotUser user, int page, IMessageChannel chan, bool edit) { Mail[] mails = await Mail.Load(user._id); if (mails.Length == 0) { await chan.SendMessageAsync("Your inbox is empty"); return; } EmbedBuilder embed = DUtils.BuildEmbed("Inbox", $"**Rewards will be given to the currently loaded character: {user.loaded}**"); page = page < 0 ? 0 : Math.Min(page, (mails.Length - 1) / 5); int n = 1; int i = page * 5; int l = Math.Min(i + 5, mails.Length); string ids = $"{page};"; for (; i < l; i++, n++) { Mail mail = mails[i]; string rewards = mail.GetRewards(); embed.AddField($"{EUI.GetNum(n)} {mail.subject}", mail.body + (rewards != null ? Environment.NewLine + Environment.NewLine + rewards : null)); ids += $"{mail._id}"; if (i + 1 < l) { ids += ","; } } if (!edit) { user.NewUI(await chan.SendMessageAsync(embed: embed.Build()), MsgType.Inbox, ids); } else { await user.EditUI(null, embed.Build(), MsgType.Inbox, ids); } }
internal Embed EmbedInfo(Encounter encounter) { EmbedBuilder info = new EmbedBuilder(); info.WithTitle(partyName); for (int i = 0; i < members.Count; i++) { info.Description += $"{(i == 0 ? "👑" : "🔘")} {GetPartyPlayerInfo(members[i], encounter)} {Environment.NewLine}"; } if (NPCMembers.Count > 0) { info.Description += "--Followers--" + Environment.NewLine; for (int i = 0; i < NPCMembers.Count; i++) { info.Description += EUI.GetNum(i + 1) + NPCMembers[i].ToString() + Environment.NewLine; } } return(info.Build()); }
internal (List <int>, EmbedFieldBuilder) LoadCategory(Player player, Cycle cycle) { var list = cycle == Cycle.Daily ? dailies : weeklies; string board = null; List <int> options = new List <int>(); for (int i = 0; i < list.Length; i++) { var(available, info) = LoadQuest(player, i, cycle); int k = i + (cycle == Cycle.Daily ? 1 : 4); board += (available ? EUI.GetNum(k) : "> ") + info + Environment.NewLine; if (available) { options.Add(k); } } return(options, DUtils.NewField($"{cycle} Quests", board)); }
internal static async Task ViewJunctions(Player player, ISocketMessageChannel chan, int page, bool edit = true) { string juncList = null; Area pArea = player.Area; if (pArea.type == AreaType.Dungeon) { throw NeitsilliaError.ReplyError("You can not leave a dungeon so easily." + " Fight or cower your way out, but whichever you choose, you must reach the end of these dark floors or leave them your life."); } List <string> juncIds = new List <string>(); int n = 0; if (pArea.junctions != null) { for (int i = page * 5; i < pArea.junctions.Count && i < (page + 1) * 5; i++) { if (pArea.junctions[i] != null && player.AreaInfo.floor >= pArea.junctions[i].floorRequirement) { juncList += $"{EUI.GetNum(n)} {pArea.junctions[i]} {Environment.NewLine}"; juncIds.Add(pArea.junctions[i].destination); n++; } } } if (player.Encounter != null && player.Encounter.Name == Encounter.Names.Floor) { juncList += "Floor"; } EmbedBuilder junctions = new EmbedBuilder(); junctions = player.UserEmbedColor(junctions); junctions.WithTitle(pArea.name + " Junctions"); junctions.WithDescription(juncList); junctions.WithFooter($"Use reactions to enter Areas"); await player.EnUI(edit, null, junctions.Build(), chan, MsgType.Junctions, $"{page};{(pArea.junctions?.Count ?? 0)};{JsonConvert.SerializeObject(juncIds)}"); }
public async Task CratesListUI(ISocketMessageChannel chan) { if (ResourceCrates == null) { ResourceCrates = new int[5]; } while (ResourceCrates.Length < 5) { ResourceCrates = ArrayM.AddItem(ResourceCrates, 0); } EmbedBuilder em = AMYPrototype.Commands.DUtils.BuildEmbed("Resource Crates", "Select a Crate type to open." + Environment.NewLine + $"{EUI.GetNum(0)} {ResourceCrates[0]} x Wooden Crates" + Environment.NewLine + $"{EUI.GetNum(1)} {ResourceCrates[1]} x Bronze Crates" + Environment.NewLine + $"{EUI.GetNum(2)} {ResourceCrates[2]} x Silver Crates" + Environment.NewLine + $"{EUI.GetNum(3)} {ResourceCrates[3]} x Golden Crates" + Environment.NewLine + $"{EUI.GetNum(4)} {ResourceCrates[4]} x Platinum Crates"); NewUI(await chan.SendMessageAsync(embed: em.Build()), MsgType.ResourceCrateList); }
internal static async Task GetOffers(Player player, int page, OfferQuery q, ISocketMessageChannel chan) { int itemPerPage = 5; ItemOffer[] array = null; EmbedBuilder em = player.UserEmbedColor(new EmbedBuilder()); switch (q) { case OfferQuery.Receiver: array = await GetOffers(player.userid); em.WithTitle("Received Offers"); break; case OfferQuery.Sender: array = await SentOffers(player.userid); em.WithTitle("Sent Offers"); break; } if (array != null && array.Length > 0) { page = Methods.Verify.MinMax(page, Methods.NumbersM.CeilParse <int>(array.Length / 5.00)); int x = 1; List <Guid> guids = new List <Guid>(); for (int p = (itemPerPage * page); p < (itemPerPage * (page + 1)) && p < array.Length; p++, x++) { em.AddField($"{EUI.GetNum(x)} {array[p]._id}", array[p].ToInfo(false)); guids.Add(array[p]._id); } em.WithFooter("Use reactions to inspect Offer and use accept and deny/delete options"); await player.NewUI(await chan.SendMessageAsync(embed: em.Build()), MsgType.OfferList, $"{page}.{array.Length}.{q}.{JsonConvert.SerializeObject(guids)}"); } else { await chan.SendMessageAsync("No offers to display"); } }
public async Task CharListForCrate(ISocketMessageChannel chan, int crateNum) { string desc = null; var chars = GetCharFiles(_id); if (chars.Count < 1) { await chan.SendMessageAsync("No characters were found for this user, create a character using `new character`"); } else { for (int i = 0; i < chars.Count; i++) { desc += EUI.GetNum(i) + " " + chars[i].ToString() + Environment.NewLine; } EmbedBuilder em = AMYPrototype.Commands.DUtils.BuildEmbed($"Opening {(ReferenceData.ResourceCrate)crateNum} Crates", "Select a character to reward crate content to." + Environment.NewLine + desc); await EditUI(null, em.Build(), MsgType.ResourceCrateOpening, crateNum + ";" + chars.Count, chan); } }
public static UIBase CreateUI(EUI eUI) { if (dUIs.ContainsKey(eUI)) { if (dUIs[eUI] != null) { return(dUIs[eUI]); } else { dUIs.Remove(eUI); } } Transform tr = Resources.Load <Transform>("UI/" + eUI); Transform uiTr = null; if (tr == null) { //加载AssetBundle } else { uiTr = GameObject.Instantiate(tr) as Transform; } uiTr.name = eUI.ToString(); UIBase ui = uiTr.GetComponent <UIBase>(); if (ui == null) { ui = uiTr.gameObject.AddComponent(Type.GetType(eUI.ToString())) as UIBase; } ui.transform.localPosition = Vector3.zero; dUIs.Add(eUI, ui); return(ui); }
internal static async Task ViewTiles(Player player, Sandbox sandbox, string source, ISocketMessageChannel channel) { await player.EditUI(null, DUtils.BuildEmbed("Buildings", sandbox.tiles.Join(Environment.NewLine, (tile, i) => $"{EUI.GetNum(i + 1)} {tile.Name}") ?? "No buildings to display" ).Build(), channel, MsgType.TileControls, $"{source};{sandbox.tiles.Count}"); }
internal static async Task TavernUI(Player player, ISocketMessageChannel chan) { await player.NewUI( await chan.SendMessageAsync( embed: DUtils.BuildEmbed("Tavern", "Welcome, Traveler! What service may I offer you?", null, player.userSettings.Color, DUtils.NewField("Services", $"{EUI.bounties} Bounties" + $"{Environment.NewLine} {EUI.sideQuest} Quests Board" + $"{Environment.NewLine} {EUI.Dice(1)} Games" ) ).Build()) , MsgType.Tavern); }
/// <summary> /// 设置测试状态 /// </summary> public void SetUUT(CUUT runUUT) { if (this.InvokeRequired) { this.Invoke(new Action <CUUT>(SetUUT), runUUT); } else { if (panelUUT == null) { return; } this._runUUT = runUUT.Clone(); EUI NowIsUI = EUI.空闲; //非空治具 if (_runUUT.Para.AlarmCode == EAlarmCode.正常 && _runUUT.Para.IsNull == 0) { if (_runUUT.Para.DoRun == EDoRun.正在老化 || _runUUT.Para.DoRun == EDoRun.老化完成 || _runUUT.Para.DoRun == EDoRun.老化结束) { NowIsUI = EUI.老化; } else { NowIsUI = EUI.状态; } } else { NowIsUI = EUI.状态; } if (IsUI != NowIsUI) { foreach (Control item in this.Controls) { this.Controls.Remove(item); } if (NowIsUI == EUI.老化) { this.Controls.Add(panelUUT); } else { this.Controls.Add(labStatus); } IsUI = NowIsUI; } uutBaseInfo = "【" + CLanguage.Lan("位置编号") + "】:" + _runUUT.Base.localName + "\r\n"; uutDevInfo = string.Empty; if (_runUUT.Para.DoRun == EDoRun.空治具到位) { uutDevInfo += "【" + CLanguage.Lan("治具ID") + "】:" + _runUUT.Para.IdCard + "\r\n"; } uutDevInfo += "【" + CLanguage.Lan("控制板地址") + "】:" + CGlobalPara.SysPara.Dev.MonCom[_runUUT.Base.ctrlCom] + "_" + _runUUT.Base.ctrlAddr.ToString("D2") + ";【" + CLanguage.Lan("ERS地址") + "】:" + CGlobalPara.SysPara.Dev.ErsCom[_runUUT.Base.ersCom] + "_" + _runUUT.Base.ersAddr.ToString("D2") + "_" + _runUUT.Base.ersCH.ToString() + ";\r\n"; uutDevInfo += "【" + CLanguage.Lan("母治具使用次数") + "】:" + _runUUT.Para.UsedNum.ToString() + ";【" + CLanguage.Lan("连续不良次数") + "】:" + _runUUT.Para.FailNum.ToString() + ";\r\n"; if (IsUI == EUI.状态) { SetStatus(); } else { SetBI(); } } }