Example #1
0
 public void swingBarricade(Vector3 position)
 {
     if (!base.GetComponent <Life>().dead&& (position - base.transform.position).magnitude < 5f)
     {
         SpawnBarricades.damage(position, (int)((float)MeleeStats.getDamage(base.GetComponent <Clothes>().item) * (1f + base.GetComponent <Skills>().warrior() * 0.4f) * 0.25f));
     }
 }
Example #2
0
 public void swingAnimal(NetworkViewID id, int limb)
 {
     if (!base.GetComponent <Life>().dead)
     {
         GameObject gameObject = NetworkView.Find(id).gameObject;
         if (gameObject != null && !gameObject.GetComponent <AI>().dead)
         {
             gameObject.GetComponent <AI>().damage((int)((float)MeleeStats.getDamage(base.GetComponent <Clothes>().item) * (1f + base.GetComponent <Skills>().warrior() * 0.4f) * DamageMultiplier.getMultiplierZombie(limb)));
             if (gameObject.GetComponent <AI>().dead)
             {
                 base.GetComponent <Skills>().learn(UnityEngine.Random.Range(gameObject.GetComponent <AI>().xp - 1, gameObject.GetComponent <AI>().xp + 2));
                 if (gameObject.name == "zombie")
                 {
                     if (!base.networkView.isMine)
                     {
                         base.networkView.RPC("killedZombie", base.networkView.owner, new object[0]);
                     }
                     else
                     {
                         base.GetComponent <Player>().killedZombie();
                     }
                 }
                 else if (!base.networkView.isMine)
                 {
                     base.networkView.RPC("killedAnimal", base.networkView.owner, new object[0]);
                 }
                 else
                 {
                     base.GetComponent <Player>().killedAnimal();
                 }
             }
         }
     }
 }
Example #3
0
 public void swingStructure(Vector3 position, NetworkMessageInfo info)
 {
     if (!base.GetComponent <Life>().dead&& (position - base.transform.position).magnitude < 5f)
     {
         SpawnStructures.damage(position, (int)((float)MeleeStats.getDamage(base.GetComponent <Clothes>().item) * (1f + base.GetComponent <Skills>().warrior() * 0.4f) * 0.25f), info.sender);
     }
 }
Example #4
0
 public void swingVehicle(NetworkViewID id)
 {
     if (!base.GetComponent <Life>().dead&& ServerSettings.pvp)
     {
         GameObject gameObject = NetworkView.Find(id).gameObject;
         if (gameObject != null)
         {
             gameObject.GetComponent <Vehicle>().damage((int)((float)MeleeStats.getDamage(base.GetComponent <Clothes>().item) * (1f + base.GetComponent <Skills>().warrior() * 0.4f) * 0.2f));
         }
     }
 }
Example #5
0
    public void swingPlayer(string id, int limb)
    {
        if (!base.GetComponent <Life>().dead&& ServerSettings.pvp)
        {
            NetworkUser userFromID = NetworkUserList.getUserFromID(id);
            if (userFromID != null && userFromID.model != null && userFromID.model != base.gameObject && !userFromID.model.GetComponent <Life>().dead&& (base.GetComponent <Player>().owner.friend == string.Empty || base.GetComponent <Player>().owner.friend != userFromID.friend) && (userFromID.model.transform.position - base.transform.position).magnitude < 3f)
            {
                float damage = (float)MeleeStats.getDamage(base.GetComponent <Clothes>().item) * DamageMultiplier.getMultiplierPlayer(limb);
                damage = damage * (1f + base.GetComponent <Skills>().warrior() * 0.4f);
                damage = damage * (1f - userFromID.model.GetComponent <Skills>().warrior() * 0.4f);
                if ((limb == 0 || limb == 1) && userFromID.model.GetComponent <Clothes>().pants != -1)
                {
                    damage = damage * ArmorStats.getArmor(userFromID.model.GetComponent <Clothes>().pants);
                }
                if ((limb == 2 || limb == 3 || limb == 5) && userFromID.model.GetComponent <Clothes>().shirt != -1)
                {
                    damage = damage * ArmorStats.getArmor(userFromID.model.GetComponent <Clothes>().shirt);
                }
                if (limb == 5 && userFromID.model.GetComponent <Clothes>().vest != -1)
                {
                    damage = damage * ArmorStats.getArmor(userFromID.model.GetComponent <Clothes>().vest);
                }
                if (limb == 4 && userFromID.model.GetComponent <Clothes>().hat != -1)
                {
                    damage = damage * ArmorStats.getArmor(userFromID.model.GetComponent <Clothes>().hat);
                }
                string empty = string.Empty;
                if (limb == 0)
                {
                    empty = "shin";
                }
                else if (limb == 1)
                {
                    empty = "thigh";
                }
                else if (limb == 2)
                {
                    empty = "arm";
                }
                else if (limb == 3)
                {
                    empty = "shoulder";
                }
                else if (limb == 4)
                {
                    empty = "head";
                }
                else if (limb == 5)
                {
                    empty = "chest";
                }

                int    itemId  = base.GetComponent <Clothes>().item;
                string steamID = base.GetComponent <Player>().owner.id;
                userFromID.model.GetComponent <Life>().damage((int)damage, string.Concat(new string[] { "You were chopped in the ", empty, " with the ", ItemName.getName(itemId), " by ", base.GetComponent <Player>().owner.name, "!" }), itemId, steamID);
                if (userFromID.model.GetComponent <Life>().dead&& Time.realtimeSinceStartup - userFromID.model.GetComponent <Player>().owner.spawned > (float)Reputation.SPAWN_DELAY)
                {
                    if (userFromID.model.GetComponent <Player>().owner.reputation >= 0)
                    {
                        NetworkHandler.offsetReputation(base.networkView.owner, -1);
                    }
                    else
                    {
                        NetworkHandler.offsetReputation(base.networkView.owner, 1);
                    }
                    if (!base.networkView.isMine)
                    {
                        base.sendKilledPlayer(userFromID, base.networkView.owner);
                        //base.networkView.RPC("killedPlayer", base.networkView.owner, new object[0]);
                    }
                    else
                    {
                        base.GetComponent <Player>().killedPlayer();
                    }
                }
            }
        }
    }