public static void InitializeLegacyLocalization() { Lang.FillNameCacheArray <PrefixID, int>("Prefix", Lang.prefix, false); for (int index = 0; index < Lang.gen.Length; ++index) { Lang.gen[index] = Language.GetText("LegacyWorldGen." + (object)index); } for (int index = 0; index < Lang.menu.Length; ++index) { Lang.menu[index] = Language.GetText("LegacyMenu." + (object)index); } for (int index = 0; index < Lang.inter.Length; ++index) { Lang.inter[index] = Language.GetText("LegacyInterface." + (object)index); } for (int index = 0; index < Lang.misc.Length; ++index) { Lang.misc[index] = Language.GetText("LegacyMisc." + (object)index); } for (int index = 0; index < Lang.mp.Length; ++index) { Lang.mp[index] = Language.GetText("LegacyMultiplayer." + (object)index); } for (int index = 0; index < Lang.tip.Length; ++index) { Lang.tip[index] = Language.GetText("LegacyTooltip." + (object)index); } for (int index = 0; index < Lang.chestType.Length; ++index) { Lang.chestType[index] = Language.GetText("LegacyChestType." + (object)index); } for (int index = 0; index < Lang.chestType2.Length; ++index) { Lang.chestType2[index] = Language.GetText("LegacyChestType2." + (object)index); } for (int index = 0; index < Lang.dresserType.Length; ++index) { Lang.dresserType[index] = Language.GetText("LegacyDresserType." + (object)index); } Lang.FillNameCacheArray <ItemID, short>("ItemName", Lang._itemNameCache, false); Lang.FillNameCacheArray <ProjectileID, short>("ProjectileName", Lang._projectileNameCache, false); Lang.FillNameCacheArray <NPCID, short>("NPCName", Lang._npcNameCache, false); Lang.FillNameCacheArray <BuffID, int>("BuffName", Lang._buffNameCache, false); Lang.FillNameCacheArray <BuffID, int>("BuffDescription", Lang._buffDescriptionCache, false); Lang.FillNameCacheArray <EmoteID, int>("EmojiName", Lang._emojiNameCache, true); for (int id = -65; id < 0; ++id) { Lang._negativeNpcNameCache[-id - 1] = Lang._npcNameCache[NPCID.FromNetId(id)]; } Lang._negativeNpcNameCache[0] = Language.GetText("NPCName.Slimeling"); Lang._negativeNpcNameCache[1] = Language.GetText("NPCName.Slimer2"); Lang._negativeNpcNameCache[2] = Language.GetText("NPCName.GreenSlime"); Lang._negativeNpcNameCache[3] = Language.GetText("NPCName.Pinky"); Lang._negativeNpcNameCache[4] = Language.GetText("NPCName.BabySlime"); Lang._negativeNpcNameCache[5] = Language.GetText("NPCName.BlackSlime"); Lang._negativeNpcNameCache[6] = Language.GetText("NPCName.PurpleSlime"); Lang._negativeNpcNameCache[7] = Language.GetText("NPCName.RedSlime"); Lang._negativeNpcNameCache[8] = Language.GetText("NPCName.YellowSlime"); Lang._negativeNpcNameCache[9] = Language.GetText("NPCName.JungleSlime"); Lang._negativeNpcNameCache[53] = Language.GetText("NPCName.SmallRainZombie"); Lang._negativeNpcNameCache[54] = Language.GetText("NPCName.BigRainZombie"); ItemTooltip.AddGlobalProcessor((TooltipProcessor)(tooltip => { if (tooltip.Contains("<right>")) { InputMode index = InputMode.XBoxGamepad; if (PlayerInput.UsingGamepad) { index = InputMode.XBoxGamepadUI; } if (index == InputMode.XBoxGamepadUI) { string newValue = PlayerInput.BuildCommand("", true, PlayerInput.CurrentProfile.InputModes[index].KeyStatus["MouseRight"]).Replace(": ", ""); tooltip = tooltip.Replace("<right>", newValue); } else { tooltip = tooltip.Replace("<right>", Language.GetTextValue("Controls.RightClick")); } } if (tooltip.Contains("<left>")) { InputMode index = InputMode.XBoxGamepad; if (PlayerInput.UsingGamepad) { index = InputMode.XBoxGamepadUI; } if (index == InputMode.XBoxGamepadUI) { string newValue = PlayerInput.BuildCommand("", true, PlayerInput.CurrentProfile.InputModes[index].KeyStatus["MouseLeft"]).Replace(": ", ""); tooltip = tooltip.Replace("<left>", newValue); } else { tooltip = tooltip.Replace("<left>", Language.GetTextValue("Controls.LeftClick")); } } return(tooltip); })); for (int index = 0; index < Lang._itemTooltipCache.Length; ++index) { Lang._itemTooltipCache[index] = ItemTooltip.None; } ((IEnumerable <FieldInfo>) typeof(ItemID).GetFields(BindingFlags.Static | BindingFlags.Public)).Where <FieldInfo>((Func <FieldInfo, bool>)(f => f.FieldType == typeof(short))).ToList <FieldInfo>().ForEach((Action <FieldInfo>)(field => { short num = (short)field.GetValue((object)null); if (num <= (short)0 || (int)num >= Lang._itemTooltipCache.Length) { return; } Lang._itemTooltipCache[(int)num] = ItemTooltip.FromLanguageKey("ItemTooltip." + field.Name); })); }
public static NetworkText CreateDeathMessage( string deadPlayerName, int plr = -1, int npc = -1, int proj = -1, int other = -1, int projType = 0, int plrItemType = 0) { NetworkText networkText1 = NetworkText.Empty; NetworkText networkText2 = NetworkText.Empty; NetworkText networkText3 = NetworkText.Empty; NetworkText networkText4 = NetworkText.Empty; if (proj >= 0) { networkText1 = NetworkText.FromKey(Lang.GetProjectileName(projType).Key); } if (npc >= 0) { networkText2 = Main.npc[npc].GetGivenOrTypeNetName(); } if (plr >= 0 && plr < (int)byte.MaxValue) { networkText3 = NetworkText.FromLiteral(Main.player[plr].name); } if (plrItemType >= 0) { networkText4 = NetworkText.FromKey(Lang.GetItemName(plrItemType).Key); } bool flag1 = networkText1 != NetworkText.Empty; bool flag2 = plr >= 0 && plr < (int)byte.MaxValue; bool flag3 = networkText2 != NetworkText.Empty; NetworkText networkText5 = NetworkText.Empty; NetworkText empty = NetworkText.Empty; NetworkText networkText6 = NetworkText.FromKey(Language.RandomFromCategory("DeathTextGeneric", (UnifiedRandom)null).Key, (object)deadPlayerName, (object)Main.worldName); if (flag2) { networkText5 = NetworkText.FromKey("DeathSource.Player", (object)networkText6, (object)networkText3, flag1 ? (object)networkText1 : (object)networkText4); } else if (flag3) { networkText5 = NetworkText.FromKey("DeathSource.NPC", (object)networkText6, (object)networkText2); } else if (flag1) { networkText5 = NetworkText.FromKey("DeathSource.Projectile", (object)networkText6, (object)networkText1); } else { switch (other) { case 0: networkText5 = NetworkText.FromKey("DeathText.Fell_" + (object)(Main.rand.Next(2) + 1), (object)deadPlayerName); break; case 1: networkText5 = NetworkText.FromKey("DeathText.Drowned_" + (object)(Main.rand.Next(4) + 1), (object)deadPlayerName); break; case 2: networkText5 = NetworkText.FromKey("DeathText.Lava_" + (object)(Main.rand.Next(4) + 1), (object)deadPlayerName); break; case 3: networkText5 = NetworkText.FromKey("DeathText.Default", (object)networkText6); break; case 4: networkText5 = NetworkText.FromKey("DeathText.Slain", (object)deadPlayerName); break; case 5: networkText5 = NetworkText.FromKey("DeathText.Petrified_" + (object)(Main.rand.Next(4) + 1), (object)deadPlayerName); break; case 6: networkText5 = NetworkText.FromKey("DeathText.Stabbed", (object)deadPlayerName); break; case 7: networkText5 = NetworkText.FromKey("DeathText.Suffocated", (object)deadPlayerName); break; case 8: networkText5 = NetworkText.FromKey("DeathText.Burned", (object)deadPlayerName); break; case 9: networkText5 = NetworkText.FromKey("DeathText.Poisoned", (object)deadPlayerName); break; case 10: networkText5 = NetworkText.FromKey("DeathText.Electrocuted", (object)deadPlayerName); break; case 11: networkText5 = NetworkText.FromKey("DeathText.TriedToEscape", (object)deadPlayerName); break; case 12: networkText5 = NetworkText.FromKey("DeathText.WasLicked", (object)deadPlayerName); break; case 13: networkText5 = NetworkText.FromKey("DeathText.Teleport_1", (object)deadPlayerName); break; case 14: networkText5 = NetworkText.FromKey("DeathText.Teleport_2_Male", (object)deadPlayerName); break; case 15: networkText5 = NetworkText.FromKey("DeathText.Teleport_2_Female", (object)deadPlayerName); break; case 16: networkText5 = NetworkText.FromKey("DeathText.Inferno", (object)deadPlayerName); break; case 254: networkText5 = NetworkText.Empty; break; case (int)byte.MaxValue: networkText5 = NetworkText.FromKey("DeathText.Slain", (object)deadPlayerName); break; } } return(networkText5); }
public static string BunnyChat(NPC npc) { object substitutionObject = Lang.CreateDialogSubstitutionObject(npc); return(Language.SelectRandom(Lang.CreateDialogFilter("BunnyChatter.", substitutionObject), (UnifiedRandom)null).FormatWith(substitutionObject)); }
public static string BartenderChat(NPC npc) { object substitutionObject = Lang.CreateDialogSubstitutionObject(npc); return(Main.rand.Next(5) == 0 ? Language.GetTextValueWith(!DD2Event.DownedInvasionT3 ? (!DD2Event.DownedInvasionT2 ? (!DD2Event.DownedInvasionT1 ? "BartenderSpecialText.BeforeDD2Tier1" : "BartenderSpecialText.AfterDD2Tier1") : "BartenderSpecialText.AfterDD2Tier2") : "BartenderSpecialText.AfterDD2Tier3", substitutionObject) : Language.SelectRandom(Lang.CreateDialogFilter("BartenderChatter.", substitutionObject), (UnifiedRandom)null).FormatWith(substitutionObject)); }
public static string GetItemNameValue(int id) { return(Lang.GetItemName(id).Value); }
public static string GetNPCNameValue(int netID) { return(Lang.GetNPCName(netID).Value); }
public static string dialog(int l, bool english = false) { return(Language.GetTextValueWith("LegacyDialog." + (object)l, Lang.CreateDialogSubstitutionObject((NPC)null))); }