Skip to content

Commit

Permalink
Add new condition and smartAI for Worldstatescript and SMART_EVENT_IS…
Browse files Browse the repository at this point in the history
…_IN_MELEE_RANGE (#3179)

* add world state script condition

* add smart event is_in_melee_range

* add action world script
  • Loading branch information
sogladev authored Nov 23, 2024
1 parent c4cc800 commit 7b38834
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/keira/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,8 @@
"CONDITION_PET_TYPE": "mask",
"CONDITION_TAXI": "Always 0",
"CONDITION_QUESTSTATE": "quest_template.ID",
"CONDITION_QUEST_OBJECTIVE_PROGRESS": "quest_template.id"
"CONDITION_QUEST_OBJECTIVE_PROGRESS": "quest_template.id",
"CONDITION_WORLD_SCRIPT": "WorldStateCondition (defined in WorldState.h)"
},
"VALUE2": {
"CONDITION_NONE": "(Never used)",
Expand All @@ -703,7 +704,8 @@
"CONDITION_HP_PCT": "ComparisionType: 0 = Percentage of max HP must be equal; 1 = Percentage of max HP must be higher; 2 = Percentage of max HP must be lower; 3 = Percentage of max HP must be equal or higher; 4 = Percentage of max HP must be equal or lower",
"CONDITION_STAND_STATE": "Exact stand state, or generic state (stand/sit), depending on value 10 = Standing; 1 = Sitting",
"CONDITION_QUESTSTATE": "state_mask",
"CONDITION_QUEST_OBJECTIVE_PROGRESS": "Quest Objective ID - see quest_template.RequiredNpcOrGo"
"CONDITION_QUEST_OBJECTIVE_PROGRESS": "Quest Objective ID - see quest_template.RequiredNpcOrGo",
"CONDITION_WORLD_SCRIPT": "state, 0 = unused"
},
"VALUE3": {
"CONDITION_NONE": "(Never used)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ CONDITION_VALUE_1_TOOLTIPS[CT.CONDITION_PET_TYPE] = 'CONDITIONS.EDITOR.VALUE1.CO
CONDITION_VALUE_1_TOOLTIPS[CT.CONDITION_TAXI] = 'CONDITIONS.EDITOR.VALUE1.CONDITION_TAXI';
CONDITION_VALUE_1_TOOLTIPS[CT.CONDITION_QUESTSTATE] = 'CONDITIONS.EDITOR.VALUE1.CONDITION_QUESTSTATE';
CONDITION_VALUE_1_TOOLTIPS[CT.CONDITION_QUEST_OBJECTIVE_PROGRESS] = 'CONDITIONS.EDITOR.VALUE1.CONDITION_QUEST_OBJECTIVE_PROGRESS';
CONDITION_VALUE_1_TOOLTIPS[CT.CONDITION_WORLD_SCRIPT] = 'CONDITIONS.EDITOR.VALUE1.CONDITION_WORLD_SCRIPT';

export const CONDITION_VALUE_2_TOOLTIPS: Record<string, string> = {};
CONDITION_VALUE_2_TOOLTIPS[CT.CONDITION_NONE] = 'CONDITIONS.EDITOR.VALUE2.CONDITION_NONE';
Expand Down Expand Up @@ -184,6 +185,7 @@ CONDITION_VALUE_2_TOOLTIPS[CT.CONDITION_PET_TYPE] = 'ALWAYS_0';
CONDITION_VALUE_2_TOOLTIPS[CT.CONDITION_TAXI] = 'ALWAYS_0';
CONDITION_VALUE_2_TOOLTIPS[CT.CONDITION_QUESTSTATE] = 'CONDITIONS.EDITOR.VALUE2.CONDITION_QUESTSTATE';
CONDITION_VALUE_2_TOOLTIPS[CT.CONDITION_QUEST_OBJECTIVE_PROGRESS] = 'CONDITIONS.EDITOR.VALUE2.CONDITION_QUEST_OBJECTIVE_PROGRESS';
CONDITION_VALUE_2_TOOLTIPS[CT.CONDITION_WORLD_SCRIPT] = 'CONDITIONS.EDITOR.VALUE2.CONDITION_WORLD_SCRIPT';

export const CONDITION_VALUE_3_TOOLTIPS: Record<string, string> = {};
CONDITION_VALUE_3_TOOLTIPS[CT.CONDITION_NONE] = 'CONDITIONS.EDITOR.VALUE3.CONDITION_NONE';
Expand Down Expand Up @@ -235,3 +237,4 @@ CONDITION_VALUE_3_TOOLTIPS[CT.CONDITION_PET_TYPE] = 'ALWAYS_0';
CONDITION_VALUE_3_TOOLTIPS[CT.CONDITION_TAXI] = 'ALWAYS_0';
CONDITION_VALUE_3_TOOLTIPS[CT.CONDITION_QUESTSTATE] = 'ALWAYS_0';
CONDITION_VALUE_3_TOOLTIPS[CT.CONDITION_QUEST_OBJECTIVE_PROGRESS] = 'CONDITIONS.EDITOR.VALUE3.CONDITION_QUEST_OBJECTIVE_PROGRESS';
CONDITION_VALUE_3_TOOLTIPS[CT.CONDITION_WORLD_SCRIPT] = 'ALWAYS_0';
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,5 @@ export enum CONDITION_TYPES {
CONDITION_DIFFICULTY_ID,
CONDITION_QUEST_SATISFY_EXCLUSIVE = 101,
CONDITION_HAS_AURA_TYPE = 102,
CONDITION_WORLD_SCRIPT = 103,
}
6 changes: 6 additions & 0 deletions libs/shared/sai-editor/src/constants/sai-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export enum SAI_ACTIONS {
MOVEMENT_STOP = 234,
MOVEMENT_PAUSE = 235,
MOVEMENT_RESUME = 236,
WORLD_SCRIPT = 237,
}
export const SAI_ACTIONS_KEYS = getEnumKeys(SAI_ACTIONS);
export const SAI_ACTION_TOOLTIPS: Record<string, string> = {};
Expand Down Expand Up @@ -1301,3 +1302,8 @@ SAI_ACTION_PARAM1_TOOLTIPS[SAI_ACTIONS.MOVEMENT_PAUSE] = 'ms';
SAI_ACTION_TOOLTIPS[SAI_ACTIONS.MOVEMENT_RESUME] = 'Calls MovementGenerator to resume movement. Not fully implemented';
SAI_ACTION_PARAM1_NAMES[SAI_ACTIONS.MOVEMENT_RESUME] = 'Timer Override';
SAI_ACTION_PARAM1_TOOLTIPS[SAI_ACTIONS.MOVEMENT_RESUME] = 'ms';

// SMART_ACTION_WORLD_SCRIPT
SAI_ACTION_TOOLTIPS[SAI_ACTIONS.WORLD_SCRIPT] = 'Calls WorldState::HandleExternalEvent(WorldStateEvent eventId, uint32 param)';
SAI_ACTION_PARAM1_NAMES[SAI_ACTIONS.WORLD_SCRIPT] = 'eventId';
SAI_ACTION_PARAM2_NAMES[SAI_ACTIONS.WORLD_SCRIPT] = 'param';
2 changes: 2 additions & 0 deletions libs/shared/sai-editor/src/constants/sai-comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ SAI_EVENT_COMMENTS[SAI_EVENTS.AREA_RANGE] = `On Hostile in Range`;
SAI_EVENT_COMMENTS[SAI_EVENTS.SUMMONED_UNIT_EVADE] = `On Summoned Unit Evade`;
SAI_EVENT_COMMENTS[SAI_EVENTS.WAYPOINT_DATA_REACHED] = `On Point _waypointParamOne_ of Path _waypointParamTwo_ Reached`;
SAI_EVENT_COMMENTS[SAI_EVENTS.WAYPOINT_DATA_ENDED] = `On Path _eventParamTwo_ Finished`;
SAI_EVENT_COMMENTS[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'On Melee Range Target';

export const SAI_ACTION_COMMENTS: Record<string, string> = {};
SAI_ACTION_COMMENTS[SAI_ACTIONS.NONE] = `No Action Type`;
Expand Down Expand Up @@ -251,3 +252,4 @@ SAI_ACTION_COMMENTS[SAI_ACTIONS.WAYPOINT_DATA_RANDOM] = `Start Random Path _acti
SAI_ACTION_COMMENTS[SAI_ACTIONS.MOVEMENT_STOP] = `Stop Movement`;
SAI_ACTION_COMMENTS[SAI_ACTIONS.MOVEMENT_PAUSE] = `Pause Movement`;
SAI_ACTION_COMMENTS[SAI_ACTIONS.MOVEMENT_RESUME] = `Resume Movement`;
SAI_ACTION_COMMENTS[SAI_ACTIONS.WORLD_SCRIPT] = `Run World State Script: Event: _actionParamOne_, Param: _actionParamTwo_`;
16 changes: 16 additions & 0 deletions libs/shared/sai-editor/src/constants/sai-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export enum SAI_EVENTS {
SUMMONED_UNIT_EVADE = 107,
WAYPOINT_DATA_REACHED = 108,
WAYPOINT_DATA_ENDED = 109,
IS_IN_MELEE_RANGE = 110,
}
export const SAI_EVENTS_KEYS = getEnumKeys(SAI_EVENTS);
export const SAI_EVENT_TOOLTIPS: string[] = [];
Expand Down Expand Up @@ -719,3 +720,18 @@ SAI_EVENT_PARAM1_NAMES[SAI_EVENTS.WAYPOINT_DATA_ENDED] = 'PointId';
SAI_EVENT_PARAM2_NAMES[SAI_EVENTS.WAYPOINT_DATA_ENDED] = 'PathId';
SAI_EVENT_PARAM1_TOOLTIPS[SAI_EVENTS.WAYPOINT_DATA_ENDED] = 'unused';
SAI_EVENT_PARAM2_TOOLTIPS[SAI_EVENTS.WAYPOINT_DATA_ENDED] = '0: any';

// SMART_EVENT_IS_IN_MELEE_RANGE
SAI_EVENT_TOOLTIPS[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'On Melee Range Target';
SAI_EVENT_PARAM1_NAMES[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'InitialMin';
SAI_EVENT_PARAM2_NAMES[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'InitialMax';
SAI_EVENT_PARAM3_NAMES[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'RepeatMin';
SAI_EVENT_PARAM4_NAMES[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'RepeatMax';
SAI_EVENT_PARAM5_NAMES[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'dist';
SAI_EVENT_PARAM6_NAMES[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'invert';
SAI_EVENT_PARAM1_TOOLTIPS[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'ms';
SAI_EVENT_PARAM2_TOOLTIPS[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'ms';
SAI_EVENT_PARAM3_TOOLTIPS[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'ms';
SAI_EVENT_PARAM4_TOOLTIPS[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'ms';
SAI_EVENT_PARAM5_TOOLTIPS[SAI_EVENTS.IS_IN_MELEE_RANGE] = 'dist param IsWithinMeleeRange (yards), default: 0';
SAI_EVENT_PARAM6_TOOLTIPS[SAI_EVENTS.IS_IN_MELEE_RANGE] = '0: no invert, 1: invert';

0 comments on commit 7b38834

Please sign in to comment.