Exemplo n.º 1
0
        public override void Update(Player player, ref int buffIndex)
        {
            int SkillLevel = PlayerMod.GetPlayerSkillBuffLevel(player, player.buffType[buffIndex]);

            player.moveSpeed  += 0.03f + SkillLevel * 0.02f;
            player.meleeSpeed += 0.03f + SkillLevel * 0.02f;
        }
Exemplo n.º 2
0
        public static decimal CritDamage(this PlayerMod mod)
        {
            var critDamage = default(decimal);

            if (mod.PrimaryTypeId == (int)ModStatTypes.Critical_Damage)
            {
                critDamage += mod.PrimaryValue;
            }

            if (mod.Secondary1TypeId == (int)ModStatTypes.Critical_Damage)
            {
                critDamage += mod.Secondary1Value;
            }

            if (mod.Secondary2TypeId == (int)ModStatTypes.Critical_Damage)
            {
                critDamage += mod.Secondary2Value;
            }

            if (mod.Secondary3TypeId == (int)ModStatTypes.Critical_Damage)
            {
                critDamage += mod.Secondary3Value;
            }

            if (mod.Secondary4TypeId == (int)ModStatTypes.Critical_Damage)
            {
                critDamage += mod.Secondary4Value;
            }

            return(critDamage);
        }
Exemplo n.º 3
0
        private void CheckExerciseButtonAction()
        {
            TerraGuardian tg = Dialogue.GetSpeaker;
            PlayerMod     pm = Main.player[Main.myPlayer].GetModPlayer <PlayerMod>();

            if (pm.CurrentExercise == ExerciseTypes.WaitUntilNextDay)
            {
                Dialogue.ShowEndDialogueMessage("*There is no other exercise for you today. For your muscles to recover from today's exercise, wait until tomorrow.*", false);
            }
            else if (pm.ExerciseCounter <= 0)
            {
                int FitBuffID   = Terraria.ModLoader.ModContent.BuffType <Buffs.Fit>();
                int NewBuffTime = 30 * 60 * 60;
                if (pm.player.HasBuff(FitBuffID))
                {
                    for (int b = 0; b < pm.player.buffType.Length; b++)
                    {
                        if (pm.player.buffType[b] == FitBuffID)
                        {
                            NewBuffTime += pm.player.buffTime[b];
                            if (NewBuffTime > 60 * 60 * 60)
                            {
                                NewBuffTime = 60 * 60 * 60;
                            }
                            break;
                        }
                    }
                }
                pm.player.AddBuff(FitBuffID, NewBuffTime);
                pm.ExercisesDone++;
                if (pm.ExercisesDone >= 10)
                {
                    pm.ExercisesDone = 0;
                    tg.IncreaseFriendshipProgress(1);
                    Dialogue.ShowEndDialogueMessage("*Good job, [nickname]. You have really impressed me those days. Let your muscles take a rest until tomorrow and then I will give you another exercise.*");
                }
                else
                {
                    Dialogue.ShowEndDialogueMessage("*Good job, [nickname]. Now take a rest and return to me tomorrow for another exercise.*");
                }
                pm.CurrentExercise = ExerciseTypes.WaitUntilNextDay;
            }
            else
            {
                switch (pm.CurrentExercise)
                {
                case ExerciseTypes.AttackTimes:
                    Dialogue.ShowEndDialogueMessage("*I tasked you into attacking anything a number of times. It seems like you still need to hit anything " + (int)pm.ExerciseCounter + " times. I'm sure you know how you will do that.*", false);
                    break;

                case ExerciseTypes.JumpTimes:
                    Dialogue.ShowEndDialogueMessage("*I told you to jump a number of times. You still need to jump " + (int)pm.ExerciseCounter + " more times to complete this exercise.*", false);
                    break;

                case ExerciseTypes.TravelDistance:
                    Dialogue.ShowEndDialogueMessage("*You need to travel " + (int)(pm.ExerciseCounter * 0.5f) + " feets more to complete this exercise.*", false);
                    break;
                }
            }
        }
Exemplo n.º 4
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            bool PlayerHasDomino = PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], GuardianBase.Domino);

            if (PlayerHasDomino || (DominoDismissed && !PlayerMod.PlayerHasGuardianSummoned(Main.player[Main.myPlayer], BrutusID)))
            {
                Main.npcChatText = "*Thanks mate.*";
                PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID);
                if (!PlayerHasDomino)
                {
                    PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
                }
                NpcMod.AddGuardianMet(GuardianID, GuardianModID);
                WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                //npc.Transform(ModContent.NPCType<GuardianNPC.List.DogGuardian>());
            }
            if (DialogueStep == 10)
            {
                AcceptedIn   = firstButton;
                DialogueTime = DialogueDelay;
                if (firstButton)
                {
                    Main.npcChatText = "*Wise choice, Terrarian.*";
                }
                else
                {
                    Main.npcChatText = "*Eh... Alright... Go Team Brutus... Happy now?*";
                }
            }
        }
