diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2023-12-27 00:32:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 01:32:01 +0100 |
commit | f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287 (patch) | |
tree | 90f2c6a4885dbd181799e2325cf33588697674e1 /primedev/scripts/client/scriptmainmenupromos.cpp | |
parent | bb8ed59f6891b1196c5f5bbe7346cd171c8215fa (diff) | |
download | NorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.tar.gz NorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.zip |
Folder restructuring from primedev (#624)v1.21.2-rc3v1.21.2
Copies of over the primedev folder structure for easier cherry-picking of further changes
Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Diffstat (limited to 'primedev/scripts/client/scriptmainmenupromos.cpp')
-rw-r--r-- | primedev/scripts/client/scriptmainmenupromos.cpp | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/primedev/scripts/client/scriptmainmenupromos.cpp b/primedev/scripts/client/scriptmainmenupromos.cpp new file mode 100644 index 00000000..ecb47af7 --- /dev/null +++ b/primedev/scripts/client/scriptmainmenupromos.cpp @@ -0,0 +1,123 @@ +#include "squirrel/squirrel.h" +#include "masterserver/masterserver.h" + +// mirror this in script +enum eMainMenuPromoDataProperty +{ + newInfoTitle1, + newInfoTitle2, + newInfoTitle3, + + largeButtonTitle, + largeButtonText, + largeButtonUrl, + largeButtonImageIndex, + + smallButton1Title, + smallButton1Url, + smallButton1ImageIndex, + + smallButton2Title, + smallButton2Url, + smallButton2ImageIndex +}; +ADD_SQFUNC("void", NSRequestCustomMainMenuPromos, "", "", ScriptContext::UI) +{ + g_pMasterServerManager->RequestMainMenuPromos(); + return SQRESULT_NULL; +} + +ADD_SQFUNC("bool", NSHasCustomMainMenuPromoData, "", "", ScriptContext::UI) +{ + g_pSquirrel<ScriptContext::UI>->pushbool(sqvm, g_pMasterServerManager->m_bHasMainMenuPromoData); + return SQRESULT_NOTNULL; +} + +ADD_SQFUNC("var", NSGetCustomMainMenuPromoData, "int promoDataKey", "", ScriptContext::UI) +{ + if (!g_pMasterServerManager->m_bHasMainMenuPromoData) + return SQRESULT_NULL; + + switch (g_pSquirrel<ScriptContext::UI>->getinteger(sqvm, 1)) + { + case eMainMenuPromoDataProperty::newInfoTitle1: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.newInfoTitle1.c_str()); + break; + } + + case eMainMenuPromoDataProperty::newInfoTitle2: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.newInfoTitle2.c_str()); + break; + } + + case eMainMenuPromoDataProperty::newInfoTitle3: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.newInfoTitle3.c_str()); + break; + } + + case eMainMenuPromoDataProperty::largeButtonTitle: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.largeButtonTitle.c_str()); + break; + } + + case eMainMenuPromoDataProperty::largeButtonText: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.largeButtonText.c_str()); + break; + } + + case eMainMenuPromoDataProperty::largeButtonUrl: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.largeButtonUrl.c_str()); + break; + } + + case eMainMenuPromoDataProperty::largeButtonImageIndex: + { + g_pSquirrel<ScriptContext::UI>->pushinteger(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.largeButtonImageIndex); + break; + } + + case eMainMenuPromoDataProperty::smallButton1Title: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.smallButton1Title.c_str()); + break; + } + + case eMainMenuPromoDataProperty::smallButton1Url: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.smallButton1Url.c_str()); + break; + } + + case eMainMenuPromoDataProperty::smallButton1ImageIndex: + { + g_pSquirrel<ScriptContext::UI>->pushinteger(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.smallButton1ImageIndex); + break; + } + + case eMainMenuPromoDataProperty::smallButton2Title: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.smallButton2Title.c_str()); + break; + } + + case eMainMenuPromoDataProperty::smallButton2Url: + { + g_pSquirrel<ScriptContext::UI>->pushstring(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.smallButton2Url.c_str()); + break; + } + + case eMainMenuPromoDataProperty::smallButton2ImageIndex: + { + g_pSquirrel<ScriptContext::UI>->pushinteger(sqvm, g_pMasterServerManager->m_sMainMenuPromoData.smallButton2ImageIndex); + break; + } + } + + return SQRESULT_NOTNULL; +} |