// Token: 0x06000005 RID: 5 RVA: 0x000030C8 File Offset: 0x000012C8 public static void CalamityAddLocalizations() { CalamitySupport.Load(); foreach (string[] array in CalamitySupport._localizations) { ModTranslation modTranslation = ModLoader.GetMod("CalamityMod").CreateTranslation(array[0]); modTranslation.SetDefault(array[1]); ModLoader.GetMod("CalamityMod").AddTranslation(modTranslation); } CalamitySupport.Unload(); }
public override void Load() { Instance = this; ZZPlayerInfoOK = RegisterHotKey("人物信息菜单", "P"); //ZZRecipeInfoOK = RegisterHotKey("物品合成菜单", "O"); /*ZZRecipeInfoUI = new ZZRicipeInfo(); * ZZRecipeInfoUI.Activate(); * ZZRecipeInterfaceUserInfo = new UserInterface(); * ZZRecipeInterfaceUserInfo.SetState(ZZRecipeInfoUI); */ ZZBuffInfoOK = RegisterHotKey("免疫buff信息", "O"); if (!Main.dedServ) { ZZBuffInfoUI = new ZZBuffInfo(); ZZBuffInfoUI.Activate(); ZZBuffInterfaceUserInfo = new UserInterface(); ZZBuffInterfaceUserInfo.SetState(ZZBuffInfoUI); ZZPlayerInfoUI = new ZZPlayerInfo(); ZZPlayerInfoUI.Activate(); ZZPlayerInterfaceUserInfo = new UserInterface(); ZZPlayerInterfaceUserInfo.SetState(ZZPlayerInfoUI); } instance = this; if (ModLoader.GetMod("CalamityMod") != null && LanguageManager.Instance.ActiveCulture == GameCulture.Chinese) { Mod mod = ModLoader.GetMod("CalamityMod"); CalamitySupport.CalamityAddLocalizations(); } if (ModLoader.GetMod("ThoriumMod") != null && LanguageManager.Instance.ActiveCulture == GameCulture.Chinese) { Mod mod = ModLoader.GetMod("ThoriumMod"); ThoriumSupport.AddLocalizations(); } }
public static string zoneString(Player player) { string zone = "所处环境: "; int num22 = (int)((double)((Main.player[Main.myPlayer].position.Y + (float)Main.player[Main.myPlayer].height) * 2f / 16f) - Main.worldSurface * 2.0); if (Main.player[Main.myPlayer].ZoneTowerSolar) { zone += "\n日耀柱"; } if (Main.player[Main.myPlayer].ZoneTowerNebula) { zone += "\n星云柱"; } if (Main.player[Main.myPlayer].ZoneTowerVortex) { zone += "\n星璇柱"; } if (Main.player[Main.myPlayer].ZoneTowerStardust) { zone += "\n星尘柱"; } if (Main.player[Main.myPlayer].ZoneSnow) { zone += "\n苔原"; } if (Main.player[Main.myPlayer].ZoneJungle) { zone += "\n丛林"; } if (Main.player[Main.myPlayer].ZoneCrimson) { zone += "\n血腥之地"; } if (Main.player[Main.myPlayer].ZoneDesert) { zone += "\n沙漠"; } if (Main.player[Main.myPlayer].ZoneRain) { zone += "\n雨天"; } if (Main.player[Main.myPlayer].ZoneSandstorm) { zone += "\n沙尘暴"; } if (Main.player[Main.myPlayer].ZoneBeach) { zone += "\n海洋"; } if (Main.player[Main.myPlayer].ZoneGlowshroom) { zone += "\n荧光蘑菇地"; } if (Main.player[Main.myPlayer].ZoneCorrupt) { zone += "\n腐化之地"; } if (Main.player[Main.myPlayer].ZoneDungeon) { zone += "\n地牢"; } if (Main.player[Main.myPlayer].ZoneHoly) { zone += "\n神圣之地"; } if (Main.player[Main.myPlayer].ZoneMeteor) { zone += "\n陨石"; } if (Main.player[Main.myPlayer].ZoneSkyHeight) { zone += "\n太空"; } bool zoneMarble = false; bool zoneGranite = false; int num26 = (int)Main.player[Main.myPlayer].Center.X / 16; int num27 = (int)(Main.player[Main.myPlayer].Bottom.Y + 8f) / 16; if (Main.tile[num26, num27].type == 367) { zoneMarble = true; } if (Main.tile[num26, num27].type == 368) { zoneGranite = true; } if (zoneMarble) { zone += "\n大理石穴"; } if (zoneGranite) { zone += "\n花岗岩穴"; } bool spiderCave = false; int num39 = (int)Main.player[Main.myPlayer].position.X / 16; int num40 = (int)Main.player[Main.myPlayer].position.Y / 16; if (Main.tile[num39, num40].wall == 62) { spiderCave = true; } if (spiderCave) { zone += "\n蜘蛛洞"; } bool lihzahrd = false; int num7 = (int)(Main.player[Main.myPlayer].position.X + (float)(Main.player[Main.myPlayer].width / 2)) / 16; int num8 = (int)(Main.player[Main.myPlayer].position.Y + (float)(Main.player[Main.myPlayer].height / 2)) / 16; if (Main.tile[num7, num8].wall == 87) { lihzahrd = true; } if (lihzahrd) { zone += "\n蜥蜴神庙"; } if (ModLoader.GetMod("AAMod") != null) { zone += AASupport.AAZone(player); } if (ModLoader.GetMod("CalamityMod") != null) { zone += CalamitySupport.CalamityZone(player); } if (ModLoader.GetMod("ThoriumMod") != null) { zone += ThoriumSupport.ThoriumZone(player); } if (ModLoader.GetMod("SacredTools") != null) { zone += SacredtoolsSupport.SacredToolsZone(player); } if (ModLoader.GetMod("Redemption") != null) { zone += ModRedemption.ModRedemptionZone(player); } if (zone == "所处环境: ") { if (Main.player[Main.myPlayer].position.Y > (float)((Main.maxTilesY - 204) * 16)) { zone += "\n地狱"; } else if ((double)Main.player[Main.myPlayer].position.Y > Main.rockLayer * 16.0 + (double)(1200 / 2) + 16.0) { zone += "\n洞穴"; } else if (num22 > 0) { zone += "\n地下"; } else if ((float)((double)((Main.screenPosition.Y + (float)(Main.screenHeight / 2)) / 16f - (65f + 10f * (float)(Main.maxTilesX / 4200))) / (Main.worldSurface / 5.0)) >= 1f) { zone += "\n森林"; } else { zone = ""; } } ; return(zone); }
public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { if (ModLoader.GetMod("CalamityMod") != null && LanguageManager.Instance.ActiveCulture == GameCulture.Chinese) { CalamitySupport.CalamityNPCChat(); } if (ModLoader.GetMod("ThoriumMod") != null && LanguageManager.Instance.ActiveCulture == GameCulture.Chinese) { ThoriumSupport.ThoriumBardClass(); } if (ModLoader.GetMod("Redemption") != null && LanguageManager.Instance.ActiveCulture == GameCulture.Chinese) { ModRedemption.ModRedemptionCombat(); ModRedemption.ModRedemptionChat(); } Player player = Main.player[Main.myPlayer]; ZZLocalizationMod.instance.ZZPlayerInfoUI.UpdateValue(player); ZZLocalizationMod.instance.ZZBuffInfoUI.UpdateValue(player); int inventoryIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Info Accessories Bar")); if (inventoryIndex != -1) { layers.Insert(inventoryIndex, new LegacyGameInterfaceLayer( "ZZLocalizationMod: Info Accessories Bar2", delegate { DrawInterfaceInfoAccs(); return(true); }, InterfaceScaleType.UI) ); } int MouseTextIndexP = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndexP != -1) { layers.Insert(MouseTextIndexP, new LegacyGameInterfaceLayer( "ZZLocalizationMod: PlayerInfo", delegate { if (ZZPlayerInfo.visible) { ZZPlayerInfoUI.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } int MouseTextIndexB = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndexB != -1) { layers.Insert(MouseTextIndexB, new LegacyGameInterfaceLayer( "ZZLocalizationMod: PlayerInfo", delegate { if (ZZBuffInfo.visible) { ZZBuffInfoUI.Draw(Main.spriteBatch); } return(true); }, InterfaceScaleType.UI) ); } /* int MouseTextIndexP2 = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Info Accessories Bar")); * if (MouseTextIndexP2 != -1) * { * layers.Insert(MouseTextIndexP2, new LegacyGameInterfaceLayer( * "ZZLocalizationMod: RecipeInfo", * delegate * { * if (ZZRicipeInfo.visible) * { * ZZRecipeInfoUI.Draw(Main.spriteBatch); * } * return true; * }, * InterfaceScaleType.UI) * ); * } */ }
public override void PostSetupContent() { CalamitySupport.Setup(); }
public static void Setup() { CalamitySupport.BossChecklistSupport(); }
internal static void Setup(Mod ZZLocalizationMod) { // Save format: /* * .. hmm, vanilla item drops...do I have to recalculate each time? New Set of mods => complete refresh? * * ZZLocalizationModVersion // So if we add more features we can ignore this file * [ of Mod Info * -> ModName * -> Version * -> [ of npc drop info? or item info? * --> Tuple<JSONNPC, LootItem[]> or * --> JSONNPC<T> * --> * ---> OR * --> Item Info * ---> ["NPCInfo" with droprate] * --> * -> ] * ] * * hmm, instead of mod info, just a list of npc? just a list of Item? * * <Mod, Version>[] --> For knowing which have updated....for now, any update or unaccounted mod, recalculate allll * ItemInfo[] JSONNPC and array of JSONNPC that drop it. (forget droprates for now?) * * * item to npc or npc to item.... */ string json; string filename = "zzmodLootCache.json"; string folder = Path.Combine(Main.SavePath, "Mods", "Cache"); string path = Path.Combine(folder, filename); LootCache li = new LootCache(); bool needsRecalculate = true; LootCacheManagerActive = true; List <string> modsThatNeedRecalculate = new List <string>(); if (File.Exists(path)) { using (StreamReader r = new StreamReader(path)) { json = r.ReadToEnd(); li = JsonConvert.DeserializeObject <LootCache>(json, new JsonSerializerSettings { Converters = { new Newtonsoft.Json.Converters.VersionConverter() } }); needsRecalculate = false; if (li == null) // Investigate why some people get LootCache.json with only 0s in it. { li = new LootCache(); } } } // New Recipe Browser version, assume total reset needed (adjust this logic next update.) if (li.ZZLocalizationModVersion != ZZLocalizationMod.Version) { li.lootInfos.Clear(); li.cachedMods.Clear(); li.ZZLocalizationModVersion = ZZLocalizationMod.Version; needsRecalculate = true; } // If we aren't up to date on each mod... foreach (var m in ModLoader.Mods) { if (/*mod == "ModLoader" || */ m.Name == "ZZLocalizationMod") { continue; } string modName = m.Name == "ModLoader" ? "Terraria" : m.Name; if (!li.cachedMods.Any(x => x.Key == modName && x.Value == m.Version)) // if this mod is either updated or doesn't exist yet //if (li.cachedMods.ContainsKey(modName) && li.cachedMods[modName] == m.Version) { if (m.Version >= new Version(0, 6, 3)) { needsRecalculate = true; } // Remove mod from list li.cachedMods.Remove(modName); // Remove items from this mod var toRemove = li.lootInfos.Where(pair => pair.Key.mod == modName) // Can't detect if a vanilla npc dropping a vanilla is because of mod. It's fine .Select(pair => pair.Key) .ToList(); foreach (var key in toRemove) { li.lootInfos.Remove(key); } // Remove npc from items. foreach (var itemToNPCs in li.lootInfos) { itemToNPCs.Value.RemoveAll(x => x.mod == modName); } modsThatNeedRecalculate.Add(modName); modsThatNeedRecalculate.Add("Terraria"); li.cachedMods[modName] = m.Version; // (new Tuple<string, Version>(modName, m.Version)); } } //li.cachedMods.Add(new Tuple<string, Version>(m.Name, m.Version)); if (needsRecalculate) { // Temp variables float soundVolume = Main.soundVolume; Main.soundVolume = 0f; if (!Main.dedServ) { try { Reflect(); } catch { } } setLoadProgressText?.Invoke("正在重新计算掉落物品,时间较长请稍等"); setLoadProgressProgress?.Invoke(0f); // expert drops? for (int playernum = 0; playernum < 256; playernum++) { Main.player[playernum] = new Player(); for (int i = 0; i < 50; i++) { Main.player[playernum].inventory[i].type = 3507; } } //Main.player[0].active = true; // Fix Terraria Overhaul bug if (Main.maxTilesY < 600 || Main.maxTilesX < 2100) { Main.maxTilesX = 8400; Main.maxTilesY = 2400; Main.tile = new Tile[Main.maxTilesX + 1, Main.maxTilesY + 1]; } int oldMx = Main.maxTilesX; Main.maxTilesX = 2100; int oldMy = Main.maxTilesY; Main.maxTilesY = 600; for (int x = 0; x < Main.maxTilesX; x++) { for (int y = 0; y < Main.maxTilesY; y++) { Main.tile[x, y] = new Tile(); Main.tile[x, y].type = 0; if (y > Main.maxTilesY * 0.3f) { Main.tile[x, y].active(true); } } } Main.worldSurface = 200; //Main.netMode = 1; // hope this doesn't do anything weird NPC npc = new NPC(); Item item = new Item(); loots = new HashSet <int>(); string lastMod = ""; var watch = Stopwatch.StartNew(); var oldRand = Main.rand; if (Main.rand == null) { Main.rand = new Terraria.Utilities.UnifiedRandom(); } Main.hardMode = true; Main.expertMode = true; CalamitySupport.CalamityCalculateLootLoad(); ThoriumSupport.ThoriumCalculateLootLoad(); AASupport.AACalculateLootLoad(); SacredtoolsSupport.SacredtoolsCalculateLootLoad(); ModRedemption.ModRedemptionCalculateLootLoad(); for (int i = 1; i < NPCLoader.NPCCount; i++) // for every npc... { npc.SetDefaults(i); npc.value = 0; // Causes some drops to be missed, why is this here? string currentMod = npc.modNPC?.mod.Name ?? "Terraria"; if (!modsThatNeedRecalculate.Contains(currentMod)) { continue; } if (lastMod != currentMod) { lastMod = currentMod; setLoadSubProgressText?.Invoke(lastMod); } setLoadProgressProgress?.Invoke((float)i / NPCLoader.NPCCount); JSONNPC jsonNPC = new JSONNPC(npc.modNPC?.mod.Name ?? "Terraria", npc.modNPC?.Name ?? npc.TypeName, npc.modNPC != null ? 0 : i); loots.Clear(); CalculateLoot(npc, Main.player[0]); // ...calculate drops foreach (var loot in loots) { if (ignoreItemIDS.Contains(loot)) { continue; } item.SetDefaults(loot, true); //JSONItem jsonitem = new JSONItem(item.modItem?.mod.Name ?? "Terraria", Lang.GetItemNameValue(loot), item.modItem != null ? 0 : loot); JSONItem jsonitem = new JSONItem(item.modItem?.mod.Name ?? "Terraria", item.modItem?.Name ?? Lang.GetItemNameValue(loot), item.modItem != null ? 0 : loot); if (!li.lootInfos.TryGetValue(jsonitem, out LootInfo.npcsthatdropme)) { li.lootInfos.Add(jsonitem, LootInfo.npcsthatdropme = new List <JSONNPC>()); } LootInfo.npcsthatdropme.Add(jsonNPC); } } loots.Clear(); // Reset temp values Main.rand = oldRand; // value 8 seconds. // don't value to 0 and ignore.contains: 5 seconds. // value to 0, contains, 4 seconds. .6 seconds without contains. Main.maxTilesX = oldMx; Main.maxTilesY = oldMy; Main.soundVolume = soundVolume; // Save json: watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; //li.iterations = MaxNumberLootExperiments; li.lastUpdateTime = elapsedMs; Directory.CreateDirectory(folder); json = JsonConvert.SerializeObject(li, Formatting.Indented, new JsonSerializerSettings { Converters = { new Newtonsoft.Json.Converters.VersionConverter() } }); File.WriteAllText(path, json); // Reset Load Mods Progress bar setLoadSubProgressText?.Invoke(""); setLoadProgressText?.Invoke("添加合成"); setLoadProgressProgress?.Invoke(0f); } LootCacheManagerActive = false; LootCache.instance = li; }