Skip to content

Commit

Permalink
feat: add event_param6 to SAI editor (azerothcore#2441)
Browse files Browse the repository at this point in the history
  • Loading branch information
Helias authored Sep 7, 2023
1 parent 8a25aa8 commit 8083118
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ describe('SaiCreatureComponent integration tests', () => {
expect(page.getInputById('event_param3').disabled).toBe(true);
expect(page.getInputById('event_param4').disabled).toBe(true);
expect(page.getInputById('event_param5').disabled).toBe(true);
expect(page.getInputById('event_param6').disabled).toBe(true);
expect(page.getInputById('action_type').disabled).toBe(true);
expect(page.getInputById('action_param1').disabled).toBe(true);
expect(page.getInputById('action_param2').disabled).toBe(true);
Expand Down Expand Up @@ -114,13 +115,13 @@ describe('SaiCreatureComponent integration tests', () => {
page.expectFullQueryToContain(
'DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 1234);\n' +
'INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, ' +
'`event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, ' +
'`event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, ' +
'`action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, ' +
'`target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, ' +
'`target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES\n' +
"(1234, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),\n" +
"(1234, 0, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),\n" +
"(1234, 0, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '');\n",
"(1234, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),\n" +
"(1234, 0, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),\n" +
"(1234, 0, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '');\n",
);
expect(page.getEditorTableRowsCount()).toBe(3);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ describe('SaiGameobjectComponent integration tests', () => {
page.expectFullQueryToContain(
'DELETE FROM `smart_scripts` WHERE (`source_type` = 1 AND `entryorguid` = 1234);\n' +
'INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, ' +
'`event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, ' +
'`event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, ' +
'`action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, ' +
'`target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, ' +
'`target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES\n' +
"(1234, 1, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),\n" +
"(1234, 1, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),\n" +
"(1234, 1, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '');\n",
"(1234, 1, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),\n" +
"(1234, 1, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),\n" +
"(1234, 1, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '');\n",
);
expect(page.getEditorTableRowsCount()).toBe(3);
});
Expand Down
10 changes: 7 additions & 3 deletions src/app/shared/modules/sai-editor/constants/sai-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ export const SAI_EVENT_PARAM2_NAMES: string[] = [];
export const SAI_EVENT_PARAM3_NAMES: string[] = [];
export const SAI_EVENT_PARAM4_NAMES: string[] = [];
export const SAI_EVENT_PARAM5_NAMES: string[] = [];
export const SAI_EVENT_PARAM6_NAMES: string[] = [];
export const SAI_EVENT_PARAM1_TOOLTIPS: string[] = [];
export const SAI_EVENT_PARAM2_TOOLTIPS: string[] = [];
export const SAI_EVENT_PARAM3_TOOLTIPS: string[] = [];
export const SAI_EVENT_PARAM4_TOOLTIPS: string[] = [];
export const SAI_EVENT_PARAM5_TOOLTIPS: string[] = [];
export const SAI_EVENT_PARAM6_TOOLTIPS: string[] = [];

// SMART_EVENT_UPDATE_IC
SAI_EVENT_TOOLTIPS[SAI_EVENTS.UPDATE_IC] =
Expand Down Expand Up @@ -179,7 +181,7 @@ SAI_EVENT_PARAM1_TOOLTIPS[SAI_EVENTS.SPELLHIT] = 'Use 0 for any';
SAI_EVENT_PARAM2_TOOLTIPS[SAI_EVENTS.SPELLHIT] = 'Use 0 for any';

// SMART_EVENT_RANGE
SAI_EVENT_TOOLTIPS[SAI_EVENTS.RANGE] = 'When the source\'s current target is within a certain range';
SAI_EVENT_TOOLTIPS[SAI_EVENTS.RANGE] = "When the source's current target is within a certain range";
SAI_EVENT_PARAM1_NAMES[SAI_EVENTS.RANGE] = 'MinDist';
SAI_EVENT_PARAM2_NAMES[SAI_EVENTS.RANGE] = 'MaxDist';
SAI_EVENT_PARAM3_NAMES[SAI_EVENTS.RANGE] = 'RepeatMin';
Expand Down Expand Up @@ -644,7 +646,8 @@ SAI_EVENT_PARAM4_TOOLTIPS[SAI_EVENTS.NEAR_UNIT_NEGATION] = 'Range in yards to ch
SAI_EVENT_PARAM5_TOOLTIPS[SAI_EVENTS.NEAR_UNIT_NEGATION] = 'Check Timer (ms).';

// SMART_EVENT_AREA_CASTING
SAI_EVENT_TOOLTIPS[SAI_EVENTS.AREA_CASTING] = 'Check threat list for hostiles casting. If none are found, repeat in 1200ms. This is mostly used for interrupt spells when used with CAST Action and INVOKER Target.';
SAI_EVENT_TOOLTIPS[SAI_EVENTS.AREA_CASTING] =
'Check threat list for hostiles casting. If none are found, repeat in 1200ms. This is mostly used for interrupt spells when used with CAST Action and INVOKER Target.';
SAI_EVENT_PARAM1_NAMES[SAI_EVENTS.AREA_CASTING] = 'InitialMin';
SAI_EVENT_PARAM2_NAMES[SAI_EVENTS.AREA_CASTING] = 'InitialMax';
SAI_EVENT_PARAM3_NAMES[SAI_EVENTS.AREA_CASTING] = 'RepeatMin';
Expand All @@ -657,7 +660,8 @@ SAI_EVENT_PARAM4_TOOLTIPS[SAI_EVENTS.AREA_CASTING] = 'ms';
SAI_EVENT_PARAM5_TOOLTIPS[SAI_EVENTS.AREA_CASTING] = '0: unlimited';

// SMART_EVENT_AREA_RANGE
SAI_EVENT_TOOLTIPS[SAI_EVENTS.AREA_RANGE] = 'Check threat list for hostiles in range. If none are found, repeat in 1200ms. This is mostly used to make creatures cast AoEs if a player is within range.';
SAI_EVENT_TOOLTIPS[SAI_EVENTS.AREA_RANGE] =
'Check threat list for hostiles in range. If none are found, repeat in 1200ms. This is mostly used to make creatures cast AoEs if a player is within range.';
SAI_EVENT_PARAM1_NAMES[SAI_EVENTS.AREA_RANGE] = 'InitialMin';
SAI_EVENT_PARAM2_NAMES[SAI_EVENTS.AREA_RANGE] = 'InitialMax';
SAI_EVENT_PARAM3_NAMES[SAI_EVENTS.AREA_RANGE] = 'RepeatMin';
Expand Down
20 changes: 19 additions & 1 deletion src/app/shared/modules/sai-editor/sai-editor.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,24 @@
<input [formControlName]="'event_param5'" id="event_param5" type="number" class="form-control form-control-sm" />
</div>
</div>

<div class="form-row" [hidden]="isTimedActionlists">
<div class="form-group col-7">
<label class="control-label" id="label-event-param6">
{{ getName('param6', EVENT_PARAM6_NAMES[selectedEvent]) }}
<i
class="fas fa-info-circle ms-1"
placement="auto"
[hidden]="!EVENT_PARAM6_TOOLTIPS[selectedEvent]"
[tooltip]="EVENT_PARAM6_TOOLTIPS[selectedEvent]"
></i>
</label>
</div>

<div class="form-group col-5">
<input [formControlName]="'event_param6'" id="event_param6" type="number" class="form-control form-control-sm" />
</div>
</div>
</div>

<div class="col-sm-6 col-lg-3 sai-category">
Expand Down Expand Up @@ -527,7 +545,7 @@

<div class="col-12 form-error" [hidden]="editorService.isFormIdUnique()">
<i class="fas fa-exclamation-triangle"></i>
<span [innerHTML]="'UNIQUE' | translate : { ENTITY_SECOND_ID_FIELD: editorService.entitySecondIdField }"></span>
<span [innerHTML]="'UNIQUE' | translate: { ENTITY_SECOND_ID_FIELD: editorService.entitySecondIdField }"></span>
</div>
</form>

Expand Down
Loading

0 comments on commit 8083118

Please sign in to comment.