Exemplo n.º 5
0
        public static decimal Tenacity(this PlayerMod mod)
        {
            var tenacity = default(decimal);

            if (mod.PrimaryTypeId == (int)ModStatTypes.Tenacity)
            {
                tenacity += mod.PrimaryValue;
            }

            if (mod.Secondary1TypeId == (int)ModStatTypes.Tenacity)
            {
                tenacity += mod.Secondary1Value;
            }

            if (mod.Secondary2TypeId == (int)ModStatTypes.Tenacity)
            {
                tenacity += mod.Secondary2Value;
            }

            if (mod.Secondary3TypeId == (int)ModStatTypes.Tenacity)
            {
                tenacity += mod.Secondary3Value;
            }

            if (mod.Secondary4TypeId == (int)ModStatTypes.Tenacity)
            {
                tenacity += mod.Secondary4Value;
            }

            return(tenacity);
        }
Exemplo n.º 6
0
 private static void ChangeQuest(int NewQuestPosition)
 {
     if (NewQuestPosition >= 0 && NewQuestPosition < QuestList.Count)
     {
         SelectedItem      = (ushort)NewQuestPosition;
         SelectedQuestInfo = PlayerMod.GetPlayerQuestDatas(Main.LocalPlayer)[QuestList[SelectedItem]];
         StoryPage         = 0;
         DescriptionText   = ParseText(SelectedQuestInfo.Description);
         string storyText = SelectedQuestInfo.Story;
         if (storyText != "")
         {
             StoryText = ParseText("Story\n\n" + storyText);
         }
         else
         {
             StoryText = new string[0];
         }
         string objectiveText = SelectedQuestInfo.Objective;
         if (objectiveText != "")
         {
             ObjectiveText = ParseText("Objective: " + objectiveText);
         }
         else
         {
             ObjectiveText = new string[0];
         }
     }
 }
Exemplo n.º 7
0
 public override void OnChatButtonClicked(bool firstButton, ref bool shop)
 {
     if (firstButton)
     {
         if (HasBrutusRecruited)
         {
             NpcMod.AddGuardianMet(6);
             WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.Brutus);
         }
         else
         {
             npc.target = Main.myPlayer;
             StartDamageTest();
             //Main.player[Main.myPlayer].talkNPC = -1;
         }
     }
     else
     {
         if (Main.player[Main.myPlayer].BuyItem(Item.buyPrice(0, HirePrice)))
         {
             Main.npcChatText = "*I accept the offer. I, " + Base.Name + ", will protect you until the end of my contract.*";
             PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID);
             PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
             NpcMod.AddGuardianMet(6);
             Main.NewText("You bought " + Base.Name + "'s help.", MainMod.RecruitColor);
             WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianBase.Brutus);
         }
         else
         {
             Main.npcChatText = "*He's saying that the only ways of hiring his blade is by either showing how strong you are, or how deep your pocket is.*";
         }
     }
 }
Exemplo n.º 8
0
 public override void Update(Player player, SkillData data)
 {
     if (data.Time >= 20)
     {
         CerberusFormData sd = (CerberusFormData)PlayerMod.GetPlayerSkillData(player, 22);
         if (sd != null)
         {
             //for(int i = 0; i < 3; i++)
             sd.HeadFrame[0] = 30;
         }
         Vector2 ShotSpawnPosition = CerberusForm.GetMouthPosition(player);
         //ShotSpawnPosition.X += player.direction * 12;
         int     Damage        = data.GetMagicDamage(0, 1.2f + 0.15f * data.Level, player);
         Vector2 ShotDirection = (new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition) - ShotSpawnPosition;
         ShotDirection.Normalize();
         ShotSpawnPosition -= ShotDirection * 40f; //Magic
         if (Main.mouseX + Main.screenPosition.X < player.Center.X)
         {
             player.direction = -1;
         }
         else
         {
             player.direction = 1;
         }
         if (data.Time % 5 == 0)
         {
             Projectile.NewProjectile(ShotSpawnPosition, ShotDirection * 8f, Terraria.ID.ProjectileID.Flames, Damage, 0.7f, player.whoAmI);
         }
     }
     if (data.Time >= 4.2f * 60)
     {
         data.EndUse(false);
     }
 }
