diff --git a/sql/mangos.sql b/sql/mangos.sql index 5b7cb3b10..7fad52676 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -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', diff --git a/sql/updates/10989_01_mangos_loot_template.sql b/sql/updates/10989_01_mangos_loot_template.sql new file mode 100644 index 000000000..992f95c5a --- /dev/null +++ b/sql/updates/10989_01_mangos_loot_template.sql @@ -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'; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 248acdc87..ebc8b434d 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -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 diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 03cf6f917..30c605778 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -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 { diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 1a12ac4de..cc32b8cb9 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -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); } diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index 64b228880..675af2262 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -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; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e48a19b99..f1abb1bd2 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -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; } diff --git a/src/game/World.cpp b/src/game/World.cpp index 9dc1beafa..3441c70ff 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -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) { diff --git a/src/game/World.h b/src/game/World.h index 3bf111dca..cdf23de49 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -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, diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 9a9c5f090..db736ea99 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -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 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 576c3f0ed..2bf1839b5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10988" + #define REVISION_NR "10989" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 47db1b04b..cf6973ce9 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -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__