diff options
-rw-r--r-- | conf/map/maps.conf | 1 | ||||
-rw-r--r-- | db/map_index.txt | 357 | ||||
-rw-r--r-- | maps/re/020-8.mcache | bin | 0 -> 80 bytes | |||
-rw-r--r-- | npc/020-1/_import.txt | 1 | ||||
-rw-r--r-- | npc/020-1/estate.txt | 95 | ||||
-rw-r--r-- | npc/020-8/_import.txt | 5 | ||||
-rw-r--r-- | npc/020-8/_warps.txt | 3 | ||||
-rw-r--r-- | npc/020-8/doorbell.txt | 336 | ||||
-rw-r--r-- | npc/020-8/utils.txt | 72 | ||||
-rw-r--r-- | npc/_import.txt | 1 | ||||
-rw-r--r-- | npc/functions/estate2.txt | 4 |
11 files changed, 697 insertions, 178 deletions
diff --git a/conf/map/maps.conf b/conf/map/maps.conf index 824f3b382..da75a819f 100644 --- a/conf/map/maps.conf +++ b/conf/map/maps.conf @@ -245,6 +245,7 @@ map_list: ( "020-7-1", "020-7-2", "020-7", + "020-8", "021-0", "021-1", "021-2", diff --git a/db/map_index.txt b/db/map_index.txt index be7d2987b..700e0ad02 100644 --- a/db/map_index.txt +++ b/db/map_index.txt @@ -242,181 +242,182 @@ 020-7-1 242 020-7-2 243 020-7 244 -021-0 245 -021-1 246 -021-2 247 -021-3 248 -021-4 249 -022-1 250 -023-1 251 -023-2 252 -023-3-1 253 -023-3-2 254 -023-3 255 -023-4 256 -024-1 257 -024-10 258 -024-11 259 -024-12 260 -024-13 261 -024-14 262 -024-15 263 -024-16 264 -024-2 265 -024-3 266 -024-4 267 -024-5 268 -024-6 269 -024-7 270 -024-8 271 -024-9 272 -025-1 273 -025-2-1 274 -025-2-2 275 -025-2-3 276 -025-2-4 277 -025-2 278 -025-3 279 -025-4-1 280 -025-4 281 -026-0 282 -026-1 283 -026-2 284 -026-3 285 -026-6 286 -026-7 287 -027-0 288 -027-1 289 -027-2 290 -027-3 291 -027-4 292 -027-5 293 -027-6 294 -027-7 295 -029-0 296 -029-1 297 -029-2 298 -029-3 299 -029-4 300 -029-5 301 -029-6 302 -029-7 303 -029-8 304 -029-9 305 -030-01 306 -030-02 307 -030-03 308 -030-04 309 -030-05 310 -030-06 311 -030-07 312 -030-08 313 -030-09 314 -030-10 315 -030-11 316 -030-12 317 -030-13 318 -030-14 319 -030-15 320 -030-16 321 -030-17 322 -030-18 323 -030-19 324 -030-20 325 -030-21 326 -030-22 327 -030-23 328 -030-24 329 -030-25 330 -030-26 331 -030-27 332 -030-28 333 -030-29 334 -030-30 335 -030-31 336 -030-32 337 -030-33 338 -030-34 339 -030-35 340 -030-36 341 -030-37 342 -030-38 343 -030-39 344 -030-40 345 -030-41 346 -030-42 347 -030-43 348 -030-44 349 -030-45 350 -030-46 351 -030-47 352 -030-48 353 -030-49 354 -030-50 355 -030-51 356 -030-52 357 -030-53 358 -030-54 359 -030-55 360 -030-56 361 -030-57 362 -030-58 363 -030-59 364 -030-60 365 -030-61 366 -030-62 367 -030-63 368 -030-64 369 -030-65 370 -030-66 371 -030-67 372 -030-68 373 -030-69 374 -030-70 375 -030-71 376 -030-72 377 -030-73 378 -030-74 379 -030-75 380 -031-0 381 -031-1 382 -031-2 383 -031-3 384 -031-4 385 -031-5 386 -031-6 387 -031-7 388 -031-8 389 -031-9 390 -032-1 391 -032-2 392 -032-3 393 -032-4 394 -032-5 395 -033-1 396 -033-2 397 -033-3 398 -033-4 399 -033-5 400 -034-1 401 -034-2 402 -034-3 403 -034-4 404 -042-0 405 -042-1 406 -042-10 407 -042-11 408 -042-2 409 -042-3 410 -042-4 411 -042-5 412 -042-6 413 -042-7 414 -042-8 415 -042-9 416 -boss 417 -botcheck 418 -guilds 419 -sec_pri 420 -soren-2 421 -soren 422 +020-8 245 +021-0 246 +021-1 247 +021-2 248 +021-3 249 +021-4 250 +022-1 251 +023-1 252 +023-2 253 +023-3-1 254 +023-3-2 255 +023-3 256 +023-4 257 +024-1 258 +024-10 259 +024-11 260 +024-12 261 +024-13 262 +024-14 263 +024-15 264 +024-16 265 +024-2 266 +024-3 267 +024-4 268 +024-5 269 +024-6 270 +024-7 271 +024-8 272 +024-9 273 +025-1 274 +025-2-1 275 +025-2-2 276 +025-2-3 277 +025-2-4 278 +025-2 279 +025-3 280 +025-4-1 281 +025-4 282 +026-0 283 +026-1 284 +026-2 285 +026-3 286 +026-6 287 +026-7 288 +027-0 289 +027-1 290 +027-2 291 +027-3 292 +027-4 293 +027-5 294 +027-6 295 +027-7 296 +029-0 297 +029-1 298 +029-2 299 +029-3 300 +029-4 301 +029-5 302 +029-6 303 +029-7 304 +029-8 305 +029-9 306 +030-01 307 +030-02 308 +030-03 309 +030-04 310 +030-05 311 +030-06 312 +030-07 313 +030-08 314 +030-09 315 +030-10 316 +030-11 317 +030-12 318 +030-13 319 +030-14 320 +030-15 321 +030-16 322 +030-17 323 +030-18 324 +030-19 325 +030-20 326 +030-21 327 +030-22 328 +030-23 329 +030-24 330 +030-25 331 +030-26 332 +030-27 333 +030-28 334 +030-29 335 +030-30 336 +030-31 337 +030-32 338 +030-33 339 +030-34 340 +030-35 341 +030-36 342 +030-37 343 +030-38 344 +030-39 345 +030-40 346 +030-41 347 +030-42 348 +030-43 349 +030-44 350 +030-45 351 +030-46 352 +030-47 353 +030-48 354 +030-49 355 +030-50 356 +030-51 357 +030-52 358 +030-53 359 +030-54 360 +030-55 361 +030-56 362 +030-57 363 +030-58 364 +030-59 365 +030-60 366 +030-61 367 +030-62 368 +030-63 369 +030-64 370 +030-65 371 +030-66 372 +030-67 373 +030-68 374 +030-69 375 +030-70 376 +030-71 377 +030-72 378 +030-73 379 +030-74 380 +030-75 381 +031-0 382 +031-1 383 +031-2 384 +031-3 385 +031-4 386 +031-5 387 +031-6 388 +031-7 389 +031-8 390 +031-9 391 +032-1 392 +032-2 393 +032-3 394 +032-4 395 +032-5 396 +033-1 397 +033-2 398 +033-3 399 +033-4 400 +033-5 401 +034-1 402 +034-2 403 +034-3 404 +034-4 405 +042-0 406 +042-1 407 +042-10 408 +042-11 409 +042-2 410 +042-3 411 +042-4 412 +042-5 413 +042-6 414 +042-7 415 +042-8 416 +042-9 417 +boss 418 +botcheck 419 +guilds 420 +sec_pri 421 +soren-2 422 +soren 423 diff --git a/maps/re/020-8.mcache b/maps/re/020-8.mcache Binary files differnew file mode 100644 index 000000000..2cae43ce3 --- /dev/null +++ b/maps/re/020-8.mcache diff --git a/npc/020-1/_import.txt b/npc/020-1/_import.txt index 2eb1208d0..36bafc015 100644 --- a/npc/020-1/_import.txt +++ b/npc/020-1/_import.txt @@ -2,6 +2,7 @@ // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/020-1/_mobs.txt", "npc/020-1/_warps.txt", +"npc/020-1/estate.txt", "npc/020-1/guards.txt", "npc/020-1/mapflags.txt", "npc/020-1/misc.txt", diff --git a/npc/020-1/estate.txt b/npc/020-1/estate.txt new file mode 100644 index 000000000..ed3c52b55 --- /dev/null +++ b/npc/020-1/estate.txt @@ -0,0 +1,95 @@ +// TMW2: Moubootaur Legends scripts. +// Author: +// Jesusalva +// Description: +// Real Estate System + +// ID: 6 +// $ESTATE_OWNER[.id] → Account ID owner of the Real Estate +// $ESTATE_OWNERNAME$[.id] → Human readable name of Real Estate owner +// $ESTATE_RENTTIME[.id] → When the rent will expire +// $ESTATE_MOBILIA_2[.id] → Bitmask of mobilia currently purchased on Monster Collision (6) (Use on walls only) +// $ESTATE_MOBILIA_4[.id] → Bitmask of mobilia currently purchased on Air Collision (2) +// $ESTATE_MOBILIA_8[.id] → Bitmask of mobilia currently purchased on Water Collision (3) +// $ESTATE_MOBILIA_32[.id] → Bitmask of mobilia currently purchased on Yellow Collision (4) +// $ESTATE_MOBILIA_64[.id] → Bitmask of mobilia currently purchased on Normal Collision (1) +// $ESTATE_MOBILIA_128[.id] → Bitmask of mobilia currently purchased on Player Collision (5) +// $ESTATE_PASSWORD$[.id] → Password to enter the estate. If it is "", then no password required +// Note: GMs and Administrators can always use super password "mouboo" to enter a locked estate +// $ESTATE_DOORBELL[.id] → If doorbell is disabled (enabled by default) + +// REAL_ESTATE_CREDITS → Credits equivalent to GP the player have. Will be used first. + +// The sign is the main controller +020-1,41,86,0 script Sign#RES_0208 NPC_SWORDS_SIGN,{ + if ($ESTATE_RENTTIME[.id] < gettimetick(2)) + goto L_RentAvailable; + + if ($ESTATE_OWNER[.id] == getcharid(3)) + goto L_Manage; + + if (is_admin() && $@GM_OVERRIDE) + goto L_Manage; + + mesc l("This estate currently belongs to @@.", $ESTATE_OWNERNAME$[.id]); + mesc l("Press the doorbell?"); + next; + if (askyesno() == ASK_YES) + doevent "Doorbell#RES_0208::OnDoorbell"; + close; + +L_RentAvailable: + realestate_rent(.id, .price); + close; + +L_Manage: + realestate_manage(.id, (.price*7/10)); + close; + +OnInit: + .sex = G_OTHER; + .distance = 3; + + // Estate Settings + .id=6; // Estate ID + .price=40000; // Monthly rent price. Renew is only 70% from this value. + end; + +} + +// Door entrance +012-1,95,69,0 script #RES_0128 NPC_HIDDEN,0,0,{ + end; +OnTouch: + if ($ESTATE_RENTTIME[.id] < gettimetick(2)) + goto L_RentAvailable; + + if ($ESTATE_OWNER[.id] == getcharid(3) || $ESTATE_PASSWORD$[.id] == "") + goto L_Warp; + + mesc l("The door is locked"); + next; + mesc l("However, it can be unlocked if you know the password:"); + if (is_gm()) mesc l("You can use super password \"mouboo\" to unlock the door."), 1; + input .@password$; + // GMs can use super password "mouboo" + if (.@password$ == $ESTATE_PASSWORD$[.id] || (is_gm() && .@password$ == "mouboo")) + goto L_Warp; + close; + +L_Warp: + warp "020-8", 33, 33; + closeclientdialog; + close; + +L_RentAvailable: + dispbottom l("This estate is available for rent, talk to the sign to rent it."); + close; + +OnInit: + // Estate Settings + .id=6; // Estate ID + end; + +} + diff --git a/npc/020-8/_import.txt b/npc/020-8/_import.txt new file mode 100644 index 000000000..7c07a7ffa --- /dev/null +++ b/npc/020-8/_import.txt @@ -0,0 +1,5 @@ +// Map 020-8: Real Estate +// This file is generated automatically. All manually added changes will be removed when running the Converter. +"npc/020-8/_warps.txt", +"npc/020-8/doorbell.txt", +"npc/020-8/utils.txt", diff --git a/npc/020-8/_warps.txt b/npc/020-8/_warps.txt new file mode 100644 index 000000000..522319953 --- /dev/null +++ b/npc/020-8/_warps.txt @@ -0,0 +1,3 @@ +// This file is generated automatically. All manually added changes will be removed when running the Converter. +// Map 020-8: Real Estate warps +020-8,34,34,0 warp #020-8_34_34 1,0,020-1,42,86 diff --git a/npc/020-8/doorbell.txt b/npc/020-8/doorbell.txt new file mode 100644 index 000000000..efe201edb --- /dev/null +++ b/npc/020-8/doorbell.txt @@ -0,0 +1,336 @@ +// TMW2: Moubootaur Legends scripts. +// Author: +// Jesusalva +// Description: +// Real Estate System +// Doorbell allows you to purchase mobilia, besides loading it when server starts +// Each layer can have 32 different furniture pieces because bitmask limit. +// This file is custom to every room + +// ID: 6 +// $ESTATE_OWNER[.id] → Account ID owner of the Real Estate +// $ESTATE_OWNERNAME$[.id] → Human readable name of Real Estate owner +// $ESTATE_RENTTIME[.id] → When the rent will expire +// $ESTATE_MOBILIA_2[.id] → Bitmask of mobilia currently purchased on Monster Collision (6) (Use on walls only) +// $ESTATE_MOBILIA_4[.id] → Bitmask of mobilia currently purchased on Air Collision (2) +// $ESTATE_MOBILIA_8[.id] → Bitmask of mobilia currently purchased on Water Collision (3) +// $ESTATE_MOBILIA_32[.id] → Bitmask of mobilia currently purchased on Yellow Collision (4) +// $ESTATE_MOBILIA_64[.id] → Bitmask of mobilia currently purchased on Normal Collision (1) +// $ESTATE_MOBILIA_128[.id] → Bitmask of mobilia currently purchased on Player Collision (5) +// $ESTATE_PASSWORD$[.id] → Password to enter the estate. If it is "", then no password required +// Note: GMs and Administrators can always use super password "mouboo" to enter a locked estate +// $ESTATE_DOORBELL[.id] → If doorbell is disabled (enabled by default) + +// REAL_ESTATE_CREDITS → Credits equivalent to GP the player have. Will be used first. + +// The sign is the main controller +020-8,32,34,0 script Doorbell#RES_0208 NPC_NO_SPRITE,{ + // Name, Layer, Price, ID, x1, y1, x2, y2, + function create_object { + array_push(.nams$, getarg(0)); + array_push(.layer, getarg(1)); + array_push(.price, getarg(2)); + array_push(.objid, getarg(3)); + array_push(.x1, getarg(4)); + array_push(.y1, getarg(5)); + array_push(.x2, getarg(6)); + array_push(.y2, getarg(7)); + return; + } + + if ($ESTATE_OWNER[.id] == getcharid(3)) + goto L_Manage; + + mesc l("This estate currently belongs to @@.", $ESTATE_OWNERNAME$[.id]); + close; + +// When using setcells() a player could get trapped! +// This label will slide the player back to entrance, which should be a safe spot +OnSlide: + slide 33, 33; + end; + +// If someone press the doorbell from outside and doorbell is enabled +OnDoorbell: + if ($ESTATE_DOORBELL[.id]) + end; + + if (.dpost < gettimetick(2)) { + npctalk (strcharinfo(0)+" is pressing the doorbell."); // We actually don't want l() + } + .dpost=gettimetick(2)+.delay; + end; + +// Managment Menu +L_Manage: + mesc l("@@'s Estate", strcharinfo(0)); + mesc ".:: "+ l("Managment Menu") + " ::."; + + .@gp=REAL_ESTATE_CREDITS+Zeny; + mesc l("Rent time available: @@", FuzzyTime($ESTATE_RENTTIME[.id])); + mesc l("Total Credits and GP: @@", format_number(.@gp)); + mes ""; + mesc l("Room password: @@", $ESTATE_PASSWORD$[.id]); + if ($ESTATE_DOORBELL[.id]) + mesc l("Doorbell is disabled"), 1; + + next; + select + l("Leave"), + l("Enable/disable doorbell"), + l("Manage Furniture"), + l("Set room password"); + + switch (@menu) { + case 1: + close; + break; + case 2: + $ESTATE_DOORBELL[.id]=!$ESTATE_DOORBELL[.id]; + break; + case 3: + goto L_Furniture; + break; + case 4: + mesc l("(Leave the password blank to disable)"); + mesc l("Current Room password: @@", $ESTATE_PASSWORD$[.id]); + mesc l("Input new password: "); + input .@password$; + mesc l("Repeat new password: "); + input .@passwordc$; + if (.@password$ == .@passwordc$) { + $ESTATE_PASSWORD$[.id]=.@password$; + mesc l("Password changed with success!"), 3; + } else { + mesc l("The passwords doesn't match."), 1; + } + break; + } + goto L_Manage; + +L_Furniture: + mesc l("@@'s Estate", strcharinfo(0)); + mesc ".:: "+ l("Furniture Menu") + " ::."; + + .@gp=REAL_ESTATE_CREDITS+Zeny; + mesc l("Total Credits and GP: @@", format_number(.@gp)); + + next; + select + l("Finish"), + l("Manage Beds"), + l("Manage Utilities"), + l("Manage Luxury furniture"), + l("Manage Decoration"), + l("Manage Chairs"), + l("Manage Paintings"); + mes ""; + + switch (@menu) { + case 1: + goto L_Manage; + break; + case 2: + mesc ".:: "+ l("Beds") + " ::.", 3; + @re_col=RES_OBJECTS; + break; + case 3: + mesc ".:: "+ l("Utilities") + " ::.", 3; + @re_col=RES_UTILITIES; + break; + case 4: + mesc ".:: "+ l("Luxury furniture") + " ::.", 3; + @re_col=RES_LUXURY; + break; + case 5: + mesc ".:: "+ l("Decoration") + " ::.", 3; + @re_col=RES_DECORATION; + break; + case 6: + mesc ".:: "+ l("Chairs") + " ::.", 3; + @re_col=RES_SITTABLE; + break; + case 7: + mesc ".:: "+ l("Paintings") + " ::.", 3; + @re_col=RES_WALLDECORATION; + break; + } + +// L_ContinuousLoop +// Requires the following variables: +// @re_col +// Target Collision ID +L_ContinuousLoop: + deletearray @valid_ids; + + // Create a second array (@valid_ids) with the ID of objects within @re_col group + for (.@i=0; .@i < getarraysize(.layer); .@i++) { + //debugmes "Found object ID %d named %s on layer %s coords (%d,%d) - Looking for layer %d", .@i, .nams$[.@i], .layer[.@i], .x1[.@i], .y1[.@i], @re_col; + if (.layer[.@i] == @re_col) + array_push(@valid_ids, .@i); + } + //debugmes "Found %d valid objects", getarraysize(@valid_ids); + + // Create the menu with @valid_ids - Check if you already have the item to decide if you're buying or selling + @menuentries$="Finish:"; + for (.@j=0; .@j < getarraysize(@valid_ids); .@j++) { + .@i=@valid_ids[.@j]; + if (realestate_hasmobilia(.id, .layer[.@i], .objid[.@i])) + @menuentries$+=l("Sell ")+.nams$[.@i]+l(" for ") + format_number( realestate_sellprice(.id,.price[.@i]) ) +":"; + else + @menuentries$+=l("Purchase ")+.nams$[.@i]+(" for ") + format_number( .price[.@i] )+":"; + } + select (@menuentries$); + mes ""; + + // First option to return to previous menu + if (@menu == 1) + goto L_Furniture; + + // Otherwise, we know then that (@menu-2) is the ID in @valid_ids + // So we save .@id with the correct ID in object arrays. + // We also calculate how much aggregated money you have. + .@id=@valid_ids[@menu-2]; + .@gp=REAL_ESTATE_CREDITS+Zeny; + + if (realestate_hasmobilia(.id, .layer[.@id], .objid[.@id])) { + // If you have the mobilia, you're selling it for Mobiliary Credits + delcells realestate_cellname(.id, .@id); + realestate_togglemobilia(.id, .layer[.@id], .objid[.@id], "NPCs#RES_0128"); + REAL_ESTATE_CREDITS+=realestate_sellprice(.id,.price[.@i]); + mesc l("Sale successful!"); + next; + } else { + // Else, you're buying it, so we must check if you have the moolah first + .@price=.price[.@id]; + if (.@gp > .@price) { + realestate_payment(.@price); + setcells .mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], .layer[.@id], realestate_cellname(.id, .@id); + areatimer(.mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], 10, "::OnSlide"); + realestate_togglemobilia(.id, .layer[.@id], .objid[.@id], "NPCs#RES_0128"); + mesc l("Purchase successful!"); + next; + } else { + mesc l("Not enough funds!"); + next; + } + } + + // This loops forever + goto L_ContinuousLoop; + + +OnInit: + .sex = G_OTHER; + .distance = 3; + + // Estate Settings + .id=6; // Estate ID + .delay=15; // Forced wait between rings + .dpost=0; // Last doorbell ring + .mapa$="020-8"; + + // Arrays + // We go element by element on the array building the menu + .nams$=""; + .layer=0; + .price=0; + .objid=0; + .x1=0; + .y1=0; + .x2=0; + .y2=0; + + // Furniture Settings + // Name, Collision Layer, Price, ID, x1, y1, x2, y2 + // For Collision Layer, see constants.conf ("Real Estate Collisions") + create_object("Placeholder" ,99,999999,99999, 99, 99, 99, 99); + + create_object("Bed 01" , 5, 5000, 1, 24, 24, 25, 27); + create_object("Bed 02" , 5, 5000, 2, 26, 24, 27, 27); + create_object("Bed 03" , 5, 5000, 4, 28, 24, 29, 27); + create_object("Bed 04" , 5, 5000, 8, 30, 24, 31, 27); + create_object("Bed 05" , 5, 5000, 16, 24, 29, 25, 32); + create_object("Bed 06" , 5, 5000, 32, 26, 29, 27, 32); + create_object("Bed 07" , 5, 5000, 64, 28, 29, 29, 32); + create_object("Bed 08" , 5, 5000, 128, 30, 29, 31, 32); + + create_object("Wardrobe" , 1, 7000, 1, 21, 23, 22, 23); + create_object("Cauldron" , 1, 5000, 2, 28, 24, 29, 24); + create_object("Shelf 01" , 1, 2000, 4, 25, 23, 25, 23); + create_object("Shelf 02" , 1, 2000, 8, 26, 23, 26, 23); + create_object("Shelf 03" , 1, 2000, 16, 27, 23, 27, 23); + create_object("Shelf 04" , 1, 2000, 32, 30, 23, 30, 23); + create_object("Shelf 05" , 1, 2000, 64, 31, 23, 31, 23); + create_object("Shelf 06" , 1, 2000, 128, 32, 23, 32, 23); + create_object("Shelf 07" , 1, 2000, 256, 33, 23, 33, 23); + create_object("Shelf 08" , 1, 2000, 512, 34, 23, 34, 23); + create_object("Shelf 09" , 1, 2000, 1024, 35, 23, 35, 23); + create_object("Shelf 10" , 1, 2000, 2048, 36, 23, 36, 23); + create_object("Shelf 11" , 1, 2000, 4096, 37, 23, 37, 23); + create_object("Shelf 12" , 1, 2000, 8192, 38, 23, 38, 23); + + create_object("Piano" , 3, 10000, 1, 33, 25, 35, 25); + create_object("Stove" , 3, 40000, 2, 23, 24, 24, 24); + + create_object("Left Desk" , 2, 5000, 1, 20, 25, 22, 27); + create_object("Right Desk" , 2, 5000, 2, 36, 30, 38, 32); + + create_object("Left Chair" , 4, 2000, 1, 21, 28, 21, 28); + create_object("Right Chair" , 4, 2000, 2, 37, 29, 37, 29); + + create_object("Painting 01" , 6, 3000, 1, 21, 20, 21, 20); + create_object("Painting 02" , 6, 3000, 2, 23, 21, 23, 21); + create_object("Painting 03" , 6, 3000, 4, 25, 20, 25, 20); + create_object("Painting 04" , 6, 3000, 8, 28, 21, 28, 21); + create_object("Painting 05" , 6, 3000, 16, 31, 20, 31, 20); + create_object("Painting 06" , 6, 3000, 32, 36, 20, 36, 20); + + // Load Mobilia already existing + //debugmes "[REAL ESTATE] Now loading mobilia"; + for (.@i=0; .@i < getarraysize(.layer); .@i++) { + switch (.layer[.@i]) { + case 1: + if ($ESTATE_MOBILIA_64[.id] & .objid[.@i]) + array_push(.valid_ids, .@i); + break; + case 2: + if ($ESTATE_MOBILIA_4[.id] & .objid[.@i]) + array_push(.valid_ids, .@i); + break; + case 3: + if ($ESTATE_MOBILIA_8[.id] & .objid[.@i]) + array_push(.valid_ids, .@i); + break; + case 4: + if ($ESTATE_MOBILIA_32[.id] & .objid[.@i]) + array_push(.valid_ids, .@i); + break; + case 5: + if ($ESTATE_MOBILIA_128[.id] & .objid[.@i]) + array_push(.valid_ids, .@i); + break; + case 6: + if ($ESTATE_MOBILIA_2[.id] & .objid[.@i]) + array_push(.valid_ids, .@i); + break; + default: + // We do nothing by default + //debugmes("[ERROR] [CRITICAL] [REAL ESTATE]: Object %d have Invalid Collision Type: %d (must range 1~6)", .@i, .layer[.@i]); + break; + } + } + //debugmes "Found %d valid objects", getarraysize(.valid_ids); + for (.@j=0; .@j < getarraysize(.valid_ids); .@j++) { + .@id=.valid_ids[.@j]; + setcells .mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], .layer[.@id], realestate_cellname(.id, .@id); + //debugmes "Creating %s in %s", realestate_cellname(.id, .@id), .mapa$; + } + deletearray .valid_ids; + // Load NPCs + donpcevent "NPCs#RES_0208::OnReload"; + end; + +} + + diff --git a/npc/020-8/utils.txt b/npc/020-8/utils.txt new file mode 100644 index 000000000..50e78eba9 --- /dev/null +++ b/npc/020-8/utils.txt @@ -0,0 +1,72 @@ +// TMW2: Moubootaur Legends scripts. +// Author: +// Jesusalva +// Description: +// Real Estate System +// Utils take care of NPCs - Their code, and enable/disable using check_cell +// This file is custom to every room + +// ID: 6 +// $ESTATE_OWNER[.id] → Account ID owner of the Real Estate +// $ESTATE_OWNERNAME$[.id] → Human readable name of Real Estate owner +// $ESTATE_RENTTIME[.id] → When the rent will expire +// $ESTATE_MOBILIA_2[.id] → Bitmask of mobilia currently purchased on Monster Collision (6) (Use on walls only) +// $ESTATE_MOBILIA_4[.id] → Bitmask of mobilia currently purchased on Air Collision (2) +// $ESTATE_MOBILIA_8[.id] → Bitmask of mobilia currently purchased on Water Collision (3) +// $ESTATE_MOBILIA_32[.id] → Bitmask of mobilia currently purchased on Yellow Collision (4) +// $ESTATE_MOBILIA_64[.id] → Bitmask of mobilia currently purchased on Player Collision (5) +// $ESTATE_MOBILIA_128[.id] → Bitmask of mobilia currently purchased on Normal Collision (1) +// $ESTATE_PASSWORD$[.id] → Password to enter the estate. If it is "", then no password required +// Note: GMs and Administrators can always use super password "mouboo" to enter a locked estate +// $ESTATE_DOORBELL[.id] → If doorbell is disabled (enabled by default) + +// REAL_ESTATE_CREDITS → Credits equivalent to GP the player have. Will be used first. + +// Real Estate NPCs and settings +// The sign is the main controller for rent system +// Doorbell is the main controller for indoor +// This is the NPC script controller +020-8,0,0,0 script NPCs#RES_0208 NPC_HIDDEN,{ + // load_npc ( name , map, x , y{, cell} ) + function load_npc { + if (checknpccell(getarg(1), getarg(2), getarg(3), getarg(4, cell_chknopass))) { + enablenpc getarg(0); + //debugmes "ENABLING NPC %s", getarg(0); + } else { + disablenpc getarg(0); + //debugmes "Disabling NPC %s", getarg(0); + } + + /* + debugmes "----- %s (%d,%d) cell report", getarg(1), getarg(2), getarg(3); + debugmes "cell_chknopass: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chknopass); + debugmes "cell_chknoreach: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chknoreach); + debugmes "cell_chkbasilica: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkbasilica); + debugmes ""; + debugmes "cell_chkwater: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkwater); + debugmes "cell_chkwall: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkwall); + debugmes "cell_chkcliff: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkcliff); + debugmes "----- Npc Id: %s", getarg(0); + */ + return; + } + end; + +OnInit: + // NPC Settings + .sex = G_OTHER; + .distance = 3; + end; + +// Load or unload accordingly +OnReload: + //debugmes "[REAL ESTATE] NPC ONRELOAD"; + // load_npc ( name , map, x , y{, cell} ) + load_npc("Wardrobe#RES_0208", .map$, 21, 23); + load_npc("Cauldron#RES_0208", .map$, 28, 24); + load_npc("Piano#RES_0208" , .map$, 34, 25); + load_npc("Stove#RES_0208" , .map$, 23, 24); + end; + +} + diff --git a/npc/_import.txt b/npc/_import.txt index dfd10ae62..060192f4e 100644 --- a/npc/_import.txt +++ b/npc/_import.txt @@ -244,6 +244,7 @@ @include "npc/020-7-1/_import.txt" @include "npc/020-7-2/_import.txt" @include "npc/020-7/_import.txt" +@include "npc/020-8/_import.txt" @include "npc/021-0/_import.txt" @include "npc/021-1/_import.txt" @include "npc/021-2/_import.txt" diff --git a/npc/functions/estate2.txt b/npc/functions/estate2.txt index 3899a560d..44764b8a2 100644 --- a/npc/functions/estate2.txt +++ b/npc/functions/estate2.txt @@ -307,6 +307,7 @@ OnInit: 017-8,21,23,0 duplicate(Wardrobe#RES_0128) Wardrobe#RES_0178 NPC_NO_SPRITE 009-6,21,23,0 duplicate(Wardrobe#RES_0128) Wardrobe#RES_0096 NPC_NO_SPRITE 009-7,21,23,0 duplicate(Wardrobe#RES_0128) Wardrobe#RES_0097 NPC_NO_SPRITE +020-8,21,23,0 duplicate(Wardrobe#RES_0128) Wardrobe#RES_0208 NPC_NO_SPRITE //////////////////////////////////////////////////////////////////////////// @@ -323,6 +324,7 @@ OnInit: 017-8,29,24,0 duplicate(Cauldron#RES_0128) Cauldron#RES_0178 NPC_NO_SPRITE 009-6,29,24,0 duplicate(Cauldron#RES_0128) Stovetop#RES_0096 NPC_NO_SPRITE 009-7,29,24,0 duplicate(Cauldron#RES_0128) Stovetop#RES_0097 NPC_NO_SPRITE +020-8,29,24,0 duplicate(Cauldron#RES_0128) Stovetop#RES_0208 NPC_NO_SPRITE //////////////////////////////////////////////////////////////////////////// @@ -339,6 +341,7 @@ OnInit: 017-8,34,25,0 duplicate(Piano#RES_0128) Piano#RES_0178 NPC_NO_SPRITE 009-6,34,25,0 duplicate(Piano#RES_0128) Piano#RES_0096 NPC_NO_SPRITE 009-7,34,25,0 duplicate(Piano#RES_0128) Piano#RES_0097 NPC_NO_SPRITE +020-8,34,25,0 duplicate(Piano#RES_0128) Piano#RES_0208 NPC_NO_SPRITE //////////////////////////////////////////////////////////////////////////// @@ -355,5 +358,6 @@ OnInit: 017-8,23,24,0 duplicate(Stove#RES_0128) Stove#RES_0178 NPC_NO_SPRITE 009-6,23,24,0 duplicate(Stove#RES_0128) Stove#RES_0096 NPC_NO_SPRITE 009-7,23,24,0 duplicate(Stove#RES_0128) Stove#RES_0097 NPC_NO_SPRITE +020-8,23,24,0 duplicate(Stove#RES_0128) Stove#RES_0208 NPC_NO_SPRITE |