1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 22:49:55 +00:00
openmw-tes3mp/apps/openmw/mwmp/LocalPlayer.hpp
Koncord c27351c19e 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-23 02:57:49 +08:00

62 lines
1.6 KiB
C++

//
// Created by koncord on 14.01.16.
//
#ifndef OPENMW_LOCALPLAYER_HPP
#define OPENMW_LOCALPLAYER_HPP
#include <components/openmw-mp/Base/BasePlayer.hpp>
#include <RakNetTypes.h>
#include <apps/openmw/mwmp/Networking.hpp>
namespace mwmp
{
class LocalPlayer : public BasePlayer
{
public:
LocalPlayer();
virtual ~LocalPlayer();
void Update();
void charGen(int stageFirst, int stageEnd);
bool charGenThread(); // return true if CGStage::current == CGStage::end
void updateDynamicStats(bool forceUpdate = false);
void updateAttributes(bool forceUpdate = false);
void updateSkills(bool forceUpdate = false);
void updateLevel(bool forceUpdate = false);
void updatePosition(bool forceUpdate = false);
void updateCell(bool forceUpdate = false);
void updateChar();
void updateEquipped(bool forceUpdate = false);
void updateInventory(bool forceUpdate = false);
void updateAttackState(bool forceUpdate = false);
void updateDeadState(bool forceUpdate = false);
void updateDrawStateAndFlags(bool forceUpdate = false);
void setDynamicStats();
void setAttributes();
void setSkills();
void setLevel();
void setPosition();
void setCell();
void setClass();
void setInventory();
void sendClass();
void sendAttack(char type);
void prepareAttack(char type, bool state);
private:
Networking *GetNetworking();
MWWorld::Ptr GetPlayerPtr();
};
}
#endif //OPENMW_LOCALPLAYER_HPP