aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/GameObject
diff options
context:
space:
mode:
authorphoenixfight <phoenix.zhao@gmail.com>2014-05-10 21:35:05 +0800
committerphoenixfight <phoenix.zhao@gmail.com>2014-06-10 11:07:15 +0800
commitae46affe4e8d69219a28df7b5557a323a2b1f248 (patch)
tree6512ed7c86d5b0827c50f08a4be831de3ee71ed1 /src/server/game/Entities/GameObject
parent71795bf9776183429455d5742125b069836810e4 (diff)
[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
Diffstat (limited to 'src/server/game/Entities/GameObject')
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp39
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h1
2 files changed, 33 insertions, 7 deletions
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<GameObject>, 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)); }