[7344] Ignore drop rate multipliers in loot groups. Author: Velorien
For grouped loot use rates create problems with impossibility loot some items including quest items. --HG-- branch : trunk
This commit is contained in:
+8
-10
@@ -58,7 +58,7 @@ class LootTemplate::LootGroup // A set of loot def
|
|||||||
bool HasQuestDrop() const; // True if group includes at least 1 quest drop entry
|
bool HasQuestDrop() const; // True if group includes at least 1 quest drop entry
|
||||||
bool HasQuestDropForPlayer(Player const * player) const;
|
bool HasQuestDropForPlayer(Player const * player) const;
|
||||||
// The same for active quests of the player
|
// 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 RawTotalChance() const; // Overall chance for the group (without equal chanced items)
|
||||||
float TotalChance() const; // Overall chance for the group
|
float TotalChance() const; // Overall chance for the group
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ class LootTemplate::LootGroup // A set of loot def
|
|||||||
LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB
|
LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB
|
||||||
LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance
|
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
|
//Remove all data and free all memory
|
||||||
@@ -792,7 +792,7 @@ void LootTemplate::LootGroup::AddEntry(LootStoreItem& item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rolls an item from the group, returns NULL if all miss their chances
|
// 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
|
if (!ExplicitlyChanced.empty()) // First explicitly chanced entries are checked
|
||||||
{
|
{
|
||||||
@@ -803,9 +803,7 @@ LootStoreItem const * LootTemplate::LootGroup::Roll(bool rate) const
|
|||||||
if(ExplicitlyChanced[i].chance>=100.f)
|
if(ExplicitlyChanced[i].chance>=100.f)
|
||||||
return &ExplicitlyChanced[i];
|
return &ExplicitlyChanced[i];
|
||||||
|
|
||||||
ItemPrototype const *pProto = objmgr.GetItemPrototype(ExplicitlyChanced[i].itemid);
|
Roll -= ExplicitlyChanced[i].chance;
|
||||||
//float qualityMultiplier = pProto && rate ? sWorld.getRate(qualityToRate[pProto->Quality]) : 1.0f;
|
|
||||||
Roll -= ExplicitlyChanced[i].chance;// * qualityMultiplier;
|
|
||||||
if (Roll < 0)
|
if (Roll < 0)
|
||||||
return &ExplicitlyChanced[i];
|
return &ExplicitlyChanced[i];
|
||||||
}
|
}
|
||||||
@@ -841,9 +839,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
|
// 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)
|
if (item != NULL)
|
||||||
loot.AddItem(*item);
|
loot.AddItem(*item);
|
||||||
}
|
}
|
||||||
@@ -935,7 +933,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
|||||||
if (groupId > Groups.size())
|
if (groupId > Groups.size())
|
||||||
return; // Error message already printed at loading stage
|
return; // Error message already printed at loading stage
|
||||||
|
|
||||||
Groups[groupId-1].Process(loot,rate);
|
Groups[groupId-1].Process(loot);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -961,7 +959,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
|||||||
|
|
||||||
// Now processing groups
|
// Now processing groups
|
||||||
for (LootGroups::const_iterator i = Groups.begin( ) ; i != Groups.end( ) ; ++i )
|
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
|
// True if template includes at least 1 quest drop entry
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7342"
|
#define REVISION_NR "7344"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|||||||
Reference in New Issue
Block a user