Beispiel #1
0
        public void OnLimbCut(object o)
        {
            Quests.UpdateActiveQuests(QuestObjective.Type.CutLimbs, 1, QuestObjective.Enemy.None, -1, Quests.HeldWeapon, "");
            int i = UnityEngine.Random.Range(0, 100);

            if (i > 50)
            {
                int     xp              = UnityEngine.Random.Range((int)8, 16);
                Vector3 pos             = transform.position;
                int     count           = TheForest.Utils.Scene.SceneTracker.allPlayers.Count(go => (go.transform.position - pos).sqrMagnitude < 250 * 250);
                bool    giveLocalPlayer = false;

                if ((LocalPlayer.Transform.position - pos).sqrMagnitude < 250 * 250)
                {
                    giveLocalPlayer = true;
                    count++;
                }


                if (count == 0)
                {
                    return;
                }


                xp = Mathf.RoundToInt((float)xp / (count));
                Network.NetworkManager.SendExpCommand(xp, pos, false);

                if (giveLocalPlayer)
                {
                    UpgradePointsMod.instance.AddXP(xp, false);
                }
            }
        }
Beispiel #2
0
        public void SharkKilled(object o)
        {
            //ModAPI.Log.Write("Giving Exp for killing shark");

            int xp = UnityEngine.Random.Range((int)110, 180);

            Quests.UpdateActiveQuests(QuestObjective.Type.Kill, 1, QuestObjective.Enemy.Shark, -1, Quests.HeldWeapon);
            Vector3 pos             = transform.position;
            int     count           = TheForest.Utils.Scene.SceneTracker.allPlayers.Count(go => (go.transform.position - pos).sqrMagnitude < 250 * 250);
            bool    giveLocalPlayer = false;

            if ((LocalPlayer.Transform.position - pos).sqrMagnitude < 250 * 250)
            {
                giveLocalPlayer = true;
                count++;
            }


            if (count == 0)
            {
                return;
            }


            xp = Mathf.RoundToInt((float)xp / (count));
            Network.NetworkManager.SendExpCommand(xp, pos, false);

            if (giveLocalPlayer)
            {
                UpgradePointsMod.instance.AddXP(xp, false);
            }
        }
 protected override void CutDown()
 {
     if (!breakEventPlayed)
     {
         Quests.UpdateActiveQuests(QuestObjective.Type.DestroyEffigies, 1, QuestObjective.Enemy.None, -1, Quests.HeldWeapon, "");
         int r = Random.Range(5, 51);
         UpgradePointsMod.instance.AddXP(r, false);
     }
     base.CutDown();
 }
Beispiel #4
0
        public void OnTreeCut(object o)
        {
            try
            {
                Quests.UpdateActiveQuests(QuestObjective.Type.CutTree, 1, QuestObjective.Enemy.None, -1, Quests.HeldWeapon, "");

                int     xp              = UnityEngine.Random.Range((int)15, 25);
                Vector3 pos             = transform.position;
                int     count           = TheForest.Utils.Scene.SceneTracker.allPlayers.Count(go => (go.transform.position - pos).sqrMagnitude < 250 * 250);
                bool    giveLocalPlayer = false;

                if ((LocalPlayer.Transform.position - pos).sqrMagnitude < 250 * 250)
                {
                    giveLocalPlayer = true;
                    count++;
                }


                if (count == 0)
                {
                    return;
                }


                xp = Mathf.RoundToInt((float)xp / (count));
                Network.NetworkManager.SendExpCommand(xp, pos, false);

                if (giveLocalPlayer)
                {
                    UpgradePointsMod.instance.AddXP(xp, false);
                }
            }
            catch (Exception ex)
            {
                ModAPI.Log.Write(ex.ToString());
            }
        }
        protected override void DieTrap(int type)
        {
            if (ai.male)
            {
                if (ai.pale)
                {
                    if (ai.skinned)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.SkinnedMale);
                    }
                    else
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.PaleMale);
                    }
                }
                else if (ai.painted)
                {
                    if (ai.fireman)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.PaintedFirethrower);
                    }
                    else if (ai.leader)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.PaintedLeader);
                    }
                    else
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.PaintedMale);
                    }
                }
                else
                {
                    if (ai.leader)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.TribalMaleLeader);
                    }
                    else
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.TribalMale);
                    }
                }
            }

            if (ai.creepy)
            {
                if (ai.pale)
                {
                    Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.PaleVirgina);
                }
                else
                {
                    Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.Virgina);
                }
            }

            if (ai.creepy_male)
            {
                if (ai.pale)
                {
                    Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.PaleArmsy);
                }
                else
                {
                    Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.Armsy);
                }
            }

            if (ai.creepy_baby)
            {
                Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.Baby);
            }

            if (ai.creepy_boss)
            {
                Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.EndBoss);
            }

            if (ai.creepy_fat)
            {
                Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.Cowman);
            }

            if (ai.maleSkinny)
            {
                if (ai.pale)
                {
                    if (ai.skinned)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.SkinnedSkinny);
                    }
                    else
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.SkinnyPale);
                    }
                }
                else
                {
                    Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.SkinnyMale);
                }
            }

            if (ai.female)
            {
                if (ai.painted)
                {
                    Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.PaintedFemale);
                }
                else
                {
                    Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.TribalFemale);
                }
            }

            if (ai.femaleSkinny)
            {
                Quests.UpdateActiveQuests(QuestObjective.Type.TrapEnemies, 1, QuestObjective.Enemy.SkinnyFemale);
            }

            base.DieTrap(type);
        }
 public override void CreateBuilding(BuildingTypes type)
 {
     base.CreateBuilding(type);
     Quests.UpdateActiveQuests(QuestObjective.Type.BuildObjects, 1, QuestObjective.Enemy.None, -1, QuestObjective.Weapon.None, type.ToString());
 }
 public override void CreateBuilding(BuildingTypes type)
 {
     base.CreateBuilding(type);
     ModAPI.Console.Write(type.ToString(), "building finished");
     Quests.UpdateActiveQuests(QuestObjective.Type.BuildObjects, 1, QuestObjective.Enemy.None, -1, QuestObjective.Weapon.None, type.ToString());
 }
Beispiel #8
0
 public void OnAddItem(object o)
 {
     Quests.UpdateActiveQuests(QuestObjective.Type.GetItem, 1, QuestObjective.Enemy.None, (int)o);
 }
        protected override void Update()
        {
            if (UpgradePointsMod.instance != null)
            {
                runSpeed          = BaseRunMs * UpgradePointsMod.instance.sprintspeed;
                swimmingSpeed     = BaseSwimmingSpeed * UpgradePointsMod.instance.Diving;
                jumpHeight        = BaseJumpHeight * UpgradePointsMod.instance.jumpheight;
                staminaCostPerSec = BaseStaminaPerSec * UpgradePointsMod.instance.sprintstaminause;

                if (PushingSled && UpgradePointsMod.instance.specialUpgrades[40].bought)
                {
                    walkSpeed = BaseWalkSpeed * 3;
                    runSpeed *= 3;
                    UpgradePointsMod.instance.PushingSled = true;
                }
                else
                {
                    UpgradePointsMod.instance.PushingSled = false;
                }
                FloatVelocity = velocity.magnitude;
                if (UpgradePointsMod.instance.specialUpgrades[47].bought)
                {
                    if (DashCooldown > 0)
                    {
                        DashCooldown -= Time.deltaTime;
                    }
                    if (WcD > 0)
                    {
                        WcD -= Time.deltaTime;
                    }
                    if (ScD > 0)
                    {
                        ScD -= Time.deltaTime;
                    }
                    if (AcD > 0)
                    {
                        AcD -= Time.deltaTime;
                    }
                    if (DcD > 0)
                    {
                        DcD -= Time.deltaTime;
                    }


                    if (DashCooldown <= 0)
                    {
                        if (UnityEngine.Input.GetKeyDown(KeyCode.W))
                        {
                            if (WcD > 0)
                            {
                                rb.AddForce(transform.forward * DashForce, ForceMode.Impulse);
                                DashCooldown = DashMaxCooldown;
                            }
                            else
                            {
                                WcD = 0.17f;
                            }
                        }
                        if (UnityEngine.Input.GetKeyDown(KeyCode.S))
                        {
                            if (ScD > 0)
                            {
                                rb.AddForce(transform.forward * -DashForce, ForceMode.Impulse);
                                DashCooldown = DashMaxCooldown;
                            }
                            else
                            {
                                ScD = 0.17f;
                            }
                        }
                        if (UnityEngine.Input.GetKeyDown(KeyCode.A))
                        {
                            if (AcD > 0)
                            {
                                rb.AddForce(transform.right * -DashForce, ForceMode.Impulse);
                                DashCooldown = DashMaxCooldown;
                            }
                            else
                            {
                                AcD = 0.17f;
                            }
                        }
                        if (UnityEngine.Input.GetKeyDown(KeyCode.D))
                        {
                            if (DcD > 0)
                            {
                                rb.AddForce(transform.right * DashForce, ForceMode.Impulse);
                                DashCooldown = DashMaxCooldown;
                            }
                            else
                            {
                                DcD = 0.17f;
                            }
                        }
                    }
                }
                base.Update();
                #region Quests
                float Dist = Vector3.Distance(transform.position, prevFramePos);
                if (Dist > 0)
                {
                    if (PushingSled)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.Sled, Dist);
                    }
                    if (swimming)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.Swim, Dist);
                    }
                    if (LocalPlayer.AnimControl.doShellRideMode)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.RideShell, Dist);
                    }
                    if (!Grounded)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.Fall, Dist);
                    }
                    if (!LocalPlayer.AnimControl.doShellRideMode && !swimming && running)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.Run, Dist);
                    }
                    if (LocalPlayer.SpecialActions.GetComponent <playerZipLineAction>()._onZipLine)
                    {
                        Quests.UpdateActiveQuests(QuestObjective.Type.Zipline, Dist);
                    }
                }
                if (LocalPlayer.IsInCaves)
                {
                    Quests.UpdateActiveQuests(QuestObjective.Type.StayInCave, Time.deltaTime, QuestObjective.Enemy.None, -1, QuestObjective.Weapon.None, "");
                }
                #endregion
                prevFramePos = transform.position;
            }
        }
 public override void CutDown()
 {
     Quests.UpdateActiveQuests(QuestObjective.Type.CutBush, 1, QuestObjective.Enemy.None, -1, Quests.HeldWeapon);
     base.CutDown();
 }