summaryrefslogtreecommitdiff
path: root/npc/test/npc1.txt
diff options
context:
space:
mode:
authorSaulc <lucashelaine14@gmail.com>2018-01-13 20:50:42 +0100
committerSaulc <lucashelaine14@gmail.com>2018-01-13 20:50:42 +0100
commit20df2abc1aca00d6aa5dc78347133890f36b32f3 (patch)
tree4ad4a8bb8b0605473a702e314799a4626347721a /npc/test/npc1.txt
downloadserverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.gz
serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.bz2
serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.xz
serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.zip
Initial commit
Diffstat (limited to 'npc/test/npc1.txt')
-rw-r--r--npc/test/npc1.txt670
1 files changed, 670 insertions, 0 deletions
diff --git a/npc/test/npc1.txt b/npc/test/npc1.txt
new file mode 100644
index 000000000..a9d15958b
--- /dev/null
+++ b/npc/test/npc1.txt
@@ -0,0 +1,670 @@
+// 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"))
+ {
+ 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)
+ {
+ 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(0, "npc4");
+ setunitdata(.@npcId, UDT_HAIRSTYLE, 0);
+ break;
+ case 3:
+ .@npcId = getnpcid(0, "npc4");
+ setunitdata(.@npcId, UDT_HEADTOP, 1301);
+ break;
+ case 4:
+ .@npcId = getnpcid(0, "npc4");
+ setunitdata(.@npcId, UDT_HEADTOP, 0);
+ break;
+ case 5:
+ goto L_Start;
+ break;
+ }
+ }
+ break;
+ }
+
+ close;
+
+OnTouch:
+ doorTouch;
+
+OnUnTouch:
+ doorUnTouch;
+
+OnTimer340:
+ doorTimer;
+
+OnInit:
+ .sex = G_MALE;
+ .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;
+
+OnSkillInvoke:
+ skillInvoke[@skillId] = skillInvoke[@skillId] + 1;
+ end;
+
+OnReadyCheck:
+ debugmes "OnReadyCheck";
+ $@bgid1 = waitingroom2bg("testbg", 10, 10, "bgnpc1::OnLogout","bgnpc1:OnDie");
+ debugmes "bgid=" + str($@bgid1);
+ setbgteam $@bgid1, 1;
+ bg_warp $@bgid1, "testbg", 10, 10;
+}