mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[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:
parent
15028559c9
commit
428b7b9178
2 changed files with 15 additions and 14 deletions
|
|
@ -127,8 +127,7 @@ void LootStore::LoadLootTable()
|
||||||
|
|
||||||
if (mincountOrRef < 0 && condition != CONDITION_NONE)
|
if (mincountOrRef < 0 && condition != CONDITION_NONE)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table '%s' entry %u mincountOrRef %i < 0 and not allowed has condition, skipped",
|
sLog.outErrorDb("Table '%s' entry %u mincountOrRef %i < 0 and not allowed has condition, skipped", GetName(), entry, mincountOrRef);
|
||||||
GetName(), entry, mincountOrRef);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -290,8 +289,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
|
||||||
|
|
||||||
if (chance != 0 && chance < 0.000001f) // loot with low chance
|
if (chance != 0 && chance < 0.000001f) // loot with low chance
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped",
|
sLog.outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped", store.GetName(), entry, itemid, chance);
|
||||||
store.GetName(), entry, itemid, chance);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -305,7 +303,10 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
|
||||||
else // mincountOrRef < 0
|
else // mincountOrRef < 0
|
||||||
{
|
{
|
||||||
if (needs_quest)
|
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
|
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);
|
sLog.outErrorDb("Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11829"
|
#define REVISION_NR "11830"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue