diff --git a/CHANGELOG.md b/CHANGELOG.md index ce1d090801e..c10968d8f79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ https://github.com/nwnxee/unified/compare/build8193.36.12...HEAD - Store: {Get|Set}MarkDown() - Store: {Get|Set}MarkUp() - Player: ReloadTlk() +- Player: ReloadColorPalettes() ### Changed - N/A diff --git a/Plugins/Player/NWScript/nwnx_player.nss b/Plugins/Player/NWScript/nwnx_player.nss index 1b5cac98456..53536a8bc8b 100644 --- a/Plugins/Player/NWScript/nwnx_player.nss +++ b/Plugins/Player/NWScript/nwnx_player.nss @@ -449,6 +449,10 @@ void NWNX_Player_SendPartyInvite(object oPlayer, object oInviter, int bForceInvi /// @return the TURD object of oPlayer, or OBJECT_INVALID if no TURD exists object NWNX_Player_GetTURD(object oPlayer); +/// @brief Reloads the color palettes for oPlayer +/// @param oPlayer The player to reload the color palette for +void NWNX_Player_ReloadColorPalettes(object oPlayer); + /// @} void NWNX_Player_ForcePlaceableExamineWindow(object player, object placeable) @@ -1146,3 +1150,11 @@ object NWNX_Player_GetTURD(object oPlayer) return NWNX_GetReturnValueObject(); } + +void NWNX_Player_ReloadColorPalettes(object oPlayer) +{ + string sFunc = "ReloadColorPalettes"; + + NWNX_PushArgumentObject(oPlayer); + NWNX_CallFunction(NWNX_Player, sFunc); +} diff --git a/Plugins/Player/Player.cpp b/Plugins/Player/Player.cpp index 38aeb6d425c..40f66b013ef 100644 --- a/Plugins/Player/Player.cpp +++ b/Plugins/Player/Player.cpp @@ -1993,3 +1993,26 @@ NWNX_EXPORT ArgumentStack GetTURD(ArgumentStack&& args) return Constants::OBJECT_INVALID; } + +NWNX_EXPORT ArgumentStack ReloadColorPalettes(ArgumentStack&& args) +{ + if (auto* pPlayer = Utils::PopPlayer(args)) + { + if (auto* pMessage = Globals::AppManager()->m_pServerExoApp->GetNWSMessage()) + { + pMessage->CreateWriteMessage(4, pPlayer->m_nPlayerID, 1); + pMessage->WriteDWORD(0x20); + uint8_t* buffer; + uint32_t size; + if (pMessage->GetWriteMessage(&buffer, &size)) + { + pMessage->SendServerToPlayerMessage(pPlayer->m_nPlayerID, + Constants::MessageMajor::Resman, + 0x4, + buffer, size); + } + } + } + + return {}; +}