diff options
author | Trazom62 <none@none> | 2010-04-04 00:30:11 +0200 |
---|---|---|
committer | Trazom62 <none@none> | 2010-04-04 00:30:11 +0200 |
commit | 917193eda513d762260a9e4fd4904f00ff407caf (patch) | |
tree | abbf1cd250ef36c4a713ac7b69e37613cd541a20 /src | |
parent | ffd133388ab245ad75821f540603526e164835d1 (diff) |
Fix Fishing skill in low level zones, where the zone_skill is < 0. The formula was not correct for those cases.
Fixes isssue #1387.
Note: junk loot is still not yet implemented.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/GameObject.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 01831f81d50..4daa17fa0be 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1211,10 +1211,6 @@ void GameObject::Use(Unit* user) { case GO_READY: // ready for loot { - // 1) skill must be >= base_zone_skill - // 2) if skill == base_zone_skill => 5% chance - // 3) chance is linear dependence from (base_zone_skill-skill) - uint32 zone, subzone; GetZoneAndAreaId(zone,subzone); @@ -1227,34 +1223,43 @@ void GameObject::Use(Unit* user) sLog.outErrorDb("Fishable areaId %u are not properly defined in `skill_fishing_base_level`.",subzone); int32 skill = player->GetSkillValue(SKILL_FISHING); - int32 chance = pow((double)skill/zone_skill,2) * 100; + + int32 chance; + if (skill < zone_skill) + { + chance = pow((double)skill/zone_skill,2) * 100; + if (chance < 1) + chance = 1; + } + else + chance = 100; + int32 roll = irand(1,100); DEBUG_LOG("Fishing check (skill: %i zone min skill: %i chance %i roll: %i",skill,zone_skill,chance,roll); - if(chance >= roll) + // but you will likely cause junk in areas that require a high fishing skill (not yet implemented) + if (chance >= roll) { player->UpdateFishingSkill(); - // 3.1 changes, you can now fish anywhere and get fishing skillups - // but you will likely cause junk in areas that require a high fishing skill (not yet implemented) - if(skill >= zone_skill) - { - // prevent removing GO at spell cancel - player->RemoveGameObject(this,false); - SetOwnerGUID(player->GetGUID()); - //TODO: find reasonable value for fishing hole search - GameObject* ok = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE); - if (ok) - { - player->SendLoot(ok->GetGUID(),LOOT_FISHINGHOLE); - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT, ok->GetGOInfo()->id); - SetLootState(GO_JUST_DEACTIVATED); - } - else - player->SendLoot(GetGUID(),LOOT_FISHING); + // prevent removing GO at spell cancel + player->RemoveGameObject(this,false); + SetOwnerGUID(player->GetGUID()); + + //TODO: find reasonable value for fishing hole search + GameObject* ok = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE); + if (ok) + { + player->SendLoot(ok->GetGUID(),LOOT_FISHINGHOLE); + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT, ok->GetGOInfo()->id); + SetLootState(GO_JUST_DEACTIVATED); } + else + player->SendLoot(GetGUID(),LOOT_FISHING); } + // TODO: else: junk + break; } case GO_JUST_DEACTIVATED: // nothing to do, will be deleted at next update |