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-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;
|
|
|
|
int refNumIndex;
|
2017-04-04 08:07:16 +00:00
|
|
|
int mpNum;
|
2017-02-05 16:45:23 +00:00
|
|
|
bool loot;
|
|
|
|
};
|
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
struct Item
|
|
|
|
{
|
2017-02-05 07:01:33 +00:00
|
|
|
std::string refId;
|
2016-01-12 03:41:44 +00:00
|
|
|
int count;
|
2017-02-05 12:56:27 +00:00
|
|
|
int charge;
|
|
|
|
|
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
|
|
|
inline bool operator==(const Item& rhs)
|
|
|
|
{
|
2017-02-05 12:56:27 +00:00
|
|
|
return refId == rhs.refId && count == rhs.count && charge == rhs.charge;
|
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-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
|
|
|
|
|
|
|
ESM::Cell actorCell;
|
2017-05-18 07:32:23 +00:00
|
|
|
std::string actorRefId;
|
|
|
|
int actorRefNumIndex;
|
|
|
|
int actorMpNum;
|
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;
|
|
|
|
bool isExpelled;
|
|
|
|
};
|
|
|
|
|
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-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-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;
|
|
|
|
};
|
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
class BasePlayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
struct CGStage
|
|
|
|
{
|
|
|
|
int current, end;
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
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;
|
2017-04-29 16:18:44 +00:00
|
|
|
useCreatureName = false;
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BasePlayer()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
double hour;
|
2017-02-05 16:45:23 +00:00
|
|
|
|
2017-01-20 10:43:05 +00:00
|
|
|
InventoryChanges inventoryChanges;
|
|
|
|
SpellbookChanges spellbookChanges;
|
2017-01-24 17:32:25 +00:00
|
|
|
JournalChanges journalChanges;
|
2017-05-18 16:27:20 +00:00
|
|
|
FactionChanges factionChanges;
|
2017-01-26 11:49:20 +00:00
|
|
|
CellStateChanges cellStateChanges;
|
2017-02-05 16:45:23 +00:00
|
|
|
ESM::ActiveSpells activeSpells;
|
|
|
|
CurrentContainer currentContainer;
|
|
|
|
|
2016-11-03 18:59:39 +00:00
|
|
|
bool consoleAllowed;
|
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;
|
2016-01-12 03:41:44 +00:00
|
|
|
ESM::Cell cell;
|
|
|
|
ESM::NPC npc;
|
|
|
|
ESM::NpcStats npcStats;
|
|
|
|
ESM::CreatureStats creatureStats;
|
2017-02-27 21:01:33 +00:00
|
|
|
ESM::Class charClass;
|
2016-01-12 03:41:44 +00:00
|
|
|
Item equipedItems[19];
|
|
|
|
Attack attack;
|
2017-01-25 15:06:15 +00:00
|
|
|
std::string birthsign;
|
2016-01-12 03:41:44 +00:00
|
|
|
std::string chatMessage;
|
2017-01-25 15:06:15 +00:00
|
|
|
CGStage charGenStage;
|
2016-01-12 03:41:44 +00:00
|
|
|
std::string passw;
|
2017-04-29 16:18:44 +00:00
|
|
|
std::string creatureModel;
|
|
|
|
bool useCreatureName;
|
2017-05-05 19:16:31 +00:00
|
|
|
|
|
|
|
std::string deathReason;
|
2016-01-12 03:41:44 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //OPENMW_BASEPLAYER_HPP
|