Exemplo n.º 9
0
        public override string QuestNpcDialogue(NPC npc)
        {
            ZacksOutfitQuestData data = (ZacksOutfitQuestData)Data;

            if (PlayerMod.PlayerHasGuardianSummoned(Terraria.Main.LocalPlayer, GuardianBase.Blue))
            {
                if ((data.QuestStep == 4 || data.QuestStep == 5) && npc.type == Terraria.ID.NPCID.Clothier)
                {
                    data.QuestStep += 2;
                    PlayerMod.GetPlayerSummonedGuardian(Main.player[Main.myPlayer], GuardianBase.Blue).
                    SaySomethingCanSchedule("*This one! This one is perfect. I'll take It. Thank you. Let's give It to Zacks.*", true, 90);
                    if (PlayerMod.PlayerHasGuardianSummoned(Main.player[Main.myPlayer], GuardianBase.Zacks))
                    {
                        data.ZacksKnowsWhoPickedShirt = 1;
                        PlayerMod.GetPlayerSummonedGuardian(Main.player[Main.myPlayer], GuardianBase.Zacks).
                        SaySomethingCanSchedule("*I hope you picked something cool for me.*", true, 90 + 150);
                    }
                    return("So, you want a shirt for " + NpcMod.GetGuardianNPCName(GuardianBase.Zacks) + "? I have quite a selection, feel free to browse.");
                }
                if ((data.QuestStep == 2 || data.QuestStep == 3) && npc.type == Terraria.ID.NPCID.Nurse)
                {
                    data.QuestStep += 2;
                    PlayerMod.GetPlayerSummonedGuardian(Main.player[Main.myPlayer], GuardianBase.Blue).
                    SaySomethingCanSchedule("*That's perfect! Thanks " + npc.GivenOrTypeName + ". Now we should visit the Clothier.*", true, 90);
                    if (PlayerMod.PlayerHasGuardianSummoned(Main.player[Main.myPlayer], GuardianBase.Zacks))
                    {
                        PlayerMod.GetPlayerSummonedGuardian(Main.player[Main.myPlayer], GuardianBase.Zacks).
                        SaySomethingCanSchedule("*That's a lot of bandages! Just how wounded am I? I could even use some to wipe myself.*", true, 90 + 150);
                    }
                    return("You want some bandages for " + NpcMod.GetGuardianNPCName(GuardianBase.Zacks) + "? Gladly I have an extra number of them. Feel free to take them.");
                }
            }
            return(base.QuestNpcDialogue(npc));
        }
Exemplo n.º 10
0
 public override void OnMobKill(NPC killedNpc)
 {
     if (killedNpc.type == Terraria.ID.NPCID.KingSlime)
     {
         OutfitQuestData data = (OutfitQuestData)Data;
         if (data.QuestStep == 1)
         {
             if (PlayerMod.PlayerHasGuardianSummoned(Main.LocalPlayer, GuardianBase.Sardine))
             {
                 if (data.SardineFell)
                 {
                     data.QuestStep = 4;
                 }
                 else
                 {
                     data.QuestStep = 2;
                     PlayerMod.GetPlayerSummonedGuardian(Main.LocalPlayer, GuardianBase.Sardine).SaySomethingCanSchedule("We did it! Yes!!");
                 }
             }
             else
             {
                 data.QuestStep = 3;
             }
         }
     }
 }
Exemplo n.º 11
0
        public override string TalkMessage(Player player, TerraGuardian guardian)
        {
            List <string> Mes = new List <string>();

            Mes.Add("*[name] showed you a rare insect he found, he seems very happy about that.*");
            Mes.Add("*[name] is asking you when is going to happen another party.*");
            Mes.Add("*[name] seems to want a new toy, but what could I give him?*");
            Mes.Add("*[name] wants to explore the dungeon sometime.*");
            if (NPC.AnyNPCs(Terraria.ID.NPCID.Merchant))
            {
                Mes.Add("*[name] is asing me if [nn:" + Terraria.ID.NPCID.Merchant + "] has put his trash can outside.*");
            }
            if (!PlayerMod.PlayerHasGuardianSummoned(player, 0))
            {
                Mes.Add("*[name] seems to want to go on an adventure with you.*");
            }
            if (PlayerMod.PlayerHasGuardianSummoned(player, 0))
            {
                Mes.Add("*[name] is enjoying travelling with me.*");
                Mes.Add("*[name] seems to killing insects with gasoline, I wonder where he acquired that.*");
                if (guardian.Wet || guardian.HasBuff(Terraria.ID.BuffID.Wet))
                {
                    Mes.Add("*[name] is soaked and cold.*");
                }
            }
            if (PlayerMod.PlayerHasGuardianSummoned(player, 1))
            {
                Mes.Add("*[name] looks surprised at [gn:1], and suddenly forgets what he was going to talk about.*");
            }
            if (PlayerMod.PlayerHasGuardianSummoned(player, 2))
            {
                Mes.Add("*[name] is asking if you could let him play with [gn:2].*");
            }
            return(Mes[Main.rand.Next(Mes.Count)]);
        }
