summaryrefslogtreecommitdiff
path: root/src/server/game/Conditions
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Conditions')
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp44
-rw-r--r--src/server/game/Conditions/ConditionMgr.h13
-rw-r--r--src/server/game/Conditions/DisableMgr.cpp61
-rw-r--r--src/server/game/Conditions/DisableMgr.h10
4 files changed, 86 insertions, 42 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index bb6fa29c49..add31c1b18 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
@@ -542,6 +542,23 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
condMeets = object->GetMap()->GetDifficulty() == ConditionValue1;
break;
}
+ case CONDITION_RANDOM_DUNGEON:
+ {
+ if (Unit* unit = object->ToUnit())
+ {
+ if (Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself())
+ {
+ if (sLFGMgr->selectedRandomLfgDungeon(player->GetGUID()))
+ {
+ if (!ConditionValue1)
+ condMeets = true;
+ else if (Map* map = player->GetMap())
+ condMeets = map->GetDifficulty() == Difficulty(ConditionValue2);
+ }
+ }
+ }
+ break;
+ }
case CONDITION_PET_TYPE:
{
if (Unit* unit = object->ToUnit())
@@ -786,6 +803,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
case CONDITION_CHARMED:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
+ case CONDITION_RANDOM_DUNGEON:
+ mask |= GRID_MAP_TYPE_MASK_PLAYER;
+ break;
case CONDITION_WORLD_SCRIPT:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
@@ -2466,6 +2486,20 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
return false;
}
break;
+ case CONDITION_RANDOM_DUNGEON:
+ if (cond->ConditionValue1 > 1)
+ {
+ LOG_ERROR("sql.sql", "RandomDungeon condition has useless data in value1 ({}).", cond->ConditionValue1);
+ return false;
+ }
+ if (cond->ConditionValue2 >= MAX_DIFFICULTY)
+ {
+ LOG_ERROR("sql.sql", "RandomDungeon condition has invalid difficulty in value2 ({}).", cond->ConditionValue1);
+ return false;
+ }
+ if (cond->ConditionValue3)
+ LOG_ERROR("sql.sql", "RandomDungeon condition has useless data in value3 ({}).", cond->ConditionValue3);
+ break;
case CONDITION_PET_TYPE:
if (cond->ConditionValue1 >= (1 << MAX_PET_TYPE))
{
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index eaa1d14e21..c472451a3f 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
@@ -88,8 +88,9 @@ enum ConditionTypes
CONDITION_HAS_AURA_TYPE = 102, // aura_type 0 0 true if has aura type
CONDITION_WORLD_SCRIPT = 103, // conditionId state 0 true if WorldState::IsConditionFulfilled returns true
CONDITION_AI_DATA = 104, // dataId value 0 true if AI::GetData returns value
+ CONDITION_RANDOM_DUNGEON = 105, // difficulty (0 = any) 0 0 true if player is queued for a random dungeon via RDF (param1 = Difficulty)
- CONDITION_AC_END = 105 // placeholder
+ CONDITION_AC_END = 106 // placeholder
};
/*! Documentation on implementing a new ConditionSourceType:
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index abb9681beb..c02c7c6819 100644
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
@@ -388,30 +388,39 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* unit,
}
case DISABLE_TYPE_MAP:
case DISABLE_TYPE_LFG_MAP:
- if (Player const* player = unit->ToPlayer())
+ {
+ MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
+ if (!mapEntry)
+ return false;
+
+ if (!mapEntry->IsDungeon())
+ return mapEntry->map_type == MAP_COMMON;
+
+ uint8 disabledModes = itr->second.flags;
+
+ Difficulty targetDifficulty;
+ if (unit && unit->IsPlayer())
+ targetDifficulty = unit->ToPlayer()->GetDifficulty(mapEntry->IsRaid());
+ else
+ targetDifficulty = Difficulty(flags);
+
+ GetDownscaledMapDifficultyData(entry, targetDifficulty);
+
+ switch (targetDifficulty)
{
- MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
- if (mapEntry->IsDungeon())
- {
- uint8 disabledModes = itr->second.flags;
- Difficulty targetDifficulty = player->GetDifficulty(mapEntry->IsRaid());
- GetDownscaledMapDifficultyData(entry, targetDifficulty);
- switch (targetDifficulty)
- {
- case DUNGEON_DIFFICULTY_NORMAL:
- return disabledModes & DUNGEON_STATUSFLAG_NORMAL;
- case DUNGEON_DIFFICULTY_HEROIC:
- return disabledModes & DUNGEON_STATUSFLAG_HEROIC;
- case RAID_DIFFICULTY_10MAN_HEROIC:
- return disabledModes & RAID_STATUSFLAG_10MAN_HEROIC;
- case RAID_DIFFICULTY_25MAN_HEROIC:
- return disabledModes & RAID_STATUSFLAG_25MAN_HEROIC;
- }
- }
- else if (mapEntry->map_type == MAP_COMMON)
- return true;
+ case DUNGEON_DIFFICULTY_NORMAL:
+ return disabledModes & DUNGEON_STATUSFLAG_NORMAL;
+ case DUNGEON_DIFFICULTY_HEROIC:
+ return disabledModes & DUNGEON_STATUSFLAG_HEROIC;
+ case RAID_DIFFICULTY_10MAN_HEROIC:
+ return disabledModes & RAID_STATUSFLAG_10MAN_HEROIC;
+ case RAID_DIFFICULTY_25MAN_HEROIC:
+ return disabledModes & RAID_STATUSFLAG_25MAN_HEROIC;
+ default:
+ return false;
}
return false;
+ }
case DISABLE_TYPE_VMAP:
return flags & itr->second.flags;
case DISABLE_TYPE_QUEST:
diff --git a/src/server/game/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h
index bfad29a4d6..8b0ae668b4 100644
--- a/src/server/game/Conditions/DisableMgr.h
+++ b/src/server/game/Conditions/DisableMgr.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along