diff options
-rw-r--r-- | npc/functions/aurora.txt | 3 | ||||
-rw-r--r-- | npc/functions/fishing.txt | 92 |
2 files changed, 54 insertions, 41 deletions
diff --git a/npc/functions/aurora.txt b/npc/functions/aurora.txt index 51f03c183..66fe7cad3 100644 --- a/npc/functions/aurora.txt +++ b/npc/functions/aurora.txt @@ -520,8 +520,9 @@ function script FYEConf_Fishing { // Modify Fishing function script FYE_Fishing { + .@net_ratio = getarg(0, 1); // TODO: Merit-based random formula [AVG: 3.5] about 10pts/min - getitem EventFish, rand2(1, 6); + getitem EventFish, (.@net_ratio * rand2(1, 6)); return; } diff --git a/npc/functions/fishing.txt b/npc/functions/fishing.txt index e589cf107..41dd60be0 100644 --- a/npc/functions/fishing.txt +++ b/npc/functions/fishing.txt @@ -22,7 +22,8 @@ function script fishing_cleanup { .@npc$ = getarg(0, ""); - if (.@npc$ == "") end; + if (.@npc$ == "") + end; set getvariableofnpc(.char_id, .@npc$), 0; // clean acc id set getvariableofnpc(.account_id, .@npc$), 0; // clean char id @@ -31,11 +32,14 @@ function script fishing_cleanup { return; } + + - script global fishing handler 32767,{ end; OnBite: - if (ispcdead()) end; + if (ispcdead()) + end; if (getnpcdir(@fishing_spot$) != UP) end; @@ -54,13 +58,14 @@ OnPCLogoutEvent: end; } + + // Syntax: fishing() // Syntax: fishing ( OFFSET, COMMON FISHES, RARE FISHES ) // OFFSET: How many fishes are common function script fishing { -/////////////////////////////////////////// -// Var initialization + // Var initialization if (getarg(0, 0) == 0) { setarray .@common_fish, CommonCarp; @@ -78,7 +83,8 @@ function script fishing { }; freeloop(false); } - //debugmes("[FISH] Initialized with %d common and %d rare fishes", getarraysize(.@common_fish), getarraysize(.@rare_fish)); + //debugmes("[FISH] Initialized with %d common and %d rare fishes", + // getarraysize(.@common_fish), getarraysize(.@rare_fish)); .@npc$ = strnpcinfo(0); // the full name of the fishing spot @@ -164,8 +170,8 @@ function script fishing { } -/////////////////////////////////////////// -// Logic below + // fishing spot logic + ///////////////////// if (countitem(.@rod) < 1) { @@ -203,9 +209,7 @@ function script fishing { dispbottom l("You pulled too soon and lost the bait."); return -3; } - - // pull maybe on time - else if (.@dir == LEFT) + else if (.@dir == LEFT) // pull maybe on time { deltimer "global fishing handler::OnCleanUp"; // cancel auto cleanup fishing_cleanup .@npc$; // do it manually instead @@ -223,38 +227,43 @@ function script fishing { // RNG to obtain a fish if (rand2(gettimetick(0) - @fishing_tick) <= .@pull_rand_max) { + .@player_boost = (readparam2(bLuk)/20) + (BaseLevel/10); + specialeffect(.@success_fx, SELF, playerattached()); + + // xp & mobpt gain is proportional to bait rarity + BaseLevel boost + getexp (.@net_ratio * (.@bait_boost + BaseLevel/10)), + (.@net_ratio * (.@bait_boost + 4)); + + // MobPt gain is equivalent to bait . + if (MPQUEST) + Mobpt += .@net_ratio * .@bait_boost * limit(1, BaseLevel/10, 10); + 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=(readparam2(bLuk)/20)+(BaseLevel/10); - .@bai=getvariableofnpc(.bait_ids[@bait_d+1], .@npc$); // Ancient Blueprint: 0.05% per bait bonus (no luck) - if (rand2(2000) < .@bp_chance*.@bai) { + if (rand2(2000) < (.@bp_chance * .@bait_boost)) { .@fish_id = AncientBlueprint; - } else if (rand2(0, 100) < .@bai+.@boost) { + } else if (rand2(0, 100) < (.@bait_boost + .@player_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), 4+getvariableofnpc(.bait_ids[@bait_d+1], .@npc$); // xp gain is equivalent to bait rarity + BaseLevel boost - - // MobPt gain is equivalent to bait rarity. - if (MPQUEST) - Mobpt+=.@bai*limit(1, BaseLevel/10, 10); + // TODO: Will herc not make a flooritem on its own? if (checkweight(.@fish_id, 1)) { getitem .@fish_id, 1; } else { - dispbottom l("You caught a @@ but had no room in your inventory to carry it.", getitemlink(.@fish_id)); + 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 } - - // Catch the Golden Fish Event - if ($EVENT$ == "Fishing") - FYE_Fishing(); } + + // Catch the Golden Fish Event + if ($EVENT$ == "Fishing") + FYE_Fishing(.@net_ratio); } else { @@ -278,19 +287,22 @@ function script fishing { // This "hack" will prevent you from fishing at two spots (buggy) // It'll cancel the previous fishing too, per logical rule. - if (@fishing_spot$ != "") { - deltimer "global fishing handler::OnCleanUp"; // cancel auto cleanup - deltimer "global fishing handler::OnBite"; - fishing_cleanup(@fishing_spot$); // clean up manually - @fishing_spot$=""; - dispbottom l("You left your fishing spot!"); - return -4; + if (@fishing_spot$ != "") + { + deltimer "global fishing handler::OnCleanUp"; // cancel auto cleanup + deltimer "global fishing handler::OnBite"; + fishing_cleanup(@fishing_spot$); // clean up manually + @fishing_spot$=""; + dispbottom l("You left your fishing spot!"); + return -4; } // begin fishing narrator S_LAST_NEXT, l("You see some fish reflecting the sun on the surface of the water."), - (.@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)); + (.@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)); if (GSET_FISHING_BAIT > 1) { .@bait = GSET_FISHING_BAIT; @@ -303,10 +315,9 @@ function script fishing { GSET_FISHING_BAIT = .@bait; } - if (.@bait < .@net_ratio) { + if (.@bait < 1) { // exit if no bait selected narrator S_FIRST_BLANK_LINE, l("You take your @@ and leave.", getitemlink(.@rod)); - return -6; } @@ -315,17 +326,18 @@ function script fishing { return -6; } - .@bait_c = false; + // Figure out if provided bait is valid and how good it is. + .@bait_valid = false; for (.@i = 0; .@i < .@baits; .@i += 2) { if (getvariableofnpc(.bait_ids[.@i], .@npc$) == .@bait) { - .@bait_c = true; - @bait_d = .@i; + .@bait_valid = true; + @bait_boost = getvariableofnpc(.bait_ids[@i+1], .@npc$); break; } } - if (.@bait_c != true) + if (.@bait_valid != true) { narrator S_FIRST_BLANK_LINE, l("This item cannot be used as bait here."); @@ -337,7 +349,7 @@ function script fishing { { narrator S_FIRST_BLANK_LINE, l("Somebody took your place on this spot!"), - l("You take your fishing rod and leave."); + l("You take your @@ and leave.", getitemlink(.@rod)); return -8; } |