2016-01-12 03:41:44 +00:00
|
|
|
//
|
|
|
|
// 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>
|
2017-04-05 09:52:27 +00:00
|
|
|
#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>
|
2017-08-27 16:15:56 +00:00
|
|
|
#include <components/esm/activespells.hpp>
|
2017-04-17 12:12:11 +00:00
|
|
|
|
|
|
|
#include <components/openmw-mp/Base/BaseStructs.hpp>
|
2017-08-27 16:15:56 +00:00
|
|
|
#include <components/openmw-mp/Base/BaseNetCreature.hpp>
|
2017-04-17 12:12:11 +00:00
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
#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;
|
|
|
|
};
|
|
|
|
|
2017-02-05 16:45:23 +00:00
|
|
|
struct CurrentContainer
|
|
|
|
{
|
|
|
|
std::string refId;
|
2017-12-10 01:07:40 +00:00
|
|
|
unsigned refNumIndex;
|
|
|
|
unsigned mpNum;
|
2017-02-05 16:45:23 +00:00
|
|
|
bool loot;
|
|
|
|
};
|
|
|
|
|
2017-01-20 10:05:45 +00:00
|
|
|
struct JournalItem
|
|
|
|
{
|
|
|
|
std::string quest;
|
|
|
|
int index;
|
2018-01-02 04:44:53 +00:00
|
|
|
enum class Type
|
2017-01-20 10:05:45 +00:00
|
|
|
{
|
2018-01-02 04:44:53 +00:00
|
|
|
Entry = 0,
|
|
|
|
Index = 1
|
2017-01-20 10:05:45 +00:00
|
|
|
};
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2017-05-18 07:32:23 +00:00
|
|
|
std::string actorRefId;
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2018-01-02 04:44:53 +00:00
|
|
|
Type type;
|
2017-01-20 10:05:45 +00:00
|
|
|
};
|
|
|
|
|
2017-05-18 16:27:20 +00:00
|
|
|
struct Faction
|
|
|
|
{
|
|
|
|
std::string factionId;
|
|
|
|
int rank;
|
2017-07-13 10:36:00 +00:00
|
|
|
int reputation;
|
2017-05-18 16:27:20 +00:00
|
|
|
bool isExpelled;
|
|
|
|
};
|
|
|
|
|
2017-05-24 18:43:34 +00:00
|
|
|
struct Topic
|
|
|
|
{
|
|
|
|
std::string topicId;
|
|
|
|
};
|
|
|
|
|
2017-06-10 11:04:19 +00:00
|
|
|
struct Kill
|
|
|
|
{
|
|
|
|
std::string refId;
|
|
|
|
int number;
|
|
|
|
};
|
|
|
|
|
2017-06-27 05:27:14 +00:00
|
|
|
struct Book
|
|
|
|
{
|
|
|
|
std::string bookId;
|
|
|
|
};
|
|
|
|
|
2017-10-25 04:21:00 +00:00
|
|
|
struct QuickKey
|
|
|
|
{
|
|
|
|
std::string itemId;
|
|
|
|
|
2018-01-02 03:52:38 +00:00
|
|
|
enum class Type : uint8_t
|
2017-10-25 04:21:00 +00:00
|
|
|
{
|
2018-01-02 03:52:38 +00:00
|
|
|
Item = 0,
|
|
|
|
Magic,
|
|
|
|
MagicItem,
|
|
|
|
Unassigned
|
2017-10-25 04:21:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
unsigned short slot;
|
2018-01-02 03:52:38 +00:00
|
|
|
Type type;
|
2017-10-25 04:21:00 +00:00
|
|
|
};
|
|
|
|
|
2017-02-03 18:27:40 +00:00
|
|
|
struct CellState
|
|
|
|
{
|
|
|
|
ESM::Cell cell;
|
|
|
|
|
2018-01-02 04:44:53 +00:00
|
|
|
enum class Type: uint8_t
|
2017-02-03 18:27:40 +00:00
|
|
|
{
|
2018-01-02 04:44:53 +00:00
|
|
|
Load = 0,
|
|
|
|
Unload
|
2017-02-03 18:27:40 +00:00
|
|
|
};
|
|
|
|
|
2018-01-02 04:44:53 +00:00
|
|
|
Type type;
|
2017-02-03 18:27:40 +00:00
|
|
|
};
|
|
|
|
|
2017-01-20 10:05:45 +00:00
|
|
|
struct JournalChanges
|
|
|
|
{
|
|
|
|
std::vector<JournalItem> journalItems;
|
|
|
|
};
|
|
|
|
|
2017-05-18 16:27:20 +00:00
|
|
|
struct FactionChanges
|
|
|
|
{
|
|
|
|
std::vector<Faction> factions;
|
2017-07-05 04:05:52 +00:00
|
|
|
|
2018-01-02 04:44:53 +00:00
|
|
|
enum class Type: uint8_t
|
2017-07-05 04:05:52 +00:00
|
|
|
{
|
2018-01-02 04:44:53 +00:00
|
|
|
Rank = 0,
|
|
|
|
Expulsion,
|
|
|
|
Reputation
|
2017-07-05 04:05:52 +00:00
|
|
|
};
|
|
|
|
|
2018-01-02 04:44:53 +00:00
|
|
|
Type action;
|
2017-05-18 16:27:20 +00:00
|
|
|
};
|
|
|
|
|
2017-05-24 18:43:34 +00:00
|
|
|
struct TopicChanges
|
|
|
|
{
|
|
|
|
std::vector<Topic> topics;
|
|
|
|
};
|
|
|
|
|
2017-06-10 11:04:19 +00:00
|
|
|
struct KillChanges
|
|
|
|
{
|
|
|
|
std::vector<Kill> kills;
|
|
|
|
};
|
|
|
|
|
2017-06-27 05:27:14 +00:00
|
|
|
struct BookChanges
|
|
|
|
{
|
|
|
|
std::vector<Book> books;
|
|
|
|
};
|
|
|
|
|
2017-07-03 06:28:27 +00:00
|
|
|
struct MapChanges
|
|
|
|
{
|
|
|
|
std::vector<ESM::Cell> cellsExplored;
|
|
|
|
};
|
|
|
|
|
2017-01-20 10:43:05 +00:00
|
|
|
struct SpellbookChanges
|
2016-11-21 04:07:29 +00:00
|
|
|
{
|
2016-12-29 13:19:26 +00:00
|
|
|
std::vector<ESM::Spell> spells;
|
2017-11-28 13:37:46 +00:00
|
|
|
|
2018-01-02 04:44:53 +00:00
|
|
|
enum class Type: int8_t
|
2016-11-21 04:07:29 +00:00
|
|
|
{
|
2018-01-02 04:44:53 +00:00
|
|
|
None = -1,
|
|
|
|
Set = 0,
|
|
|
|
Add,
|
|
|
|
Remove
|
2016-11-21 04:07:29 +00:00
|
|
|
};
|
2018-01-02 04:44:53 +00:00
|
|
|
Type action;
|
2016-11-21 04:07:29 +00:00
|
|
|
};
|
|
|
|
|
2017-10-25 04:21:00 +00:00
|
|
|
struct QuickKeyChanges
|
|
|
|
{
|
|
|
|
std::vector<QuickKey> quickKeys;
|
|
|
|
};
|
|
|
|
|
2017-01-26 11:49:20 +00:00
|
|
|
struct CellStateChanges
|
2017-01-26 07:02:01 +00:00
|
|
|
{
|
2017-02-03 18:27:40 +00:00
|
|
|
std::vector<CellState> cellStates;
|
2017-01-26 07:02:01 +00:00
|
|
|
};
|
|
|
|
|
2017-12-10 04:01:04 +00:00
|
|
|
enum class ResurrectType : uint8_t
|
2017-06-26 22:01:45 +00:00
|
|
|
{
|
2017-12-10 04:01:04 +00:00
|
|
|
Regular = 0,
|
|
|
|
ImperialShrine,
|
|
|
|
TribunalTemple
|
2017-06-26 22:01:45 +00:00
|
|
|
};
|
|
|
|
|
2017-08-27 16:15:56 +00:00
|
|
|
class BasePlayer : public mwmp::BaseNetCreature
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2017-11-13 03:33:27 +00:00
|
|
|
struct CharGenState
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
2017-11-13 03:33:27 +00:00
|
|
|
int currentStage, endStage;
|
|
|
|
bool isFinished;
|
2016-01-12 03:41:44 +00:00
|
|
|
};
|
|
|
|
|
2016-07-23 14:02:06 +00:00
|
|
|
struct GUIMessageBox
|
|
|
|
{
|
2018-01-02 04:44:53 +00:00
|
|
|
enum class Type: uint8_t
|
2016-07-23 14:02:06 +00:00
|
|
|
{
|
|
|
|
MessageBox = 0,
|
|
|
|
CustomMessageBox,
|
|
|
|
InputDialog,
|
2016-11-03 16:21:41 +00:00
|
|
|
PasswordDialog,
|
|
|
|
ListBox
|
2016-07-23 14:02:06 +00:00
|
|
|
};
|
2018-01-02 04:44:53 +00:00
|
|
|
|
|
|
|
int id;
|
|
|
|
Type type;
|
|
|
|
|
2016-07-23 14:02:06 +00:00
|
|
|
std::string label;
|
2017-07-02 10:07:10 +00:00
|
|
|
std::string note;
|
2016-07-23 14:02:06 +00:00
|
|
|
std::string buttons;
|
|
|
|
|
|
|
|
std::string data;
|
|
|
|
};
|
|
|
|
|
2017-11-25 15:36:42 +00:00
|
|
|
struct GUIWindow
|
|
|
|
{
|
|
|
|
int32_t id;
|
|
|
|
short width, height;
|
2017-11-28 14:23:54 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
BasePlayer(RakNet::RakNetGUID guid) : guid(guid)
|
|
|
|
{
|
2018-01-02 04:44:53 +00:00
|
|
|
inventoryChanges.action = InventoryChanges::Type::None;
|
|
|
|
spellbookChanges.action = SpellbookChanges::Type::None;
|
2017-04-29 16:18:44 +00:00
|
|
|
useCreatureName = false;
|
2017-09-02 11:45:19 +00:00
|
|
|
isWerewolf = false;
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BasePlayer()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-08-27 16:15:56 +00:00
|
|
|
~BasePlayer()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
RakNet::RakNetGUID guid;
|
2016-07-23 14:02:06 +00:00
|
|
|
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;
|
2017-02-05 16:45:23 +00:00
|
|
|
|
2017-11-29 14:55:51 +00:00
|
|
|
// 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;
|
2017-11-24 10:38:42 +00:00
|
|
|
|
2017-01-20 10:43:05 +00:00
|
|
|
SpellbookChanges spellbookChanges;
|
2017-10-25 04:21:00 +00:00
|
|
|
QuickKeyChanges quickKeyChanges;
|
2017-01-24 17:32:25 +00:00
|
|
|
JournalChanges journalChanges;
|
2017-05-18 16:27:20 +00:00
|
|
|
FactionChanges factionChanges;
|
2017-05-24 18:43:34 +00:00
|
|
|
TopicChanges topicChanges;
|
2017-06-10 11:04:19 +00:00
|
|
|
KillChanges killChanges;
|
2017-06-27 05:27:14 +00:00
|
|
|
BookChanges bookChanges;
|
2017-07-03 06:28:27 +00:00
|
|
|
MapChanges mapChanges;
|
2017-01-26 11:49:20 +00:00
|
|
|
CellStateChanges cellStateChanges;
|
2017-06-27 05:27:14 +00:00
|
|
|
|
2017-02-05 16:45:23 +00:00
|
|
|
ESM::ActiveSpells activeSpells;
|
|
|
|
CurrentContainer currentContainer;
|
|
|
|
|
2018-01-01 10:04:25 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int currentWeather, nextWeather;
|
|
|
|
float updateTime, transitionFactor;
|
|
|
|
} weather;
|
|
|
|
|
2017-06-20 02:28:45 +00:00
|
|
|
int difficulty;
|
2017-11-27 05:39:02 +00:00
|
|
|
bool consoleAllowed;
|
2017-11-30 10:18:15 +00:00
|
|
|
bool bedRestAllowed;
|
|
|
|
bool wildernessRestAllowed;
|
2017-11-27 05:39:02 +00:00
|
|
|
bool waitAllowed;
|
2017-06-20 02:28:45 +00:00
|
|
|
|
2016-11-12 20:21:02 +00:00
|
|
|
bool ignorePosPacket;
|
2016-01-12 03:41:44 +00:00
|
|
|
|
2017-08-04 18:45:52 +00:00
|
|
|
ESM::Position previousCellPosition;
|
2016-01-12 03:41:44 +00:00
|
|
|
ESM::NPC npc;
|
|
|
|
ESM::NpcStats npcStats;
|
2017-02-27 21:01:33 +00:00
|
|
|
ESM::Class charClass;
|
2017-01-25 15:06:15 +00:00
|
|
|
std::string birthsign;
|
2017-12-07 23:43:29 +00:00
|
|
|
Chat chat;
|
2017-11-13 03:33:27 +00:00
|
|
|
CharGenState charGenState;
|
2016-01-12 03:41:44 +00:00
|
|
|
std::string passw;
|
2017-07-15 06:02:19 +00:00
|
|
|
|
2017-10-31 13:19:14 +00:00
|
|
|
std::string sound;
|
2017-10-27 06:10:29 +00:00
|
|
|
Animation animation;
|
|
|
|
|
2017-07-15 06:02:19 +00:00
|
|
|
bool isWerewolf;
|
2017-04-29 16:18:44 +00:00
|
|
|
std::string creatureModel;
|
|
|
|
bool useCreatureName;
|
2017-05-05 19:16:31 +00:00
|
|
|
|
|
|
|
std::string deathReason;
|
2017-06-26 22:01:45 +00:00
|
|
|
|
2017-07-10 09:33:53 +00:00
|
|
|
int jailDays;
|
2017-07-11 10:34:09 +00:00
|
|
|
bool ignoreJailTeleportation;
|
2017-07-12 15:24:37 +00:00
|
|
|
bool ignoreJailSkillIncreases;
|
2017-07-13 17:13:28 +00:00
|
|
|
std::string jailProgressText;
|
|
|
|
std::string jailEndText;
|
2017-07-10 09:33:53 +00:00
|
|
|
|
2017-12-10 04:01:04 +00:00
|
|
|
ResurrectType resurrectType;
|
2017-09-04 12:13:05 +00:00
|
|
|
|
|
|
|
bool diedSinceArrestAttempt;
|
2017-10-25 04:21:00 +00:00
|
|
|
bool isReceivingQuickKeys;
|
2017-11-01 20:00:54 +00:00
|
|
|
bool isPlayingAnimation;
|
2016-01-12 03:41:44 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //OPENMW_BASEPLAYER_HPP
|