1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225module Duets.Data.World.Cities.PlaceCreators
open Duets.Data.World
open Duets.Entities
/// Creates a bar with the given name, quality and zone.
let createBar streetId (name, quality, zoneId) =
World.Place.create name quality Bar Layouts.barRoomLayout zoneId streetId
|> World.Place.changeOpeningHours OpeningHours.barOpeningHours
|> World.Place.addExit Ids.Common.bar streetId
/// Creates a bookstore with the given name, quality and zone.
let createBookstore streetId (name, quality, zoneId) =
World.Place.create
name
quality
Bookstore
Layouts.bookstoreLayout
zoneId
streetId
|> World.Place.changeOpeningHours OpeningHours.servicesOpeningHours
|> World.Place.addExit Ids.Bookstore.readingRoom streetId
/// Creates a cafe with the given name, quality and zone.
let createCafe streetId (name, quality, zoneId) =
World.Place.create name quality Cafe Layouts.cafeRoomLayout zoneId streetId
|> World.Place.changeOpeningHours OpeningHours.cafeOpeningHours
|> World.Place.addExit Ids.Common.cafe streetId
/// Creates a car dealer with the given name, quality, cone and car price range.
let createCarDealer streetId (name, quality, zoneId, carDealer) =
World.Place.create
name
quality
(CarDealer(carDealer))
Layouts.carDealerLayout
zoneId
streetId
|> World.Place.changeOpeningHours OpeningHours.servicesOpeningHours
|> World.Place.addExit Ids.CarDealer.showRoom streetId
/// Creates a casino with the given name, quality and zone.
let createCasino streetId (name, quality, zoneId) =
World.Place.create name quality Casino Layouts.casinoLayout zoneId streetId
|> World.Place.addExit Ids.Common.lobby streetId
/// Creates a concert space with the given name, capacity, quality and zone.
let createConcertSpace streetId (name, capacity, quality, layout, zoneId) =
World.Place.create
name
quality
(ConcertSpace { Capacity = capacity })
layout
zoneId
streetId
|> World.Place.changeOpeningHours OpeningHours.concertSpaceOpeningHours
|> World.Place.addExit Ids.Common.lobby streetId
/// Creates a gym with the given name, quality and zone.
let createGym (city: City) streetId (name, quality, zoneId) =
let place =
World.Place.create name quality Gym Layouts.gymLayout zoneId streetId
let entranceChip = Item.Key.createGymChipFor city.Id place.Id
place
|> World.Place.changeRoom Ids.Gym.changingRoom (function
| Some room ->
let requiredItems =
{ ComingFrom = Ids.Common.lobby
Items = [ entranceChip ] }
room
|> World.Room.changeRequiredItemForEntrance requiredItems
|> Some
| _ -> None)
|> World.Place.changeOpeningHours OpeningHours.gymOpeningHours
|> World.Place.addExit Ids.Common.lobby streetId
/// Creates a home with the given zone.
/// TODO: Allow different types of homes depending on the zone, how much the rent is, etc.
let createHome streetId zoneId =
World.Place.create
"Home"
100<quality>
Home
Layouts.homeLayout
zoneId
streetId
|> World.Place.addExit Ids.Home.kitchen streetId
/// Creates a hotel with the given name, quality, price per night and zone.
let createHotel streetId (name, quality, pricePerNight, zoneId) =
World.Place.create
name
quality
(Hotel { PricePerNight = pricePerNight })
Layouts.hotelLayout
zoneId
streetId
|> World.Place.addExit Ids.Common.lobby streetId
/// Creates a hospital with the given name, quality and zone.
let createHospital streetId (name, quality, zoneId) =
World.Place.create
name
quality
Hospital
Layouts.hospitalLayout
zoneId
streetId
|> World.Place.addExit Ids.Common.lobby streetId
/// Creates a merchandise workshop with the given name and zone.
let createMerchandiseWorkshop streetId (name, zoneId) =
World.Place.create
name
100<quality>
MerchandiseWorkshop
Layouts.merchandiseWorkshopLayout
zoneId
streetId
|> World.Place.changeOpeningHours OpeningHours.servicesOpeningHours
|> World.Place.addExit Ids.Workshop.workshop streetId
/// Creates a metro station with the given name and lines.
let createMetro streetId (name, zoneId) =
World.Place.create
name
100<quality>
MetroStation
Layouts.metroLayout
zoneId
streetId
|> World.Place.addExit Ids.Metro.platform streetId
/// Creates a rehearsal space with the given name, quality, price and zone.
let createRehearsalSpace streetId (name, quality, price, zoneId) =
World.Place.create
name
quality
(RehearsalSpace { Price = price })
Layouts.rehearsalSpaceLayout
zoneId
streetId
|> World.Place.changeOpeningHours OpeningHours.servicesOpeningHours
|> World.Place.addExit Ids.Common.lobby streetId
/// Creates a radio studio with the given name, quality, music genre and zone.
let createRadioStudio
(city: City)
streetId
(name, quality, musicGenre, zoneId)
=
let place =
World.Place.create
name
quality
(RadioStudio { MusicGenre = musicGenre })
Layouts.radioStudioLayout
zoneId
streetId
let invitation = Item.Key.createEntranceCardFor city.Id place.Id
place
|> World.Place.changeRoom Ids.Studio.recordingRoom (function
| Some room ->
let requiredItems =
{ ComingFrom = Ids.Common.lobby
Items = [ invitation ] }
room
|> World.Room.changeRequiredItemForEntrance requiredItems
|> Some
| _ -> None)
|> World.Place.changeOpeningHours OpeningHours.radioStudioOpeningHours
|> World.Place.addExit Ids.Common.lobby streetId
/// Creates a restaurant with the given name, quality, cuisine and zone.
let createRestaurant streetId (name, quality, cuisine, zoneId) =
let place =
World.Place.create
name
quality
Restaurant
(Layouts.restaurantRoomLayout cuisine)
zoneId
streetId
let openingHours =
match cuisine with
| Turkish -> PlaceOpeningHours.AlwaysOpen
| _ -> OpeningHours.restaurantOpeningHours
World.Place.changeOpeningHours openingHours place
|> World.Place.addExit Ids.Common.restaurant streetId
/// Creates a studio with the given name, quality, price per song and zone.
let createStudio streetId (name, quality, pricePerSong, producer, zoneId) =
let studio =
{ Producer = producer
PricePerSong = pricePerSong }
World.Place.create
name
quality
(Studio studio)
Layouts.studioLayout
zoneId
streetId
|> World.Place.changeOpeningHours OpeningHours.servicesOpeningHours
|> World.Place.addExit Ids.Studio.masteringRoom streetId
/// Creates an airport with the given name and quality.
let createAirport streetId (name, quality, zoneId) =
World.Place.create
name
quality
Airport
Layouts.airportLayout
zoneId
streetId
|> World.Place.addExit Ids.Common.lobby streetId