Core/Conditions: Implemented new condition type CONDITION_BATTLE_PET_COUNT to check how many copies of a battle pet are collected

Port From (https://github.com/TrinityCore/TrinityCore/commit/b5a67cf17dbf18369a2a3370d9d45ca6c56e8cc7)
This commit is contained in:
hondacrx
2022-05-04 10:31:48 -04:00
parent a4dfc261a4
commit 1a2251e58d
3 changed files with 25 additions and 0 deletions
@@ -1724,6 +1724,23 @@ namespace Game
return false;
}
break;
case ConditionTypes.BattlePetCount:
if (!CliDB.BattlePetSpeciesStorage.ContainsKey(cond.ConditionValue1))
{
Log.outError(LogFilter.Sql, $"{cond.ToString(true)} has non existing BattlePet SpeciesId in value1 ({cond.ConditionValue1}), skipped.");
return false;
}
if (cond.ConditionValue2 > SharedConst.DefaultMaxBattlePetsPerSpecies)
{
Log.outError(LogFilter.Sql, $"{cond.ToString(true)} has invalid (greater than {SharedConst.DefaultMaxBattlePetsPerSpecies}) value2 ({cond.ConditionValue2}), skipped.");
return false;
}
if (cond.ConditionValue3 >= (uint)ComparisionType.Max)
{
Log.outError(LogFilter.Sql, $"{cond.ToString(true)} has invalid ComparisionType ({cond.ConditionValue3}), skipped.");
return false;
}
break;
default:
Log.outError(LogFilter.Sql, $"{cond.ToString()} Invalid ConditionType in `condition` table, ignoring.");
return false;