Article by BAndysc
WoW Database Editor is a new database editor designed for all TrinityCore-based servers. The editor is created to be modular, easily extensible, and simple to customize for any wow emulator.
Smart Script editing
The main feature of the WoW Database Editor (WDE) is smart_script editing. Even though there are already a few SAI editors, they all are similar in the way they work. WDE redefines how a smart script editor can look like.
The screenshot above shows a smart script opened in the WoW Database Editor. It looks completely different from other editors. Competing SAI editors are in fact just another “view” for the smart_scripts table. That means, you still have to think very low level about the columns in the table, about the ids, about the links. Sure, those editors help you choose parameter values, flags, but that’s not enough.
On the other hand, in WDE you never look at the column values, at the column numbers, at the line id. You even are not allowed to link events manually, because the editor does all this for you! It does not mean that you have limited options, on the contrary, it allows you to focus on what is important – writing the script.
Just look at the screenshot above – without scrolling, without editing particular event/action you can see the script as a whole, it makes reading and writing is much easier. Once you complete your scripting, you can just export the script to a SQL and send a pull request with a fix to your chosen open-source emulator repository 🙂
Smart Script redefined
Traditional SAI is built upon event - action - target
approach. Each event has exactly one action, but they can be linked. WDE changes that – now each event can have multiple actions. Usually, in traditional editors, you add a new line, select an event type, then an action type and finally a target. WDE introduces the concept of a source
of action – that is the object which will execute the action.
Therefore, if you add a new action, you firstly have to pick the source of the action! After you select the source, a list of actions will pop up, what is important, you will see only actions that make sense with current source! Let’s take ACTION_SET_RUN
as an example. Do you know, what would happen if in traditional editor you had chosen target CLOSEST_CREATURE
? The answer is: not what you would expect – this action will NOT change the target movement speed, it will always change script creature speed. Therefore, WDE will not let you choose action SET_RUN
if you select CLOSEST_CREATURE
for a source! All actions have information about which source they support!
Another new feature that WDE brings to smart_script is a new WAIT
action. To add a delay between actions, you can just insert new wait
action. And here comes the best part – you may not know that, but wait
action is supported by any wow emulator that supports smart scripts! There is no need to modify the SAI implementation, there is no need to use a timed actionlist to add a delay between two actions. Wait action is much more readable and easier to use in those cases. Timed actionlist are still great, especially for longer scripts. But to add a simple delay between one action – they are definietly an overkill.
On the left, traditional timed actionlist script, on the right the same script is converted to wait
action. Which is easier to read and understand?
Contextual editing
Context
is a key thing in the editor. To make writing script as smooth as possible, a lot of places take into account context, let me give you few examples:
- when you write a timed actionlist and add a new event, the only event you will see is “UPDATE”, because that’s the only event compatible with this smart script type
- when you use
UPDATE
event in a timed actionlist script, it will correctly display as “After x seconds” instead of “Every x seconds”, because that’s how the event works in case of timed actionlist
- each event, action, source changes its description based on parameters, to describe what it will do as good as possible. The screenshot below presents the same action (MOVE_TO_POSITION) with different parameters. Look how the text changes. Thanks to this, you do not have to select an event/action to see its parameters, you can just depend on the event/action description
- you do not have to remember spell ids, flags, creature entries, etc… Every parameter can be chosen from the list. In the screenshot below you can see spell picker. Take a look at the description of the “cast flags” and “trigger flags” parameter – they are shown as human-readable text
- event/action parameters can also depend on other parameters. For instance, for action
TALK
you can choose creature_text id from the list, which depends on the chosen source (works in progress for that feature)
- when you add an action, you will see only those that are compatible with the selected source. If you try to outsmart the editor and change the source, after the action is added, it will kindly warn you that won’t work
Inline conditions editing
Conditions are often forgotten in other smart_script editors, but they can be quite powerful and enhance events by a lot. Therefore, conditions in Smart Scripts are a first-class citizen in WoW Database Editor! Just like you can add action to the event with one click, you can also add a condition, by just picking one from the list:
Conditions are displayed just below the event they refer to. Just look at the screenshot below, isn’t it immediately obvious what the conditions do in this script? WDE even introduces a special meta “OR” action in place of the else_group
column for readability:
Modularity and support for multiple emulators
WDE from its beginning is created to be modular. Each particular feature (database support, smart script editing, condition editing) is a separate module, that can be easily replaced. Does your emulator have a different database structure? It is easy to just replace the database module. Does your emulator have different actions/events? You can just modify actions from within the editor, even without recompilation!
At this point, WDE has official support for:
- TrinityCore Wrath (3.3.5 branch),
- TrinityCore Shadowlands (master branch),
- Cataclysm Preservation Project (TrinityCore 4.3.4),
- AzerothCore
That’s already quite a big list. And by “support” I mean – the editor really takes into account differences between those emulators.
For instance, if you select Trinity 3.3.5 compatibility mode, then you will not see serverside areatrigger smart scripts
, because they are supported only on the master branch. On the other hand, if you select TrinityCore Shadowlands mode, not only you will be able to create those scripts, but the editor will also load the “AreaTrigger Template” from the areatrigger_template
table (present only on the master branch).
Another example: two actions: ACTION_SET_FLY
on AzerothCore and ACTION_DISABLE_GRAVITY
in TrinityCore share the same ID – 60. Additionally, AzerothCore action has two extra parameters in addition to TrinityCore. Even the official AzerothCore database editor doesn’t have correct parameters for this action! Depending on the emulator version you choose, that action will be displayed differently (and correctly) in the editor: (on the left, action 60 when in AzerothCore compatibility mode, on the right the same (but different) action 60 when in TrinityCore compatibility mode)
Modern IDE
Actually, WDE is more than just a smart_script editor. It is built to behave and look more like a whole IDE – integrated development environment (Visual Studio is an example of an IDE). A key part of the IDE is a place to group “files” – WDE uses Visual Studio Solution Explorer like feature:
You can add group scripts into a folder for easier editing and those projects are persistent along IDE run!
All moderns IDE have a dark theme. So does Wow Database Editor!
Quality of life features
A very important aspect of the editor, are those tiny little details that you spot only when they are not working! Therefore, I try to emphasize the implementation of these little things. Espace
and Enter
keys are working in most places to cancel/accept action. You can use drag and drop
to move events and actions around (even supports multi-selection!). If you try to close a script that is modified and not saved – the editor will warn you to prevent losing work. You can move around with selected actions using keyboard arrows. Control+Z
and Control+Y
work as expected. The list of those things is very long by now.
Free and open source!
Now the best part. Not only is the editor free and publicly available, but it is also open source! Few private tools have their own tools, but none of them share those. WoW Database Editor is available on github.com to download, modify and enhance. Any contribution is welcome!
The future of the IDE
So what is the future of the IDE? Primarily, quality over quantity! The editor allows to edit smart_script only at the moment, but before the work is focused on other database aspects and tables, I want to make sure smart_script editing is feature-wise and quality-wise complete. However, the long-term goal is to provide editors for all the most important tables.
Download
The project is hosted on the GitHub: https://github.com/BAndysc/WoWDatabaseEditor Readme contains also a link to always latest prebuild version, ready to use out of the box. It doesn’t require any installation, you just need to download the program and run!