Exemple #1
0
        public void SharkKilled()
        {
            int xp = 1500;

            if (GameSetup.IsMultiplayer)
            {
                using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
                {
                    using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                    {
                        w.Write(10);
                        w.Write((long)xp);
                    }
                    Network.NetworkManager.SendLine(answerStream.ToArray(), Network.NetworkManager.Target.Everyone);
                }
            }
            else
            {
                ModdedPlayer.instance.AddKillExperience(xp);
            }
            if (!GameSetup.IsMpClient)
            {
                Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(270), LocalPlayer.Transform.position + Vector3.up * 6f, ItemPickUp.DropSource.EnemyOnDeath);
                Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(310), LocalPlayer.Transform.position + Vector3.up * 6f, ItemPickUp.DropSource.EnemyOnDeath);
                Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(370), LocalPlayer.Transform.position + Vector3.up * 6f, ItemPickUp.DropSource.EnemyOnDeath);
            }
        }
Exemple #2
0
        //public IEnumerator ProjectileMultihit(Transform target,float dmg,bool headshot, UnityAction dmgScript, int invcationCount )
        //{
        //	for (int i = 0; i < invcationCount; i++)
        //	{
        //		yield return null;
        //		dmgScript.Invoke();
        //		ModdedPlayer.instance.DoAreaDamage(target.root, dmg);
        //		ModdedPlayer.instance.OnHit();
        //		ModdedPlayer.instance.OnHit_Ranged(target);
        //	}
        //}

        public IEnumerator AsyncSendRandomItemDrops(int count, EnemyProgression.Enemy type, long bounty, ModSettings.Difficulty difficulty, Vector3 position)
        {
            for (int i = 0; i < count; i++)
            {
                yield return(null);

                yield return(null);

                Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(bounty, type, difficulty), position + Vector3.up * (2f + i / 4) + Random.Range(-1, 1) * Vector3.forward + Random.Range(-1, 1) * Vector3.right, ItemPickUp.DropSource.EnemyOnDeath);
            }
        }
 protected override void CutDown()
 {
     if (!breakEventPlayed)
     {
         long Expamount = 40;
         ModdedPlayer.instance.AddFinalExperience(Expamount);
         if (!GameSetup.IsMpClient && Random.value < 0.3f + ModReferences.Players.Count * 0.10f)
         {
             Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(99, EnemyProgression.Enemy.NormalSkinnyMale), transform.position + Vector3.up * (1.75f));
         }
     }
     base.CutDown();
 }
Exemple #4
0
 protected override void CutDown()
 {
     if (!breakEventPlayed)
     {
         long expAmount = 35;
         ModdedPlayer.instance.AddFinalExperience(expAmount);
         if (!GameSetup.IsMpClient && Random.value * ModdedPlayer.Stats.magicFind < 0.5f)
         {
             Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(170 * ModdedPlayer.Stats.magicFind.Value, EnemyProgression.Enemy.NormalSkinnyMale, ModSettings.difficulty), transform.position + Vector3.up * (1.75f), ItemPickUp.DropSource.Effigy);
         }
         if (ModdedPlayer.Stats.perk_doubleStickHarvesting)
         {
             Object.Instantiate(Loot, Loot.transform.position, Loot.transform.rotation);
         }
     }
     base.CutDown();
 }
Exemple #5
0
 protected override void CutDown()
 {
     if (!breakEventPlayed)
     {
         long Expamount = 35;
         ModdedPlayer.instance.AddFinalExperience(Expamount);
         if (!GameSetup.IsMpClient && Random.value < 0.3f + ModReferences.Players.Count * 0.10f)
         {
             Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(170, EnemyProgression.Enemy.NormalSkinnyMale), transform.position + Vector3.up * (1.75f));
         }
         if (ModdedPlayer.Stats.perk_doubleStickHarvesting)
         {
             Object.Instantiate(Loot, Loot.transform.position, Loot.transform.rotation);
         }
     }
     base.CutDown();
 }
