Ejemplo n.º 1
0
        public static Splayer GetModPlayer()
        {
            Player  player    = Main.player[Main.myPlayer];
            Splayer modPlayer = player.GetModPlayer <Splayer>();

            return(modPlayer);
        }
Ejemplo n.º 2
0
        public override void NPCLoot(NPC npc)
        {
            Splayer splayer = Main.LocalPlayer.GetModPlayer <Splayer>();

            if (splayer.activeBossTask != null)
            {
                if (splayer.activeBossTask.targetIDs.Contains(npc.type) && npc.boss)
                {
                    Item.NewItem(npc.getRect(), splayer.activeBossTask.reward);
                    splayer.RemoveBossTask();
                }
            }
        }
Ejemplo n.º 3
0
        public override void OnHitByItem(NPC npc, Player player, Item item, int damage, float knockback, bool crit)
        {
            Splayer splayer = player.GetModPlayer <Splayer>();

            if (splayer.activeTask != null)
            {
                if (npc.life <= 0 && splayer.activeTask.targetIDs.Contains(npc.type))
                {
                    splayer.activeTask.UpdateProgress();
                    //SlayerUI.UpdateUITask(splayer.activeTask);
                }
            }

            base.OnHitByItem(npc, player, item, damage, knockback, crit);
        }
Ejemplo n.º 4
0
        public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit)
        {
            Splayer splayer = Main.player[projectile.owner].GetModPlayer <Splayer>();

            if (splayer.activeTask != null)
            {
                if (npc.life <= 0 && splayer.activeTask.targetIDs.Contains(npc.type))
                {
                    splayer.activeTask.UpdateProgress();
                    //SlayerUI.UpdateUITask(splayer.activeTask);
                }
            }

            base.OnHitByProjectile(npc, projectile, damage, knockback, crit);
        }
Ejemplo n.º 5
0
        public override void OnChatButtonClicked(bool firstButton, ref bool openShop) //Allows you to make something happen whenever a button is clicked on this town NPC's chat window. The firstButton parameter tells whether the first button or second button (button and button2 from SetChatButtons) was clicked. Set the shop parameter to true to open this NPC's shop.
        {
            Splayer splayer = SlayerMod.GetModPlayer();

            if (firstButton)
            {
                openShop = true;   //so when you click on buy button opens the shop
            }
            else
            {
                if (Main.LocalPlayer.HasItem(ItemType <BossMedallion>()))
                {
                    if (splayer.activeBossTask != null)
                    {
                        Main.npcChatText = "What? Are you afraid? GO!!!";
                    }
                    else
                    {
                        splayer.UpdateBossTask(new BossTask());
                        Main.npcChatText = $"I have a special task for you today... I want you to kill {splayer.activeBossTask.target.bossName}. Good Luck.";
                    }
                }
                else
                {
                    if (splayer.activeTask != null)
                    {
                        if (splayer.activeTask.progress >= splayer.activeTask.quantity)
                        {
                            Main.npcChatText = $"Congratulations, you have completed the task, here's your {splayer.activeTask.reward} medals!";
                            Main.LocalPlayer.QuickSpawnItem(ItemType <SlayerMedalItem>(), splayer.activeTask.reward);
                            splayer.RemoveTask();
                        }
                        else
                        {
                            Main.npcChatText = $"You haven't killed all those {splayer.activeTask.targets[0].FullName}, you've killed only {splayer.activeTask.progress}! Go back there!";
                        }
                    }
                    else
                    {
                        splayer.UpdateTask(new Task());
                        //SlayerUI.UpdateUITask(splayer.activeTask);

                        Main.npcChatText = $"Go kill {splayer.activeTask.quantity} {splayer.activeTask.targets[0].FullName}, {Main.LocalPlayer.name}";
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public void SetPlayer(Splayer modPlayer)
 {
     splayer = modPlayer;
 }