mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 16:37:06 +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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1171,6 +1171,9 @@ void LoadLootTemplates_Fishing()
|
|||
ids_set.erase(areaEntry->ID);
|
||||
}
|
||||
|
||||
// by default (look config options) fishing at fail provide junk loot, entry 0 use for store this loot
|
||||
ids_set.erase(0);
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
LootTemplates_Fishing.ReportUnusedIds(ids_set);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ enum LootType
|
|||
LOOT_MILLING = 8,
|
||||
|
||||
LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
|
||||
LOOT_INSIGNIA = 21 // unsupported by client, sending LOOT_CORPSE instead
|
||||
LOOT_FISHING_FAIL = 21, // unsupported by client, sending LOOT_FISHING instead
|
||||
LOOT_INSIGNIA = 22 // unsupported by client, sending LOOT_CORPSE instead
|
||||
};
|
||||
|
||||
class Player;
|
||||
|
|
|
|||
|
|
@ -7900,7 +7900,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||
|
||||
// not check distance for GO in case owned GO (fishing bobber case, for example)
|
||||
// And permit out of range GO with no owner in case fishing hole
|
||||
if (!go || (loot_type != LOOT_FISHINGHOLE && (loot_type != LOOT_FISHING || go->GetOwnerGuid() != GetObjectGuid()) && !go->IsWithinDistInMap(this,INTERACTION_DISTANCE)))
|
||||
if (!go || (loot_type != LOOT_FISHINGHOLE && (loot_type != LOOT_FISHING && loot_type != LOOT_FISHING_FAIL || go->GetOwnerGuid() != GetObjectGuid()) && !go->IsWithinDistInMap(this,INTERACTION_DISTANCE)))
|
||||
{
|
||||
SendLootRelease(guid);
|
||||
return;
|
||||
|
|
@ -7921,15 +7921,18 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||
return;
|
||||
}
|
||||
|
||||
if (lootid)
|
||||
// Entry 0 in fishing loot template used for store junk fish loot at fishing fail it junk allowed by config option
|
||||
// this is overwrite fishinghole loot for example
|
||||
if (loot_type == LOOT_FISHING_FAIL)
|
||||
loot->FillLoot(0, LootTemplates_Fishing, this, true);
|
||||
else if (lootid)
|
||||
{
|
||||
DEBUG_LOG(" if(lootid)");
|
||||
loot->clear();
|
||||
loot->FillLoot(lootid, LootTemplates_Gameobject, this, false);
|
||||
loot->generateMoneyLoot(go->GetGOInfo()->MinMoneyLoot, go->GetGOInfo()->MaxMoneyLoot);
|
||||
}
|
||||
|
||||
if (loot_type == LOOT_FISHING)
|
||||
else if (loot_type == LOOT_FISHING)
|
||||
go->getFishLoot(loot,this);
|
||||
|
||||
go->SetLootState(GO_ACTIVATED);
|
||||
|
|
@ -8142,8 +8145,9 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||
// LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client
|
||||
switch(loot_type)
|
||||
{
|
||||
case LOOT_INSIGNIA: loot_type = LOOT_SKINNING; break;
|
||||
case LOOT_FISHINGHOLE: loot_type = LOOT_FISHING; break;
|
||||
case LOOT_INSIGNIA: loot_type = LOOT_SKINNING; break;
|
||||
case LOOT_FISHING_FAIL: loot_type = LOOT_FISHING; break;
|
||||
case LOOT_FISHINGHOLE: loot_type = LOOT_FISHING; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -644,6 +644,10 @@ void World::LoadConfigSettings(bool reload)
|
|||
setConfigPos(CONFIG_UINT32_SKILL_GAIN_GATHERING, "SkillGain.Gathering", 1);
|
||||
setConfig(CONFIG_UINT32_SKILL_GAIN_WEAPON, "SkillGain.Weapon", 1);
|
||||
|
||||
setConfig(CONFIG_BOOL_SKILL_FAIL_LOOT_FISHING, "SkillFail.Loot.Fishing", true);
|
||||
setConfig(CONFIG_BOOL_SKILL_FAIL_GAIN_FISHING, "SkillFail.Gain.Fishing", true);
|
||||
setConfig(CONFIG_BOOL_SKILL_FAIL_POSSIBLE_FISHINGPOOL, "SkillFail.Possible.FishingPool", false);
|
||||
|
||||
setConfig(CONFIG_UINT32_MAX_OVERSPEED_PINGS, "MaxOverspeedPings", 2);
|
||||
if (getConfig(CONFIG_UINT32_MAX_OVERSPEED_PINGS) != 0 && getConfig(CONFIG_UINT32_MAX_OVERSPEED_PINGS) < 2)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -316,6 +316,9 @@ enum eConfigBoolValues
|
|||
CONFIG_BOOL_ALL_TAXI_PATHS,
|
||||
CONFIG_BOOL_DECLINED_NAMES_USED,
|
||||
CONFIG_BOOL_SKILL_MILLING,
|
||||
CONFIG_BOOL_SKILL_FAIL_LOOT_FISHING,
|
||||
CONFIG_BOOL_SKILL_FAIL_GAIN_FISHING,
|
||||
CONFIG_BOOL_SKILL_FAIL_POSSIBLE_FISHINGPOOL,
|
||||
CONFIG_BOOL_BATTLEGROUND_CAST_DESERTER,
|
||||
CONFIG_BOOL_BATTLEGROUND_QUEUE_ANNOUNCER_START,
|
||||
CONFIG_BOOL_ARENA_AUTO_DISTRIBUTE_POINTS,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue