mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-08 18:36:00 +03:00
Compare commits
2 Commits
6f5d3662b6
...
0a0c327c46
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a0c327c46 | ||
|
|
3df4e5eeeb |
@ -493,7 +493,9 @@ static int32_t Script_ForceQuit(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetCursorMoney(lua_State* L) {
|
static int32_t Script_GetCursorMoney(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_DropCursorMoney(lua_State* L) {
|
static int32_t Script_DropCursorMoney(lua_State* L) {
|
||||||
|
|||||||
@ -93,7 +93,9 @@ static int32_t Script_ChangeActionBarPage(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetActionBarPage(lua_State* L) {
|
static int32_t Script_GetActionBarPage(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushinteger(L, 1);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetActionBarToggles(lua_State* L) {
|
static int32_t Script_GetActionBarToggles(lua_State* L) {
|
||||||
|
|||||||
@ -250,7 +250,9 @@ static int32_t Script_UnitLevel(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetMoney(lua_State* L) {
|
static int32_t Script_GetMoney(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 10.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetHonorCurrency(lua_State* L) {
|
static int32_t Script_GetHonorCurrency(lua_State* L) {
|
||||||
|
|||||||
@ -41,11 +41,15 @@ static int32_t Script_CancelTradeAccept(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetPlayerTradeMoney(lua_State* L) {
|
static int32_t Script_GetPlayerTradeMoney(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetTargetTradeMoney(lua_State* L) {
|
static int32_t Script_GetTargetTradeMoney(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_PickupTradeMoney(lua_State* L) {
|
static int32_t Script_PickupTradeMoney(lua_State* L) {
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
#include "ui/CSimpleFrameScript.hpp"
|
#include "ui/CSimpleFrameScript.hpp"
|
||||||
#include "gx/Coordinate.hpp"
|
|
||||||
#include "ui/CSimpleFrame.hpp"
|
#include "ui/CSimpleFrame.hpp"
|
||||||
|
#include "ui/CSimpleTexture.hpp"
|
||||||
|
#include "gx/Coordinate.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
|
#include "ui/FrameXML.hpp"
|
||||||
#include "ui/CBackdropGenerator.hpp"
|
#include "ui/CBackdropGenerator.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
|
#include <bc/Memory.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -19,7 +23,57 @@ int32_t CSimpleFrame_CreateTitleRegion(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_CreateTexture(lua_State* L) {
|
int32_t CSimpleFrame_CreateTexture(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
int32_t type = CSimpleFrame::GetObjectType();
|
||||||
|
CSimpleFrame* frame = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
const char* name = lua_isstring(L, 2) ? lua_tolstring(L, 2, nullptr) : nullptr;
|
||||||
|
|
||||||
|
int32_t drawLayer = 2;
|
||||||
|
if (lua_isstring(L, 3)) {
|
||||||
|
StringToDrawLayer(lua_tolstring(L, 3, nullptr), drawLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLNode* frameNode = nullptr;
|
||||||
|
|
||||||
|
if (lua_type(L, 4) == LUA_TSTRING) {
|
||||||
|
const char* tainted;
|
||||||
|
bool locked;
|
||||||
|
|
||||||
|
const char* inheritName = lua_tolstring(L, 4, nullptr);
|
||||||
|
const char* frameName = frame->GetName();
|
||||||
|
if (!frameName) {
|
||||||
|
frameName = "<unnamed>";
|
||||||
|
}
|
||||||
|
|
||||||
|
frameNode = FrameXML_AcquireHashNode(inheritName, tainted, locked);
|
||||||
|
if (!frameNode) {
|
||||||
|
luaL_error(L, "%s:CreateTexture(): Couldn't find inherited node \"%s\"", frameName, inheritName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (locked) {
|
||||||
|
luaL_error(L, "%s:CreateTexture(): Recursively inherited node \"%s\"", frameName, inheritName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto texture = NEW(CSimpleTexture, frame, drawLayer, 1);
|
||||||
|
if (name && *name) {
|
||||||
|
texture->SetName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frameNode) {
|
||||||
|
CStatus status;
|
||||||
|
texture->PostLoadXML(frameNode, &status);
|
||||||
|
FrameXML_ReleaseHashNode(lua_tolstring(L, 4, nullptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
if (!texture->lua_registered) {
|
||||||
|
texture->RegisterScriptObject(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, texture->lua_objectRef);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_CreateFontString(lua_State* L) {
|
int32_t CSimpleFrame_CreateFontString(lua_State* L) {
|
||||||
|
|||||||
@ -418,7 +418,15 @@ int32_t FrameScript_ExecuteFile(const char* filePath, const char* a2, MD5_CTX* m
|
|||||||
MD5Update(md5, static_cast<unsigned char*>(fileBuffer), fileBytes);
|
MD5Update(md5, static_cast<unsigned char*>(fileBuffer), fileBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t v10 = FrameScript_ExecuteBuffer(static_cast<char*>(fileBuffer), fileBytes, v11, status, a2);
|
char* cleanBuffer = static_cast<char*>(fileBuffer);
|
||||||
|
|
||||||
|
// Skip UTF8 BOM
|
||||||
|
if (fileBytes >= 3 && memcmp(fileBuffer, "\xEF\xBB\xBF", 3) == 0) {
|
||||||
|
cleanBuffer += 3;
|
||||||
|
fileBytes -= 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t v10 = FrameScript_ExecuteBuffer(cleanBuffer, fileBytes, v11, status, a2);
|
||||||
|
|
||||||
SFile::Unload(fileBuffer);
|
SFile::Unload(fileBuffer);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user