Esempio n. 1
0
 public Resource(int id, string FileName)
 {
     ID       = id;
     fileName = FileName;
     loaded   = false;
     if (fileName.EndsWith(".png", true, System.Globalization.CultureInfo.CurrentCulture) || fileName.EndsWith(".jpeg", true, System.Globalization.CultureInfo.CurrentCulture) || fileName.EndsWith(".jpg", true, System.Globalization.CultureInfo.CurrentCulture))
     {
         type = ResourceType.Texture;
     }
     else if (fileName.EndsWith(".txt", true, System.Globalization.CultureInfo.CurrentCulture))
     {
         type = ResourceType.Text;
     }
     else if (fileName.EndsWith(".obj", true, System.Globalization.CultureInfo.CurrentCulture) || fileName.EndsWith(".mesh", true, System.Globalization.CultureInfo.CurrentCulture))
     {
         type = ResourceType.Mesh;
     }
     else if (fileName.EndsWith(".ogg", true, System.Globalization.CultureInfo.CurrentCulture) || fileName.EndsWith(".mp3", true, System.Globalization.CultureInfo.CurrentCulture) || fileName.EndsWith(".wav", true, System.Globalization.CultureInfo.CurrentCulture))
     {
         type = ResourceType.Audio;
     }
     try
     {
         ResourceLoader.instance.unloadedResources.Add(id, this);
     }
     catch (System.Exception ex)
     {
         CotfUtils.Log($"ERROR WHILE ADDING RESOURCE: {fileName}\n" + ex.ToString());
     }
 }
Esempio n. 2
0
 public static void AssignPrefabs()
 {
     try
     {
         AssetBundle bundle = Res.ResourceLoader.GetAssetBundle(2003);
         arcanaprefab = bundle.LoadAsset <GameObject>("FireColumnArcane.prefab");
         fireprefab   = bundle.LoadAsset <GameObject>("FireColumn.prefab");
     }
     catch (Exception e)
     {
         CotfUtils.Log("Assign Prefabs error " + e.Message);
     }
 }
Esempio n. 3
0
 private void EnableParticles()
 {
     try
     {
         particleParent.SetActive(true);
         warmUpDone = true;
         Invoke("End", duration);
         CotfUtils.Log("enabled particles cataclysm");
     }
     catch (Exception e)
     {
         CotfUtils.Log("Enabling particles cataclysm error " + e.Message);
     }
 }
 public void Awake()
 {
     cam      = Camera.main;
     ratio    = 1f / cam.aspect;
     instance = this;
     try
     {
         var bundle = Res.ResourceLoader.GetAssetBundle(2004);
         shader = bundle.LoadAsset <Shader>("BlackHoleShader.shader");
     }
     catch (System.Exception e)
     {
         CotfUtils.Log(e.ToString());
     }
 }
Esempio n. 5
0
 private void End()
 {
     try
     {
         warmUpDone = false;
         for (int i = 0; i < particleParent.transform.childCount; i++)
         {
             particleParent.transform.GetChild(i).SendMessage("Stop", new object[] { true, ParticleSystemStopBehavior.StopEmitting });
         }
         animator.SetBool("Done", true);
         Destroy(gameObject, 3);
     }
     catch (Exception e)
     {
         CotfUtils.Log("End cataclysm error " + e.Message);
     }
 }
Esempio n. 6
0
 private void Start()
 {
     try
     {
         warmUpDone = false;
         animator   = transform.GetChild(0).GetChild(0).GetComponent <Animator>();
         animator.Play("Intro");
         particleParent = transform.GetChild(1).gameObject;
         particleParent.SetActive(false);
         Invoke("EnableParticles", 2);
         CotfUtils.Log("start cataclysm");
         dmg = (int)damage;
     }
     catch (Exception e)
     {
         CotfUtils.Log("Start cataclysm error " + e.Message);
     }
 }
