actboy168 / YDWE

A Tool to Help the Creation of Warcraft III Map
GNU General Public License v3.0
462 stars 139 forks source link

在魔兽1.27版本中 lua引擎message.hook 获取按下技能按钮事件的参数错误 #165

Closed w4454962 closed 5 years ago

w4454962 commented 5 years ago

我查了一下问题,技能按钮的偏移在1.27里偏移了4字节

static bool ability_mouse_event(lua_State L, ability_mouse_message_t msg) { lua_getfield(L, LUA_REGISTRYINDEX, "_JASS_MESSAGE_HANDLE"); if (!lua_isfunction(L, -1)) { lua_pop(L, 1); return true; } lua_newtable(L); lua_pushstring(L, "mouse_ability"); lua_setfield(L, -2, "type"); auto button = msg->button; war3_searcher& s = get_war3_searcher(); if (s.get_version() >= version_127a) { button = (CCommandButton*)msg->unk0B; } if (msg && msg->button&& button->ability) { lua_pushinteger(L, msg->code); lua_setfield(L, -2, "code"); lua_pushinteger(L, button->ability->ability_id); lua_setfield(L, -2, "ability"); lua_pushinteger(L, button->ability->order_id); lua_setfield(L, -2, "order"); } lua_insert(L, -2); lua_pushvalue(L, -2); if (safe_call_not_sleep(L, 1, 1, true) != LUA_OK) { lua_pop(L, 1); return true; } int ok = lua_toboolean(L, -1); lua_pop(L, 1); lua_pop(L, 1); return !!ok; }

这是改正后的正常的代码。

actboy168 commented 5 years ago

PR please

w4454962 commented 5 years ago

什么鬼- -

w4454962 commented 5 years ago
actboy168 commented 5 years ago

请提供pull request