DB/WorldStateExpression: Difference between revisions

From wowdev
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 1: Line 1:
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.
expression is a flattened AST. is bytewise.  
 
struct expression {
  char is_enabled; // eval to 0 otherwise
  value v;
};
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 {
        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;
    }
  }
};
 
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.


{{Template:Sandbox/VersionRange|min_expansionlevel=5}}
{{Template:Sandbox/VersionRange|min_expansionlevel=5}}

Revision as of 14:35, 8 September 2019

expression is a flattened AST. is bytewise.

struct expression {
  char is_enabled; // eval to 0 otherwise
  value v;
};
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 {
        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;
    }
  }
};

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.

≥ Mists

6.0.1.18179

struct WorldStateExpressionRec {
  uint32_t m_ID;
  stringref m_expression;
};