From 81777b738fecbc3ca05c11b27f07dae146f6e09c Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 5 Mar 2019 16:15:56 -0300 Subject: Real Estate patch --- npc/012-8/_import.txt | 1 + npc/012-8/doorbell.txt | 63 +++++++++---------- npc/012-8/utils.txt | 161 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+), 31 deletions(-) create mode 100644 npc/012-8/utils.txt (limited to 'npc/012-8') 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; +} + -- cgit v1.2.3-60-g2f50