Skip to content

Commit

Permalink
Merge pull request wowsims#3812 from wowsims/add_apl_editing_readme
Browse files Browse the repository at this point in the history
Add APL editing readme
  • Loading branch information
lologarithm authored Oct 4, 2023
2 parents 51fda77 + 104f0a5 commit 2f42f20
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"json.schemas": [
{
"fileMatch": [
"*.apl.json"
],
"url": "./jsonschema/APLRotation.json"
}
],
"Lua.diagnostics.globals": [
"FONT_COLOR_CODE_CLOSE",
"SELECTED_CHAT_FRAME",
"DEFAULT_CHAT_FRAME",
"InterfaceOptions_AddCategory",
"NORMAL_FONT_COLOR",
"GameFontNormal",
"GameFontHighlight",
"ACCEPT",
"CANCEL",
"GameFontHighlightLarge",
"GameFontHighlightSmall",
"SlashCmdList",
"hash_SlashCmdList",
"NORMAL_FONT_COLOR_CODE",
"CLOSE",
"PanelTemplates_TabResize",
"PanelTemplates_SetDisabledTabState",
"PanelTemplates_SelectTab",
"PanelTemplates_DeselectTab",
"SetDesaturation",
"ColorPickerFrame",
"OpacitySliderFrame",
"ChatFontNormal",
"OKAY",
"NOT_BOUND",
"NUM_BAG_SLOTS",
"NUM_BANKBAGSLOTS",
"InterfaceOptionsFrame_OpenToCategory",
"BANK_CONTAINER",
"CreateFrame",
"geterrorhandler",
"IsLoggedIn",
"PlaySound",
"GetRealmName",
"UnitName",
"UnitClass",
"UnitRace",
"UnitFactionGroup",
"GetCurrentRegion",
"GetLocale",
"C_Container",
"GetTalentInfo",
"UnitFullName",
"GetPlayerInfoByGUID",
"UnitLevel",
"tInvert",
"GetItemInfo",
"IsEquippableItem",
"UnitGUID",
"GetSpellInfo",
"GetInventorySlotInfo",
"GetInventoryItemLink",
"max",
"min",
"ceil",
"BackdropTemplateMixin",
"floor",
"GetCursorInfo",
"ClearCursor",
"hooksecurefunc",
"GetMacroInfo",
"IsShiftKeyDown",
"IsControlKeyDown",
"IsAltKeyDown",
"issecurevariable",
"GetTime",
"C_Timer",
"format",
"gsub",
"strfind",
"strsub",
"strchar",
"strbyte",
"tinsert",
"UIParent"
]
}
95 changes: 95 additions & 0 deletions tools/APL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# How to setup autocompletion for APL editing in vscode

1. Install protoc-gen-jsonschema

```
go install github.com/chrusty/protoc-gen-jsonschema/cmd/protoc-gen-jsonschema@latest
```

2. Generate Schema

```
mkdir jsonschema
protoc \
--jsonschema_out=./jsonschema \
--proto_path=./proto/ \
--jsonschema_opt=json_fieldnames \
--jsonschema_opt=enforce_oneof \
--jsonschema_opt=disallow_additional_properties \
./proto/apl.proto
```

3. Edit APL files

The project settings file for vscode should now pick that up (.vscode/settings.json) should point the schema "jsonschema" directory. The extension ".apl.json" should activate the generated schema.

Create an APL file named "myrotation.apl.json" replacing `myrotation` with whatever name you prefer.

An empty rotation looks something like
```
{
"type": "TypeAPL",
"prepullActions": [],
"priorityList": []
}
```

You can then add prepull actions and the main priority list.

Here is what a example prepull action looks like. It casts spell 1 at -1 seconds.
```
{
"action": {
"castSpell": {
"spellId": {
"spellId": 1
}
}
},
"doAt": "-1s"
}
```

Here is an example action from the priorityList of elemental shaman. This is the check to see if flameshock dot is applied before casting lavaburst.

Condition is checking that "cmp" (compare) that the "lhs" (left hand side) is "OpGt" (greater than) the "rhs" (right hand side).

In this case it is checking that dot remaining time for flameshock is greater than the cast time of lava burst.

```
{
"action": {
"condition": {
"cmp": {
"op": "OpGt",
"lhs": {
"dotRemainingTime": {
"spellId": {
"spellId": 49233
}
}
},
"rhs": {
"spellCastTime": {
"spellId": {
"spellId": 60043
}
}
}
}
},
"castSpell": {
"spellId": {
"spellId": 60043
}
}
}
},
```

5. Insert rotation into JSON file for import.

You export your current settings in the sim (Export->JSON). Save the export as a file. Replace the `"rotation": {}` part of the export with your custom json rotation. (Just replace the `{}` leaving the `"rotation":` )

In the sim click (Import->JSON) and choose your edited JSON file, your rotation should appear!

0 comments on commit 2f42f20

Please sign in to comment.