1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 17:53:51 +00:00
openmw-tes3mp/components/openmw-mp/Base/BasePlayer.hpp

334 lines
6.6 KiB
C++
Raw Normal View History

//
// Created by koncord on 07.01.16.
//
#ifndef OPENMW_BASEPLAYER_HPP
#define OPENMW_BASEPLAYER_HPP
#include <components/esm/loadcell.hpp>
#include <components/esm/loadnpc.hpp>
#include <components/esm/npcstats.hpp>
2016-08-29 14:59:04 +00:00
#include <components/esm/loadclas.hpp>
2016-12-29 13:19:26 +00:00
#include <components/esm/loadspel.hpp>
#include <components/esm/activespells.hpp>
#include <components/openmw-mp/Base/BaseStructs.hpp>
#include <components/openmw-mp/Base/BaseNetCreature.hpp>
#include <RakNetTypes.h>
namespace mwmp
{
2017-12-07 23:43:29 +00:00
struct Chat
{
enum class Action : uint8_t {
print = 0,
clear,
addchannel,
setchannel,
closechannel,
renamechannel
};
unsigned channel;
Action action;
std::string message;
};
struct CurrentContainer
{
std::string refId;
unsigned refNumIndex;
unsigned mpNum;
bool loot;
};
struct JournalItem
{
std::string quest;
int index;
enum class Type
{
Entry = 0,
Index = 1
};
std::string actorRefId;
Type type;
};
struct Faction
{
std::string factionId;
int rank;
int reputation;
bool isExpelled;
};
struct Topic
{
std::string topicId;
};
struct Kill
{
std::string refId;
int number;
};
struct Book
{
std::string bookId;
};
struct QuickKey
{
std::string itemId;
enum class Type : uint8_t
{
Item = 0,
Magic,
MagicItem,
Unassigned
};
unsigned short slot;
Type type;
};
struct CellState
{
ESM::Cell cell;
enum class Type: uint8_t
{
Load = 0,
Unload
};
Type type;
};
struct JournalChanges
{
std::vector<JournalItem> journalItems;
};
struct FactionChanges
{
std::vector<Faction> factions;
enum class Type: uint8_t
{
Rank = 0,
Expulsion,
Reputation
};
Type action;
};
struct TopicChanges
{
std::vector<Topic> topics;
};
struct KillChanges
{
std::vector<Kill> kills;
};
struct BookChanges
{
std::vector<Book> books;
};
struct MapChanges
{
std::vector<ESM::Cell> cellsExplored;
};
struct SpellbookChanges
{
2016-12-29 13:19:26 +00:00
std::vector<ESM::Spell> spells;
2017-11-28 13:37:46 +00:00
enum class Type: int8_t
{
None = -1,
Set = 0,
Add,
Remove
};
Type action;
};
struct QuickKeyChanges
{
std::vector<QuickKey> quickKeys;
};
struct CellStateChanges
{
std::vector<CellState> cellStates;
};
enum class ResurrectType : uint8_t
{
Regular = 0,
ImperialShrine,
TribunalTemple
};
class BasePlayer : public mwmp::BaseNetCreature
{
public:
struct CharGenState
{
int currentStage, endStage;
bool isFinished;
};
struct GUIMessageBox
{
enum class Type: uint8_t
{
MessageBox = 0,
CustomMessageBox,
InputDialog,
PasswordDialog,
ListBox
};
int id;
Type type;
std::string label;
std::string note;
std::string buttons;
std::string data;
};
2017-11-25 15:36:42 +00:00
struct GUIWindow
{
int32_t id;
short width, height;
enum class WidgetType: uint8_t
2017-11-25 15:36:42 +00:00
{
Button,
Editbox,
Label,
ListBoxActive,
ListBoxPassive,
Slider
};
struct Widget
{
WidgetType type;
std::string name;
bool disabled;
short posX, posY;
short width, height;
std::vector<std::string> data;
};
std::vector<Widget> widgets;
};
BasePlayer(RakNet::RakNetGUID guid) : guid(guid)
{
inventoryChanges.action = InventoryChanges::Type::None;
spellbookChanges.action = SpellbookChanges::Type::None;
useCreatureName = false;
isWerewolf = false;
}
BasePlayer()
{
}
~BasePlayer()
{
}
RakNet::RakNetGUID guid;
GUIMessageBox guiMessageBox;
2016-08-30 05:24:31 +00:00
int month;
int day;
2017-11-25 15:36:42 +00:00
GUIWindow guiWindow;
2016-08-30 05:24:31 +00:00
double hour;
// Track only the indexes of the attributes that have been changed,
// with the attribute values themselves being stored in creatureStats.mAttributes
std::vector<int> attributeIndexChanges;
// Track only the indexes of the skills that have been changed,
// with the skill values themselves being stored in npcStats.mSkills
std::vector<int> skillIndexChanges;
SpellbookChanges spellbookChanges;
QuickKeyChanges quickKeyChanges;
JournalChanges journalChanges;
FactionChanges factionChanges;
TopicChanges topicChanges;
KillChanges killChanges;
BookChanges bookChanges;
MapChanges mapChanges;
CellStateChanges cellStateChanges;
ESM::ActiveSpells activeSpells;
CurrentContainer currentContainer;
struct
{
int currentWeather, nextWeather;
float updateTime, transitionFactor;
} weather;
int difficulty;
bool consoleAllowed;
bool bedRestAllowed;
bool wildernessRestAllowed;
bool waitAllowed;
bool ignorePosPacket;
ESM::Position previousCellPosition;
ESM::NPC npc;
ESM::NpcStats npcStats;
ESM::Class charClass;
std::string birthsign;
2017-12-07 23:43:29 +00:00
Chat chat;
CharGenState charGenState;
std::string passw;
std::string sound;
Animation animation;
bool isWerewolf;
std::string creatureModel;
bool useCreatureName;
std::string deathReason;
int jailDays;
bool ignoreJailTeleportation;
bool ignoreJailSkillIncreases;
std::string jailProgressText;
std::string jailEndText;
ResurrectType resurrectType;
bool diedSinceArrestAttempt;
bool isReceivingQuickKeys;
bool isPlayingAnimation;
};
}
#endif //OPENMW_BASEPLAYER_HPP