summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-04-27 12:43:48 -0300
committerJesusaves <cpntb1@ymail.com>2020-04-27 12:43:48 -0300
commitabdee2ccaa24f361eef4bc44f11c5b900ae6ce25 (patch)
tree278060590bf34b54b742eb6ee63f9ae1e4a1dea3
parentb2fc469c9ac9cd9bc3df335ac2acda488ac9d18f (diff)
downloadserverdata-abdee2ccaa24f361eef4bc44f11c5b900ae6ce25.tar.gz
serverdata-abdee2ccaa24f361eef4bc44f11c5b900ae6ce25.tar.bz2
serverdata-abdee2ccaa24f361eef4bc44f11c5b900ae6ce25.tar.xz
serverdata-abdee2ccaa24f361eef4bc44f11c5b900ae6ce25.zip
Sketch, playing with filters, for fake skills implementations
-rw-r--r--npc/commands/kami.txt3
-rw-r--r--npc/functions/filters.txt41
-rw-r--r--npc/items/grenade.txt25
-rw-r--r--npc/magic/guild.txt15
-rw-r--r--npc/scripts.conf2
5 files changed, 78 insertions, 8 deletions
diff --git a/npc/commands/kami.txt b/npc/commands/kami.txt
index 7ac50c7bc..92505a2be 100644
--- a/npc/commands/kami.txt
+++ b/npc/commands/kami.txt
@@ -73,7 +73,8 @@ OnSkry:
OnJustDoIt:
//dispbottom l("STR: %d AGI %d VIT %d", readparam2(bStr), readparam2(bAgi), readparam2(bVit));
- unitskilluseid(getcharid(3), 10010, 1, getcharid(3));
+ //unitskilluseid(getcharid(3), 10010, 1, getcharid(3));
+ areasc(9, 10000, SC_INCAGI, BL_PC, 10, "filter_sameguild");
end;
OnInit:
diff --git a/npc/functions/filters.txt b/npc/functions/filters.txt
new file mode 100644
index 000000000..77833d5fb
--- /dev/null
+++ b/npc/functions/filters.txt
@@ -0,0 +1,41 @@
+// TMW2 scripts.
+// Authors:
+// Jesusalva
+// Description:
+// Several filters
+
+// filter_always( id )
+function script filter_always {
+ return true;
+}
+
+// filter_onlyme( id )
+function script filter_onlyme {
+ return (getarg(0) == getcharid(3));
+}
+
+// filter_notme( id )
+function script filter_notme {
+ return (getarg(0) != getcharid(3));
+}
+
+// filter_sameguild( id )
+function script filter_sameguild {
+ if (getcharid(2) < 1)
+ return false;
+ return (strcharinfo(2, "~!<mk>@tmw2.org", getarg(0)) == strcharinfo(2));
+}
+
+// filter_sameparty( id )
+function script filter_sameparty {
+ if (getcharid(1) < 1 && getarg(0) != getcharid(3))
+ return false;
+ return (strcharinfo(1, "~!<mk>@tmw2.org", getarg(0)) == strcharinfo(1));
+}
+
+// filter_notboss( id )
+function script filter_notboss {
+ // 32 = MD_BOSS
+ return (!(getunitdata(getarg(0), UDT_MODE) & 32));
+}
+
diff --git a/npc/items/grenade.txt b/npc/items/grenade.txt
index 226712691..f2e749ba9 100644
--- a/npc/items/grenade.txt
+++ b/npc/items/grenade.txt
@@ -9,6 +9,7 @@
function script grenade {
.@r=getarg(0, 3);
.@d=getarg(1, 500);
+ .@f$=getarg(2, "filter_notboss");
getmapxy(.@m$, .@x, .@y, 0);
.@c=getunits(BL_MOB, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
@@ -17,7 +18,7 @@ function script grenade {
.@dm=max(1, .@hp*(10000-.@d)/10000);
if (getarg(2, false))
.@dm=max(1, .@hp-.@d);
- if (!(getunitdata(.@mbs[.@i], UDT_MODE) & 32)) { // 32 = MD_BOSS
+ if (callfunc(.@f$)) {
//debugmes "Hitting monster (%d hp) for %d damage", .@hp, .@dm;
setunitdata(.@mbs[.@i], UDT_HP, .@dm);
specialeffect(FX_ATTACK, AREA, .@mbs[.@i]);
@@ -26,27 +27,30 @@ function script grenade {
return;
}
-// areasc(range, time, sc, bl) - defaults to 3x3 square, sleep mob for 500ms.
+// areasc(range, time, sc, bl, value, filter)
+// Defaults to 3x3 square, sleep mob for 500ms. Ignores you.
// Need a player caster. Valid BL: BL_MOB | BL_PC | BL_HOM | BL_MER
function script areasc {
.@r=getarg(0, 3);
.@d=getarg(1, 500);
.@s=getarg(2, SC_SLEEP);
.@b=getarg(3, BL_MOB);
+ .@val=getarg(4, 1);
+ .@f$=getarg(5, "filter_notme");
getmapxy(.@m$, .@x, .@y, 0);
.@c=getunits(.@b, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
for (.@i = 0; .@i < .@c; .@i++) {
- // Never target the caster
- if (.@mbs[.@i] == getcharid(3))
+ // Filtering
+ if (!callfunc(.@f$, .@mbs[.@i]))
continue;
- sc_start .@s, .@d, 1, 10000, SCFLAG_NONE, .@mbs[.@i];
+ sc_start .@s, .@d, .@val, 10000, SCFLAG_NONE, .@mbs[.@i];
specialeffect(FX_BUFF, AREA, .@mbs[.@i]);
}
return;
}
-// areasc2(map, x, y, {range, time, sc, bl}) - can be used by NPC
+// areasc2(map, x, y, {range, time, sc, bl, value, filter}) - can be used by NPC
// Valid BL: BL_MOB | BL_PC | BL_HOM | BL_MER
function script areasc2 {
.@m$=getarg(0);
@@ -56,10 +60,15 @@ function script areasc2 {
.@d=getarg(4, 500);
.@s=getarg(5, SC_SLEEP);
.@b=getarg(6, BL_MOB);
+ .@val=getarg(7, 1);
+ .@f$=getarg(8, "filter_always");
.@c=getunits(.@b, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
for (.@i = 0; .@i < .@c; .@i++) {
- sc_start .@s, .@d, 1, 10000, SCFLAG_NONE, .@mbs[.@i];
+ // Filtering
+ if (!callfunc(.@f$, .@mbs[.@i]))
+ continue;
+ sc_start .@s, .@d, .@val, 10000, SCFLAG_NONE, .@mbs[.@i];
specialeffect(FX_BUFF, AREA, .@mbs[.@i]);
}
return;
@@ -82,3 +91,5 @@ function script massprovoke {
return;
}
+// TODO: Maybe we could use areasc() with a special check
+// To force the implementation of guild skills... (Yet another script based)
diff --git a/npc/magic/guild.txt b/npc/magic/guild.txt
new file mode 100644
index 000000000..4f6a0e338
--- /dev/null
+++ b/npc/magic/guild.txt
@@ -0,0 +1,15 @@
+// TMW2 script
+// Author: Jesusalva <admin@tmw2.org>
+//
+// Magic Script: TMW2_GD
+//
+// Guild Magic
+
+// GD_agiboost ( lv )
+function script GD_allboost {
+ .@lv=getarg(0, @skillLv);
+ // range, time, SC, BL, power, filter
+ areasc(3+.@lv, 10000*.@lv, SC_INCAGI, BL_PC, .@lv, "filter_sameguild");
+ return;
+}
+
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 5682be9d8..89afddc45 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -69,6 +69,8 @@
"npc/functions/soul_menhir.txt",
"npc/functions/treasure.txt",
+"npc/functions/filters.txt",
+
// Item functions
"npc/items/alcohol.txt",
"npc/items/arcmage.txt",