Exemplo n.º 12
0
        private void SardineTellsHisProblem()
        {
            TerraGuardian Sardine = Dialogue.GetSpeaker,
                          Bree    = PlayerMod.GetPlayerSummonedGuardian(Main.LocalPlayer, GuardianBase.Bree),
                          Glenn   = PlayerMod.GetPlayerSummonedGuardian(Main.LocalPlayer, GuardianBase.Glenn);

            Dialogue.ShowDialogueWithContinue("Hey [nickname], I need to speak with you.");
            Dialogue.ShowDialogueWithContinue("I didn't liked the result of my last fight against the King Slime, and I think there's still some gel inside my ears.");
            Dialogue.SetImportantDialogue();
            if (Bree != null)
            {
                Dialogue.ShowDialogueWithContinue("You're still sad about that? I'm actually glad that [nickname] actually were able to rescue you from the inside of that creature.", Bree);
                Dialogue.ShowDialogueWithContinue("That still doesn't make me feel good, since I had to be rescued from it.", Sardine);
                Dialogue.ShowDialogueWithContinue("Don't feel like that, you know that you're still my hero, right?", Bree);
                Dialogue.ShowDialogueWithContinue("Yes, I know, but still...", Sardine);
            }
            OutfitQuestData data = (OutfitQuestData)Data;

            data.QuestStep = 1;
            QuestStartedNotification(data);
            if (Dialogue.ShowDialogueWithOptions("I think we should try doing that fight again, but this time doing it right. What do you say?", new string[] { "Let's bash the king!", "Not now." }) == 0)
            {
                Dialogue.ShowDialogueWithContinue("I like that! Let's go kick King Slime's jelly ass!");
                Item.NewItem(Dialogue.GetSpeaker.HitBox, Terraria.ID.ItemID.SlimeCrown, 1, true, noGrabDelay: true);
                Dialogue.ShowDialogueWithContinue("I have made one of its summoning item in my spare time, so take this.");
                Dialogue.ShowEndDialogueMessage("Do you want to talk about something else before we go?", false);
            }
            else
            {
                Dialogue.ShowDialogueWithContinue("It's not necessary that we do that now, but any time when possible, let's kick it's jelly ass.");
                Item.NewItem(Dialogue.GetSpeaker.HitBox, Terraria.ID.ItemID.SlimeCrown, 1, true, noGrabDelay: true);
                Dialogue.ShowDialogueWithContinue("I think you should have this too. In case you decide to give it a try on King Slime, so we could face it together.");
                Dialogue.ShowEndDialogueMessage("Anyway, is there anything else you want to speak about?", false);
            }
        }
Exemplo n.º 13
0
 public override void OnChatButtonClicked(bool firstButton, ref bool shop)
 {
     if (firstButton)
     {
         if (AiStage == 2)
         {
             DialogueStep++;
         }
         else
         {
             npc.position.Y -= 48;
             AiStage         = 2;
             AiTimer         = 0;
             SayMessage("*Pull!*");
             if (PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID))
             {
                 DialogueStep = 100;
             }
             npc.velocity.Y -= 6.25f;
         }
     }
     else if (AiStage == 2) //Button 2
     {
         if (DialogueStep == 5)
         {
             Rejected = true;
         }
         DialogueStep++;
     }
     Main.npcChatText = GetDialogueMessage(DialogueStep);
 }
Exemplo n.º 14
0
 public override void OnChatButtonClicked(bool firstButton, ref bool shop)
 {
     if (firstButton)
     {
         NpcMod.AddGuardianMet(16);
         Main.player[Main.myPlayer].GetModPlayer <PlayerMod>().AddNewGuardian(16);
         if (PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).FriendshipLevel == 0)
         {
             PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).IncreaseFriendshipProgress(1);
         }
         Main.npcChatText = "(She looks happy at you, sketches on the floor her name, " + PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).Name + ", then places her hand on your shoulder, telling you that you can count on her.)";
         WorldMod.TurnNpcIntoGuardianTownNpc(npc, 16);
     }
     else
     {
         NpcMod.AddGuardianMet(16, "", false);
         Main.player[Main.myPlayer].GetModPlayer <PlayerMod>().AddNewGuardian(16);
         if (PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).FriendshipLevel == 0)
         {
             PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).IncreaseFriendshipProgress(1);
         }
         Main.npcChatText = "(Her face suddenly changed to a sad look, she sketches her name on the floor, " + PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], 16).Name + ", then signals saying that If you need her help, you just need to call.)";
         WorldMod.TurnNpcIntoGuardianTownNpc(npc, 16);
     }
 }