Esempio n. 7
0
 public static void Create(Vector3 position, float radius, float damage, float duration, TornadoType tornadoType, bool isFromEnemy)
 {
     try
     {
         GameObject go = tornadoType == TornadoType.Fire ? GameObject.Instantiate(fireprefab) : GameObject.Instantiate(arcanaprefab);
         radius = 18.5f;
         go.transform.position = position + Vector3.down * 2;
         go.transform.rotation = Quaternion.identity;
         Cataclysm c = go.AddComponent <Cataclysm>();
         c.damage      = damage;
         c.radius      = radius;
         c.duration    = duration;
         c.isFromEnemy = isFromEnemy;
         c.isArcane    = tornadoType == TornadoType.Arcane;
         CotfUtils.Log("Created cataclysm");
     }
     catch (Exception e)
     {
         CotfUtils.Log("Creating cataclysm error " + e.Message);
     }
 }
        public static void OnCommand(byte[] bytes)
        {
            using (MemoryStream stream = new MemoryStream(bytes))
            {
                using (BinaryReader r = new BinaryReader(stream))
                {
                    int cmdIndex = r.ReadInt32();

                    if (cmdIndex == 1)  //previousely AB
                    {
                        if (GameSetup.IsMpServer && ModSettings.DifficultyChoosen)
                        {
                            using (MemoryStream answerStream = new MemoryStream())
                            {
                                using (BinaryWriter w = new BinaryWriter(answerStream))
                                {
                                    w.Write(2);
                                    w.Write((int)ModSettings.difficulty);
                                    w.Write(ModSettings.FriendlyFire);
                                    w.Write((int)ModSettings.dropsOnDeath);
                                    w.Write(ModSettings.killOnDowned);
                                    w.Close();
                                }
                                Network.NetworkManager.SendLine(answerStream.ToArray(), Network.NetworkManager.Target.Clients);
                                answerStream.Close();
                            }
                        }
                    }
                    else if (cmdIndex == 2) //request for the what is the difficulty
                    {
                        if (!GameSetup.IsMpClient || ModSettings.IsDedicated)
                        {
                            return;
                        }

                        int index = r.ReadInt32();
                        ModSettings.FriendlyFire = r.ReadBoolean();
                        ModSettings.dropsOnDeath = (ModSettings.DropsOnDeathMode)r.ReadInt32();
                        ModSettings.killOnDowned = r.ReadBoolean();
                        Array values = Enum.GetValues(typeof(ModSettings.Difficulty));
                        ModSettings.difficulty = (ModSettings.Difficulty)values.GetValue(index);
                        if (!ModSettings.DifficultyChoosen)
                        {
                            LocalPlayer.FpCharacter.UnLockView();
                            LocalPlayer.FpCharacter.MovementLocked = false;
                        }
                        ModSettings.DifficultyChoosen = true;
                    }
                    else if (cmdIndex == 3) //spell casted
                    {
                        int spellid = r.ReadInt32();
                        if (spellid == 1)
                        {
                            Vector3 pos = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            BlackHole.CreateBlackHole(pos, r.ReadBoolean(), r.ReadSingle(), r.ReadSingle(), r.ReadSingle(), r.ReadSingle(), r.ReadString());
                        }
                        else if (spellid == 2)
                        {
                            Vector3 pos = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            HealingDome.CreateHealingDome(pos, r.ReadSingle(), r.ReadSingle(), r.ReadBoolean(), r.ReadBoolean(), r.ReadSingle());
                        }
                        else if (spellid == 3)
                        {
                            Vector3 pos = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            DarkBeam.Create(pos, r.ReadBoolean(), r.ReadSingle(), r.ReadSingle(), r.ReadSingle(), r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        }
                        else if (spellid == 4)
                        {
                            bool   isOn   = r.ReadBoolean();
                            string packed = r.ReadString();
                            BlackFlame.ToggleOtherPlayer(packed, isOn);
                        }
                        else if (spellid == 5)
                        {
                            Vector3 pos     = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            float   radius  = r.ReadSingle();
                            float   speed   = r.ReadSingle();
                            float   dmg     = r.ReadSingle();
                            bool    GiveDmg = r.ReadBoolean();
                            bool    GiveAr  = r.ReadBoolean();
                            int     ar      = 0;
                            if (GiveAr)
                            {
                                ar = r.ReadInt32();
                            }

                            WarCry.Cast(pos, radius, speed, dmg, GiveDmg, GiveAr, ar);
                        }
                        else if (spellid == 6)
                        {
                            Vector3 pos      = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            float   duration = r.ReadSingle();
                            int     id       = r.ReadInt32();

                            Portal.CreatePortal(pos, duration, id, r.ReadBoolean(), r.ReadBoolean());
                        }
                        else if (spellid == 7)
                        {
                            Vector3 pos = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            Vector3 dir = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());

                            float  dmg       = r.ReadSingle();
                            string caster    = r.ReadString();
                            float  duration  = r.ReadSingle();
                            bool   slow      = r.ReadBoolean();
                            bool   dmgdebuff = r.ReadBoolean();
                            if (GameSetup.IsMpServer)
                            {
                                MagicArrow.Create(pos, dir, dmg, caster, duration, slow, dmgdebuff);
                            }
                            else
                            {
                                MagicArrow.CreateEffect(pos, dir, dmgdebuff, duration);
                            }
                        }
                        else if (spellid == 8)
                        {
                            Purge.Cast(new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle()), r.ReadSingle(), r.ReadBoolean(), r.ReadBoolean());
                        }
                        else if (spellid == 9)
                        {
                            Vector3 pos  = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            float   dist = r.ReadSingle();

                            SnapFreeze.CreateEffect(pos, dist);
                            if (!GameSetup.IsMpClient)
                            {
                                SnapFreeze.HostAction(pos, dist, r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            }
                        }
                        else if (spellid == 10)
                        {
                            Vector3 pos   = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            Vector3 speed = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            float   dmg   = r.ReadSingle();
                            uint    id    = r.ReadUInt32();

                            if (BallLightning.lastID < id)
                            {
                                BallLightning.lastID = id;
                            }

                            BallLightning.Create(pos, speed, dmg, id);
                        }
                        else if (spellid == 11)
                        {
                            Vector3 pos       = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            float   radius    = r.ReadSingle();
                            float   dmg       = r.ReadSingle();
                            float   duration  = r.ReadSingle();
                            bool    isArcane  = r.ReadBoolean();
                            bool    fromEnemy = r.ReadBoolean();
                            Cataclysm.Create(pos, radius, dmg, duration, isArcane ? Cataclysm.TornadoType.Arcane : Cataclysm.TornadoType.Fire, fromEnemy);
                        }
                        else if (spellid == 12)
                        {
                            //a request from a client to a host to spawn a ball lightning. The host assigns the id of
                            //a ball lightning to not create overlapping ids
                            using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream())
                            {
                                using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream))
                                {
                                    w.Write(3);
                                    w.Write(10);
                                    w.Write(r.ReadSingle());
                                    w.Write(r.ReadSingle());
                                    w.Write(r.ReadSingle());
                                    w.Write(r.ReadSingle());
                                    w.Write(r.ReadSingle());
                                    w.Write(r.ReadSingle());
                                    w.Write(r.ReadSingle());
                                    w.Write((uint)(BallLightning.lastID + 1));
                                    w.Close();
                                    BallLightning.lastID++;
                                }
                                ChampionsOfForest.Network.NetworkManager.SendLine(answerStream.ToArray(), ChampionsOfForest.Network.NetworkManager.Target.Everyone);
                                answerStream.Close();
                            }
                        }
                        else if (spellid == 13) //parry was casted by a client
                        {
                            Vector3 pos    = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            float   radius = r.ReadSingle();
                            bool    ignite = r.ReadBoolean();
                            float   dmg    = r.ReadSingle();

                            DamageMath.DamageClamp(dmg, out int d, out int rep);
                            var hits = Physics.SphereCastAll(pos, radius, Vector3.one);

                            for (int i = 0; i < hits.Length; i++)
                            {
                                if (hits[i].transform.CompareTag("enemyCollide"))
                                {
                                    for (int a = 0; a < rep; a++)
                                    {
                                        hits[i].transform.SendMessageUpwards("Hit", d, SendMessageOptions.DontRequireReceiver);
                                        if (ignite)
                                        {
                                            hits[i].transform.SendMessageUpwards("Burn", SendMessageOptions.DontRequireReceiver);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else if (cmdIndex == 4) //remove item
                    {
                        PickUpManager.RemovePickup(r.ReadUInt64());
                    }
                    else if (cmdIndex == 5)                                                        //create item
                    {
                        Item  item = new Item(ItemDataBase.ItemBases[r.ReadInt32()], 1, 0, false); //reading first value, id
                        ulong id   = r.ReadUInt64();
                        item.level = r.ReadInt32();
                        int     amount = r.ReadInt32();
                        Vector3 pos    = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        while (r.BaseStream.Position != r.BaseStream.Length)
                        {
                            ItemStat stat = new ItemStat(ItemDataBase.Stats[r.ReadInt32()])
                            {
                                Amount = r.ReadSingle()
                            };
                            item.Stats.Add(stat);
                        }
                        PickUpManager.SpawnPickUp(item, pos, amount, id);
                    }
                    else if (cmdIndex == 6) //host has been asked to share info on enemy
                    {
                        if (!GameSetup.IsMpClient)
                        {
                            ulong packed = r.ReadUInt64();
                            if (EnemyManager.hostDictionary.ContainsKey(packed))
                            {
                                EnemyProgression ep = EnemyManager.hostDictionary[packed];
                                using (MemoryStream answerStream = new MemoryStream())
                                {
                                    using (BinaryWriter w = new BinaryWriter(answerStream))
                                    {
                                        w.Write(7);
                                        w.Write(packed);
                                        w.Write(ep.EnemyName);
                                        w.Write(ep.Level);
                                        w.Write(ep._hp + ep._Health.Health);
                                        w.Write(ep.MaxHealth);
                                        w.Write(ep.bounty);
                                        w.Write(ep.Armor);
                                        w.Write(ep.ArmorReduction);
                                        w.Write(ep.Steadfast);
                                        w.Write(ep.abilities.Count);
                                        foreach (EnemyProgression.Abilities item in ep.abilities)
                                        {
                                            w.Write((int)item);
                                        }

                                        w.Close();
                                    }
                                    Network.NetworkManager.SendLine(answerStream.ToArray(), Network.NetworkManager.Target.Clients);
                                    answerStream.Close();
                                }
                            }
                            else
                            {
                                CotfUtils.Log("no enemy in host's dictionary");
                            }
                        }
                    }
                    else if (cmdIndex == 7) //host answered info about a enemy and the info is processed
                    {
                        if (ModSettings.IsDedicated)
                        {
                            return;
                        }

                        if (GameSetup.IsMpClient)
                        {
                            ulong packed = r.ReadUInt64();
                            if (!EnemyManager.allboltEntities.ContainsKey(packed))
                            {
                                EnemyManager.GetAllEntities();
                            }
                            if (EnemyManager.allboltEntities.ContainsKey(packed))
                            {
                                BoltEntity entity         = EnemyManager.allboltEntities[packed];
                                string     name           = r.ReadString();
                                int        level          = r.ReadInt32();
                                float      health         = r.ReadSingle();
                                float      maxhealth      = r.ReadSingle();
                                long       bounty         = r.ReadInt64();
                                int        armor          = r.ReadInt32();
                                int        armorReduction = r.ReadInt32();
                                float      steadfast      = r.ReadSingle();
                                int        length         = r.ReadInt32();
                                int[]      affixes        = new int[length];
                                for (int i = 0; i < length; i++)
                                {
                                    affixes[i] = r.ReadInt32();
                                }
                                if (EnemyManager.clinetProgressions.ContainsKey(entity))
                                {
                                    ClinetEnemyProgression cp = EnemyManager.clinetProgressions[entity];
                                    cp.creationTime   = Time.time;
                                    cp.Entity         = entity;
                                    cp.Level          = level;
                                    cp.Health         = health;
                                    cp.MaxHealth      = maxhealth;
                                    cp.Armor          = armor;
                                    cp.ArmorReduction = armorReduction;
                                    cp.EnemyName      = name;
                                    cp.ExpBounty      = bounty;
                                    cp.Steadfast      = steadfast;
                                    cp.Affixes        = affixes;
                                }
                                else
                                {
                                    new ClinetEnemyProgression(entity, name, level, health, maxhealth, bounty, armor, armorReduction, steadfast, affixes);
                                }
                            }
                        }
                    }
                    else if (cmdIndex == 8) //enemy spell casted
                    {
                        int id = r.ReadInt32();
                        if (id == 1) //snow aura
                        {
                            ulong    packed = r.ReadUInt64();
                            SnowAura sa     = new GameObject("Snow").AddComponent <SnowAura>();
                            if (!EnemyManager.allboltEntities.ContainsKey(packed))
                            {
                                EnemyManager.GetAllEntities();
                            }
                            sa.followTarget = EnemyManager.allboltEntities[packed].transform;
                        }
                        else if (id == 2) //fire aura
                        {
                            ulong      packed = r.ReadUInt64();
                            float      dmg    = r.ReadSingle();
                            GameObject go     = EnemyManager.allboltEntities[packed].gameObject;
                            FireAura.Cast(go, dmg);
                        }
                    }
                    else if (cmdIndex == 9)  //poison Player
                    {
                        string playerID = r.ReadString();
                        if (ModReferences.ThisPlayerID == playerID)
                        {
                            int   source   = r.ReadInt32();
                            float amount   = r.ReadSingle();
                            float duration = r.ReadSingle();

                            BuffDB.AddBuff(3, source, amount, duration);
                        }
                    }
                    else if (cmdIndex == 10) //kill experience
                    {
                        ModdedPlayer.instance.AddKillExperience(r.ReadInt64());
                    }
                    else if (cmdIndex == 11) //add experience without massacre
                    {
                        ModdedPlayer.instance.AddFinalExperience(r.ReadInt64());
                    }
                    else if (cmdIndex == 12)  //root the player
                    {
                        if (ModdedPlayer.instance.RootImmune == 0 && ModdedPlayer.instance.StunImmune == 0)
                        {
                            Vector3 pos = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                            if ((LocalPlayer.Transform.position - pos).sqrMagnitude < 1250)
                            {
                                float duration = r.ReadSingle();
                                ModdedPlayer.instance.Root(duration);
                                using (MemoryStream answerStream = new MemoryStream())
                                {
                                    using (BinaryWriter w = new BinaryWriter(answerStream))
                                    {
                                        w.Write(14);
                                        w.Write(LocalPlayer.Transform.position.x);
                                        w.Write(LocalPlayer.Transform.position.y);
                                        w.Write(LocalPlayer.Transform.position.z);
                                        w.Write(duration);
                                        w.Close();
                                    }
                                    NetworkManager.SendLine(answerStream.ToArray(), NetworkManager.Target.Everyone);
                                    answerStream.Close();
                                }
                            }
                        }
                    }
                    else if (cmdIndex == 13)  //stun the player
                    {
                        if (ModSettings.IsDedicated)
                        {
                            return;
                        }
                        if (ModdedPlayer.instance.StunImmune == 0)
                        {
                            string playerID = r.ReadString();
                            if (ModReferences.ThisPlayerID == playerID)
                            {
                                float duration = r.ReadSingle();
                                ModdedPlayer.instance.Stun(duration);
                            }
                        }
                    }
                    else if (cmdIndex == 14) //player has been chained, now spawn effect
                    {
                        if (ModSettings.IsDedicated)
                        {
                            return;
                        }

                        Vector3 pos      = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        float   duration = r.ReadSingle();
                        RootSpell.Create(pos, duration);
                    }
                    else if (cmdIndex == 15)    //create trap sphere
                    {
                        Vector3 pos      = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        float   duration = r.ReadSingle();
                        float   radius   = r.ReadSingle();
                        TrapSphereSpell.Create(pos, radius, duration);
                    }
                    else if (cmdIndex == 16)    //create enemy laser, aka plasma cannon
                    {
                        Vector3 pos = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        Vector3 dir = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());

                        EnemyLaser.CreateLaser(pos, dir);
                    }
                    else if (cmdIndex == 17) //create enemy meteor rain
                    {
                        Vector3 pos = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        Meteor.CreateEnemy(pos, r.ReadInt32());
                    }
                    else if (cmdIndex == 18) //player's level info, or command to wipe level data
                    {
                        if (r.BaseStream.Position == r.BaseStream.Length)
                        {
                            ModReferences.PlayerLevels.Clear();
                        }
                        using (MemoryStream answerStream = new MemoryStream())
                        {
                            using (BinaryWriter w = new BinaryWriter(answerStream))
                            {
                                w.Write(19);
                                w.Write(ModReferences.ThisPlayerID);
                                w.Write(ModdedPlayer.instance.Level);
                                w.Close();
                            }
                            Network.NetworkManager.SendLine(answerStream.ToArray(), NetworkManager.Target.Others);
                            answerStream.Close();
                        }
                    }
                    else if (cmdIndex == 19)//add or update some players level to list
                    {
                        string packed = r.ReadString();
                        int    level  = r.ReadInt32();
                        if (ModReferences.PlayerLevels.ContainsKey(packed))
                        {
                            ModReferences.PlayerLevels[packed] = level;
                        }
                        else
                        {
                            ModReferences.PlayerLevels.Add(packed, level);
                        }
                    }
                    else if (cmdIndex == 20) //enemy hitmarker
                    {
                        if (ModSettings.IsDedicated)
                        {
                            return;
                        }

                        int     amount = r.ReadInt32();
                        Vector3 pos    = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        Color   c      = new Color(r.ReadSingle(), r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        MainMenu.CreateHitMarker(amount, pos, c);
                    }
                    else if (cmdIndex == 21)  //player hitmarker
                    {
                        if (ModSettings.IsDedicated)
                        {
                            return;
                        }

                        int     amount = r.ReadInt32();
                        Vector3 pos    = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        new MainMenu.HitMarker(amount, pos, true);
                    }
                    else if (cmdIndex == 22)   //slow Enemy
                    {
                        if (GameSetup.IsMpServer || GameSetup.IsSinglePlayer)
                        {
                            ulong id = r.ReadUInt64();
                            if (EnemyManager.hostDictionary.ContainsKey(id))
                            {
                                float amount = r.ReadSingle();
                                float time   = r.ReadSingle();
                                int   src    = r.ReadInt32();
                                EnemyManager.hostDictionary[id].Slow(src, amount, time);
                            }
                        }
                    }
                    else if (cmdIndex == 23)  //sync magic find
                    {
                        if (GameSetup.IsMpServer)
                        {
                            if (ModSettings.IsDedicated)
                            {
                                ItemDataBase.MagicFind = 1;
                            }
                            else
                            {
                                ItemDataBase.MagicFind = ModdedPlayer.instance.MagicFindMultipier;
                            }
                        }
                        else
                        {
                            using (MemoryStream answerStream = new MemoryStream())
                            {
                                using (BinaryWriter w = new BinaryWriter(answerStream))
                                {
                                    w.Write(24);
                                    w.Write(ModdedPlayer.instance.MagicFindMultipier);
                                    w.Close();
                                }
                                Network.NetworkManager.SendLine(answerStream.ToArray(), Network.NetworkManager.Target.OnlyServer);
                                answerStream.Close();
                            }
                        }
                    }
                    else if (cmdIndex == 24) //update magic find for host
                    {
                        if (GameSetup.IsMpServer)
                        {
                            ItemDataBase.MagicFind *= r.ReadSingle();
                        }
                    }
                    else if (cmdIndex == 25) //ask for item
                    {
                        if (GameSetup.IsMpServer)
                        {
                            ulong itemID = r.ReadUInt64();
                            if (PickUpManager.PickUps.ContainsKey(itemID))
                            {
                                int    itemAmount = r.ReadInt32();
                                string playerID   = r.ReadString();

                                if (PickUpManager.PickUps[itemID].amount > 0)
                                {
                                    int givenAmount = itemAmount;
                                    if (itemAmount > PickUpManager.PickUps[itemID].amount)
                                    {
                                        givenAmount = Mathf.Min(PickUpManager.PickUps[itemID].amount, itemAmount);
                                    }

                                    NetworkManager.SendItemToPlayer(PickUpManager.PickUps[itemID].item, playerID, givenAmount);

                                    PickUpManager.PickUps[itemID].amount -= givenAmount;

                                    if (PickUpManager.PickUps[itemID].amount > 0)
                                    {
                                        return;
                                    }
                                }
                            }
                            using (MemoryStream answerStream = new MemoryStream())
                            {
                                using (BinaryWriter w = new BinaryWriter(answerStream))
                                {
                                    w.Write(4);
                                    w.Write(itemID);
                                    w.Close();
                                }
                                Network.NetworkManager.SendLine(answerStream.ToArray(), Network.NetworkManager.Target.Clients);
                                answerStream.Close();
                            }
                        }
                    }
                    else if (cmdIndex == 26) //give item to player
                    {
                        string playerID = r.ReadString();
                        if (ModReferences.ThisPlayerID == playerID)
                        {
                            //creating the item.
                            Item item = new Item(ItemDataBase.ItemBases[r.ReadInt32()], r.ReadInt32(), 0, false)
                            {
                                level = r.ReadInt32()
                            };

                            //adding stats to the item
                            while (r.BaseStream.Position != r.BaseStream.Length)
                            {
                                ItemStat stat = new ItemStat(ItemDataBase.Stats[r.ReadInt32()])
                                {
                                    Amount = r.ReadSingle()
                                };
                                item.Stats.Add(stat);
                            }

                            Player.Inventory.Instance.AddItem(item, item.Amount);
                        }
                    }
                    else if (cmdIndex == 27) // bonus fire damage
                    {
                        if (GameSetup.IsMpServer || GameSetup.IsSinglePlayer)
                        {
                            ulong id = r.ReadUInt64();
                            if (EnemyManager.hostDictionary.ContainsKey(id))
                            {
                                float amount = r.ReadSingle();
                                float time   = r.ReadSingle();
                                int   src    = r.ReadInt32();
                                EnemyManager.hostDictionary[id].FireDebuff(src, amount, time);
                            }
                        }
                    }
                    else if (cmdIndex == 28) //custom weapon in mp
                    {
                        string id       = r.ReadString();
                        int    weaponID = r.ReadInt32();
                        if (!ModReferences.PlayerHands.ContainsKey(id))
                        {
                            ModReferences.FindHands();
                        }

                        if (ModReferences.PlayerHands.ContainsKey(id))
                        {
                            CoopCustomWeapons.SetWeaponOn(ModReferences.PlayerHands[id], weaponID);
                            Console.WriteLine(ModReferences.PlayerHands[id].name);
                        }
                        else
                        {
                            Debug.LogWarning("NO HAND IN COMMAND READER");
                        }
                    }
                    else if (cmdIndex == 29) //request for enemy damage information
                    {
                        if (GameSetup.IsMpServer)
                        {
                            ulong id = r.ReadUInt64();
                            if (EnemyManager.hostDictionary.ContainsKey(id))
                            {
                                EnemyProgression p = EnemyManager.hostDictionary[id];
                                using (MemoryStream answerStream = new MemoryStream())
                                {
                                    using (BinaryWriter w = new BinaryWriter(answerStream))
                                    {
                                        w.Write(30);
                                        w.Write(id);
                                        w.Write(p.BaseDamageMult);
                                        foreach (EnemyProgression.Abilities ability in p.abilities)
                                        {
                                            w.Write((int)ability);
                                        }
                                        w.Close();
                                    }
                                    NetworkManager.SendLine(answerStream.ToArray(), NetworkManager.Target.Clients);
                                    answerStream.Close();
                                }
                            }
                        }
                    }
                    else if (cmdIndex == 30) //answer to client damage
                    {
                        ulong id  = r.ReadUInt64();
                        float dmg = r.ReadSingle();
                        List <EnemyProgression.Abilities> abilities = new List <EnemyProgression.Abilities>();
                        while (r.BaseStream.Position != r.BaseStream.Length)
                        {
                            abilities.Add((EnemyProgression.Abilities)r.ReadInt32());
                        }
                        new ClientEnemy(id, dmg, abilities);
                    }
                    else if (cmdIndex == 31) //detonate ball lightning
                    {
                        uint    id  = r.ReadUInt32();
                        Vector3 pos = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        if (BallLightning.list.ContainsKey(id))
                        {
                            BallLightning.list[id].CoopTrigger(pos);
                        }
                    }
                    else if (cmdIndex == 32) //apply DoT to an enemy
                    {
                        ulong id = r.ReadUInt64();
                        if (EnemyManager.hostDictionary.ContainsKey(id))
                        {
                            EnemyProgression p = EnemyManager.hostDictionary[id];
                            p.DoDoT(r.ReadInt32(), r.ReadSingle());
                        }
                    }
                    else if (cmdIndex == 33) //enemy got bashed
                    {
                        ulong enemy = r.ReadUInt64();
                        if (EnemyManager.hostDictionary.ContainsKey(enemy))
                        {
                            EnemyProgression p        = EnemyManager.hostDictionary[enemy];
                            float            duration = r.ReadSingle();
                            var   source      = r.ReadInt32();
                            float slowAmount  = r.ReadSingle();
                            float dmgDebuff   = r.ReadSingle();
                            var   bleedDmg    = r.ReadInt32();
                            float bleedChance = r.ReadSingle();
                            p.Slow(source, slowAmount, duration);
                            p.DmgTakenDebuff(source, dmgDebuff, duration);
                            if (UnityEngine.Random.value < bleedChance)
                            {
                                p.DoDoT(bleedDmg, duration);
                            }
                        }
                    }
                    else if (cmdIndex == 34)
                    {
                        if (GameSetup.IsMpServer)
                        {
                            ulong enemy = r.ReadUInt64();
                            if (EnemyManager.hostDictionary.ContainsKey(enemy))
                            {
                                EnemyProgression p = EnemyManager.hostDictionary[enemy];
                                var   source       = r.ReadInt32();
                                float amount       = r.ReadSingle();
                                float duration     = r.ReadSingle();
                                p.DmgTakenDebuff(source, amount, duration);
                            }
                        }
                    }
                    else if (cmdIndex == 35)    //clear ping command
                    {
                        string player = r.ReadString();
                        if (MainMenu.Instance.otherPlayerPings.ContainsKey(player))
                        {
                            MainMenu.Instance.otherPlayerPings.Remove(player);
                        }
                    }
                    else if (cmdIndex == 36)    //create ping command
                    {
                        string PlayerID           = r.ReadString();
                        MarkObject.PingType ptype = (MarkObject.PingType)r.ReadInt32();
                        switch (ptype)
                        {
                        case MarkObject.PingType.Enemy:
                            ulong EnemyID = r.ReadUInt64();
                            if (!EnemyManager.allboltEntities.ContainsKey(EnemyID))
                            {
                                EnemyManager.GetAllEntities();
                            }
                            if (EnemyManager.allboltEntities.ContainsKey(EnemyID))
                            {
                                bool      isElite = r.ReadBoolean();
                                string    name    = r.ReadString();
                                Transform tr      = EnemyManager.allboltEntities[EnemyID].transform;
                                if (PlayerID == ModReferences.ThisPlayerID)
                                {
                                    MainMenu.Instance.localPlayerPing = new MarkEnemy(tr, name, isElite);
                                }
                                else
                                {
                                    if (MainMenu.Instance.otherPlayerPings.ContainsKey(PlayerID))
                                    {
                                        MainMenu.Instance.otherPlayerPings[PlayerID] = new MarkEnemy(tr, name, isElite);
                                    }
                                    else
                                    {
                                        MainMenu.Instance.otherPlayerPings.Add(PlayerID, new MarkEnemy(tr, name, isElite));
                                    }
                                }
                            }
                            break;

                        case MarkObject.PingType.Location:
                            float x = r.ReadSingle(), y = r.ReadSingle(), z = r.ReadSingle();
                            if (PlayerID == ModReferences.ThisPlayerID)
                            {
                                MainMenu.Instance.localPlayerPing = new MarkPostion(new Vector3(x, y, z));
                            }
                            else
                            {
                                if (MainMenu.Instance.otherPlayerPings.ContainsKey(PlayerID))
                                {
                                    MainMenu.Instance.otherPlayerPings[PlayerID] = new MarkPostion(new Vector3(x, y, z));
                                }
                                else
                                {
                                    MainMenu.Instance.otherPlayerPings.Add(PlayerID, new MarkPostion(new Vector3(x, y, z)));
                                }
                            }

                            break;

                        case MarkObject.PingType.Item:
                            ulong PickupID = r.ReadUInt64();
                            if (PickUpManager.PickUps.ContainsKey(PickupID))
                            {
                                var pu = PickUpManager.PickUps[PickupID];
                                if (PlayerID == ModReferences.ThisPlayerID)
                                {
                                    MainMenu.Instance.localPlayerPing = new MarkPickup(pu.transform, pu.item.name, pu.item.Rarity);
                                }
                                else
                                {
                                    if (MainMenu.Instance.otherPlayerPings.ContainsKey(PlayerID))
                                    {
                                        MainMenu.Instance.otherPlayerPings[PlayerID] = new MarkPickup(pu.transform, pu.item.name, pu.item.Rarity);
                                    }
                                    else
                                    {
                                        MainMenu.Instance.otherPlayerPings.Add(PlayerID, new MarkPickup(pu.transform, pu.item.name, pu.item.Rarity));
                                    }
                                }
                            }
                            break;
                        }
                    }
                    else if (cmdIndex == 37)    //create ping for enemy
                    {
                        if (GameSetup.IsMpServer)
                        {
                            string PlayerID = r.ReadString();
                            ulong  EnemyID  = r.ReadUInt64();
                            if (EnemyManager.hostDictionary.ContainsKey(EnemyID))
                            {
                                var enemy = EnemyManager.hostDictionary[EnemyID];
                                using (MemoryStream answerStream = new MemoryStream())
                                {
                                    using (BinaryWriter w = new BinaryWriter(answerStream))
                                    {
                                        w.Write(36);
                                        w.Write(PlayerID);
                                        w.Write(0);
                                        w.Write(EnemyID);
                                        w.Write(enemy._rarity != EnemyProgression.EnemyRarity.Normal);
                                        w.Write(enemy.EnemyName);
                                        w.Close();
                                    }
                                    NetworkManager.SendLine(answerStream.ToArray(), NetworkManager.Target.Everyone);
                                    answerStream.Close();
                                }
                            }
                        }
                    }
                    else if (cmdIndex == 38)    //spark of light after darkness callback to clients
                    {
                        if (GameSetup.IsMpClient)
                        {
                            string PlayerID = r.ReadString();
                            if (ModReferences.ThisPlayerID == PlayerID)
                            {
                                Vector3 pos = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                                SpellActions.CastBallLightning(pos, Vector3.down);
                            }
                        }
                    }
                    else if (cmdIndex == 39)    //archangel bow hit a player
                    {
                        var s = r.ReadString();
                        if (ModReferences.ThisPlayerID == s)
                        {
                            BuffDB.AddBuff(25, 91, r.ReadSingle(), 30);
                            BuffDB.AddBuff(9, 92, 1.35f, 30);
                            ModdedPlayer.instance.damageAbsorbAmounts[2] = r.ReadSingle();
                        }
                    }
                    else if (cmdIndex == 40)    //buff a player by ID
                    {
                        var s = r.ReadString();
                        if (ModReferences.ThisPlayerID == s)
                        {
                            BuffDB.AddBuff(r.ReadInt32(), r.ReadInt32(), r.ReadSingle(), r.ReadSingle());
                        }
                    }
                    else if (cmdIndex == 41)    //buff a player by distance
                    {
                        var vector = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
                        var dist   = r.ReadSingle();
                        if ((vector - LocalPlayer.Transform.position).sqrMagnitude <= dist * dist)
                        {
                            BuffDB.AddBuff(r.ReadInt32(), r.ReadInt32(), r.ReadSingle(), r.ReadSingle());
                        }
                    }
                    else if (cmdIndex == 42)    //buff all players globally
                    {
                        BuffDB.AddBuff(r.ReadInt32(), r.ReadInt32(), r.ReadSingle(), r.ReadSingle());
                    }
                    r.Close();
                }
                stream.Close();
            }
        }
        protected override void OnTriggerEnter(Collider other)
        {
            try
            {
                currState = animator.GetCurrentAnimatorStateInfo(0);
                nextState = animator.GetNextAnimatorStateInfo(0);
                if (currState.tagHash != damagedHash && currState.tagHash != staggerHash && currState.tagHash != hitStaggerHash && currState.tagHash != deathHash && nextState.tagHash != damagedHash && nextState.tagHash != staggerHash && nextState.tagHash != hitStaggerHash && nextState.tagHash != deathHash)
                {
                    if (other.gameObject.CompareTag("trapTrigger"))
                    {
                        other.gameObject.SendMessage("CutRope", SendMessageOptions.DontRequireReceiver);
                    }
                    if (!netPrefab && LocalPlayer.Animator && LocalPlayer.Animator.GetBool("deathBool"))
                    {
                        return;
                    }
                    if (other.gameObject.CompareTag("playerHitDetect") && mainTrigger)
                    {
                        if (!Scene.SceneTracker.hasAttackedPlayer)
                        {
                            Scene.SceneTracker.hasAttackedPlayer = true;
                            Scene.SceneTracker.Invoke("resetHasAttackedPlayer", Random.Range(120, 240));
                        }
                        targetStats component = other.transform.root.GetComponent <targetStats>();
                        if (component && component.targetDown)
                        {
                            return;
                        }
                        Animator componentInParent = other.gameObject.GetComponentInParent <Animator>();
                        Vector3  position          = rootTr.position;
                        position.y += 3.3f;
                        Vector3 direction = other.transform.position - position;
                        if (!Physics.Raycast(position, direction, out hit, direction.magnitude, enemyHitMask, QueryTriggerInteraction.Ignore))
                        {
                            bool doParry = SpellActions.ParryAnythingIsTimed;
                            if (doParry || (!creepy_male && !creepy && !creepy_baby && !creepy_fat && events))
                            {
                                if (componentInParent)
                                {
                                    bool flag = InFront(other.gameObject);
                                    if (doParry || ((!BoltNetwork.isServer || !netPrefab) && flag && events.parryBool && ((componentInParent.GetNextAnimatorStateInfo(1).tagHash == blockHash || componentInParent.GetCurrentAnimatorStateInfo(1).tagHash == blockHash))))
                                    {
                                        SpellActions.DoParry(transform.position);
                                        ModAPI.Console.Write("Parrying successful");

                                        if ((!creepy_male && !creepy && !creepy_baby && !creepy_fat && events))
                                        {
                                            int parryDir = events != null ? events.parryDir : 1;
                                            BoltSetReflectedShim.SetIntegerReflected(animator, "parryDirInt", parryDir);
                                            if (BoltNetwork.isClient && netPrefab)
                                            {
                                                BoltSetReflectedShim.SetTriggerReflected(animator, "ClientParryTrigger");
                                                hitPrediction.StartParryPrediction();
                                                FMODCommon.PlayOneshot(parryEvent, base.transform);
                                                parryEnemy parryEnemy = parryEnemy.Create(GlobalTargets.OnlyServer);
                                                parryEnemy.Target = transform.root.GetComponent <BoltEntity>();
                                                parryEnemy.Send();
                                            }
                                            else
                                            {
                                                BoltSetReflectedShim.SetTriggerReflected(animator, "parryTrigger");
                                            }
                                            events.StartCoroutine("disableAllWeapons");
                                            playerHitReactions componentInParent2 = other.gameObject.GetComponentInParent <playerHitReactions>();
                                            if (componentInParent2 != null)
                                            {
                                                componentInParent2.enableParryState();
                                            }
                                            FMODCommon.PlayOneshotNetworked(parryEvent, base.transform, FMODCommon.NetworkRole.Server);
                                            events.parryBool = false;
                                        }
                                        return;
                                    }
                                }
                            }
                            if ((bool)events)
                            {
                                events.parryBool = false;
                            }
                            other.transform.root.SendMessage("getHitDirection", rootTr.position, SendMessageOptions.DontRequireReceiver);
                            float num = 0;
                            if (maleSkinny || femaleSkinny)
                            {
                                if (pale)
                                {
                                    num = ((!skinned) ? Mathf.Floor(10f * GameSettings.Ai.skinnyDamageRatio) : Mathf.Floor(10f * GameSettings.Ai.skinnyDamageRatio * GameSettings.Ai.skinMaskDamageRatio));
                                }
                                else
                                {
                                    num = Mathf.Floor(13f * GameSettings.Ai.skinnyDamageRatio);
                                    if (maleSkinny && props.regularStick.activeSelf && events.leftHandWeapon)
                                    {
                                        num = Mathf.Floor(num * 1.35f);
                                    }
                                }
                            }
                            else if (male && pale)
                            {
                                num = ((!skinned) ? Mathf.Floor(22f * GameSettings.Ai.largePaleDamageRatio) : Mathf.Floor(22f * GameSettings.Ai.largePaleDamageRatio * GameSettings.Ai.skinMaskDamageRatio));
                            }
                            else if (male && !firemanMain)
                            {
                                num = ((!painted) ? Mathf.Floor(20f * GameSettings.Ai.regularMaleDamageRatio) : Mathf.Floor(20f * GameSettings.Ai.regularMaleDamageRatio * GameSettings.Ai.paintedDamageRatio));
                            }
                            else if (female)
                            {
                                num = Mathf.Floor(17f * GameSettings.Ai.regularFemaleDamageRatio);
                            }
                            else if (creepy)
                            {
                                num = ((!pale) ? Mathf.Floor(28f * GameSettings.Ai.creepyDamageRatio) : Mathf.Floor(35f * GameSettings.Ai.creepyDamageRatio));
                            }
                            else if (creepy_male)
                            {
                                num = ((!pale) ? Mathf.Floor(60f * GameSettings.Ai.creepyDamageRatio) : Mathf.Floor(120f * GameSettings.Ai.creepyDamageRatio));
                            }
                            else if (creepy_baby)
                            {
                                num = Mathf.Floor(26f * GameSettings.Ai.creepyBabyDamageRatio);
                            }
                            else if (firemanMain)
                            {
                                num = Mathf.Floor(12f * GameSettings.Ai.regularMaleDamageRatio);
                                if (events && !enemyAtStructure && !events.noFireAttack)
                                {
                                    if (BoltNetwork.isRunning && netPrefab)
                                    {
                                        other.gameObject.SendMessageUpwards("Burn", SendMessageOptions.DontRequireReceiver);
                                    }
                                    else
                                    {
                                        other.gameObject.SendMessageUpwards("Burn", SendMessageOptions.DontRequireReceiver);
                                    }
                                }
                            }
                            if (!female && male)
                            {
                                if (holdingRegularWeapon() && events.leftHandWeapon)
                                {
                                    num += 7;
                                }
                                else if (holdingAdvancedWeapon() && events.leftHandWeapon)
                                {
                                    num += 15;
                                }
                            }
                            if (setup && setup.health.poisoned)
                            {
                                num = Mathf.Floor(num / 2);
                            }

                            //COTF additional code
                            try
                            {
                                if (GameSetup.IsMpClient)
                                {
                                    if (other.transform.root == LocalPlayer.Transform.root)
                                    {
                                        var x = EnemyManager.clientEnemies[entity.networkId.PackedValue];
                                        num = x.damagemult + num - 20f;
                                        if (x.abilities.Contains(EnemyProgression.Abilities.RainEmpowerment))
                                        {
                                            if (Scene.WeatherSystem.Raining)
                                            {
                                                num *= 5;
                                            }
                                        }
                                        hitDamage = num;
                                        if (x.abilities.Contains(EnemyProgression.Abilities.Poisonous))
                                        {
                                            BuffDB.AddBuff(3, 32, Mathf.Sqrt(num / 10) / 7, poisonDuration);
                                        }
                                        if (x.abilities.Contains(EnemyProgression.Abilities.Basher))
                                        {
                                            ModdedPlayer.instance.Stun(stunDuration);
                                        }
                                        if (ModdedPlayer.Stats.TotalThornsDamage > 0)
                                        {
                                            if (ModdedPlayer.Stats.TotalThornsArmorPiercing > 0)
                                            {
                                                EnemyProgression.ReduceArmor(entity, ModdedPlayer.Stats.TotalThornsArmorPiercing);
                                            }

                                            PlayerHitEnemy playerHitEnemy = PlayerHitEnemy.Create(GlobalTargets.OnlyServer);
                                            playerHitEnemy.Target = entity;
                                            //this integer make the attack not stagger the enemy
                                            playerHitEnemy.getAttackerType = 2000000;
                                            playerHitEnemy.Hit             = DamageMath.GetSendableDamage(ModdedPlayer.Stats.TotalThornsDamage);
                                            playerHitEnemy.Send();
                                        }
                                    }
                                }
                                else
                                {
                                    if (other.transform.root == LocalPlayer.Transform.root && EnemyManager.enemyByTransform.ContainsKey(this.rootTr))
                                    {
                                        if (EnemyProg == null)
                                        {
                                            EnemyProg = EnemyManager.enemyByTransform[this.rootTr];
                                        }
                                        num = EnemyProg.DamageAmp * EnemyProg.DebuffDmgMult + num - 20f;

                                        hitDamage = num;
                                        CotfUtils.Log($"Damage dealt to player: d{hitDamage}  amp{EnemyProg.DamageAmp}  lv{EnemyProg.level}  php{hitDamage*100 / ModdedPlayer.Stats.TotalMaxHealth}%", true);

                                        //POISON ATTACKS
                                        if (EnemyProg.abilities.Contains(EnemyProgression.Abilities.Poisonous))
                                        {
                                            BuffDB.AddBuff(3, 32, Mathf.Sqrt(num / 10) / 10, poisonDuration);
                                        }

                                        //STUN ON HIT
                                        if (EnemyProg.abilities.Contains(EnemyProgression.Abilities.Basher))
                                        {
                                            ModdedPlayer.instance.Stun(stunDuration);
                                        }

                                        if (ModdedPlayer.Stats.TotalThornsDamage > 0)
                                        {
                                            EnemyProg.HitPhysicalSilent(ModdedPlayer.Stats.TotalThornsDamage);
                                            if (ModdedPlayer.Stats.TotalThornsArmorPiercing > 0)
                                            {
                                                EnemyProg.ReduceArmor(ModdedPlayer.Stats.TotalThornsArmorPiercing);
                                            }
                                        }
                                    }
                                }
                            }
                            catch (System.Exception ex)
                            {
                                ModAPI.Log.Write(ex.ToString());
                            }
                            PlayerStats component2 = other.transform.root.GetComponent <PlayerStats>();
                            if (male || female || creepy_male || creepy_fat || creepy || creepy_baby)
                            {
                                netId component3 = other.transform.GetComponent <netId>();
                                if (BoltNetwork.isServer && component3)
                                {
                                    other.transform.root.SendMessage("StartPrediction", SendMessageOptions.DontRequireReceiver);
                                    return;
                                }
                                if (BoltNetwork.isClient && netPrefab && !(bool)component3)
                                {
                                    other.transform.root.SendMessage("setCurrentAttacker", this, SendMessageOptions.DontRequireReceiver);
                                    other.transform.root.SendMessage("hitFromEnemy", Mathf.RoundToInt(num), SendMessageOptions.DontRequireReceiver);
                                    other.transform.root.SendMessage("StartPrediction", SendMessageOptions.DontRequireReceiver);
                                }
                                else if (BoltNetwork.isServer)
                                {
                                    if (!(bool)component3)
                                    {
                                        other.transform.root.SendMessage("setCurrentAttacker", this, SendMessageOptions.DontRequireReceiver);
                                        other.transform.root.SendMessage("hitFromEnemy", Mathf.RoundToInt(num), SendMessageOptions.DontRequireReceiver);
                                    }
                                }
                                else if (!BoltNetwork.isRunning && component2)
                                {
                                    component2.setCurrentAttacker(this);
                                    component2.hitFromEnemy(Mathf.RoundToInt(num));
                                }
                            }
                            else if (!netPrefab && component2)
                            {
                                component2.setCurrentAttacker(this);
                                component2.hitFromEnemy(Mathf.RoundToInt(num));
                            }

                            goto IL_092f;
                        }
                        return;
                    }
                    goto IL_092f;
                }

                return;

IL_092f:
                if (other.gameObject.CompareTag("enemyCollide") && mainTrigger && bodyCollider && !enemyAtStructure)
                {
                    setupAttackerType();
                    if (other.gameObject != bodyCollider)
                    {
                        other.transform.SendMessageUpwards("getAttackDirection", Random.Range(0, 2), SendMessageOptions.DontRequireReceiver);
                        other.transform.SendMessageUpwards("getCombo", Random.Range(1, 4), SendMessageOptions.DontRequireReceiver);
                        other.transform.SendMessage("getAttackerType", attackerType, SendMessageOptions.DontRequireReceiver);
                        other.transform.SendMessage("getAttacker", rootTr.gameObject, SendMessageOptions.DontRequireReceiver);
                        other.transform.SendMessageUpwards("HitPhysical", Random.Range(30f, 50f) * Mathf.Pow(ModdedPlayer.Stats.explosionDamage, 1.25f), SendMessageOptions.DontRequireReceiver);
                        FMODCommon.PlayOneshotNetworked(weaponHitEvent, base.transform, FMODCommon.NetworkRole.Server);
                    }
                }
                if (other.gameObject.CompareTag("BreakableWood") || (other.gameObject.CompareTag("BreakableRock") && mainTrigger))
                {
                    other.transform.SendMessage("Hit", 50, SendMessageOptions.DontRequireReceiver);
                    other.SendMessage("LocalizedHit", new LocalizedHitData(base.transform.position, 50f), SendMessageOptions.DontRequireReceiver);
                    FMODCommon.PlayOneshotNetworked(weaponHitEvent, base.transform, FMODCommon.NetworkRole.Server);
                }
                if (other.gameObject.CompareTag("SmallTree") && !mainTrigger)
                {
                    other.SendMessage("Hit", 2, SendMessageOptions.DontRequireReceiver);
                }
                if (other.gameObject.CompareTag("Fire") && mainTrigger && firemanMain && !events.noFireAttack)
                {
                    other.SendMessage("Burn", SendMessageOptions.DontRequireReceiver);
                }
                if (other.gameObject.CompareTag("Tree") && mainTrigger && creepy_male)
                {
                    other.SendMessage("Explosion", 5f, SendMessageOptions.DontRequireReceiver);
                    FMODCommon.PlayOneshotNetworked(weaponHitEvent, base.transform, FMODCommon.NetworkRole.Server);
                }
                if (!other.gameObject.CompareTag("structure") && !other.gameObject.CompareTag("SLTier1") && !other.gameObject.CompareTag("SLTier2") && !other.gameObject.CompareTag("SLTier3") && !other.gameObject.CompareTag("jumpObject") && !other.gameObject.CompareTag("UnderfootWood"))
                {
                    return;
                }
                if (!mainTrigger)
                {
                    return;
                }
                getStructureStrength component4 = other.gameObject.GetComponent <getStructureStrength>();
                bool flag2 = component4 == null;
                enemyAtStructure = true;
                int num2;
                if (!creepy_male && !creepy && !creepy_fat && !creepy_baby)
                {
                    if (!flag2)
                    {
                        num2 = ((maleSkinny || femaleSkinny) ? ((component4._strength == getStructureStrength.strength.weak) ? Mathf.FloorToInt(8f * GameSettings.Ai.regularStructureDamageRatio) : 0) : ((pale || painted || skinned) ? ((component4._strength != getStructureStrength.strength.veryStrong) ? Mathf.FloorToInt(16f * GameSettings.Ai.regularStructureDamageRatio) : 0) : ((component4._strength != getStructureStrength.strength.veryStrong) ? Mathf.FloorToInt(12f * GameSettings.Ai.regularStructureDamageRatio) : 0)));
                        goto IL_0d63;
                    }
                    return;
                }
                num2 = ((!creepy_baby) ? Mathf.FloorToInt(30f * GameSettings.Ai.creepyStructureDamageRatio) : Mathf.FloorToInt(10f * GameSettings.Ai.creepyStructureDamageRatio));
                goto IL_0d63;
IL_0d63:
                if (setup && setup.health.poisoned)
                {
                    num2 /= 2;
                }
                other.SendMessage("Hit", num2, SendMessageOptions.DontRequireReceiver);
                other.SendMessage("LocalizedHit", new LocalizedHitData(base.transform.position, num2), SendMessageOptions.DontRequireReceiver);
                FMODCommon.PlayOneshotNetworked(weaponHitEvent, base.transform, FMODCommon.NetworkRole.Server);
            }
            catch (System.Exception ee)
            {
                ModAPI.Log.Write(ee.ToString());
            }
        }