diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-04-27 23:21:29 +0000 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-04-27 23:21:29 +0000 |
commit | 6181f9df7dd8cb9fda62b2c41dba38574d129844 (patch) | |
tree | ceabeb5bc7f5adacf34bb7005c059290c28f6976 /npc | |
parent | e1d7abdd935460ebeecc802b16b30522904bb4c1 (diff) | |
download | serverdata-6181f9df7dd8cb9fda62b2c41dba38574d129844.tar.gz serverdata-6181f9df7dd8cb9fda62b2c41dba38574d129844.tar.bz2 serverdata-6181f9df7dd8cb9fda62b2c41dba38574d129844.tar.xz serverdata-6181f9df7dd8cb9fda62b2c41dba38574d129844.zip |
Alpha version of spotlight system - requires a fixed clientdata!119 or won't work
NOT gm command compatible. May be optimizable, new MR for comparasion and performance check pending.
Diffstat (limited to 'npc')
-rw-r--r-- | npc/001-2-19/lloyd.txt | 2 | ||||
-rw-r--r-- | npc/001-3-0/mundane.txt | 1 | ||||
-rw-r--r-- | npc/commands/warp.txt | 1 | ||||
-rw-r--r-- | npc/functions/masks.txt | 1 | ||||
-rw-r--r-- | npc/functions/spotlight.txt | 102 | ||||
-rw-r--r-- | npc/scripts.conf | 1 |
6 files changed, 108 insertions, 0 deletions
diff --git a/npc/001-2-19/lloyd.txt b/npc/001-2-19/lloyd.txt index 9dfd97de..6cfd8bc3 100644 --- a/npc/001-2-19/lloyd.txt +++ b/npc/001-2-19/lloyd.txt @@ -240,5 +240,7 @@ OnPCLoginEvent: BankVault += max(0, #MerchantBank); #MerchantBank = 0; } + if (getmap() ~= "*-3-*") + updateSpotlight(); end; } diff --git a/npc/001-3-0/mundane.txt b/npc/001-3-0/mundane.txt index 136061a9..17e70b0f 100644 --- a/npc/001-3-0/mundane.txt +++ b/npc/001-3-0/mundane.txt @@ -96,6 +96,7 @@ setq ArtisQuests_MonaDad, 2; warp(.@MAP_NAME$, 96,66); addtimer(150, instance_npcname(.name$, @MUNDANE_INSTID)+"::OnMove"); + updateSpotlight(true); // Important temporary variables @MUNDANE_OLDX=96; diff --git a/npc/commands/warp.txt b/npc/commands/warp.txt index 318489d7..e4e5c92c 100644 --- a/npc/commands/warp.txt +++ b/npc/commands/warp.txt @@ -70,6 +70,7 @@ OnCall: } slide_or_warp(.@map$, .@x, .@y); + updateSpotlight(); end; OnInit: diff --git a/npc/functions/masks.txt b/npc/functions/masks.txt index 03c81630..4b28bfc7 100644 --- a/npc/functions/masks.txt +++ b/npc/functions/masks.txt @@ -1,6 +1,7 @@ // Evol functions. // Author: // Reid +// Jesusalva // Description: // Triggers functions to add and remove masks. // Variables: diff --git a/npc/functions/spotlight.txt b/npc/functions/spotlight.txt new file mode 100644 index 00000000..c4fb9c6b --- /dev/null +++ b/npc/functions/spotlight.txt @@ -0,0 +1,102 @@ +// Evol functions. +// Author: +// Jesusalva +// Micksha +// Description: +// Update spotlight on caves +// Variables: +// 2 - the darkest mask +// 4 - the average mask +// 8 - the lightest mask + +// forced_update - if set to true, will ignore if the map is known as valid +// (required for instance maps) +// updateSpotlight ( {forced_update} ) +function script updateSpotlight { + // A small delay of 80 ms in case player is changing map + // It will be cast twice when switching caves. This sleep prevents obscure bugs. + sleep2(80); + + // Maps which this system + setarray .@mapz$, + "001-3-0", "001-3-1", "001-3-2", + "008-3-0", "008-3-1", "008-4-1"; + + getmapxy(.@m$, .@x, .@y, 0); + //debugmes "Begin"; + + // Is your map valid (or is the check skipped) + /* + if (!getarg(0,false)) + { + if (array_find(.@mapz$, .@m$) < 0) + return; + } + */ + + // Retrieve default map masks + .@ms=getmapmask(.@m$); + //debugmes "Default: %d", .@ms; + + // Which equipments provide bonuses? + setarray .@b_head, CandleHelmet; + setarray .@b_weapon, ManaTorch, TrainingWand, Torch; + + // Calc your lighting score (it should NOT start on zero) + .@score=1; + if (array_find(.@b_head, getequipid(EQI_HEAD_TOP)) >= 0) + .@score+=1; + if (array_find(.@b_weapon, getequipid(EQI_HAND_R)) >= 0) + .@score+=1; + // TODO: Lighting scrolls + + //debugmes "Score: %d", .@score; + //debugmes "Equips: %d and %d", getequipid(EQI_HEAD_TOP), getequipid(EQI_HAND_R); + //debugmes "Headvalue: %d", .@b_head[0]; + //debugmes "Weappnvalue: %d, %d, %d", .@b_weapon[0], .@b_weapon[1], .@b_weapon[2]; + // Sanitize score + .@score=min(3, .@score); + + // Calculate and send new map mask + .@ms=.@ms|(2**.@score); + sendmapmask(.@ms); + //debugmes "Data sent: %d", .@ms; + return; +} + +// MAIN FUNCTION - DO NOT REMOVE +// Every NPC will be duplicating this one +001-3-0,0,0,0 script #SpotlightMaster NPC_HIDDEN,0,0,{ +OnTouch: + updateSpotlight(); + end; +} + + +// I'm too lazy to do this in different files and in the right spot..... + +// npc/001-3-0/_warps.txt +001-3-0,196,35,0 duplicate(#SpotlightMaster) #SPOT001-3-0_196_35 NPC_HIDDEN,2,2 +001-3-0,172,41,0 duplicate(#SpotlightMaster) #SPOT001-3-0_172_41 NPC_HIDDEN,2,2 +001-3-0,162,40,0 duplicate(#SpotlightMaster) #SPOT001-3-0_162_40 NPC_HIDDEN,2,2 +001-3-0,198,60,0 duplicate(#SpotlightMaster) #SPOT001-3-0_198_60 NPC_HIDDEN,2,2 +001-3-0,152,55,0 duplicate(#SpotlightMaster) #SPOT001-3-0_152_55 NPC_HIDDEN,2,2 +001-3-0,85,130,0 duplicate(#SpotlightMaster) #SPOT001-3-0_85_130 NPC_HIDDEN,2,2 + +// npc/001-3-1/_warps.txt +001-3-1,24,58,0 duplicate(#SpotlightMaster) #SPOT001-3-1_24_58 NPC_HIDDEN,2,2 +001-3-1,35,59,0 duplicate(#SpotlightMaster) #SPOT001-3-1_35_59 NPC_HIDDEN,2,2 +001-3-1,30,19,0 duplicate(#SpotlightMaster) #SPOT001-3-1_30_19 NPC_HIDDEN,2,2 + +// npc/001-3-2/_warps.txt +001-3-2,30,117,0 duplicate(#SpotlightMaster) #SPOT001-3-2_30_117 NPC_HIDDEN,2,2 + +// npc/008-3-0/_warps.txt +008-3-0,130,113,0 duplicate(#SpotlightMaster) #SPOT008-3-0_130_113 NPC_HIDDEN,2,2 + +// npc/008-3-1/_warps.txt +008-3-1,34,34,0 duplicate(#SpotlightMaster) #SPOT008-3-1_34_34 NPC_HIDDEN,2,2 + +// npc/008-4-1/_warps.txt +008-4-1,175,18,0 duplicate(#SpotlightMaster) #SPOT008-4-1_175_18 NPC_HIDDEN,2,2 + diff --git a/npc/scripts.conf b/npc/scripts.conf index ca2bf288..1b7e85e6 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -28,6 +28,7 @@ "npc/functions/marriage.txt", "npc/functions/npcmove.txt", "npc/functions/masks.txt", +"npc/functions/spotlight.txt", "npc/functions/openbook.txt", "npc/functions/questgen.txt", "npc/functions/sailordialogue.txt", |