Exemple #6
0
        public IEnumerator AsyncSendRandomItemDrops(int count, EnemyProgression.Enemy type, long bounty, Vector3 position)
        {
            for (int i = 0; i < count; i++)
            {
                yield return(null);

                yield return(null);

                yield return(null);

                yield return(null);

                yield return(null);

                Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(bounty, type), position + Vector3.up * (2f + i / 4));
            }
        }
Exemple #7
0
        protected override void Die()
        {
            long xp = 0;

            if (spawnFunctions.lizard)
            {
                xp = Random.Range(40, 65);
            }
            if (spawnFunctions.turtle)
            {
                xp = Random.Range(40, 60);
            }
            if (spawnFunctions.rabbit)
            {
                xp = Random.Range(45, 60);
            }
            if (spawnFunctions.fish)
            {
                xp = Random.Range(30, 45);
            }
            if (spawnFunctions.tortoise)
            {
                xp = Random.Range(100, 110);
            }
            if (spawnFunctions.raccoon)
            {
                xp = Random.Range(200, 250);
            }
            if (spawnFunctions.deer)
            {
                xp = Random.Range(75, 85);
            }
            if (spawnFunctions.squirrel)
            {
                xp = Random.Range(70, 75);
            }
            if (spawnFunctions.boar)
            {
                xp = Random.Range(150, 200);
            }
            if (spawnFunctions.crocodile)
            {
                xp = Random.Range(350, 450);
            }

            if (GameSetup.IsMultiplayer)
            {
                using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
                {
                    using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                    {
                        w.Write(10);
                        w.Write(xp);
                    }
                    Network.NetworkManager.SendLine(answerStream.ToArray(), Network.NetworkManager.Target.Others);
                }
            }
            ModdedPlayer.instance.AddKillExperience(xp);
            if (xp > 82)
            {
                if (Random.value < 0.5f)
                {
                    Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(xp), transform.position + Vector3.up * 4f, ItemPickUp.DropSource.EnemyOnDeath);
                }
            }
            base.Die();
        }
        protected override void Update()
        {
            this.activeWormWalkers.RemoveAll((GameObject o) => o == null);
            this.activeWormTrees.RemoveAll((GameObject o) => o == null);
            this.activeWormSingle.RemoveAll((GameObject o) => o == null);
            this.activeWormAngels.RemoveAll((GameObject o) => o == null);
            if (this.activeWormWalkers.Count > 0 || this.activeWormAngels.Count > 0 || this.activeWormTrees.Count > 0)
            {
                this.anyFormSpawned = true;
            }
            else
            {
                this.anyFormSpawned = false;
            }
            if (this.activeWormSingle.Count == 0 && this.init)
            {
                if (GameSetup.IsMpServer || GameSetup.IsSinglePlayer)
                {
                    long Exp;
                    switch (ModSettings.difficulty)
                    {
                    case ModSettings.Difficulty.Normal:
                        Exp = 5000;
                        break;

                    case ModSettings.Difficulty.Hard:
                        Exp = 20000;
                        break;

                    case ModSettings.Difficulty.Elite:
                        Exp = 100000;
                        break;

                    case ModSettings.Difficulty.Master:
                        Exp = 3000000;
                        break;

                    case ModSettings.Difficulty.Challenge1:
                        Exp = 50000000;
                        break;

                    case ModSettings.Difficulty.Challenge2:
                        Exp = 100000000;
                        break;

                    case ModSettings.Difficulty.Challenge3:
                        Exp = 500000000;
                        break;

                    case ModSettings.Difficulty.Challenge4:
                        Exp = 1000000000;
                        break;

                    case ModSettings.Difficulty.Challenge5:
                        Exp = 5000000000;
                        break;

                    default:
                        Exp = 10000000000;
                        break;
                    }
                    if (GameSetup.IsMpServer)
                    {
                        using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
                        {
                            using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                            {
                                w.Write(10);
                                w.Write(Exp);
                                w.Close();
                            }
                            ChampionsOfForest.Network.NetworkManager.SendLine(answerStream.ToArray(), ChampionsOfForest.Network.NetworkManager.Target.Everyone);
                            answerStream.Close();
                        }
                    }
                    else
                    {
                        ModdedPlayer.instance.AddKillExperience(Exp);
                    }
                    int itemCount = UnityEngine.Random.Range(15, 26);
                    for (int i = 0; i < itemCount; i++)
                    {
                        Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(Exp), LocalPlayer.Transform.position + Vector3.up * 2);
                    }
                    ModAPI.Console.Write("Worm Died");
                }
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }
Exemple #9
0
 public static void Init()
 {
     TwitchMod.Register("randomitem", s => ChampionsOfForest.Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(Random.value * 2000), LocalPlayer.Transform.position + Vector3.up * 3f));
     TwitchMod.Register("buff", s =>
     {
         int r = Random.Range(0, positiveBuffs.Length);
         BuffDB.AddBuff(positiveBuffs[r], 90000, positiveBuffs_amounts[r], 10);
     });
     TwitchMod.Register("debuff", s =>
     {
         int r = Random.Range(0, negativeBuffs.Length);
         BuffDB.AddBuff(negativeBuffs[r], 90001, negativeBuffs_amounts[r], 10);
     });
     TwitchMod.Register("meteors", s => Meteor.CreateEnemy(LocalPlayer.Transform.position, Random.Range(0, 1000000)));
     TwitchMod.Register("laser", s => EnemyLaser.CreateLaser(LocalPlayer.Transform.position - LocalPlayer.Transform.forward * 10, LocalPlayer.Transform.forward));
     TwitchMod.Register("cataclysm", s => Cataclysm.Create(LocalPlayer.Transform.position, 7, 100, 5, Cataclysm.TornadoType.Fire, true));
 }
