mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 13:37:22 +00:00
Split itemType enum into it's own header (#647)
* Split itemType enum into it's own header add mount item type * fix whitespace
This commit is contained in:
parent
f5ae5aa13e
commit
9287e5bc4b
@ -440,33 +440,6 @@ enum eInventoryType : uint32_t {
|
|||||||
INVALID // made up, for internal use!!!
|
INVALID // made up, for internal use!!!
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eItemType : int32_t {
|
|
||||||
ITEM_TYPE_UNKNOWN = -1, //!< An unknown item type
|
|
||||||
ITEM_TYPE_BRICK = 1, //!< A brick
|
|
||||||
ITEM_TYPE_HAT = 2, //!< A hat / head item
|
|
||||||
ITEM_TYPE_HAIR = 3, //!< A hair item
|
|
||||||
ITEM_TYPE_NECK = 4, //!< A neck item
|
|
||||||
ITEM_TYPE_LEFT_HAND = 5, //!< A left handed item
|
|
||||||
ITEM_TYPE_RIGHT_HAND = 6, //!< A right handed item
|
|
||||||
ITEM_TYPE_LEGS = 7, //!< A pants item
|
|
||||||
ITEM_TYPE_LEFT_TRINKET = 8, //!< A left handled trinket item
|
|
||||||
ITEM_TYPE_RIGHT_TRINKET = 9, //!< A right handed trinket item
|
|
||||||
ITEM_TYPE_BEHAVIOR = 10, //!< A behavior
|
|
||||||
ITEM_TYPE_PROPERTY = 11, //!< A property
|
|
||||||
ITEM_TYPE_MODEL = 12, //!< A model
|
|
||||||
ITEM_TYPE_COLLECTIBLE = 13, //!< A collectible item
|
|
||||||
ITEM_TYPE_CONSUMABLE = 14, //!< A consumable item
|
|
||||||
ITEM_TYPE_CHEST = 15, //!< A chest item
|
|
||||||
ITEM_TYPE_EGG = 16, //!< An egg
|
|
||||||
ITEM_TYPE_PET_FOOD = 17, //!< A pet food item
|
|
||||||
ITEM_TYPE_QUEST_OBJECT = 18, //!< A quest item
|
|
||||||
ITEM_TYPE_PET_INVENTORY_ITEM = 19, //!< A pet inventory item
|
|
||||||
ITEM_TYPE_PACKAGE = 20, //!< A package
|
|
||||||
ITEM_TYPE_LOOT_MODEL = 21, //!< A loot model
|
|
||||||
ITEM_TYPE_VEHICLE = 22, //!< A vehicle
|
|
||||||
ITEM_TYPE_CURRENCY = 23 //!< Currency
|
|
||||||
};
|
|
||||||
|
|
||||||
enum eRebuildState : uint32_t {
|
enum eRebuildState : uint32_t {
|
||||||
REBUILD_OPEN,
|
REBUILD_OPEN,
|
||||||
REBUILD_COMPLETED = 2,
|
REBUILD_COMPLETED = 2,
|
||||||
|
36
dCommon/eItemType.h
Normal file
36
dCommon/eItemType.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __EITEMTYPE__H__
|
||||||
|
#define __EITEMTYPE__H__
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
enum class eItemType : int32_t {
|
||||||
|
ITEM_TYPE_UNKNOWN = -1, //!< An unknown item type
|
||||||
|
ITEM_TYPE_BRICK = 1, //!< A brick
|
||||||
|
ITEM_TYPE_HAT = 2, //!< A hat / head item
|
||||||
|
ITEM_TYPE_HAIR = 3, //!< A hair item
|
||||||
|
ITEM_TYPE_NECK = 4, //!< A neck item
|
||||||
|
ITEM_TYPE_LEFT_HAND = 5, //!< A left handed item
|
||||||
|
ITEM_TYPE_RIGHT_HAND = 6, //!< A right handed item
|
||||||
|
ITEM_TYPE_LEGS = 7, //!< A pants item
|
||||||
|
ITEM_TYPE_LEFT_TRINKET = 8, //!< A left handled trinket item
|
||||||
|
ITEM_TYPE_RIGHT_TRINKET = 9, //!< A right handed trinket item
|
||||||
|
ITEM_TYPE_BEHAVIOR = 10, //!< A behavior
|
||||||
|
ITEM_TYPE_PROPERTY = 11, //!< A property
|
||||||
|
ITEM_TYPE_MODEL = 12, //!< A model
|
||||||
|
ITEM_TYPE_COLLECTIBLE = 13, //!< A collectible item
|
||||||
|
ITEM_TYPE_CONSUMABLE = 14, //!< A consumable item
|
||||||
|
ITEM_TYPE_CHEST = 15, //!< A chest item
|
||||||
|
ITEM_TYPE_EGG = 16, //!< An egg
|
||||||
|
ITEM_TYPE_PET_FOOD = 17, //!< A pet food item
|
||||||
|
ITEM_TYPE_QUEST_OBJECT = 18, //!< A quest item
|
||||||
|
ITEM_TYPE_PET_INVENTORY_ITEM = 19, //!< A pet inventory item
|
||||||
|
ITEM_TYPE_PACKAGE = 20, //!< A package
|
||||||
|
ITEM_TYPE_LOOT_MODEL = 21, //!< A loot model
|
||||||
|
ITEM_TYPE_VEHICLE = 22, //!< A vehicle
|
||||||
|
ITEM_TYPE_CURRENCY = 23, //!< Currency
|
||||||
|
ITEM_TYPE_MOUNT = 24 //!< A Mount
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //!__EITEMTYPE__H__
|
@ -25,6 +25,7 @@
|
|||||||
#include "PropertyManagementComponent.h"
|
#include "PropertyManagementComponent.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
|
#include "eItemType.h"
|
||||||
|
|
||||||
InventoryComponent::InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document) : Component(parent)
|
InventoryComponent::InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document) : Component(parent)
|
||||||
{
|
{
|
||||||
@ -1024,13 +1025,13 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == ITEM_TYPE_LOOT_MODEL || type == ITEM_TYPE_VEHICLE)
|
if (type == eItemType::ITEM_TYPE_LOOT_MODEL || type == eItemType::ITEM_TYPE_VEHICLE)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != ITEM_TYPE_LOOT_MODEL && type != ITEM_TYPE_MODEL)
|
if (type != eItemType::ITEM_TYPE_LOOT_MODEL && type != eItemType::ITEM_TYPE_MODEL)
|
||||||
{
|
{
|
||||||
if (!item->GetBound() && !item->GetPreconditionExpression()->Check(m_Parent))
|
if (!item->GetBound() && !item->GetPreconditionExpression()->Check(m_Parent))
|
||||||
{
|
{
|
||||||
@ -1411,15 +1412,15 @@ void InventoryComponent::RemoveDatabasePet(LWOOBJID id)
|
|||||||
BehaviorSlot InventoryComponent::FindBehaviorSlot(const eItemType type)
|
BehaviorSlot InventoryComponent::FindBehaviorSlot(const eItemType type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ITEM_TYPE_HAT:
|
case eItemType::ITEM_TYPE_HAT:
|
||||||
return BehaviorSlot::Head;
|
return BehaviorSlot::Head;
|
||||||
case ITEM_TYPE_NECK:
|
case eItemType::ITEM_TYPE_NECK:
|
||||||
return BehaviorSlot::Neck;
|
return BehaviorSlot::Neck;
|
||||||
case ITEM_TYPE_LEFT_HAND:
|
case eItemType::ITEM_TYPE_LEFT_HAND:
|
||||||
return BehaviorSlot::Offhand;
|
return BehaviorSlot::Offhand;
|
||||||
case ITEM_TYPE_RIGHT_HAND:
|
case eItemType::ITEM_TYPE_RIGHT_HAND:
|
||||||
return BehaviorSlot::Primary;
|
return BehaviorSlot::Primary;
|
||||||
case ITEM_TYPE_CONSUMABLE:
|
case eItemType::ITEM_TYPE_CONSUMABLE:
|
||||||
return BehaviorSlot::Consumable;
|
return BehaviorSlot::Consumable;
|
||||||
default:
|
default:
|
||||||
return BehaviorSlot::Invalid;
|
return BehaviorSlot::Invalid;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef INVENTORYCOMPONENT_H
|
#ifndef INVENTORYCOMPONENT_H
|
||||||
#define INVENTORYCOMPONENT_H
|
#define INVENTORYCOMPONENT_H
|
||||||
@ -25,6 +25,8 @@ class ItemSet;
|
|||||||
|
|
||||||
typedef std::map<std::string, EquippedItem> EquipmentMap;
|
typedef std::map<std::string, EquippedItem> EquipmentMap;
|
||||||
|
|
||||||
|
enum class eItemType : int32_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the inventory of entity, including the items they possess and have equipped. An entity can have inventories
|
* Handles the inventory of entity, including the items they possess and have equipped. An entity can have inventories
|
||||||
* of different types, each type representing a different group of items, see `eInventoryType` for a list of
|
* of different types, each type representing a different group of items, see `eInventoryType` for a list of
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "Inventory.h"
|
#include "Inventory.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
|
#include "eItemType.h"
|
||||||
|
|
||||||
std::vector<LOT> Inventory::m_GameMasterRestrictedItems = {
|
std::vector<LOT> Inventory::m_GameMasterRestrictedItems = {
|
||||||
1727, // GM Only - JetPack
|
1727, // GM Only - JetPack
|
||||||
@ -274,40 +275,41 @@ eInventoryType Inventory::FindInventoryTypeForLot(const LOT lot)
|
|||||||
const auto itemType = static_cast<eItemType>(itemComponent.itemType);
|
const auto itemType = static_cast<eItemType>(itemComponent.itemType);
|
||||||
|
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
case ITEM_TYPE_BRICK:
|
case eItemType::ITEM_TYPE_BRICK:
|
||||||
return BRICKS;
|
return BRICKS;
|
||||||
|
|
||||||
case ITEM_TYPE_BEHAVIOR:
|
case eItemType::ITEM_TYPE_BEHAVIOR:
|
||||||
return BEHAVIORS;
|
return BEHAVIORS;
|
||||||
|
|
||||||
case ITEM_TYPE_PROPERTY:
|
case eItemType::ITEM_TYPE_PROPERTY:
|
||||||
return PROPERTY_DEEDS;
|
return PROPERTY_DEEDS;
|
||||||
|
|
||||||
case ITEM_TYPE_MODEL:
|
case eItemType::ITEM_TYPE_MODEL:
|
||||||
case ITEM_TYPE_VEHICLE:
|
case eItemType::ITEM_TYPE_VEHICLE:
|
||||||
case ITEM_TYPE_LOOT_MODEL:
|
case eItemType::ITEM_TYPE_LOOT_MODEL:
|
||||||
|
case eItemType::ITEM_TYPE_MOUNT:
|
||||||
return MODELS;
|
return MODELS;
|
||||||
|
|
||||||
case ITEM_TYPE_HAT:
|
case eItemType::ITEM_TYPE_HAT:
|
||||||
case ITEM_TYPE_HAIR:
|
case eItemType::ITEM_TYPE_HAIR:
|
||||||
case ITEM_TYPE_NECK:
|
case eItemType::ITEM_TYPE_NECK:
|
||||||
case ITEM_TYPE_LEFT_HAND:
|
case eItemType::ITEM_TYPE_LEFT_HAND:
|
||||||
case ITEM_TYPE_RIGHT_HAND:
|
case eItemType::ITEM_TYPE_RIGHT_HAND:
|
||||||
case ITEM_TYPE_LEGS:
|
case eItemType::ITEM_TYPE_LEGS:
|
||||||
case ITEM_TYPE_LEFT_TRINKET:
|
case eItemType::ITEM_TYPE_LEFT_TRINKET:
|
||||||
case ITEM_TYPE_RIGHT_TRINKET:
|
case eItemType::ITEM_TYPE_RIGHT_TRINKET:
|
||||||
case ITEM_TYPE_COLLECTIBLE:
|
case eItemType::ITEM_TYPE_COLLECTIBLE:
|
||||||
case ITEM_TYPE_CONSUMABLE:
|
case eItemType::ITEM_TYPE_CONSUMABLE:
|
||||||
case ITEM_TYPE_CHEST:
|
case eItemType::ITEM_TYPE_CHEST:
|
||||||
case ITEM_TYPE_EGG:
|
case eItemType::ITEM_TYPE_EGG:
|
||||||
case ITEM_TYPE_PET_FOOD:
|
case eItemType::ITEM_TYPE_PET_FOOD:
|
||||||
case ITEM_TYPE_PET_INVENTORY_ITEM:
|
case eItemType::ITEM_TYPE_PET_INVENTORY_ITEM:
|
||||||
case ITEM_TYPE_PACKAGE:
|
case eItemType::ITEM_TYPE_PACKAGE:
|
||||||
case ITEM_TYPE_CURRENCY:
|
case eItemType::ITEM_TYPE_CURRENCY:
|
||||||
return ITEMS;
|
return ITEMS;
|
||||||
|
|
||||||
case ITEM_TYPE_QUEST_OBJECT:
|
case eItemType::ITEM_TYPE_QUEST_OBJECT:
|
||||||
case ITEM_TYPE_UNKNOWN:
|
case eItemType::ITEM_TYPE_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
return HIDDEN;
|
return HIDDEN;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user