summaryrefslogtreecommitdiff
path: root/npc/test
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-04-09 11:00:49 -0300
committerJesusaves <cpntb1@ymail.com>2021-04-09 11:00:49 -0300
commit8a4bf716002a017de77fe7df301ef8e4aaf00a2e (patch)
tree4947d0b015baad639fa07133369e9a09c8a468bc /npc/test
downloadserverdata-8a4bf716002a017de77fe7df301ef8e4aaf00a2e.tar.gz
serverdata-8a4bf716002a017de77fe7df301ef8e4aaf00a2e.tar.bz2
serverdata-8a4bf716002a017de77fe7df301ef8e4aaf00a2e.tar.xz
serverdata-8a4bf716002a017de77fe7df301ef8e4aaf00a2e.zip
Initial commit
Diffstat (limited to 'npc/test')
-rw-r--r--npc/test/_import.txt12
-rw-r--r--npc/test/_mobs.txt15
-rw-r--r--npc/test/mapflags.txt2
-rw-r--r--npc/test/npc1.txt712
-rw-r--r--npc/test/npc2.txt35
-rw-r--r--npc/test/npc3.txt7
-rw-r--r--npc/test/npc4.txt30
-rw-r--r--npc/test/npc5.txt34
-rw-r--r--npc/test/npc6.txt23
-rw-r--r--npc/test/test1.txt165
-rw-r--r--npc/test/test2.txt13
11 files changed, 1048 insertions, 0 deletions
diff --git a/npc/test/_import.txt b/npc/test/_import.txt
new file mode 100644
index 00000000..69324674
--- /dev/null
+++ b/npc/test/_import.txt
@@ -0,0 +1,12 @@
+// Map test: test
+// This file is generated automatically. All manually added changes will be removed when running the Converter.
+"npc/test/_mobs.txt",
+"npc/test/mapflags.txt",
+"npc/test/npc1.txt",
+"npc/test/npc2.txt",
+"npc/test/npc3.txt",
+"npc/test/npc4.txt",
+"npc/test/npc5.txt",
+"npc/test/npc6.txt",
+"npc/test/test1.txt",
+"npc/test/test2.txt",
diff --git a/npc/test/_mobs.txt b/npc/test/_mobs.txt
new file mode 100644
index 00000000..8bab3101
--- /dev/null
+++ b/npc/test/_mobs.txt
@@ -0,0 +1,15 @@
+// This file is generated automatically. All manually added changes will be removed when running the Converter.
+// Map test: test mobs
+test,38,12,1,1 monster Piou 1002,1,1000,1000
+test,38,12,1,1 monster Tortuga 1004,1,1000,1000
+test,44,12,1,1 monster Piou 1002,3,1000,1000
+test,48,10,1,1 monster Tortuga 1004,3,1000,1000
+test,48,10,0,0 monster Piou 1002,1,1000,1000
+test,48,10,0,0 monster Ratto 1005,1,1000,1000
+test,54,10,1,1 monster Piou 1002,3,1000,1000
+test,68,9,0,0 monster Piou 1002,3,1000,1000
+test,68,9,0,0 monster Ratto 1005,1,1000,1000
+test,68,9,1,1 monster Tortuga 1004,3,1000,1000
+test,76,10,1,1 monster Piou 1002,3,1000,1000
+test,76,10,1,1 monster Ratto 1005,1,1000,1000
+test,78,4,1,1 monster Ratto 1005,3,1000,1000
diff --git a/npc/test/mapflags.txt b/npc/test/mapflags.txt
new file mode 100644
index 00000000..6f3199ae
--- /dev/null
+++ b/npc/test/mapflags.txt
@@ -0,0 +1,2 @@
+test mapflag mask 5
+test mapflag town
diff --git a/npc/test/npc1.txt b/npc/test/npc1.txt
new file mode 100644
index 00000000..31a6a689
--- /dev/null
+++ b/npc/test/npc1.txt
@@ -0,0 +1,712 @@
+// Evol scripts.
+// Author:
+// 4144
+// Description:
+// test npc1
+
+test,10,10,0 script npc1#door NPC_HIDDEN,0,1,{
+OnTouch:
+ warp "test", 20, 20;
+ close;
+OnUnTouch:
+ doevent "npc1::OnUnTouch";
+}
+
+test,10,10,0 script npc1 NPC_TEST1,3,3,{
+ function areatest
+ {
+ mesn;
+ mes "getareausers(\"test\", 7, 7, 13, 13): " + getareausers("test", 7, 7, 13, 13);
+ mes "getareausers(7, 7, 13, 13): " + getareausers(7, 7, 13, 13);
+ mes "getareausers(\"test\"): " + getareausers("test");
+ mes "getareausers(): " + getareausers();
+ mes "getareausers(\"test\", 1): " + getareausers("test", 1);
+ mes "getareausers(1): " + getareausers(1);
+ next;
+ return;
+ }
+
+L_Start:
+ switch (select(
+ "show area",
+ "map",
+ "pc",
+ "change npc direction",
+ "quest test",
+ "cart",
+ "items",
+ "chat",
+ "wall",
+ "craft",
+ "hashtable",
+ "instance",
+ "mercenary",
+ "npc",
+ "clan"))
+ {
+ case 1:
+ areatest;
+ break;
+ case 2:
+ while(1)
+ {
+ .@mask = getmapmask("test");
+ mes "current mask: " + str(.@mask);
+ switch (select("show sand:show grass:show fog:hide fog:back"))
+ {
+ case 1:
+ addremovemapmask "test", 4, 8;
+ break;
+ case 2:
+ addremovemapmask "test", 8, 4;
+ break;
+ case 3:
+ addmapmask "test", 2;
+ break;
+ case 4:
+ removemapmask "test", 2;
+ break;
+ case 5:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+
+ case 3:
+ while(1)
+ {
+ switch (select("change sex:setmount 0:setmount 1:setmount 2:test command:back"))
+ {
+ case 1:
+ changecharsex;
+ break;
+ case 2:
+ setmount 0;
+ break;
+ case 3:
+ setmount 1;
+ break;
+ case 4:
+ setmount 2;
+ break;
+ case 5:
+ clientcommand "emote 1";
+ break;
+ case 6:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 4:
+ for (.@f = 0; .@f < 9; .@f ++)
+ {
+ mes "" + .@f;
+ .dir = .@f;
+ next;
+ }
+ break;
+ case 5:
+ mes "current";
+ .@val1 = getq(ShipQuests_Gugli);
+ .@val2 = getq2(ShipQuests_Gugli);
+ .@val3 = getq3(ShipQuests_Gugli);
+ .@valTime = getqtime(ShipQuests_Gugli);
+ mes "val1=" + .@val1;
+ mes "val2=" + .@val2;
+ mes "val3=" + .@val3;
+ mes "valTime=" + .@valTime;
+ .@val1 ++;
+ .@val2 ++;
+ .@val3 ++;
+ .@valTime ++;
+ next;
+ mes "test " + str(.@val1) + ", " + str(.@val2) + ", " + str(.@val3) + ", " + str(.@valTime);
+ setq ShipQuests_Gugli, .@val1, .@val2, .@val3, .@valTime;
+ next;
+ .@val1 = getq(ShipQuests_Gugli);
+ .@val2 = getq2(ShipQuests_Gugli);
+ .@val3 = getq3(ShipQuests_Gugli);
+ .@valTime = getqtime(ShipQuests_Gugli);
+ mes "val1=" + .@val1;
+ mes "val2=" + .@val2;
+ mes "val3=" + .@val3;
+ mes "valTime=" + .@valTime;
+ break;
+ case 6:
+ while(1)
+ {
+ switch (select("add cart:remove cart:back"))
+ {
+ case 1:
+ setcart 1;
+ break;
+ case 2:
+ setcart 0;
+ break;
+ case 3:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 7:
+ while(1)
+ {
+ switch (select("refine", "rent", "bound", "named", "cards", "options", "back"))
+ {
+ case 1:
+ .@item = -1;
+ while(1)
+ {
+ switch (select("set item", "refine +1", "refine -1", "refine fail", "back"))
+ {
+ case 1:
+ .@item = requestitemindex();
+ mes "Item index selected: " + str(.@item);
+ break;
+ case 2:
+ successrefindex .@item, 1;
+ break;
+ case 3:
+ downrefindex .@item, 1;
+ break;
+ case 4:
+ failedrefindex .@item;
+ break;
+ case 5:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 2:
+ while(1)
+ {
+ switch (select("rent vneck for 10 seconds",
+ "rent vneck for 30 seconds",
+ "rent vneck for 1 minute",
+ "rent vneck for 5 minutes",
+ "back"))
+ {
+ case 1:
+ rentitem 1301, 10;
+ break;
+ case 2:
+ rentitem 1301, 30;
+ break;
+ case 3:
+ rentitem 1301, 60;
+ break;
+ case 4:
+ rentitem 1301, 300;
+ break;
+ case 5:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 3:
+ while(1)
+ {
+ switch (select("get bound vneck",
+ "back"))
+ {
+ case 1:
+ getitembound2 1301, 1, 1, 0, 0, 0, 0, 0, 0, 1;
+ break;
+ case 2:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 4:
+ while(1)
+ {
+ switch (select("get named vneck",
+ "back"))
+ {
+ case 1:
+ getnameditem 1301, "4144";
+ break;
+ case 2:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 5:
+ .@item = -1;
+ while(1)
+ {
+ switch (select("set item",
+ "remove cards success",
+ "fail, remove both",
+ "fail, remove card",
+ "fail, remove item",
+ "fail, safe",
+ "print all",
+ "remove 0",
+ "back"))
+ {
+ case 1:
+ .@item = requestitemindex();
+ mes "Item index selected: " + str(.@item);
+ break;
+ case 2:
+ successremovecardsindex .@item;
+ break;
+ case 3:
+ failedremovecardsindex .@item, 0;
+ break;
+ case 4:
+ failedremovecardsindex .@item, 1;
+ break;
+ case 5:
+ failedremovecardsindex .@item, 2;
+ break;
+ case 6:
+ failedremovecardsindex .@item, 3;
+ break;
+ case 7:
+ mes "slots=" + str(MAX_SLOTS);
+ for (.@i = 0; .@i < MAX_SLOTS; .@i++)
+ {
+ mes "slot " + str(.@i) + " = " + str(getcardbyindex(.@item, .@i));
+ }
+ mes "item options:";
+ for (.@i = 0; .@i < 5; .@i ++)
+ {
+ mes sprintf("%d: Option: %d, Value: %d", .@i, getitemoptionidbyindex(.@item, .@i), getitemoptionvaluebyindex(.@item, .@i));
+ }
+ break;
+ case 8:
+ removecardbyindex(.@item, 0);
+ break;
+ case 9:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 6:
+ .@item = -1;
+ while(1)
+ {
+ switch (select("set item", "info", "set option 1", "remove options", "back"))
+ {
+ case 1:
+ .@item = requestitemindex();
+ mes "Item index selected: " + str(.@item);
+ break;
+ case 2:
+ mes "Selected item options";
+ for (.@i = 0; .@i < 5; .@i ++)
+ {
+ mes sprintf("%d: Option: %d, Value: %d", .@i, getitemoptionidbyindex(.@item, .@i), getitemoptionvaluebyindex(.@item, .@i));
+ }
+ break;
+ case 3:
+ setitemoptionbyindex(.@item, 0, VAR_MAXHPAMOUNT, 200);
+ setitemoptionbyindex(.@item, 1, VAR_STRAMOUNT, 10);
+ setitemoptionbyindex(.@item, 2, VAR_VITAMOUNT, -5);
+ break;
+ case 4:
+ mes "Remove item options";
+ for (.@i = 0; .@i < 5; .@i ++)
+ {
+ setitemoptionbyindex(.@item, .@i, 0, 0);
+ }
+ break;
+ case 5:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 7:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 8:
+ chatjoin .chat;
+ close;
+ case 9:
+ while(1)
+ {
+ switch (select("set wall 1:set wall 2:set wall 3:delete wall 1:delete wall 2:delete wall 3:back"))
+ {
+ case 1:
+ setcells "test", 14, 11, 17, 11, 3, "wall1";
+ break;
+ case 2:
+ setcells "test", 14, 7, 21, 8, 1, "wall2";
+ break;
+ case 3:
+ setcells "test", 13, 15, 13, 21, 3, "wall3";
+ break;
+ case 4:
+ delcells "wall1";
+ break;
+ case 5:
+ delcells "wall2";
+ break;
+ case 6:
+ delcells "wall3";
+ break;
+ case 7:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 10:
+ while(1)
+ {
+ switch (select("technical:normal:back"))
+ {
+ case 1:
+ setskin "test2";
+ .@var$ = requestcraft(9);
+ mes .@var$;
+ .@craft = initcraft(.@var$);
+ mes "craft id: " + str(.@craft);
+ mes "is craft valid: " + validatecraft(.@craft);
+ .@id = getcraftslotid(.@craft, 0);
+ .@amount = getcraftslotamount(.@craft, 0);
+ mes "first item id: " + .@id;
+ mes "first item name: " + getitemlink(.@id);
+ mes "first item amount: " + .@amount;
+
+ .@id = getcraftslotid(.@craft, 1);
+ .@amount = getcraftslotamount(.@craft, 1);
+ mes "second item id: " + .@id;
+ mes "second item name: " + getitemlink(.@id);
+ mes "second item amount: " + .@amount;
+// dumpcraft .@craft;
+ .@entry = findcraftentry(.@craft, 0);
+ mes "found craft entry: " + .@entry;
+ if (.@entry < 0)
+ {
+ mes "no craft recipe found";
+ }
+ else
+ {
+ mes "use craft";
+ usecraft .@craft;
+ mes "return code: " + getcraftcode(.@entry);
+ }
+ deletecraft .@craft;
+ setskin "";
+ break;
+ case 2:
+ mes "put items what you want to craft";
+ setskin "test2";
+ .@var$ = requestcraft(9);
+ setskin "";
+ .@craft = initcraft(.@var$);
+ if (.@craft < 0)
+ {
+ mes "Craft error.";
+ goto L_Start;
+ }
+ mes "lets see what you can get...";
+ next;
+ if (!validatecraft(.@craft))
+ {
+ mes "inventory was changed.";
+ goto L_Start;
+ }
+ .@entry = findcraftentry(.@craft, 0);
+ if (.@entry < 0)
+ {
+ mes "no craft recipe found";
+ }
+ else
+ {
+ mes "found recipe";
+ usecraft .@craft;
+ mes "return code: " + getcraftcode(.@entry);
+ }
+ deletecraft .@craft;
+ break;
+ case 3:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 11:
+ switch(select("Create new hashtable",
+ "Use existing ID"))
+ {
+ case 1:
+ .@ht = htnew();
+ mes "ID = " + .@ht;
+ break;
+ case 2:
+ mes "Input ID";
+ input .@ht;
+ break;
+ }
+ .@defval = 0;
+ .@defval_str$ = "";
+ .@newval = 0;
+ .@newval_str$ = "";
+ .@key$ = "";
+
+ while(1)
+ {
+ switch (select("Set default string value",
+ "Set default number value",
+ "Get string",
+ "Get number",
+ "Put string",
+ "Put number",
+ "Show hashtable",
+ "Clear hashtable",
+ "Delete hashtable",
+ "Exit"))
+ {
+ case 1:
+ input .@defval_str$;
+ break;
+ case 2:
+ input .@defval;
+ break;
+ case 3:
+ mes "Input key:";
+ input .@key$;
+ mes "htget(" + .@ht + ", \"" + .@key$ + "\") = " + htget(.@ht, .@key$);
+ mes "htget(" + .@ht + ", \"" + .@key$ + "\", \"" + .@defval_str$ + "\") = " + htget(.@ht, .@key$, .@defval_str$);
+ break;
+ case 4:
+ mes "Input key:";
+ input .@key$;
+ mes "htget(" + .@ht + ", \"" + .@key$ + "\") = " + htget(.@ht, .@key$);
+ mes "htget(" + .@ht + ", \"" + .@key$ + "\", " + .@defval + ") = " + htget(.@ht, .@key$, .@defval);
+ break;
+ case 5:
+ mes "Input key:";
+ input .@key$;
+ mes "Input value:";
+ input .@newval_str$;
+ htput(.@ht, .@key$, .@newval_str$);
+ mes "htput(" + .@ht + ", \"" + .@key$ + "\", \"" + .@newval_str$ + "\")";
+ mes "htget(" + .@ht + ", \"" + .@key$ + "\") = " + htget(.@ht, .@key$);
+ break;
+ case 6:
+ mes "Input key:";
+ input .@key$;
+ mes "Input value:";
+ input .@newval;
+ htput(.@ht, .@key$, .@newval);
+ mes "htput(" + .@ht + ", \"" + .@key$ + "\", " + .@newval + ")";
+ mes "htget(" + .@ht + ", \"" + .@key$ + "\") = " + htget(.@ht, .@key$);
+ break;
+ case 7:
+ mes "size = " + htsize(.@ht);
+ .@hti = htiterator(.@ht);
+ for(.@key$ = htinextkey(.@hti); hticheck(.@hti); .@key$ = htinextkey(.@hti))
+ mes "key = " + .@key$ + " value = " + htget(.@ht, .@key$);
+ htidelete(.@hti);
+ break;
+ case 8:
+ htclear(.@ht);
+ mes "htclear(" + .@ht + ")";
+ break;
+ case 9:
+ htdelete(.@ht);
+ mes "htdelete(" + .@ht + ")";
+ break;
+ case 10:
+ goto L_Start;
+ } // switch
+ } // while
+ break;
+ case 12:
+ while(1)
+ {
+ switch (select("create", "warp", "info", "warp back", "delete", "back"))
+ {
+ case 1:
+ if (.instid >= 0 && isinstance(.instid))
+ {
+ mes "Error: test instance already created";
+ break;
+ }
+// .instid = instance_create("test@instance", 0, 0);
+ .instid = instance_create("test@instance", getcharid(3), IOT_CHAR);
+ if (.instid < 0)
+ {
+ mes "Error: creating instance";
+ break;
+ }
+ mes "new instance id: " + str(.instid);
+// .@instanceMapName$ = instance_attachmap("test", .instid, 1, "test@map1");
+// .@instanceMapName$ = instance_attachmap("test", .instid, 1);
+ .@instanceMapName$ = instance_attachmap("test", .instid, 0, "test@map1");
+ if (.@instanceMapName$ == "")
+ {
+ mes "Error: instance attach map error";
+ break;
+ }
+ mes "Attached instance map name: " + .@instanceMapName$;
+ instance_set_timeout(1000000, 1000000, .instid);
+ instance_init(.instid);
+ break;
+ case 2:
+ warp "test@map1", 12, 12;
+ break;
+ case 3:
+ mes "npc name: " + .name$;
+ mes "npc ext name: " + .extname$;
+ mes "npc id: " + .id;
+ mes "npc parent id: " + .parent;
+ mes "npc src id: " + .srcId;
+ if (instance_id() >= 0)
+ {
+ mes "npc1 in instance named: " + instance_npcname("npc1");
+ }
+ else
+ {
+ mes "npc1 not in instance";
+ }
+ break;
+ case 4:
+ warp "test", 12, 12;
+ break;
+ case 5:
+ if (.instid < 0)
+ {
+ mes "Error: test instance was not created";
+ break;
+ }
+ instance_destroy(.instid);
+ break;
+ case 6:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 13:
+ while(1)
+ {
+ switch (select("create mercenary for 10 seconds", "create mercenary for 1 min", "create mercenary for 10 min", "back"))
+ {
+ case 1:
+ mercenary_create 1191, 10000;
+ break;
+ case 2:
+ mercenary_create 1191, 60000;
+ break;
+ case 3:
+ mercenary_create 1191, 600000;
+ break;
+ case 4:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 14:
+ while(1)
+ {
+ switch (select("set hair 1", "set hair 0", "equip vneck", "unequip vneck", "back"))
+ {
+ case 1:
+ setunitdata(.@npcId, UDT_HAIRSTYLE, 5);
+ setunitdata(.@npcId, UDT_HAIRCOLOR, 17);
+ break;
+ case 2:
+ .@npcId = getnpcid("npc4");
+ setunitdata(.@npcId, UDT_HAIRSTYLE, 0);
+ break;
+ case 3:
+ .@npcId = getnpcid("npc4");
+ setunitdata(.@npcId, UDT_HEADTOP, 1301);
+ break;
+ case 4:
+ .@npcId = getnpcid("npc4");
+ setunitdata(.@npcId, UDT_HEADTOP, 0);
+ break;
+ case 5:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ case 15:
+ while(1)
+ {
+ switch (select(
+ "join sword clan",
+ "join arc wand clan",
+ "join golden mace clan",
+ "join crossbox clan",
+ "leave clan",
+ "back"))
+ {
+ case 1:
+ mes(str(clan_join(1)));
+ break;
+ case 2:
+ mes(str(clan_join(2)));
+ break;
+ case 3:
+ mes(str(clan_join(3)));
+ break;
+ case 4:
+ mes(str(clan_join(4)));
+ break;
+ case 5:
+ mes(str(clan_leave()));
+ break;
+ case 6:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ }
+
+ close;
+
+OnTouch:
+ doorTouch;
+
+OnUnTouch:
+ doorUnTouch;
+
+OnTimer340:
+ doorTimer;
+
+OnInit:
+ .distance = 5;
+ .alwaysVisible = true;
+ waitingroom "test room", 2, "npc1::OnReadyCheck", 1;
+ // test instance id
+ .instid = -10;
+ if (.parent != 0)
+ {
+ setnpcdir 0;
+ }
+ end;
+
+OnWhisperGlobal:
+ mes "cmd: " + @whispervar0$;
+ close;
+
+OnReadyCheck:
+ consolemes(CONSOLEMES_DEBUG, "OnReadyCheck");
+ $@bgid1 = waitingroom2bg("testbg", 10, 10, "bgnpc1::OnLogout","bgnpc1:OnDie");
+ consolemes(CONSOLEMES_DEBUG, "bgid=" + str($@bgid1));
+ setbgteam $@bgid1, 1;
+ bg_warp $@bgid1, "testbg", 10, 10;
+}
diff --git a/npc/test/npc2.txt b/npc/test/npc2.txt
new file mode 100644
index 00000000..8a2146f1
--- /dev/null
+++ b/npc/test/npc2.txt
@@ -0,0 +1,35 @@
+// Evol scripts.
+// Author:
+// 4144
+// Description:
+// test npc2
+
+test,20,10,0 trader npc2 NPC_HAT_BOX,{
+OnInit:
+ tradertype(NST_MARKET);
+ sellitem 505, -1, 10;
+ sellitem 502, -1, 10;
+ sellitem 513, -1, 10;
+ sellitem 509, -1, 10;
+ sellitem 2000, -1, 10;
+ sellitem 1800, -1, 10;
+ sellitem 3501, -1, 10;
+ end;
+
+OnClock0000:
+ if (shopcount(505) < 10)
+ sellitem 505, -1, 10;
+ if (shopcount(502) < 10)
+ sellitem 502, -1, 10;
+ if (shopcount(513) < 10)
+ sellitem 513, -1, 10;
+ if (shopcount(509) < 10)
+ sellitem 509, -1, 10;
+ if (shopcount(2000) < 10)
+ sellitem 2000, -1, 10;
+ if (shopcount(1800) < 10)
+ sellitem 1800, -1, 10;
+ if (shopcount(3501) < 10)
+ sellitem 3501, -1, 10;
+ end;
+}
diff --git a/npc/test/npc3.txt b/npc/test/npc3.txt
new file mode 100644
index 00000000..82d5fe3f
--- /dev/null
+++ b/npc/test/npc3.txt
@@ -0,0 +1,7 @@
+// Evol scripts.
+// Author:
+// 4144
+// Description:
+// test npc3
+
+test,25,10,0 cashshop npc3 NPC_SHOP_BAG,505:100,502:-1,513:-1,509:-1,2000:-1,1800:-1,3501:-1
diff --git a/npc/test/npc4.txt b/npc/test/npc4.txt
new file mode 100644
index 00000000..b85d1bf8
--- /dev/null
+++ b/npc/test/npc4.txt
@@ -0,0 +1,30 @@
+// Evol scripts.
+// Author:
+// 4144
+// Description:
+// test npc4
+
+test,25,20,0 script npc4 NPC_PLAYER,{
+ close;
+OnTimer1000:
+ domovestep;
+OnInit:
+ .walkmask = WALK_WATER;
+ initpath "move", 20, 20,
+ "sit", 0, 0,
+ "dir", 6, 0,
+ "move", 25, 20,
+ "emote", 3, 0,
+// "class", 104, 0,
+ "speed", 100, 0,
+ "wait", 2, 0,
+ "move", 22, 10,
+ "rmove", 3, 3,
+// "class", 801, 0,
+ "speed", 200, 0,
+ "wait", 1, 0,
+ "warp", 22, 30,
+ "goto", 0, 0;
+ initialmove;
+ initnpctimer;
+}
diff --git a/npc/test/npc5.txt b/npc/test/npc5.txt
new file mode 100644
index 00000000..faa655e8
--- /dev/null
+++ b/npc/test/npc5.txt
@@ -0,0 +1,34 @@
+// Evol scripts.
+// Author:
+// Travolta
+// Description:
+// test npc5
+
+function script npc5TestFunc {
+ npctalk getarg(0);
+ return 0;
+}
+
+test,45,25,0 script npc5 NPC_PLAYER,{
+ close;
+
+OnTimer1000:
+ dographmovestep;
+
+OnInit:
+ // .debug = 1;
+ initmovegraph "topleft", 45, 25,
+ "topright", 55, 25,
+ "bottomright", 55, 34,
+ "bottomleft", 45, 34;
+
+ setmovegraphcmd "topleft", "topright", 30, "dir 0; wait 1",
+ "topleft", "bottomright", 20, "class 104",
+ "topleft", "bottomleft", 50, "emote 8; wait 1; warp bottomright",
+ "topright", "bottomleft", 1, "emote 3; wait 5",
+ "bottomleft", "topleft", 25, "dir 2; wait 1; call npc5TestFunc Hello=)",
+ "bottomleft", "bottomright", 10, "speed 40",
+ "bottomright", "bottomleft", 1, "class 801; speed 100; dir 0; emote 1; wait 4";
+ firstmove "wait 1; speed 100; dir 4; emote 7";
+ initnpctimer;
+}
diff --git a/npc/test/npc6.txt b/npc/test/npc6.txt
new file mode 100644
index 00000000..7c4893ad
--- /dev/null
+++ b/npc/test/npc6.txt
@@ -0,0 +1,23 @@
+// Evol scripts.
+// Authors:
+// 4144
+// Description:
+// test npc1
+
+test,30,10,0 trader npc6 NPC_SHOP_BAG_TEST,{
+ end;
+
+OnCountFunds:
+ setcurrency 10000;
+ end;
+
+OnPayFunds:
+ dispbottom "Hi: price="+@price+" and points="+@points;
+ // check and remove points
+ purchaseok;
+ end;
+OnInit:
+ tradertype NST_CUSTOM;
+ sellitem Acorn, 500;
+ sellitem Bread, 200;
+}
diff --git a/npc/test/test1.txt b/npc/test/test1.txt
new file mode 100644
index 00000000..9fefe307
--- /dev/null
+++ b/npc/test/test1.txt
@@ -0,0 +1,165 @@
+// Evol scripts.
+// Author:
+// 4144
+// Description:
+// script tests
+
+function script test1function {
+ .var = .walkmask;
+ if (.var != 3)
+ mes "Error: testing test1 npc variables from function.";
+ .var = getvariableofnpc(.walkmask, "test1");
+ if (.var != 3)
+ mes "Error: testing test1 npc variables from function.";
+ .var = getvariableofnpc(.walkmask, "test2");
+ if (.var != 4)
+ mes "Error: testing test2 npc variables from function.";
+
+ return;
+}
+
+test,10,5,0 script test1 NPC_HAT_BOX,{
+
+ function assert {
+ if (getarg(0)) {
+ .stats[1]++;
+ // comment out the next line for less verbosity
+ mesf("Success: %s.", getarg(1));
+ } else {
+ mesf("##BError##b: %s.", getarg(1));
+ }
+ return .stats[0]++;
+ }
+
+ function test_npc_vars {
+ mes("##2Testing NPC variables...##0");
+ .var = .walkmask;
+ assert(.var == 3, "test1 npc variales");
+ .var = getvariableofnpc(.walkmask, "test1");
+ assert(.var == 3, "test1 npc variables from function");
+ .var = getvariableofnpc(.walkmask, "test2");
+ assert(.var == 4, "test2 npc variables");
+ test1function();
+ next();
+ }
+
+ function test_quest_vars {
+ mes("##2Testing quest variables...##0");
+ .@time = 1000;
+ setq(Test_testing1, 1, 2, 3, .@time);
+ assert(getq(Test_testing1) == 1, "getq1 = 1");
+ assert(getq2(Test_testing1) == 2, "getq2 = 2");
+ assert(getq3(Test_testing1) == 3, "getq3 = 3");
+ assert(getqtime(Test_testing1) == .@time, "getqtime = 1000");
+ next();
+ .@time = 2000;
+ setq(Test_testing1, 2, 3, 4, .@time);
+ assert(getq(Test_testing1) == 2, "getq1 = 2");
+ assert(getq2(Test_testing1) == 3, "getq2 = 3");
+ assert(getq3(Test_testing1) == 4, "getq3 = 4");
+ assert(getqtime(Test_testing1) == .@time, "getqtime = 2000");
+ next();
+ setq(Test_testing1, 0);
+ }
+
+ function test_translation_old {
+ mes("##2Testing old translation system without gender...##0");
+ assert(l("test @@", "") == "test ", "\"test @@\", \"\"");
+ assert(l("test @@", "foo") == "test foo", "\"test @@\", \"foo\"");
+ assert(l("@@", "") == "", "\"@@\", \"\"");
+ assert(l("@@") == "@@", "\"@@\"");
+ assert(l("@@ @@ @@", "this", "is", "test") == "this is test", "\"@@ @@ @@\", \"this\", \"is\", \"test\"");
+ assert(l("data @@ @@ @@ data", "this", "is", "test") == "data this is test data", "\"data @@ @@ @@ data\", \"this\", \"is\", \"test\"");
+ next();
+
+ /*
+ mesf("##2Testing old translation system as %s gender...##0", g("female", "male"));
+ if (Sex == 1)
+ assert(lg("test1 @@", "test2 @@", "line") == "test2 line#1", "\"test1 @@\", \"test2 @@\", \"line\"");
+ else if (Sex == 0)
+ assert(lg("test1 @@", "test2 @@", "line") == "test1 line#0", "\"test1 @@\", \"test2 @@\", \"line\"");
+ */
+ next();
+ }
+
+ function test_translation_new {
+ mes("##2Testing new translation system without gender...##0");
+ assert(l("") == "", "\"\"");
+ assert(l("test") == "test", "\"test\"");
+ assert(l("test %s", "") == "test ", "\"test %s\", \"\"");
+ assert(l("test %s", "foo") == "test foo", "\"test %s\", \"foo\"");
+ assert(l("%s", "") == "", "\"%s\", \"\"");
+ assert(l("%s") == "%s", "\"%s\"");
+ assert(l("%%") == "%%", "\"%##0%\""); // XXX: %% is reserved for emotes in manaplus, so we escape it with color
+ assert(l("%d%%", 6) == "6%", "\"%d%##0%\", 6"); // XXX: %% is reserved for emotes in manaplus, so we escape it with color
+ assert(l("%s %s %s", "this", "is", "test") == "this is test", "\"%s %s %s\", \"this\", \"is\", \"test\"");
+ assert(l("%s %d %s", "foo", 69, "bar") == "foo 69 bar", "\"%s %d %s\", \"foo\", 69, \"bar\"");
+ assert(l("data %s %s %s data", "this", "is", "test") == "data this is test data", "\"data %s %s %s data\", \"this\", \"is\", \"test\"");
+ next();
+
+ /*
+ mesf("##2Testing new translation system as %s gender...##0", g("female", "male"));
+ if (Sex == 1) {
+ assert(lg("test") == "test#1", "\"test\"");
+ assert(lg("test1", "test2") == "test2#1", "\"test1\", \"test2\"");
+ assert(lg("test1 %s", "test2 %s", "line") == "test2 line#1", "\"test1 %s\", \"test2 %s\", \"line\"");
+ } else if (Sex == 0) {
+ assert(lg("test") == "test#0", "\"test\"");
+ assert(lg("test1", "test2") == "test1#0", "\"test1\", \"test2\"");
+ assert(lg("test1 %s", "test2 %s", "line") == "test1 line#0", "\"test1 %s\", \"test2 %s\", \"line\"");
+ }
+ */
+ next();
+
+ mes("##2Testing advanced translation...##0");
+ assert(l("foo %2$s bar %1$s baz", "qux", "quux") == "foo quux bar qux baz", "\"foo %2$s bar %1$s baz\", \"qux\", \"quux\"");
+ assert(l("%5d", 6) == " 6", "\"%5d\", 6");
+ assert(l("%5d", -6) == " -6", "\"%5d\", -6");
+ assert(l("%+5d", 6) == " +6", "\"%+5d\", 6");
+ assert(l("%+5d", -6) == " -6", "\"%+5d\", -6");
+ assert(l("%-5d", 6) == "6 ", "\"%-5d\", 6");
+ assert(l("%-5d", -6) == "-6 ", "\"%-5d\", -6");
+ assert(l("% 5d", 6) == " 6", "\"% 5d\", 6");
+ assert(l("% 5d", -6) == " -6", "\"% 5d\", -6");
+ assert(l("%05d", 6) == "00006", "\"%05d\", 6");
+ assert(l("%05d", -6) == "-0006", "\"%05d\", -6");
+ assert(l("%10s", "test") == " test", "\"%10s\", \"test\"");
+ assert(l("% 10s", "test") == " test", "\"% 10s\", \"test\"");
+ assert(l("%-10s", "test") == "test ", "\"%-10s\", \"test\"");
+ next();
+ }
+
+
+ do {
+ mes("Please select a test:");
+ select(
+ "NPC variables",
+ "quest variables",
+ "translation (old)",
+ "translation (new)",
+ "everything");
+
+ setarray(.stats[0], 0, 0); // make sure we have a clean state
+ clear();
+
+ switch (@menu) {
+ case 1: test_npc_vars(); break;
+ case 2: test_quest_vars(); break;
+ case 3: test_translation_old(); break;
+ case 4: test_translation_new(); break;
+ default:
+ test_translation_old();
+ test_translation_new();
+ test_npc_vars();
+ test_quest_vars();
+ }
+
+ mesf("##BTests complete. [%02d/%02d]", .stats[1], .stats[0]);
+ next();
+ } while (true);
+ close;
+
+OnInit:
+ .walkmask = 3;
+ end;
+}
diff --git a/npc/test/test2.txt b/npc/test/test2.txt
new file mode 100644
index 00000000..fdc6f847
--- /dev/null
+++ b/npc/test/test2.txt
@@ -0,0 +1,13 @@
+// Evol scripts.
+// Author:
+// 4144
+// Description:
+// script tests
+
+test,12,5,0 script test2 NPC_HAT_BOX,{
+ close;
+
+OnInit:
+ .walkmask = 4;
+ end;
+}