summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-04-27 23:21:29 +0000
committerJesusaves <cpntb1@ymail.com>2019-04-27 23:21:29 +0000
commitfa061c5c0d2c77d9d9276f61a71f20b6c0ad4843 (patch)
treeceabeb5bc7f5adacf34bb7005c059290c28f6976
parente1d7abdd935460ebeecc802b16b30522904bb4c1 (diff)
parent6181f9df7dd8cb9fda62b2c41dba38574d129844 (diff)
downloadserverdata-fa061c5c0d2c77d9d9276f61a71f20b6c0ad4843.tar.gz
serverdata-fa061c5c0d2c77d9d9276f61a71f20b6c0ad4843.tar.bz2
serverdata-fa061c5c0d2c77d9d9276f61a71f20b6c0ad4843.tar.xz
serverdata-fa061c5c0d2c77d9d9276f61a71f20b6c0ad4843.zip
Merge branch 'jesusalva/spotlight' into 'master'
Alpha version of spotlight system Closes evol-all#37 See merge request evol/serverdata!187
-rw-r--r--db/re/item_db.conf33
-rw-r--r--npc/001-2-19/lloyd.txt2
-rw-r--r--npc/001-3-0/mundane.txt1
-rw-r--r--npc/commands/warp.txt1
-rw-r--r--npc/functions/masks.txt1
-rw-r--r--npc/functions/spotlight.txt102
-rw-r--r--npc/scripts.conf1
7 files changed, 132 insertions, 9 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 96293603..40f51c00 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -3823,7 +3823,6 @@ item_db: (
Atk: 0
Matk: -25
Def: 180
- Range: 0
Slots: 0
Loc: "EQP_HEAD_TOP"
WeaponLv: 0
@@ -3831,8 +3830,12 @@ item_db: (
Refine: false
ViewSprite: 2907
BindOnEquip: false
- Delay: 0
- Sprite: 0
+ OnEquipScript: <"
+ doevent "#SpotlightMaster::OnTouch";
+ ">
+ OnUnequipScript: <"
+ doevent "#SpotlightMaster::OnTouch";
+ ">
},
{
Id: 2908
@@ -4192,8 +4195,12 @@ item_db: (
Refine: false
Subtype: "W_STAFF"
BindOnEquip: false
- Delay: 0
- Sprite: 0
+ OnEquipScript: <"
+ doevent "#SpotlightMaster::OnTouch";
+ ">
+ OnUnequipScript: <"
+ doevent "#SpotlightMaster::OnTouch";
+ ">
Script: <"
skill AL_HEAL, 1;
bonus bMagicAtkDef, 10;
@@ -4218,8 +4225,12 @@ item_db: (
Refine: false
Subtype: "W_STAFF"
BindOnEquip: false
- Delay: 0
- Sprite: 0
+ OnEquipScript: <"
+ doevent "#SpotlightMaster::OnTouch";
+ ">
+ OnUnequipScript: <"
+ doevent "#SpotlightMaster::OnTouch";
+ ">
Script: <"
skill MG_FIREBALL, 1;
bonus bMatkRate, 10;
@@ -4334,8 +4345,12 @@ item_db: (
Refine: false
Subtype: "W_DAGGER"
BindOnEquip: false
- Delay: 0
- Sprite: 0
+ OnEquipScript: <"
+ doevent "#SpotlightMaster::OnTouch";
+ ">
+ OnUnequipScript: <"
+ doevent "#SpotlightMaster::OnTouch";
+ ">
},
{
Id: 3512
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",