diff options
author | Saulc <lucashelaine14@gmail.com> | 2018-01-13 20:50:42 +0100 |
---|---|---|
committer | Saulc <lucashelaine14@gmail.com> | 2018-01-13 20:50:42 +0100 |
commit | 20df2abc1aca00d6aa5dc78347133890f36b32f3 (patch) | |
tree | 4ad4a8bb8b0605473a702e314799a4626347721a /npc/items | |
download | serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.gz serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.bz2 serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.tar.xz serverdata-20df2abc1aca00d6aa5dc78347133890f36b32f3.zip |
Initial commit
Diffstat (limited to 'npc/items')
-rw-r--r-- | npc/items/croconut.txt | 72 | ||||
-rw-r--r-- | npc/items/rand_sc_heal.txt | 85 | ||||
-rw-r--r-- | npc/items/shovel.txt | 218 |
3 files changed, 375 insertions, 0 deletions
diff --git a/npc/items/croconut.txt b/npc/items/croconut.txt new file mode 100644 index 000000000..eb8b6d65e --- /dev/null +++ b/npc/items/croconut.txt @@ -0,0 +1,72 @@ +// Evol scripts. +// Authors: +// 4144 +// Reid +// Description: +// Allows to cut a Croconut in multiple parts. +// +// Possible choices for L_Weapon: +// rif(countitem(35xx), l(getitemname(xx))), L_Weak, +// rif(countitem(35yy), l(getitemname(yy))), L_Good, + +000-2-1,0,0,0 script Croconut NPC_HIDDEN,{ + close; + +OnUse: + mesn "Narrator"; + mes col(l("Do you want to cut this @@?", getitemlink(Croconut)), 9); + next; + + menu + l("Yes."), L_Weapon, + l("No."), -; + + getitem Croconut, 1; + close; + +L_Weapon: + mes ""; + mesn "Narrator"; + mes col(l("Which of your weapons do you want to use in order to cut this @@?", getitemlink(Croconut)), 9); + next; + + menu + rif(countitem(Knife) > 0, l(getitemname(Knife))), L_Weak, + rif(countitem(PiouSlayer) > 0, l(getitemname(PiouSlayer))), L_Weak, + rif(countitem(TrainingGladius) > 0, l(getitemname(TrainingGladius))), L_Good, + rif(countitem(WoodenSword) > 0, l(getitemname(WoodenSword))), L_Weak, + rif(countitem(ArtisBacksword) > 0, l(getitemname(ArtisBacksword))), L_Good, + l("Bare Hands"), -; + +L_TooWeak: + mes ""; + mesn "Narrator"; + + .@q = rand(5); + if (.@q == 0) goto L_TooWeakLost; + if ( (.@q == 1) || (.@q == 2) ) goto L_TooWeakFail; + if ( (.@q == 3) || (.@q == 4) || (.@q == 5) ) goto L_Weak; + +L_TooWeakLost: + mes col(l("You hit too hard with your fist, you destroyed your @@.", getitemlink(Croconut)), 9); + + close; + +L_TooWeakFail: + mes col(l("Your hands are too weak, you did not succeed in opening this @@.", getitemlink(Croconut)), 9); + + getitem Croconut, 1; + close; + +L_Weak: + mes col(l("You opened the @@ in two parts, but you crushed one of them.", getitemlink(Croconut)), 9); + + getitem HalfCroconut, 1; + close; + +L_Good: + mes col(l("You perfectly cut your @@ into two edible parts.", getitemlink(Croconut)), 9); + + getitem HalfCroconut, 2; + close; +} diff --git a/npc/items/rand_sc_heal.txt b/npc/items/rand_sc_heal.txt new file mode 100644 index 000000000..e4b0875a8 --- /dev/null +++ b/npc/items/rand_sc_heal.txt @@ -0,0 +1,85 @@ +// Evol scripts. +// Author: +// Reid +// Description: +// Random heal every x seconds. +// +// Variables: +// @delay Second of healing +// @min Min amount of healing +// @max Max amount of healing +// @type 1 Heal +// 2 Other +// 3 Special 1 +// 4 Special 2 + +- script rand_sc_heal -1,{ + + // Add remaning bonus if the last one hasn't finished + function remaining_bonus + { + if (getstatus(getarg(0))) + { + .@old_val1 = getstatus(getarg(0), 1); + .@old_delay = getstatus(getarg(0), 4) * 1000; + + // change the delay to prevent fast healing + if (.@old_delay > @delay) + { + @delay = .@old_delay; + @val1 += .@old_val1; + } + else + { + @val1 += (.@old_val1 * .@old_delay) / @delay; + } + } + else + { + @val1 = @val3; + } + return; + } + +OnUse: + if (@delay <= 0) close; + + // minimum between @min and bVit / 2 * BaseLevel / 10 + .@vitality_bonus = min(@min, readparam(bVit) * BaseLevel / 20); + .@rand_heal_val = rand(@min, @max); + + // val1 is the heal value without the vitality bonus + @val1 = .@rand_heal_val / @delay; + @val3 = (.@rand_heal_val + .@vitality_bonus) / @delay; + + if (@val1 <= 0) close; + + @delay *= 1000; // Put the delay in ms + + switch (@type) + { + case 1: + .@skill = SC_S_LIFEPOTION; + break; + case 2: + .@skill = SC_L_LIFEPOTION; + break; + case 3: + .@skill = SC_G_LIFEPOTION; + break; + case 4: + .@skill = SC_M_LIFEPOTION; + break; + default : + .@skill = 0; + break; + } + if (.@skill != 0) + { + remaining_bonus(.@skill); + sc_end .@skill; + sc_start2 .@skill, @delay, @val1, 1; + } + + close; +} diff --git a/npc/items/shovel.txt b/npc/items/shovel.txt new file mode 100644 index 000000000..f01a0fcbe --- /dev/null +++ b/npc/items/shovel.txt @@ -0,0 +1,218 @@ +// Evol scripts. +// Author: +// Travolta +// Description: +// NPC to use shovel (dig, bury etc) + +- script Shovel -1,{ + + function CheckDigLocation { + getmapxy(.@map$, .@x, .@y, 0); + for (.@i = 0; .@i < getarraysize(.WorldDigRect_Map$); .@i++) + { + if (!strcmp(.WorldDigRect_Map$[.@i], .@map$) && + .WorldDigRect_x1[.@i] <= .@x && + .WorldDigRect_x2[.@i] >= .@x && + .WorldDigRect_y1[.@i] <= .@y && + .WorldDigRect_y2[.@i] >= .@y) + { + return 1; + } + } + return 0; + } + + function AddDigRect { + if (getargcount() < 5) + { + debugmes "usage: AddDigRect(map$,x1,y1,x2,y2)"; + return 0; + } + .@map$ = str(getarg(0)); + .@x1 = getarg(1); + .@y1 = getarg(2); + .@x2 = getarg(3); + .@y2 = getarg(4); + .@size = getarraysize(.WorldDigRect_Map$); + .WorldDigRect_Map$[.@size] = .@map$; + .WorldDigRect_x1[.@size] = .@x1; + .WorldDigRect_y1[.@size] = .@y1; + .WorldDigRect_x2[.@size] = .@x2; + .WorldDigRect_y2[.@size] = .@y2; + return 1; + } + + function PlayerIsTired { + .@tick = gettimetick(1); + .@playertick = .PlayerTiredTime - readparam(bStr); + if (@ShovelLastUsed + max(4, .@playertick) > .@tick) + { + narrator S_FIRST_BLANK_LINE, + lg("You are exhausted, you should rest a bit."); + return 1; + } + @ShovelLastUsed = .@tick; + return 0; + } + + function Dig { + getmapxy(.@map$, .@x, .@y, 0); + for (.@i = 0; .@i < getarraysize($WorldBuriedTreasures_id); .@i++) + { + if (!strcmp($WorldBuriedTreasures_map$[.@i], .@map$) && + $WorldBuriedTreasures_x[.@i] == .@x && + $WorldBuriedTreasures_y[.@i] == .@y) + { + .@id = $WorldBuriedTreasures_id[.@i]; + .@amount = $WorldBuriedTreasures_amount[.@i]; + deletearray $WorldBuriedTreasures_id[.@i], 1; + deletearray $WorldBuriedTreasures_amount[.@i], 1; + deletearray $WorldBuriedTreasures_map$[.@i], 1; + deletearray $WorldBuriedTreasures_x[.@i], 1; + deletearray $WorldBuriedTreasures_y[.@i], 1; + getitem .@id, .@amount; + narrator S_FIRST_BLANK_LINE, + l("You found something!"), + l("It's @@ @@.", .@amount, getitemname(.@id)); + return 1; + } + } + narrator S_FIRST_BLANK_LINE, l("Sadly, you found nothing but dirt."); + return 0; + } + + function Bury { + narrator S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE, l("What would you like to bury?"); + .@items$ = ""; + getinventorylist; + for (.@i = 0; .@i < @inventorylist_count; .@i++) + { + .@items$ = .@items$ + getitemname(@inventorylist_id[.@i]) + ":"; + debugmes getitemname(@inventorylist_id[.@i]); + } + .@idx = select(.@items$) - 1; + .@id = @inventorylist_id[.@idx]; + .@amount = 1; + if (@inventorylist_amount[.@idx] > 1) + { + narrator S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE, l("Amount?"); + input .@amount, 1, @inventorylist_amount[.@idx]; + } + + getmapxy(.@map$, .@x, .@y, 0); + delitem .@id, .@amount; + .@wtc = getarraysize($WorldBuriedTreasures_id); + $WorldBuriedTreasures_id[.@wtc] = .@id; + $WorldBuriedTreasures_amount[.@wtc] = .@amount; + $WorldBuriedTreasures_map$[.@wtc] = .@map$; + $WorldBuriedTreasures_x[.@wtc] = .@x; + $WorldBuriedTreasures_y[.@wtc] = .@y; + narrator S_FIRST_BLANK_LINE, l("You buried @@ @@.", .@amount, getitemname(.@id)); + + return 0; + } + + function ShovelQuests { + getmapxy(.@map$, .@x, .@y, 0); + for (.@i = 0; .@i < getarraysize(ShovelQuests_func$); .@i++) + { + if (!strcmp(ShovelQuests_map$[.@i], .@map$) && + ShovelQuests_x[.@i] == .@x && + ShovelQuests_y[.@i] == .@y) + { + .@func$ = ShovelQuests_func$[.@i]; + deletearray ShovelQuests_func$[.@i], 1; + deletearray ShovelQuests_map$[.@i], 1; + deletearray ShovelQuests_x[.@i], 1; + deletearray ShovelQuests_y[.@i], 1; + callfunc(.@func$); + return 1; + } + } + return 0; + } + +OnUse: + if (!CheckDigLocation()) + { + message strcharinfo(0), l("I can't use the shovel here."); + close; + } + + narrator S_LAST_BLANK_LINE, + l("You hold the shovel in your hands."), + l("What are you going to do?"); + + .@action = select( + l("Dig."), + l("Bury."), + l("Nothing.")); + + switch(.@action) + { + case 1: + if (PlayerIsTired()) + close; + if (!ShovelQuests()) + Dig(); + break; + case 2: + if (PlayerIsTired()) + close; + Bury(); + break; + case 3: + narrator S_FIRST_BLANK_LINE, l("You hide your shovel."); + break; + } + close; + +OnHour00: + if (playerattached()) + @ShovelLastUsed = 0; + end; + +OnInit: + .PlayerTiredTime = 20; + AddDigRect("001-1", 172, 26, 200, 48); + end; + +} + +function script shovel_addquest { + if (getargcount() < 4) + { + debugmes "usage: shovel_addquest(map$,x,y,func$)"; + return 0; + } + .@map$ = str(getarg(0)); + .@x = getarg(1); + .@y = getarg(2); + .@func$ = str(getarg(3)); + .@size = getarraysize(ShovelQuests_func$); + ShovelQuests_func$[.@size] = .@func$; + ShovelQuests_map$[.@size] = .@map$; + ShovelQuests_x[.@size] = .@x; + ShovelQuests_y[.@size] = .@y; + return 1; +} + +function script shovel_adddigrect { + if (getargcount() < 5) + { + debugmes "usage: shovel_adddigrect(map$,x1,y1,x2,y2)"; + return 0; + } + .@map$ = str(getarg(0)); + .@x1 = getarg(1); + .@y1 = getarg(2); + .@x2 = getarg(3); + .@y2 = getarg(4); + .@size = getarraysize(getvariableofnpc(.WorldDigRect_Map$, strnpcinfo(3))); + set getvariableofnpc(.WorldDigRect_Map$[.@size], strnpcinfo(3)), .@map$; + set getvariableofnpc(.WorldDigRect_x1[.@size], strnpcinfo(3)), .@x1; + set getvariableofnpc(.WorldDigRect_y1[.@size], strnpcinfo(3)), .@y1; + set getvariableofnpc(.WorldDigRect_x2[.@size], strnpcinfo(3)), .@x2; + set getvariableofnpc(.WorldDigRect_y2[.@size], strnpcinfo(3)), .@y2; + return 1; +} |