diff options
-rw-r--r-- | db/constants.conf | 4 | ||||
-rw-r--r-- | maps/re/003-1-3.mcache | bin | 366 -> 365 bytes | |||
-rw-r--r-- | npc/012-1/estate.txt | 20 | ||||
-rw-r--r-- | npc/012-8/_import.txt | 1 | ||||
-rw-r--r-- | npc/012-8/doorbell.txt | 63 | ||||
-rw-r--r-- | npc/012-8/utils.txt | 161 | ||||
-rw-r--r-- | npc/functions/estate.txt | 15 |
7 files changed, 223 insertions, 41 deletions
diff --git a/db/constants.conf b/db/constants.conf index a26946525..c2b1b8214 100644 --- a/db/constants.conf +++ b/db/constants.conf @@ -3884,11 +3884,11 @@ constants_db: { MASK_SPECIAL: 1024 comment__: "Real Estate Collisions" - RES_OBJECTS: 1 - RES_UTILITIES: 5 + RES_UTILITIES: 1 RES_LUXURY: 3 RES_DECORATION: 2 RES_SITTABLE: 4 + RES_OBJECTS: 5 RES_WALLDECORATION: 6 comment__: "speechflags" diff --git a/maps/re/003-1-3.mcache b/maps/re/003-1-3.mcache Binary files differindex 042e0c98d..132a1b2b8 100644 --- a/maps/re/003-1-3.mcache +++ b/maps/re/003-1-3.mcache diff --git a/npc/012-1/estate.txt b/npc/012-1/estate.txt index 57f578f1d..7552854c8 100644 --- a/npc/012-1/estate.txt +++ b/npc/012-1/estate.txt @@ -12,8 +12,8 @@ // $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_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) @@ -108,7 +108,8 @@ L_Manage: l("Leave"), l("Enable/disable doorbell"), l("Set room password"), - rif(.@gp >= .price && $ESTATE_RENTTIME[.id] < gettimetick(2)+.time, l("Renew Rent")); + rif(.@gp >= .price && $ESTATE_RENTTIME[.id] < gettimetick(2)+.time, l("Renew Rent")), + l("Destroy all mobilia"); switch (@menu) { case 1: @@ -145,6 +146,19 @@ L_Manage: // If you lost the rent and somebody else rented it, you lose the GP $ESTATE_RENTTIME[.id]+=.time; break; + case 5: + mesc l("Are you sure? This cannot be undone!"), 1; + next; + if (validatepin()) { + $ESTATE_MOBILIA_2[.id]=0; + $ESTATE_MOBILIA_4[.id]=0; + $ESTATE_MOBILIA_8[.id]=0; + $ESTATE_MOBILIA_32[.id]=0; + $ESTATE_MOBILIA_64[.id]=0; + $ESTATE_MOBILIA_128[.id]=0; + $ESTATE_PASSWORD$[.id]=""; + $ESTATE_DOORBELL[.id]=false; + } } goto L_Manage; close; diff --git a/npc/012-8/_import.txt b/npc/012-8/_import.txt index b156ebd12..615e3e715 100644 --- a/npc/012-8/_import.txt +++ b/npc/012-8/_import.txt @@ -2,3 +2,4 @@ // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/012-8/_warps.txt", "npc/012-8/doorbell.txt", +"npc/012-8/utils.txt", diff --git a/npc/012-8/doorbell.txt b/npc/012-8/doorbell.txt index 833872c05..a377d9673 100644 --- a/npc/012-8/doorbell.txt +++ b/npc/012-8/doorbell.txt @@ -15,8 +15,8 @@ // $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_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) @@ -50,7 +50,7 @@ OnDoorbell: end; if (.dpost < gettimetick(2)) { - npctalk ("@@ is pressing the doorbell.", strcharinfo(0)); + npctalk l("@@ is pressing the doorbell.", strcharinfo(0)); // We actually don't want l() } .dpost=gettimetick(2)+.delay; end; @@ -189,9 +189,9 @@ L_ContinuousLoop: if (realestate_hasmobilia(.id, .layer[.@id], .objid[.@id])) { // If you have the mobilia, you're selling it for Mobiliary Credits - realestate_togglemobilia(.id, .layer[.@id], .objid[.@id]); - REAL_ESTATE_CREDITS+=realestate_sellprice(.id,.price[.@i]); 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 { @@ -199,8 +199,8 @@ L_ContinuousLoop: .@price=.price[.@id]; if (.@gp > .@price) { realestate_payment(.@price); - realestate_togglemobilia(.id, .layer[.@id], .objid[.@id]); setcells .mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], .layer[.@id], realestate_cellname(.id, .@id); + realestate_togglemobilia(.id, .layer[.@id], .objid[.@id], "NPCs#RES_0128"); mesc l("Purchase successful!"); next; } else { @@ -239,29 +239,29 @@ OnInit: // For Collision Layer, see constants.conf ("Real Estate Collisions") create_object("Placeholder" ,99,999999,99999, 99, 99, 99, 99); - create_object("Bed 01" , 1, 5000, 1, 24, 24, 25, 27); - create_object("Bed 02" , 1, 5000, 2, 26, 24, 27, 27); - create_object("Bed 03" , 1, 5000, 4, 28, 24, 29, 27); - create_object("Bed 04" , 1, 5000, 8, 30, 24, 31, 27); - create_object("Bed 05" , 1, 5000, 16, 24, 29, 25, 32); - create_object("Bed 06" , 1, 5000, 32, 26, 29, 27, 32); - create_object("Bed 07" , 1, 5000, 64, 28, 29, 29, 32); - create_object("Bed 08" , 1, 5000, 128, 30, 29, 31, 32); - - create_object("Wardrobe" , 5, 7000, 1, 21, 23, 22, 23); - create_object("Cauldron" , 5, 5000, 2, 28, 24, 29, 24); - create_object("Shelf 01" , 5, 2000, 4, 25, 23, 25, 23); - create_object("Shelf 02" , 5, 2000, 8, 26, 23, 26, 23); - create_object("Shelf 03" , 5, 2000, 16, 27, 23, 27, 23); - create_object("Shelf 04" , 5, 2000, 32, 30, 23, 30, 23); - create_object("Shelf 05" , 5, 2000, 64, 31, 23, 31, 23); - create_object("Shelf 06" , 5, 2000, 128, 32, 23, 32, 23); - create_object("Shelf 07" , 5, 2000, 256, 33, 23, 33, 23); - create_object("Shelf 08" , 5, 2000, 512, 34, 23, 34, 23); - create_object("Shelf 09" , 5, 2000, 1024, 35, 23, 35, 23); - create_object("Shelf 10" , 5, 2000, 2048, 36, 23, 36, 23); - create_object("Shelf 11" , 5, 2000, 4096, 37, 23, 37, 23); - create_object("Shelf 12" , 5, 2000, 8192, 38, 23, 38, 23); + 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); @@ -316,10 +316,11 @@ OnInit: 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$; + //debugmes "Creating %s in %s", realestate_cellname(.id, .@id), .mapa$; } deletearray .valid_ids; - stopnpctimer; + // Load NPCs + donpcevent "NPCs#RES_0128::OnReload"; end; } diff --git a/npc/012-8/utils.txt b/npc/012-8/utils.txt new file mode 100644 index 000000000..894a5f291 --- /dev/null +++ b/npc/012-8/utils.txt @@ -0,0 +1,161 @@ +// 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: 1 +// $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. + +// The sign is the main controller for rent system +// Doorbell is the main controller for indoor +// This is the NPC script controller +012-8,0,0,0 script NPCs#RES_0128 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: + // Estate Settings + .id=1; // Estate ID + .mapa$="012-8"; // Map name + + // 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_0128", .mapa$, 21, 23); + load_npc("Cauldron#RES_0128", .mapa$, 28, 24); + load_npc("Piano#RES_0128" , .mapa$, 34, 25); + end; + +} + +012-8,21,23,0 script Wardrobe#RES_0128 NPC_NO_SPRITE,{ + openstorage; + end; + +OnInit: + .distance=3; + end; +} + + +012-8,29,24,0 script Cauldron#RES_0128 NPC_NO_SPRITE,{ + npctalk l("Alchemy system Not Yet Implemented - Blame Jesusalva"); + end; + +OnInit: + .distance=3; + end; +} + + +012-8,34,25,0 script Piano#RES_0128 NPC_NO_SPRITE,{ + mesc l("Do you want to play a song?"); + mesc l("This is not saved."); + select + l("Nothing"), + l("Default"), + l("Indoors 1 (Peace)"), + l("Indoors 2 (Dimonds)"), + l("TMW Adventure"), + l("Sailing Away!"), + l("Magick Real"), + l("The Forest"), + l("Dragons and Toast"), + l("Unforgiving Lands"), + l("Arabesque (Action)"), + l("No Chains (Tulimshar)"), + l("School of Quirks (Candor)"), + l("Cake Town (Hurnscald)"), + l("Steam (LoF Village)"), + l("Woodland Fantasy"), + l("Birds in the Sunrise"); + + mes ""; + .@m$=""; + switch (@menu) { + case 1: + close; + case 2: + .@m$="8bit_the_hero.ogg"; break; + case 3: + .@m$="peace.ogg"; break; + case 4: + .@m$="peace2.ogg"; break; + case 5: + .@m$="tmw_adventure.ogg"; break; + case 6: + .@m$="sail_away.ogg"; break; + case 7: + .@m$="magick_real.ogg"; break; + case 8: + .@m$="dariunas_forest.ogg"; break; + case 9: + .@m$="dragon_and_toast.ogg"; break; + case 10: + .@m$="Unforgiving_Lands.ogg"; break; + case 11: + .@m$="Arabesque.ogg"; break; + case 12: + .@m$="mvrasseli_nochains.ogg"; break; + case 13: + .@m$="school_of_quirks.ogg"; break; + case 14: + .@m$="caketown.ogg"; break; + case 15: + .@m$="steam.ogg"; break; + case 16: + .@m$="woodland_fantasy.ogg"; break; + case 17: + .@m$="tws_birds_in_the_sunrise.ogg"; break; + + } + changemusic "012-8", .@m$; + close; + +OnInit: + .distance=3; + end; +} + diff --git a/npc/functions/estate.txt b/npc/functions/estate.txt index 5eb508e1b..7a537e579 100644 --- a/npc/functions/estate.txt +++ b/npc/functions/estate.txt @@ -37,11 +37,12 @@ function script realestate_sellprice { } // This will toggle if mobilia was purchased or not, in the right group -// realestate_togglemobilia ( estate_id, layer_id, object_id ) +// And as an added bonus, will tell the correct Script to reload NPCs +// realestate_togglemobilia ( estate_id, layer_id, object_id{, npc_file} ) function script realestate_togglemobilia { switch (getarg(1)) { case 1: - $ESTATE_MOBILIA_128[getarg(0)] = $ESTATE_MOBILIA_128[getarg(0)] ^ getarg(2); + $ESTATE_MOBILIA_64[getarg(0)] = $ESTATE_MOBILIA_64[getarg(0)] ^ getarg(2); break; case 2: $ESTATE_MOBILIA_4[getarg(0)] = $ESTATE_MOBILIA_4[getarg(0)] ^ getarg(2); @@ -53,7 +54,7 @@ function script realestate_togglemobilia { $ESTATE_MOBILIA_32[getarg(0)] = $ESTATE_MOBILIA_32[getarg(0)] ^ getarg(2); break; case 5: - $ESTATE_MOBILIA_64[getarg(0)] = $ESTATE_MOBILIA_64[getarg(0)] ^ getarg(2); + $ESTATE_MOBILIA_128[getarg(0)] = $ESTATE_MOBILIA_128[getarg(0)] ^ getarg(2); break; case 6: $ESTATE_MOBILIA_2[getarg(0)] = $ESTATE_MOBILIA_2[getarg(0)] ^ getarg(2); @@ -62,6 +63,10 @@ function script realestate_togglemobilia { debugmes("[ERROR] [CRITICAL] [REAL ESTATE]: Object %d have Invalid Collision Type: %d (must range 1~6)", getarg(2), getarg(1)); break; } + if (getarg(3, "error") != "error") { + // Reload NPCs on the meanwhile + donpcevent getarg(3)+"::OnReload"; + } return; } @@ -71,7 +76,7 @@ function script realestate_togglemobilia { function script realestate_hasmobilia { switch (getarg(1)) { case 1: - return $ESTATE_MOBILIA_128[getarg(0)] & getarg(2); + return $ESTATE_MOBILIA_64[getarg(0)] & getarg(2); case 2: return $ESTATE_MOBILIA_4[getarg(0)] & getarg(2); case 3: @@ -79,7 +84,7 @@ function script realestate_hasmobilia { case 4: return $ESTATE_MOBILIA_32[getarg(0)] & getarg(2); case 5: - return $ESTATE_MOBILIA_64[getarg(0)] & getarg(2); + return $ESTATE_MOBILIA_128[getarg(0)] & getarg(2); case 6: return $ESTATE_MOBILIA_2[getarg(0)] & getarg(2); default: |