Skip to content

Commit 08ed60e

Browse files
GultaskHelias
andauthored
feat(Core/SmartScripts): Implement Target Type for Formations (#3679)
Co-authored-by: Helias <stefanoborzi32@gmail.com>
1 parent f6b5881 commit 08ed60e

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

libs/shared/sai-editor/src/constants/sai-targets.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export enum SAI_TARGETS {
3636
ROLE_SELECTION = 203,
3737
SUMMONED_CREATURES = 204,
3838
INSTANCE_STORAGE = 205,
39+
FORMATION = 206,
3940
}
4041

4142
export const SAI_TARGETS_KEYS = getEnumKeys(SAI_TARGETS);
@@ -312,3 +313,12 @@ SAI_TARGET_TOOLTIPS[SAI_TARGETS.INSTANCE_STORAGE] = '';
312313
SAI_TARGET_PARAM1_NAMES[SAI_TARGETS.INSTANCE_STORAGE] = 'Data Index';
313314
SAI_TARGET_PARAM2_NAMES[SAI_TARGETS.INSTANCE_STORAGE] = 'Type';
314315
SAI_TARGET_PARAM2_TOOLTIPS[SAI_TARGETS.INSTANCE_STORAGE] = 'creature (1), gameobject (2)';
316+
317+
// SMART_TARGET_FORMATION
318+
SAI_TARGET_TOOLTIPS[SAI_TARGETS.FORMATION] = 'Targets members of the creature\'s formation group (creature_formations table). Dead members are excluded.';
319+
SAI_TARGET_PARAM1_NAMES[SAI_TARGETS.FORMATION] = 'Type';
320+
SAI_TARGET_PARAM2_NAMES[SAI_TARGETS.FORMATION] = 'CreatureEntry';
321+
SAI_TARGET_PARAM3_NAMES[SAI_TARGETS.FORMATION] = 'ExcludeSelf';
322+
SAI_TARGET_PARAM1_TOOLTIPS[SAI_TARGETS.FORMATION] = '0: members only, 1: leader only, 2: all';
323+
SAI_TARGET_PARAM2_TOOLTIPS[SAI_TARGETS.FORMATION] = '0: any entry';
324+
SAI_TARGET_PARAM3_TOOLTIPS[SAI_TARGETS.FORMATION] = '(0/1) exclude this creature';

libs/shared/sai-editor/src/sai-comment-generator.service.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,14 @@ describe('SaiCommentGeneratorService', () => {
11391139
},
11401140
expected: `MockEntity - In Combat - Move To Loot Recipients`,
11411141
},
1142+
{
1143+
name: `SAI_ACTIONS.MOVE_TO_POS check target type (unsupported target type)`,
1144+
input: {
1145+
action_type: SAI_ACTIONS.MOVE_TO_POS,
1146+
target_type: 99999,
1147+
},
1148+
expected: `MockEntity - In Combat - Move To [unsupported target type]`,
1149+
},
11421150
{
11431151
name: `SAI_ACTIONS.GO_SET_LOOT_STATE check action param 1 (0)`,
11441152
input: {
@@ -1961,6 +1969,15 @@ describe('SaiCommentGeneratorService', () => {
19611969
},
19621970
expected: `MockEntity - In Combat - Move To Instance Storage`,
19631971
},
1972+
{
1973+
name: `SAI_ACTIONS.MOVE_TO_POS check target type (SAI_TARGETS.FORMATION)`,
1974+
input: {
1975+
action_type: SAI_ACTIONS.MOVE_TO_POS,
1976+
target_type: SAI_TARGETS.FORMATION,
1977+
target_param1: 0,
1978+
},
1979+
expected: `MockEntity - In Combat - Move To Formation`,
1980+
},
19641981
{
19651982
name: `SAI_ACTIONS.MOVE_TO_POS check target type (unsupported target type)`,
19661983
input: {

libs/shared/sai-editor/src/sai-comment-generator.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ export class SaiCommentGeneratorService {
9191
return 'Summoned Creatures';
9292
case SAI_TARGETS.INSTANCE_STORAGE:
9393
return 'Instance Storage';
94+
case SAI_TARGETS.FORMATION:
95+
return 'Formation';
9496
default:
9597
return '[unsupported target type]';
9698
}

0 commit comments

Comments
 (0)