aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/3.3.5/2016_08_29_00_world.sql3
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h2
-rw-r--r--src/server/game/Entities/Player/Player.cpp2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp35
4 files changed, 32 insertions, 10 deletions
diff --git a/sql/updates/world/3.3.5/2016_08_29_00_world.sql b/sql/updates/world/3.3.5/2016_08_29_00_world.sql
new file mode 100644
index 00000000000..6f948e61cf5
--- /dev/null
+++ b/sql/updates/world/3.3.5/2016_08_29_00_world.sql
@@ -0,0 +1,3 @@
+ALTER TABLE `gameobject_template`
+ADD COLUMN `mingold` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `unk1`,
+ADD COLUMN `maxgold` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `mingold`;
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 455e68463e1..6e2d50120f8 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -43,6 +43,8 @@ struct GameObjectTemplate
std::string IconName;
std::string castBarCaption;
std::string unk1;
+ uint32 mingold;
+ uint32 maxgold;
uint32 faction;
uint32 flags;
float size;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 4656b0a3c2e..9f19e912c94 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -8383,6 +8383,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
group->UpdateLooterGuid(go);
}
+ loot->generateMoneyLoot(go->GetGOInfo()->mingold, go->GetGOInfo()->maxgold);
+
if (loot_type == LOOT_FISHING)
go->getFishLoot(loot, this);
else if (loot_type == LOOT_FISHING_JUNK)
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index da98a7b0e1c..1905c47ac32 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -6736,11 +6736,11 @@ void ObjectMgr::LoadGameObjectTemplate()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3 4 5 6 7 8 9
- QueryResult result = WorldDatabase.Query("SELECT entry, type, displayId, name, IconName, castBarCaption, unk1, faction, flags, size, "
- // 10 11 12 13 14 15 16 17 18 19 20 21 22
+ // 0 1 2 3 4 5 6 7 8 9 10 11
+ QueryResult result = WorldDatabase.Query("SELECT entry, type, displayId, name, IconName, castBarCaption, unk1, mingold, maxgold, faction, flags, size, "
+ // 12 13 14 15 16 17 18 19 20 21 22 23 24
"Data0, Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11, Data12, "
- // 23 24 25 26 27 28 29 30 31 32 33 34 35
+ // 25 26 27 28 29 30 31 32 33 34 35 36 37
"Data13, Data14, Data15, Data16, Data17, Data18, Data19, Data20, Data21, Data22, Data23, AIName, ScriptName "
"FROM gameobject_template");
@@ -6767,15 +6767,17 @@ void ObjectMgr::LoadGameObjectTemplate()
got.IconName = fields[4].GetString();
got.castBarCaption = fields[5].GetString();
got.unk1 = fields[6].GetString();
- got.faction = uint32(fields[7].GetUInt16());
- got.flags = fields[8].GetUInt32();
- got.size = fields[9].GetFloat();
+ got.mingold = fields[7].GetUInt32();
+ got.maxgold = fields[8].GetUInt32();
+ got.faction = uint32(fields[9].GetUInt16());
+ got.flags = fields[10].GetUInt32();
+ got.size = fields[11].GetFloat();
for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
- got.raw.data[i] = fields[10 + i].GetInt32(); // data1 and data6 can be -1
+ got.raw.data[i] = fields[12 + i].GetInt32(); // data1 and data6 can be -1
- got.AIName = fields[34].GetString();
- got.ScriptId = GetScriptId(fields[35].GetString());
+ got.AIName = fields[36].GetString();
+ got.ScriptId = GetScriptId(fields[37].GetString());
// Checks
@@ -6910,6 +6912,19 @@ void ObjectMgr::LoadGameObjectTemplate()
break;
}
+ if (got.maxgold > 0)
+ {
+ switch (got.type)
+ {
+ case GAMEOBJECT_TYPE_CHEST:
+ case GAMEOBJECT_TYPE_FISHINGHOLE:
+ break;
+ default:
+ TC_LOG_ERROR("sql.sql", "GameObject (Entry %u GoType: %u) cannot be looted but has maxgold set", entry, got.type);
+ break;
+ }
+ }
+
++count;
}
while (result->NextRow());