private Texture2D EmitSwapTitleMenuDelegate(Texture2D input, NPC npc)
 {
     if (StarlightWorld.TownUpgrades.TryGetValue(npc.TypeName, out bool unlocked) && unlocked)
     {
         return(TownUpgrade.FromString(npc.TypeName).icon);
     }
     return(input);
 }
 private string EmitSwapTitleDelegate(NPC npc, string input)
 {
     if (StarlightWorld.TownUpgrades.TryGetValue(npc.TypeName, out bool unlocked) && unlocked)
     {
         return(npc.GivenName + " the " + TownUpgrade.FromString(npc.TypeName)._title);
     }
     return(input);
 }
 private NetworkText EmitSwapTitleDeathDelegate(NetworkText input, NPC npc)
 {
     if (StarlightWorld.TownUpgrades.TryGetValue(npc.TypeName, out bool unlocked) && unlocked)
     {
         return(NetworkText.FromLiteral(npc.GivenName + " the " + TownUpgrade.FromString(npc.TypeName)._title + " was slain..."));
     }
     return(input);
 }
        private string EmitSwapTextMenuDelegate(string input, NPC npc, int x, int y)
        {
            bool hovering = Main.mouseX >= x && Main.mouseX <= x + Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= y && Main.mouseY <= y + Main.inventoryBackTexture.Height * Main.inventoryScale;

            if (hovering && string.IsNullOrEmpty(input) && Main.mouseItem.type == ItemID.None && StarlightWorld.TownUpgrades.TryGetValue(npc.TypeName, out bool unlocked) && unlocked)
            {
                return(npc.GivenName + " the " + TownUpgrade.FromString(npc.TypeName)._title);
            }
            return(input);
        }
Example #5
0
        private string SetUpgradeUI(On.Terraria.NPC.orig_GetChat orig, NPC self)
        {
            if (StarlightWorld.TownUpgrades.TryGetValue(self.TypeName, out bool unlocked) && unlocked)
            {
                Instance.Chatbox.SetState(TownUpgrade.FromString(self.TypeName));
            }
            else
            {
                Instance.Chatbox.SetState(new LockedUpgrade());
            }

            return(orig(self));
        }
Example #6
0
        public void PopulateList()
        {
            quests.Clear();

            int offY = 0;

            foreach (KeyValuePair <string, bool> pair in StarlightWorld.TownUpgrades)
            {
                if (TownUpgrade.FromString(pair.Key) != null)
                {
                    AddQuestButton(new TownQuestItem(TownUpgrade.FromString(pair.Key)), offY);
                }
                offY += 28 + 6;
            }
        }
        private string SetUpgradeUI(On.Terraria.NPC.orig_GetChat orig, NPC self)
        {
            if (StarlightWorld.TownUpgrades.TryGetValue(self.TypeName, out bool unlocked))
            {
                if (unlocked)
                {
                    UILoader.GetUIState <ChatboxOverUI>().SetState(TownUpgrade.FromString(self.TypeName));
                }
                else
                {
                    UILoader.GetUIState <ChatboxOverUI>().SetState(new LockedUpgrade());
                }
            }
            else
            {
                UILoader.GetUIState <ChatboxOverUI>().SetState(null);
            }

            return(orig(self));
        }