Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
ResourceObject.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <optional>
4 #include <string>
5 #include <vector>
6 
7 #include "../entity/Entity.hpp"
8 #include "Object.hpp"
9 
13 class ResourceObject : public Object
14 {
15 public:
16  ResourceObject(int id, std::string instanceId, std::string name, Coordinates coords, unsigned int rotation, std::vector<YieldableItem> yieldableItemList, int xpPerYield, int depleteChance, int relatedSkillId, int xpRequirement, reader::ObjectType type, std::vector<ItemTransform> itemTransformList);
17 
18  ResourceObject(const ResourceObjectStruct& object, const ObjectLocation& location, reader::ObjectType type);
19 
25  bool canInteract(Entity& entity);
26 
31  void interact(Entity& entity);
32 
33 private:
34  std::vector<YieldableItem> yieldableItemListM;
37  std::vector<ItemTransform> itemTransformListM;
40 };
Base pure virtual Entity class. Different types of enities inherit this.
Definition: Entity.hpp:17
Represents generic object in the game world.
Definition: Object.hpp:12
Represents and object that can be interacted with to gain resources and train skills.
Definition: ResourceObject.hpp:14
ResourceObject(int id, std::string instanceId, std::string name, Coordinates coords, unsigned int rotation, std::vector< YieldableItem > yieldableItemList, int xpPerYield, int depleteChance, int relatedSkillId, int xpRequirement, reader::ObjectType type, std::vector< ItemTransform > itemTransformList)
Definition: ResourceObject.cpp:4
std::vector< ItemTransform > itemTransformListM
Definition: ResourceObject.hpp:37
int xpPerYieldM
Definition: ResourceObject.hpp:35
int depleteChanceM
TODO: Deplete functionality.
Definition: ResourceObject.hpp:36
int xpRequirementM
Definition: ResourceObject.hpp:39
void interact(Entity &entity)
Interact with the object.
Definition: ResourceObject.cpp:67
std::vector< YieldableItem > yieldableItemListM
Definition: ResourceObject.hpp:34
int relatedSkillIdM
Definition: ResourceObject.hpp:38
bool canInteract(Entity &entity)
Check if the entity can interact with the object.
Definition: ResourceObject.cpp:24
ObjectType
Definition: ObjectReader.hpp:90
Struct for coordinates.
Definition: Coordinates.hpp:7
Describes the location of an object on the map. This is used to spawn object instances on the map.
Definition: ObjectReader.hpp:17
Definition: ObjectReader.hpp:72