Allods Developers Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[LUA] Change game lua. Изменение игрового lua.

Whitetech

Member
Guide Author
Premium
Вашему вниманию представляю гайд: "как изменять клиентские lua и не только!"
Here is a guide I am presenting to you: "How to Modify Client-Side Lua and More!"

Предыстория. Была необходимость объединить 2 фракции в одну. Мы это сделали, но оказалось что душа творца это отдельная ветка выбора рассы и класса, где не учитывается противоположная фракция. Этот код был на стороне скомпилированного luac. Тут и начался мой путь.
Background. There was a need to merge 2 factions into one. We did it, but it turned out that the creator's soul is a separate branch of race and class selection, where the opposite faction is not taken into account. This code was on the side of the compiled luac. This is where my journey began.

В начале я воспользовался напрямую lua 5.0, lua 5.1 - никаких результатов, потом нашёл информацию на alloder pro о том что аллоды используют luajit 2.0.
Благодаря этой информации я смог декомпилировать все lua файлы в проекте. я приложил файл luajit decompiler.7z это 2 декомпилятора и пользоваться ими довольно просто. Я пользуюсь "luajit-decompiler-v2.exe". Пример использования

  1. берём нужный luac скрипт из проекта. Переносим в рабочую папку и drag and drop переносим на .exe файл или командой через консоль
    (если у вас linux можете воспользоваться python версией декомпилятора он тоже неплохой и рабочий)
  2. переносим его на luajit-decompiler-v2.exe и получаем папку output в которой будет файл с исходным кодом lua который можно редактировать и
  3. читаем и понимаем код, изменяем, можете воспользоваться например
    You do not have permission to view link Log in or register now.
    если совсем не понимаете о чем идет речь
  4. для эксперимента начните с чего то простого (какой то шрифт, цвет или анимация)
At first, I directly used Lua 5.0 and Lua 5.1, but got no results. Then I found information on Alloder Pro stating that Allods uses LuaJIT 2.0.
Thanks to this information, I managed to decompile all Lua files in the project. I've attached the file luajit_decompiler.7z, which contains two decompilers, both easy to use. Personally, I prefer using luajit-decompiler-v2.exe. Here's an example of how to use it:

  1. Take the desired luac script from the project and move it to the working directory. You can either drag-and-drop the script onto the .exe file or run it via command line. If you're on Linux, you can also try the Python version of the decompiler - it works well too.
  2. Drag the script onto luajit-decompiler-v2.exe, and you'll receive an output folder containing the original Lua source code, ready for editing.
  3. Read and understand the code, make changes. If needed, you may consult resources such as
    You do not have permission to view link Log in or register now.
    if you're having trouble understanding what's going on.
  4. For experimentation purposes, start with something simple.
1746346047941.png
1746346238389.png

Далее я обнаружил такую вещь: так уж вышло что AddonDesc он инициализирует везде именно .lua скрипты и соответственно они не нуждаются по сути в обратной компиляции в .luac формат. А уж тем более на пиратском сервере - это ради успокоения самого себя, но какой смысл если можно всё обратно декомпилировать.
Воспользуемся именно это фишкой чтобы упростить себе разработку.

Then I discovered this: it just so happened that AddonDesc initializes .lua scripts everywhere and accordingly they essentially do not need to be recompiled into .luac format. And even more so on a pirate server - this is for the sake of reassurance, but what's the point if you can decompile everything back.
Let's use this feature to simplify our development.


1746343982988.png

Приведу пример. Изменим цвет и скорость анимации в меню игры.
Let me give you an example. Change color and animation speed in context menu.

1. Зацепимся за контекст, найдем по тексту нужный нам путь: Interface\Ingame\ContextMenu

Let's latch onto the context and find the path we need in the text: Interface\Ingame\ContextMenu
1746385126928.png

1746385508091.png

2. Откройте проект с декомпилированными lua я его приложил как decompiled lua.7z (7.0 server)

Unpack decompiled lua.7z and Open as project
1746347116161.png
3. Найдем нужный нам lua методов который описал выше. в данном примере поменяем скорость вращения шестеренок в меню и цвет контекстного меню выхода.
Lets find lua to edit it. there we change gears rotate speed and context menu background color.
1746384938516.png

1746385296403.png

4. Заменяем lua и проверяем результат
Lets check results. Replace old luac to your edited lua. Old luac rename to .luac.bak

1746385373357.png


View attachment Allods Online 2025.05.04 - 22.15.34.03.mp4

Доп ресурсы
 

Attachments

Back
Top