|
|
|
//
|
|
|
|
// 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>
|
|
|
|
#include <components/esm/creaturestats.hpp>
|
|
|
|
#include <components/esm/loadclas.hpp>
|
|
|
|
#include <components/esm/loadspel.hpp>
|
|
|
|
|
|
|
|
#include <components/openmw-mp/Base/BaseStructs.hpp>
|
|
|
|
|
|
|
|
#include <RakNetTypes.h>
|
|
|
|
|
|
|
|
namespace mwmp
|
|
|
|
{
|
|
|
|
struct CurrentContainer
|
|
|
|
{
|
|
|
|
std::string refId;
|
|
|
|
int refNumIndex;
|
|
|
|
int mpNum;
|
|
|
|
bool loot;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Item
|
|
|
|
{
|
|
|
|
std::string refId;
|
|
|
|
int count;
|
|
|
|
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
```
8 years ago
|
|
|
inline bool operator==(const Item& rhs)
|
|
|
|
{
|
|
|
|
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
```
8 years ago
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct JournalItem
|
|
|
|
{
|
|
|
|
std::string quest;
|
|
|
|
int index;
|
|
|
|
enum JOURNAL_ITEM_TYPE
|
|
|
|
{
|
|
|
|
ENTRY = 0,
|
|
|
|
INDEX = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
ESM::Cell actorCell;
|
|
|
|
ESM::CellRef actorCellRef;
|
|
|
|
|
|
|
|
int type; // 0 - An entire entry, 1 - An index
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CellState
|
|
|
|
{
|
|
|
|
ESM::Cell cell;
|
|
|
|
|
|
|
|
enum CELL_STATE_ACTION
|
|
|
|
{
|
|
|
|
LOAD = 0,
|
|
|
|
UNLOAD = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
int type; // 0 - Cell load, 1 - Cell unload
|
|
|
|
};
|
|
|
|
|
|
|
|
struct JournalChanges
|
|
|
|
{
|
|
|
|
std::vector<JournalItem> journalItems;
|
|
|
|
unsigned int count;
|
|
|
|
};
|
|
|
|
|
|
|
|
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
```
8 years ago
|
|
|
{
|
|
|
|
std::vector<Item> items;
|
|
|
|
unsigned int count;
|
|
|
|
enum ACTION_TYPE
|
|
|
|
{
|
|
|
|
SET = 0,
|
|
|
|
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
```
8 years ago
|
|
|
};
|
|
|
|
int action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SpellbookChanges
|
|
|
|
{
|
|
|
|
std::vector<ESM::Spell> spells;
|
|
|
|
unsigned int count;
|
|
|
|
enum ACTION_TYPE
|
|
|
|
{
|
|
|
|
SET = 0,
|
|
|
|
ADD,
|
|
|
|
REMOVE
|
|
|
|
};
|
|
|
|
int action; // 0 - Clear and set in entirety, 1 - Add spell, 2 - Remove spell
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CellStateChanges
|
|
|
|
{
|
|
|
|
std::vector<CellState> cellStates;
|
|
|
|
unsigned int count;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BasePlayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
struct CGStage
|
|
|
|
{
|
|
|
|
int current, end;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GUIMessageBox
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
int type;
|
|
|
|
enum GUI_TYPE
|
|
|
|
{
|
|
|
|
MessageBox = 0,
|
|
|
|
CustomMessageBox,
|
|
|
|
InputDialog,
|
|
|
|
PasswordDialog,
|
|
|
|
ListBox
|
|
|
|
};
|
|
|
|
std::string label;
|
|
|
|
std::string buttons;
|
|
|
|
|
|
|
|
std::string data;
|
|
|
|
};
|
|
|
|
|
|
|
|
BasePlayer(RakNet::RakNetGUID guid) : guid(guid)
|
|
|
|
{
|
|
|
|
inventoryChanges.action = 0;
|
|
|
|
inventoryChanges.count = 0;
|
|
|
|
spellbookChanges.action = 0;
|
|
|
|
spellbookChanges.count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
BasePlayer()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RakNet::RakNetGUID guid;
|
|
|
|
GUIMessageBox guiMessageBox;
|
|
|
|
int month;
|
|
|
|
int day;
|
|
|
|
double hour;
|
|
|
|
|
|
|
|
InventoryChanges inventoryChanges;
|
|
|
|
SpellbookChanges spellbookChanges;
|
|
|
|
JournalChanges journalChanges;
|
|
|
|
CellStateChanges cellStateChanges;
|
|
|
|
ESM::ActiveSpells activeSpells;
|
|
|
|
CurrentContainer currentContainer;
|
|
|
|
|
|
|
|
bool consoleAllowed;
|
|
|
|
bool ignorePosPacket;
|
|
|
|
|
|
|
|
unsigned int movementFlags;
|
|
|
|
char movementAnim;
|
|
|
|
char drawState;
|
|
|
|
bool isFlying;
|
|
|
|
|
|
|
|
ESM::Position position;
|
|
|
|
ESM::Position direction;
|
|
|
|
ESM::Cell cell;
|
|
|
|
ESM::NPC npc;
|
|
|
|
ESM::NpcStats npcStats;
|
|
|
|
ESM::CreatureStats creatureStats;
|
|
|
|
ESM::Class charClass;
|
|
|
|
Item equipedItems[19];
|
|
|
|
Attack attack;
|
|
|
|
std::string birthsign;
|
|
|
|
std::string chatMessage;
|
|
|
|
CGStage charGenStage;
|
|
|
|
std::string passw;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //OPENMW_BASEPLAYER_HPP
|