Beispiel #1
0
        public override void PostDraw(SpriteBatch spriteBatch, Color drawColor)
        {
            Texture2D         texture           = mod.GetTexture("Miscellaneous/QuestIcon2");
            Texture2D         texture2          = mod.GetTexture("Miscellaneous/QuestIcon3");
            Player            player            = Main.LocalPlayer;
            PirateQuestSystem pirateQuestSystem = player.GetModPlayer <PirateQuestSystem>();

            if (pirateQuestSystem.CurrentPirateQuest == -1 && !ModContent.GetInstance <AntiarisWorld>().FinishedPirateQuest)
            {
                if (texture == null)
                {
                    return;
                }
                Vector2 origin   = new Vector2(texture.Width / 2, texture.Height / 2);
                float   y        = 50.0f;
                Vector2 position = npc.Center - Main.screenPosition - new Vector2(0.0f, y);
                spriteBatch.Draw(texture, position, null, Color.White, 0, origin, npc.scale, SpriteEffects.None, 0.0f);
            }
            foreach (Item item in player.inventory)
            {
                if (item.type == ModContent.ItemType <MagicalAmulet>() && pirateQuestSystem.CurrentPirateQuest != -1)
                {
                    if (texture == null)
                    {
                        return;
                    }
                    Vector2 origin   = new Vector2(texture.Width / 2, texture.Height / 2);
                    float   y        = 50.0f;
                    Vector2 position = npc.Center - Main.screenPosition - new Vector2(0.0f, y);
                    spriteBatch.Draw(texture2, position, null, Color.White, 0, origin, npc.scale, SpriteEffects.None, 0.0f);
                }
            }
        }
Beispiel #2
0
        public override void AI()
        {
            npc.rotation = 0f;
            Player            player            = Main.LocalPlayer;
            PirateQuestSystem pirateQuestSystem = player.GetModPlayer <PirateQuestSystem>(mod);

            npc.velocity.X = 0f;
            npc.velocity.Y = 5f;
            npc.direction  = npc.spriteDirection;
            if (player.position.X > (double)npc.position.X)
            {
                npc.spriteDirection = 1;
            }
            else if (player.position.X < (double)npc.position.X)
            {
                npc.spriteDirection = -1;
            }
            if (Pirate.Completed)
            {
                npc.townNPC = false;
                timer++;
            }
            if (Main.netMode != NetmodeID.MultiplayerClient && npc.townNPC)
            {
                npc.homeless  = false;
                npc.homeTileX = -1;
                npc.homeTileY = -1;
                npc.netUpdate = true;
            }
        }
Beispiel #3
0
        void PirateQuest()
        {
            PirateQuestSystem pirateQuestSystem = Main.LocalPlayer.GetModPlayer <PirateQuestSystem>(mod);

            if (Pirate.Completed)
            {
                Main.npcChatText       = Language.GetTextValue("Mods.Antiaris.PirateCompleted");
                Main.npcChatCornerItem = 0;
            }
            else if (pirateQuestSystem.CurrentPirateQuest == -1)
            {
                int NewQuest = PirateQuestSystem.ChooseNewQuest();
                Main.npcChatText       = PirateQuestSystem.Quests[NewQuest].ToString();
                Main.npcChatCornerItem = PirateQuestSystem.Quests[NewQuest].ItemType;
                pirateQuestSystem.CurrentPirateQuest = NewQuest;
                return;
            }
            else
            {
                if (pirateQuestSystem.CheckQuest())
                {
                    Main.npcChatText       = pirateQuestSystem.GetCurrentQuest().SayThanks();
                    Main.npcChatCornerItem = 0;
                    pirateQuestSystem.SpawnReward(npc);
                    pirateQuestSystem.CompleteQuest();
                    ;
                    return;
                }
                else
                {
                    Main.npcChatText       = pirateQuestSystem.GetCurrentQuest().ToString();
                    Main.npcChatCornerItem = pirateQuestSystem.GetCurrentQuest().ItemType;
                }
            }
        }
Beispiel #4
0
            public override void SendClientChanges(ModPlayer clientPlayer)
            {
                PirateQuestSystem clone = clientPlayer as PirateQuestSystem;

                if (clone.CurrentPirateQuest != CurrentPirateQuest)
                {
                    ModPacket packet = mod.GetPacket();
                    packet.Write((byte)4);
                    packet.Write(player.whoAmI);
                    packet.Write(CurrentPirateQuest);
                    packet.Send();
                }
            }
Beispiel #5
0
            public override void clientClone(ModPlayer clientClone)
            {
                PirateQuestSystem clone = clientClone as PirateQuestSystem;

                clone.CurrentPirateQuest = CurrentPirateQuest;
            }