mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 03:53:52 +00:00
3f7e163c92
Conflicts: apps/openmw-mp/CMakeLists.txt apps/openmw-mp/Script/Functions/GUI.cpp apps/openmw-mp/Script/Functions/GUI.hpp apps/openmw-mp/Script/Functions/Worldstate.cpp apps/openmw-mp/Script/Functions/Worldstate.hpp apps/openmw-mp/processors/worldstate/ProcessorRecordDynamic.hpp apps/openmw/mwmp/processors/worldstate/ProcessorRecordDynamic.hpp components/CMakeLists.txt components/openmw-mp/Packets/Player/PacketGUIBoxes.cpp
119 lines
3 KiB
C++
119 lines
3 KiB
C++
#pragma once
|
|
|
|
#include <queue>
|
|
#include "Window.hpp"
|
|
#include "BaseMgr.hpp"
|
|
|
|
class LuaState;
|
|
class Player;
|
|
|
|
class GUI final: public BaseMgr
|
|
{
|
|
public:
|
|
static void Init(LuaState &lua);
|
|
public:
|
|
explicit GUI(Player *player);
|
|
|
|
void messageBox(sol::function fn, const char *label, sol::this_environment te);
|
|
|
|
void customMessageBox(sol::function fn, const char *label, const char *buttons, sol::this_environment te);
|
|
void inputDialog(sol::function fn, const char *label, const char *note, sol::this_environment te);
|
|
void passwordDialog(sol::function fn, const char *label, const char *note, sol::this_environment te);
|
|
|
|
void listBox(sol::function fn, const char *label, const char *items, sol::this_environment te);
|
|
|
|
void onGUIAction();
|
|
|
|
//state 0 - disallow, 1 - allow
|
|
void setMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state);
|
|
void setMapVisibilityAll(unsigned short targetPID, unsigned short state);
|
|
|
|
std::shared_ptr<Window> createWindow(short x, short y, sol::function fn, sol::this_environment te);
|
|
void deleteWindow(std::shared_ptr<Window> window);
|
|
void onGUIWindowAction();
|
|
|
|
void addQuickKey(unsigned short slot, int type, const std::string &itemId);
|
|
std::string getTopicId(unsigned int i) const;
|
|
unsigned int getChanges() const;
|
|
|
|
private:
|
|
uint64_t generateGuiId();
|
|
void processUpdate() final;
|
|
std::unordered_map<int, std::shared_ptr<Window>> windows;
|
|
std::queue<std::pair<mwmp::BasePlayer::GUIMessageBox, sol::function>> guiQueue;
|
|
int lastWindowId;
|
|
};
|
|
|
|
class QuickKey
|
|
{
|
|
friend class QuickKeys;
|
|
public:
|
|
static void Init(LuaState &lua);
|
|
public:
|
|
explicit QuickKey(mwmp::QuickKey &quickKey);
|
|
|
|
int getSlot() const;
|
|
void setSlot(unsigned short slot);
|
|
|
|
mwmp::QuickKey::Type getType() const;
|
|
void setType(mwmp::QuickKey::Type slot);
|
|
|
|
std::string getItemId() const;
|
|
void setItemId(const std::string &itemId);
|
|
|
|
mwmp::QuickKey quickKey;
|
|
};
|
|
|
|
class QuickKeys final: public BaseMgr
|
|
{
|
|
public:
|
|
static void Init(LuaState &lua);
|
|
public:
|
|
explicit QuickKeys(Player *player);
|
|
|
|
void addQuickKey(const QuickKey &quickKey);
|
|
QuickKey getQuickKey(int id) const;
|
|
void setQuickKey(int id, const QuickKey &quickKey);
|
|
size_t size() const;
|
|
void clear();
|
|
|
|
private:
|
|
void processUpdate() final;
|
|
};
|
|
|
|
class MapTile
|
|
{
|
|
friend class MapTiles;
|
|
public:
|
|
static void Init(LuaState &lua);
|
|
public:
|
|
explicit MapTile(mwmp::MapTile &mapTile);
|
|
|
|
int getCellX() const;
|
|
void setCellX(int cellX);
|
|
|
|
int getCellY() const;
|
|
void setCellY(int cellY);
|
|
|
|
void loadImageFile(const char* filePath);
|
|
void saveImageFile(const char *filePath);
|
|
|
|
mwmp::MapTile mapTile;
|
|
};
|
|
|
|
class MapTiles final: public BaseMgr
|
|
{
|
|
public:
|
|
static void Init(LuaState &lua);
|
|
public:
|
|
explicit MapTiles(Player *player);
|
|
|
|
void addMapTile(const MapTile &mapTile);
|
|
MapTile getMapTile(int id) const;
|
|
void setMapTile(int id, const MapTile &mapTile);
|
|
size_t size() const;
|
|
void clear();
|
|
|
|
private:
|
|
void processUpdate() final;
|
|
};
|