#pragma once #include class Village { private: Level* level; std::vector > doorInfos; Pos* accCenter; Pos* center; int radius; int stableSince; int _tick; int populationSize; int noBreedTimer; std::unordered_map playerStanding; class Aggressor { public: std::shared_ptr mob; int timeStamp; Aggressor(std::shared_ptr mob, int timeStamp); }; std::vector aggressors; int golemCount; public: Village(); Village(Level* level); ~Village(); void setLevel(Level* level); void tick(int tick); private: std::optional findRandomSpawnPos(int x, int y, int z, int sx, int sy, int sz); bool canSpawnAt(int x, int y, int z, int sx, int sy, int sz); void countGolem(); void countPopulation(); public: Pos* getCenter(); int getRadius(); int getDoorCount(); int getStableAge(); int getPopulationSize(); bool isInside(int xx, int yy, int zz); std::vector >* getDoorInfos(); std::shared_ptr getClosestDoorInfo(int x, int y, int z); std::shared_ptr getBestDoorInfo(int x, int y, int z); bool hasDoorInfo(int x, int y, int z); std::shared_ptr getDoorInfo(int x, int y, int z); void addDoorInfo(std::shared_ptr di); bool canRemove(); void addAggressor(std::shared_ptr mob); std::shared_ptr getClosestAggressor( std::shared_ptr from); std::shared_ptr getClosestBadStandingPlayer( std::shared_ptr from); private: void updateAggressors(); void updateDoors(); bool isDoor(int x, int y, int z); void calcInfo(); public: int getStanding(const std::wstring& playerName); int modifyStanding(const std::wstring& playerName, int delta); bool isGoodStanding(const std::wstring& playerName); bool isBadStanding(const std::wstring& playerName); bool isVeryBadStanding(const std::wstring playerName); void readAdditionalSaveData(CompoundTag* tag); void addAdditonalSaveData(CompoundTag* tag); void resetNoBreedTimer(); bool isBreedTimerOk(); void rewardAllPlayers(int amount); };