Пример #1
0
        public override void Click(UIMouseEvent evt)
        {
            Player player = Main.LocalPlayer;

            if (hunt.available())
            {
                int item = player.FindItem(hunt.item);
                if (item != -1)
                {
                    player.inventory[item].stack--;
                    if (player.inventory[item].stack <= 0)
                    {
                        player.inventory[item] = new Item();
                    }
                    Main.npcChatText = hunt.completeText;
                    JoostMod.instance.HideHuntUI();
                    Main.PlaySound(24, -1, -1, 1, 1f, 0f);
                    hunt.reward(player);
                    return;
                }
                else if (!hunt.completed())
                {
                    Main.npcChatText = hunt.questText;
                    JoostMod.instance.HideHuntUI();
                    Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 1, 1, -0.5f);
                    if (!JoostWorld.activeQuest.Contains(hunt.NPC))
                    {
                        Main.NewText(Lang.GetNPCNameValue(hunt.NPC), 225, 25, 25);
                        Main.NewText("The Hunt Begins!", 225, 25, 25);
                        JoostWorld.activeQuest.Add(hunt.NPC);
                        if (Main.netMode == 1)
                        {
                            ModPacket packet = JoostMod.instance.GetPacket();
                            packet.Write((byte)JoostModMessageType.ActiveQuest);
                            packet.Write(hunt.NPC);
                            packet.Send();
                        }
                    }
                }
            }
        }