summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-07-23 09:47:41 -0300
committerJesusaves <cpntb1@ymail.com>2019-07-23 09:47:41 -0300
commit7b9def530c41346a3ad3427ff255133c0356ee25 (patch)
treecefe19cafa0e18780fc42c6212fc069031c7f51b /npc
parent23f4043278afbc299ad3710e7e0fd2058395abc8 (diff)
downloadserverdata-7b9def530c41346a3ad3427ff255133c0356ee25.tar.gz
serverdata-7b9def530c41346a3ad3427ff255133c0356ee25.tar.bz2
serverdata-7b9def530c41346a3ad3427ff255133c0356ee25.tar.xz
serverdata-7b9def530c41346a3ad3427ff255133c0356ee25.zip
Redesign fishing system so it may accept fishing nets.
Diffstat (limited to 'npc')
-rw-r--r--npc/functions/fishing.txt60
1 files changed, 31 insertions, 29 deletions
diff --git a/npc/functions/fishing.txt b/npc/functions/fishing.txt
index 57df44956..0e6a8c62e 100644
--- a/npc/functions/fishing.txt
+++ b/npc/functions/fishing.txt
@@ -89,6 +89,9 @@ function script fishing {
.@rod = getvariableofnpc(.fishing_rod, .@npc$); // the fishing rod required for this spot
.@rod = (.@rod ? .@rod : FishingRod);
+ .@net_ratio = getvariableofnpc(.net_ratio, .@npc$); // How many fishes and baits are required?
+ .@net_ratio = min(1, (.@net_ratio ? .@net_ratio : 1));
+
.@regen_time = getvariableofnpc(.cooldown, .@npc$); // cooldown for the fishing spot
.@regen_time = (.@regen_time ? .@regen_time : 20);
@@ -204,34 +207,32 @@ function script fishing {
return -4;
}
- // RNG to obtain a rare fish or common fish
- // Luck can increase up to 5% when it is at 100.
- // Level can increase up to 10% when it is at 100.
- .@boost=(readparam(bLuk)/20)+(BaseLevel/10);
- if (rand2(0, 100) < getvariableofnpc(.bait_ids[@bait_d+1], .@npc$)+.@boost)
- {
- //debugmes("[FISH] Got a rare with %d drop chances", getarraysize(.@rare_fish));
- .@fish_id = any_of(.@rare_fish);
- } else {
- //debugmes("[FISH] Got a common with %d drop chances", getarraysize(.@common_fish));
- .@fish_id = any_of(.@common_fish);
- }
// RNG to obtain a fish
- if (rand(gettimetick(0) - @fishing_tick) <= .@pull_rand_max)
+ if (rand2(gettimetick(0) - @fishing_tick) <= .@pull_rand_max)
{
- specialeffect(.@success_fx, SELF, playerattached()); // event success
- getexp getvariableofnpc(.bait_ids[@bait_d+1], .@npc$)+(BaseLevel/10), 0; // xp gain is equivalent to bait rarity + BaseLevel boost
-
- if(!checkweight(.@fish_id, 1))
- {
- dispbottom l("You caught a @@ but had no room in your inventory to carry it.", getitemlink(.@fish_id));
- makeitem .@fish_id, 1, .@mapbis$, .@xbis, .@ybis; // drop on the ground
- return 0;
+ for (.@i=0 ; .@i < .@net_ratio ; .@i++) {
+ // RNG to obtain a rare fish or common fish
+ // Luck can increase up to 5% when it is at 100.
+ // Level can increase up to 10% when it is at 100.
+ .@boost=(readparam(bLuk)/20)+(BaseLevel/10);
+ if (rand2(0, 100) < getvariableofnpc(.bait_ids[@bait_d+1], .@npc$)+.@boost)
+ {
+ .@fish_id = any_of(.@rare_fish);
+ } else {
+ .@fish_id = any_of(.@common_fish);
+ }
+ specialeffect(.@success_fx, SELF, playerattached());
+ getexp getvariableofnpc(.bait_ids[@bait_d+1], .@npc$)+(BaseLevel/10), 0; // xp gain is equivalent to bait rarity + BaseLevel boost
+
+ if(!checkweight(.@fish_id, 1))
+ {
+ dispbottom l("You caught a @@ but had no room in your inventory to carry it.", getitemlink(.@fish_id));
+ makeitem .@fish_id, 1, .@mapbis$, .@xbis, .@ybis; // drop on the ground
+ return 0;
+ }
+ getitem .@fish_id, 1;
}
-
- //dispbottom l("You caught a @@!", getitemlink(.@fish_id)); <= already shows "you picked up [...]"
- getitem .@fish_id, 1;
}
else
{
@@ -255,21 +256,22 @@ function script fishing {
// begin fishing
narrator S_LAST_NEXT,
l("You see some fish reflecting the sun on the surface of the water."),
- l("What will be the bait for the fish?");
+ (.@net_ratio == 1 ? l("What will be the bait for the fish?") : l("You need @@ units of bait for this fishing spot. What will you use?", .@net_ratio));
mes "##B" + l("Drag and drop an item from your inventory.") + "##b";
.@bait = requestitem();
.@bait_c = false;
- if (.@bait < 1) {
+ if (.@bait < .@net_ratio) {
narrator S_FIRST_BLANK_LINE,
- l("You take your fishing rod and leave.");
+ l("You take your @@ and leave.", getitemlink(.@rod));
return -6;
}
- if (countitem(.@bait) < 1) {
+ if (countitem(.@bait) < .@net_ratio) {
+ mesc l("You do not have enough bait for fishing here.");
return -6;
}
@@ -303,7 +305,7 @@ function script fishing {
set getvariableofnpc(.char_id, .@npc$), getcharid(CHAR_ID_CHAR); // record char id
set getvariableofnpc(.last_used, .@npc$), gettimetick(2);
getmapxy(@fishing_loc$[0], @fishing_loc[0], @fishing_loc[1], 0); // record char pos
- delitem .@bait, 1;
+ delitem .@bait, .@net_ratio;
// The player uses this spot, his bait is ready, he just has to wait for the signal.
closedialog;