2016-01-12 03:41:44 +00:00
|
|
|
#ifndef OPENMW_BASEPLAYER_HPP
|
|
|
|
#define OPENMW_BASEPLAYER_HPP
|
|
|
|
|
|
|
|
#include <components/esm/loadcell.hpp>
|
2018-04-13 05:37:06 +00:00
|
|
|
#include <components/esm/loadcrea.hpp>
|
2016-01-12 03:41:44 +00:00
|
|
|
#include <components/esm/loadnpc.hpp>
|
2017-04-05 09:52:27 +00:00
|
|
|
#include <components/esm/npcstats.hpp>
|
2016-01-12 03:41:44 +00:00
|
|
|
#include <components/esm/creaturestats.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-04-17 12:12:11 +00:00
|
|
|
|
|
|
|
#include <components/openmw-mp/Base/BaseStructs.hpp>
|
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
#include <RakNetTypes.h>
|
|
|
|
|
|
|
|
namespace mwmp
|
|
|
|
{
|
2017-02-05 16:45:23 +00:00
|
|
|
struct CurrentContainer
|
|
|
|
{
|
|
|
|
std::string refId;
|
2018-07-13 01:12:03 +00:00
|
|
|
unsigned int refNum;
|
2018-07-02 19:34:30 +00:00
|
|
|
unsigned int 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;
|
|
|
|
enum JOURNAL_ITEM_TYPE
|
|
|
|
{
|
|
|
|
ENTRY = 0,
|
|
|
|
INDEX = 1
|
|
|
|
};
|
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
|
|
|
|
2017-01-20 10:05:45 +00:00
|
|
|
int type; // 0 - An entire entry, 1 - An index
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
enum QUICKKEY_TYPE
|
|
|
|
{
|
|
|
|
ITEM = 0,
|
|
|
|
MAGIC = 1,
|
|
|
|
ITEM_MAGIC = 2,
|
|
|
|
UNASSIGNED = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
unsigned short slot;
|
|
|
|
int type;
|
|
|
|
};
|
|
|
|
|
2017-02-03 18:27:40 +00:00
|
|
|
struct CellState
|
|
|
|
{
|
|
|
|
ESM::Cell cell;
|
|
|
|
|
2017-02-04 19:32:06 +00:00
|
|
|
enum CELL_STATE_ACTION
|
2017-02-03 18:27:40 +00:00
|
|
|
{
|
|
|
|
LOAD = 0,
|
|
|
|
UNLOAD = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
int type; // 0 - Cell load, 1 - Cell unload
|
|
|
|
};
|
|
|
|
|
2017-01-20 10:05:45 +00:00
|
|
|
struct JournalChanges
|
|
|
|
{
|
|
|
|
std::vector<JournalItem> journalItems;
|
|
|
|
unsigned int count;
|
|
|
|
};
|
|
|
|
|
2017-05-18 16:27:20 +00:00
|
|
|
struct FactionChanges
|
|
|
|
{
|
|
|
|
std::vector<Faction> factions;
|
|
|
|
unsigned int count;
|
2017-07-05 04:05:52 +00:00
|
|
|
|
|
|
|
enum FACTION_ACTION
|
|
|
|
{
|
|
|
|
RANK = 0,
|
2017-07-13 10:36:00 +00:00
|
|
|
EXPULSION = 1,
|
|
|
|
REPUTATION = 2
|
2017-07-05 04:05:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int action; // 0 - Rank, 1 - Expulsion state, 2 - Both
|
2017-05-18 16:27:20 +00:00
|
|
|
};
|
|
|
|
|
2017-05-24 18:43:34 +00:00
|
|
|
struct TopicChanges
|
|
|
|
{
|
|
|
|
std::vector<Topic> topics;
|
|
|
|
unsigned int count;
|
|
|
|
};
|
|
|
|
|
2017-06-10 11:04:19 +00:00
|
|
|
struct KillChanges
|
|
|
|
{
|
|
|
|
std::vector<Kill> kills;
|
|
|
|
unsigned int count;
|
|
|
|
};
|
|
|
|
|
2017-06-27 05:27:14 +00:00
|
|
|
struct BookChanges
|
|
|
|
{
|
|
|
|
std::vector<Book> books;
|
|
|
|
unsigned int count;
|
|
|
|
};
|
|
|
|
|
2017-01-20 10:43:05 +00:00
|
|
|
struct InventoryChanges
|
Implement inventory functions
AddItem, RemoveItem, GetItemName, GetItemCount, GetItemHealth, GetInventorySize SendInventory
Example:
```lua
tes3mp.AddItem(pid, "glass dagger", 1, 50)
tes3mp.AddItem(pid, "glass dagger", 1, -1)
tes3mp.SendInventory(pid)
tes3mp.RemoveItem(pid, "glass dagger", 1)
tes3mp.SendInventory(pid)
local invSize = tes3mp.GetInventorySize(pid) - 1
for i = 0, invSize do
print(("%s %d %d"):format(tes3mp.GetItemName(pid, i), tes3mp.GetItemCount(pid, i), tes3mp.GetItemHealth(pid, i)))
end
```
2016-10-22 18:57:37 +00:00
|
|
|
{
|
|
|
|
std::vector<Item> items;
|
|
|
|
unsigned int count;
|
|
|
|
enum ACTION_TYPE
|
|
|
|
{
|
2017-01-20 07:07:07 +00:00
|
|
|
SET = 0,
|
2017-01-19 13:18:37 +00:00
|
|
|
ADD,
|
|
|
|
REMOVE
|
Implement inventory functions
AddItem, RemoveItem, GetItemName, GetItemCount, GetItemHealth, GetInventorySize SendInventory
Example:
```lua
tes3mp.AddItem(pid, "glass dagger", 1, 50)
tes3mp.AddItem(pid, "glass dagger", 1, -1)
tes3mp.SendInventory(pid)
tes3mp.RemoveItem(pid, "glass dagger", 1)
tes3mp.SendInventory(pid)
local invSize = tes3mp.GetInventorySize(pid) - 1
for i = 0, invSize do
print(("%s %d %d"):format(tes3mp.GetItemName(pid, i), tes3mp.GetItemCount(pid, i), tes3mp.GetItemHealth(pid, i)))
end
```
2016-10-22 18:57:37 +00:00
|
|
|
};
|
2017-02-04 19:32:06 +00:00
|
|
|
int action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item
|
2016-01-12 03:41:44 +00:00
|
|
|
};
|
|
|
|
|
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;
|
2016-11-21 04:07:29 +00:00
|
|
|
unsigned int count;
|
|
|
|
enum ACTION_TYPE
|
|
|
|
{
|
2017-01-20 07:07:07 +00:00
|
|
|
SET = 0,
|
2016-11-21 04:07:29 +00:00
|
|
|
ADD,
|
|
|
|
REMOVE
|
|
|
|
};
|
2017-02-04 19:32:06 +00:00
|
|
|
int action; // 0 - Clear and set in entirety, 1 - Add spell, 2 - Remove spell
|
2016-11-21 04:07:29 +00:00
|
|
|
};
|
|
|
|
|
2017-10-25 04:21:00 +00:00
|
|
|
struct QuickKeyChanges
|
|
|
|
{
|
|
|
|
std::vector<QuickKey> quickKeys;
|
|
|
|
unsigned int count;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
unsigned int count;
|
|
|
|
};
|
|
|
|
|
2017-06-26 22:01:45 +00:00
|
|
|
enum RESURRECT_TYPE
|
|
|
|
{
|
|
|
|
REGULAR = 0,
|
|
|
|
IMPERIAL_SHRINE,
|
|
|
|
TRIBUNAL_TEMPLE
|
|
|
|
};
|
|
|
|
|
2018-01-31 02:50:29 +00:00
|
|
|
enum MISCELLANEOUS_CHANGE_TYPE
|
|
|
|
{
|
|
|
|
MARK_LOCATION = 0,
|
|
|
|
SELECTED_SPELL
|
|
|
|
};
|
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
class BasePlayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2018-04-19 10:25:29 +00:00
|
|
|
struct CharGenState
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
2018-04-19 10:25:29 +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
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
int type;
|
|
|
|
enum GUI_TYPE
|
|
|
|
{
|
|
|
|
MessageBox = 0,
|
|
|
|
CustomMessageBox,
|
|
|
|
InputDialog,
|
2016-11-03 16:21:41 +00:00
|
|
|
PasswordDialog,
|
|
|
|
ListBox
|
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;
|
|
|
|
};
|
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
BasePlayer(RakNet::RakNetGUID guid) : guid(guid)
|
|
|
|
{
|
2017-01-20 10:43:05 +00:00
|
|
|
inventoryChanges.action = 0;
|
|
|
|
inventoryChanges.count = 0;
|
|
|
|
spellbookChanges.action = 0;
|
|
|
|
spellbookChanges.count = 0;
|
2018-04-19 17:42:27 +00:00
|
|
|
|
2018-04-26 18:56:14 +00:00
|
|
|
exchangeFullInfo = false;
|
2018-04-05 12:42:06 +00:00
|
|
|
displayCreatureName = false;
|
2018-04-09 16:21:19 +00:00
|
|
|
resetStats = false;
|
2018-04-19 17:42:27 +00:00
|
|
|
enforcedLogLevel = -1;
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BasePlayer()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RakNet::RakNetGUID guid;
|
2016-07-23 14:02:06 +00:00
|
|
|
GUIMessageBox guiMessageBox;
|
2017-02-05 16:45:23 +00:00
|
|
|
|
2018-04-19 20:28:03 +00:00
|
|
|
// Track only the indexes of the attributes that have been changed,
|
|
|
|
// with the attribute values themselves being stored in creatureStats.mAttributes
|
2018-07-03 10:40:11 +00:00
|
|
|
std::vector<uint8_t> attributeIndexChanges;
|
2018-04-19 20:28:03 +00:00
|
|
|
|
|
|
|
// Track only the indexes of the skills that have been changed,
|
|
|
|
// with the skill values themselves being stored in npcStats.mSkills
|
2018-07-03 10:40:11 +00:00
|
|
|
std::vector<uint8_t> skillIndexChanges;
|
2018-04-19 12:18:38 +00:00
|
|
|
|
2018-04-20 21:43:49 +00:00
|
|
|
// Track only the indexes of the dynamic states that have been changed,
|
|
|
|
// with the dynamicStats themselves being stored in creatureStats.mDynamic
|
2018-07-03 10:40:11 +00:00
|
|
|
std::vector<uint8_t> statsDynamicIndexChanges;
|
2018-04-20 21:43:49 +00:00
|
|
|
|
2018-04-20 19:46:16 +00:00
|
|
|
// Track only the indexes of the equipment items that have been changed,
|
|
|
|
// with the items themselves being stored in equipmentItems
|
|
|
|
std::vector<int> equipmentIndexChanges;
|
|
|
|
|
2018-04-26 18:56:14 +00:00
|
|
|
bool exchangeFullInfo;
|
|
|
|
|
2017-01-20 10:43:05 +00:00
|
|
|
InventoryChanges inventoryChanges;
|
|
|
|
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-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;
|
|
|
|
|
2017-06-20 02:28:45 +00:00
|
|
|
int difficulty;
|
2018-03-11 02:50:59 +00:00
|
|
|
int enforcedLogLevel;
|
2018-02-14 03:53:44 +00:00
|
|
|
float physicsFramerate;
|
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-02-27 21:01:33 +00:00
|
|
|
unsigned int movementFlags;
|
|
|
|
char movementAnim;
|
|
|
|
char drawState;
|
|
|
|
bool isFlying;
|
|
|
|
|
2017-01-25 15:06:15 +00:00
|
|
|
ESM::Position position;
|
|
|
|
ESM::Position direction;
|
2017-08-04 18:45:52 +00:00
|
|
|
ESM::Position previousCellPosition;
|
2018-04-29 20:47:17 +00:00
|
|
|
ESM::Position momentum;
|
2016-01-12 03:41:44 +00:00
|
|
|
ESM::Cell cell;
|
|
|
|
ESM::NPC npc;
|
|
|
|
ESM::NpcStats npcStats;
|
2018-04-13 05:37:06 +00:00
|
|
|
ESM::Creature creature;
|
2016-01-12 03:41:44 +00:00
|
|
|
ESM::CreatureStats creatureStats;
|
2017-02-27 21:01:33 +00:00
|
|
|
ESM::Class charClass;
|
2018-04-20 19:46:16 +00:00
|
|
|
Item equipmentItems[19];
|
2016-01-12 03:41:44 +00:00
|
|
|
Attack attack;
|
2017-01-25 15:06:15 +00:00
|
|
|
std::string birthsign;
|
2016-01-12 03:41:44 +00:00
|
|
|
std::string chatMessage;
|
2018-04-19 10:25:29 +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;
|
|
|
|
|
2018-04-09 16:21:19 +00:00
|
|
|
bool resetStats;
|
2018-02-01 00:11:45 +00:00
|
|
|
float scale;
|
2017-07-15 06:02:19 +00:00
|
|
|
bool isWerewolf;
|
2018-04-05 12:42:06 +00:00
|
|
|
|
|
|
|
bool displayCreatureName;
|
|
|
|
std::string creatureRefId;
|
2017-05-05 19:16:31 +00:00
|
|
|
|
2017-06-10 08:43:40 +00:00
|
|
|
bool isChangingRegion;
|
|
|
|
|
2018-07-05 19:24:51 +00:00
|
|
|
Target killer;
|
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-06-26 22:01:45 +00:00
|
|
|
unsigned int resurrectType;
|
2018-01-31 02:50:29 +00:00
|
|
|
unsigned int miscellaneousChangeType;
|
|
|
|
|
|
|
|
ESM::Cell markCell;
|
|
|
|
ESM::Position markPosition;
|
2018-02-06 04:36:46 +00:00
|
|
|
std::string selectedSpellId;
|
2017-09-04 12:13:05 +00:00
|
|
|
|
2017-10-25 04:21:00 +00:00
|
|
|
bool isReceivingQuickKeys;
|
2017-11-01 20:00:54 +00:00
|
|
|
bool isPlayingAnimation;
|
2018-02-06 04:36:46 +00:00
|
|
|
bool diedSinceArrestAttempt;
|
2016-01-12 03:41:44 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //OPENMW_BASEPLAYER_HPP
|