Перейти к содержанию

Дайджесты за январь-февраль

Обновления гайдов и аддонов

Январь Февраль

Мониторинг серверов и редактор аддонов

Представляем вам две легенды. То, о чем можно было только мечтать, стало реальностью.

Мониторинг серверов Редактор аддонов

Подсказки из игры на вашем сайте

Теперь вы можете отображать сведения о внутриигровых элементах простым наведением курсора мыши.

Подробнее

Апдейтер аддонов

Представляем вам программу для автообновления аддонов и делимся подробностями.

Подробнее Скачать

Addons using Class(...)?


BhaaL

Рекомендуемые сообщения

Has anyone tried (and succeeded in) using the new facilities that came with (around) 3.0?

I'm talking about the stuff in LuaCompiledSystem.pak, specifically Class (Interface\Common\Script\ScriptClassesImplementation.luac) and useful base classes such as widgetObjectMonitor (Interface\Common\Script\ScriptWidgetObjectMonitor.luac) or widgetDynamicList (Interface\Common\Script\ScriptWidgetDynamicList.luac)?

I tried to use them like other scripts do (for example AstralMap), which starts the whole thing by doing something like that:

Code:
Class("main", UIBasicElement())

function main:Init()

    otherClass(self.wtSomeWidget):Init()

    -- [...] 

    return UIBasicElement.Init(self)

end

-- [...] 

main(mainForm):Init()

...when I try that, main(mainForm) throws a bad argument #1 to `setmetatable' (table expected, got userdata); if I remove mainForm it runs Init - but then self.wtSomeOtherWidget is never set (and I couldnt find any code inside the classes that initializes them based on widgetForm:GetNamedChildren or something).

So, any luck there, or am I the first one to try that?

My main goals in trying to use those things is the magic widgetDynamicList and widgetObjectMonitor work behind the scenes (like widgetDynamicList.Add creating other classes for objectIds or widgetObjectMonitor.Toggle keeping track of busy reaction handlers).

Ссылка на комментарий
Поделиться на другие сайты

Well, obviously you can't set metatable to userdata from script, so your mainForm should be a table. Since it's not, and all the widgets we have from client side are userdata, there should be some script (probably within \Interface\Common\Script\) which makes them tables. So link all other scripts from \Interface\Common\Script\ to your add-on and try again. If it does the trick, remove those scripts one by one and restart client until add-on becomes all broken over again. This will leave you with one or several scripts essential for classes to work. My money's in particular on ScriptWidgetCore.luac, since it has funny name. All other possible candidates are far too old, you can get them among ancient scripts from version 1.0.03.26.2. I've seen 'em somewhere on this forum. Good luck.

Here's some similar thread.

Ссылка на комментарий
Поделиться на другие сайты

Oh, neat, I didn't know they were around for that long. I just noticed them after looking around AstralMap and things after the 3.0 update.

I'll take a look at WidgetCore, and its gonna be a lot to reverse.

Ссылка на комментарий
Поделиться на другие сайты

Great, it looks like WidgetCore does the trick (you can clearly see how it overrides __index).

For others that are interrested:

Code:
<?xml version="1.0" encoding="UTF-8" ?>

<UIAddon>

  <!-- other stuff -->

  <ScriptFileRefs>

   <Item href="/Interface/Common/Script/ScriptWidgetCore.luac" />

   <Item href="/Interface/Common/Script/ScriptClassesImplementation.luac" />

        <!-- your scripts using Class(...) here -->

  </ScriptFileRefs>

  <!-- other stuff -->

</UIAddon>

I've yet to run further tests and see whether my actual code works, but so far it doesnt throw any errors anymore.

Ссылка на комментарий
Поделиться на другие сайты

So I was right. Damn, I'm good! © Duke Nukem =)

Well, I got question too. Which tool do you use to decompile scripts? I can't find one that actually works. It seems they all need some kind of debug data included in scripts.

Ссылка на комментарий
Поделиться на другие сайты

I use ChunkSpy and reverse the code by hand, as most other tools fail on certain stuff thats in there (luadec tends to coredump and stuff).

Ссылка на комментарий
Поделиться на другие сайты

Гость
Ответить в этой теме...

×   Вставлено с форматированием.   Восстановить форматирование

  Разрешено использовать не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отображать как обычную ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставлять изображения напрямую. Загружайте или вставляйте изображения по ссылке.

×
×
  • Создать...

Важная информация

Пользуясь сайтом, вы принимаете Условия использования