diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-29 22:09:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-29 22:09:19 +0300 |
commit | 39fa4991f1ce803da04fae342d5ab64111a3df5e (patch) | |
tree | 585dbfb0d6800a8a3bc4d3bec3eb8d41e23894e1 /server/sample | |
parent | 61d35617036a2170160e91fdc8f93410ae7d0e3e (diff) | |
download | docs-39fa4991f1ce803da04fae342d5ab64111a3df5e.tar.gz docs-39fa4991f1ce803da04fae342d5ab64111a3df5e.tar.bz2 docs-39fa4991f1ce803da04fae342d5ab64111a3df5e.tar.xz docs-39fa4991f1ce803da04fae342d5ab64111a3df5e.zip |
Add all existing server docs.
Diffstat (limited to 'server/sample')
27 files changed, 1946 insertions, 0 deletions
diff --git a/server/sample/bank_test.txt b/server/sample/bank_test.txt new file mode 100644 index 0000000..5cdf319 --- /dev/null +++ b/server/sample/bank_test.txt @@ -0,0 +1,80 @@ +//===== Hercules Script ======================================= +//= Sample: Bank Test +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Contains commands needed for a basic bank. +//============================================================ + +prontera,162,188,1 script Bank Test 4_F_KAFRA6,{ + cutin "kafra_06",2; + + mes "[Bank Test]"; + mes "Welcome to Prontera's Bank Test."; + mes "You can only deposit a minimal of"; + mes "1000z. What do you want to do?"; + next; + switch (select("Deposit","Withdraw","Exit")) { + case 1: + mes "[Bank Test]"; + mes "How much do you want to deposit?"; + next; + input .@kafrabank; + + if (.@kafrabank < 1000) { + mes "[Bank Test]"; + mes "The minimum deposit is 1000z"; + next; + break; + } + if (.@kafrabank > Zeny) { + mes "[Bank Test]"; + mes "You don't have enough money."; + next; + break; + } + Zeny -= .@kafrabank; + #kafrabank += .@kafrabank; + mes "[Bank Test]"; + mes "You now have ^135445" + Zeny + "z^000000"; + mes "and your bank account ^135445" + #kafrabank + "z^000000"; + next; + break; + case 2: + if (#kafrabank == 0) { + mes "[Bank Test]"; + mes "Your bank account is currently empty, you can't withdraw."; + next; + break; + } + mes "[Bank Test]"; + mes "Current balance: ^135445" + #kafrabank + "^000000z"; + mes "How much do you want to withdraw?"; + next; + input .@kafrabank; + + if (.@kafrabank < 1) + break; + if (.@kafrabank > #kafrabank) { + mes "[Bank Test]"; + mes "You can't withdraw more than ^135445"+ #kafrabank + "^000000z."; + next; + break; + } + #kafrabank -= .@kafrabank; + Zeny += .@kafrabank; + mes "[Bank Test]"; + mes "You now have ^135445" + Zeny + "z^000000"; + mes "and your bank account ^135445" + #kafrabank + "z^000000"; + next; + break; + case 3: + break; + } + + mes "Good bye!"; + cutin "kafra_06",255; + close; +} diff --git a/server/sample/basejob_baseclass_upper.txt b/server/sample/basejob_baseclass_upper.txt new file mode 100644 index 0000000..80cc23f --- /dev/null +++ b/server/sample/basejob_baseclass_upper.txt @@ -0,0 +1,18 @@ +//===== Hercules Script ======================================= +//= Sample: Class Constants +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Outputs the values of class constants. +//============================================================ + +prontera,155,177,1 script Tell Me 4_F_JOB_ASSASSIN,{ + mes "[Tell Me]"; + mes "Class: " + Class; + mes "BaseClass: " + BaseClass; + mes "BaseJob: " + BaseJob; + mes "Upper: " + Upper; + close; +} diff --git a/server/sample/checkoption.txt b/server/sample/checkoption.txt new file mode 100644 index 0000000..77c0a31 --- /dev/null +++ b/server/sample/checkoption.txt @@ -0,0 +1,19 @@ +//===== Hercules Script ======================================= +//= Sample: Checkoption +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates the 'checkoption' command. +//============================================================ + +prontera,156,89,6 script test_checkoption 4_F_KAFRA1,{ + mes "Please enter a value of type!"; + input .@value; + if(checkoption(.@value) == 1) + mes "True!"; + else if(checkoption(.@value) == 0) + mes "False!"; + close; +} diff --git a/server/sample/delitem2.txt b/server/sample/delitem2.txt new file mode 100644 index 0000000..46e3e42 --- /dev/null +++ b/server/sample/delitem2.txt @@ -0,0 +1,39 @@ +//===== Hercules Script ======================================= +//= Sample: Delitem2 +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates the 'delitem2' command. +//============================================================ + +prontera,160,182,5 script Delitem2 1_M_BARD,{ + mes "Item ID?"; + next; + input .@nameid; + mes "Amount?"; + next; + input .@amount; + mes "Identified? (0:no, 1:yes)"; + next; + input .@iden; + mes "Refined how many times?"; + next; + input .@ref; + mes "Attribute? (0:normal, 1:broken)"; + next; + input .@attr; + mes "4 cards (one after another)..."; + next; + input .@c1; + input .@c2; + input .@c3; + input .@c4; + mes "Your command is:"; + mes "delitem2 "+.@nameid+","+.@amount+","+.@iden+","+.@ref+","+.@attr+","+.@c1+","+.@c2+","+.@c3+","+.@c4; + next; + delitem2 .@nameid,.@amount,.@iden,.@ref,.@attr,.@c1,.@c2,.@c3,.@c4; + mes "And here is the moment when your item should disappear! :P"; + close; +} diff --git a/server/sample/getequipcardid.txt b/server/sample/getequipcardid.txt new file mode 100644 index 0000000..8f7d7f2 --- /dev/null +++ b/server/sample/getequipcardid.txt @@ -0,0 +1,26 @@ +//===== Hercules Script ======================================= +//= Sample: Getequipcardid +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates the 'getequipcardid' command. +//============================================================ + +prontera,155,177,4 script Check My Hat 1_M_SIGNROGUE,{ + mes "Checking your head..."; + if (getequipisequiped(1)) { + .@id = getequipid(1); + .@ref = getequiprefinerycnt(1); + mes "Your hat is... "+getitemname(.@id)+"..."; + if(.@ref) + mes "It has been refined "+.@ref+" times."; + mes "Card Slot 0:"+getequipcardid(1,0)+" 1:"+getequipcardid(1,1); + mes "Card Slot 2:"+getequipcardid(1,2)+" 3:"+getequipcardid(1,3); + close; + } + mes "Nothing?"; + emotion e_hmm; + close; +} diff --git a/server/sample/getequipid.txt b/server/sample/getequipid.txt new file mode 100644 index 0000000..6543d79 --- /dev/null +++ b/server/sample/getequipid.txt @@ -0,0 +1,16 @@ +//===== Hercules Script ======================================= +//= Sample: Getequipid +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates the 'getequipid' command. +//============================================================ + +prontera,161,181,6 script getequipid Sample 8W_SOLDIER,{ + mes "[GetEquipID Sample]"; + for (.@i = 1; .@i < 11; ++.@i) + mes "getequipid(" + .@i + ") : " + getequipid(1); + close; +} diff --git a/server/sample/getiteminfo.txt b/server/sample/getiteminfo.txt new file mode 100644 index 0000000..89f9a66 --- /dev/null +++ b/server/sample/getiteminfo.txt @@ -0,0 +1,23 @@ +//===== Hercules Script ======================================= +//= Sample: Getiteminfo +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates the 'getiteminfo' command. +//============================================================ + +prontera,156,179,6 script test_getiteminfo 4_F_KAFRA1,{ + mes "Please enter an item ID."; + input .@value; + + // This line uses an INTERNAL function of your client to show item name by its ID! + // ^nItemID^XXXX -> Item Name + mes "Item ID: "+.@value+" ^nItemID^"+.@value; + + mes "Current item info:"; + for (.@id = 0; .@id < 14; ++.@id) + mes " getiteminfo("+.@value+","+.@id+") = "+getiteminfo(.@value,.@id); + close; +} diff --git a/server/sample/getmonsterinfo.txt b/server/sample/getmonsterinfo.txt new file mode 100644 index 0000000..064f1fc --- /dev/null +++ b/server/sample/getmonsterinfo.txt @@ -0,0 +1,23 @@ +//===== Hercules Script ======================================= +//= Sample: Getmonsterinfo +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates the 'getmonsterinfo' command. +//============================================================ + +prontera,156,179,6 script test_getmonsterinfo 4_F_KAFRA1,{ + mes "Please enter a monster ID."; + input .@value; + if(getmonsterinfo(.@value,MOB_LV)<0 || getmonsterinfo(.@value,MOB_NAME)=="Dummy") { + mes "Invalid monster ID."; + close; + } + mes "Monster ID: "+.@value+" '"+getmonsterinfo(.@value,MOB_NAME)+"'"; + mes "Current Monster info:"; + for (.@id = 0; .@id < 23; ++.@id) + mes " getmonsterinfo("+.@value+","+@id+") = "+getmonsterinfo(.@value,@id); + close; +} diff --git a/server/sample/gstorage_test.txt b/server/sample/gstorage_test.txt new file mode 100644 index 0000000..8b1a1c0 --- /dev/null +++ b/server/sample/gstorage_test.txt @@ -0,0 +1,36 @@ +//===== Hercules Script ======================================= +//= Sample: Guild Storage Test +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Contains commands needed for a guild warehouse NPC. +//============================================================ + +prontera,165,188,4 script Guild Warehouse 4_F_KAFRA6,{ + cutin "kafra_06",2; + + mes "[Guild Warehouse Coupler]"; + mes "This is the guild warehouse coupler service."; + mes "You will not receive zeny for this is a test."; + next; + if (select("Access Guild Warehouse","Exit") != 1) { + mes "[Guild Warehouser]"; + mes "Come back whenever you want."; + cutin "kafra_06", 255; + close; + } + + .@flag = guildopenstorage; + if (.@flag == 1) { + mes "[Guild Warehouse]"; + mes "The guild warehouse is being used right now."; + mes "Please wait a while, then come back."; + } else if(.@flag == 2) { + mes "[Guild Warehouse]"; + mes "You can't use this service if you're not in a guild!"; + } + cutin "kafra_06",255; + close; +} diff --git a/server/sample/localized_npc.txt b/server/sample/localized_npc.txt new file mode 100644 index 0000000..82a08fa --- /dev/null +++ b/server/sample/localized_npc.txt @@ -0,0 +1,148 @@ +//===== Hercules Script ====================================== +//= Sample localized NPC +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= v1.1 +//===== Description: ========================================= +//= Example of a localized NPC. +//= +//= There are many ways to do it, this is just one option. +//= The player has a global account variable ##_langid_ that +//= identifies the it's language. +//= +//= The default language should always have langid 0. +//= When a message isn't found for the player's langid +//= (strlen = 0), the message from langid 0 is used instead. +//= +//= Each message is identified by a string that must only +//= contain valid variable name characters. +//= +//= void setlang(int langid) +//= - sets the player's language +//= int getlang(void) +//= - returns the player's language +//= void setmes2(string name,int langid,string text) +//= - sets the localized text for name +//= string getmes2(string name,int langid) +//= - returns the localized text of name +//= void mes2(string name) +//= - displays the localized text of name +//= +//===== Additional Comments: ================================= +//= To use this globally, just put the functions in Global_Functions.txt +//============================================================ + +////////////////////////////////////////////////////////////// +/// Sets the language of the player account. +/// @param langid Languange identifier (0 for default) +function script setlang { + ##_langid_ = getarg(0); + return; +} + +////////////////////////////////////////////////////////////// +/// Returns the language identifier of the player +function script getlang { + return ##_langid_; +} + +////////////////////////////////////////////////////////////// +/// Sets a localized text entry. +/// Does not need a RID attached. +/// @param name Message identifier +/// @param langid Language identifier (0 for default) +/// @param text Text message +function script setmes2 { + .@mes2_name$ = getarg(0); + .@mes2_langid = getarg(1); + .@mes2_text$ = getarg(2); + .@mes2_var$ = "$@__"+ .@mes2_name$ +"_"+ .@mes2_langid +"$"; + + //debugmes "setmes2 \""+ .@mes2_var$ +"\", \""+ .@mes2_text$ +"\";"; + + // set the localized text + setd .@mes2_var$, .@mes2_text$; + return; +} + +////////////////////////////////////////////////////////////// +/// Sets a localized text entry. +/// Does not need a RID attached. +/// @param name Message identifier +/// @param langid Language identifier (0 for default) +/// @return Text message +function script getmes2 { + .@mes2_name$ = getarg(0); + .@mes2_langid = getarg(1); + .@mes2_var$ = "$@__"+ .@mes2_name$ +"_"+ .@mes2_langid +"$"; + .@mes2_text$ = getd(.@mes2_var$); + + //debugmes "getmes2(\""+ .@mes2_var$ +"\")=\""+ .@mes2_text$ +"\""; + + return .@mes2_text$; +} + +////////////////////////////////////////////////////////////// +/// mes for localized text. +/// index should be a unique string, made up only of characters +/// that are valis as a variable name +/// @param index Message identifier +function script mes2 { + .@mes2_index$ = getarg(0); + + if( getstrlen(.@mes2_index$) == 0 ) + return; // invalid index + + // print localized text + .@mes2_text$ = callfunc("getmes2",.@mes2_index$,##_langid_); + if( getstrlen(.@mes2_text$) == 0 ) { + if( ##_langid_ != 0 ) { + // revert to default language + .@mes2_text$ = callfunc("getmes2",.@mes2_index$,0); + if( getstrlen(.@mes2_text$) != 0 ) + mes .@mes2_text$; // default text + } + } else + mes .@mes2_text$; // localized text + return; +} + +////////////////////////////////////////////////////////////// +/// Sample localized NPC +prontera,155,183,4 script LocalizedNPC 4_M_GEF_SOLDIER,{ + // Get text for specific languages + .@menu1$ = callfunc("getmes2","LNPC_lang",0); + .@menu2$ = callfunc("getmes2","LNPC_lang",1); + do { + // get text that fallbacks to language 0 + callfunc "mes2", "LNPC_name"; + // localized mes + callfunc "mes2", "LNPC_lang"; + callfunc "mes2", "LNPC_text"; + next; + + switch(select(.@menu1$,.@menu2$,"Cancel")) + { + case 1: + case 2: + // Set player language + callfunc "setlang",@menu-1; + break; + } + } while( @menu != 3 ); + close; + end; + +OnInterIfInitOnce: + // Load the localized text. + // This can be anywhere, as long as it's executed before the coresponding getmes2/mes2 calls + // 0 - English (default) + // 1 - Portuguese + callfunc "setmes2", "LNPC_name", 0, "[LocalizedNPC]"; + callfunc "setmes2", "LNPC_lang", 0, "EN"; + callfunc "setmes2", "LNPC_lang", 1, "PT"; + callfunc "setmes2", "LNPC_text", 0, "Something in english"; + callfunc "setmes2", "LNPC_text", 1, "Algo em português"; + end; +} diff --git a/server/sample/npc_dynamic_shop.txt b/server/sample/npc_dynamic_shop.txt new file mode 100644 index 0000000..1e4ac77 --- /dev/null +++ b/server/sample/npc_dynamic_shop.txt @@ -0,0 +1,93 @@ +//===== Hercules Script ====================================== +//= Sample: Dynamic Shop +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Contains commands needed for a dynamic shop. +//============================================================ + +// Dummy shop to insert items into: +- shop dyn_shop1 -1,501:50. + +prontera,181,200,4 script Dynamic Shop 2_F_MAGICMASTER,{ + callshop "dyn_shop1",0; + npcshopattach "dyn_shop1"; + end; + +OnSellItem: + for (.@i = 0; .@i < getarraysize(@sold_nameid); ++.@i) { + if(countitem(@sold_nameid[.@i]) < @sold_quantity[.@i] || @sold_quantity[.@i] <= 0) { + mes "omgh4x!"; + close; + } else if (@sold_nameid[.@i] == Red_Potion) { + delitem Red_Potion, @sold_quantity[.@i]; + $@rpotsleft += @sold_quantity[.@i]; + Zeny += @sold_quantity[.@i]*20; + } else if (@sold_nameid[.@i] == Orange_Potion){ + delitem Orange_Potion, @sold_quantity[.@i]; + $@opotsleft += @sold_quantity[.@i]; + Zeny += @sold_quantity[.@i]*100; + } else { + mes "Sorry, I don't need your items."; + close; + } + } + deletearray @sold_quantity, getarraysize(@sold_quantity); + deletearray @sold_nameid, getarraysize(@sold_nameid); + mes "Deal completed."; + close; + +OnBuyItem: + for (.@i = 0; .@i < getarraysize(@bought_nameid); ++.@i) { + if (@bought_quantity[.@i] <= 0) { + mes "omgh4x!"; + close; + } else if (@bought_nameid[.@i] == Red_Potion) { + if (@bought_quantity[.@i] > $@rpotsleft) { + if($@rpotsleft > 0) { + @bought_quantity[.@i] = $@rpotsleft; + } else { + mes "We are out of red potions!"; + close; + } + } + if(Zeny >= 40*@bought_quantity[.@i]) { + Zeny -= 40*@bought_quantity[.@i]; + getitem Red_Potion, @bought_quantity[.@i]; + $@rpotsleft -= @bought_quantity[.@i]; + } else { + mes "You have insufficient cash."; + close; + } + } else /*if (@bought_nameid[.@i] == Orange_Potion)*/ { + if(@bought_quantity[.@i] > $@opotsleft) { + if($@opotsleft > 0) { + @bought_quantity[.@i] = $@opotsleft; + } else { + mes "We are out of orange potions!"; + close; + } + } + if(Zeny >= 200*@bought_quantity[.@i]) { + Zeny -= 200*@bought_quantity[.@i]; + getitem Orange_Potion, @bought_quantity[.@i]; + $@opotsleft -= @bought_quantity[.@i]; + } else { + mes "You have insufficient cash."; + close; + } + } + } + deletearray @bought_quantity, getarraysize(@bought_quantity); + deletearray @bought_nameid, getarraysize(@bought_nameid); + mes "Trade done."; + close; + +OnInit: + npcshopitem "dyn_shop1", Red_Potion, 40, Orange_Potion, 200; + $@rpotsleft = 10; + $@opotsleft = 10; + end; +} diff --git a/server/sample/npc_extend_shop.txt b/server/sample/npc_extend_shop.txt new file mode 100644 index 0000000..31ed0af --- /dev/null +++ b/server/sample/npc_extend_shop.txt @@ -0,0 +1,351 @@ +//===== Hercules Script ====================================== +//= Sample: Extended Shops +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= An example of shop NPCs. +//============================================================ + +prontera,182,213,3 trader Super Novice Shop 4_M_KID2,{ +OnInit: + sellitem Novice_Knife; + sellitem Novice_Guard; + sellitem Novice_Breast; + sellitem Novice_Plate; + sellitem Novice_Boots; + sellitem Novice_Hood; + sellitem Novice_Armlet; + sellitem Novice_Egg_Cap; +} +prontera,149,139,5 trader Whips Merchant 1_M_MERCHANT,{ +OnInit: + sellitem Rope_; + sellitem Line_; + sellitem Wire_; + sellitem Rante_; + sellitem Tail_; + sellitem Whip_; + sellitem Lariat; + sellitem Rapture_Rose; + sellitem Chemeti; +} +prontera,162,175,3 trader Headgears Merchant 1 1_F_MERCHANT_01,{ +OnInit: + sellitem Ribbon_; + sellitem Hair_Band; + sellitem Bandana; + sellitem Hat_; + sellitem Turban_; + sellitem Biretta_; + sellitem Cap_; + sellitem Gemmed_Sallet_; + sellitem Goggle_; + sellitem Helm_; +} +prontera,162,172,3 trader Headgears Merchant 2 1_F_MERCHANT_01,{ +OnInit: + sellitem Glasses; + sellitem Eye_Bandage; + sellitem Flu_Mask; + sellitem One_Eyed_Glass; + sellitem Granpa_Beard; + sellitem Luxury_Sunglasses; + sellitem Spinning_Eyes; + sellitem Gangster_Patch; + sellitem Ganster_Mask; + sellitem Eagle_Eyes; + sellitem Mr_Scream; + sellitem Masquerade; + sellitem Goblini_Mask; +} +prontera,162,169,3 trader Armours Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Mink_Coat; + sellitem Padded_Armor_; + sellitem Chain_Mail_; + sellitem Plate_Armor_; + sellitem Clothes_Of_The_Lord; + sellitem Formal_Suit; + sellitem Silk_Robe_; + sellitem Scapulare_; + sellitem Saint_Robe_; + sellitem Holy_Robe; + sellitem Wooden_Mail_; + sellitem Tights_; + sellitem Mage_Coat; + sellitem Thief_Clothes_; + sellitem Ninja_Suit; + sellitem Full_Plate_Armor_; +} +prontera,162,166,3 trader Shields Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Guard_; + sellitem Buckler_; + sellitem Shield_; + sellitem Mirror_Shield_; + sellitem Memorize_Book; + sellitem Holy_Guard; + sellitem Herald_Of_GOD; +} +prontera,162,163,3 trader Boots Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Sandals_; + sellitem Shoes_; + sellitem Boots_; + sellitem Chrystal_Pumps; + sellitem Grave_; + sellitem Safty_Boots; +} +prontera,162,160,3 trader Robes Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Hood_; + sellitem Muffler_; + sellitem Manteau_; + sellitem Cape_Of_Ancient_Lord; + sellitem Ragamuffin_Cape; + sellitem Clack_Of_Servival; +} +prontera,162,157,3 trader Accessory Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Ring; + sellitem Earring; + sellitem Necklace; + sellitem Glove; + sellitem Brooch; + sellitem Clip; + sellitem Rosary; + sellitem Safety_Ring; + sellitem Critical_Ring; + sellitem Matyr's_Flea_Guard; + sellitem Thimble_Of_Archer; +} +prontera,162,154,3 trader Arrows Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Arrow; + sellitem Silver_Arrow; + sellitem Fire_Arrow; + sellitem Steel_Arrow; + sellitem Crystal_Arrow; + sellitem Arrow_Of_Wind; + sellitem Stone_Arrow; + sellitem Immatrial_Arrow; + sellitem Stun_Arrow; + sellitem Freezing_Arrow; + sellitem Flash_Arrow; + sellitem Curse_Arrow; + sellitem Rusty_Arrow; + sellitem Poison_Arrow; + sellitem Incisive_Arrow; + sellitem Oridecon_Arrow; + sellitem Arrow_Of_Counter_Evil; + sellitem Arrow_Of_Shadow; + sellitem Sleep_Arrow; + sellitem Silence_Arrow; +} +prontera,162,151,3 trader Alchemist Shop 1_F_MERCHANT_01,{ +OnInit: + sellitem Alcol_Create_Book; + sellitem FireBottle_Create_Book; + sellitem Acid_Create_Book; + sellitem Plant_Create_Book; + sellitem Mine_Create_Book; + sellitem Coating_Create_Book; + sellitem Slim_Potion_Create_Book; + sellitem Normal_Potion_Book; + sellitem Medicine_Bowl; + sellitem Empty_Potion; +} +prontera,162,148,3 trader Taming Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Unripe_Apple; + sellitem Orange_Juice; + sellitem Bitter_Herb; + sellitem Rainbow_Carrot; + sellitem Earthworm_The_Dude; + sellitem Rotten_Fish; + sellitem Lusty_Iron; + sellitem Monster_Juice; + sellitem Sweet_Milk; + sellitem Well_Dried_Bone; + sellitem Singing_Flower; + sellitem Dew_Laden_Moss; + sellitem Deadly_Noxious_Herb; + sellitem Fatty_Chubby_Earthworm; + sellitem Baked_Yam; + sellitem Tropical_Banana; + sellitem Horror_Of_Tribe; + sellitem No_Recipient; + sellitem Old_Broom; + sellitem Silver_Knife_Of_Chaste; + sellitem Armlet_Of_Obedience; + sellitem Shining_Stone; + sellitem Contracts_In_Shadow; + sellitem Book_Of_Devil; + sellitem Heart_Of_Her; +} +prontera,162,145,3 trader Pet Equipment 1_F_MERCHANT_01,{ +OnInit: + sellitem Skull_Helm; + sellitem Monster_Oxygen_Mask; + sellitem Transparent_Headgear; + sellitem Pacifier; + sellitem Wig; + sellitem Queen's_Hair_Ornament; + sellitem Silk_Ribbon; + sellitem Punisher; + sellitem Wild_Flower; + sellitem Battered_Pot; + sellitem Stellar_Hairpin; + sellitem Tiny_Egg_Shell; + sellitem Backpack; + sellitem Rocker_Glasses; + sellitem Green_Lace; + sellitem Golden_Bell; + sellitem Bark_Shorts; + sellitem Monkey_Circlet; + sellitem Red_Muffler; + sellitem Sword_Of_Grave_Keeper; +} +prontera,148,234,5 trader Weapon Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Drops_Card, 100000; + sellitem Andre_Larva_Card, 100000; + sellitem Skeleton_Card, 100000; + sellitem Thief_Bug_Female_Card, 100000; + sellitem Hornet_Card, 100000; + sellitem Wolf_Card, 100000; + sellitem Andre_Card, 100000; + sellitem Savage_Babe_Card, 100000; + sellitem Farmiliar_Card, 100000; + sellitem Plankton_Card, 100000; + sellitem Snake_Card, 100000; + sellitem Marina_Card, 100000; + sellitem Metaller_Card, 100000; + sellitem Magnolia_Card, 100000; + sellitem Zenorc_Card, 100000; + sellitem Requiem_Card, 100000; + sellitem Mandragora_Card, 100000; + sellitem Vadon_Card, 100000; + sellitem Anacondaq_Card, 100000; + sellitem Drainliar_Card, 100000; + sellitem Orc_Skeleton_Card, 100000; + sellitem Pecopeco_Egg_Card, 100000; + sellitem Goblin_Card, 100000; + sellitem Caramel_Card, 100000; + sellitem Scorpion_Card, 100000; + sellitem Flora_Card, 100000; + sellitem Archer_Skeleton_Card, 100000; + sellitem Strouf_Card, 100000; + sellitem Petit_Card, 100000; + sellitem Desert_Wolf_Card, 20700; + sellitem Skel_Worker_Card, 100000; + sellitem Minorous_Card, 100000; + sellitem Golem_Card, 100000; + sellitem Hunter_Fly_Card, 100000; + sellitem Hydra_Card, 100000; + sellitem Soldier_Skeleton_Card, 100000; + sellitem Mummy_Card, 100000; + sellitem Side_Winder_Card, 100000; + sellitem Deviace_Card, 100000; +} +prontera,148,231,5 trader Headgear Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Wilow_Card, 100000; + sellitem Stainer_Card, 100000; + sellitem Martin_Card, 100000; + sellitem Elder_Wilow_Card, 100000; + sellitem Giearth_Card, 100000; + sellitem Ghoul_Card, 100000; + sellitem Marduk_Card, 100000; + sellitem Deviruchi_Card, 100000; + sellitem Nightmare_Card, 100000; +} +prontera,146,229,5 trader Armor Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Pupa_Card, 100000; + sellitem Picky_Card, 100000; + sellitem Picky__Card, 100000; + sellitem Roda_Frog_Card, 100000; + sellitem Thief_Bug_Card, 100000; + sellitem Rocker_Card, 100000; + sellitem Desert_Wolf_Babe_Card, 100000; + sellitem Pecopeco_Card, 100000; + sellitem Savage_Card, 100000; + sellitem Sword_Fish_Card, 100000; + sellitem Dokebi_Card, 100000; + sellitem Pasana_Card, 100000; + sellitem Sand_Man_Card, 100000; + sellitem Argiope_Card, 100000; + sellitem Bathory_Card, 100000; + sellitem Evil_Druid_Card, 100000; + sellitem Cornutus_Card, 100000; + sellitem Marc_Card, 100000; +} +prontera,144,227,5 trader Shield Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Andre_Egg_Card, 100000; + sellitem Ambernite_Card, 100000; + sellitem Thara_Frog_Card, 100000; + sellitem Soldier_Andre_Card, 100000; + sellitem Orc_Warrior_Card, 100000; + sellitem BigFoot_Card, 100000; + sellitem Rafflesia_Card, 100000; + sellitem Petit__Card, 100000; + sellitem Medusa_Card, 100000; + sellitem Khalitzburg_Card, 100000; + sellitem Anubis_Card, 100000; + sellitem Horn_Card, 100000; + sellitem Megalodon_Card, 100000; + sellitem Argos_Card, 100000; + sellitem Munak_Card, 100000; +} +prontera,142,225,5 trader Robe Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Dustiness_Card, 100000; + sellitem Orc_Zombie_Card, 100000; + sellitem Hode_Card, 100000; + sellitem Marse_Card, 100000; + sellitem Myst_Card, 100000; + sellitem Jakk_Card, 100000; + sellitem Marionette_Card, 100000; + sellitem Isis_Card, 100000; + sellitem Daydric_Card, 100000; + sellitem Condor_Card, 100000; + sellitem Frilldora_Card, 100000; + sellitem Whisper_Card, 100000; + sellitem Baphomet__Card, 100000; +} +prontera,140,223,5 trader Shoes Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Chonchon_Card, 100000; + sellitem Zombie_Card, 100000; + sellitem Thief_Bug_Male_Card, 100000; + sellitem Eggyra_Card, 100000; + sellitem Matyr_Card, 100000; + sellitem Sohee_Card, 100000; + sellitem Verit_Card, 100000; +} +prontera,138,221,5 trader Accessory Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Spore_Card, 100500; + sellitem Kukre_Card, 100500; + sellitem Tarou_Card, 100500; + sellitem Worm_Tail_Card, 100500; + sellitem Yoyo_Card, 100500; + sellitem Zerom_Card, 100500; + sellitem Kobold_Card, 100500; + sellitem Mantis_Card, 100500; + sellitem Poporing_Card, 100500; + sellitem Creamy_Card, 100500; + sellitem Smokie_Card, 100500; + sellitem Poison_Spore_Card, 100500; + sellitem Vitata_Card, 100500; + sellitem Pirate_Skel_Card, 100500; + sellitem Phen_Card, 100500; + sellitem Marine_Sphere_Card, 100500; + sellitem Obeaune_Card, 100500; + sellitem Horong_Card, 100500; + sellitem Joker_Card, 100500; +} diff --git a/server/sample/npc_live_dialogues.txt b/server/sample/npc_live_dialogues.txt new file mode 100644 index 0000000..9ce628c --- /dev/null +++ b/server/sample/npc_live_dialogues.txt @@ -0,0 +1,53 @@ +//===== Hercules Script ======================================= +//= Sample: Live Dialogue +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= An example of an NPC with live dialogue. +//= Note: This relies on Global_Functions.txt to run. +//============================================================ + +prontera,167,177,5 script Luppy DESERT_WOLF_B,{ + mes "[Luppy]"; + + // Say a random greeting from Global_Functions.txt + mes callfunc("F_Hi"); + + // Say a compliment according to player's gender + // 1st string is for FEMALE, 2nd for MALE + mes callfunc("F_Sex","What a beautiful lady!","What a handsome man!"); + + // Add some random greeting and goodbye into the menu + if (select(callfunc("F_Hi"), callfunc("F_Bye")) != 1) { + mes "[Luppy]"; + // Add some random goodbye from Global_Functions.txt + mes callfunc("F_Bye"); + close; + } + + mes "[Luppy]"; + // Give a random prize from set list of items + if (@gotstuff) { + // Again, say stuff according to player's gender + mes "I like "+callfunc("F_Sex","smiling ladies!","bloody pirates!"); + + // Show one of 3 emotion from the list (we added ,1 to show emotion over PLAYER's head) + emotion callfunc("F_RandMes", 3, e_scissors, e_kis, e_pat), 1; + close; + } + + // We set a temp var to give present just once. Player can get more by relogging. + @gotstuff = 1; + + // Get item ID from the list of presents: Apple, Mastela Fruit, Yggdrasil Seed or Orange Juice + .@itemIDfromList = callfunc("F_RandMes", 4, Apple, Fruit_Of_Mastela, Seed_Of_Yggdrasil, Orange_Juice); + + // Again, say stuff according to player's gender + mes "Hey, "+callfunc("F_Sex","sister!","brother!")+" I have "+getitemname(.@itemIDfromList)+" for you!"; + + // Get the item from the list + getitem .@itemIDfromList, 1; + close; +} diff --git a/server/sample/npc_test_array.txt b/server/sample/npc_test_array.txt new file mode 100644 index 0000000..a429ffb --- /dev/null +++ b/server/sample/npc_test_array.txt @@ -0,0 +1,43 @@ +//===== Hercules Script ======================================= +//= Sample: Array Test +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates array commands. +//============================================================ + +prontera,164,190,1 script Array Test 4_F_KAFRA6,{ + .@hoge[0] = 1; + .@hoge[1] = 5; + mes "Please enter a value for hoge[2]."; + next; + input .@hoge[2]; + mes "hoge => " + .@hoge; + mes "hoge[0]=> " + .@hoge[0]; + mes "hoge[1]=> " + .@hoge[1]; + mes "hoge[2]=> " + .@hoge[2]; + next; + setarray .@hoge[1],2,3,4,5; + mes "true: 5,1,2,3,4"; + mes "hoge size = "+ getarraysize(.@hoge); + mes "hoge[0]=> " + .@hoge[0]; + mes "hoge[1]=> " + .@hoge[1]; + mes "hoge[2]=> " + .@hoge[2]; + mes "hoge[3]=> " + .@hoge[3]; + next; + copyarray .@fuga[0],.@hoge[2],2; + mes "true: 3,4,0"; + mes "fuga[0]=> " + .@fuga[0]; + mes "fuga[1]=> " + .@fuga[1]; + mes "fuga[2]=> " + .@fuga[2]; + next; + deletearray .@hoge[1],2; + mes "true: 1,4,5,0"; + mes "hoge[0]=> " + .@hoge[0]; + mes "hoge[1]=> " + .@hoge[1]; + mes "hoge[2]=> " + .@hoge[2]; + mes "hoge[3]=> " + .@hoge[3]; + close; +} diff --git a/server/sample/npc_test_chat.txt b/server/sample/npc_test_chat.txt new file mode 100644 index 0000000..adc53c7 --- /dev/null +++ b/server/sample/npc_test_chat.txt @@ -0,0 +1,37 @@ +//===== Hercules Script ======================================= +//= Sample: Chat Test +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates waitingroom commands. +//============================================================ + +prontera,158,182,0 script Chat Test::test0001 4_F_KAFRA2,{ + mes "Trigger Number: " + getwaitingroomstate(2); + mes "Trigger State: " + getwaitingroomstate(3); + switch(select("Enable:Disable:Delete:Create")) { + case 1: + enablewaitingroomevent; + close; + case 2: + disablewaitingroomevent; + close; + case 3: + delwaitingroom; + close; + case 4: + waitingroom "Test",15,"test0001::OnChatEvent",1; + close; + } + +OnInit: + waitingroom "Test",15,"test0001::OnChatEvent",1; + end; + +OnChatEvent: + disablewaitingroomevent; + warpwaitingpc "prontera",160,180; + end; +} diff --git a/server/sample/npc_test_checkweight.txt b/server/sample/npc_test_checkweight.txt new file mode 100644 index 0000000..0f383ff --- /dev/null +++ b/server/sample/npc_test_checkweight.txt @@ -0,0 +1,158 @@ +//===== Hercules Script ======================================= +//= Sample: CheckWeight +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates 'checkweight' command. +//============================================================ + +prontera,161,181,6 script ChkSpace 4_M_JPN,{ + function ChkResult; + function FinalReport; + + // Reset + resetlvl(1); + getinventorylist; + for (.@i = 0; .@i < @inventorylist_count; ++.@i) { + delitem(@inventorylist_id[.@i], @inventorylist_amount[.@i]); //clear inventory + } + + //basic backward chk + .@testid = 0; + .@succes = 0; + .@ret = checkweight(Apple, 10); + .@succes += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight("Apple", 10); + .@succes += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight(Premium_Reset_Stone, 33000); + .@succes += ChkResult(.@testid++, 0, .@ret); //should be failure too many item amount item weight=0 + .@ret = checkweight("Premium_Reset_Stone", 33000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure too many item amount + .@ret = checkweight(Blue_Gemstone, 500); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success weight based on max weight=2030 + .@ret = checkweight(Blue_Gemstone, 1000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure weight based on max weight=2030 + .@ret = checkweight(Magic_Stone_Ring, 100); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight(Magic_Stone_Ring, 101); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure (with MAX_INVENTORY = 100) + .@ret = checkweight(-1, 1); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid item id + .@ret = checkweight(Apple, 0); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid amount + + debugmes "End backward test"; + FinalReport(.@testid, .@succes); + + //update using list test + .@testid = 0; + .@succes = 0; + + .@ret = checkweight(Apple, 10, Banana, 10); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight("Apple", 10, "Banana", 10); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight(Apple, 80, Banana, 33000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure + .@ret = checkweight("Apple", 80, "Banana", 33000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure too many item amount + .@ret = checkweight("Apple", 10, "Banana", 21, Apple); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid nb of args + .@ret = checkweight(Blue_Gemstone, 500, Red_Gemstone, 100); + .@success += ChkResult(.@testid++, 1, .@ret); //should be succes weight 1800/2030 + .@ret = checkweight(Blue_Gemstone, 500, Red_Gemstone, 500); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure weight 3000/2030 + .@ret = checkweight(Magic_Stone_Ring, 95, Green_Apple_Ring, 5); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight(Magic_Stone_Ring, 95, Green_Apple_Ring, 10); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure (with MAX_INVENTORY = 100) + .@ret = checkweight(Apple, 1, -1, 1); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid item id + .@ret = checkweight(Apple, 1, Banana, 0); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid amount + .@ret = checkweight(Premium_Reset_Stone, 31000, Premium_Reset_Stone, 2000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure overamount inventory + .@ret = checkweight(Apple, 1, Banana, 1, Grape, 1, Carrot, 1); + .@success += ChkResult(.@testid++, 1, .@ret); //should be sucess + + debugmes "End update by list tests"; + FinalReport(.@testid, .@succes); + + //update using array tests + .@testid = 0; + .@succes = 0; + + setarray .@item[0], Apple, Banana, Grape, Carrot; + setarray .@count[0], 1, 5, 9, 12; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 1, .@ret); //should be sucess + cleararray .@item[0], 0, 4; + cleararray .@count[0], 0, 4; + setarray .@item[0], Apple, Banana, Grape, Carrot; + setarray .@count[0], 1, 5, -1, 12; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure, invalid amout + cleararray .@item[0], 0, 4; + cleararray .@count[0], 0, 4; + setarray .@item[0], Apple, Banana, Grape, -1; + setarray .@count[0], 1, 5, 15, 12; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure, invalid id + cleararray .@item[0], 0, 4; + cleararray .@count[0], 0, 4; + setarray .@item[0], Blue_Gemstone, Yellow_Gemstone, Red_Gemstone, Emperium; + setarray .@count[0], 300, 300, 300, 300; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure, total by weight + cleararray .@item[0], 0, 4; + cleararray .@count[0], 0, 4; + setarray .@item[0], Premium_Reset_Stone, Premium_Reset_Stone; + setarray .@count[0], 31000, 2000; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure, total by weight + cleararray .@item[0], 0, 2; + cleararray .@count[0], 0, 2; + setarray .@item[0], Magic_Stone_Ring, Green_Apple_Ring; + setarray .@count[0], 95, 5; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + setarray .@count[0], 95, 10; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure overamount item + cleararray .@item[0], 0, 2; + cleararray .@count[0], 0, 2; + setarray .@item[0], Premium_Reset_Stone, Premium_Reset_Stone, Apple; + setarray .@count[0], 1, 3; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure, size mistmatch + cleararray .@item[0], 0, 3; + cleararray .@count[0], 0, 2; + setarray .@item[0], Premium_Reset_Stone, Premium_Reset_Stone; + setarray .@count[0], 1, 3, 5; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure, size mistmatch + + debugmes "End update by array tests"; + FinalReport(.@testid, .@succes); + + end; + + function ChkResult { + .@tid = getarg(0); + .@expected = getarg(1); + .@ret = getarg(2); + .@sucess = (.@ret==.@expected); + debugmes "Test "+.@tid+" = "+(.@sucess?"Sucess":"Fail"); + return .@sucess; + } + + function FinalReport { + .@tdone = getarg(0); + .@succes = getarg(1); + debugmes "Results = Pass : "+.@succes+"/"+.@tdone+" Fails : "+(.@tdone-.@succes)+"/"+.@tdone; + if(.@succes != .@tdone) { debugmes "Some failure as occured, enable chkresult print to found out"; } + return; + } +} diff --git a/server/sample/npc_test_duplicate.txt b/server/sample/npc_test_duplicate.txt new file mode 100644 index 0000000..55d64bc --- /dev/null +++ b/server/sample/npc_test_duplicate.txt @@ -0,0 +1,33 @@ +//===== Hercules Script ======================================= +//= Sample: Duplicate Test +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20140320 +//===== Description: ========================================= +//= An example of how duplicate NPCs are handled: +//= NPC variables are shared between all duplicates. +//= In this sample, to get the NPC coordinate, has to trigger OnTouch +//= Duplicates always override the source NPC's trigger area (even 0x0). +//= 'OnInit' loads the main npc last, for some reason. (check with debugmes) +//============================================================ + +- script Test Script -1,1,1,{ + mes "Hi."; + mes "My coords are "+ .map$ +", "+ .x +"/" +.y ; + close; + +OnInit: + getmapxy(.map$, .x, .y, 1); + debugmes strnpcinfo(0); + end; + +OnTouch: + getmapxy(.map$, .x, .y, 1); + emotion e_scissors; + end; +} + +prontera,150,175,4 duplicate(Test Script) Test1 4_PORING +prontera,155,175,4 duplicate(Test Script) Test2 4_PORING,2,2 +prontera,160,175,4 duplicate(Test Script) Test3 4_PORING,3,3 diff --git a/server/sample/npc_test_func.txt b/server/sample/npc_test_func.txt new file mode 100644 index 0000000..a57b6cf --- /dev/null +++ b/server/sample/npc_test_func.txt @@ -0,0 +1,35 @@ +//===== Hercules Script ======================================= +//= Sample: Functions +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates use of functions. +//============================================================ + +// Define the function func001 +function script func001 { + mes "Hello there!"; + next; + return; // Return to script +} + +// Define the function func002 +function script func002 { + return "I'm a function"; +} + +// Uses 3 different methods of displaying dialogue from both internal and external sources. +prontera,168,189,1 script Functions 4_F_KAFRA6,{ + callfunc "func001"; // Calls func001 and displays "Hello there!" + mes callfunc("func002"); // Calls func002 and displays "I'm a function" + next; + callsub L_SUB001; // Calls the label L_SUB001 and displays "I'm a label" + close; + end; + +L_SUB001: + mes "I'm a label"; + return; +} diff --git a/server/sample/npc_test_npctimer.txt b/server/sample/npc_test_npctimer.txt new file mode 100644 index 0000000..6c9b85a --- /dev/null +++ b/server/sample/npc_test_npctimer.txt @@ -0,0 +1,42 @@ +//===== Hercules Script ====================================== +//= Sample: NPC Timers +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates NPC timer commands. +//============================================================ + +prontera,156,183,0 script NPCtimerTest::npctimerX0000 4_F_KAFRA2,{ + mes "Timer value" + getnpctimer(0); + mes "State timer" + getnpctimer(1,"npctimerX0000"); + mes "Number of events" + getnpctimer(2); + switch(select("Initialization:Stop:Start:Settings")) { + case 1: + initnpctimer; + close; + case 2: + stopnpctimer; + close; + case 3: + startnpctimer; + close; + case 4: + input .@temp; + setnpctimer .@temp; + close; + } + +OnTimer1000: + npctalk "After a second..."; + end; + +OnTimer5000: + npctalk "After 5 seconds..."; + end; + +OnTimer10000: + npctalk "After 10 seconds..."; + end; +} diff --git a/server/sample/npc_test_npctimer2.txt b/server/sample/npc_test_npctimer2.txt new file mode 100644 index 0000000..b325c0c --- /dev/null +++ b/server/sample/npc_test_npctimer2.txt @@ -0,0 +1,23 @@ +//===== Hercules Script ====================================== +//= Sample: Attached NPC Timers +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates attached NPC timer commands. +//============================================================ + +prontera,156,183,0 script NPCtimerTest::npctimerX0000 4_F_KAFRA2,{ + mes "What would you like to know?"; + select("Tell me my level."); + mes "I need time to think..."; + initnpctimer; + attachnpctimer; + close; + +OnTimer5000: + mes "Ah, your level is " + readparam(11) + "!"; + detachnpctimer; + close; +} diff --git a/server/sample/npc_test_pcre.txt b/server/sample/npc_test_pcre.txt new file mode 100644 index 0000000..1306d17 --- /dev/null +++ b/server/sample/npc_test_pcre.txt @@ -0,0 +1,402 @@ +//===== Hercules Script ======================================= +//= Sample: PCRE +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates PCRE commands. +//============================================================ + +prontera,152,181,5 script MouseJstr 4_M_JPN,{ + +// hello +Lquote0: + npctalk "How do you do. Please state your problem."; + end; + +// computer +Lquote1: + switch(rand(4)) { + case 0: npctalk "Do computers worry you?"; break; + case 1: npctalk "What do you think about machines?"; break; + case 2: npctalk "Why do you mention computers?"; break; + case 3: npctalk "What do you think machines have to do with your problem?"; break; + } + end; + +// name +Lquote2: + npctalk "I am not interested in names"; + end; + +// sorry +Lquote3: + switch(rand(3)) { + case 0: npctalk "Please don't apologize"; break; + case 1: npctalk "Apologies are not necessary"; break; + case 2: npctalk "What feelings do you have when you apologize"; break; + } + end; + +// I remember $@p2$ +Lquote4: + switch(rand(6)) { + case 0: npctalk "Do you often think of "+$@p2$+"?"; break; + case 1: npctalk "Does thinking of "+$@p2$+" bring anything else to mind?"; break; + case 2: npctalk "What else do you remember?"; break; + case 3: npctalk "Why do you recall "+$@p2$+" right now?"; break; + case 4: npctalk "What in the present situation reminds you of "+$@p2$+"?"; break; + case 5: npctalk "What is the connection between me and "+$@p2$+"?"; break; + } + end; + +// do you remember +Lquote5: + switch (rand(4)) { + case 0: npctalk "Did you think I would forget "+$@p2$+" ?"; break; + case 1: npctalk "Why do you think I should recall "+$@p2$+" now"; break; + case 2: npctalk "What about "+$@p2$+""; break; + case 3: npctalk "You mentioned "+$@p2$+""; break; + } + end; + +// if +Lquote6: + switch(rand(4)) { + case 0: npctalk "Do you really think its likely that "+$@p2$+""; break; + case 1: npctalk "Do you wish that "+$@p2$+"?"; break; + case 2: npctalk "What do you think about "+$@p2$+"?"; break; + case 3: npctalk "Really-- if "+$@p2$+"?"; break; + } + end; + +// i dreamt +Lquote7: + switch(rand(3)) { + case 0: npctalk "Really-- "+$@p2$+""; break; + case 1: npctalk "Have you ever fantasized "+$@p2$+" while you were awake?"; break; + case 2: npctalk "Have you dreamt "+$@p2$+" before?"; break; + } + end; + +// dream about +Lquote8: + npctalk "How do you feel about "+$@p2$+" in reality?"; + end; + +// dream +Lquote9: + switch(rand(4)) { + case 0: npctalk "What does this dream suggest to you?"; break; + case 1: npctalk "Do you dream often?"; break; + case 2: npctalk "What persons appear in your dreams?"; break; + case 3: npctalk "Don't you believe that dream has to do with your problem?"; break; + } + end; + +// my mother +Lquote10: + switch(rand(2)) { + case 0: npctalk "Who else in your family "+$@p2$+""; break; + case 1: npctalk "Tell me more about your family"; break; + } + end; + +// my father +Lquote11: + switch(rand(3)) { + case 0: npctalk "Your father"; break; + case 1: npctalk "Does he influence you strongly?"; break; + case 2: npctalk "What else comes to mind when you think of your father?"; break; + } + end; + +// I want +Lquote12: + switch(rand(3)) { + case 0: npctalk "What would it mean if you got "+$@p2$+""; break; + case 1: npctalk "Why do you want "+$@p2$+""; break; + case 2: npctalk "Suppose you got "+$@p2$+" soon"; break; + } + end; + +// I am glad +Lquote13: + switch(rand(3)) { + case 0: npctalk "How have I helped you to be "+$@p2$+""; break; + case 1: npctalk "What makes you happy just now"; break; + case 2: npctalk "Can you explain why you are suddenly "+$@p2$+""; break; + } + end; + +// I am sad +Lquote14: + switch(rand(2)) { + case 0: npctalk "I am sorry to hear you are depressed"; break; + case 1: npctalk "I'm sure its not pleasant to be sad"; break; + } + end; + +// $@p2 are like "+$@p3$+" +Lquote15: + npctalk "What resemblance do you see between "+$@p2$+" and "+$@p3$+""; + end; + +// "+$@p2$+" is like "+$@p3$+" +Lquote16: + switch(rand(4)) { + case 0: npctalk "In what way is it that "+$@p2$+" is like "+$@p3$+""; break; + case 1: npctalk "What resemblance do you see?"; break; + case 2: npctalk "Could there really be some connection?"; break; + case 3: npctalk "How?"; break; + } + end; + +// alike +Lquote17: + switch(rand(2)) { + case 0: npctalk "In what way?"; break; + case 1: npctalk "What similarities are there?"; break; + } + end; + +// same +Lquote18: + npctalk "What other connections do you see?"; + end; + +// I was "+$@p2$+" +Lquote19: + switch(rand(3)) { + case 0: npctalk "Were you really?"; break; + case 1: npctalk "Perhaps I already knew you were "+$@p2$+""; break; + case 2: npctalk "Why do you tell me you were "+$@p2$+" now?"; break; + } + end; + +// was I +Lquote20: + switch(rand(3)) { + case 0: npctalk "What if you were "+$@p2$+" ?"; break; + case 1: npctalk "Do you thin you were "+$@p2$+""; break; + case 2: npctalk "What would it mean if you were "+$@p2$+""; break; + } + end; + +// I am +Lquote21: + switch(rand(2)) { + case 0: npctalk "In what way are you "+$@p2$+""; break; + case 1: npctalk "Do you want to be "+$@p2$+" ?"; break; + } + end; + +// am I +Lquote22: + switch(rand(4)) { + case 0: npctalk "Do you believe you are "+$@p2$+""; break; + case 1: npctalk "Would you want to be "+$@p2$+""; break; + case 2: npctalk "You wish I would tell you you are "+$@p2$+""; break; + case 3: npctalk "What would it mean if you were "+$@p2$+""; break; + } + end; + +// am +Lquote23: + switch(rand(2)) { + case 0: npctalk "Why do you say AM?"; break; + case 1: npctalk "I don't understand that"; break; + } + end; + +// are you +Lquote24: + switch(rand(3)) { + case 0: npctalk "Why are you interested in whether I am "+$@p2$+" or not?"; break; + case 1: npctalk "Would you prefer if I weren't "+$@p2$+""; break; + case 2: npctalk "Perhaps I am "+$@p2$+" in your fantasies"; break; + } + end; + +// you are +Lquote25: + npctalk "What makes you think I am "+$@p2$+" ?"; + end; + +// because +Lquote26: + switch(rand(3)) { + case 0: npctalk "Is that the real reason?"; break; + case 1: npctalk "What other reasons might there be?"; break; + case 2: npctalk "Does that reason seem to explain anything else?"; break; + } + end; + +// were you +Lquote27: + switch(rand(3)) { + case 0: npctalk "Perhaps I was "+$@p2$+""; break; + case 1: npctalk "What do you think?"; break; + case 2: npctalk "What if I had been "+$@p2$+""; break; + } + end; + +// I can't +Lquote28: + switch(rand(2)) { + case 0: npctalk "Maybe you could "+$@p3$+" now"; break; + case 1: npctalk "What if you could "+$@p3$+" ?"; break; + } + end; + +// I feel +Lquote29: + npctalk "Do you often feel "+$@p2$+" ?"; + end; + +// I felt +Lquote30: + npctalk "What other feelings do you have?"; + end; + +// $@p1$ I $@p2$ you $@p3$ +Lquote31: + npctalk "Perhaps in your fantasy we "+$@p3$+" each other?"; + end; + +// why don't you +Lquote32: + switch(rand(3)) { + case 0: npctalk "Should you "+$@p3$+" yourself?"; break; + case 1: npctalk "Do you believe I don't "+$@p3$+""; break; + case 2: npctalk "Perhaps I will "+$@p3$+" in good time"; break; + } + end; + +// yes +Lquote33: + switch(rand(3)) { + case 0: npctalk "You seem quite positive"; break; + case 1: npctalk "You are sure?"; break; + case 2: npctalk "I understand"; break; + } + end; + +// no +Lquote34: + switch(rand(3)) { + case 0: npctalk "Why not?"; break; + case 1: npctalk "You are being a bit negative"; break; + case 2: npctalk "Are you saying NO just to be negative?"; break; + } + end; + +// someone +Lquote35: + npctalk "Can you be more specific?"; + end; + +// everyone +Lquote36: + switch(rand(4)) { + case 0: npctalk "surely not everyone"; break; + case 1: npctalk "Can you think of anyone in particular?"; break; + case 2: npctalk "Who for example?"; break; + case 3: npctalk "You are thinking of a special person?"; break; + } + end; + +// always +Lquote37: + switch(rand(4)) { + case 0: npctalk "Can you think of a specific example?"; break; + case 1: npctalk "When?"; break; + case 2: npctalk "What incident are you thinking of?"; break; + case 3: npctalk "Really-- always?"; break; + } + end; + +// what +Lquote38: + switch(rand(5)) { + case 0: npctalk "Why do you ask?"; break; + case 1: npctalk "Does that question interest you?"; break; + case 2: npctalk "What is it you really want to know?"; break; + case 3: npctalk "What do you think?"; break; + case 4: npctalk "What comes to your mind when you ask that?"; break; + } + end; + +// perhaps +Lquote39: + npctalk "You do not seem quite certain"; + end; + +// are +Lquote40: + switch(rand(2)) { + case 0: npctalk "Did you think they might not be "+$@p2$+""; break; + case 1: npctalk "Possibly they are "+$@p2$; break; + } + end; + +// default +Lquote41: + switch(rand(6)) { + case 0: npctalk "Very interesting"; break; + case 1: npctalk "I am not sure I understand you fully"; break; + case 2: npctalk "What does that suggest to you?"; break; + case 3: npctalk "Please continue"; break; + case 4: npctalk "Go on"; break; + case 5: npctalk "Do you feel strongly about discussing such things?"; break; + } + end; + +OnInit: + defpattern 1, "([^:]+):.*\\shello.*", "Lquote0"; + defpattern 1, "([^:]+):.*\\scomputer.*", "Lquote1"; + defpattern 1, "([^:]+):.*\\sname.*", "Lquote2"; + defpattern 1, "([^:]+):.*\\ssorry.*", "Lquote3"; + defpattern 1, "([^:]+):.*\\si\\s+remember\\s+(.*)", "Lquote4"; + defpattern 1, "([^:]+):.*\\sdo\\s+you\\s+remember\\s+(.*)", "Lquote5"; + defpattern 1, "([^:]+):.*\\sif\\s+(.*)", "Lquote6"; + defpattern 1, "([^:]+):.*\\si\\s+dreamt\\s+(.*)", "Lquote7"; + defpattern 1, "([^:]+):.*\\sdream\\s+about\\s+(.*)", "Lquote8"; + defpattern 1, "([^:]+):.*\\sdream\\s+(.*)", "Lquote9"; + defpattern 1, "([^:]+):.*\\smy\\s+mother\\s+(.*)", "Lquote10"; + defpattern 1, "([^:]+):.*\\smy\\s+father\\s+(.*)", "Lquote11"; + defpattern 1, "([^:]+):.*\\si\\s+want\\s+(.*)", "Lquote12"; + defpattern 1, "([^:]+):.*\\si\\s+am\\s+glad\\s+(.*)", "Lquote13"; + defpattern 1, "([^:]+):\\s+(.*)\\s+i\\s+am\\s+sad\\s+(.*)", "Lquote14"; + defpattern 1, "([^:]+):\\s+(.*)\\s+are\\s+like\\s+(.*)", "Lquote15"; + defpattern 1, "([^:]+):\\s+(.*)\\s+is\\s+like\\s+(.*)", "Lquote16"; + defpattern 1, "([^:]+):.*\\salike\\s+(.*)", "Lquote17"; + defpattern 1, "([^:]+):.*\\ssame\\s+(.*)", "Lquote18"; + defpattern 1, "([^:]+):.*\\si\\s+was\\s+(.*)", "Lquote19"; + defpattern 1, "([^:]+):.*\\swas\\s+i\\s+(.*)", "Lquote20"; + defpattern 1, "([^:]+):.*\\si\\s+am\\s+(.*)", "Lquote21"; + defpattern 1, "([^:]+):.*\\sam\\s+i\\s+(.*)", "Lquote22"; + defpattern 1, "([^:]+):.*\\sam\\s+(.*)", "Lquote23"; + defpattern 1, "([^:]+):.*\\sare\\s+you\\s+(.*)", "Lquote24"; + defpattern 1, "([^:]+):.*\\syou\\s+are\\s+(.*)", "Lquote25"; + defpattern 1, "([^:]+):.*\\sbecause\\s+(.*)", "Lquote26"; + defpattern 1, "([^:]+):.*\\swere\\s+you\\s+(.*)", "Lquote27"; + defpattern 1, "([^:]+):.*\\si\\s+(cant|can't|cannot)\\s+(.*)", "Lquote28"; + defpattern 1, "([^:]+):.*\\si\\s+feel\\s+(.*)", "Lquote29"; + defpattern 1, "([^:]+):.*\\si\\s+felt\\s+(.*)", "Lquote30"; + defpattern 1, "([^:]+):.*\\si\\s+(.*)\\s+you\\s+(.*)", "Lquote31"; + defpattern 1, "([^:]+):.*\\swhy\\s+(don't|dont)\\s+you\\s+(.*)", "Lquote32"; + defpattern 1, "([^:]+):.*\\syes\\s+(.*)", "Lquote33"; + defpattern 1, "([^:]+):.*\\sno\\s+(.*)", "Lquote34"; + defpattern 1, "([^:]+):.*\\ssomeone\\s+(.*)", "Lquote35"; + defpattern 1, "([^:]+):.*\\severyone\\s+(.*)", "Lquote36"; + defpattern 1, "([^:]+):.*\\salways\\s+(.*)", "Lquote37"; + defpattern 1, "([^:]+):.*\\swhat\\s+(.*)", "Lquote38"; + defpattern 1, "([^:]+):.*\\sperhaps\\s+(.*)", "Lquote39"; + defpattern 1, "([^:]+):.*\\sare\\s+(.*)", "Lquote40"; + defpattern 1, "([^:]+):(.*)", "Lquote41"; + + activatepset 1; + end; +} diff --git a/server/sample/npc_test_quest.txt b/server/sample/npc_test_quest.txt new file mode 100644 index 0000000..90659aa --- /dev/null +++ b/server/sample/npc_test_quest.txt @@ -0,0 +1,52 @@ +//===== Hercules Script ====================================== +//= Sample: Quest Test +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates quest commands. +//============================================================ + +// Before installing an NPC like the one below, you would +// need to add the quest to /db/quest_db.txt - e.g: +// 70000,0,1002,3,0,0,0,0,"3 Splats Please!" + +prontera,90,95,1 script Jelly 2_F_MAGICMASTER,{ + if (!questprogress(70000)) { + // Quest not yet started. + mes "[Jelly]"; + mes "Hey there! Would you help me?"; + next; + switch(select("I'd rather not:What's up?")){ + case 1: + mes "[Jelly]"; + mes "I didn't want your help anyway!"; + close; + case 2: + mes "[Jelly]"; + mes "Those Porings are weirding me out."; + mes "Would you kill 3 for me?"; + setquest 70000; // Adds the quest to your Quest Window. + close; + } + } else if (questprogress(70000,HUNTING) == 2) { + // All monsters killed. + mes "[Jelly]"; + mes "Awesome! Thank you!"; + getexp 10000,0; + dispbottom "You have been rewarded with 10,000 Base Exp."; + completequest 70000; // Sets quest status to "complete". + close; + } else if (questprogress(70000) == 1) { + // Quest is active. + mes "[Jelly]"; + mes "Keep going, almost there!"; + close; + } else if (questprogress(70000) == 2) { + // Quest finished. + mes "[Jelly]"; + mes "Thanks again for doing that for me!"; + close; + } +} diff --git a/server/sample/npc_test_setitemx.txt b/server/sample/npc_test_setitemx.txt new file mode 100644 index 0000000..a06f0dc --- /dev/null +++ b/server/sample/npc_test_setitemx.txt @@ -0,0 +1,44 @@ +//===== Hercules Script ====================================== +//= Sample: Setiteminfo & Setitemscript +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates 'setiteminfo' and 'setitemscript' commands. +//============================================================ + +prontera,164,161,5 script Lupus WOLF,{ + mes "Please choose an option:"; + next; + switch (select("Make Knife[3] Edible", "Make Apple Equippable", "Edible Knife = Full SP", "Knife = Weapon + 3 Notes")) { + case 1: + mes "Ok. We made Knife[3] edible."; + setiteminfo(Knife, 2, IT_HEALING); //type = 0 : potion + setitemscript(Knife, "{dispbottom \"* You used Knife[3]\";}"); + break; + case 2: + mes "Ok. We made Apple equippable."; + setiteminfo(Apple, 2, IT_ARMOR); //item type -> headgear (type = 5 -> IT_ARMOR) + setiteminfo(Apple, 5, 512); //where to equip to (equip = 512) + setiteminfo(Apple, 11, 256); //set as headgear location (loc = 256) + setiteminfo(Apple, 14, 85); //set Headgear Sprite ID (view id = 85) + setitemscript(Apple, "{dispbottom \"* Other item's changed\";}", 0); + setitemscript(Apple, "{dispbottom \"* Equipped\";}", 1); + setitemscript(Apple, "{dispbottom \"* Unequipped\";}", 2); + break; + case 3: + mes "Ok. Now edible Knife[3] restores your SP."; + setitemscript(Knife, 2, 0); + setitemscript(Knife, "{dispbottom \"* You ate Knife[3] + Full SP\"; percentheal 0,100;}"); + break; + case 4: + mes "Ok. We made Knife a weapon, but added 3 notes."; + setiteminfo(Knife, 2, IT_WEAPON); //type = 4 -> IT_WEAPON + setitemscript(Knife, "{dispbottom \"* 1 Used\";}", 0); + setitemscript(Knife, "{dispbottom \"* 2 Equipped\";}", 1); + setitemscript(Knife, "{dispbottom \"* 3 Unequipped\";}", 2); + break; + } + close; +} diff --git a/server/sample/npc_test_setmapflag.txt b/server/sample/npc_test_setmapflag.txt new file mode 100644 index 0000000..44137be --- /dev/null +++ b/server/sample/npc_test_setmapflag.txt @@ -0,0 +1,32 @@ +//===== Hercules Script ====================================== +//= Sample: Mapflag Test +//===== By: ================================================== +//= Jbain +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates mapflag commands. +//============================================================ + +prontera,165,145,0 script EXPflagtest 2_F_MAGICMASTER,{ + mes "[EXPflagtest]"; + mes "Set up the map rates:"; + switch(select("Job EXP:Base EXP:PVP on:Reset all flags")) { + case 1: + input .@rate; + setmapflag "prontera",mf_jexp,.@rate; + close; + case 2: + input .@rate; + setmapflag "prontera",mf_bexp,.@rate; + close; + case 3: + setmapflag "prontera",mf_pvp; + close; + case 4: + removemapflag "prontera",mf_bexp; + removemapflag "prontera",mf_jexp; + removemapflag "prontera",mf_pvp; + close; + } +} diff --git a/server/sample/npc_test_skill.txt b/server/sample/npc_test_skill.txt new file mode 100644 index 0000000..c26ed1b --- /dev/null +++ b/server/sample/npc_test_skill.txt @@ -0,0 +1,37 @@ +//===== Hercules Script ======================================= +//= Sample: Skill +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates the 'skill' command. +//============================================================ + +// skill <skill id>,<level>{,<flag>}; +// flag=0 Grants the skill permanently +// flag=1 Grants the skill temporarily +// flag=2 Level bonus, stackable +// flag=3 Grants the skill permanently even after skill resets/job changes +// If flag is undefined, it defaults to 1 +// View db/(pre-)re/skill_db.txt for skill IDs + +prontera,157,182,0 script Skills 4_F_KAFRA2,{ + mes "What skill would you like?"; + switch(select("First Aid:Play Dead:Heal:Sight:None")) { + case 1: + skill NV_FIRSTAID,1,0; // Permanently gives player level 1 First Aid + close; + case 2: + skill NV_TRICKDEAD,1,0; // Permanently gives player level 1 Play Dead + close; + case 3: + skill AL_HEAL,3,1; // Temporarily gives player level 3 Heal + close; + case 4: + skill MG_SIGHT,1,3; // Permanently gives player level 1 Sight, even after skill resets/job changes + close; + case 5: + close; + } +} diff --git a/server/sample/npc_test_time.txt b/server/sample/npc_test_time.txt new file mode 100644 index 0000000..c3d4eae --- /dev/null +++ b/server/sample/npc_test_time.txt @@ -0,0 +1,25 @@ +//===== Hercules Script ======================================= +//= Sample: Time Test +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20151115 +//===== Description: ========================================= +//= Demonstrates time commands. +//============================================================ + +prontera,157,181,6 script Time Sample 8W_SOLDIER,{ + mes "[Time Sample]"; + mes " System Tick : " + gettimetick(0); + mes " Time Tick : " + gettimetick(1); + mes " GETTIME_SECOND : " + gettime(GETTIME_SECOND) + " (Sec)"; + mes " GETTIME_MINUTE : " + gettime(GETTIME_MINUTE) + " (Min)"; + mes " GETTIME_HOUR : " + gettime(GETTIME_HOUR) + " (Hour)"; + mes " GETTIME_WEEKDAY : " + gettime(GETTIME_WEEKDAY) + " (WeekDay)"; + mes "GETTIME_DAYOFMONTH : " + gettime(GETTIME_DAYOFMONTH) + " (MonthDay)"; + mes " GETTIME_MONTH : " + gettime(GETTIME_MONTH) + " (Month)"; + mes " GETTIME_YEAR : " + gettime(GETTIME_YEAR) + " (Year)"; + mes " GETTIME_DAYOFYEAR : " + gettime(GETTIME_DAYOFYEAR) + " (Day of Year)"; + mes " gettimestr : " + gettimestr("%Y-%m/%d %H:%M:%S",19); + close; +} diff --git a/server/sample/npc_trader_sample.txt b/server/sample/npc_trader_sample.txt new file mode 100644 index 0000000..0d50af8 --- /dev/null +++ b/server/sample/npc_trader_sample.txt @@ -0,0 +1,58 @@ +//===== Hercules Script ======================================= +//= Sample: NPC Trader +//===== By: ================================================== +//= Hercules Dev Team +//===== Current Version: ===================================== +//= 20131225 +//===== Description: ========================================= +//= Demonstrates NPC Trader. +//============================================================ + +/* ordinary zeny trader */ +prontera,152,151,1 trader TestTrader 4_F_EDEN_OFFICER,{ + OnInit: + sellitem Valkyrja's_Shield; + end; +} +/* ordinary cash trader */ +prontera,152,152,1 trader TestTraderCash 4_F_EDEN_OFFICER,{ + OnInit: + tradertype(NST_CASH); + sellitem Valkyrja's_Shield; + end; +} +/* custom npc trader */ +prontera,153,152,1 trader TestCustom2 4_F_EDEN_OFFICER,{ + OnInit: + tradertype(NST_CUSTOM); + sellitem Red_Potion,2; + end; + +/* allows currency to be item 501 and 502 */ +OnCountFunds: + setcurrency(countitem(Red_Potion),countitem(Orange_Potion)); + end; + +/* receives @price (total cost) and @points (the secondary input field for cash windows) */ +OnPayFunds: + dispbottom "Hi: price="+@price+" and points="+@points; + if( countitem(Orange_Potion) < @points || countitem(Red_Potion) < @price-@points ) + end; + delitem Orange_Potion,@points; + delitem Red_Potion,@price-@points; + purchaseok(); + end; +} +/* demonstrates Market Trader */ +prontera,150,160,6 trader HaiMarket 4_F_EDEN_OFFICER,{ +OnInit: + tradertype(NST_MARKET); + sellitem Red_Potion,-1,49; + end; + +OnClock0000://resupplies red potions on midnight +OnMyResupply: + if( shopcount(Red_Potion) < 20 ) + sellitem Red_Potion,-1,49; + end; +} |