#ifndef RAGNAROK_SOURCE_CONTENTS_WORLD_WORLD_H #define RAGNAROK_SOURCE_CONTENTS_WORLD_WORLD_H #include "Contents/World/WorldSpatialTree.h" #include #include #include #include #include #include class BinkMovies; class CItem; class CGameMode; class CGameObject; class CPlayer; class CRenderObject; class GroundGeometry; struct CellFloatPos { CellFloatPos() { } CellFloatPos(float x, float z) : x(x), z(z) { } CellFloatPos(const CellFloatPos& other) : x(other.x), z(other.z) { } float x; float z; }; class CWorld { public: CWorld(); virtual ~CWorld(); CWorld(const CWorld&) = delete; CWorld& operator=(const CWorld&) = delete; void LoadMapEffects(); void CellOrigin(int column, int row, float& x, float& z) const; void Clear(); void OnExitFrame(); void OnProcess(); bool RemoveItem(std::uint32_t aid); bool FindActorInCell(const float* position, std::function predicate) const; CRenderObject* GetGameActorByAID(std::uint32_t aid) const; CRenderObject* GetGameActorByAidIncludeMe(std::uint32_t aid) const; __declspec(noinline) CRenderObject* GetSkillByAID(std::uint32_t aid) const; CItem* GetItemByAID(std::uint32_t aid) const; CRenderObject* GetActorByGID(int gid) const; void RemovePcPos(std::uint32_t aid, bool notify); void RemovePcPosForMove(std::uint32_t aid, bool notify); void ClearActorCells(); bool IsGuildMaster(std::uint32_t aid); bool IsExistGuildMasterNearby(const float& x, const float& z); bool RemoveGroundItem(std::uint32_t aid); bool RemoveSkill(std::uint32_t aid); void PlayerMove(const float& x, const float& z); void PcApproachToPlayer(std::uint32_t accountId, const CellFloatPos& pos); void UpdateGuildMasterApproach(std::function isNearby); void CreatePlayer(); void AddPcPos(std::uint32_t aid, const CellFloatPos& cell); void AddPcPosFromCell(std::uint32_t aid, const int* cell); void AddPcPosUnindexed(std::uint32_t aid, const CellFloatPos& cell); void InitWorld(); void InitializeSpatial(); void RemoveObject(CRenderObject* object); void SendObjectMessage(CGameObject* sender, std::uint64_t identity, int message, int a, int b, int c, int d); static unsigned long __stdcall LoadDeferredModels(void* parameter); void FinishModelLoading(); /* 0004 */ CGameMode* gameMode; /* 0008 */ std::list objects; /* 0010 */ std::list actors; /* 0018 */ std::list items; /* 0020 */ std::list skills; /* 0028 */ GroundGeometry* ground; /* 002C */ CPlayer* player; /* 0030 */ C3dAttr* terrain; /* 0034 */ std::vector models; /* 0040 */ int published; /* 0044 */ int pending; /* 0048 */ int isPKZone; /* 004C */ int isSiegeMode; /* 0050 */ int isBattleFieldMode; /* 0054 */ int isEventPVPMode; /* 0058 */ WorldSpatialTree spatial; /* 00D4 */ const WorldSpatialTree* serializedSpatial; /* 00D8 */ std::list pendingActorIds; /* 00E0 */ BinkMovies* movies; /* 00E4 */ std::map> actorCells; /* 00EC */ std::list unindexedActorIds; /* 00F4 */ bool guildMasterNearby; /* 00F8 */ int nearbyRange; /* 00FC */ bool backgroundFog; /* 00FD */ bool partyRestricted; }; CRenderObject* FindRenderObject(std::uint32_t aid); #if defined(_WIN32) && !defined(_WIN64) static_assert(offsetof(CWorld, gameMode) == 0x04); static_assert(offsetof(CWorld, objects) == 0x08); static_assert(offsetof(CWorld, actors) == 0x10); static_assert(offsetof(CWorld, items) == 0x18); static_assert(offsetof(CWorld, skills) == 0x20); static_assert(offsetof(CWorld, ground) == 0x28); static_assert(offsetof(CWorld, player) == 0x2C); static_assert(offsetof(CWorld, terrain) == 0x30); static_assert(offsetof(CWorld, models) == 0x34); static_assert(offsetof(CWorld, published) == 0x40); static_assert(offsetof(CWorld, pending) == 0x44); static_assert(offsetof(CWorld, spatial) == 0x58); static_assert(offsetof(CWorld, serializedSpatial) == 0xD4); static_assert(offsetof(CWorld, pendingActorIds) == 0xD8); static_assert(offsetof(CWorld, movies) == 0xE0); static_assert(offsetof(CWorld, actorCells) == 0xE4); static_assert(offsetof(CWorld, unindexedActorIds) == 0xEC); static_assert(offsetof(CWorld, guildMasterNearby) == 0xF4); static_assert(offsetof(CWorld, nearbyRange) == 0xF8); static_assert(offsetof(CWorld, backgroundFog) == 0xFC); static_assert(offsetof(CWorld, partyRestricted) == 0xFD); static_assert(sizeof(CWorld) == 0x100); #endif #endif