[7344] Ignore drop rate multipliers in loot groups.

For grouped loot use rates create problems with impossibility loot some items including quest items.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Velorien 2009-02-26 09:17:52 +03:00 committed by VladimirMangos
parent 3dd6b69adb
commit aba675c4ca
2 changed files with 9 additions and 11 deletions

View file

@ -55,7 +55,7 @@ class LootTemplate::LootGroup // A set of loot def
bool HasQuestDrop() const; // True if group includes at least 1 quest drop entry
bool HasQuestDropForPlayer(Player const * player) const;
// The same for active quests of the player
void Process(Loot& loot, bool rate) const; // Rolls an item from the group (if any) and adds the item to the loot
void Process(Loot& loot) const; // Rolls an item from the group (if any) and adds the item to the loot
float RawTotalChance() const; // Overall chance for the group (without equal chanced items)
float TotalChance() const; // Overall chance for the group
@ -66,7 +66,7 @@ class LootTemplate::LootGroup // A set of loot def
LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB
LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance
LootStoreItem const * Roll(bool rate) const; // Rolls an item from the group, returns NULL if all miss their chances
LootStoreItem const * Roll() const; // Rolls an item from the group, returns NULL if all miss their chances
};
//Remove all data and free all memory
@ -789,7 +789,7 @@ void LootTemplate::LootGroup::AddEntry(LootStoreItem& item)
}
// Rolls an item from the group, returns NULL if all miss their chances
LootStoreItem const * LootTemplate::LootGroup::Roll(bool rate) const
LootStoreItem const * LootTemplate::LootGroup::Roll() const
{
if (!ExplicitlyChanced.empty()) // First explicitly chanced entries are checked
{
@ -800,9 +800,7 @@ LootStoreItem const * LootTemplate::LootGroup::Roll(bool rate) const
if(ExplicitlyChanced[i].chance>=100.f)
return &ExplicitlyChanced[i];
ItemPrototype const *pProto = objmgr.GetItemPrototype(ExplicitlyChanced[i].itemid);
float qualityMultiplier = pProto && rate ? sWorld.getRate(qualityToRate[pProto->Quality]) : 1.0f;
Roll -= ExplicitlyChanced[i].chance * qualityMultiplier;
Roll -= ExplicitlyChanced[i].chance;
if (Roll < 0)
return &ExplicitlyChanced[i];
}
@ -838,9 +836,9 @@ bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const * player) const
}
// Rolls an item from the group (if any takes its chance) and adds the item to the loot
void LootTemplate::LootGroup::Process(Loot& loot, bool rate) const
void LootTemplate::LootGroup::Process(Loot& loot) const
{
LootStoreItem const * item = Roll(rate);
LootStoreItem const * item = Roll();
if (item != NULL)
loot.AddItem(*item);
}
@ -932,7 +930,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
if (groupId > Groups.size())
return; // Error message already printed at loading stage
Groups[groupId-1].Process(loot,rate);
Groups[groupId-1].Process(loot);
return;
}
@ -958,7 +956,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
// Now processing groups
for (LootGroups::const_iterator i = Groups.begin( ) ; i != Groups.end( ) ; ++i )
i->Process(loot,rate);
i->Process(loot);
}
// True if template includes at least 1 quest drop entry

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7343"
#define REVISION_NR "7344"
#endif // __REVISION_NR_H__