From 1be14ebf7f38ab446907b4c111370b3a62bdc268 Mon Sep 17 00:00:00 2001 From: Feyo Korenhof <35343640+feyokorenhof@users.noreply.github.com> Date: Mon, 29 Nov 2021 13:53:58 +0100 Subject: Added ExperienceAmount variable to HOOK_PLAYER_FISHING and HOOK_PLAYER_FISHED (#5345) * Implemented cServer::ScheduleTask() and cServer::TickQueuedTasks() * Fixed formatting and added ScheduleTask to APIDesc * Added feyokorenhof to contributors * Added ExperienceAmount variable to all the hook calls. * Made ExperienceAmount int reference instead of int in HOOK_PLAYER_FISHING. Fixed bug: a_Reward is now a reference * Add documentation, change ItemFishingRod to pass in experience Co-authored-by: Alexander Harkness --- src/Items/ItemFishingRod.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Items/ItemFishingRod.h') diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h index 183c9756c..909f892c3 100644 --- a/src/Items/ItemFishingRod.h +++ b/src/Items/ItemFishingRod.h @@ -287,8 +287,10 @@ public: a_Player.GetStatistics().Custom[CustomStatistic::FishCaught]++; } + auto Experience = Random.RandInt(1, 6); + // Check with plugins if this loot is acceptable: - if (cRoot::Get()->GetPluginManager()->CallHookPlayerFishing(a_Player, Drops)) + if (cRoot::Get()->GetPluginManager()->CallHookPlayerFishing(a_Player, Drops, Experience)) { return; } @@ -298,10 +300,10 @@ public: const float FISH_SPEED_MULT = 2.25f; Vector3d FlyDirection = (a_Player.GetEyePosition() - FloaterPos).addedY(1.0f) * FISH_SPEED_MULT; a_World.SpawnItemPickups(Drops, FloaterPos, FlyDirection); - a_World.SpawnExperienceOrb(a_Player.GetPosition(), Random.RandInt(1, 6)); + a_World.SpawnExperienceOrb(a_Player.GetPosition(), Experience); a_Player.UseEquippedItem(1); // Notify plugins - cRoot::Get()->GetPluginManager()->CallHookPlayerFished(a_Player, Drops); + cRoot::Get()->GetPluginManager()->CallHookPlayerFished(a_Player, Drops, Experience); } } ; -- cgit v1.2.3