From ae46affe4e8d69219a28df7b5557a323a2b1f248 Mon Sep 17 00:00:00 2001 From: phoenixfight Date: Sat, 10 May 2014 21:35:05 +0800 Subject: [core/database]Repair fishing spell result fish escape edit fish junk sql formart Optimized code, remove some useless brackets fix default fish result ,just like Off the coast of Storm Peaks. cleaned the sql part thx Kinzcool fix todo now --- src/server/game/Entities/GameObject/GameObject.cpp | 39 ++++++++++++++++++---- src/server/game/Entities/GameObject/GameObject.h | 1 + 2 files changed, 33 insertions(+), 7 deletions(-) (limited to 'src/server/game/Entities/GameObject') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 8051c757bf2..868aa87c26f 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -694,12 +694,39 @@ void GameObject::getFishLoot(Loot* fishloot, Player* loot_owner) fishloot->clear(); uint32 zone, subzone; + uint32 defaultzone = 1; GetZoneAndAreaId(zone, subzone); // if subzone loot exist use it - if (!fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true)) - // else use zone loot (must exist in like case) - fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true); + fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true); + if (fishloot->empty()) //use this becase if zone or subzone has set LOOT_MODE_JUNK_FISH,Even if no normal drop, fishloot->FillLoot return true. it wrong. + { + //subzone no result,use zone loot + fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true); + //use zone 1 as default, somewhere fishing got nothing,becase subzone and zone not set, like Off the coast of Storm Peaks. + if (fishloot->empty()) + fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true); + } +} + +void GameObject::getFishLootJunk(Loot* fishloot, Player* loot_owner) +{ + fishloot->clear(); + + uint32 zone, subzone; + uint32 defaultzone = 1; + GetZoneAndAreaId(zone, subzone); + + // if subzone loot exist use it + fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH); + if (fishloot->empty()) //use this becase if zone or subzone has normal mask drop, then fishloot->FillLoot return true. + { + //use zone loot + fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH); + if (fishloot->empty()) + //use zone 1 as default + fishloot->FillLoot(defaultzone, LootTemplates_Fishing, loot_owner, true, true, LOOT_MODE_JUNK_FISH); + } } void GameObject::SaveToDB() @@ -1413,10 +1440,8 @@ void GameObject::Use(Unit* user) else player->SendLoot(GetGUID(), LOOT_FISHING); } - /// @todo else: junk - else - m_respawnTime = time(NULL); - + else // else: junk + player->SendLoot(GetGUID(), LOOT_FISHING_JUNK); break; } case GO_JUST_DEACTIVATED: // nothing to do, will be deleted at next update diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index a99c5db93aa..7aa3a01016b 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -713,6 +713,7 @@ class GameObject : public WorldObject, public GridObject, public Map void Refresh(); void Delete(); void getFishLoot(Loot* loot, Player* loot_owner); + void getFishLootJunk(Loot* loot, Player* loot_owner); GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); } void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); } GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); } -- cgit v1.2.3