DB/WorldStateExpression: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 3: | Line 3: | ||
First is enabled == always 1. then, operand {0 (disabled), 1 (uint32), 2 (worldStateID (evals to something other than id, likely something in worldStateRec)), 3 (uint8 op, recurse left, recurse right; where op <=0xc: none, random, month, day, timeofday, region, clockHour, difficultyID, holidayStart, holidayLeft, holidayActive, currentTime, weeknumber)}, then op {1: +, 2:-, 3:*, 4*/, 5:%, 0: no op}, then op2 {…. See CGWorldStateInfo::EvalWorldStateExpression. | First is enabled == always 1. then, operand {0 (disabled), 1 (uint32), 2 (worldStateID (evals to something other than id, likely something in worldStateRec)), 3 (uint8 op, recurse left, recurse right; where op <=0xc: none, random, month, day, timeofday, region, clockHour, difficultyID, holidayStart, holidayLeft, holidayActive, currentTime, weeknumber)}, then op {1: +, 2:-, 3:*, 4*/, 5:%, 0: no op}, then op2 {…. See CGWorldStateInfo::EvalWorldStateExpression. | ||
enum arith_operand { | enum arith_operand : char { | ||
id = 0, // lhs; DO NOT READ RHS | id = 0, // lhs; DO NOT READ RHS | ||
add = 1, // lhs + rhs | add = 1, // lhs + rhs | ||
Line 12: | Line 12: | ||
}; | }; | ||
enum log_operand { | enum log_operand : char { | ||
id = 0, // lhs; do not read rhs? | id = 0, // lhs; do not read rhs? | ||
eq = 1, // lhs = rhs | eq = 1, // lhs = rhs | ||
Line 34: | Line 34: | ||
break; | break; | ||
case 3: | case 3: | ||
enum function_id { | enum function_id : int { | ||
none = 0, // => 0 | none = 0, // => 0 | ||
random = 1, // min, max => random in [min, max) | random = 1, // min, max => random in [min, max) |
Revision as of 15:41, 8 September 2019
expression is a flattened AST. is bytewise.
First is enabled == always 1. then, operand {0 (disabled), 1 (uint32), 2 (worldStateID (evals to something other than id, likely something in worldStateRec)), 3 (uint8 op, recurse left, recurse right; where op <=0xc: none, random, month, day, timeofday, region, clockHour, difficultyID, holidayStart, holidayLeft, holidayActive, currentTime, weeknumber)}, then op {1: +, 2:-, 3:*, 4*/, 5:%, 0: no op}, then op2 {…. See CGWorldStateInfo::EvalWorldStateExpression.
enum arith_operand : char { id = 0, // lhs; DO NOT READ RHS add = 1, // lhs + rhs sub = 2, // lhs - rhs mul = 3, // lhs * rhs div = 4, // rhs ≠ 0 ? (lhs / rhs) : 0 mod = 5, // rhs ≠ 0 ? (lhs % rhs) : 0 };
enum log_operand : char { id = 0, // lhs; do not read rhs? eq = 1, // lhs = rhs ne = 2, // lhs ≠ rhs lt = 3, // lhs < rhs le = 4, // lhs ≤ rhs gt = 5, // lhs > rhs ge = 6, // lhs ≥ rhs };
struct value { char type; switch (type) { case 1: int value; // result = value break; case 2: int world_state_id; // result = current world state value of given state break; case 3: enum function_id : int { none = 0, // => 0 random = 1, // min, max => random in [min, max) month = 2, // => g_clientGameTime.month + 1 day = 3, // => g_clientGameTime.day + 1 time_of_day = 4, // => g_clientGameTime.GetHourAndMinutes() (in minutes) region = 5, // => CGServerInfo::regionID clock_hour = 6, // => g_clientGameTime.hours % 12 difficulty_id = 7, // => CGGameUI::m_instanceDifficultyID holiday_start = 8, // holiday_id, duration_id => minutes to begin holiday_left = 9, // holiday_id, duration_id => minutes to end holiday_active = 10, // holiday_id => 1 if any left > 0 timer_current_time = 11, // => time(nullptr) week_number = 12, // => weeks since raid origin }; function_id type; value lhs; // note: regardless of number of used arguments! value rhs; // result = fun(lhs, rhs) break; } } };
6.0.1.18179
struct WorldStateExpressionRec { uint32_t m_ID; stringrefⁱ m_expression; };