Exemplo n.º 15
0
 public override void OnChatButtonClicked(bool firstButton, ref bool shop)
 {
     if (PlayerHasRococo)
     {
         NpcMod.AddGuardianMet(GuardianID, GuardianModID);
         WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
         //npc.Transform(ModContent.NPCType<GuardianNPC.List.RaccoonGuardian>());
     }
     else if (!RejectedOnce && !AcceptedOnce)
     {
         if (firstButton) //Accept
         {
             AcceptedOnce     = true;
             Main.npcChatText = "*It got very happy after I said that It can move to my world, and said that his name is " + Base.Name + ".*";
             Jump             = true;
         }
         else
         {
             RejectedOnce     = true;
             Main.npcChatText = "*It got saddened after hearing my refusal. But says that wont feel bad for that. He told you that you can call him anytime, if you change your mind, and that his name is " + Base.Name + "*";
         }
         PlayerMod.AddPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID);
         PlayerMod.GetPlayerGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID).IncreaseFriendshipProgress(1);
         NpcMod.AddGuardianMet(GuardianID, GuardianModID, firstButton);
         WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
     }
     else if (AcceptedOnce)
     {
         //npc.Transform(ModContent.NPCType<GuardianNPC.List.RaccoonGuardian>());
     }
 }
Exemplo n.º 16
0
        public static void GetGuardianEquippedItem(BinaryReader reader, int WhoAmI)
        {
            byte PlayerID        = reader.ReadByte();
            int  MyGuardianPosID = reader.ReadInt32();
            int  Slot            = reader.ReadInt32();
            int  NetId           = reader.ReadInt32();
            byte Prefix          = (byte)(NetId == 0 ? 0 : reader.ReadByte());
            int  Stack           = (NetId == 0 ? 0 : reader.ReadInt32());
            Item i = new Item();

            i.netDefaults(NetId);
            i.Prefix(Prefix);
            i.stack = Stack;
            ItemIO.ReceiveModData(i, reader);
            Player player = Main.player[PlayerID];

            if (PlayerID == Main.myPlayer)
            {
                return;
            }
            PlayerMod pm = player.GetModPlayer <PlayerMod>();

            if (!pm.MyGuardians.ContainsKey(MyGuardianPosID))
            {
                return;
            }
            pm.MyGuardians[MyGuardianPosID].Equipments[Slot] = i;
            if (Main.netMode == 2)
            {
                SendGuardianEquippedItem(pm, MyGuardianPosID, Slot, -1, WhoAmI);
            }
        }
Exemplo n.º 17
0
 public static void OpenInterface()
 {
     IsActive             = true;
     Main.playerInventory = false;
     Position             = new Vector2(Main.screenWidth - Width, Main.screenHeight - Height) * 0.5f;
     QuestList.Clear();
     QuestData[] quests = PlayerMod.GetPlayerQuestDatas(Main.player[Main.myPlayer]);
     for (int i = 0; i < quests.Length; i++)
     {
         if (!quests[i].IsInvalid && quests[i].IsQuestStarted)
         {
             QuestList.Add(i);
         }
     }
     SelectedItem         = 0;
     ListScrollY          = 0;
     StoryPage            = 0;
     DescriptionText      = new string[0];
     StoryText            = new string[0];
     ObjectiveText        = new string[0];
     Main.playerInventory = false;
     if (QuestList.Count > 0)
     {
         ChangeQuest(SelectedItem);
     }
 }
Exemplo n.º 18
0
        public static int Speed(this PlayerMod mod)
        {
            var speed = default(int);

            if (mod.PrimaryTypeId == (int)ModStatTypes.Speed)
            {
                speed += mod.PrimaryValue.ToInt32();
            }

            if (mod.Secondary1TypeId == (int)ModStatTypes.Speed)
            {
                speed += mod.Secondary1Value.ToInt32();
            }

            if (mod.Secondary2TypeId == (int)ModStatTypes.Speed)
            {
                speed += mod.Secondary2Value.ToInt32();
            }

            if (mod.Secondary3TypeId == (int)ModStatTypes.Speed)
            {
                speed += mod.Secondary3Value.ToInt32();
            }

            if (mod.Secondary4TypeId == (int)ModStatTypes.Speed)
            {
                speed += mod.Secondary4Value.ToInt32();
            }

            return(speed);
        }
