Advertisement
Rellyx

player.h

Sep 22nd, 2018
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 39.56 KB | None | 0 0
  1. /**
  2.  * The Forgotten Server - a free and open-source MMORPG server emulator
  3.  * Copyright (C) 2018  Mark Samman <mark.samman@gmail.com>
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or
  8.  * (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License along
  16.  * with this program; if not, write to the Free Software Foundation, Inc.,
  17.  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18.  */
  19.  
  20. #ifndef FS_PLAYER_H_4083D3D3A05B4EDE891B31BB720CD06F
  21. #define FS_PLAYER_H_4083D3D3A05B4EDE891B31BB720CD06F
  22.  
  23. #include "creature.h"
  24. #include "container.h"
  25. #include "cylinder.h"
  26. #include "outfit.h"
  27. #include "enums.h"
  28. #include "vocation.h"
  29. #include "protocolgame.h"
  30. #include "ioguild.h"
  31. #include "party.h"
  32. #include "inbox.h"
  33. #include "depotchest.h"
  34. #include "depotlocker.h"
  35. #include "guild.h"
  36. #include "groups.h"
  37. #include "town.h"
  38. #include "mounts.h"
  39.  
  40. class House;
  41. class NetworkMessage;
  42. class Weapon;
  43. class ProtocolGame;
  44. class Npc;
  45. class Party;
  46. class SchedulerTask;
  47. class Bed;
  48. class Guild;
  49.  
  50. enum skillsid_t {
  51.     SKILLVALUE_LEVEL = 0,
  52.     SKILLVALUE_TRIES = 1,
  53.     SKILLVALUE_PERCENT = 2,
  54. };
  55.  
  56. enum fightMode_t : uint8_t {
  57.     FIGHTMODE_ATTACK = 1,
  58.     FIGHTMODE_BALANCED = 2,
  59.     FIGHTMODE_DEFENSE = 3,
  60. };
  61.  
  62. enum pvpMode_t : uint8_t {
  63.     PVP_MODE_DOVE = 0,
  64.     PVP_MODE_WHITE_HAND = 1,
  65.     PVP_MODE_YELLOW_HAND = 2,
  66.     PVP_MODE_RED_FIST = 3,
  67. };
  68.  
  69. enum tradestate_t : uint8_t {
  70.     TRADE_NONE,
  71.     TRADE_INITIATED,
  72.     TRADE_ACCEPT,
  73.     TRADE_ACKNOWLEDGE,
  74.     TRADE_TRANSFER,
  75. };
  76.  
  77. enum attackHand_t : uint8_t {
  78.     HAND_LEFT,
  79.     HAND_RIGHT,
  80. };
  81.  
  82. struct VIPEntry {
  83.     VIPEntry(uint32_t guid, std::string name, std::string description, uint32_t icon, bool notify) :
  84.         guid(guid), name(std::move(name)), description(std::move(description)), icon(icon), notify(notify) {}
  85.  
  86.     uint32_t guid;
  87.     std::string name;
  88.     std::string description;
  89.     uint32_t icon;
  90.     bool notify;
  91. };
  92.  
  93. struct OpenContainer {
  94.     Container* container;
  95.     uint16_t index;
  96. };
  97.  
  98. struct OutfitEntry {
  99.     constexpr OutfitEntry(uint16_t lookType, uint8_t addons) : lookType(lookType), addons(addons) {}
  100.  
  101.     uint16_t lookType;
  102.     uint8_t addons;
  103. };
  104.  
  105. struct Skill {
  106.     uint64_t tries = 0;
  107.     uint16_t level = 10;
  108.     uint8_t percent = 0;
  109. };
  110.  
  111. using MuteCountMap = std::map<uint32_t, uint32_t>;
  112.  
  113. static constexpr int32_t PLAYER_MAX_SPEED = 1500;
  114. static constexpr int32_t PLAYER_MIN_SPEED = 10;
  115.  
  116. class Player final : public Creature, public Cylinder
  117. {
  118.     public:
  119.         explicit Player(ProtocolGame_ptr p);
  120.         ~Player();
  121.  
  122.         // non-copyable
  123.         Player(const Player&) = delete;
  124.         Player& operator=(const Player&) = delete;
  125.  
  126.         Player* getPlayer() override {
  127.             return this;
  128.         }
  129.         const Player* getPlayer() const override {
  130.             return this;
  131.         }
  132.  
  133.         void setID() override {
  134.             if (id == 0) {
  135.                 id = playerAutoID++;
  136.             }
  137.         }
  138.  
  139.         static MuteCountMap muteCountMap;
  140.  
  141.         const std::string& getName() const override {
  142.             return name;
  143.         }
  144.         void setName(std::string name) {
  145.             this->name = std::move(name);
  146.         }
  147.         const std::string& getNameDescription() const override {
  148.             return name;
  149.         }
  150.         std::string getDescription(int32_t lookDistance) const override;
  151.  
  152.         CreatureType_t getType() const override {
  153.             return CREATURETYPE_PLAYER;
  154.         }
  155.  
  156.         uint8_t getCurrentMount() const;
  157.         void setCurrentMount(uint8_t mountId);
  158.         bool isMounted() const {
  159.             return defaultOutfit.lookMount != 0;
  160.         }
  161.         bool toggleMount(bool mount);
  162.         bool tameMount(uint8_t mountId);
  163.         bool untameMount(uint8_t mountId);
  164.         bool hasMount(const Mount* mount) const;
  165.         void dismount();
  166.  
  167.         void sendFYIBox(const std::string& message) {
  168.             if (client) {
  169.                 client->sendFYIBox(message);
  170.             }
  171.         }
  172.  
  173.         void setGUID(uint32_t guid) {
  174.             this->guid = guid;
  175.         }
  176.         uint32_t getGUID() const {
  177.             return guid;
  178.         }
  179.         bool canSeeInvisibility() const override {
  180.             return hasFlag(PlayerFlag_CanSenseInvisibility) || group->access;
  181.         }
  182.  
  183.         void removeList() override;
  184.         void addList() override;
  185.         void kickPlayer(bool displayEffect);
  186.  
  187.         static uint64_t getExpForLevel(int32_t lv) {
  188.             lv--;
  189.             return ((50ULL * lv * lv * lv) - (150ULL * lv * lv) + (400ULL * lv)) / 3ULL;
  190.         }
  191.  
  192.         uint16_t getStaminaMinutes() const {
  193.             return staminaMinutes;
  194.         }
  195.  
  196.         bool addOfflineTrainingTries(skills_t skill, uint64_t tries);
  197.  
  198.         void addOfflineTrainingTime(int32_t addTime) {
  199.             offlineTrainingTime = std::min<int32_t>(12 * 3600 * 1000, offlineTrainingTime + addTime);
  200.         }
  201.         void removeOfflineTrainingTime(int32_t removeTime) {
  202.             offlineTrainingTime = std::max<int32_t>(0, offlineTrainingTime - removeTime);
  203.         }
  204.         int32_t getOfflineTrainingTime() const {
  205.             return offlineTrainingTime;
  206.         }
  207.  
  208.         int32_t getOfflineTrainingSkill() const {
  209.             return offlineTrainingSkill;
  210.         }
  211.         void setOfflineTrainingSkill(int32_t skill) {
  212.             offlineTrainingSkill = skill;
  213.         }
  214.  
  215.         uint64_t getBankBalance() const {
  216.             return bankBalance;
  217.         }
  218.         void setBankBalance(uint64_t balance) {
  219.             bankBalance = balance;
  220.         }
  221.  
  222.         Guild* getGuild() const {
  223.             return guild;
  224.         }
  225.         void setGuild(Guild* guild);
  226.  
  227.         const GuildRank* getGuildRank() const {
  228.             return guildRank;
  229.         }
  230.         void setGuildRank(const GuildRank* newGuildRank) {
  231.             guildRank = newGuildRank;
  232.         }
  233.  
  234.         bool isGuildMate(const Player* player) const;
  235.  
  236.         const std::string& getGuildNick() const {
  237.             return guildNick;
  238.         }
  239.         void setGuildNick(std::string nick) {
  240.             guildNick = nick;
  241.         }
  242.  
  243.         bool isInWar(const Player* player) const;
  244.         bool isInWarList(uint32_t guildId) const;
  245.  
  246.         void setLastWalkthroughAttempt(int64_t walkthroughAttempt) {
  247.             lastWalkthroughAttempt = walkthroughAttempt;
  248.         }
  249.         void setLastWalkthroughPosition(Position walkthroughPosition) {
  250.             lastWalkthroughPosition = walkthroughPosition;
  251.         }
  252.  
  253.         Inbox* getInbox() const {
  254.             return inbox;
  255.         }
  256.  
  257.         uint16_t getClientIcons() const;
  258.  
  259.         const GuildWarVector& getGuildWarVector() const {
  260.             return guildWarVector;
  261.         }
  262.  
  263.         Vocation* getVocation() const {
  264.             return vocation;
  265.         }
  266.  
  267.         OperatingSystem_t getOperatingSystem() const {
  268.             return operatingSystem;
  269.         }
  270.         void setOperatingSystem(OperatingSystem_t clientos) {
  271.             operatingSystem = clientos;
  272.         }
  273.  
  274.         uint16_t getProtocolVersion() const {
  275.             if (!client) {
  276.                 return 0;
  277.             }
  278.  
  279.             return client->getVersion();
  280.         }
  281.  
  282.         bool hasSecureMode() const {
  283.             return secureMode;
  284.         }
  285.  
  286.         void setParty(Party* party) {
  287.             this->party = party;
  288.         }
  289.         Party* getParty() const {
  290.             return party;
  291.         }
  292.         PartyShields_t getPartyShield(const Player* player) const;
  293.         bool isInviting(const Player* player) const;
  294.         bool isPartner(const Player* player) const;
  295.         void sendPlayerPartyIcons(Player* player);
  296.         bool addPartyInvitation(Party* party);
  297.         void removePartyInvitation(Party* party);
  298.         void clearPartyInvitations();
  299.  
  300.         GuildEmblems_t getGuildEmblem(const Player* player) const;
  301.  
  302.         uint64_t getSpentMana() const {
  303.             return manaSpent;
  304.         }
  305.  
  306.         bool hasFlag(PlayerFlags value) const {
  307.             return (group->flags & value) != 0;
  308.         }
  309.  
  310.         BedItem* getBedItem() {
  311.             return bedItem;
  312.         }
  313.         void setBedItem(BedItem* b) {
  314.             bedItem = b;
  315.         }
  316.  
  317.         void addBlessing(uint8_t blessing) {
  318.             blessings |= blessing;
  319.         }
  320.         void removeBlessing(uint8_t blessing) {
  321.             blessings &= ~blessing;
  322.         }
  323.         bool hasBlessing(uint8_t value) const {
  324.             return (blessings & (static_cast<uint8_t>(1) << value)) != 0;
  325.         }
  326.  
  327.         bool isOffline() const {
  328.             return (getID() == 0);
  329.         }
  330.         void disconnect() {
  331.             if (client) {
  332.                 client->disconnect();
  333.             }
  334.         }
  335.         uint32_t getIP() const;
  336.  
  337.         void addContainer(uint8_t cid, Container* container);
  338.         void closeContainer(uint8_t cid);
  339.         void setContainerIndex(uint8_t cid, uint16_t index);
  340.  
  341.         Container* getContainerByID(uint8_t cid);
  342.         int8_t getContainerID(const Container* container) const;
  343.         uint16_t getContainerIndex(uint8_t cid) const;
  344.  
  345.         bool canOpenCorpse(uint32_t ownerId) const;
  346.  
  347.         void addStorageValue(const uint32_t key, const int32_t value, const bool isLogin = false);
  348.         bool getStorageValue(const uint32_t key, int32_t& value) const;
  349.         void genReservedStorageRange();
  350.  
  351.         void setGroup(Group* newGroup) {
  352.             group = newGroup;
  353.         }
  354.         Group* getGroup() const {
  355.             return group;
  356.         }
  357.  
  358.         void setInMarket(bool value) {
  359.             inMarket = value;
  360.         }
  361.         bool isInMarket() const {
  362.             return inMarket;
  363.         }
  364.  
  365.         void setLastDepotId(int16_t newId) {
  366.             lastDepotId = newId;
  367.         }
  368.         int16_t getLastDepotId() const {
  369.             return lastDepotId;
  370.         }
  371.  
  372.         void resetIdleTime() {
  373.             idleTime = 0;
  374.         }
  375.  
  376.         bool isInGhostMode() const override {
  377.             return ghostMode;
  378.         }
  379.         void switchGhostMode() {
  380.             ghostMode = !ghostMode;
  381.         }
  382.  
  383.         uint32_t getAccount() const {
  384.             return accountNumber;
  385.         }
  386.         AccountType_t getAccountType() const {
  387.             return accountType;
  388.         }
  389.         uint32_t getLevel() const {
  390.             return level;
  391.         }
  392.         uint8_t getLevelPercent() const {
  393.             return levelPercent;
  394.         }
  395.         uint32_t getMagicLevel() const {
  396.             return std::max<int32_t>(0, magLevel + varStats[STAT_MAGICPOINTS]);
  397.         }
  398.         uint32_t getBaseMagicLevel() const {
  399.             return magLevel;
  400.         }
  401.         uint8_t getMagicLevelPercent() const {
  402.             return magLevelPercent;
  403.         }
  404.         uint8_t getSoul() const {
  405.             return soul;
  406.         }
  407.         bool isAccessPlayer() const {
  408.             return group->access;
  409.         }
  410.         bool isPremium() const;
  411.         void setPremiumDays(int32_t v);
  412.  
  413.         uint16_t getHelpers() const;
  414.  
  415.         bool setVocation(uint16_t vocId);
  416.         uint16_t getVocationId() const {
  417.             return vocation->getId();
  418.         }
  419.  
  420.         PlayerSex_t getSex() const {
  421.             return sex;
  422.         }
  423.         void setSex(PlayerSex_t);
  424.         uint64_t getExperience() const {
  425.             return experience;
  426.         }
  427.  
  428.         time_t getLastLoginSaved() const {
  429.             return lastLoginSaved;
  430.         }
  431.  
  432.         time_t getLastLogout() const {
  433.             return lastLogout;
  434.         }
  435.  
  436.         const Position& getLoginPosition() const {
  437.             return loginPosition;
  438.         }
  439.         const Position& getTemplePosition() const {
  440.             return town->getTemplePosition();
  441.         }
  442.         Town* getTown() const {
  443.             return town;
  444.         }
  445.         void setTown(Town* town) {
  446.             this->town = town;
  447.         }
  448.  
  449.         void clearModalWindows();
  450.         bool hasModalWindowOpen(uint32_t modalWindowId) const;
  451.         void onModalWindowHandled(uint32_t modalWindowId);
  452.  
  453.         bool isPushable() const override;
  454.         uint32_t isMuted() const;
  455.         void addMessageBuffer();
  456.         void removeMessageBuffer();
  457.  
  458.         bool removeItemOfType(uint16_t itemId, uint32_t amount, int32_t subType, bool ignoreEquipped = false) const;
  459.  
  460.         uint32_t getCapacity() const {
  461.             if (hasFlag(PlayerFlag_CannotPickupItem)) {
  462.                 return 0;
  463.             } else if (hasFlag(PlayerFlag_HasInfiniteCapacity)) {
  464.                 return std::numeric_limits<uint32_t>::max();
  465.             }
  466.             return capacity;
  467.         }
  468.  
  469.         uint32_t getFreeCapacity() const {
  470.             if (hasFlag(PlayerFlag_CannotPickupItem)) {
  471.                 return 0;
  472.             } else if (hasFlag(PlayerFlag_HasInfiniteCapacity)) {
  473.                 return std::numeric_limits<uint32_t>::max();
  474.             } else {
  475.                 return std::max<int32_t>(0, capacity - inventoryWeight);
  476.             }
  477.         }
  478.  
  479.         int32_t getMaxHealth() const override {
  480.             return std::max<int32_t>(1, healthMax + varStats[STAT_MAXHITPOINTS]);
  481.         }
  482.         uint32_t getMana() const {
  483.             return mana;
  484.         }
  485.         uint32_t getMaxMana() const {
  486.             return std::max<int32_t>(0, manaMax + varStats[STAT_MAXMANAPOINTS]);
  487.         }
  488.  
  489.         Item* getInventoryItem(slots_t slot) const;
  490.  
  491.         bool isItemAbilityEnabled(slots_t slot) const {
  492.             return inventoryAbilities[slot];
  493.         }
  494.         void setItemAbility(slots_t slot, bool enabled) {
  495.             inventoryAbilities[slot] = enabled;
  496.         }
  497.  
  498.         void setVarSkill(skills_t skill, int32_t modifier) {
  499.             varSkills[skill] += modifier;
  500.         }
  501.  
  502.         void setVarSpecialSkill(SpecialSkills_t skill, int32_t modifier) {
  503.             varSpecialSkills[skill] += modifier;
  504.         }
  505.  
  506.         void setVarStats(stats_t stat, int32_t modifier);
  507.         int32_t getDefaultStats(stats_t stat) const;
  508.  
  509.         void addConditionSuppressions(uint32_t conditions);
  510.         void removeConditionSuppressions(uint32_t conditions);
  511.  
  512.         DepotChest* getDepotChest(uint32_t depotId, bool autoCreate);
  513.         DepotLocker* getDepotLocker(uint32_t depotId);
  514.         void onReceiveMail() const;
  515.         bool isNearDepotBox() const;
  516.  
  517.         bool canSee(const Position& pos) const override;
  518.         bool canSeeCreature(const Creature* creature) const override;
  519.  
  520.         bool canWalkthrough(const Creature* creature) const;
  521.         bool canWalkthroughEx(const Creature* creature) const;
  522.  
  523.         RaceType_t getRace() const override {
  524.             return RACE_BLOOD;
  525.         }
  526.  
  527.         uint64_t getMoney() const;
  528.  
  529.         //safe-trade functions
  530.         void setTradeState(tradestate_t state) {
  531.             tradeState = state;
  532.         }
  533.         tradestate_t getTradeState() const {
  534.             return tradeState;
  535.         }
  536.         Item* getTradeItem() {
  537.             return tradeItem;
  538.         }
  539.  
  540.         //shop functions
  541.         void setShopOwner(Npc* owner, int32_t onBuy, int32_t onSell) {
  542.             shopOwner = owner;
  543.             purchaseCallback = onBuy;
  544.             saleCallback = onSell;
  545.         }
  546.  
  547.         Npc* getShopOwner(int32_t& onBuy, int32_t& onSell) {
  548.             onBuy = purchaseCallback;
  549.             onSell = saleCallback;
  550.             return shopOwner;
  551.         }
  552.  
  553.         const Npc* getShopOwner(int32_t& onBuy, int32_t& onSell) const {
  554.             onBuy = purchaseCallback;
  555.             onSell = saleCallback;
  556.             return shopOwner;
  557.         }
  558.  
  559.         //V.I.P. functions
  560.         void notifyStatusChange(Player* loginPlayer, VipStatus_t status);
  561.         bool removeVIP(uint32_t vipGuid);
  562.         bool addVIP(uint32_t vipGuid, const std::string& vipName, VipStatus_t status);
  563.         bool addVIPInternal(uint32_t vipGuid);
  564.         bool editVIP(uint32_t vipGuid, const std::string& description, uint32_t icon, bool notify);
  565.  
  566.         //follow functions
  567.         bool setFollowCreature(Creature* creature) override;
  568.         void goToFollowCreature() override;
  569.  
  570.         //follow events
  571.         void onFollowCreature(const Creature* creature) override;
  572.  
  573.         //walk events
  574.         void onWalk(Direction& dir) override;
  575.         void onWalkAborted() override;
  576.         void onWalkComplete() override;
  577.  
  578.         void stopWalk();
  579.         void openShopWindow(Npc* npc, const std::list<ShopInfo>& shop);
  580.         bool closeShopWindow(bool sendCloseShopWindow = true);
  581.         bool updateSaleShopList(const Item* item);
  582.         bool hasShopItemForSale(uint32_t itemId, uint8_t subType) const;
  583.  
  584.         void setChaseMode(bool mode);
  585.         void setFightMode(fightMode_t mode) {
  586.             fightMode = mode;
  587.         }
  588.         void setSecureMode(bool mode) {
  589.             secureMode = mode;
  590.         }
  591.  
  592.         //combat functions
  593.         bool setAttackedCreature(Creature* creature) override;
  594.         bool isImmune(CombatType_t type) const override;
  595.         bool isImmune(ConditionType_t type) const override;
  596.         bool hasShield() const;
  597.         bool isAttackable() const override;
  598.         static bool lastHitIsPlayer(Creature* lastHitCreature);
  599.  
  600.         void changeHealth(int32_t healthChange, bool sendHealthChange = true) override;
  601.         void changeMana(int32_t manaChange);
  602.         void changeSoul(int32_t soulChange);
  603.  
  604.         bool isPzLocked() const {
  605.             return pzLocked;
  606.         }
  607.         BlockType_t blockHit(Creature* attacker, CombatType_t combatType, int32_t& damage,
  608.                                      bool checkDefense = false, bool checkArmor = false, bool field = false) override;
  609.         void doAttacking(uint32_t interval) override;
  610.         bool hasExtraSwing() override {
  611.             return lastAttack > 0 && ((OTSYS_TIME() - lastAttack) >= getAttackSpeed());
  612.         }
  613.  
  614.         uint16_t getSpecialSkill(uint8_t skill) const {
  615.             return std::max<int32_t>(0, varSpecialSkills[skill]);
  616.         }
  617.         uint16_t getSkillLevel(uint8_t skill) const {
  618.             return std::max<int32_t>(0, skills[skill].level + varSkills[skill]);
  619.         }
  620.         uint16_t getBaseSkill(uint8_t skill) const {
  621.             return skills[skill].level;
  622.         }
  623.         uint8_t getSkillPercent(uint8_t skill) const {
  624.             return skills[skill].percent;
  625.         }
  626.  
  627.         bool getAddAttackSkill() const {
  628.             return addAttackSkillPoint;
  629.         }
  630.         BlockType_t getLastAttackBlockType() const {
  631.             return lastAttackBlockType;
  632.         }
  633.  
  634.         void switchAttackHand() {
  635.             lastAttackHand = lastAttackHand == HAND_LEFT ? HAND_RIGHT : HAND_LEFT;
  636.         }
  637.  
  638.         slots_t getAttackHand() const {
  639.             return lastAttackHand == HAND_LEFT ? CONST_SLOT_LEFT : CONST_SLOT_RIGHT;
  640.         }
  641.  
  642.         void switchBlockSkillAdvance() {
  643.             blockSkillAdvance = !blockSkillAdvance;
  644.         }
  645.  
  646.         bool getBlockSkillAdvance() {
  647.             return blockSkillAdvance;
  648.         }
  649.  
  650.         Item* getWeapon(slots_t slot, bool ignoreAmmo) const;
  651.         Item* getWeapon(bool ignoreAmmo = false) const;
  652.         WeaponType_t getWeaponType() const;
  653.         int32_t getWeaponSkill(const Item* item) const;
  654.         void getShieldAndWeapon(const Item*& shield, const Item*& weapon) const;
  655.         bool isDualWielding() const;
  656.  
  657.         void drainHealth(Creature* attacker, int32_t damage) override;
  658.         void drainMana(Creature* attacker, int32_t manaLoss);
  659.         void addManaSpent(uint64_t amount);
  660.         void addSkillAdvance(skills_t skill, uint64_t count);
  661.  
  662.         int32_t getArmor() const override;
  663.         int32_t getDefense() const override;
  664.         float getAttackFactor() const override;
  665.         float getDefenseFactor() const override;
  666.  
  667.         void addInFightTicks(bool pzlock = false);
  668.  
  669.         uint64_t getGainedExperience(Creature* attacker) const override;
  670.  
  671.         //combat event functions
  672.         void onAddCondition(ConditionType_t type) override;
  673.         void onAddCombatCondition(ConditionType_t type) override;
  674.         void onEndCondition(ConditionType_t type) override;
  675.         void onCombatRemoveCondition(Condition* condition) override;
  676.         void onAttackedCreature(Creature* target) override;
  677.         void onAttacked() override;
  678.         void onAttackedCreatureDrainHealth(Creature* target, int32_t points) override;
  679.         void onTargetCreatureGainHealth(Creature* target, int32_t points) override;
  680.         bool onKilledCreature(Creature* target, bool lastHit = true) override;
  681.         void onGainExperience(uint64_t gainExp, Creature* target) override;
  682.         void onGainSharedExperience(uint64_t gainExp, Creature* source);
  683.         void onAttackedCreatureBlockHit(BlockType_t blockType) override;
  684.         void onBlockHit() override;
  685.         void onChangeZone(ZoneType_t zone) override;
  686.         void onAttackedCreatureChangeZone(ZoneType_t zone) override;
  687.         void onIdleStatus() override;
  688.         void onPlacedCreature() override;
  689.  
  690.         LightInfo getCreatureLight() const override;
  691.  
  692.         Skulls_t getSkull() const override;
  693.         Skulls_t getSkullClient(const Creature* creature) const override;
  694.         int64_t getSkullTicks() const { return skullTicks; }
  695.         void setSkullTicks(int64_t ticks) { skullTicks = ticks; }
  696.  
  697.         bool hasAttacked(const Player* attacked) const;
  698.         void addAttacked(const Player* attacked);
  699.         void removeAttacked(const Player* attacked);
  700.         void clearAttacked();
  701.         void addUnjustifiedDead(const Player* attacked);
  702.         void sendCreatureSkull(const Creature* creature) const {
  703.             if (client) {
  704.                 client->sendCreatureSkull(creature);
  705.             }
  706.         }
  707.         void checkSkullTicks(int32_t ticks);
  708.  
  709.         bool canWear(uint32_t lookType, uint8_t addons) const;
  710.         void addOutfit(uint16_t lookType, uint8_t addons);
  711.         bool removeOutfit(uint16_t lookType);
  712.         bool removeOutfitAddon(uint16_t lookType, uint8_t addons);
  713.         bool getOutfitAddons(const Outfit& outfit, uint8_t& addons) const;
  714.  
  715.         bool canLogout();
  716.  
  717.         size_t getMaxVIPEntries() const;
  718.         size_t getMaxDepotItems() const;
  719.  
  720.         //tile
  721.         //send methods
  722.         void sendAddTileItem(const Tile* tile, const Position& pos, const Item* item) {
  723.             if (client) {
  724.                 int32_t stackpos = tile->getStackposOfItem(this, item);
  725.                 if (stackpos != -1) {
  726.                     client->sendAddTileItem(pos, stackpos, item);
  727.                 }
  728.             }
  729.         }
  730.         void sendUpdateTileItem(const Tile* tile, const Position& pos, const Item* item) {
  731.             if (client) {
  732.                 int32_t stackpos = tile->getStackposOfItem(this, item);
  733.                 if (stackpos != -1) {
  734.                     client->sendUpdateTileItem(pos, stackpos, item);
  735.                 }
  736.             }
  737.         }
  738.         void sendRemoveTileThing(const Position& pos, int32_t stackpos) {
  739.             if (stackpos != -1 && client) {
  740.                 client->sendRemoveTileThing(pos, stackpos);
  741.             }
  742.         }
  743.         void sendUpdateTile(const Tile* tile, const Position& pos) {
  744.             if (client) {
  745.                 client->sendUpdateTile(tile, pos);
  746.             }
  747.         }
  748.  
  749.         void sendChannelMessage(const std::string& author, const std::string& text, SpeakClasses type, uint16_t channel) {
  750.             if (client) {
  751.                 client->sendChannelMessage(author, text, type, channel);
  752.             }
  753.         }
  754.         void sendChannelEvent(uint16_t channelId, const std::string& playerName, ChannelEvent_t channelEvent) {
  755.             if (client) {
  756.                 client->sendChannelEvent(channelId, playerName, channelEvent);
  757.             }
  758.         }
  759.         void sendCreatureAppear(const Creature* creature, const Position& pos, bool isLogin) {
  760.             if (client) {
  761.                 client->sendAddCreature(creature, pos, creature->getTile()->getStackposOfCreature(this, creature), isLogin);
  762.             }
  763.         }
  764.         void sendCreatureMove(const Creature* creature, const Position& newPos, int32_t newStackPos, const Position& oldPos, int32_t oldStackPos, bool teleport) {
  765.             if (client) {
  766.                 client->sendMoveCreature(creature, newPos, newStackPos, oldPos, oldStackPos, teleport);
  767.             }
  768.         }
  769.         void sendCreatureTurn(const Creature* creature) {
  770.             if (client && canSeeCreature(creature)) {
  771.                 int32_t stackpos = creature->getTile()->getStackposOfCreature(this, creature);
  772.                 if (stackpos != -1) {
  773.                     client->sendCreatureTurn(creature, stackpos);
  774.                 }
  775.             }
  776.         }
  777.         void sendCreatureSay(const Creature* creature, SpeakClasses type, const std::string& text, const Position* pos = nullptr) {
  778.             if (client) {
  779.                 client->sendCreatureSay(creature, type, text, pos);
  780.             }
  781.         }
  782.         void sendPrivateMessage(const Player* speaker, SpeakClasses type, const std::string& text) {
  783.             if (client) {
  784.                 client->sendPrivateMessage(speaker, type, text);
  785.             }
  786.         }
  787.         void sendCreatureSquare(const Creature* creature, SquareColor_t color) {
  788.             if (client) {
  789.                 client->sendCreatureSquare(creature, color);
  790.             }
  791.         }
  792.         void sendCreatureChangeOutfit(const Creature* creature, const Outfit_t& outfit) {
  793.             if (client) {
  794.                 client->sendCreatureOutfit(creature, outfit);
  795.             }
  796.         }
  797.         void sendCreatureChangeVisible(const Creature* creature, bool visible) {
  798.             if (!client) {
  799.                 return;
  800.             }
  801.  
  802.             if (creature->getPlayer()) {
  803.                 if (visible) {
  804.                     client->sendCreatureOutfit(creature, creature->getCurrentOutfit());
  805.                 } else {
  806.                     static Outfit_t outfit;
  807.                     client->sendCreatureOutfit(creature, outfit);
  808.                 }
  809.             } else if (canSeeInvisibility()) {
  810.                 client->sendCreatureOutfit(creature, creature->getCurrentOutfit());
  811.             } else {
  812.                 int32_t stackpos = creature->getTile()->getStackposOfCreature(this, creature);
  813.                 if (stackpos == -1) {
  814.                     return;
  815.                 }
  816.  
  817.                 if (visible) {
  818.                     client->sendAddCreature(creature, creature->getPosition(), stackpos, false);
  819.                 } else {
  820.                     client->sendRemoveTileThing(creature->getPosition(), stackpos);
  821.                 }
  822.             }
  823.         }
  824.         void sendCreatureLight(const Creature* creature) {
  825.             if (client) {
  826.                 client->sendCreatureLight(creature);
  827.             }
  828.         }
  829.         void sendCreatureWalkthrough(const Creature* creature, bool walkthrough) {
  830.             if (client) {
  831.                 client->sendCreatureWalkthrough(creature, walkthrough);
  832.             }
  833.         }
  834.         void sendCreatureShield(const Creature* creature) {
  835.             if (client) {
  836.                 client->sendCreatureShield(creature);
  837.             }
  838.         }
  839.         void sendCreatureType(uint32_t creatureId, uint8_t creatureType) {
  840.             if (client) {
  841.                 client->sendCreatureType(creatureId, creatureType);
  842.             }
  843.         }
  844.         void sendCreatureHelpers(uint32_t creatureId, uint16_t helpers) {
  845.             if (client) {
  846.                 client->sendCreatureHelpers(creatureId, helpers);
  847.             }
  848.         }
  849.         void sendSpellCooldown(uint8_t spellId, uint32_t time) {
  850.             if (client) {
  851.                 client->sendSpellCooldown(spellId, time);
  852.             }
  853.         }
  854.         void sendSpellGroupCooldown(SpellGroup_t groupId, uint32_t time) {
  855.             if (client) {
  856.                 client->sendSpellGroupCooldown(groupId, time);
  857.             }
  858.         }
  859.         void sendModalWindow(const ModalWindow& modalWindow);
  860.  
  861.         //container
  862.         void sendAddContainerItem(const Container* container, const Item* item);
  863.         void sendUpdateContainerItem(const Container* container, uint16_t slot, const Item* newItem);
  864.         void sendRemoveContainerItem(const Container* container, uint16_t slot);
  865.         void sendContainer(uint8_t cid, const Container* container, bool hasParent, uint16_t firstIndex) {
  866.             if (client) {
  867.                 client->sendContainer(cid, container, hasParent, firstIndex);
  868.             }
  869.         }
  870.  
  871.         //inventory
  872.         void sendInventoryItem(slots_t slot, const Item* item) {
  873.             if (client) {
  874.                 client->sendInventoryItem(slot, item);
  875.             }
  876.         }
  877.         void sendItems() {
  878.             if (client) {
  879.                 client->sendItems();
  880.             }
  881.         }
  882.  
  883.         //event methods
  884.         void onUpdateTileItem(const Tile* tile, const Position& pos, const Item* oldItem,
  885.                                       const ItemType& oldType, const Item* newItem, const ItemType& newType) override;
  886.         void onRemoveTileItem(const Tile* tile, const Position& pos, const ItemType& iType,
  887.                                       const Item* item) override;
  888.  
  889.         void onCreatureAppear(Creature* creature, bool isLogin) override;
  890.         void onRemoveCreature(Creature* creature, bool isLogout) override;
  891.         void onCreatureMove(Creature* creature, const Tile* newTile, const Position& newPos,
  892.                                     const Tile* oldTile, const Position& oldPos, bool teleport) override;
  893.  
  894.         void onAttackedCreatureDisappear(bool isLogout) override;
  895.         void onFollowCreatureDisappear(bool isLogout) override;
  896.  
  897.         //container
  898.         void onAddContainerItem(const Item* item);
  899.         void onUpdateContainerItem(const Container* container, const Item* oldItem, const Item* newItem);
  900.         void onRemoveContainerItem(const Container* container, const Item* item);
  901.  
  902.         void onCloseContainer(const Container* container);
  903.         void onSendContainer(const Container* container);
  904.         void autoCloseContainers(const Container* container);
  905.  
  906.         //inventory
  907.         void onUpdateInventoryItem(Item* oldItem, Item* newItem);
  908.         void onRemoveInventoryItem(Item* item);
  909.  
  910.         void sendCancelMessage(const std::string& msg) const {
  911.             if (client) {
  912.                 client->sendTextMessage(TextMessage(MESSAGE_STATUS_SMALL, msg));
  913.             }
  914.         }
  915.         void sendCancelMessage(ReturnValue message) const;
  916.         void sendCancelTarget() const {
  917.             if (client) {
  918.                 client->sendCancelTarget();
  919.             }
  920.         }
  921.         void sendCancelWalk() const {
  922.             if (client) {
  923.                 client->sendCancelWalk();
  924.             }
  925.         }
  926.         void sendChangeSpeed(const Creature* creature, uint32_t newSpeed) const {
  927.             if (client) {
  928.                 client->sendChangeSpeed(creature, newSpeed);
  929.             }
  930.         }
  931.         void sendCreatureHealth(const Creature* creature) const {
  932.             if (client) {
  933.                 client->sendCreatureHealth(creature);
  934.             }
  935.         }
  936.         void sendDistanceShoot(const Position& from, const Position& to, unsigned char type) const {
  937.             if (client) {
  938.                 client->sendDistanceShoot(from, to, type);
  939.             }
  940.         }
  941.         void sendHouseWindow(House* house, uint32_t listId) const;
  942.         void sendCreatePrivateChannel(uint16_t channelId, const std::string& channelName) {
  943.             if (client) {
  944.                 client->sendCreatePrivateChannel(channelId, channelName);
  945.             }
  946.         }
  947.         void sendClosePrivate(uint16_t channelId);
  948.         void sendIcons() const {
  949.             if (client) {
  950.                 client->sendIcons(getClientIcons());
  951.             }
  952.         }
  953.         void sendMagicEffect(const Position& pos, uint8_t type) const {
  954.             if (client) {
  955.                 client->sendMagicEffect(pos, type);
  956.             }
  957.         }
  958.         void sendPing();
  959.         void sendPingBack() const {
  960.             if (client) {
  961.                 client->sendPingBack();
  962.             }
  963.         }
  964.         void sendStats();
  965.         void sendBasicData() const {
  966.             if (client) {
  967.                 client->sendBasicData();
  968.             }
  969.         }
  970.         void sendSkills() const {
  971.             if (client) {
  972.                 client->sendSkills();
  973.             }
  974.         }
  975.         void sendTextMessage(MessageClasses mclass, const std::string& message) const {
  976.             if (client) {
  977.                 client->sendTextMessage(TextMessage(mclass, message));
  978.             }
  979.         }
  980.         void sendTextMessage(const TextMessage& message) const {
  981.             if (client) {
  982.                 client->sendTextMessage(message);
  983.             }
  984.         }
  985.         void sendReLoginWindow(uint8_t unfairFightReduction) const {
  986.             if (client) {
  987.                 client->sendReLoginWindow(unfairFightReduction);
  988.             }
  989.         }
  990.         void sendTextWindow(Item* item, uint16_t maxlen, bool canWrite) const {
  991.             if (client) {
  992.                 client->sendTextWindow(windowTextId, item, maxlen, canWrite);
  993.             }
  994.         }
  995.         void sendTextWindow(uint32_t itemId, const std::string& text) const {
  996.             if (client) {
  997.                 client->sendTextWindow(windowTextId, itemId, text);
  998.             }
  999.         }
  1000.         void sendToChannel(const Creature* creature, SpeakClasses type, const std::string& text, uint16_t channelId) const {
  1001.             if (client) {
  1002.                 client->sendToChannel(creature, type, text, channelId);
  1003.             }
  1004.         }
  1005.         void sendShop(Npc* npc) const {
  1006.             if (client) {
  1007.                 client->sendShop(npc, shopItemList);
  1008.             }
  1009.         }
  1010.         void sendSaleItemList() const {
  1011.             if (client) {
  1012.                 client->sendSaleItemList(shopItemList);
  1013.             }
  1014.         }
  1015.         void sendCloseShop() const {
  1016.             if (client) {
  1017.                 client->sendCloseShop();
  1018.             }
  1019.         }
  1020.         void sendMarketEnter(uint32_t depotId) const {
  1021.             if (client) {
  1022.                 client->sendMarketEnter(depotId);
  1023.             }
  1024.         }
  1025.         void sendMarketLeave() {
  1026.             inMarket = false;
  1027.             if (client) {
  1028.                 client->sendMarketLeave();
  1029.             }
  1030.         }
  1031.         void sendMarketBrowseItem(uint16_t itemId, const MarketOfferList& buyOffers, const MarketOfferList& sellOffers) const {
  1032.             if (client) {
  1033.                 client->sendMarketBrowseItem(itemId, buyOffers, sellOffers);
  1034.             }
  1035.         }
  1036.         void sendMarketBrowseOwnOffers(const MarketOfferList& buyOffers, const MarketOfferList& sellOffers) const {
  1037.             if (client) {
  1038.                 client->sendMarketBrowseOwnOffers(buyOffers, sellOffers);
  1039.             }
  1040.         }
  1041.         void sendMarketBrowseOwnHistory(const HistoryMarketOfferList& buyOffers, const HistoryMarketOfferList& sellOffers) const {
  1042.             if (client) {
  1043.                 client->sendMarketBrowseOwnHistory(buyOffers, sellOffers);
  1044.             }
  1045.         }
  1046.         void sendMarketDetail(uint16_t itemId) const {
  1047.             if (client) {
  1048.                 client->sendMarketDetail(itemId);
  1049.             }
  1050.         }
  1051.         void sendMarketAcceptOffer(const MarketOfferEx& offer) const {
  1052.             if (client) {
  1053.                 client->sendMarketAcceptOffer(offer);
  1054.             }
  1055.         }
  1056.         void sendMarketCancelOffer(const MarketOfferEx& offer) const {
  1057.             if (client) {
  1058.                 client->sendMarketCancelOffer(offer);
  1059.             }
  1060.         }
  1061.         void sendTradeItemRequest(const std::string& traderName, const Item* item, bool ack) const {
  1062.             if (client) {
  1063.                 client->sendTradeItemRequest(traderName, item, ack);
  1064.             }
  1065.         }
  1066.         void sendTradeClose() const {
  1067.             if (client) {
  1068.                 client->sendCloseTrade();
  1069.             }
  1070.         }
  1071.         void sendWorldLight(LightInfo lightInfo) {
  1072.             if (client) {
  1073.                 client->sendWorldLight(lightInfo);
  1074.             }
  1075.         }
  1076.         void sendChannelsDialog() {
  1077.             if (client) {
  1078.                 client->sendChannelsDialog();
  1079.             }
  1080.         }
  1081.         void sendOpenPrivateChannel(const std::string& receiver) {
  1082.             if (client) {
  1083.                 client->sendOpenPrivateChannel(receiver);
  1084.             }
  1085.         }
  1086.         void sendOutfitWindow() {
  1087.             if (client) {
  1088.                 client->sendOutfitWindow();
  1089.             }
  1090.         }
  1091.         void sendCloseContainer(uint8_t cid) {
  1092.             if (client) {
  1093.                 client->sendCloseContainer(cid);
  1094.             }
  1095.         }
  1096.  
  1097.         void sendChannel(uint16_t channelId, const std::string& channelName, const UsersMap* channelUsers, const InvitedMap* invitedUsers) {
  1098.             if (client) {
  1099.                 client->sendChannel(channelId, channelName, channelUsers, invitedUsers);
  1100.             }
  1101.         }
  1102.         void sendTutorial(uint8_t tutorialId) {
  1103.             if (client) {
  1104.                 client->sendTutorial(tutorialId);
  1105.             }
  1106.         }
  1107.         void sendAddMarker(const Position& pos, uint8_t markType, const std::string& desc) {
  1108.             if (client) {
  1109.                 client->sendAddMarker(pos, markType, desc);
  1110.             }
  1111.         }
  1112.         void sendQuestLog() {
  1113.             if (client) {
  1114.                 client->sendQuestLog();
  1115.             }
  1116.         }
  1117.         void sendQuestLine(const Quest* quest) {
  1118.             if (client) {
  1119.                 client->sendQuestLine(quest);
  1120.             }
  1121.         }
  1122.         void sendEnterWorld() {
  1123.             if (client) {
  1124.                 client->sendEnterWorld();
  1125.             }
  1126.         }
  1127.         void sendFightModes() {
  1128.             if (client) {
  1129.                 client->sendFightModes();
  1130.             }
  1131.         }
  1132.         void sendNetworkMessage(const NetworkMessage& message) {
  1133.             if (client) {
  1134.                 client->writeToOutputBuffer(message);
  1135.             }
  1136.         }
  1137.  
  1138.         void receivePing() {
  1139.             lastPong = OTSYS_TIME();
  1140.         }
  1141.  
  1142.         void onThink(uint32_t interval) override;
  1143.  
  1144.         void postAddNotification(Thing* thing, const Cylinder* oldParent, int32_t index, cylinderlink_t link = LINK_OWNER) override;
  1145.         void postRemoveNotification(Thing* thing, const Cylinder* newParent, int32_t index, cylinderlink_t link = LINK_OWNER) override;
  1146.  
  1147.         void setNextAction(int64_t time) {
  1148.             if (time > nextAction) {
  1149.                 nextAction = time;
  1150.             }
  1151.         }
  1152.         bool canDoAction() const {
  1153.             return nextAction <= OTSYS_TIME();
  1154.         }
  1155.         uint32_t getNextActionTime() const;
  1156.  
  1157.         Item* getWriteItem(uint32_t& windowTextId, uint16_t& maxWriteLen);
  1158.         void setWriteItem(Item* item, uint16_t maxWriteLen = 0);
  1159.  
  1160.         House* getEditHouse(uint32_t& windowTextId, uint32_t& listId);
  1161.         void setEditHouse(House* house, uint32_t listId = 0);
  1162.  
  1163.         void learnInstantSpell(const std::string& spellName);
  1164.         void forgetInstantSpell(const std::string& spellName);
  1165.         bool hasLearnedInstantSpell(const std::string& spellName) const;
  1166.  
  1167.     private:
  1168.         std::forward_list<Condition*> getMuteConditions() const;
  1169.  
  1170.         void checkTradeState(const Item* item);
  1171.         bool hasCapacity(const Item* item, uint32_t count) const;
  1172.  
  1173.         void gainExperience(uint64_t gainExp, Creature* source);
  1174.         void addExperience(Creature* source, uint64_t exp, bool sendText = false);
  1175.         void removeExperience(uint64_t exp, bool sendText = false);
  1176.  
  1177.         void updateInventoryWeight();
  1178.  
  1179.         void setNextWalkActionTask(SchedulerTask* task);
  1180.         void setNextWalkTask(SchedulerTask* task);
  1181.         void setNextActionTask(SchedulerTask* task);
  1182.  
  1183.         void death(Creature* lastHitCreature) override;
  1184.         bool dropCorpse(Creature* lastHitCreature, Creature* mostDamageCreature, bool lastHitUnjustified, bool mostDamageUnjustified) override;
  1185.         Item* getCorpse(Creature* lastHitCreature, Creature* mostDamageCreature) override;
  1186.  
  1187.         //cylinder implementations
  1188.         ReturnValue queryAdd(int32_t index, const Thing& thing, uint32_t count,
  1189.                 uint32_t flags, Creature* actor = nullptr) const override;
  1190.         ReturnValue queryMaxCount(int32_t index, const Thing& thing, uint32_t count, uint32_t& maxQueryCount,
  1191.                 uint32_t flags) const override;
  1192.         ReturnValue queryRemove(const Thing& thing, uint32_t count, uint32_t flags) const override;
  1193.         Cylinder* queryDestination(int32_t& index, const Thing& thing, Item** destItem,
  1194.                 uint32_t& flags) override;
  1195.  
  1196.         void addThing(Thing*) override {}
  1197.         void addThing(int32_t index, Thing* thing) override;
  1198.  
  1199.         void updateThing(Thing* thing, uint16_t itemId, uint32_t count) override;
  1200.         void replaceThing(uint32_t index, Thing* thing) override;
  1201.  
  1202.         void removeThing(Thing* thing, uint32_t count) override;
  1203.  
  1204.         int32_t getThingIndex(const Thing* thing) const override;
  1205.         size_t getFirstIndex() const override;
  1206.         size_t getLastIndex() const override;
  1207.         uint32_t getItemTypeCount(uint16_t itemId, int32_t subType = -1) const override;
  1208.         std::map<uint32_t, uint32_t>& getAllItemTypeCount(std::map<uint32_t, uint32_t>& countMap) const override;
  1209.         Thing* getThing(size_t index) const override;
  1210.  
  1211.         void internalAddThing(Thing* thing) override;
  1212.         void internalAddThing(uint32_t index, Thing* thing) override;
  1213.  
  1214.         std::unordered_set<uint32_t> attackedSet;
  1215.         std::unordered_set<uint32_t> VIPList;
  1216.  
  1217.         std::map<uint8_t, OpenContainer> openContainers;
  1218.         std::map<uint32_t, DepotLocker*> depotLockerMap;
  1219.         std::map<uint32_t, DepotChest*> depotChests;
  1220.         std::map<uint32_t, int32_t> storageMap;
  1221.  
  1222.         std::vector<OutfitEntry> outfits;
  1223.         GuildWarVector guildWarVector;
  1224.  
  1225.         std::list<ShopInfo> shopItemList;
  1226.  
  1227.         std::forward_list<Party*> invitePartyList;
  1228.         std::forward_list<uint32_t> modalWindows;
  1229.         std::forward_list<std::string> learnedInstantSpellList;
  1230.         std::forward_list<Condition*> storedConditionList; // TODO: This variable is only temporarily used when logging in, get rid of it somehow
  1231.  
  1232.         std::string name;
  1233.         std::string guildNick;
  1234.  
  1235.         Skill skills[SKILL_LAST + 1];
  1236.         LightInfo itemsLight;
  1237.         Position loginPosition;
  1238.         Position lastWalkthroughPosition;
  1239.  
  1240.         time_t lastLoginSaved = 0;
  1241.         time_t lastLogout = 0;
  1242.  
  1243.         uint64_t experience = 0;
  1244.         uint64_t manaSpent = 0;
  1245.         uint64_t lastAttack = 0;
  1246.         uint64_t bankBalance = 0;
  1247.         uint64_t lastQuestlogUpdate = 0;
  1248.         int64_t lastFailedFollow = 0;
  1249.         int64_t skullTicks = 0;
  1250.         int64_t lastWalkthroughAttempt = 0;
  1251.         int64_t lastToggleMount = 0;
  1252.         int64_t lastPing;
  1253.         int64_t lastPong;
  1254.         int64_t nextAction = 0;
  1255.  
  1256.         BedItem* bedItem = nullptr;
  1257.         Guild* guild = nullptr;
  1258.         const GuildRank* guildRank = nullptr;
  1259.         Group* group = nullptr;
  1260.         Inbox* inbox;
  1261.         Item* tradeItem = nullptr;
  1262.         Item* inventory[CONST_SLOT_LAST + 1] = {};
  1263.         Item* writeItem = nullptr;
  1264.         House* editHouse = nullptr;
  1265.         Npc* shopOwner = nullptr;
  1266.         Party* party = nullptr;
  1267.         Player* tradePartner = nullptr;
  1268.         ProtocolGame_ptr client;
  1269.         SchedulerTask* walkTask = nullptr;
  1270.         Town* town = nullptr;
  1271.         Vocation* vocation = nullptr;
  1272.  
  1273.         uint32_t inventoryWeight = 0;
  1274.         uint32_t capacity = 40000;
  1275.         uint32_t damageImmunities = 0;
  1276.         uint32_t conditionImmunities = 0;
  1277.         uint32_t conditionSuppressions = 0;
  1278.         uint32_t level = 1;
  1279.         uint32_t magLevel = 0;
  1280.         uint32_t actionTaskEvent = 0;
  1281.         uint32_t nextStepEvent = 0;
  1282.         uint32_t walkTaskEvent = 0;
  1283.         uint32_t MessageBufferTicks = 0;
  1284.         uint32_t lastIP = 0;
  1285.         uint32_t accountNumber = 0;
  1286.         uint32_t guid = 0;
  1287.         uint32_t windowTextId = 0;
  1288.         uint32_t editListId = 0;
  1289.         uint32_t mana = 0;
  1290.         uint32_t manaMax = 0;
  1291.         int32_t varSkills[SKILL_LAST + 1] = {};
  1292.         int32_t varSpecialSkills[SPECIALSKILL_LAST + 1] = {};
  1293.         int32_t varStats[STAT_LAST + 1] = {};
  1294.         int32_t purchaseCallback = -1;
  1295.         int32_t saleCallback = -1;
  1296.         int32_t MessageBufferCount = 0;
  1297.         int32_t premiumDays = 0;
  1298.         int32_t bloodHitCount = 0;
  1299.         int32_t shieldBlockCount = 0;
  1300.         int32_t offlineTrainingSkill = -1;
  1301.         int32_t offlineTrainingTime = 0;
  1302.         int32_t idleTime = 0;
  1303.  
  1304.         uint16_t lastStatsTrainingTime = 0;
  1305.         uint16_t staminaMinutes = 2520;
  1306.         uint16_t maxWriteLen = 0;
  1307.         int16_t lastDepotId = -1;
  1308.  
  1309.         uint8_t soul = 0;
  1310.         uint8_t blessings = 0;
  1311.         uint8_t levelPercent = 0;
  1312.         uint8_t magLevelPercent = 0;
  1313.  
  1314.         PlayerSex_t sex = PLAYERSEX_FEMALE;
  1315.         OperatingSystem_t operatingSystem = CLIENTOS_NONE;
  1316.         BlockType_t lastAttackBlockType = BLOCK_NONE;
  1317.         tradestate_t tradeState = TRADE_NONE;
  1318.         fightMode_t fightMode = FIGHTMODE_ATTACK;
  1319.         AccountType_t accountType = ACCOUNT_TYPE_NORMAL;
  1320.         attackHand_t lastAttackHand = HAND_LEFT;
  1321.  
  1322.         bool blockSkillAdvance;
  1323.         bool chaseMode = false;
  1324.         bool secureMode = false;
  1325.         bool inMarket = false;
  1326.         bool wasMounted = false;
  1327.         bool ghostMode = false;
  1328.         bool pzLocked = false;
  1329.         bool isConnecting = false;
  1330.         bool addAttackSkillPoint = false;
  1331.         bool inventoryAbilities[CONST_SLOT_LAST + 1] = {};
  1332.  
  1333.         static uint32_t playerAutoID;
  1334.  
  1335.         void updateItemsLight(bool internal = false);
  1336.         int32_t getStepSpeed() const override {
  1337.             return std::max<int32_t>(PLAYER_MIN_SPEED, std::min<int32_t>(PLAYER_MAX_SPEED, getSpeed()));
  1338.         }
  1339.         void updateBaseSpeed() {
  1340.             if (!hasFlag(PlayerFlag_SetMaxSpeed)) {
  1341.                 baseSpeed = vocation->getBaseSpeed() + (2 * (level - 1));
  1342.             } else {
  1343.                 baseSpeed = PLAYER_MAX_SPEED;
  1344.             }
  1345.         }
  1346.  
  1347.         bool isPromoted() const;
  1348.  
  1349.         /*uint32_t getAttackSpeed() const {
  1350.             return vocation->getAttackSpeed();
  1351.         }*/
  1352.  
  1353.         uint32_t getAttackSpeed() const;
  1354.  
  1355.         static uint8_t getPercentLevel(uint64_t count, uint64_t nextLevelCount);
  1356.         double getLostPercent() const;
  1357.         uint64_t getLostExperience() const override {
  1358.             return skillLoss ? static_cast<uint64_t>(experience * getLostPercent()) : 0;
  1359.         }
  1360.         uint32_t getDamageImmunities() const override {
  1361.             return damageImmunities;
  1362.         }
  1363.         uint32_t getConditionImmunities() const override {
  1364.             return conditionImmunities;
  1365.         }
  1366.         uint32_t getConditionSuppressions() const override {
  1367.             return conditionSuppressions;
  1368.         }
  1369.         uint16_t getLookCorpse() const override;
  1370.         void getPathSearchParams(const Creature* creature, FindPathParams& fpp) const override;
  1371.  
  1372.         friend class Game;
  1373.         friend class Npc;
  1374.         friend class LuaScriptInterface;
  1375.         friend class Map;
  1376.         friend class Actions;
  1377.         friend class IOLoginData;
  1378.         friend class ProtocolGame;
  1379. };
  1380.  
  1381. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement