mirror of
https://github.com/opentibiabr/remeres-map-editor
synced 2026-08-15 18:26:04 -04:00
feat: migrate Remeres to 12.x assets system and modernized item handling • Migrated old Remeres .dat/.spr system to new 12.x client /assets/ appearance & sprite format • Removed OTB dependency and outdated client version structures • Integrated Protobuf-based sprite reader (credit: @nekiro) • Major refactor on graphics.cpp structure and brush icon handling • Updated brushes and tags system • Fixed top order drawing bugs and missing brushes icons • Fixed outfit color paint and correct offset handling for non-32x32 sprites • Re-enabled map saving and loading • Improved creature sprite rendering and brush previews • Added new item properties window with toggle for legacy/new layout Co-authored-by: Marcos <66353315+marcosvf132@users.noreply.github.com> Co-authored-by: Pedro Henrique Alves Cruz <phac@cin.ufpe.br>
152 lines
3.8 KiB
C++
152 lines
3.8 KiB
C++
//////////////////////////////////////////////////////////////////////
|
|
// This file is part of Remere's Map Editor
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Remere's Map Editor is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// Remere's Map Editor is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef RME_CONTAINER_H_
|
|
#define RME_CONTAINER_H_
|
|
|
|
#include "position.h"
|
|
#include "item.h"
|
|
|
|
#pragma pack(1)
|
|
|
|
struct OTBM_TeleportDestination {
|
|
uint16_t x;
|
|
uint16_t y;
|
|
uint8_t z;
|
|
};
|
|
|
|
#pragma pack()
|
|
|
|
class Container : public Item {
|
|
public:
|
|
Container(const uint16_t type);
|
|
~Container();
|
|
|
|
Item* deepCopy() const override;
|
|
Container* getContainer() override {
|
|
return this;
|
|
}
|
|
|
|
Item* getItem(size_t index) const;
|
|
|
|
ItemVector &getVector() noexcept {
|
|
return contents;
|
|
}
|
|
size_t getItemCount() const noexcept {
|
|
return contents.size();
|
|
}
|
|
size_t getVolume() const noexcept {
|
|
return getItemType().volume;
|
|
}
|
|
double getWeight() noexcept override {
|
|
return getItemType().weight;
|
|
}
|
|
|
|
virtual bool unserializeItemNode_OTBM(const IOMap &maphandle, BinaryNode* node) override;
|
|
virtual bool serializeItemNode_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const override;
|
|
|
|
protected:
|
|
ItemVector contents;
|
|
};
|
|
|
|
class Teleport : public Item {
|
|
public:
|
|
Teleport(const uint16_t type);
|
|
|
|
Item* deepCopy() const override;
|
|
Teleport* getTeleport() override {
|
|
return this;
|
|
}
|
|
|
|
virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const override;
|
|
virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node) override;
|
|
|
|
const Position &getDestination() const noexcept {
|
|
return destination;
|
|
}
|
|
int getX() const noexcept {
|
|
return destination.x;
|
|
}
|
|
int getY() const noexcept {
|
|
return destination.y;
|
|
}
|
|
int getZ() const noexcept {
|
|
return destination.z;
|
|
}
|
|
void setDestination(const Position &position) noexcept {
|
|
destination = position;
|
|
setAttribute("destination.x", position.x);
|
|
setAttribute("destination.y", position.y);
|
|
setAttribute("destination.z", position.z);
|
|
}
|
|
bool hasDestination() const noexcept {
|
|
return destination.isValid();
|
|
}
|
|
|
|
protected:
|
|
Position destination;
|
|
};
|
|
|
|
class Door : public Item {
|
|
public:
|
|
Door(const uint16_t type);
|
|
|
|
Item* deepCopy() const override;
|
|
Door* getDoor() override {
|
|
return this;
|
|
}
|
|
|
|
uint8_t getDoorID() const {
|
|
return doorId;
|
|
}
|
|
void setDoorID(uint8_t id) {
|
|
doorId = id;
|
|
setAttribute("doorid", doorId);
|
|
}
|
|
|
|
virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const override;
|
|
virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node) override;
|
|
|
|
protected:
|
|
uint8_t doorId;
|
|
};
|
|
|
|
class Depot : public Item {
|
|
public:
|
|
Depot(const uint16_t _type);
|
|
|
|
Item* deepCopy() const override;
|
|
Depot* getDepot() override {
|
|
return this;
|
|
}
|
|
|
|
uint8_t getDepotID() const {
|
|
return depotId;
|
|
}
|
|
void setDepotID(uint8_t id) {
|
|
depotId = id;
|
|
setAttribute("depotid", depotId);
|
|
}
|
|
|
|
virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const override;
|
|
virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node) override;
|
|
|
|
protected:
|
|
uint8_t depotId;
|
|
};
|
|
|
|
#endif
|