From 104f0a51e08ce1ca226b7b978c0d6a06c188dcf9 Mon Sep 17 00:00:00 2001 From: Ben Echols Date: Wed, 4 Oct 2023 10:45:13 -0600 Subject: [PATCH] better --- .vscode/settings.json | 87 +++++++++++++++++++++++++++++++++++++++ tools/APL.md | 95 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 tools/APL.md diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..40afc5b1cf --- /dev/null +++ b/.vscode/settings.json @@ -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" + ] +} \ No newline at end of file diff --git a/tools/APL.md b/tools/APL.md new file mode 100644 index 0000000000..7add515de5 --- /dev/null +++ b/tools/APL.md @@ -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! \ No newline at end of file