2016-07-23 14:02:06 +00:00
|
|
|
//
|
|
|
|
// Created by koncord on 23.07.16.
|
|
|
|
//
|
|
|
|
|
2016-08-30 04:19:49 +00:00
|
|
|
#include "GUI.hpp"
|
2016-07-23 14:02:06 +00:00
|
|
|
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
|
|
|
|
#include <apps/openmw-mp/Networking.hpp>
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-30 05:01:34 +00:00
|
|
|
void GUIFunctions::_MessageBox(unsigned short pid, int id, const char *label) noexcept
|
2016-07-23 14:02:06 +00:00
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player,);
|
|
|
|
|
|
|
|
player->guiMessageBox.id = id;
|
|
|
|
player->guiMessageBox.label = label;
|
|
|
|
player->guiMessageBox.type = Player::GUIMessageBox::MessageBox;
|
|
|
|
|
2017-04-09 05:51:28 +00:00
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
2016-07-23 14:02:06 +00:00
|
|
|
}
|
|
|
|
|
2016-08-30 04:19:49 +00:00
|
|
|
void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept
|
2016-07-23 14:02:06 +00:00
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player,);
|
|
|
|
|
|
|
|
player->guiMessageBox.id = id;
|
|
|
|
player->guiMessageBox.label = label;
|
|
|
|
player->guiMessageBox.buttons = buttons;
|
|
|
|
player->guiMessageBox.type = Player::GUIMessageBox::CustomMessageBox;
|
|
|
|
|
2017-04-09 05:51:28 +00:00
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
2016-07-23 14:02:06 +00:00
|
|
|
}
|
|
|
|
|
2016-08-30 04:19:49 +00:00
|
|
|
void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) noexcept
|
2016-07-23 14:02:06 +00:00
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player,);
|
|
|
|
|
|
|
|
player->guiMessageBox.id = id;
|
|
|
|
player->guiMessageBox.label = label;
|
|
|
|
player->guiMessageBox.type = Player::GUIMessageBox::InputDialog;
|
|
|
|
|
2017-04-09 05:51:28 +00:00
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
2016-08-30 04:19:49 +00:00
|
|
|
}
|
|
|
|
|
2016-11-03 16:21:41 +00:00
|
|
|
void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const char *items)
|
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player,);
|
|
|
|
|
|
|
|
player->guiMessageBox.id = id;
|
|
|
|
player->guiMessageBox.label = label;
|
|
|
|
player->guiMessageBox.data = items;
|
|
|
|
player->guiMessageBox.type = Player::GUIMessageBox::ListBox;
|
|
|
|
|
2017-04-09 05:51:28 +00:00
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
2016-11-03 16:21:41 +00:00
|
|
|
}
|
|
|
|
|
2016-08-30 04:19:49 +00:00
|
|
|
void GUIFunctions::SetMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state) noexcept
|
|
|
|
{
|
2016-11-17 04:39:35 +00:00
|
|
|
LOG_MESSAGE(Log::LOG_WARN, "stub");
|
2016-08-30 04:19:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GUIFunctions::SetMapVisibilityAll(unsigned short targetPID, unsigned short state) noexcept
|
|
|
|
{
|
2016-11-17 04:39:35 +00:00
|
|
|
LOG_MESSAGE(Log::LOG_WARN, "stub");
|
2016-11-03 18:59:39 +00:00
|
|
|
}
|
|
|
|
|
2017-02-01 05:44:25 +00:00
|
|
|
void GUIFunctions::SetConsoleAllow(unsigned short pid, bool state)
|
2016-11-03 18:59:39 +00:00
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player,);
|
|
|
|
|
|
|
|
player->consoleAllowed = state;
|
|
|
|
|
2017-04-09 05:51:28 +00:00
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_CONSOLE)->setPlayer(player);
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_CONSOLE)->Send(false);
|
2016-11-03 18:59:39 +00:00
|
|
|
}
|