public override void OnlyLoadoutWeapons(HTNPlayer target)
 {
     if (Object.op_Equality((Object)target, (Object)null) || target.IsDestroyed || (target.IsDead() || target.IsWounded()) || (Object.op_Equality((Object)target.inventory, (Object)null) || target.inventory.containerBelt == null || (target.inventory.containerMain == null || target.inventory.containerWear == null)))
     {
         return;
     }
     if (this.loadouts != null && this.loadouts.Length != 0)
     {
         PlayerInventoryProperties loadout = this.loadouts[Random.Range(0, this.loadouts.Length)];
         if (!Object.op_Inequality((Object)loadout, (Object)null))
         {
             return;
         }
         foreach (ItemAmount itemAmount in loadout.belt)
         {
             if (itemAmount.itemDef.category == ItemCategory.Weapon)
             {
                 target.inventory.GiveItem(ItemManager.Create(itemAmount.itemDef, (int)itemAmount.amount, 0UL), target.inventory.containerBelt);
             }
         }
         ((MonoBehaviour)target).StartCoroutine(this.EquipWeapon(target));
     }
     else
     {
         Debug.LogWarning((object)("Loadout for NPC " + ((Object)this).get_name() + " was empty."));
     }
 }
Exemple #2
0
 public override void OnlyLoadoutWeapons(HTNPlayer target)
 {
     if (target == null || target.IsDestroyed || target.IsDead() || target.IsWounded() || target.inventory == null || target.inventory.containerBelt == null || target.inventory.containerMain == null || target.inventory.containerWear == null)
     {
         return;
     }
     if (this.loadouts == null || this.loadouts.Length == 0)
     {
         UnityEngine.Debug.LogWarning(string.Concat("Loadout for NPC ", base.name, " was empty."));
     }
     else
     {
         PlayerInventoryProperties playerInventoryProperty = this.loadouts[UnityEngine.Random.Range(0, (int)this.loadouts.Length)];
         if (playerInventoryProperty != null)
         {
             foreach (ItemAmount itemAmount in playerInventoryProperty.belt)
             {
                 if (itemAmount.itemDef.category != ItemCategory.Weapon)
                 {
                     continue;
                 }
                 target.inventory.GiveItem(ItemManager.Create(itemAmount.itemDef, (int)itemAmount.amount, (ulong)0), target.inventory.containerBelt);
             }
             target.StartCoroutine(this.EquipWeapon(target));
             return;
         }
     }
 }
Exemple #3
0
 public override void Loadout(HTNPlayer target)
 {
     if (target == null || target.IsDestroyed || target.IsDead() || target.IsWounded() || target.inventory == null || target.inventory.containerBelt == null || target.inventory.containerMain == null || target.inventory.containerWear == null)
     {
         return;
     }
     if (this.loadouts == null || this.loadouts.Length == 0)
     {
         UnityEngine.Debug.LogWarning(string.Concat("Loadout for NPC ", base.name, " was empty."));
     }
     else
     {
         PlayerInventoryProperties playerInventoryProperty = this.loadouts[UnityEngine.Random.Range(0, (int)this.loadouts.Length)];
         if (playerInventoryProperty != null)
         {
             playerInventoryProperty.GiveToPlayer(target);
             target.StartCoroutine(this.EquipWeapon(target));
             return;
         }
     }
 }
 public override void Loadout(HTNPlayer target)
 {
     if (Object.op_Equality((Object)target, (Object)null) || target.IsDestroyed || (target.IsDead() || target.IsWounded()) || (Object.op_Equality((Object)target.inventory, (Object)null) || target.inventory.containerBelt == null || (target.inventory.containerMain == null || target.inventory.containerWear == null)))
     {
         return;
     }
     if (this.loadouts != null && this.loadouts.Length != 0)
     {
         PlayerInventoryProperties loadout = this.loadouts[Random.Range(0, this.loadouts.Length)];
         if (!Object.op_Inequality((Object)loadout, (Object)null))
         {
             return;
         }
         loadout.GiveToPlayer((BasePlayer)target);
         ((MonoBehaviour)target).StartCoroutine(this.EquipWeapon(target));
     }
     else
     {
         Debug.LogWarning((object)("Loadout for NPC " + ((Object)this).get_name() + " was empty."));
     }
 }