Advertisement
cfehunter

Untitled

Dec 14th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1.     private void GiveItems(GeoFaction faction, GeoSite relatedActor = null)
  2.     {
  3.       if (this.Items == null || this.Items.IsEmpty)
  4.         return;
  5.       if ((UnityEngine.Object) relatedActor == (UnityEngine.Object) null)
  6.         throw new Exception("Parameter 'relatedActor' is required if items will be given as reward.");
  7.       ItemStorage itemStorage = faction.GetItemStorage(relatedActor);
  8.       int num = faction.GetTotalStorage() - itemStorage.GetStorageUsed();
  9.       foreach (GeoItem geoItem in this.Items.ToList())
  10.       {
  11.         if (num >= geoItem.CommonItemData.StorageUsed)
  12.         {
  13.           itemStorage.AddItem(geoItem);
  14.           num -= geoItem.CommonItemData.StorageUsed;
  15.           this.ApplyResult.Items.AddItem(geoItem);
  16.         }
  17.       }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement