Exemple #1
0
 public void ReceiveHouse(PlayerEntity playerEntity)
 {
     if (rank < 9)
     {
         DaggerfallUI.MessageBox(NoHouseId);
     }
     else if ((flags & HouseFlagMask) > 0)
     {
         DaggerfallUI.MessageBox(HardStrings.serviceReceiveHouseAlready);
     }
     else
     {   // Give a house if one availiable
         if (DaggerfallBankManager.OwnsHouse)
         {
             DaggerfallUI.MessageBox((int)TransactionResult.ALREADY_OWN_HOUSE);
         }
         else
         {
             BuildingDirectory buildingDirectory = GameManager.Instance.StreamingWorld.GetCurrentBuildingDirectory();
             if (buildingDirectory)
             {
                 List <BuildingSummary> housesForSale = buildingDirectory.GetHousesForSale();
                 if (housesForSale.Count > 0)
                 {
                     BuildingSummary house = housesForSale[UnityEngine.Random.Range(0, housesForSale.Count)];
                     DaggerfallBankManager.AllocateHouseToPlayer(house, GameManager.Instance.PlayerGPS.CurrentRegionIndex);
                     flags = flags | HouseFlagMask;
                     DaggerfallUI.MessageBox(HouseId);
                     return;
                 }
             }
             DaggerfallUI.MessageBox((int)TransactionResult.NO_HOUSES_FOR_SALE);
         }
     }
 }