public override void ProcessTriggers(TriggersSet triggersSet) { if (IMPCN.instance.ShowTextKey.JustPressed) { Item item = Main.HoverItem; int id; if (item == null) { Tile tile = Main.tile[Main.mouseX, Main.mouseY]; if (tile == null || tile.type == 0) { return; } id = tile.blockType(); } else { id = item.type; } ItemWithName info = IMPCNExtension.GetItem(id); if (info == null) { ModItem modItem = ItemLoader.GetItem(id); item = modItem.item; info = new ItemWithName( id: id, clazz: item.GetType().Name, english: modItem.DisplayName.GetDefault(), original: modItem.DisplayName.GetTranslation(GameCulture.Chinese) ); } QueryItemNameCommand.WriteItem(info); } }
public override void Unload() { instance = null; random = null; titles = null; ShowTextKey = null; IMPCNExtension.Unload(); }
public override void Load() { instance = this; IMPCNExtension.Load(); Main.versionNumber = "v1.3.5.2\nIMPCN v" + instance.Version.ToString(); Main.versionNumber2 = "v1.3.5.2\nIMPCN v" + instance.Version.ToString(); ShowTextKey = RegisterHotKey("查询物品名称(鼠标悬停)", "Z"); // The new version of tModLoader has been updated C#. if (ModLoader.version < new Version(0, 11)) { throw new Exception("\nThis mod uses functionality only present in the latest tModLoader. Please update tModLoader to use this mod\n\n"); } if (random == null) { random = new Random(); } //LoadAlternateChinese(LanguageManager.Instance); if (LanguageManager.Instance.ActiveCulture == GameCulture.Chinese) { Mod thoriumMod = ModLoader.GetMod("ThoriumMod"); Version fixed_vers = new Version(1, 5, 1, 2); // ThoriumMod fixed the bug in version 1.5.1.2. // If exists ThoriumMod, and its version lower than 1.5.1.2. if (thoriumMod != null && thoriumMod.Version < fixed_vers) { LoadAlternateChinese(LanguageManager.Instance, "Terraria.Localization.ContentForThoriumMod."); // see RemarkOfThoriumMod.txt for details. } else { LoadAlternateChinese(LanguageManager.Instance, "Terraria.Localization.Content."); } } }
public override void Action(CommandCaller caller, string input, string[] args) { if (args.Length != 1) { Main.NewText("非法参数", Colors.RarityRed); return; } if (IMPCNExtension.enabled) { System.Collections.Generic.HashSet <ItemWithName> item = IMPCNExtension.GetExactItem(args[0].Replace('_', ' ')); if (item == null) { Main.NewText("未找到该物品", Colors.RarityRed); return; } Main.NewText("找到" + item.Count + "个结果"); foreach (ItemWithName ii in item) { WriteItem(ii); } return; } }