mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[10989] Implement post-3.1 and later fishing changes.
* Fishing now prowide junk loot at fail skill check. This can be disabled for old way work using SkillFail.Loot.Fishing option. Junk loot expected to be listed in fishing_loot_template entry 0. * Fishing can gain skill grow at skill fail check case. Controlled by SkillFail.Gain.Fishing option. * Fishing from fishing pool gameobject can't be fail. Controlled by SkillFail.Possible.FishingPool
This commit is contained in:
parent
d2b3977fee
commit
39e7b19267
12 changed files with 82 additions and 21 deletions
|
|
@ -1193,24 +1193,43 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
DEBUG_LOG("Fishing check (skill: %i zone min skill: %i chance %i roll: %i",skill,zone_skill,chance,roll);
|
||||
|
||||
if (skill >= zone_skill && chance >= roll)
|
||||
// normal chance
|
||||
bool success = skill >= zone_skill && chance >= roll;
|
||||
GameObject* fishingHole = NULL;
|
||||
|
||||
// overwrite fail in case fishhole if allowed (after 3.3.0)
|
||||
if (!success)
|
||||
{
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_SKILL_FAIL_POSSIBLE_FISHINGPOOL))
|
||||
{
|
||||
//TODO: find reasonable value for fishing hole search
|
||||
fishingHole = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE);
|
||||
if (fishingHole)
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
// just search fishhole for success case
|
||||
else
|
||||
//TODO: find reasonable value for fishing hole search
|
||||
fishingHole = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE);
|
||||
|
||||
if (success || sWorld.getConfig(CONFIG_BOOL_SKILL_FAIL_GAIN_FISHING))
|
||||
player->UpdateFishingSkill();
|
||||
|
||||
// fish catch or fail and junk allowed (after 3.1.0)
|
||||
if (success || sWorld.getConfig(CONFIG_BOOL_SKILL_FAIL_LOOT_FISHING))
|
||||
{
|
||||
// prevent removing GO at spell cancel
|
||||
player->RemoveGameObject(this,false);
|
||||
SetOwnerGuid(player->GetObjectGuid());
|
||||
|
||||
//fish catched
|
||||
player->UpdateFishingSkill();
|
||||
|
||||
//TODO: find reasonable value for fishing hole search
|
||||
GameObject* ok = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE);
|
||||
if (ok)
|
||||
if (fishingHole) // will set at success only
|
||||
{
|
||||
ok->Use(player);
|
||||
fishingHole->Use(player);
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
else
|
||||
player->SendLoot(GetObjectGuid(),LOOT_FISHING);
|
||||
player->SendLoot(GetObjectGuid(), success ? LOOT_FISHING : LOOT_FISHING_FAIL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue