Exemplo n.º 1
0
 public float armor(ELimb limb, Player player)
 {
     if (limb == ELimb.LEFT_FOOT || limb == ELimb.LEFT_LEG || limb == ELimb.RIGHT_FOOT || limb == ELimb.RIGHT_LEG)
     {
         if (player.clothing.pants != 0)
         {
             ItemClothingAsset itemClothingAsset = (ItemClothingAsset)Assets.find(EAssetType.ITEM, player.clothing.pants);
             if (itemClothingAsset != null)
             {
                 if (Provider.modeConfigData.Items.Has_Durability && player.clothing.pantsQuality > 0)
                 {
                     PlayerClothing clothing = player.clothing;
                     clothing.pantsQuality -= 1;
                     player.clothing.sendUpdatePantsQuality();
                 }
                 return(itemClothingAsset.armor + (1f - itemClothingAsset.armor) * (1f - (float)player.clothing.pantsQuality / 100f));
             }
         }
     }
     else if (limb == ELimb.LEFT_HAND || limb == ELimb.LEFT_ARM || limb == ELimb.RIGHT_HAND || limb == ELimb.RIGHT_ARM)
     {
         if (player.clothing.shirt != 0)
         {
             ItemClothingAsset itemClothingAsset2 = (ItemClothingAsset)Assets.find(EAssetType.ITEM, player.clothing.shirt);
             if (itemClothingAsset2 != null)
             {
                 if (Provider.modeConfigData.Items.Has_Durability && player.clothing.shirtQuality > 0)
                 {
                     PlayerClothing clothing2 = player.clothing;
                     clothing2.shirtQuality -= 1;
                     player.clothing.sendUpdateShirtQuality();
                 }
                 return(itemClothingAsset2.armor + (1f - itemClothingAsset2.armor) * (1f - (float)player.clothing.shirtQuality / 100f));
             }
         }
     }
     else
     {
         if (limb == ELimb.SPINE)
         {
             float num = 1f;
             if (player.clothing.vest != 0)
             {
                 ItemClothingAsset itemClothingAsset3 = (ItemClothingAsset)Assets.find(EAssetType.ITEM, player.clothing.vest);
                 if (itemClothingAsset3 != null)
                 {
                     if (Provider.modeConfigData.Items.Has_Durability && player.clothing.vestQuality > 0)
                     {
                         PlayerClothing clothing3 = player.clothing;
                         clothing3.vestQuality -= 1;
                         player.clothing.sendUpdateVestQuality();
                     }
                     num *= itemClothingAsset3.armor + (1f - itemClothingAsset3.armor) * (1f - (float)player.clothing.vestQuality / 100f);
                 }
             }
             if (player.clothing.shirt != 0)
             {
                 ItemClothingAsset itemClothingAsset4 = (ItemClothingAsset)Assets.find(EAssetType.ITEM, player.clothing.shirt);
                 if (itemClothingAsset4 != null)
                 {
                     if (Provider.modeConfigData.Items.Has_Durability && player.clothing.shirtQuality > 0)
                     {
                         PlayerClothing clothing4 = player.clothing;
                         clothing4.shirtQuality -= 1;
                         player.clothing.sendUpdateShirtQuality();
                     }
                     num *= itemClothingAsset4.armor + (1f - itemClothingAsset4.armor) * (1f - (float)player.clothing.shirtQuality / 100f);
                 }
             }
             return(num);
         }
         if (limb == ELimb.SKULL && player.clothing.hat != 0)
         {
             ItemClothingAsset itemClothingAsset5 = (ItemClothingAsset)Assets.find(EAssetType.ITEM, player.clothing.hat);
             if (itemClothingAsset5 != null)
             {
                 if (Provider.modeConfigData.Items.Has_Durability && player.clothing.hatQuality > 0)
                 {
                     PlayerClothing clothing5 = player.clothing;
                     clothing5.hatQuality -= 1;
                     player.clothing.sendUpdateHatQuality();
                 }
                 return(itemClothingAsset5.armor + (1f - itemClothingAsset5.armor) * (1f - (float)player.clothing.hatQuality / 100f));
             }
         }
     }
     return(1f);
 }
Exemplo n.º 2
0
 public float armor(ELimb limb, Zombie zombie)
 {
     if ((int)zombie.type < LevelZombies.tables.Count)
     {
         if (limb == ELimb.LEFT_FOOT || limb == ELimb.LEFT_LEG || limb == ELimb.RIGHT_FOOT || limb == ELimb.RIGHT_LEG)
         {
             if (zombie.pants != 255 && (int)zombie.pants < LevelZombies.tables[(int)zombie.type].slots[1].table.Count)
             {
                 ItemClothingAsset itemClothingAsset = (ItemClothingAsset)Assets.find(EAssetType.ITEM, LevelZombies.tables[(int)zombie.type].slots[1].table[(int)zombie.pants].item);
                 if (itemClothingAsset != null)
                 {
                     return(itemClothingAsset.armor);
                 }
             }
         }
         else if (limb == ELimb.LEFT_HAND || limb == ELimb.LEFT_ARM || limb == ELimb.RIGHT_HAND || limb == ELimb.RIGHT_ARM)
         {
             if (zombie.shirt != 255 && (int)zombie.shirt < LevelZombies.tables[(int)zombie.type].slots[0].table.Count)
             {
                 ItemClothingAsset itemClothingAsset2 = (ItemClothingAsset)Assets.find(EAssetType.ITEM, LevelZombies.tables[(int)zombie.type].slots[0].table[(int)zombie.shirt].item);
                 if (itemClothingAsset2 != null)
                 {
                     return(itemClothingAsset2.armor);
                 }
             }
         }
         else
         {
             if (limb == ELimb.SPINE)
             {
                 float num = 1f;
                 if (zombie.gear != 255 && (int)zombie.gear < LevelZombies.tables[(int)zombie.type].slots[3].table.Count)
                 {
                     ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, LevelZombies.tables[(int)zombie.type].slots[3].table[(int)zombie.gear].item);
                     if (itemAsset != null && itemAsset.type == EItemType.VEST)
                     {
                         num *= ((ItemClothingAsset)itemAsset).armor;
                     }
                 }
                 if (zombie.shirt != 255 && (int)zombie.shirt < LevelZombies.tables[(int)zombie.type].slots[0].table.Count)
                 {
                     ItemClothingAsset itemClothingAsset3 = (ItemClothingAsset)Assets.find(EAssetType.ITEM, LevelZombies.tables[(int)zombie.type].slots[0].table[(int)zombie.shirt].item);
                     if (itemClothingAsset3 != null)
                     {
                         num *= itemClothingAsset3.armor;
                     }
                 }
                 return(num);
             }
             if (limb == ELimb.SKULL && zombie.hat != 255 && (int)zombie.hat < LevelZombies.tables[(int)zombie.type].slots[2].table.Count)
             {
                 ItemClothingAsset itemClothingAsset4 = (ItemClothingAsset)Assets.find(EAssetType.ITEM, LevelZombies.tables[(int)zombie.type].slots[2].table[(int)zombie.hat].item);
                 if (itemClothingAsset4 != null)
                 {
                     return(itemClothingAsset4.armor);
                 }
             }
         }
     }
     return(1f);
 }