public FurnitureForCreateViewModel GetFurnitureForCreate(FurnitureTypeEnum furnitureType)
 {
     return(new FurnitureForCreateViewModel()
     {
         Name = furnitureType.ToHumanReadable().FirstUpper(),
         FurnitureTypeID = (int)furnitureType,
         Price = HouseFurnitureObject.GetUpgradeCost(furnitureType, 1)
     });
 }
예제 #2
0
        public MethodResult CanBuildFurniture(House house, FurnitureTypeEnum furnitureType, Entity entity)
        {
            var result = CanModifyHouse(house, entity);

            if (result.IsError)
            {
                return(result);
            }

            if (houseFurnitureRepository.IsFurnitureBuilt(house.ID, furnitureType))
            {
                return(new MethodResult($"{furnitureType.ToHumanReadable().FirstUpper()} is already built!"));
            }

            var cost  = HouseFurnitureObject.GetUpgradeCost(furnitureType, 1);
            var chest = houseFurnitureRepository.GetHouseChest(house.ID);

            if (houseChestService.HasItem(chest, ProductTypeEnum.ConstructionMaterials, 1, cost) == false)
            {
                return(new MethodResult($"You do not have {cost} Construction materials to create {furnitureType.ToHumanReadable()}."));
            }

            return(MethodResult.Success);
        }