aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Utilities/Random.cpp8
-rw-r--r--src/common/Utilities/Random.h4
-rw-r--r--src/server/game/Accounts/RBAC.h4
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp18
-rw-r--r--src/server/game/Conditions/ConditionMgr.h10
5 files changed, 34 insertions, 10 deletions
diff --git a/src/common/Utilities/Random.cpp b/src/common/Utilities/Random.cpp
index cc013110b01..31318e8f52d 100644
--- a/src/common/Utilities/Random.cpp
+++ b/src/common/Utilities/Random.cpp
@@ -61,6 +61,14 @@ float frand(float min, float max)
return float(GetRng()->Random() * (max - min) + min);
}
+Milliseconds randtime(Milliseconds const& min, Milliseconds const& max)
+{
+ long long diff = max.count() - min.count();
+ ASSERT(diff >= 0);
+ ASSERT(diff <= (uint32)-1);
+ return min + Milliseconds(urand(0, diff));
+}
+
uint32 rand32()
{
return GetRng()->BRandom();
diff --git a/src/common/Utilities/Random.h b/src/common/Utilities/Random.h
index 5610651a83b..5dea6117f97 100644
--- a/src/common/Utilities/Random.h
+++ b/src/common/Utilities/Random.h
@@ -19,6 +19,7 @@
#define Random_h__
#include "Define.h"
+#include "Duration.h"
#include <limits>
#include <random>
@@ -34,6 +35,9 @@ uint32 urandms(uint32 min, uint32 max);
/* Return a random number in the range 0 .. UINT32_MAX. */
uint32 rand32();
+/* Return a random time in the range min..max (up to millisecond precision). Only works for values where millisecond difference is a valid uint32. */
+Milliseconds randtime(Milliseconds const& min, Milliseconds const& max);
+
/* Return a random number in the range min..max */
float frand(float min, float max);
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h
index 4ebd3ae7042..3f5db56558b 100644
--- a/src/server/game/Accounts/RBAC.h
+++ b/src/server/game/Accounts/RBAC.h
@@ -670,8 +670,8 @@ enum RBACPermissions
RBAC_PERM_COMMAND_WP_UNLOAD = 772,
RBAC_PERM_COMMAND_WP_RELOAD = 773,
RBAC_PERM_COMMAND_WP_SHOW = 774,
- RBAC_PERM_COMMAND_MODIFY_CURRENCY = 775, // only 4.3.4
- RBAC_PERM_COMMAND_DEBUG_PHASE = 776, // only 4.3.4
+ RBAC_PERM_COMMAND_MODIFY_CURRENCY = 775, // only 6.x
+ RBAC_PERM_COMMAND_DEBUG_PHASE = 776, // only 6.x
RBAC_PERM_COMMAND_MAILBOX = 777,
RBAC_PERM_COMMAND_AHBOT = 778,
RBAC_PERM_COMMAND_AHBOT_ITEMS = 779,
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 81dc7894592..6da83aad1a8 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -55,7 +55,8 @@ char const* const ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX]
"SmartScript",
"Npc Vendor",
"Spell Proc",
- "Phase Def"
+ "Terrain Swap",
+ "Phase"
};
ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[CONDITION_MAX] =
@@ -101,6 +102,7 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND
{ "Health Pct", true, true, false },
{ "Realm Achievement", true, false, false },
{ "In Water", false, false, false },
+ { "Terrain Swap", false, false, false },
{ "Sit/stand state", true, true, false }
};
@@ -1650,9 +1652,14 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) const
}
break;
}
- case CONDITION_SOURCE_TYPE_PHASE_DEFINITION:
+ case CONDITION_SOURCE_TYPE_TERRAIN_SWAP:
{
- TC_LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_PHASE_DEFINITION:: is only for 4.3.4 branch, skipped");
+ TC_LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_TERRAIN_SWAP: is only for 6.x branch, skipped");
+ return false;
+ }
+ case CONDITION_SOURCE_TYPE_PHASE:
+ {
+ TC_LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_PHASE: is only for 6.x branch, skipped");
return false;
}
case CONDITION_SOURCE_TYPE_GOSSIP_MENU:
@@ -1670,7 +1677,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
{
if (cond->ConditionType == CONDITION_NONE || cond->ConditionType >= CONDITION_MAX)
{
- TC_LOG_ERROR("sql.sql", "%s Invalid ConditionType in `condition` table, ignoring.", cond->ToString().c_str());
+ TC_LOG_ERROR("sql.sql", "%s Invalid ConditionType in `condition` table, ignoring.", cond->ToString(true).c_str());
return false;
}
@@ -2107,6 +2114,9 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
}
case CONDITION_IN_WATER:
break;
+ case CONDITION_TERRAIN_SWAP:
+ TC_LOG_ERROR("sql.sql", "%s is not valid for this branch, skipped.", cond->ToString(true).c_str());
+ return false;
case CONDITION_STAND_STATE:
{
bool valid = false;
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 3123aaca86a..7dc4592a6a9 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -71,8 +71,9 @@ enum ConditionTypes
CONDITION_HP_PCT = 38, // hpPct ComparisonType 0 true if unit's hp matches given pct
CONDITION_REALM_ACHIEVEMENT = 39, // achievement_id 0 0 true if realm achievement is complete
CONDITION_IN_WATER = 40, // 0 0 0 true if unit in water
- CONDITION_STAND_STATE = 41, // stateType state 0 true if unit matches specified sitstate (0,x: has exactly state x; 1,0: any standing state; 1,1: any sitting state;)
- CONDITION_MAX = 42 // MAX
+ CONDITION_TERRAIN_SWAP = 41, // only for 6.x
+ CONDITION_STAND_STATE = 42, // stateType state 0 true if unit matches specified sitstate (0,x: has exactly state x; 1,0: any standing state; 1,1: any sitting state;)
+ CONDITION_MAX = 43 // MAX
};
/*! Documentation on implementing a new ConditionSourceType:
@@ -129,8 +130,9 @@ enum ConditionSourceType
CONDITION_SOURCE_TYPE_SMART_EVENT = 22,
CONDITION_SOURCE_TYPE_NPC_VENDOR = 23,
CONDITION_SOURCE_TYPE_SPELL_PROC = 24,
- CONDITION_SOURCE_TYPE_PHASE_DEFINITION = 25, // only 4.3.4
- CONDITION_SOURCE_TYPE_MAX = 26 // MAX
+ CONDITION_SOURCE_TYPE_TERRAIN_SWAP = 25, // only 6.x
+ CONDITION_SOURCE_TYPE_PHASE = 26, // only 6.x
+ CONDITION_SOURCE_TYPE_MAX = 27 // MAX
};
enum RelationType