Exemplo n.º 19
0
 public override void OnChatButtonClicked(bool firstButton, ref bool shop)
 {
     if (PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], GuardianID, GuardianModID))
     {
         NpcMod.AddGuardianMet(GuardianID, GuardianModID);
         //npc.Transform(ModContent.NPCType<GuardianNPC.List.FemaleCatGuardian>());
         TransformNPC();
         return;
     }
     else if (PlayerMod.HasGuardianSummoned(Main.player[Main.myPlayer], 2, GuardianModID))
     {
         return;
     }
     else if (!dialogues.Finished)
     {
         dialogues.MarkAnswer(firstButton);
         if (dialogues.Finished)
         {
             Main.npcChatText = GetEndDialogueMessage;
         }
         else
         {
             Main.npcChatText = dialogues.GetQuestion();
         }
     }
     else if (dialogues.Finished)
     {
         if (DialogueResultSuccess)
         {
             TransformNPC();
         }
     }
 }
Exemplo n.º 20
0
        public static decimal Accuracy(this PlayerMod mod)
        {
            var accuracy = default(decimal);

            if (mod.PrimaryTypeId == (int)ModStatTypes.Accuracy)
            {
                accuracy += mod.PrimaryValue;
            }

            if (mod.Secondary1TypeId == (int)ModStatTypes.Accuracy)
            {
                accuracy += mod.Secondary1Value;
            }

            if (mod.Secondary2TypeId == (int)ModStatTypes.Accuracy)
            {
                accuracy += mod.Secondary2Value;
            }

            if (mod.Secondary3TypeId == (int)ModStatTypes.Accuracy)
            {
                accuracy += mod.Secondary3Value;
            }

            if (mod.Secondary4TypeId == (int)ModStatTypes.Accuracy)
            {
                accuracy += mod.Secondary4Value;
            }

            return(accuracy);
        }
Exemplo n.º 21
0
        public static void RemoveModFromAllSets(ZelusDbContext db, PlayerMod mod)
        {
            if (mod.Mod1.Any())
            {
                db.PlayerModSets.RemoveRange(mod.Mod1);
            }

            if (mod.Mod2.Any())
            {
                db.PlayerModSets.RemoveRange(mod.Mod2);
            }

            if (mod.Mod3.Any())
            {
                db.PlayerModSets.RemoveRange(mod.Mod3);
            }

            if (mod.Mod4.Any())
            {
                db.PlayerModSets.RemoveRange(mod.Mod4);
            }

            if (mod.Mod5.Any())
            {
                db.PlayerModSets.RemoveRange(mod.Mod5);
            }

            if (mod.Mod6.Any())
            {
                db.PlayerModSets.RemoveRange(mod.Mod6);
            }

            db.SaveChanges();
        }
Exemplo n.º 22
0
        private static PlayerMod ParseStats(this HtmlNode container, PlayerMod mod)
        {
            var primaryStatContainer = container.Descendants("div")
                                       .First(d => d.Attributes["class"].IsNotNull() &&
                                              d.Attributes["class"].Value.Contains("statmod-stats-1"));

            mod.PrimaryTypeId  = GetTypeFromLabel(primaryStatContainer.GetStatLabel());
            mod.PrimaryUnitsId = GetUnitsFromValue(primaryStatContainer.GetStatValue());
            mod.PrimaryValue   = GetActualValue(primaryStatContainer.GetStatValue());

            var secondaryStatContainers = container.Descendants("div")
                                          .First(d => d.Attributes["class"].IsNotNull() &&
                                                 d.Attributes["class"].Value.Contains("statmod-stats-2"))
                                          .Elements("div")
                                          .ToList();

            //First Secondary Stat
            mod.Secondary1TypeId = GetTypeFromLabel(secondaryStatContainers.Count > 0 ?
                                                    secondaryStatContainers[0].GetStatLabel() :
                                                    null);
            mod.Secondary1UnitsId = GetUnitsFromValue(secondaryStatContainers.Count > 0 ?
                                                      secondaryStatContainers[0].GetStatValue():
                                                      null);
            mod.Secondary1Value = GetActualValue(secondaryStatContainers.Count > 0 ?
                                                 secondaryStatContainers[0].GetStatValue() :
                                                 null);
            //Second Secondary Stat
            mod.Secondary2TypeId = GetTypeFromLabel(secondaryStatContainers.Count > 1 ?
                                                    secondaryStatContainers[1].GetStatLabel() :
                                                    null);
            mod.Secondary2UnitsId = GetUnitsFromValue(secondaryStatContainers.Count > 1 ?
                                                      secondaryStatContainers[1].GetStatValue() :
                                                      null);
            mod.Secondary2Value = GetActualValue(secondaryStatContainers.Count > 1 ?
                                                 secondaryStatContainers[1].GetStatValue() :
                                                 null);
            //Third Secondary Stat
            mod.Secondary3TypeId = GetTypeFromLabel(secondaryStatContainers.Count > 2 ?
                                                    secondaryStatContainers[2].GetStatLabel() :
                                                    null);
            mod.Secondary3UnitsId = GetUnitsFromValue(secondaryStatContainers.Count > 2 ?
                                                      secondaryStatContainers[2].GetStatValue() :
                                                      null);
            mod.Secondary3Value = GetActualValue(secondaryStatContainers.Count > 2 ?
                                                 secondaryStatContainers[2].GetStatValue() :
                                                 null);
            //Fourth Secondary Stat
            mod.Secondary4TypeId = GetTypeFromLabel(secondaryStatContainers.Count > 3 ?
                                                    secondaryStatContainers[3].GetStatLabel() :
                                                    null);
            mod.Secondary4UnitsId = GetUnitsFromValue(secondaryStatContainers.Count > 3 ?
                                                      secondaryStatContainers[3].GetStatValue() :
                                                      null);
            mod.Secondary4Value = GetActualValue(secondaryStatContainers.Count > 3 ?
                                                 secondaryStatContainers[3].GetStatValue() :
                                                 null);

            return(mod);
        }
Exemplo n.º 23
0
        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            if (MetPlayer)
            {
                return;
            }
            if (SpeakingToKnownPlayer > 0)
            {
                if (firstButton)
                {
                    if (SpeakingToKnownPlayer == 1)
                    {
                        Main.npcChatText = "*Huh.*";
                        SayMessage("(I'll follow them again by keeping some distance, maybe they know the way out.)");
                    }
                    else
                    {
                        Main.npcChatText = "*No, I actually lied. Please, let me go with you! Get me out of here!!*";
                    }
                    PlayerMod.AddPlayerGuardian(Main.LocalPlayer, GuardianBase.Fear);
                    NpcMod.AddGuardianMet(GuardianBase.Fear);
                    WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                }
                else
                {
                    Main.npcChatText = "*Uh.. Alright... Just- Just go away!*";
                    MetPlayer        = true;
                }
            }
            switch (DialogueStep)
            {
            case 0:
                DialogueStep++;
                Main.npcChatText = "*I don't trust you! You will try killing me like you did to those scary monsters!*";
                break;

            case 1:
                DialogueStep++;
                Main.npcChatText = "*Uh.. I guess you're right. BUT! Doesn't mean you can't still turn on me.*";
                break;

            case 2:
                DialogueStep++;
                if (firstButton)
                {
                    Main.npcChatText = "*I, ah... Okay.*";
                    SayMessage("(I'll trail behind them carefully for now, maybe they will help me get out of this horrible place.)");
                    PlayerMod.AddPlayerGuardian(Main.LocalPlayer, GuardianBase.Fear);
                    NpcMod.AddGuardianMet(GuardianBase.Fear);
                    WorldMod.TurnNpcIntoGuardianTownNpc(npc, GuardianID, GuardianModID);
                }
                else
                {
                    Main.npcChatText = "*Uh.. Alright... Just- Just go away!*";
                    MetPlayer        = true;
                }
                break;
            }
        }
Exemplo n.º 24
0
 public override string BirthdayMessage(Player player, TerraGuardian guardian)
 {
     if (!PlayerMod.HasGuardianBeenGifted(player, 0) && Main.rand.NextDouble() < 0.5)
     {
         return("*[name] is curious about what you will give him as gift.*");
     }
     return("*[name] is asking why you aren't dancing, It's party time.*");
 }
Exemplo n.º 25
0
 public override float SpawnChance(NPCSpawnInfo spawnInfo)
 {
     if (Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY].wall == 0 && PlayerMod.GetTerraGuardianCompanionsFound(spawnInfo.player) > 0 && Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY].wall == 0 && spawnInfo.playerInTown && Main.dayTime && !spawnInfo.water && !NpcMod.HasMetGuardian(GuardianBase.Luna) && !NpcMod.HasGuardianNPC(GuardianBase.Luna) && !PlayerMod.PlayerHasGuardianSummoned(spawnInfo.player, GuardianBase.Luna))
     {
         return(1f);
     }
     return(0);
 }
Exemplo n.º 26
0
 public override string BirthdayMessage(Player player, TerraGuardian guardian)
 {
     if (!PlayerMod.HasGuardianBeenGifted(player, 4) && Main.rand.NextDouble() < 0.5)
     {
         return("You want to give me something? Ok, I will open it then.");
     }
     return("It doesn't matter how old I am, I nearly don't exist.");
 }
Exemplo n.º 27
0
 public override float SpawnChance(NPCSpawnInfo spawnInfo)
 {
     if (!spawnInfo.water && Main.dayTime && !NpcMod.HasGuardianNPC(0) && !PlayerMod.PlayerHasGuardian(Main.player[Main.myPlayer], 0) && Main.time > 27000 && Main.time < 48600 && NpcMod.RecruitNpcSpawnConditionCheck(spawnInfo) && !NPC.AnyNPCs(ModContent.NPCType <RococoNPC>()))
     {
         return((float)(Main.time - 27000) * (1f / 432000 * 0.5f));
     }
     return(0);
 }
Exemplo n.º 28
0
 public override string BirthdayMessage(Player player, TerraGuardian guardian)
 {
     if (!PlayerMod.HasGuardianBeenGifted(player, guardian) && Main.rand.NextFloat() < 0.5f)
     {
         return("you say you have a gift for me? I love them, what surprises will it hide.");
     }
     return("my master always told me that with age comes wisdom.");
 }
Exemplo n.º 29
0
        public static void GetSpawnCompanionOnPlayer(BinaryReader reader, int WhoAmI) //On server, need not only to get the server WhoAmID of the character, but also send that to the player who created it, and send the updated change to other players.
        {
            byte   PlayerID        = reader.ReadByte();
            int    MyGuardianPosID = reader.ReadInt32();
            byte   AssistSlot      = reader.ReadByte();
            int    ReceivedWhoAmID = reader.ReadInt32();
            int    CompanionID     = reader.ReadInt32();
            string CompanionModID  = reader.ReadString();
            bool   Starter         = reader.ReadBoolean();
            Player player          = Main.player[PlayerID];

            if (PlayerID == Main.myPlayer)
            {
                return;
            }
            PlayerMod pm = player.GetModPlayer <PlayerMod>();

            if (!pm.MyGuardians.ContainsKey(MyGuardianPosID))
            {
                if (!pm.AddNewGuardian(CompanionID, CompanionModID, MyGuardianPosID, Starter))
                {
                    return;
                }
            }
            else
            {
                if (!pm.MyGuardians[MyGuardianPosID].MyID.IsSameID(CompanionID, CompanionModID))
                {
                    pm.MyGuardians.Remove(MyGuardianPosID);
                    if (!pm.AddNewGuardian(CompanionID, CompanionModID, MyGuardianPosID, Starter))
                    {
                        return;
                    }
                }
            }
            if (pm.GetGuardianFromSlot(AssistSlot).Active)
            {
                pm.DismissGuardian(AssistSlot);
            }
            pm.CallGuardian(MyGuardianPosID, AssistSlot);
            if (Main.netMode == 2)
            {
                int NewWhoAmID = pm.GetGuardianFromSlot(AssistSlot).WhoAmID;
                SendGuardianWhoAmIDUpdate(ReceivedWhoAmID, NewWhoAmID, WhoAmI);
                SendSpawnCompanionOnPlayer(pm, MyGuardianPosID, AssistSlot, NewWhoAmID, -1, WhoAmI);
            }
            else
            {
                pm.GetGuardianFromSlot(AssistSlot).WhoAmID = ReceivedWhoAmID;
                if (MainMod.ActiveGuardians.ContainsKey(ReceivedWhoAmID))
                {
                    do
                    {
                        MainMod.ActiveGuardians[ReceivedWhoAmID].WhoAmID = TerraGuardian.IDStack++;
                    }while (MainMod.ActiveGuardians.ContainsKey(MainMod.ActiveGuardians[ReceivedWhoAmID].WhoAmID));
                }
            }
        }
Exemplo n.º 30
0
 public override string BirthdayMessage(Player player, TerraGuardian guardian)
 {
     List<string> Mes = new List<string>();
     Mes.Add("*No, I'm not happy, I can never be happy!*");
     Mes.Add("*All those people dancing around, meanwhile I'm here, this is making me furious!!*");
     if (!PlayerMod.HasGuardianBeenGifted(player, Wrath))
         Mes.Add("*This gift better be good.*");
     return Mes[Main.rand.Next(Mes.Count)];
 }