[11830] Do not allow referenced loot with negative chance, bug found by crackm

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2011-10-16 21:33:53 +02:00
parent 15028559c9
commit 428b7b9178
2 changed files with 15 additions and 14 deletions

View file

@ -127,8 +127,7 @@ void LootStore::LoadLootTable()
if (mincountOrRef < 0 && condition != CONDITION_NONE)
{
sLog.outErrorDb("Table '%s' entry %u mincountOrRef %i < 0 and not allowed has condition, skipped",
GetName(), entry, mincountOrRef);
sLog.outErrorDb("Table '%s' entry %u mincountOrRef %i < 0 and not allowed has condition, skipped", GetName(), entry, mincountOrRef);
continue;
}
@ -290,8 +289,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
if (chance != 0 && chance < 0.000001f) // loot with low chance
{
sLog.outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped",
store.GetName(), entry, itemid, chance);
sLog.outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped", store.GetName(), entry, itemid, chance);
return false;
}
@ -305,7 +303,10 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
else // mincountOrRef < 0
{
if (needs_quest)
sLog.outErrorDb("Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid);
{
sLog.outErrorDb("Table '%s' entry %d item %d: negative chance is specified for a reference, skipped", store.GetName(), entry, itemid);
return false;
}
else if (chance == 0) // no chance for the reference
{
sLog.outErrorDb("Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11829"
#define REVISION_NR "11830"
#endif // __REVISION_NR_H__