// // Created by koncord on 07.01.16. // #ifndef OPENMW_BASEPLAYER_HPP #define OPENMW_BASEPLAYER_HPP #include #include #include #include #include #include #include #include #include namespace mwmp { struct Chat { enum class Action: uint8_t { print = 0, clear, addchannel, setchannel, closechannel, renamechannel }; unsigned channel; Action action; std::string message; }; struct CurrentContainer { std::string refId; unsigned refNumIndex; unsigned mpNum; bool loot; }; struct JournalItem { std::string quest; int index; enum class Type: uint8_t { Entry = 0, Index = 1 }; std::string actorRefId; Type type; }; struct Faction { enum ChangesMask { Rank = 1, Expulsion = 2, Reputation = 4 }; inline bool isRankChanged() const { return (changes & ChangesMask::Rank) > 0; } inline bool isExpulsionChanged() const { return (changes & ChangesMask::Expulsion) > 0; } inline bool isReputationChanged() const { return (changes & ChangesMask::Reputation) > 0; } inline void rankChanged() { changes |= ChangesMask::Rank; }; inline void expulsionChanged() { changes |= ChangesMask::Expulsion; }; inline void reputationChanged() { changes |= ChangesMask::Reputation; }; std::string factionId; int rank; int reputation; bool isExpelled; uint8_t changes = 0; }; struct Topic { std::string topicId; }; struct Kill { std::string refId; int number; }; struct Book { std::string bookId; }; struct QuickKey { std::string itemId; enum class Type: uint8_t { Item = 0, Magic, MagicItem, Unassigned }; unsigned short slot; Type type; }; struct CellState { ESM::Cell cell; enum class Type: uint8_t { Load = 0, Unload }; Type type; }; struct JournalChanges { std::vector journalItems; }; struct FactionChanges { std::vector factions; }; struct TopicChanges { std::vector topics; }; struct KillChanges { std::vector kills; }; struct BookChanges { std::vector books; }; struct MapChanges { std::vector cellsExplored; }; struct SpellbookChanges { std::vector spells; enum class Type: int8_t { None = -1, Set = 0, Add, Remove }; Type action; }; struct QuickKeyChanges { std::vector quickKeys; }; struct CellStateChanges { std::vector cellStates; }; enum class ResurrectType : uint8_t { Regular = 0, ImperialShrine, TribunalTemple }; class BasePlayer : public mwmp::BaseNetCreature { public: struct CharGenState { int currentStage, endStage; bool isFinished; }; struct GUIMessageBox { enum class Type: uint8_t { MessageBox = 0, CustomMessageBox, InputDialog, PasswordDialog, ListBox }; int id; Type type; std::string label; std::string note; std::string buttons; std::string data; }; struct GUIWindow { int32_t id; short width, height; enum class WidgetType: uint8_t { Button, Editbox, Label, ListBoxActive, ListBoxPassive, Slider }; struct Widget { WidgetType type; std::string name; bool disabled; short posX, posY; short width, height; std::vector data; }; std::vector widgets; }; BasePlayer(RakNet::RakNetGUID guid) : guid(guid) { spellbookChanges.action = SpellbookChanges::Type::None; useCreatureName = false; isWerewolf = false; } BasePlayer() { } ~BasePlayer() { } RakNet::RakNetGUID guid; GUIMessageBox guiMessageBox; int month; int day; GUIWindow guiWindow; double hour; // Track only the indexes of the attributes that have been changed, // with the attribute values themselves being stored in creatureStats.mAttributes std::vector attributeIndexChanges; // Track only the indexes of the skills that have been changed, // with the skill values themselves being stored in npcStats.mSkills std::vector skillIndexChanges; SpellbookChanges spellbookChanges; QuickKeyChanges quickKeyChanges; JournalChanges journalChanges; FactionChanges factionChanges; TopicChanges topicChanges; KillChanges killChanges; BookChanges bookChanges; MapChanges mapChanges; CellStateChanges cellStateChanges; ESM::ActiveSpells activeSpells; CurrentContainer currentContainer; struct { int currentWeather, nextWeather; float updateTime, transitionFactor; } weather; int difficulty; bool consoleAllowed; bool bedRestAllowed; bool wildernessRestAllowed; bool waitAllowed; bool ignorePosPacket; ESM::Position previousCellPosition; ESM::NPC npc; ESM::NpcStats npcStats; ESM::Class charClass; std::string birthsign; Chat chat; CharGenState charGenState; std::string passw; std::string sound; Animation animation; bool isWerewolf; std::string creatureModel; bool useCreatureName; std::string deathReason; int jailDays; bool ignoreJailTeleportation; bool ignoreJailSkillIncreases; std::string jailProgressText; std::string jailEndText; ResurrectType resurrectType; bool diedSinceArrestAttempt; bool isReceivingQuickKeys; bool isPlayingAnimation; }; } #endif //OPENMW_BASEPLAYER_HPP