mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 16:52:45 +03:00
Compare commits
16 Commits
215e17d02a
...
3c7c1800bf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c7c1800bf | ||
|
|
b9f2c60966 | ||
|
|
5f7bf8c95c | ||
|
|
7d9173b880 | ||
|
|
98ea309985 | ||
|
|
ba5006a4d8 | ||
|
|
e872450202 | ||
|
|
bc1d7cbd66 | ||
|
|
61b05eb366 | ||
|
|
a168c6fd41 | ||
|
|
95a8f4287f | ||
|
|
c0ec4aed44 | ||
|
|
6dd15ed2cf | ||
|
|
dc071210ca | ||
|
|
cbbf491620 | ||
|
|
a82628adaa |
@ -160,6 +160,10 @@ ClientConnection* ClientServices::Connection() {
|
||||
return ClientServices::s_currentConnection;
|
||||
}
|
||||
|
||||
void ClientServices::CharacterDelete(uint64_t guid) {
|
||||
ClientServices::Connection()->RequestCharacterDelete(guid);
|
||||
}
|
||||
|
||||
void ClientServices::Disconnect() {
|
||||
ClientServices::Connection()->Disconnect();
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ class ClientServices : public LoginResponse {
|
||||
// Static functions
|
||||
static void ConnectToSelectedServer();
|
||||
static ClientConnection* Connection();
|
||||
static void CharacterDelete(uint64_t guid);
|
||||
static void Disconnect();
|
||||
static const char* GetCurrentLoginPortal();
|
||||
static const char* GetCurrentLoginServer();
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "glue/CCharacterSelectionScript.hpp"
|
||||
#include "CGlueMgr.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "glue/CCharacterSelection.hpp"
|
||||
#include "object/client/CGUnit_C.hpp"
|
||||
@ -157,7 +158,17 @@ int32_t Script_SelectCharacter(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_DeleteCharacter(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
luaL_error(L, "Usage: DeleteCharacter(index)");
|
||||
}
|
||||
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
|
||||
if (index >= 0 && index < CCharacterSelection::s_characterList.Count()) {
|
||||
CGlueMgr::DeleteCharacter(CCharacterSelection::s_characterList.m_data[index].m_info.guid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_RenameCharacter(lua_State* L) {
|
||||
|
||||
@ -26,10 +26,11 @@
|
||||
#include "ui/FrameXML.hpp"
|
||||
#include "ui/Interface.hpp"
|
||||
#include "ui/Key.hpp"
|
||||
#include "ui/ScriptFunctions.hpp"
|
||||
#include "ui/ScriptFunctionsSystem.hpp"
|
||||
#include "ui/game/CGVideoOptions.hpp"
|
||||
#include "ui/simple/CSimpleModelFFX.hpp"
|
||||
#include "ui/simple/CSimpleTop.hpp"
|
||||
#include "ui/simple/ScriptMethods.hpp"
|
||||
#include "util/Filesystem.hpp"
|
||||
#include "util/Locale.hpp"
|
||||
#include "util/Log.hpp"
|
||||
@ -128,6 +129,17 @@ void CGlueMgr::ChangeRealm(const REALM_INFO* realmInfo) {
|
||||
ClientServices::Connection()->Connect();
|
||||
}
|
||||
|
||||
void CGlueMgr::DeleteCharacter(uint64_t guid) {
|
||||
if (guid) {
|
||||
CGlueMgr::SetIdleState(IDLE_DELETE_CHARACTER);
|
||||
|
||||
auto text = FrameScript_GetText(ClientServices::GetErrorToken(70), -1, GENDER_NOT_APPLICABLE);
|
||||
FrameScript_SignalEvent(OPEN_STATUS_DIALOG, "%s%s", "CANCEL", text);
|
||||
|
||||
ClientServices::CharacterDelete(guid);
|
||||
}
|
||||
}
|
||||
|
||||
void CGlueMgr::EnterWorld() {
|
||||
if (!ClientServices::GetSelectedRealm()) {
|
||||
return;
|
||||
@ -1186,6 +1198,10 @@ void CGlueMgr::Suspend() {
|
||||
|
||||
// TODO
|
||||
|
||||
SystemUnregisterFunctions();
|
||||
|
||||
// TODO
|
||||
|
||||
FrameXML_FreeHashNodes();
|
||||
|
||||
// TODO
|
||||
|
||||
@ -66,6 +66,7 @@ class CGlueMgr {
|
||||
// Static functions
|
||||
static void CancelRealmListQuery();
|
||||
static void ChangeRealm(const REALM_INFO* realmInfo);
|
||||
static void DeleteCharacter(uint64_t guid);
|
||||
static void DisplayLoginStatus();
|
||||
static void EnterWorld();
|
||||
static void GetCharacterList();
|
||||
|
||||
@ -522,36 +522,6 @@ int32_t Script_IsScanDLLFinished(lua_State* L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_IsWindowsClient(lua_State* L) {
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
lua_pushnumber(L, 1.0);
|
||||
#else
|
||||
lua_pushnil(L);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_IsMacClient(lua_State* L) {
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
lua_pushnumber(L, 1.0);
|
||||
#else
|
||||
lua_pushnil(L);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_IsLinuxClient(lua_State* L) {
|
||||
#if defined(WHOA_SYSTEM_LINUX)
|
||||
lua_pushnumber(L, 1.0);
|
||||
#else
|
||||
lua_pushnil(L);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_SetRealmSplitState(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include "net/connection/ClientConnection.hpp"
|
||||
#include "net/Login.hpp"
|
||||
#include "client/ClientServices.hpp"
|
||||
#include "common/datastore/CDataStore.hpp"
|
||||
#include "net/Login.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
|
||||
void ClientConnection::AccountLogin(const char* name, const char* password, int32_t region, WOW_LOCALE locale) {
|
||||
@ -160,3 +161,19 @@ int32_t ClientConnection::PollStatus(WOWCS_OPS& op, const char** msg, int32_t& r
|
||||
|
||||
return this->m_statusComplete;
|
||||
}
|
||||
|
||||
void ClientConnection::RequestCharacterDelete(uint64_t guid) {
|
||||
this->Initiate(COP_DELETE_CHARACTER, 70, nullptr);
|
||||
|
||||
if (this->IsConnected()) {
|
||||
CDataStore netMsg;
|
||||
netMsg.Put(static_cast<uint32_t>(CMSG_CHAR_DELETE));
|
||||
netMsg.Put(guid);
|
||||
netMsg.Finalize();
|
||||
|
||||
this->Send(&netMsg);
|
||||
}
|
||||
else {
|
||||
this->Cancel(4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ class ClientConnection : public RealmConnection {
|
||||
void Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)());
|
||||
int32_t IsConnected();
|
||||
int32_t PollStatus(WOWCS_OPS& op, const char** msg, int32_t& result, int32_t& errorCode);
|
||||
void RequestCharacterDelete(uint64_t guid);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1047,6 +1047,15 @@ const char* FrameScript_Sprintf(lua_State* L, int32_t idx, char buffer[], uint32
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void FrameScript_UnregisterFunction(const char* name) {
|
||||
auto L = FrameScript::s_context;
|
||||
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, name);
|
||||
lua_insert(L, -2);
|
||||
lua_rawset(L, LUA_GLOBALSINDEX);
|
||||
}
|
||||
|
||||
void FrameScript_UnregisterScriptEvent(FrameScript_Object* object, FrameScript_EventObject* event) {
|
||||
if (event->pendingSignalCount) {
|
||||
auto node = event->unregisterListeners.Head();
|
||||
|
||||
@ -99,6 +99,8 @@ void FrameScript_SignalEvent(uint32_t index, const char* format, ...);
|
||||
|
||||
const char* FrameScript_Sprintf(lua_State* L, int32_t idx, char buffer[], uint32_t bufferLen);
|
||||
|
||||
void FrameScript_UnregisterFunction(const char* name);
|
||||
|
||||
void FrameScript_UnregisterScriptEvent(FrameScript_Object* object, FrameScript_EventObject* event);
|
||||
|
||||
void ScriptEventsInitialize();
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
#include "ui/ScriptFunctions.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "ui/simple/CSimpleButton.hpp"
|
||||
#include "ui/simple/CSimpleCheckbox.hpp"
|
||||
#include "ui/simple/CSimpleEditBox.hpp"
|
||||
#include "ui/simple/CSimpleFont.hpp"
|
||||
#include "ui/simple/CSimpleFontString.hpp"
|
||||
#include "ui/simple/CSimpleFrame.hpp"
|
||||
#include "ui/simple/CSimpleHTML.hpp"
|
||||
#include "ui/simple/CSimpleModel.hpp"
|
||||
#include "ui/simple/CSimpleModelFFX.hpp"
|
||||
#include "ui/simple/CSimpleScrollFrame.hpp"
|
||||
#include "ui/simple/CSimpleSlider.hpp"
|
||||
#include "ui/simple/CSimpleTexture.hpp"
|
||||
|
||||
void RegisterSimpleFrameScriptMethods() {
|
||||
for (int32_t i = 0; i < NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME; ++i) {
|
||||
FrameScript_RegisterFunction(
|
||||
FrameScript::s_ScriptFunctions_SimpleFrame[i].name,
|
||||
FrameScript::s_ScriptFunctions_SimpleFrame[i].method
|
||||
);
|
||||
}
|
||||
|
||||
// TODO
|
||||
// CSimpleAnim::CreateScriptMetaTable();
|
||||
// CSimpleTranslationAnim::CreateScriptMetaTable();
|
||||
// CSimpleRotationAnim::CreateScriptMetaTable();
|
||||
// CSimpleScaleAnim::CreateScriptMetaTable();
|
||||
// CSimpleControlPoint::CreateScriptMetaTable();
|
||||
// CSimplePathAnim::CreateScriptMetaTable();
|
||||
// CSimpleAlphaAnim::CreateScriptMetaTable();
|
||||
// CSimpleAnimGroup::CreateScriptMetaTable();
|
||||
|
||||
CSimpleFont::CreateScriptMetaTable();
|
||||
CSimpleTexture::CreateScriptMetaTable();
|
||||
CSimpleFontString::CreateScriptMetaTable();
|
||||
CSimpleFrame::CreateScriptMetaTable();
|
||||
CSimpleButton::CreateScriptMetaTable();
|
||||
CSimpleCheckbox::CreateScriptMetaTable();
|
||||
CSimpleEditBox::CreateScriptMetaTable();
|
||||
CSimpleHTML::CreateScriptMetaTable();
|
||||
|
||||
// TODO
|
||||
// CSimpleMessageFrame::CreateScriptMetaTable();
|
||||
// CSimpleMessageScrollFrame::CreateScriptMetaTable();
|
||||
|
||||
CSimpleModel::CreateScriptMetaTable();
|
||||
CSimpleModelFFX::CreateScriptMetaTable();
|
||||
CSimpleScrollFrame::CreateScriptMetaTable();
|
||||
CSimpleSlider::CreateScriptMetaTable();
|
||||
|
||||
// TODO
|
||||
// CSimpleStatusBar::CreateScriptMetaTable();
|
||||
// CSimpleColorSelect::CreateScriptMetaTable();
|
||||
// CSimpleMovieFrame::CreateScriptMetaTable();
|
||||
}
|
||||
|
||||
void SystemRegisterFunctions() {
|
||||
for (int32_t i = 0; i < NUM_SCRIPT_FUNCTIONS_SYSTEM; ++i) {
|
||||
FrameScript_RegisterFunction(
|
||||
FrameScript::s_ScriptFunctions_System[i].name,
|
||||
FrameScript::s_ScriptFunctions_System[i].method
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
#ifndef UI_SCRIPT_FUNCTIONS_HPP
|
||||
#define UI_SCRIPT_FUNCTIONS_HPP
|
||||
|
||||
#include "ui/Types.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
struct lua_State;
|
||||
|
||||
#define NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME 7
|
||||
#define NUM_SCRIPT_FUNCTIONS_SYSTEM 7
|
||||
|
||||
namespace FrameScript {
|
||||
extern FrameScript_Method s_ScriptFunctions_SimpleFrame[NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME];
|
||||
extern FrameScript_Method s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SYSTEM];
|
||||
}
|
||||
|
||||
void RegisterSimpleFrameScriptMethods();
|
||||
|
||||
void SystemRegisterFunctions();
|
||||
|
||||
#endif
|
||||
@ -1,4 +1,4 @@
|
||||
#include "ui/ScriptFunctions.hpp"
|
||||
#include "ui/ScriptFunctionsShared.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
#include <cstdint>
|
||||
@ -6,3 +6,33 @@
|
||||
int32_t Script_GetAccountExpansionLevel(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_IsLinuxClient(lua_State* L) {
|
||||
#if defined(WHOA_SYSTEM_LINUX)
|
||||
lua_pushnumber(L, 1.0);
|
||||
#else
|
||||
lua_pushnil(L);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_IsMacClient(lua_State* L) {
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
lua_pushnumber(L, 1.0);
|
||||
#else
|
||||
lua_pushnil(L);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_IsWindowsClient(lua_State* L) {
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
lua_pushnumber(L, 1.0);
|
||||
#else
|
||||
lua_pushnil(L);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -6,4 +6,10 @@
|
||||
|
||||
int32_t Script_GetAccountExpansionLevel(lua_State* L);
|
||||
|
||||
int32_t Script_IsLinuxClient(lua_State* L);
|
||||
|
||||
int32_t Script_IsMacClient(lua_State* L);
|
||||
|
||||
int32_t Script_IsWindowsClient(lua_State* L);
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "ui/ScriptFunctions.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "ui/ScriptFunctionsShared.hpp"
|
||||
#include "ui/Types.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
@ -22,10 +22,12 @@ int32_t Script_ConsoleExec(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_AccessDenied(lua_State* L) {
|
||||
return luaL_error(L, "Access Denied");
|
||||
luaL_error(L, "Access Denied");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
FrameScript_Method FrameScript::s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SYSTEM] = {
|
||||
static FrameScript_Method s_SystemFunctions[] = {
|
||||
{ "GetTime", &Script_GetTime },
|
||||
{ "GetGameTime", &Script_GetGameTime },
|
||||
{ "ConsoleExec", &Script_ConsoleExec },
|
||||
@ -34,3 +36,15 @@ FrameScript_Method FrameScript::s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SY
|
||||
{ "AppendToFile", &Script_AccessDenied },
|
||||
{ "GetAccountExpansionLevel", &Script_GetAccountExpansionLevel }
|
||||
};
|
||||
|
||||
void SystemRegisterFunctions() {
|
||||
for (auto& func : s_SystemFunctions) {
|
||||
FrameScript_RegisterFunction(func.name, func.method);
|
||||
}
|
||||
}
|
||||
|
||||
void SystemUnregisterFunctions() {
|
||||
for (auto& func : s_SystemFunctions) {
|
||||
FrameScript_UnregisterFunction(func.name);
|
||||
}
|
||||
}
|
||||
|
||||
8
src/ui/ScriptFunctionsSystem.hpp
Normal file
8
src/ui/ScriptFunctionsSystem.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef UI_SCRIPT_FUNCTIONS_SYSTEM_HPP
|
||||
#define UI_SCRIPT_FUNCTIONS_SYSTEM_HPP
|
||||
|
||||
void SystemRegisterFunctions();
|
||||
|
||||
void SystemUnregisterFunctions();
|
||||
|
||||
#endif
|
||||
@ -3,6 +3,8 @@
|
||||
#include "ui/FrameXML.hpp"
|
||||
#include "ui/Key.hpp"
|
||||
#include "ui/game/CGWorldFrame.hpp"
|
||||
#include "ui/game/GMTicketInfoScript.hpp"
|
||||
#include "ui/game/GameScript.hpp"
|
||||
#include "ui/game/ScriptEvents.hpp"
|
||||
#include "ui/simple/CSimpleTop.hpp"
|
||||
#include "util/CStatus.hpp"
|
||||
@ -13,9 +15,17 @@ CSimpleTop* CGGameUI::s_simpleTop;
|
||||
void LoadScriptFunctions() {
|
||||
// TODO
|
||||
|
||||
GameScriptRegisterFunctions();
|
||||
|
||||
// TODO
|
||||
|
||||
ScriptEventsRegisterFunctions();
|
||||
|
||||
// TODO
|
||||
|
||||
GMTicketInfoRegisterScriptFunctions();
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGGameUI::Initialize() {
|
||||
|
||||
87
src/ui/game/GMTicketInfoScript.cpp
Normal file
87
src/ui/game/GMTicketInfoScript.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
#include "ui/game/GMTicketInfoScript.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t Script_GetGMTicket(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_NewGMTicket(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_UpdateGMTicket(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_DeleteGMTicket(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GMResponseNeedMoreHelp(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GMResponseResolve(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GetGMStatus(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GMSurveyQuestion(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GMSurveyNumAnswers(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GMSurveyAnswer(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GMSurveyAnswerSubmit(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GMSurveyCommentSubmit(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GMSurveySubmit(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GMReportLag(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_RegisterStaticConstants(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static FrameScript_Method s_ScriptFunctions[] = {
|
||||
{ "GetGMTicket", &Script_GetGMTicket },
|
||||
{ "NewGMTicket", &Script_NewGMTicket },
|
||||
{ "UpdateGMTicket", &Script_UpdateGMTicket },
|
||||
{ "DeleteGMTicket", &Script_DeleteGMTicket },
|
||||
{ "GMResponseNeedMoreHelp", &Script_GMResponseNeedMoreHelp },
|
||||
{ "GMResponseResolve", &Script_GMResponseResolve },
|
||||
{ "GetGMStatus", &Script_GetGMStatus },
|
||||
{ "GMSurveyQuestion", &Script_GMSurveyQuestion },
|
||||
{ "GMSurveyNumAnswers", &Script_GMSurveyNumAnswers },
|
||||
{ "GMSurveyAnswer", &Script_GMSurveyAnswer },
|
||||
{ "GMSurveyAnswerSubmit", &Script_GMSurveyAnswerSubmit },
|
||||
{ "GMSurveyCommentSubmit", &Script_GMSurveyCommentSubmit },
|
||||
{ "GMSurveySubmit", &Script_GMSurveySubmit },
|
||||
{ "GMReportLag", &Script_GMReportLag },
|
||||
{ "RegisterStaticConstants", &Script_RegisterStaticConstants },
|
||||
};
|
||||
|
||||
void GMTicketInfoRegisterScriptFunctions() {
|
||||
for (auto& func : s_ScriptFunctions) {
|
||||
FrameScript_RegisterFunction(func.name, func.method);
|
||||
}
|
||||
}
|
||||
6
src/ui/game/GMTicketInfoScript.hpp
Normal file
6
src/ui/game/GMTicketInfoScript.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef UI_GAME_GM_TICKET_INFO_SCRIPT_HPP
|
||||
#define UI_GAME_GM_TICKET_INFO_SCRIPT_HPP
|
||||
|
||||
void GMTicketInfoRegisterScriptFunctions();
|
||||
|
||||
#endif
|
||||
1590
src/ui/game/GameScript.cpp
Normal file
1590
src/ui/game/GameScript.cpp
Normal file
File diff suppressed because it is too large
Load Diff
6
src/ui/game/GameScript.hpp
Normal file
6
src/ui/game/GameScript.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef UI_GAME_GAME_SCRIPT_HPP
|
||||
#define UI_GAME_GAME_SCRIPT_HPP
|
||||
|
||||
void GameScriptRegisterFunctions();
|
||||
|
||||
#endif
|
||||
@ -1,7 +1,6 @@
|
||||
#include "ui/game/ScriptEvents.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "ui/ScriptFunctions.hpp"
|
||||
#include "ui/ScriptFunctionsShared.hpp"
|
||||
#include "ui/ScriptFunctionsSystem.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t Script_UnitExists(lua_State* L) {
|
||||
|
||||
@ -73,7 +73,16 @@ int32_t CSimpleFontString_Hide(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t CSimpleFontString_IsVisible(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleFontString::GetObjectType();
|
||||
auto string = static_cast<CSimpleFontString*>(FrameScript_GetObjectThis(L, type));
|
||||
|
||||
if (string->IsVisible()) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleFontString_IsShown(lua_State* L) {
|
||||
|
||||
@ -1342,7 +1342,7 @@ void CSimpleFrame::SetBeingScrolled(int32_t a2, int32_t a3) {
|
||||
this->m_batchDirty |= 0x1F;
|
||||
}
|
||||
|
||||
for (auto child = this->m_children.Head(); child; this->m_children.Link(child)->Next()) {
|
||||
for (auto child = this->m_children.Head(); child; child = this->m_children.Link(child)->Next()) {
|
||||
if (!(child->frame->m_flags & 0x4000)) {
|
||||
child->frame->SetBeingScrolled(a2, -1);
|
||||
}
|
||||
|
||||
@ -49,6 +49,10 @@ bool CSimpleRegion::IsShown() {
|
||||
return this->m_shown == 1;
|
||||
}
|
||||
|
||||
bool CSimpleRegion::IsVisible() {
|
||||
return this->m_visible == 1;
|
||||
}
|
||||
|
||||
void CSimpleRegion::OnColorChanged(bool a2) {
|
||||
if (this->m_parent) {
|
||||
uint8_t effectiveAlpha = this->m_parent->m_alpha * this->m_parent->alphaBD / 255;
|
||||
|
||||
@ -32,6 +32,7 @@ class CSimpleRegion : public CScriptRegion {
|
||||
void Hide();
|
||||
void HideThis();
|
||||
bool IsShown();
|
||||
bool IsVisible();
|
||||
void OnRegionChanged();
|
||||
void SetVertexColor(const CImVector& color);
|
||||
void SetVertexGradient(ORIENTATION orientation, const CImVector& minColor, const CImVector& maxColor);
|
||||
|
||||
@ -97,11 +97,29 @@ int32_t CSimpleTexture_Hide(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t CSimpleTexture_IsVisible(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleTexture::GetObjectType();
|
||||
auto texture = static_cast<CSimpleTexture*>(FrameScript_GetObjectThis(L, type));
|
||||
|
||||
if (texture->IsVisible()) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleTexture_IsShown(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleTexture::GetObjectType();
|
||||
auto texture = static_cast<CSimpleTexture*>(FrameScript_GetObjectThis(L, type));
|
||||
|
||||
if (texture->IsShown()) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleTexture_GetTexture(lua_State* L) {
|
||||
|
||||
@ -1,13 +1,24 @@
|
||||
#include "ui/simple/ScriptMethods.hpp"
|
||||
#include "ui/FrameXML.hpp"
|
||||
#include "ui/ScriptFunctions.hpp"
|
||||
#include "ui/Types.hpp"
|
||||
#include "ui/simple/CSimpleButton.hpp"
|
||||
#include "ui/simple/CSimpleCheckbox.hpp"
|
||||
#include "ui/simple/CSimpleEditBox.hpp"
|
||||
#include "ui/simple/CSimpleFont.hpp"
|
||||
#include "ui/simple/CSimpleFontString.hpp"
|
||||
#include "ui/simple/CSimpleFrame.hpp"
|
||||
#include "ui/simple/CSimpleHTML.hpp"
|
||||
#include "ui/simple/CSimpleModel.hpp"
|
||||
#include "ui/simple/CSimpleModelFFX.hpp"
|
||||
#include "ui/simple/CSimpleScrollFrame.hpp"
|
||||
#include "ui/simple/CSimpleSlider.hpp"
|
||||
#include "ui/simple/CSimpleTexture.hpp"
|
||||
#include "util/CStatus.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
#include <common/XML.hpp>
|
||||
#include <cstdint>
|
||||
#include <storm/String.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
int32_t Script_GetText(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
@ -137,7 +148,7 @@ int32_t Script_GetCurrentKeyBoardFocus(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
FrameScript_Method FrameScript::s_ScriptFunctions_SimpleFrame[NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME] = {
|
||||
static FrameScript_Method s_ScriptFunctions[] = {
|
||||
{ "GetText", &Script_GetText },
|
||||
{ "GetNumFrames", &Script_GetNumFrames },
|
||||
{ "EnumerateFrames", &Script_EnumerateFrames },
|
||||
@ -146,3 +157,42 @@ FrameScript_Method FrameScript::s_ScriptFunctions_SimpleFrame[NUM_SCRIPT_FUNCTIO
|
||||
{ "GetFramesRegisteredForEvent", &Script_GetFramesRegisteredForEvent },
|
||||
{ "GetCurrentKeyBoardFocus", &Script_GetCurrentKeyBoardFocus },
|
||||
};
|
||||
|
||||
void RegisterSimpleFrameScriptMethods() {
|
||||
for (auto& func : s_ScriptFunctions) {
|
||||
FrameScript_RegisterFunction(func.name, func.method);
|
||||
}
|
||||
|
||||
// TODO
|
||||
// CSimpleAnim::CreateScriptMetaTable();
|
||||
// CSimpleTranslationAnim::CreateScriptMetaTable();
|
||||
// CSimpleRotationAnim::CreateScriptMetaTable();
|
||||
// CSimpleScaleAnim::CreateScriptMetaTable();
|
||||
// CSimpleControlPoint::CreateScriptMetaTable();
|
||||
// CSimplePathAnim::CreateScriptMetaTable();
|
||||
// CSimpleAlphaAnim::CreateScriptMetaTable();
|
||||
// CSimpleAnimGroup::CreateScriptMetaTable();
|
||||
|
||||
CSimpleFont::CreateScriptMetaTable();
|
||||
CSimpleTexture::CreateScriptMetaTable();
|
||||
CSimpleFontString::CreateScriptMetaTable();
|
||||
CSimpleFrame::CreateScriptMetaTable();
|
||||
CSimpleButton::CreateScriptMetaTable();
|
||||
CSimpleCheckbox::CreateScriptMetaTable();
|
||||
CSimpleEditBox::CreateScriptMetaTable();
|
||||
CSimpleHTML::CreateScriptMetaTable();
|
||||
|
||||
// TODO
|
||||
// CSimpleMessageFrame::CreateScriptMetaTable();
|
||||
// CSimpleMessageScrollFrame::CreateScriptMetaTable();
|
||||
|
||||
CSimpleModel::CreateScriptMetaTable();
|
||||
CSimpleModelFFX::CreateScriptMetaTable();
|
||||
CSimpleScrollFrame::CreateScriptMetaTable();
|
||||
CSimpleSlider::CreateScriptMetaTable();
|
||||
|
||||
// TODO
|
||||
// CSimpleStatusBar::CreateScriptMetaTable();
|
||||
// CSimpleColorSelect::CreateScriptMetaTable();
|
||||
// CSimpleMovieFrame::CreateScriptMetaTable();
|
||||
}
|
||||
6
src/ui/simple/ScriptMethods.hpp
Normal file
6
src/ui/simple/ScriptMethods.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef UI_SIMPLE_SCRIPT_METHODS_HPP
|
||||
#define UI_SIMPLE_SCRIPT_METHODS_HPP
|
||||
|
||||
void RegisterSimpleFrameScriptMethods();
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user