[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:
VladimirMangos 2011-01-09 14:20:49 +03:00
parent d2b3977fee
commit 39e7b19267
12 changed files with 82 additions and 21 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_10988_01_mangos_mangos_string` bit(1) default NULL
`required_10989_01_mangos_loot_template` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -927,7 +927,7 @@ UNLOCK TABLES;
DROP TABLE IF EXISTS `creature_loot_template`;
CREATE TABLE `creature_loot_template` (
`entry` mediumint(8) unsigned NOT NULL default '0',
`entry` mediumint(8) unsigned NOT NULL default '0' COMMENT 'entry 0 used for player insignia loot',
`item` mediumint(8) unsigned NOT NULL default '0',
`ChanceOrQuestChance` float NOT NULL default '100',
`groupid` tinyint(3) unsigned NOT NULL default '0',
@ -1586,7 +1586,7 @@ UNLOCK TABLES;
DROP TABLE IF EXISTS `fishing_loot_template`;
CREATE TABLE `fishing_loot_template` (
`entry` mediumint(8) unsigned NOT NULL default '0',
`entry` mediumint(8) unsigned NOT NULL default '0' COMMENT 'entry 0 used for junk loot at fishing fail (if allowed by config option',
`item` mediumint(8) unsigned NOT NULL default '0',
`ChanceOrQuestChance` float NOT NULL default '100',
`groupid` tinyint(3) unsigned NOT NULL default '0',

View file

@ -0,0 +1,7 @@
ALTER TABLE db_version CHANGE COLUMN required_10988_01_mangos_mangos_string required_10989_01_mangos_loot_template bit;
ALTER TABLE creature_loot_template
CHANGE COLUMN entry entry mediumint(8) unsigned NOT NULL default '0' COMMENT 'entry 0 used for player insignia loot';
ALTER TABLE fishing_loot_template
CHANGE COLUMN entry entry mediumint(8) unsigned NOT NULL default '0' COMMENT 'entry 0 used for junk loot at fishing fail (if allowed by config option';

View file

@ -148,6 +148,7 @@ pkgdata_DATA = \
10973_01_characters_game_event_status.sql \
10973_01_mangos_game_event_mail.sql \
10988_01_mangos_mangos_string.sql \
10989_01_mangos_loot_template.sql \
README
## Additional files to include when running 'make dist'
@ -276,4 +277,5 @@ EXTRA_DIST = \
10973_01_characters_game_event_status.sql \
10973_01_mangos_game_event_mail.sql \
10988_01_mangos_mangos_string.sql \
10989_01_mangos_loot_template.sql \
README

View file

@ -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
{

View file

@ -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);
}

View file

@ -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;

View file

@ -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);
@ -8143,6 +8146,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
switch(loot_type)
{
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;
}

View file

@ -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)
{

View file

@ -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,

View file

@ -1239,6 +1239,21 @@ Visibility.Distance.Grey.Object = 10
# Default: 0 - no decrease
# 75 - in 2 times each 75 skill points
#
# SkillFail.Loot.Fishing
# For fishing instead fail provided junk loot
# Default: 1 (enabled)
# 0 (disabled)
#
# SkillFail.Gain.Fishing
# For fishing skill gain possible at fail also
# Default: 1 (enabled)
# 0 (disabled)
#
# SkillFail.Possible.FishingPool
# For fishing pool impossible fail from low skill by default
# Default: 0 (disabled)
# 1 (enabled)
#
# DurabilityLossChance.Damage
# Chance lost one from equiped items durability point at damage apply or receive.
# Default: 0.5 (100/0.5 = 200) Each 200 damage apply one from 19 possible equipped items
@ -1327,6 +1342,9 @@ SkillChance.Green = 25
SkillChance.Grey = 0
SkillChance.MiningSteps = 0
SkillChance.SkinningSteps = 0
SkillFailLoot.Fishing = 1
SkillFail.Gain.Fishing = 1
SkillFail.Possible.FishingPool = 0
DurabilityLossChance.Damage = 0.5
DurabilityLossChance.Absorb = 0.5
DurabilityLossChance.Parry = 0.05

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10988"
#define REVISION_NR "10989"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_10973_01_characters_game_event_status"
#define REVISION_DB_MANGOS "required_10988_01_mangos_mangos_string"
#define REVISION_DB_MANGOS "required_10989_01_mangos_loot_template"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__