Exemple #10
0
        protected override void Update()
        {
            this.activeWormWalkers.RemoveAll((GameObject o) => o == null);
            this.activeWormTrees.RemoveAll((GameObject o) => o == null);
            this.activeWormSingle.RemoveAll((GameObject o) => o == null);
            this.activeWormAngels.RemoveAll((GameObject o) => o == null);
            if (this.activeWormWalkers.Count > 0 || this.activeWormAngels.Count > 0 || this.activeWormTrees.Count > 0)
            {
                this.anyFormSpawned = true;
            }
            else
            {
                this.anyFormSpawned = false;
            }
            if (this.activeWormSingle.Count == 0 && this.init)
            {
                if (GameSetup.IsMpServer || GameSetup.IsSinglePlayer)
                {
                    float multipier = 1;
                    switch (ModSettings.difficulty)
                    {
                    case ModSettings.Difficulty.Hard:
                        multipier = 2.3f;
                        break;

                    case ModSettings.Difficulty.Elite:
                        multipier = 9;
                        break;

                    case ModSettings.Difficulty.Master:
                        multipier = 20;
                        break;

                    case ModSettings.Difficulty.Challenge1:
                        multipier = 70;
                        break;

                    case ModSettings.Difficulty.Challenge2:
                        multipier = 200;
                        break;

                    case ModSettings.Difficulty.Challenge3:
                        multipier = 1000;
                        break;

                    case ModSettings.Difficulty.Challenge4:
                        multipier = 7000;
                        break;

                    case ModSettings.Difficulty.Challenge5:
                        multipier = 50000;
                        break;

                    default:
                        break;
                    }
                    float Exp = UnityEngine.Random.Range(300, 350);
                    if (GameSetup.IsMpServer)
                    {
                        Network.NetworkManager.SendLine("KX" + Convert.ToInt64(Exp * multipier / (Mathf.Max(1, 0.8f + ModReferences.Players.Count * 0.2f))) + ";", Network.NetworkManager.Target.Everyone);
                    }
                    else
                    {
                        ModdedPlayer.instance.AddKillExperience(Convert.ToInt64(Exp * multipier));
                    }
                    int itemCount = UnityEngine.Random.Range(5, 7);
                    for (int i = 0; i < itemCount; i++)
                    {
                        Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(Exp), LocalPlayer.Transform.position + Vector3.up * 2);
                    }
                }
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }