//////////////// /// @private public override void Action(CommandCaller caller, string input, string[] args) { string _; ObjectivesAPI.AddObjective( objective: new FlatObjective( //title: "Kill The Guide", //description: "He's let in one too many zombies", title: "Kill A Blue Slime", description: "What even is a slime?", isImportant: false, condition: (obj) => NPCLibraries.CurrentPlayerKillsOfBannerNpc(NPCID.BlueSlime) > 0 ), order: -1, alertPlayer: false, result: out _ ); ObjectivesAPI.AddObjective( objective: new PercentObjective( title: "Collect 50 Rings", description: "Wrong game.", isImportant: false, units: 50, condition: (obj) => (float)PlayerItemFinderLibraries.CountTotalOfEach( Main.LocalPlayer, new HashSet <int> { ItemID.GoldRing }, false ) / 50f ), order: -1, alertPlayer: false, result: out _ ); ObjectivesAPI.AddObjective( objective: new FlatObjective( title: "Order Pizza", description: "Can't be done.", isImportant: true ), order: -1, alertPlayer: false, result: out _ ); ObjectivesAPI.AddObjective( objective: new FlatObjective( title: "Collect A Blueberry", description: "Don't ask.", isImportant: true, condition: (obj) => (float)PlayerItemFinderLibraries.CountTotalOfEach( Main.LocalPlayer, new HashSet <int> { ItemID.BlueBerries }, false ) > 0 ), order: -1, alertPlayer: false, result: out _ ); ObjectivesAPI.AddObjective( objective: new FlatObjective( title: "Craft A Molotov", description: "Viva la revolution!", isImportant: false, condition: (obj) => (float)PlayerItemFinderLibraries.CountTotalOfEach( Main.LocalPlayer, new HashSet <int> { ItemID.MolotovCocktail }, false ) > 0 ), order: -1, alertPlayer: false, result: out _ ); ObjectivesAPI.AddObjective( objective: new PercentObjective( title: "Kill 10 Squids", description: "Thanks twerking Squidward. Some random squids must be punished now.", isImportant: true, units: 10, condition: (obj) => (float)NPCLibraries.CurrentPlayerKillsOfBannerNpc(NPCID.Squid) / 10f ), order: -1, alertPlayer: false, result: out _ ); ObjectivesAPI.AddObjective( objective: new PercentObjective( title: "Collect 99 Dirt Blocks", description: "Mission impossible?", isImportant: false, units: 99, condition: (obj) => (float)PlayerItemFinderLibraries.CountTotalOfEach( Main.LocalPlayer, new HashSet <int> { ItemID.DirtBlock }, false ) / 99f ), order: -1, alertPlayer: false, result: out _ ); }
/// <summary> /// Gets a list of assorted game data statistics, formatted for (markdown) output. /// </summary> /// <param name="mods">Mods to display in this list. Typically only the set of loaded mods (ModLoader.Mods`).</param> /// <returns></returns> public static IList <string> GetFormattedGameInfo(IEnumerable <Mod> mods) { var list = new List <string>(); var modsList = mods.OrderBy(m => m.Name) .SafeSelect(m => StringFormattingLibraries.SanitizeMarkdown(m.DisplayName) + " " + m.Version.ToString()) .ToArray(); bool isDay = Main.dayTime; double timeOfDay = Main.time; int halfDays = WorldStateLibraries.GetElapsedHalfDays(); string worldSize = WorldLibraries.GetSize().ToString(); string[] worldProg = GameInfoLibraries.GetVanillaProgressList().ToArray(); int activeItems = ItemLibraries.GetActive().Count; int activeNpcs = NPCLibraries.GetActive().Count; //string[] playerInfos = InfoLibraries.GetCurrentPlayerInfo().ToArray(); //string[] playerEquips = InfoLibraries.GetCurrentPlayerEquipment().ToArray(); int activePlayers = Main.ActivePlayersCount; string netmode = Main.netMode == NetmodeID.SinglePlayer ? "single-player" : "multiplayer"; bool autopause = Main.autoPause; bool autosave = Main.autoSave; int lighting = Lighting.lightMode; int lightingThreads = Lighting.LightingThreads; int frameSkipMode = Main.FrameSkipMode; bool isMaximized = Main.screenMaximized; int windowWid = Main.screenWidth; int windowHei = Main.screenHeight; int qualityStyle = Main.qaStyle; bool bgOn = Main.BackgroundEnabled; bool childSafe = !ChildSafety.Disabled; float gameZoom = Main.GameZoomTarget; float uiZoom = Main.UIScale; list.Add("tModLoader version: " + ModLoader.version.ToString()); list.Add(FormattedGameInfoLibraries.RenderMarkdownModTable(modsList)); list.Add(FormattedGameInfoLibraries.RenderMarkdownPlayersTable()); for (int i = 0; i < Main.player.Length; i++) { Player plr = Main.player[i]; if (plr == null || !plr.active) { continue; } list.Add(FormattedGameInfoLibraries.RenderMarkdownPlayerEquipsTable(plr)); } list.Add("Is day: " + isDay + ", Time of day/night: " + timeOfDay + ", Elapsed half days: " + halfDays); //+ ", Total time (seconds): " + Main._drawInterfaceGameTime.TotalGameTime.Seconds; list.Add("World name: " + StringFormattingLibraries.SanitizeMarkdown(Main.worldName) + ", world size: " + worldSize); list.Add("World progress: " + (worldProg.Length > 0 ? string.Join(", ", worldProg) : "none")); list.Add("Items on ground: " + activeItems + ", Npcs active: " + activeNpcs); //list.Add( "Player info: " + string.Join( ", ", playerInfos ) ); //list.Add( "Player equips: " + (playerEquips.Length > 0 ? string.Join(", ", playerEquips) : "none" ) ); list.Add("Player count: " + activePlayers + " (" + netmode + ")"); list.Add("Autopause: " + autopause); list.Add("Autosave: " + autosave); list.Add("Lighting mode: " + lighting); list.Add("Lighting threads: " + lightingThreads); list.Add("Frame skip mode: " + frameSkipMode); list.Add("Is screen maximized: " + isMaximized); list.Add("Screen resolution: " + windowWid + " " + windowHei); list.Add("Quality style: " + qualityStyle); list.Add("Background on: " + bgOn); list.Add("Child safety: " + childSafe); list.Add("Game zoom: " + gameZoom); list.Add("UI zoom: " + uiZoom); list.Add("FrameworkVersion.Framework: " + Enum.GetName(typeof(Framework), FrameworkVersion.Framework)); list.Add("FrameworkVersion.Version: " + FrameworkVersion.Version.ToString()); return(list); }