aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Loot/LootMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Loot/LootMgr.cpp')
-rw-r--r--src/server/game/Loot/LootMgr.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 02fc7b7762e..07504c41c02 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -271,6 +271,8 @@ bool LootStoreItem::Roll(bool rate) const
return roll_chance_f(chance * qualityModifier);
}
+ case Type::TrackingQuest:
+ return roll_chance_f(chance);
default:
break;
}
@@ -364,6 +366,45 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
}
break;
}
+ case Type::TrackingQuest:
+ {
+ Quest const* quest = sObjectMgr->GetQuestTemplate(itemid);
+ if (!quest)
+ {
+ TC_LOG_ERROR("sql.sql", "Table '{}' Entry {} ItemType {} Item {}: quest does not exist - skipped",
+ store.GetName(), entry, type, itemid);
+ return false;
+ }
+
+ if (!quest->HasFlag(QUEST_FLAGS_TRACKING_EVENT))
+ {
+ TC_LOG_ERROR("sql.sql", "Table '{}' Entry {} ItemType {} Item {}: quest is not a tracking flag - skipped",
+ store.GetName(), entry, type, itemid);
+ return false;
+ }
+
+ if (chance == 0 && groupid == 0) // Zero chance is allowed for grouped entries only
+ {
+ TC_LOG_ERROR("sql.sql", "Table '{}' Entry {} ItemType {} Item {}: equal-chanced grouped entry, but group not defined - skipped",
+ store.GetName(), entry, type, itemid);
+ return false;
+ }
+
+ if (chance != 0 && chance < 0.0001f) // loot with low chance
+ {
+ TC_LOG_ERROR("sql.sql", "Table '{}' Entry {} ItemType {} Item {}: low chance ({}) - skipped",
+ store.GetName(), entry, type, itemid, chance);
+ return false;
+ }
+
+ if (mincount != 1 || maxcount) // wrong count
+ {
+ TC_LOG_ERROR("sql.sql", "Table '{}' Entry {} ItemType {} Item {}: tracking quest has count other than 1 (MinCount {} MaxCount {}) - skipped",
+ store.GetName(), entry, type, itemid, int32(maxcount), mincount);
+ return false;
+ }
+ break;
+ }
default:
TC_LOG_ERROR("sql.sql", "Table '{}' Entry {} Item {}: invalid ItemType {}, skipped",
@@ -579,6 +620,10 @@ void LootTemplate::CopyConditions(LootItem* li) const
if (li->type != LootItemType::Currency)
continue;
break;
+ case LootStoreItem::Type::TrackingQuest:
+ if (li->type != LootItemType::TrackingQuest)
+ continue;
+ break;
default:
break;
}
@@ -619,6 +664,7 @@ void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId
{
case LootStoreItem::Type::Item:
case LootStoreItem::Type::Currency:
+ case LootStoreItem::Type::TrackingQuest:
// Plain entries (not a reference, not grouped)
// Chance is already checked, just add
if (!personalLooter || LootItem::AllowedForPlayer(personalLooter, *item, true))
@@ -729,6 +775,7 @@ void LootTemplate::ProcessPersonalLoot(std::unordered_map<Player*, std::unique_p
break;
}
case LootStoreItem::Type::Currency:
+ case LootStoreItem::Type::TrackingQuest:
{
// Plain entries (not a reference, not grouped)
// Chance is already checked, just add
@@ -786,6 +833,7 @@ bool LootTemplate::HasDropForPlayer(Player const* player, uint8 groupId, bool st
{
case LootStoreItem::Type::Item:
case LootStoreItem::Type::Currency:
+ case LootStoreItem::Type::TrackingQuest:
if (LootItem::AllowedForPlayer(player, *lootStoreItem, strictUsabilityCheck))
return true; // active quest drop found
break;