Exemplo n.º 1
0
        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, (object)(flag1 ? networkText1 : 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 if (other >= 0)
            {
                if (other == 0)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Fell_" + (object)(Main.rand.Next(2) + 1), (object)deadPlayerName);
                }
                else if (other == 1)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Drowned_" + (object)(Main.rand.Next(4) + 1), (object)deadPlayerName);
                }
                else if (other == 2)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Lava_" + (object)(Main.rand.Next(4) + 1), (object)deadPlayerName);
                }
                else if (other == 3)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Default", (object)networkText6);
                }
                else if (other == 4)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Slain", (object)deadPlayerName);
                }
                else if (other == 5)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Petrified_" + (object)(Main.rand.Next(4) + 1), (object)deadPlayerName);
                }
                else if (other == 6)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Stabbed", (object)deadPlayerName);
                }
                else if (other == 7)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Suffocated", (object)deadPlayerName);
                }
                else if (other == 8)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Burned", (object)deadPlayerName);
                }
                else if (other == 9)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Poisoned", (object)deadPlayerName);
                }
                else if (other == 10)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Electrocuted", (object)deadPlayerName);
                }
                else if (other == 11)
                {
                    networkText5 = NetworkText.FromKey("DeathText.TriedToEscape", (object)deadPlayerName);
                }
                else if (other == 12)
                {
                    networkText5 = NetworkText.FromKey("DeathText.WasLicked", (object)deadPlayerName);
                }
                else if (other == 13)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Teleport_1", (object)deadPlayerName);
                }
                else if (other == 14)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Teleport_2_Male", (object)deadPlayerName);
                }
                else if (other == 15)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Teleport_2_Female", (object)deadPlayerName);
                }
                else if (other == 254)
                {
                    networkText5 = NetworkText.Empty;
                }
                else if (other == (int)byte.MaxValue)
                {
                    networkText5 = NetworkText.FromKey("DeathText.Slain", (object)deadPlayerName);
                }
            }
            return(networkText5);
        }
Exemplo n.º 2
0
 public static string GetItemNameValue(int id)
 {
     return(Lang.GetItemName(id).Value);
 }