mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
format codebase
This commit is contained in:
@@ -7,20 +7,20 @@
|
||||
*/
|
||||
struct DatabasePet
|
||||
{
|
||||
/**
|
||||
* The lot of this pet
|
||||
*/
|
||||
LOT lot = LOT_NULL;
|
||||
/**
|
||||
* The lot of this pet
|
||||
*/
|
||||
LOT lot = LOT_NULL;
|
||||
|
||||
/**
|
||||
* The name of the pet
|
||||
*/
|
||||
std::string name;
|
||||
/**
|
||||
* The name of the pet
|
||||
*/
|
||||
std::string name;
|
||||
|
||||
/**
|
||||
* The current moderation state, see PetComponent for more info
|
||||
*/
|
||||
int32_t moderationState = 0;
|
||||
/**
|
||||
* The current moderation state, see PetComponent for more info
|
||||
*/
|
||||
int32_t moderationState = 0;
|
||||
};
|
||||
|
||||
const DatabasePet DATABASE_PET_INVALID;
|
||||
|
@@ -8,24 +8,24 @@
|
||||
*/
|
||||
struct EquippedItem
|
||||
{
|
||||
/**
|
||||
* The object ID of the equipped item
|
||||
*/
|
||||
/**
|
||||
* The object ID of the equipped item
|
||||
*/
|
||||
LWOOBJID id = LWOOBJID_EMPTY;
|
||||
|
||||
/**
|
||||
* The LOT of this equipped item
|
||||
*/
|
||||
/**
|
||||
* The LOT of this equipped item
|
||||
*/
|
||||
LOT lot = LOT_NULL;
|
||||
|
||||
/**
|
||||
* The number of items that are stored in this slot
|
||||
*/
|
||||
/**
|
||||
* The number of items that are stored in this slot
|
||||
*/
|
||||
uint32_t count = 0;
|
||||
|
||||
/**
|
||||
* The slot this item is stored in
|
||||
*/
|
||||
/**
|
||||
* The slot this item is stored in
|
||||
*/
|
||||
uint32_t slot = 0;
|
||||
|
||||
/**
|
||||
|
@@ -14,40 +14,33 @@ std::vector<LOT> Inventory::m_GameMasterRestrictedItems = {
|
||||
14442 // The jamesster jetpack
|
||||
};
|
||||
|
||||
Inventory::Inventory(const eInventoryType type, const uint32_t size, const std::vector<Item*>& items, InventoryComponent* component)
|
||||
{
|
||||
Inventory::Inventory(const eInventoryType type, const uint32_t size, const std::vector<Item*>& items, InventoryComponent* component) {
|
||||
this->type = type;
|
||||
this->size = size;
|
||||
this->free = size;
|
||||
this->component = component;
|
||||
|
||||
for (auto* item : items)
|
||||
{
|
||||
for (auto* item : items) {
|
||||
AddManagedItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
eInventoryType Inventory::GetType() const
|
||||
{
|
||||
eInventoryType Inventory::GetType() const {
|
||||
return type;
|
||||
}
|
||||
|
||||
uint32_t Inventory::GetSize() const
|
||||
{
|
||||
uint32_t Inventory::GetSize() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
std::map<LWOOBJID, Item*>& Inventory::GetItems()
|
||||
{
|
||||
std::map<LWOOBJID, Item*>& Inventory::GetItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
std::map<uint32_t, Item*> Inventory::GetSlots() const
|
||||
{
|
||||
std::map<uint32_t, Item*> Inventory::GetSlots() const {
|
||||
std::map<uint32_t, Item*> slots;
|
||||
|
||||
for (const auto& pair : items)
|
||||
{
|
||||
for (const auto& pair : items) {
|
||||
auto* item = pair.second;
|
||||
|
||||
slots.insert_or_assign(item->GetSlot(), item);
|
||||
@@ -56,21 +49,17 @@ std::map<uint32_t, Item*> Inventory::GetSlots() const
|
||||
return slots;
|
||||
}
|
||||
|
||||
InventoryComponent* Inventory::GetComponent() const
|
||||
{
|
||||
InventoryComponent* Inventory::GetComponent() const {
|
||||
return component;
|
||||
}
|
||||
|
||||
uint32_t Inventory::GetLotCount(const LOT lot) const
|
||||
{
|
||||
uint32_t Inventory::GetLotCount(const LOT lot) const {
|
||||
uint32_t count = 0;
|
||||
|
||||
for (const auto& pair : items)
|
||||
{
|
||||
for (const auto& pair : items) {
|
||||
const auto* item = pair.second;
|
||||
|
||||
if (item->GetLot() == lot)
|
||||
{
|
||||
if (item->GetLot() == lot) {
|
||||
count += item->GetCount();
|
||||
}
|
||||
}
|
||||
@@ -78,8 +67,7 @@ uint32_t Inventory::GetLotCount(const LOT lot) const
|
||||
return count;
|
||||
}
|
||||
|
||||
void Inventory::SetSize(const uint32_t value)
|
||||
{
|
||||
void Inventory::SetSize(const uint32_t value) {
|
||||
free += static_cast<int32_t>(value) - static_cast<int32_t>(size);
|
||||
|
||||
size = value;
|
||||
@@ -87,45 +75,34 @@ void Inventory::SetSize(const uint32_t value)
|
||||
GameMessages::SendSetInventorySize(component->GetParent(), type, static_cast<int>(size));
|
||||
}
|
||||
|
||||
int32_t Inventory::FindEmptySlot()
|
||||
{
|
||||
int32_t Inventory::FindEmptySlot() {
|
||||
if (free <= 6) // Up from 1
|
||||
{
|
||||
if (type != ITEMS && type != VAULT_ITEMS && type != eInventoryType::VAULT_MODELS)
|
||||
{
|
||||
if (type != ITEMS && type != VAULT_ITEMS && type != eInventoryType::VAULT_MODELS) {
|
||||
uint32_t newSize = size;
|
||||
|
||||
if (type == MODELS)
|
||||
{
|
||||
if (type == MODELS) {
|
||||
newSize = 240;
|
||||
}
|
||||
else if (type == eInventoryType::VENDOR_BUYBACK)
|
||||
{
|
||||
} else if (type == eInventoryType::VENDOR_BUYBACK) {
|
||||
newSize += 9u;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
newSize += 10u;
|
||||
}
|
||||
|
||||
if (newSize > GetSize())
|
||||
{
|
||||
if (newSize > GetSize()) {
|
||||
SetSize(newSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (free == 0)
|
||||
{
|
||||
if (free == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const auto slots = GetSlots();
|
||||
|
||||
for (auto i = 0u; i < size; ++i)
|
||||
{
|
||||
if (slots.find(i) == slots.end())
|
||||
{
|
||||
for (auto i = 0u; i < size; ++i) {
|
||||
if (slots.find(i) == slots.end()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -133,13 +110,11 @@ int32_t Inventory::FindEmptySlot()
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t Inventory::GetEmptySlots()
|
||||
{
|
||||
int32_t Inventory::GetEmptySlots() {
|
||||
return free;
|
||||
}
|
||||
|
||||
bool Inventory::IsSlotEmpty(int32_t slot)
|
||||
{
|
||||
bool Inventory::IsSlotEmpty(int32_t slot) {
|
||||
const auto slots = GetSlots();
|
||||
|
||||
const auto& index = slots.find(slot);
|
||||
@@ -147,50 +122,41 @@ bool Inventory::IsSlotEmpty(int32_t slot)
|
||||
return index == slots.end();
|
||||
}
|
||||
|
||||
Item* Inventory::FindItemById(const LWOOBJID id) const
|
||||
{
|
||||
Item* Inventory::FindItemById(const LWOOBJID id) const {
|
||||
const auto& index = items.find(id);
|
||||
|
||||
if (index == items.end())
|
||||
{
|
||||
if (index == items.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return index->second;
|
||||
}
|
||||
|
||||
Item* Inventory::FindItemByLot(const LOT lot, const bool ignoreEquipped, const bool ignoreBound) const
|
||||
{
|
||||
Item* Inventory::FindItemByLot(const LOT lot, const bool ignoreEquipped, const bool ignoreBound) const {
|
||||
Item* smallest = nullptr;
|
||||
|
||||
for (const auto& pair : items)
|
||||
{
|
||||
for (const auto& pair : items) {
|
||||
auto* item = pair.second;
|
||||
|
||||
if (item->GetLot() != lot)
|
||||
{
|
||||
if (item->GetLot() != lot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ignoreEquipped && item->IsEquipped())
|
||||
{
|
||||
if (ignoreEquipped && item->IsEquipped()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ignoreBound && item->GetBound())
|
||||
{
|
||||
if (ignoreBound && item->GetBound()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (smallest == nullptr)
|
||||
{
|
||||
if (smallest == nullptr) {
|
||||
smallest = item;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (smallest->GetCount() > item->GetCount())
|
||||
{
|
||||
if (smallest->GetCount() > item->GetCount()) {
|
||||
smallest = item;
|
||||
}
|
||||
}
|
||||
@@ -198,26 +164,21 @@ Item* Inventory::FindItemByLot(const LOT lot, const bool ignoreEquipped, const b
|
||||
return smallest;
|
||||
}
|
||||
|
||||
Item* Inventory::FindItemBySlot(const uint32_t slot) const
|
||||
{
|
||||
Item* Inventory::FindItemBySlot(const uint32_t slot) const {
|
||||
const auto slots = GetSlots();
|
||||
|
||||
const auto index = slots.find(slot);
|
||||
|
||||
if (index == slots.end())
|
||||
{
|
||||
if (index == slots.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return index->second;
|
||||
}
|
||||
|
||||
Item* Inventory::FindItemBySubKey(LWOOBJID id) const
|
||||
{
|
||||
for (const auto& item : items)
|
||||
{
|
||||
if (item.second->GetSubKey() == id)
|
||||
{
|
||||
Item* Inventory::FindItemBySubKey(LWOOBJID id) const {
|
||||
for (const auto& item : items) {
|
||||
if (item.second->GetSubKey() == id) {
|
||||
return item.second;
|
||||
}
|
||||
}
|
||||
@@ -225,12 +186,10 @@ Item* Inventory::FindItemBySubKey(LWOOBJID id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Inventory::AddManagedItem(Item* item)
|
||||
{
|
||||
void Inventory::AddManagedItem(Item* item) {
|
||||
const auto id = item->GetId();
|
||||
|
||||
if (items.find(id) != items.end())
|
||||
{
|
||||
if (items.find(id) != items.end()) {
|
||||
Game::logger->Log("Inventory", "Attempting to add an item with an already present id (%llu)!", id);
|
||||
|
||||
return;
|
||||
@@ -240,8 +199,7 @@ void Inventory::AddManagedItem(Item* item)
|
||||
|
||||
const auto slot = item->GetSlot();
|
||||
|
||||
if (slots.find(slot) != slots.end())
|
||||
{
|
||||
if (slots.find(slot) != slots.end()) {
|
||||
Game::logger->Log("Inventory", "Attempting to add an item with an already present slot (%i)!", slot);
|
||||
|
||||
return;
|
||||
@@ -252,12 +210,10 @@ void Inventory::AddManagedItem(Item* item)
|
||||
free--;
|
||||
}
|
||||
|
||||
void Inventory::RemoveManagedItem(Item* item)
|
||||
{
|
||||
void Inventory::RemoveManagedItem(Item* item) {
|
||||
const auto id = item->GetId();
|
||||
|
||||
if (items.find(id) == items.end())
|
||||
{
|
||||
if (items.find(id) == items.end()) {
|
||||
Game::logger->Log("Inventory", "Attempting to remove an item with an invalid id (%llu), lot (%i)!", id, item->GetLot());
|
||||
|
||||
return;
|
||||
@@ -268,8 +224,7 @@ void Inventory::RemoveManagedItem(Item* item)
|
||||
free++;
|
||||
}
|
||||
|
||||
eInventoryType Inventory::FindInventoryTypeForLot(const LOT lot)
|
||||
{
|
||||
eInventoryType Inventory::FindInventoryTypeForLot(const LOT lot) {
|
||||
auto itemComponent = FindItemComponent(lot);
|
||||
|
||||
const auto itemType = static_cast<eItemType>(itemComponent.itemType);
|
||||
@@ -315,16 +270,14 @@ eInventoryType Inventory::FindInventoryTypeForLot(const LOT lot)
|
||||
}
|
||||
}
|
||||
|
||||
const CDItemComponent& Inventory::FindItemComponent(const LOT lot)
|
||||
{
|
||||
const CDItemComponent& Inventory::FindItemComponent(const LOT lot) {
|
||||
auto* registry = CDClientManager::Instance()->GetTable<CDComponentsRegistryTable>("ComponentsRegistry");
|
||||
|
||||
auto* itemComponents = CDClientManager::Instance()->GetTable<CDItemComponentTable>("ItemComponent");
|
||||
|
||||
const auto componentId = registry->GetByIDAndType(lot, COMPONENT_TYPE_ITEM);
|
||||
|
||||
if (componentId == 0)
|
||||
{
|
||||
if (componentId == 0) {
|
||||
Game::logger->Log("Inventory", "Failed to find item component for (%i)!", lot);
|
||||
|
||||
return CDItemComponentTable::Default;
|
||||
@@ -335,8 +288,7 @@ const CDItemComponent& Inventory::FindItemComponent(const LOT lot)
|
||||
return itemComponent;
|
||||
}
|
||||
|
||||
bool Inventory::IsValidItem(const LOT lot)
|
||||
{
|
||||
bool Inventory::IsValidItem(const LOT lot) {
|
||||
auto* registry = CDClientManager::Instance()->GetTable<CDComponentsRegistryTable>("ComponentsRegistry");
|
||||
|
||||
const auto componentId = registry->GetByIDAndType(lot, COMPONENT_TYPE_ITEM);
|
||||
@@ -344,15 +296,12 @@ bool Inventory::IsValidItem(const LOT lot)
|
||||
return componentId != 0;
|
||||
}
|
||||
|
||||
const std::vector<LOT>& Inventory::GetAllGMItems()
|
||||
{
|
||||
const std::vector<LOT>& Inventory::GetAllGMItems() {
|
||||
return m_GameMasterRestrictedItems;
|
||||
}
|
||||
|
||||
Inventory::~Inventory()
|
||||
{
|
||||
for (auto item : items)
|
||||
{
|
||||
Inventory::~Inventory() {
|
||||
for (auto item : items) {
|
||||
delete item.second;
|
||||
}
|
||||
|
||||
|
@@ -21,168 +21,168 @@ class Inventory final
|
||||
public:
|
||||
explicit Inventory(eInventoryType type, uint32_t size, const std::vector<Item*>& items, InventoryComponent* component);
|
||||
|
||||
/**
|
||||
* Returns the type of this inventory
|
||||
* @return the type of this inventory
|
||||
*/
|
||||
/**
|
||||
* Returns the type of this inventory
|
||||
* @return the type of this inventory
|
||||
*/
|
||||
eInventoryType GetType() const;
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of items this inventory can contain
|
||||
* @return the maximum amount of items this inventory can contain
|
||||
*/
|
||||
/**
|
||||
* Returns the maximum amount of items this inventory can contain
|
||||
* @return the maximum amount of items this inventory can contain
|
||||
*/
|
||||
uint32_t GetSize() const;
|
||||
|
||||
/**
|
||||
* Returns all the items that are currently in this inventory, mapped by object ID
|
||||
* @return all the items that are currently in this inventory, mapped by object ID
|
||||
*/
|
||||
/**
|
||||
* Returns all the items that are currently in this inventory, mapped by object ID
|
||||
* @return all the items that are currently in this inventory, mapped by object ID
|
||||
*/
|
||||
std::map<LWOOBJID, Item*>& GetItems();
|
||||
|
||||
/**
|
||||
* Returns all the items that are currently in this inventory, mapped by slot
|
||||
* @return all the items that are currently in this inventory, mapped by slot
|
||||
*/
|
||||
/**
|
||||
* Returns all the items that are currently in this inventory, mapped by slot
|
||||
* @return all the items that are currently in this inventory, mapped by slot
|
||||
*/
|
||||
std::map<uint32_t, Item*> GetSlots() const;
|
||||
|
||||
/**
|
||||
* Returns the inventory component that this inventory is part of
|
||||
* @return the inventory component that this inventory is part of
|
||||
*/
|
||||
/**
|
||||
* Returns the inventory component that this inventory is part of
|
||||
* @return the inventory component that this inventory is part of
|
||||
*/
|
||||
InventoryComponent* GetComponent() const;
|
||||
|
||||
/**
|
||||
* Returns the amount of items this inventory contains of the specified LOT
|
||||
* @param lot the lot to find items for
|
||||
* @return the amount of items this inventory contains of the specified LOT
|
||||
*/
|
||||
/**
|
||||
* Returns the amount of items this inventory contains of the specified LOT
|
||||
* @param lot the lot to find items for
|
||||
* @return the amount of items this inventory contains of the specified LOT
|
||||
*/
|
||||
uint32_t GetLotCount(LOT lot) const;
|
||||
|
||||
/**
|
||||
* Updates the max size of this inventory
|
||||
* @param value the size to set
|
||||
*/
|
||||
/**
|
||||
* Updates the max size of this inventory
|
||||
* @param value the size to set
|
||||
*/
|
||||
void SetSize(uint32_t value);
|
||||
|
||||
/**
|
||||
* Returns the first slot in this inventory that does not contain an item
|
||||
* @return the first slot in this inventory that does not contain an item
|
||||
*/
|
||||
/**
|
||||
* Returns the first slot in this inventory that does not contain an item
|
||||
* @return the first slot in this inventory that does not contain an item
|
||||
*/
|
||||
int32_t FindEmptySlot();
|
||||
|
||||
/**
|
||||
* Returns the number of empty slots this inventory has left
|
||||
* @return the number of empty slots this inventory has left
|
||||
*/
|
||||
/**
|
||||
* Returns the number of empty slots this inventory has left
|
||||
* @return the number of empty slots this inventory has left
|
||||
*/
|
||||
int32_t GetEmptySlots();
|
||||
|
||||
/**
|
||||
* Returns if the slot for the specified index is empty
|
||||
* @param slot the index to check occupation for
|
||||
* @return if the slot for the specified index is empty
|
||||
*/
|
||||
/**
|
||||
* Returns if the slot for the specified index is empty
|
||||
* @param slot the index to check occupation for
|
||||
* @return if the slot for the specified index is empty
|
||||
*/
|
||||
bool IsSlotEmpty(int32_t slot);
|
||||
|
||||
/**
|
||||
* Finds an item in this inventory by the provided id
|
||||
* @param id the object ID of the item to find
|
||||
* @return item in this inventory by the provided id
|
||||
*/
|
||||
/**
|
||||
* Finds an item in this inventory by the provided id
|
||||
* @param id the object ID of the item to find
|
||||
* @return item in this inventory by the provided id
|
||||
*/
|
||||
Item* FindItemById(LWOOBJID id) const;
|
||||
|
||||
/**
|
||||
* Finds an item in the inventory for the provided LOT
|
||||
* @param lot the lot to find items for
|
||||
* @param ignoreEquipped ignores equipped items
|
||||
* @param ignoreBound ignores bound items
|
||||
* @return item in the inventory for the provided LOT
|
||||
*/
|
||||
/**
|
||||
* Finds an item in the inventory for the provided LOT
|
||||
* @param lot the lot to find items for
|
||||
* @param ignoreEquipped ignores equipped items
|
||||
* @param ignoreBound ignores bound items
|
||||
* @return item in the inventory for the provided LOT
|
||||
*/
|
||||
Item* FindItemByLot(LOT lot, bool ignoreEquipped = false, bool ignoreBound = false) const;
|
||||
|
||||
/**
|
||||
* Finds an item in the inventory stored on the provied slot
|
||||
* @param slot to slot to find an item for
|
||||
* @return item in the inventory stored on the provied slot
|
||||
*/
|
||||
/**
|
||||
* Finds an item in the inventory stored on the provied slot
|
||||
* @param slot to slot to find an item for
|
||||
* @return item in the inventory stored on the provied slot
|
||||
*/
|
||||
Item* FindItemBySlot(uint32_t slot) const;
|
||||
|
||||
/**
|
||||
* Finds an item based on a specified subkey (useful for pets)
|
||||
* @param id the subkey to look for in the items
|
||||
* @return item based on a specified subkey
|
||||
*/
|
||||
/**
|
||||
* Finds an item based on a specified subkey (useful for pets)
|
||||
* @param id the subkey to look for in the items
|
||||
* @return item based on a specified subkey
|
||||
*/
|
||||
Item* FindItemBySubKey(LWOOBJID id) const;
|
||||
|
||||
/**
|
||||
* Adds an item to the inventory, finding a slot to place it in
|
||||
* @param item item to add to the inventory
|
||||
*/
|
||||
/**
|
||||
* Adds an item to the inventory, finding a slot to place it in
|
||||
* @param item item to add to the inventory
|
||||
*/
|
||||
void AddManagedItem(Item* item);
|
||||
|
||||
/**
|
||||
* Removes an item from the inventory, clearing its slot
|
||||
* @param item
|
||||
*/
|
||||
/**
|
||||
* Removes an item from the inventory, clearing its slot
|
||||
* @param item
|
||||
*/
|
||||
void RemoveManagedItem(Item* item);
|
||||
|
||||
/**
|
||||
* Returns the inventory type an item of the specified lot should be placed in
|
||||
* @param lot the lot to find the inventory type for
|
||||
* @return the inventory type an item of the specified lot should be placed in
|
||||
*/
|
||||
/**
|
||||
* Returns the inventory type an item of the specified lot should be placed in
|
||||
* @param lot the lot to find the inventory type for
|
||||
* @return the inventory type an item of the specified lot should be placed in
|
||||
*/
|
||||
static eInventoryType FindInventoryTypeForLot(LOT lot);
|
||||
|
||||
/**
|
||||
* Finds the database item component for a item of a certain LOT
|
||||
* @param lot the LOT of the item to get the database item component for
|
||||
* @return the database item component for a item of a certain LOT
|
||||
*/
|
||||
/**
|
||||
* Finds the database item component for a item of a certain LOT
|
||||
* @param lot the LOT of the item to get the database item component for
|
||||
* @return the database item component for a item of a certain LOT
|
||||
*/
|
||||
static const CDItemComponent& FindItemComponent(LOT lot);
|
||||
|
||||
/**
|
||||
* Cheks if the provided lot has a database item component
|
||||
* @param lot the LOT to check item validity for
|
||||
* @return if the provided lot has a database item component
|
||||
*/
|
||||
/**
|
||||
* Cheks if the provided lot has a database item component
|
||||
* @param lot the LOT to check item validity for
|
||||
* @return if the provided lot has a database item component
|
||||
*/
|
||||
static bool IsValidItem(LOT lot);
|
||||
|
||||
/**
|
||||
* Returns all the items that are restricted to GMs
|
||||
* @return all the items that are restricted to GMs
|
||||
*/
|
||||
/**
|
||||
* Returns all the items that are restricted to GMs
|
||||
* @return all the items that are restricted to GMs
|
||||
*/
|
||||
static const std::vector<LOT>& GetAllGMItems();
|
||||
|
||||
|
||||
~Inventory();
|
||||
|
||||
private:
|
||||
/**
|
||||
* The type of this inventory
|
||||
*/
|
||||
/**
|
||||
* The type of this inventory
|
||||
*/
|
||||
eInventoryType type;
|
||||
|
||||
/**
|
||||
* The max size of this inventory
|
||||
*/
|
||||
/**
|
||||
* The max size of this inventory
|
||||
*/
|
||||
uint32_t size;
|
||||
|
||||
/**
|
||||
* The amount of items that can still be stored in this inventroy
|
||||
*/
|
||||
/**
|
||||
* The amount of items that can still be stored in this inventroy
|
||||
*/
|
||||
uint32_t free;
|
||||
|
||||
/**
|
||||
* The items stored in this inventory
|
||||
*/
|
||||
/**
|
||||
* The items stored in this inventory
|
||||
*/
|
||||
std::map<LWOOBJID, Item*> items;
|
||||
|
||||
/**
|
||||
* The inventory component this inventory belongs to
|
||||
*/
|
||||
/**
|
||||
* The inventory component this inventory belongs to
|
||||
*/
|
||||
InventoryComponent* component;
|
||||
|
||||
/**
|
||||
* List of items that are GM restricted
|
||||
*/
|
||||
/**
|
||||
* List of items that are GM restricted
|
||||
*/
|
||||
static std::vector<LOT> m_GameMasterRestrictedItems;
|
||||
};
|
||||
|
||||
|
@@ -14,10 +14,8 @@
|
||||
class Inventory;
|
||||
|
||||
|
||||
Item::Item(const LWOOBJID id, const LOT lot, Inventory* inventory, const uint32_t slot, const uint32_t count, const bool bound, const std::vector<LDFBaseData*>& config, const LWOOBJID parent, LWOOBJID subKey, eLootSourceType lootSourceType)
|
||||
{
|
||||
if (!Inventory::IsValidItem(lot))
|
||||
{
|
||||
Item::Item(const LWOOBJID id, const LOT lot, Inventory* inventory, const uint32_t slot, const uint32_t count, const bool bound, const std::vector<LDFBaseData*>& config, const LWOOBJID parent, LWOOBJID subKey, eLootSourceType lootSourceType) {
|
||||
if (!Inventory::IsValidItem(lot)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,15 +45,12 @@ Item::Item(
|
||||
bool isModMoveAndEquip,
|
||||
LWOOBJID subKey,
|
||||
bool bound,
|
||||
eLootSourceType lootSourceType)
|
||||
{
|
||||
if (!Inventory::IsValidItem(lot))
|
||||
{
|
||||
eLootSourceType lootSourceType) {
|
||||
if (!Inventory::IsValidItem(lot)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isModMoveAndEquip)
|
||||
{
|
||||
if (isModMoveAndEquip) {
|
||||
showFlyingLoot = false;
|
||||
}
|
||||
|
||||
@@ -83,8 +78,7 @@ Item::Item(
|
||||
auto* entity = inventory->GetComponent()->GetParent();
|
||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, static_cast<int>(this->count), subKey, lootSourceType);
|
||||
|
||||
if (isModMoveAndEquip)
|
||||
{
|
||||
if (isModMoveAndEquip) {
|
||||
Equip();
|
||||
|
||||
Game::logger->Log("Item", "Move and equipped (%i) from (%i)", this->lot, this->inventory->GetType());
|
||||
@@ -93,65 +87,52 @@ Item::Item(
|
||||
}
|
||||
}
|
||||
|
||||
LWOOBJID Item::GetId() const
|
||||
{
|
||||
LWOOBJID Item::GetId() const {
|
||||
return id;
|
||||
}
|
||||
|
||||
LOT Item::GetLot() const
|
||||
{
|
||||
LOT Item::GetLot() const {
|
||||
return lot;
|
||||
}
|
||||
|
||||
uint32_t Item::GetCount() const
|
||||
{
|
||||
uint32_t Item::GetCount() const {
|
||||
return count;
|
||||
}
|
||||
|
||||
uint32_t Item::GetSlot() const
|
||||
{
|
||||
uint32_t Item::GetSlot() const {
|
||||
return slot;
|
||||
}
|
||||
|
||||
std::vector<LDFBaseData*>& Item::GetConfig()
|
||||
{
|
||||
std::vector<LDFBaseData*>& Item::GetConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
const CDItemComponent& Item::GetInfo() const
|
||||
{
|
||||
const CDItemComponent& Item::GetInfo() const {
|
||||
return *info;
|
||||
}
|
||||
|
||||
bool Item::GetBound() const
|
||||
{
|
||||
bool Item::GetBound() const {
|
||||
return bound;
|
||||
}
|
||||
|
||||
Inventory* Item::GetInventory() const
|
||||
{
|
||||
Inventory* Item::GetInventory() const {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
LWOOBJID Item::GetParent() const
|
||||
{
|
||||
LWOOBJID Item::GetParent() const {
|
||||
return parent;
|
||||
}
|
||||
|
||||
LWOOBJID Item::GetSubKey() const
|
||||
{
|
||||
LWOOBJID Item::GetSubKey() const {
|
||||
return subKey;
|
||||
}
|
||||
|
||||
PreconditionExpression* Item::GetPreconditionExpression() const
|
||||
{
|
||||
PreconditionExpression* Item::GetPreconditionExpression() const {
|
||||
return preconditions;
|
||||
}
|
||||
|
||||
void Item::SetCount(const uint32_t value, const bool silent, const bool disassemble, const bool showFlyingLoot, eLootSourceType lootSourceType)
|
||||
{
|
||||
if (value == count)
|
||||
{
|
||||
void Item::SetCount(const uint32_t value, const bool silent, const bool disassemble, const bool showFlyingLoot, eLootSourceType lootSourceType) {
|
||||
if (value == count) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -159,52 +140,40 @@ void Item::SetCount(const uint32_t value, const bool silent, const bool disassem
|
||||
|
||||
const auto type = static_cast<eItemType>(info->itemType);
|
||||
|
||||
if (disassemble)
|
||||
{
|
||||
if (value < count)
|
||||
{
|
||||
for (auto i = 0; i < delta; ++i)
|
||||
{
|
||||
if (disassemble) {
|
||||
if (value < count) {
|
||||
for (auto i = 0; i < delta; ++i) {
|
||||
Disassemble();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
if (!silent) {
|
||||
auto* entity = inventory->GetComponent()->GetParent();
|
||||
|
||||
if (value > count)
|
||||
{
|
||||
if (value > count) {
|
||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, delta, LWOOBJID_EMPTY, lootSourceType);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GameMessages::SendRemoveItemFromInventory(entity, entity->GetSystemAddress(), id, lot, inventory->GetType(), delta, value);
|
||||
}
|
||||
}
|
||||
|
||||
count = value;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
if (count == 0) {
|
||||
RemoveFromInventory();
|
||||
}
|
||||
}
|
||||
|
||||
void Item::SetSlot(const uint32_t value)
|
||||
{
|
||||
if (slot == value)
|
||||
{
|
||||
void Item::SetSlot(const uint32_t value) {
|
||||
if (slot == value) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& pair : inventory->GetItems())
|
||||
{
|
||||
for (const auto& pair : inventory->GetItems()) {
|
||||
auto* item = pair.second;
|
||||
|
||||
if (item->slot == value)
|
||||
{
|
||||
if (item->slot == value) {
|
||||
item->slot = slot;
|
||||
}
|
||||
}
|
||||
@@ -212,18 +181,15 @@ void Item::SetSlot(const uint32_t value)
|
||||
slot = value;
|
||||
}
|
||||
|
||||
void Item::SetBound(const bool value)
|
||||
{
|
||||
void Item::SetBound(const bool value) {
|
||||
bound = value;
|
||||
}
|
||||
|
||||
void Item::SetSubKey(LWOOBJID value)
|
||||
{
|
||||
void Item::SetSubKey(LWOOBJID value) {
|
||||
subKey = value;
|
||||
}
|
||||
|
||||
void Item::SetInventory(Inventory* value)
|
||||
{
|
||||
void Item::SetInventory(Inventory* value) {
|
||||
inventory->RemoveManagedItem(this);
|
||||
|
||||
inventory = value;
|
||||
@@ -231,36 +197,29 @@ void Item::SetInventory(Inventory* value)
|
||||
inventory->AddManagedItem(this);
|
||||
}
|
||||
|
||||
void Item::Equip(const bool skipChecks)
|
||||
{
|
||||
if (IsEquipped())
|
||||
{
|
||||
void Item::Equip(const bool skipChecks) {
|
||||
if (IsEquipped()) {
|
||||
return;
|
||||
}
|
||||
|
||||
inventory->GetComponent()->EquipItem(this, skipChecks);
|
||||
}
|
||||
|
||||
void Item::UnEquip()
|
||||
{
|
||||
if (!IsEquipped())
|
||||
{
|
||||
void Item::UnEquip() {
|
||||
if (!IsEquipped()) {
|
||||
return;
|
||||
}
|
||||
|
||||
inventory->GetComponent()->UnEquipItem(this);
|
||||
}
|
||||
|
||||
bool Item::IsEquipped() const
|
||||
{
|
||||
bool Item::IsEquipped() const {
|
||||
auto* component = inventory->GetComponent();
|
||||
|
||||
for (const auto& pair : component->GetEquippedItems())
|
||||
{
|
||||
for (const auto& pair : component->GetEquippedItems()) {
|
||||
const auto item = pair.second;
|
||||
|
||||
if (item.id == id)
|
||||
{
|
||||
if (item.id == id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -268,19 +227,16 @@ bool Item::IsEquipped() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Item::Consume()
|
||||
{
|
||||
bool Item::Consume() {
|
||||
auto* skillsTable = CDClientManager::Instance()->GetTable<CDObjectSkillsTable>("ObjectSkills");
|
||||
|
||||
auto skills = skillsTable->Query([=](const CDObjectSkills entry)
|
||||
{
|
||||
auto skills = skillsTable->Query([=](const CDObjectSkills entry) {
|
||||
return entry.objectTemplate == static_cast<uint32_t>(lot);
|
||||
});
|
||||
});
|
||||
|
||||
auto success = false;
|
||||
|
||||
for (auto& skill : skills)
|
||||
{
|
||||
for (auto& skill : skills) {
|
||||
if (skill.castOnType == 3) // Consumable type
|
||||
{
|
||||
success = true;
|
||||
@@ -291,16 +247,14 @@ bool Item::Consume()
|
||||
|
||||
GameMessages::SendUseItemResult(inventory->GetComponent()->GetParent(), lot, success);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (success) {
|
||||
inventory->GetComponent()->RemoveItem(lot, 1);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool Item::UseNonEquip()
|
||||
{
|
||||
bool Item::UseNonEquip() {
|
||||
auto* compRegistryTable = CDClientManager::Instance()->GetTable<CDComponentsRegistryTable>("ComponentsRegistry");
|
||||
|
||||
const auto packageComponentId = compRegistryTable->GetByIDAndType(lot, COMPONENT_TYPE_PACKAGE);
|
||||
@@ -315,29 +269,24 @@ bool Item::UseNonEquip()
|
||||
|
||||
auto playerEntity = inventoryComponent->GetParent();
|
||||
|
||||
if (subKey != LWOOBJID_EMPTY)
|
||||
{
|
||||
if (subKey != LWOOBJID_EMPTY) {
|
||||
const auto& databasePet = GetInventory()->GetComponent()->GetDatabasePet(subKey);
|
||||
|
||||
if (databasePet.lot != LOT_NULL)
|
||||
{
|
||||
if (databasePet.lot != LOT_NULL) {
|
||||
GetInventory()->GetComponent()->SpawnPet(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (success && (playerEntity->GetGMLevel() >= eGameMasterLevel::GAME_MASTER_LEVEL_JUNIOR_DEVELOPER || this->GetPreconditionExpression()->Check(playerEntity)))
|
||||
{
|
||||
if (success && (playerEntity->GetGMLevel() >= eGameMasterLevel::GAME_MASTER_LEVEL_JUNIOR_DEVELOPER || this->GetPreconditionExpression()->Check(playerEntity))) {
|
||||
auto* entityParent = inventory->GetComponent()->GetParent();
|
||||
|
||||
for (auto& pack : packages)
|
||||
{
|
||||
std::unordered_map<LOT, int32_t> result {};
|
||||
for (auto& pack : packages) {
|
||||
std::unordered_map<LOT, int32_t> result{};
|
||||
|
||||
result = LootGenerator::Instance().RollLootMatrix(entityParent, pack.LootMatrixIndex);
|
||||
|
||||
if (!inventory->GetComponent()->HasSpaceForLoot(result))
|
||||
{
|
||||
if (!inventory->GetComponent()->HasSpaceForLoot(result)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -350,12 +299,9 @@ bool Item::UseNonEquip()
|
||||
return success;
|
||||
}
|
||||
|
||||
void Item::Disassemble(const eInventoryType inventoryType)
|
||||
{
|
||||
for (auto* data : config)
|
||||
{
|
||||
if (data->GetKey() == u"assemblyPartLOTs")
|
||||
{
|
||||
void Item::Disassemble(const eInventoryType inventoryType) {
|
||||
for (auto* data : config) {
|
||||
if (data->GetKey() == u"assemblyPartLOTs") {
|
||||
auto modStr = data->GetValueAsString();
|
||||
|
||||
std::vector<LOT> modArray;
|
||||
@@ -366,35 +312,31 @@ void Item::Disassemble(const eInventoryType inventoryType)
|
||||
|
||||
const auto deliminator = '+';
|
||||
|
||||
while (std::getline(ssData, token, deliminator))
|
||||
{
|
||||
while (std::getline(ssData, token, deliminator)) {
|
||||
const auto modLot = std::stoi(token.substr(2, token.size() - 1));
|
||||
|
||||
modArray.push_back(modLot);
|
||||
}
|
||||
|
||||
for (const auto mod : modArray)
|
||||
{
|
||||
for (const auto mod : modArray) {
|
||||
inventory->GetComponent()->AddItem(mod, 1, eLootSourceType::LOOT_SOURCE_DELETION, inventoryType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Item::DisassembleModel()
|
||||
{
|
||||
void Item::DisassembleModel() {
|
||||
auto* table = CDClientManager::Instance()->GetTable<CDComponentsRegistryTable>("ComponentsRegistry");
|
||||
|
||||
const auto componentId = table->GetByIDAndType(GetLot(), COMPONENT_TYPE_RENDER);
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT render_asset FROM RenderComponent WHERE id = ?;");
|
||||
query.bind(1, (int) componentId);
|
||||
query.bind(1, (int)componentId);
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
if (result.eof())
|
||||
{
|
||||
if (result.eof()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -406,28 +348,24 @@ void Item::DisassembleModel()
|
||||
|
||||
result.finalize();
|
||||
|
||||
if (!file.good())
|
||||
{
|
||||
if (!file.good()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::stringstream data;
|
||||
data << file.rdbuf();
|
||||
|
||||
if (data.str().empty())
|
||||
{
|
||||
if (data.str().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* doc = new tinyxml2::XMLDocument();
|
||||
|
||||
if (!doc)
|
||||
{
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (doc->Parse(data.str().c_str(), data.str().size()) != 0)
|
||||
{
|
||||
if (doc->Parse(data.str().c_str(), data.str().size()) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -437,22 +375,18 @@ void Item::DisassembleModel()
|
||||
auto* bricks = lxfml->FirstChildElement("Bricks");
|
||||
std::string searchTerm = "Brick";
|
||||
|
||||
if (!bricks)
|
||||
{
|
||||
if (!bricks) {
|
||||
searchTerm = "Part";
|
||||
bricks = lxfml->FirstChildElement("Scene")->FirstChildElement("Model")->FirstChildElement("Group");
|
||||
|
||||
if (!bricks)
|
||||
{
|
||||
if (!bricks) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
auto* currentBrick = bricks->FirstChildElement(searchTerm.c_str());
|
||||
while (currentBrick)
|
||||
{
|
||||
if (currentBrick->Attribute("designID") != nullptr)
|
||||
{
|
||||
while (currentBrick) {
|
||||
if (currentBrick->Attribute("designID") != nullptr) {
|
||||
parts.push_back(std::stoi(currentBrick->Attribute("designID")));
|
||||
}
|
||||
|
||||
@@ -461,15 +395,12 @@ void Item::DisassembleModel()
|
||||
|
||||
auto* brickIDTable = CDClientManager::Instance()->GetTable<CDBrickIDTableTable>("BrickIDTable");
|
||||
|
||||
for (unsigned int part : parts)
|
||||
{
|
||||
const auto brickID = brickIDTable->Query([=](const CDBrickIDTable& entry)
|
||||
{
|
||||
for (unsigned int part : parts) {
|
||||
const auto brickID = brickIDTable->Query([=](const CDBrickIDTable& entry) {
|
||||
return entry.LEGOBrickID == part;
|
||||
});
|
||||
});
|
||||
|
||||
if (brickID.empty())
|
||||
{
|
||||
if (brickID.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -477,8 +408,7 @@ void Item::DisassembleModel()
|
||||
}
|
||||
}
|
||||
|
||||
void Item::RemoveFromInventory()
|
||||
{
|
||||
void Item::RemoveFromInventory() {
|
||||
UnEquip();
|
||||
|
||||
count = 0;
|
||||
@@ -488,12 +418,10 @@ void Item::RemoveFromInventory()
|
||||
delete this;
|
||||
}
|
||||
|
||||
Item::~Item()
|
||||
{
|
||||
Item::~Item() {
|
||||
delete preconditions;
|
||||
|
||||
for (auto* value : config)
|
||||
{
|
||||
for (auto* value : config) {
|
||||
delete value;
|
||||
}
|
||||
|
||||
|
@@ -15,18 +15,18 @@ class Item final
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Creates an item, should be used if the item is not picked up but already exists
|
||||
* @param id the object ID of the item to create
|
||||
* @param lot the LOT of the item
|
||||
* @param inventory the inventory to add this item to
|
||||
* @param slot the slot in the inventory to add this item to
|
||||
* @param count the amount of items to add to the inventory
|
||||
* @param bound if the item should be bound
|
||||
* @param config config data for this item, e.g. for rockets
|
||||
* @param parent optional parent of this item, e.g. for proxy items
|
||||
* @param subKey optional subkey for this item, e.g. for pets
|
||||
*/
|
||||
/**
|
||||
* Creates an item, should be used if the item is not picked up but already exists
|
||||
* @param id the object ID of the item to create
|
||||
* @param lot the LOT of the item
|
||||
* @param inventory the inventory to add this item to
|
||||
* @param slot the slot in the inventory to add this item to
|
||||
* @param count the amount of items to add to the inventory
|
||||
* @param bound if the item should be bound
|
||||
* @param config config data for this item, e.g. for rockets
|
||||
* @param parent optional parent of this item, e.g. for proxy items
|
||||
* @param subKey optional subkey for this item, e.g. for pets
|
||||
*/
|
||||
explicit Item(
|
||||
LWOOBJID id,
|
||||
LOT lot,
|
||||
@@ -37,22 +37,22 @@ public:
|
||||
const std::vector<LDFBaseData*>& config,
|
||||
LWOOBJID parent,
|
||||
LWOOBJID subKey,
|
||||
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE
|
||||
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE
|
||||
);
|
||||
|
||||
/**
|
||||
* Creates an item, should be used if the item is picked up / added to the inventory after load
|
||||
* @param lot the LOT of the item
|
||||
* @param inventory the inventory to add this item to
|
||||
* @param slot the slot in the inventory to add this item to
|
||||
* @param count the amount of items to add to the inventory
|
||||
* @param config config data for this item, e.g. for rockets
|
||||
* @param parent optional parent of this item, e.g. for proxy items
|
||||
* @param showFlyingLoot show UI animation of the item being added
|
||||
* @param isModMoveAndEquip equips the item
|
||||
* @param subKey optional subkey for this item, e.g. for pets
|
||||
* @param bound if the item should be bound
|
||||
*/
|
||||
/**
|
||||
* Creates an item, should be used if the item is picked up / added to the inventory after load
|
||||
* @param lot the LOT of the item
|
||||
* @param inventory the inventory to add this item to
|
||||
* @param slot the slot in the inventory to add this item to
|
||||
* @param count the amount of items to add to the inventory
|
||||
* @param config config data for this item, e.g. for rockets
|
||||
* @param parent optional parent of this item, e.g. for proxy items
|
||||
* @param showFlyingLoot show UI animation of the item being added
|
||||
* @param isModMoveAndEquip equips the item
|
||||
* @param subKey optional subkey for this item, e.g. for pets
|
||||
* @param bound if the item should be bound
|
||||
*/
|
||||
explicit Item(
|
||||
LOT lot,
|
||||
Inventory* inventory,
|
||||
@@ -64,209 +64,208 @@ public:
|
||||
bool isModMoveAndEquip = false,
|
||||
LWOOBJID subKey = LWOOBJID_EMPTY,
|
||||
bool bound = false,
|
||||
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE
|
||||
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE
|
||||
);
|
||||
|
||||
~Item();
|
||||
~Item();
|
||||
|
||||
/**
|
||||
* Returns the object ID of this item
|
||||
* @return the object ID of this item
|
||||
*/
|
||||
/**
|
||||
* Returns the object ID of this item
|
||||
* @return the object ID of this item
|
||||
*/
|
||||
LWOOBJID GetId() const;
|
||||
|
||||
/**
|
||||
* Returns the lot of this item
|
||||
* @return the lot of this item
|
||||
*/
|
||||
/**
|
||||
* Returns the lot of this item
|
||||
* @return the lot of this item
|
||||
*/
|
||||
LOT GetLot() const;
|
||||
|
||||
/**
|
||||
* Sets the number of items this item represents
|
||||
* @param value the number to update by
|
||||
* @param silent if true, the client will not be notified of the change with GMs
|
||||
* @param disassemble if items were removed, this returns all the sub parts of the item individually if it had assembly part lots
|
||||
* @param showFlyingLoot shows flying loot to the client, if not silent
|
||||
*/
|
||||
void SetCount(uint32_t value, bool silent = false, bool disassemble = true, bool showFlyingLoot = true, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||
/**
|
||||
* Sets the number of items this item represents
|
||||
* @param value the number to update by
|
||||
* @param silent if true, the client will not be notified of the change with GMs
|
||||
* @param disassemble if items were removed, this returns all the sub parts of the item individually if it had assembly part lots
|
||||
* @param showFlyingLoot shows flying loot to the client, if not silent
|
||||
*/
|
||||
void SetCount(uint32_t value, bool silent = false, bool disassemble = true, bool showFlyingLoot = true, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||
|
||||
/**
|
||||
* Returns the number of items this item represents (e.g. for stacks)
|
||||
* @return the number of items this item represents
|
||||
*/
|
||||
/**
|
||||
* Returns the number of items this item represents (e.g. for stacks)
|
||||
* @return the number of items this item represents
|
||||
*/
|
||||
uint32_t GetCount() const;
|
||||
|
||||
/**
|
||||
* Sets the slot this item is stored in
|
||||
* @param value the slot this item is stored in
|
||||
*/
|
||||
void SetSlot(uint32_t value);
|
||||
/**
|
||||
* Sets the slot this item is stored in
|
||||
* @param value the slot this item is stored in
|
||||
*/
|
||||
void SetSlot(uint32_t value);
|
||||
|
||||
/**
|
||||
* Returns the slot this item is in
|
||||
* @return the slot this item is in
|
||||
*/
|
||||
/**
|
||||
* Returns the slot this item is in
|
||||
* @return the slot this item is in
|
||||
*/
|
||||
uint32_t GetSlot() const;
|
||||
|
||||
/**
|
||||
* Returns current config info for this item, e.g. for rockets
|
||||
* @return current config info for this item
|
||||
*/
|
||||
/**
|
||||
* Returns current config info for this item, e.g. for rockets
|
||||
* @return current config info for this item
|
||||
*/
|
||||
std::vector<LDFBaseData*>& GetConfig();
|
||||
|
||||
/**
|
||||
* Returns the database info for this item
|
||||
* @return the database info for this item
|
||||
*/
|
||||
/**
|
||||
* Returns the database info for this item
|
||||
* @return the database info for this item
|
||||
*/
|
||||
const CDItemComponent& GetInfo() const;
|
||||
|
||||
/**
|
||||
* Sets if the item is bound
|
||||
* @param value if the item is bound
|
||||
*/
|
||||
void SetBound(bool value);
|
||||
/**
|
||||
* Sets if the item is bound
|
||||
* @param value if the item is bound
|
||||
*/
|
||||
void SetBound(bool value);
|
||||
|
||||
/**
|
||||
* Returns if the item is bound
|
||||
* @return if the item is bound
|
||||
*/
|
||||
/**
|
||||
* Returns if the item is bound
|
||||
* @return if the item is bound
|
||||
*/
|
||||
bool GetBound() const;
|
||||
|
||||
/**
|
||||
* Sets the inventory this item belongs to
|
||||
* @param value the inventory this item belongs to
|
||||
*/
|
||||
void SetInventory(Inventory* value);
|
||||
/**
|
||||
* Sets the inventory this item belongs to
|
||||
* @param value the inventory this item belongs to
|
||||
*/
|
||||
void SetInventory(Inventory* value);
|
||||
|
||||
/**
|
||||
* Returns the inventory this item belongs to
|
||||
* @return the inventory this item belongs to
|
||||
*/
|
||||
/**
|
||||
* Returns the inventory this item belongs to
|
||||
* @return the inventory this item belongs to
|
||||
*/
|
||||
Inventory* GetInventory() const;
|
||||
|
||||
/**
|
||||
* Returns the parent of this item, e.g. for proxy items
|
||||
* @return the parent of this item
|
||||
*/
|
||||
/**
|
||||
* Returns the parent of this item, e.g. for proxy items
|
||||
* @return the parent of this item
|
||||
*/
|
||||
LWOOBJID GetParent() const;
|
||||
|
||||
/**
|
||||
* Sets the subkey for this item, e.g. for pets
|
||||
* @param value the subkey for this item
|
||||
*/
|
||||
void SetSubKey(LWOOBJID value);
|
||||
/**
|
||||
* Sets the subkey for this item, e.g. for pets
|
||||
* @param value the subkey for this item
|
||||
*/
|
||||
void SetSubKey(LWOOBJID value);
|
||||
|
||||
/**
|
||||
* Returns the sub key this item has, e.g. for pets
|
||||
* @return the sub key this item has
|
||||
*/
|
||||
/**
|
||||
* Returns the sub key this item has, e.g. for pets
|
||||
* @return the sub key this item has
|
||||
*/
|
||||
LWOOBJID GetSubKey() const;
|
||||
|
||||
/**
|
||||
* Returns the preconditions that must be met before this item may be used
|
||||
* @return the preconditions that must be met before this item may be used
|
||||
*/
|
||||
/**
|
||||
* Returns the preconditions that must be met before this item may be used
|
||||
* @return the preconditions that must be met before this item may be used
|
||||
*/
|
||||
PreconditionExpression* GetPreconditionExpression() const;
|
||||
|
||||
/**
|
||||
* Equips this item into the linked inventory
|
||||
* @param skipChecks skips equip checks for special items like rockets and cars
|
||||
*/
|
||||
/**
|
||||
* Equips this item into the linked inventory
|
||||
* @param skipChecks skips equip checks for special items like rockets and cars
|
||||
*/
|
||||
void Equip(bool skipChecks = false);
|
||||
|
||||
/**
|
||||
* Unequps the item from the linked inventory
|
||||
*/
|
||||
/**
|
||||
* Unequps the item from the linked inventory
|
||||
*/
|
||||
void UnEquip();
|
||||
|
||||
/**
|
||||
* Returns if the item is equipped in the linked inventory
|
||||
* @return if the item is equipped
|
||||
*/
|
||||
/**
|
||||
* Returns if the item is equipped in the linked inventory
|
||||
* @return if the item is equipped
|
||||
*/
|
||||
bool IsEquipped() const;
|
||||
|
||||
/**
|
||||
* Attempts to consume one of this item, applying its skills
|
||||
* @return whether the consumption was successful, e.g. the skill was cast
|
||||
*/
|
||||
/**
|
||||
* Attempts to consume one of this item, applying its skills
|
||||
* @return whether the consumption was successful, e.g. the skill was cast
|
||||
*/
|
||||
bool Consume();
|
||||
|
||||
/**
|
||||
* Uses this item if its non equip, essentially an interface for the linked GM
|
||||
* @return whether the use was successful, e.g. the skill was cast
|
||||
*/
|
||||
/**
|
||||
* Uses this item if its non equip, essentially an interface for the linked GM
|
||||
* @return whether the use was successful, e.g. the skill was cast
|
||||
*/
|
||||
bool UseNonEquip();
|
||||
|
||||
/**
|
||||
* Disassembles the part LOTs of this item back into the inventory, if it has any
|
||||
* @param inventoryType the inventory to dissassemble into
|
||||
*/
|
||||
/**
|
||||
* Disassembles the part LOTs of this item back into the inventory, if it has any
|
||||
* @param inventoryType the inventory to dissassemble into
|
||||
*/
|
||||
void Disassemble(eInventoryType inventoryType = INVALID);
|
||||
|
||||
/**
|
||||
* Disassembles this item into bricks
|
||||
*/
|
||||
/**
|
||||
* Disassembles this item into bricks
|
||||
*/
|
||||
void DisassembleModel();
|
||||
|
||||
/**
|
||||
* Removes the item from the linked inventory
|
||||
*/
|
||||
/**
|
||||
* Removes the item from the linked inventory
|
||||
*/
|
||||
void RemoveFromInventory();
|
||||
|
||||
private:
|
||||
/**
|
||||
* The object ID of this item
|
||||
*/
|
||||
/**
|
||||
* The object ID of this item
|
||||
*/
|
||||
LWOOBJID id;
|
||||
|
||||
/**
|
||||
* The LOT of this item
|
||||
*/
|
||||
/**
|
||||
* The LOT of this item
|
||||
*/
|
||||
LOT lot;
|
||||
|
||||
/**
|
||||
* The number of items this represents
|
||||
*/
|
||||
/**
|
||||
* The number of items this represents
|
||||
*/
|
||||
uint32_t count;
|
||||
|
||||
/**
|
||||
* The slot this item is stored in
|
||||
*/
|
||||
/**
|
||||
* The slot this item is stored in
|
||||
*/
|
||||
uint32_t slot;
|
||||
|
||||
/**
|
||||
* If this item is bound
|
||||
*/
|
||||
/**
|
||||
* If this item is bound
|
||||
*/
|
||||
bool bound;
|
||||
|
||||
/**
|
||||
* A potential parent of this item, if this item is a subitem
|
||||
*/
|
||||
/**
|
||||
* A potential parent of this item, if this item is a subitem
|
||||
*/
|
||||
LWOOBJID parent;
|
||||
|
||||
/**
|
||||
* A potential subkey of this item, e.g. for pets
|
||||
*/
|
||||
/**
|
||||
* A potential subkey of this item, e.g. for pets
|
||||
*/
|
||||
LWOOBJID subKey;
|
||||
|
||||
/**
|
||||
* Config data for this item, e.g. for rocket parts and car parts
|
||||
*/
|
||||
/**
|
||||
* Config data for this item, e.g. for rocket parts and car parts
|
||||
*/
|
||||
std::vector<LDFBaseData*> config;
|
||||
|
||||
/**
|
||||
* The inventory this item belongs to
|
||||
*/
|
||||
/**
|
||||
* The inventory this item belongs to
|
||||
*/
|
||||
Inventory* inventory;
|
||||
|
||||
/**
|
||||
* The database information of this item
|
||||
*/
|
||||
/**
|
||||
* The database information of this item
|
||||
*/
|
||||
const CDItemComponent* info;
|
||||
|
||||
/**
|
||||
* A precondition to using this item
|
||||
*/
|
||||
/**
|
||||
* A precondition to using this item
|
||||
*/
|
||||
PreconditionExpression* preconditions = nullptr;
|
||||
};
|
||||
|
@@ -8,8 +8,7 @@
|
||||
#include "MissionComponent.h"
|
||||
#include <algorithm>
|
||||
|
||||
ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
{
|
||||
ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent) {
|
||||
this->m_ID = id;
|
||||
this->m_InventoryComponent = inventoryComponent;
|
||||
|
||||
@@ -17,19 +16,16 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT skillSetWith2, skillSetWith3, skillSetWith4, skillSetWith5, skillSetWith6, itemIDs FROM ItemSets WHERE setID = ?;");
|
||||
query.bind(1, (int) id);
|
||||
query.bind(1, (int)id);
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
if (result.eof())
|
||||
{
|
||||
if (result.eof()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto i = 0; i < 5; ++i)
|
||||
{
|
||||
if (result.fieldIsNull(i))
|
||||
{
|
||||
for (auto i = 0; i < 5; ++i) {
|
||||
if (result.fieldIsNull(i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -39,15 +35,12 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
|
||||
auto skillResult = skillQuery.execQuery();
|
||||
|
||||
if (skillResult.eof())
|
||||
{
|
||||
if (skillResult.eof()) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (!skillResult.eof())
|
||||
{
|
||||
if (skillResult.fieldIsNull(0))
|
||||
{
|
||||
while (!skillResult.eof()) {
|
||||
if (skillResult.fieldIsNull(0)) {
|
||||
skillResult.nextRow();
|
||||
|
||||
continue;
|
||||
@@ -55,8 +48,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
|
||||
const auto skillId = skillResult.getIntField(0);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
switch (i) {
|
||||
case 0:
|
||||
m_SkillsWith2.push_back(skillId);
|
||||
break;
|
||||
@@ -91,42 +83,34 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
|
||||
m_Items = {};
|
||||
|
||||
while (std::getline(stream, token, ','))
|
||||
{
|
||||
while (std::getline(stream, token, ',')) {
|
||||
int32_t value;
|
||||
if (GeneralUtils::TryParse(token, value))
|
||||
{
|
||||
if (GeneralUtils::TryParse(token, value)) {
|
||||
m_Items.push_back(value);
|
||||
}
|
||||
}
|
||||
|
||||
m_Equipped = {};
|
||||
|
||||
for (const auto item : m_Items)
|
||||
{
|
||||
if (inventoryComponent->IsEquipped(item))
|
||||
{
|
||||
for (const auto item : m_Items) {
|
||||
if (inventoryComponent->IsEquipped(item)) {
|
||||
m_Equipped.push_back(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ItemSet::Contains(const LOT lot)
|
||||
{
|
||||
bool ItemSet::Contains(const LOT lot) {
|
||||
return std::find(m_Items.begin(), m_Items.end(), lot) != m_Items.end();
|
||||
}
|
||||
|
||||
void ItemSet::OnEquip(const LOT lot)
|
||||
{
|
||||
if (!Contains(lot))
|
||||
{
|
||||
void ItemSet::OnEquip(const LOT lot) {
|
||||
if (!Contains(lot)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& index = std::find(m_Equipped.begin(), m_Equipped.end(), lot);
|
||||
|
||||
if (index != m_Equipped.end())
|
||||
{
|
||||
if (index != m_Equipped.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -134,16 +118,14 @@ void ItemSet::OnEquip(const LOT lot)
|
||||
|
||||
const auto& skillSet = GetSkillSet(m_Equipped.size());
|
||||
|
||||
if (skillSet.empty())
|
||||
{
|
||||
if (skillSet.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = m_InventoryComponent->GetParent()->GetComponent<SkillComponent>();
|
||||
auto* missionComponent = m_InventoryComponent->GetParent()->GetComponent<MissionComponent>();
|
||||
|
||||
for (const auto skill : skillSet)
|
||||
{
|
||||
for (const auto skill : skillSet) {
|
||||
auto* skillTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");
|
||||
|
||||
const auto behaviorId = skillTable->GetSkillByID(skill).behaviorID;
|
||||
@@ -154,17 +136,14 @@ void ItemSet::OnEquip(const LOT lot)
|
||||
}
|
||||
}
|
||||
|
||||
void ItemSet::OnUnEquip(const LOT lot)
|
||||
{
|
||||
if (!Contains(lot))
|
||||
{
|
||||
void ItemSet::OnUnEquip(const LOT lot) {
|
||||
if (!Contains(lot)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& index = std::find(m_Equipped.begin(), m_Equipped.end(), lot);
|
||||
|
||||
if (index == m_Equipped.end())
|
||||
{
|
||||
if (index == m_Equipped.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -172,15 +151,13 @@ void ItemSet::OnUnEquip(const LOT lot)
|
||||
|
||||
m_Equipped.erase(index);
|
||||
|
||||
if (skillSet.empty())
|
||||
{
|
||||
if (skillSet.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& skillComponent = m_InventoryComponent->GetParent()->GetComponent<SkillComponent>();
|
||||
|
||||
for (const auto skill : skillSet)
|
||||
{
|
||||
for (const auto skill : skillSet) {
|
||||
auto* skillTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");
|
||||
|
||||
const auto behaviorId = skillTable->GetSkillByID(skill).behaviorID;
|
||||
@@ -189,36 +166,28 @@ void ItemSet::OnUnEquip(const LOT lot)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ItemSet::GetEquippedCount() const
|
||||
{
|
||||
uint32_t ItemSet::GetEquippedCount() const {
|
||||
return m_Equipped.size();
|
||||
}
|
||||
|
||||
uint32_t ItemSet::GetID() const
|
||||
{
|
||||
uint32_t ItemSet::GetID() const {
|
||||
return m_ID;
|
||||
}
|
||||
|
||||
void ItemSet::Update(float deltaTime)
|
||||
{
|
||||
for (auto& passiveAbility : m_PassiveAbilities)
|
||||
{
|
||||
void ItemSet::Update(float deltaTime) {
|
||||
for (auto& passiveAbility : m_PassiveAbilities) {
|
||||
passiveAbility.Update(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemSet::TriggerPassiveAbility(PassiveAbilityTrigger trigger)
|
||||
{
|
||||
for (auto& passiveAbility : m_PassiveAbilities)
|
||||
{
|
||||
void ItemSet::TriggerPassiveAbility(PassiveAbilityTrigger trigger) {
|
||||
for (auto& passiveAbility : m_PassiveAbilities) {
|
||||
passiveAbility.Trigger(trigger);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint32_t> ItemSet::GetSkillSet(const uint32_t itemCount) const
|
||||
{
|
||||
switch (itemCount)
|
||||
{
|
||||
std::vector<uint32_t> ItemSet::GetSkillSet(const uint32_t itemCount) const {
|
||||
switch (itemCount) {
|
||||
case 2:
|
||||
return m_SkillsWith2;
|
||||
case 3:
|
||||
|
@@ -15,100 +15,100 @@ class ItemSet
|
||||
{
|
||||
public:
|
||||
explicit ItemSet(uint32_t id, InventoryComponent* inventoryComponent);
|
||||
void Update(float deltaTime);
|
||||
void Update(float deltaTime);
|
||||
|
||||
/**
|
||||
* Returns if this item set contains the LOT specified
|
||||
* @param lot the lot to check for
|
||||
* @return if this item set contains the LOT specified
|
||||
*/
|
||||
/**
|
||||
* Returns if this item set contains the LOT specified
|
||||
* @param lot the lot to check for
|
||||
* @return if this item set contains the LOT specified
|
||||
*/
|
||||
bool Contains(LOT lot);
|
||||
|
||||
/**
|
||||
* Equips the item set skill for this LOT (if it's in the item set)
|
||||
* @param lot the LOT of the item to equip skills for
|
||||
*/
|
||||
/**
|
||||
* Equips the item set skill for this LOT (if it's in the item set)
|
||||
* @param lot the LOT of the item to equip skills for
|
||||
*/
|
||||
void OnEquip(LOT lot);
|
||||
|
||||
/**
|
||||
* Unequips the item set skill for this LOT (if it's in the item set)
|
||||
* @param lot the LOT of the item to unequip skills for
|
||||
*/
|
||||
/**
|
||||
* Unequips the item set skill for this LOT (if it's in the item set)
|
||||
* @param lot the LOT of the item to unequip skills for
|
||||
*/
|
||||
void OnUnEquip(LOT lot);
|
||||
|
||||
/**
|
||||
* Returns the number of items in the item set that are currently equipped
|
||||
* @return the number of items in the item set that are currently equipped
|
||||
*/
|
||||
/**
|
||||
* Returns the number of items in the item set that are currently equipped
|
||||
* @return the number of items in the item set that are currently equipped
|
||||
*/
|
||||
uint32_t GetEquippedCount() const;
|
||||
|
||||
/**
|
||||
* Returns the ID of this item set
|
||||
* @return the ID of this item set
|
||||
*/
|
||||
/**
|
||||
* Returns the ID of this item set
|
||||
* @return the ID of this item set
|
||||
*/
|
||||
uint32_t GetID() const;
|
||||
|
||||
/**
|
||||
* Triggers all the passive abilities in this item set that match this trigger
|
||||
* @param trigger the trigger to use to trigger passive abilities
|
||||
*/
|
||||
void TriggerPassiveAbility(PassiveAbilityTrigger trigger);
|
||||
/**
|
||||
* Triggers all the passive abilities in this item set that match this trigger
|
||||
* @param trigger the trigger to use to trigger passive abilities
|
||||
*/
|
||||
void TriggerPassiveAbility(PassiveAbilityTrigger trigger);
|
||||
|
||||
/**
|
||||
* Returns the skills that can be equipped for a specified amount of equipped items
|
||||
* @param itemCount the amount of items equipped to check for
|
||||
* @return the skills that can be equipped for a specified amount of equipped items
|
||||
*/
|
||||
/**
|
||||
* Returns the skills that can be equipped for a specified amount of equipped items
|
||||
* @param itemCount the amount of items equipped to check for
|
||||
* @return the skills that can be equipped for a specified amount of equipped items
|
||||
*/
|
||||
std::vector<uint32_t> GetSkillSet(uint32_t itemCount) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* The ID of this skill set
|
||||
*/
|
||||
/**
|
||||
* The ID of this skill set
|
||||
*/
|
||||
uint32_t m_ID;
|
||||
|
||||
/**
|
||||
* The inventory this skill set belongs to
|
||||
*/
|
||||
/**
|
||||
* The inventory this skill set belongs to
|
||||
*/
|
||||
InventoryComponent* m_InventoryComponent;
|
||||
|
||||
/**
|
||||
* The items in the skill set that are currently equipped
|
||||
*/
|
||||
/**
|
||||
* The items in the skill set that are currently equipped
|
||||
*/
|
||||
std::vector<LOT> m_Equipped;
|
||||
|
||||
/**
|
||||
* The total list of items in this skill set
|
||||
*/
|
||||
/**
|
||||
* The total list of items in this skill set
|
||||
*/
|
||||
std::vector<LOT> m_Items;
|
||||
|
||||
/**
|
||||
* The skills that can be triggered when 2 items are equipped
|
||||
*/
|
||||
/**
|
||||
* The skills that can be triggered when 2 items are equipped
|
||||
*/
|
||||
std::vector<uint32_t> m_SkillsWith2;
|
||||
|
||||
/**
|
||||
* The skills that can be triggered when 3 items are equipped
|
||||
*/
|
||||
/**
|
||||
* The skills that can be triggered when 3 items are equipped
|
||||
*/
|
||||
std::vector<uint32_t> m_SkillsWith3;
|
||||
|
||||
/**
|
||||
* The skills that can be triggered when 4 items are equipped
|
||||
*/
|
||||
/**
|
||||
* The skills that can be triggered when 4 items are equipped
|
||||
*/
|
||||
std::vector<uint32_t> m_SkillsWith4;
|
||||
|
||||
/**
|
||||
* The skills that can be triggered when 5 items are equipped
|
||||
*/
|
||||
/**
|
||||
* The skills that can be triggered when 5 items are equipped
|
||||
*/
|
||||
std::vector<uint32_t> m_SkillsWith5;
|
||||
|
||||
/**
|
||||
* The skills that can be triggered when 6 items are equipped
|
||||
*/
|
||||
/**
|
||||
* The skills that can be triggered when 6 items are equipped
|
||||
*/
|
||||
std::vector<uint32_t> m_SkillsWith6;
|
||||
|
||||
/**
|
||||
* The passive abilities associated with this skill set
|
||||
*/
|
||||
/**
|
||||
* The passive abilities associated with this skill set
|
||||
*/
|
||||
std::vector<ItemSetPassiveAbility> m_PassiveAbilities;
|
||||
};
|
||||
};
|
||||
|
@@ -5,330 +5,316 @@
|
||||
#include "ItemSet.h"
|
||||
#include "ItemSetPassiveAbilityID.h"
|
||||
|
||||
ItemSetPassiveAbility::ItemSetPassiveAbility(PassiveAbilityTrigger trigger, Entity* parent, ItemSet* itemSet)
|
||||
{
|
||||
m_Trigger = trigger;
|
||||
m_Parent = parent;
|
||||
m_ItemSet = itemSet;
|
||||
ItemSetPassiveAbility::ItemSetPassiveAbility(PassiveAbilityTrigger trigger, Entity* parent, ItemSet* itemSet) {
|
||||
m_Trigger = trigger;
|
||||
m_Parent = parent;
|
||||
m_ItemSet = itemSet;
|
||||
|
||||
m_Cooldown = 0.0f;
|
||||
m_Cooldown = 0.0f;
|
||||
}
|
||||
|
||||
ItemSetPassiveAbility::~ItemSetPassiveAbility()
|
||||
{
|
||||
ItemSetPassiveAbility::~ItemSetPassiveAbility() {
|
||||
}
|
||||
|
||||
void ItemSetPassiveAbility::Trigger(PassiveAbilityTrigger trigger)
|
||||
{
|
||||
if (m_Trigger != trigger || m_Cooldown > 0.0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void ItemSetPassiveAbility::Trigger(PassiveAbilityTrigger trigger) {
|
||||
if (m_Trigger != trigger || m_Cooldown > 0.0f) {
|
||||
return;
|
||||
}
|
||||
|
||||
Activate();
|
||||
Activate();
|
||||
}
|
||||
|
||||
void ItemSetPassiveAbility::Update(float deltaTime)
|
||||
{
|
||||
if (m_Cooldown > 0.0f)
|
||||
{
|
||||
m_Cooldown -= deltaTime;
|
||||
}
|
||||
void ItemSetPassiveAbility::Update(float deltaTime) {
|
||||
if (m_Cooldown > 0.0f) {
|
||||
m_Cooldown -= deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemSetPassiveAbility::Activate()
|
||||
{
|
||||
if (m_Trigger == PassiveAbilityTrigger::EnemySmashed)
|
||||
{
|
||||
OnEnemySmshed();
|
||||
void ItemSetPassiveAbility::Activate() {
|
||||
if (m_Trigger == PassiveAbilityTrigger::EnemySmashed) {
|
||||
OnEnemySmshed();
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || skillComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (destroyableComponent == nullptr || skillComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
|
||||
const auto id = static_cast<ItemSetPassiveAbilityID>(m_ItemSet->GetID());
|
||||
const auto parentID = m_Parent->GetObjectID();
|
||||
const auto equippedCount = m_ItemSet->GetEquippedCount();
|
||||
const auto id = static_cast<ItemSetPassiveAbilityID>(m_ItemSet->GetID());
|
||||
const auto parentID = m_Parent->GetObjectID();
|
||||
const auto equippedCount = m_ItemSet->GetEquippedCount();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
// Assembly
|
||||
case ItemSetPassiveAbilityID::InventorRank1:
|
||||
case ItemSetPassiveAbilityID::SummonerRank1:
|
||||
case ItemSetPassiveAbilityID::EngineerRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(394, 4401, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::InventorRank2:
|
||||
case ItemSetPassiveAbilityID::SummonerRank2:
|
||||
case ItemSetPassiveAbilityID::EngineerRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(581, 9433, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::InventorRank3:
|
||||
case ItemSetPassiveAbilityID::SummonerRank3:
|
||||
case ItemSetPassiveAbilityID::EngineerRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(582, 9435, parentID);
|
||||
break;
|
||||
}
|
||||
switch (id) {
|
||||
// Assembly
|
||||
case ItemSetPassiveAbilityID::InventorRank1:
|
||||
case ItemSetPassiveAbilityID::SummonerRank1:
|
||||
case ItemSetPassiveAbilityID::EngineerRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(394, 4401, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::InventorRank2:
|
||||
case ItemSetPassiveAbilityID::SummonerRank2:
|
||||
case ItemSetPassiveAbilityID::EngineerRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(581, 9433, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::InventorRank3:
|
||||
case ItemSetPassiveAbilityID::SummonerRank3:
|
||||
case ItemSetPassiveAbilityID::EngineerRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(582, 9435, parentID);
|
||||
break;
|
||||
}
|
||||
|
||||
// Sentinel
|
||||
case ItemSetPassiveAbilityID::KnightRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(559, 8884, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::KnightRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(560, 8885, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::KnightRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(561, 8890, parentID);
|
||||
break;
|
||||
}
|
||||
// Sentinel
|
||||
case ItemSetPassiveAbilityID::KnightRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(559, 8884, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::KnightRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(560, 8885, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::KnightRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(561, 8890, parentID);
|
||||
break;
|
||||
}
|
||||
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(1101, 24612, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(1102, 24617, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(1103, 24622, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(1101, 24612, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(1102, 24617, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(1103, 24622, parentID);
|
||||
break;
|
||||
}
|
||||
|
||||
case ItemSetPassiveAbilityID::SamuraiRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(562, 8899, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(563, 8904, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(564, 8909, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(562, 8899, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(563, 8904, parentID);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
m_Cooldown = 11.0f;
|
||||
skillComponent->CalculateBehavior(564, 8909, parentID);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ItemSetPassiveAbility> ItemSetPassiveAbility::FindAbilities(uint32_t itemSetID, Entity* parent, ItemSet* itemSet)
|
||||
{
|
||||
std::vector<ItemSetPassiveAbility> abilities;
|
||||
std::vector<ItemSetPassiveAbility> ItemSetPassiveAbility::FindAbilities(uint32_t itemSetID, Entity* parent, ItemSet* itemSet) {
|
||||
std::vector<ItemSetPassiveAbility> abilities;
|
||||
|
||||
switch (static_cast<ItemSetPassiveAbilityID>(itemSetID)) {
|
||||
// Assembly
|
||||
case ItemSetPassiveAbilityID::SummonerRank1:
|
||||
case ItemSetPassiveAbilityID::SummonerRank2:
|
||||
case ItemSetPassiveAbilityID::SummonerRank3:
|
||||
case ItemSetPassiveAbilityID::InventorRank1:
|
||||
case ItemSetPassiveAbilityID::InventorRank2:
|
||||
case ItemSetPassiveAbilityID::InventorRank3:
|
||||
case ItemSetPassiveAbilityID::EngineerRank1:
|
||||
case ItemSetPassiveAbilityID::EngineerRank2:
|
||||
case ItemSetPassiveAbilityID::EngineerRank3: {
|
||||
abilities.emplace_back(PassiveAbilityTrigger::AssemblyImagination, parent, itemSet);
|
||||
switch (static_cast<ItemSetPassiveAbilityID>(itemSetID)) {
|
||||
// Assembly
|
||||
case ItemSetPassiveAbilityID::SummonerRank1:
|
||||
case ItemSetPassiveAbilityID::SummonerRank2:
|
||||
case ItemSetPassiveAbilityID::SummonerRank3:
|
||||
case ItemSetPassiveAbilityID::InventorRank1:
|
||||
case ItemSetPassiveAbilityID::InventorRank2:
|
||||
case ItemSetPassiveAbilityID::InventorRank3:
|
||||
case ItemSetPassiveAbilityID::EngineerRank1:
|
||||
case ItemSetPassiveAbilityID::EngineerRank2:
|
||||
case ItemSetPassiveAbilityID::EngineerRank3: {
|
||||
abilities.emplace_back(PassiveAbilityTrigger::AssemblyImagination, parent, itemSet);
|
||||
|
||||
break;
|
||||
}
|
||||
// Sentinel
|
||||
case ItemSetPassiveAbilityID::KnightRank1:
|
||||
case ItemSetPassiveAbilityID::KnightRank2:
|
||||
case ItemSetPassiveAbilityID::KnightRank3:
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank1:
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank2:
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank3:
|
||||
case ItemSetPassiveAbilityID::SamuraiRank1:
|
||||
case ItemSetPassiveAbilityID::SamuraiRank2:
|
||||
case ItemSetPassiveAbilityID::SamuraiRank3: {
|
||||
abilities.emplace_back(PassiveAbilityTrigger::SentinelArmor, parent, itemSet);
|
||||
abilities.emplace_back(PassiveAbilityTrigger::EnemySmashed, parent, itemSet);
|
||||
break;
|
||||
}
|
||||
// Sentinel
|
||||
case ItemSetPassiveAbilityID::KnightRank1:
|
||||
case ItemSetPassiveAbilityID::KnightRank2:
|
||||
case ItemSetPassiveAbilityID::KnightRank3:
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank1:
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank2:
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank3:
|
||||
case ItemSetPassiveAbilityID::SamuraiRank1:
|
||||
case ItemSetPassiveAbilityID::SamuraiRank2:
|
||||
case ItemSetPassiveAbilityID::SamuraiRank3: {
|
||||
abilities.emplace_back(PassiveAbilityTrigger::SentinelArmor, parent, itemSet);
|
||||
abilities.emplace_back(PassiveAbilityTrigger::EnemySmashed, parent, itemSet);
|
||||
|
||||
break;
|
||||
}
|
||||
// Paradox
|
||||
case ItemSetPassiveAbilityID::BatLord:
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank1:
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank2:
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank3:
|
||||
case ItemSetPassiveAbilityID::SorcererRank1:
|
||||
case ItemSetPassiveAbilityID::SorcererRank2:
|
||||
case ItemSetPassiveAbilityID::SorcererRank3:
|
||||
case ItemSetPassiveAbilityID::ShinobiRank1:
|
||||
case ItemSetPassiveAbilityID::ShinobiRank2:
|
||||
case ItemSetPassiveAbilityID::ShinobiRank3: {
|
||||
abilities.emplace_back(PassiveAbilityTrigger::EnemySmashed, parent, itemSet);
|
||||
break;
|
||||
}
|
||||
// Paradox
|
||||
case ItemSetPassiveAbilityID::BatLord:
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank1:
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank2:
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank3:
|
||||
case ItemSetPassiveAbilityID::SorcererRank1:
|
||||
case ItemSetPassiveAbilityID::SorcererRank2:
|
||||
case ItemSetPassiveAbilityID::SorcererRank3:
|
||||
case ItemSetPassiveAbilityID::ShinobiRank1:
|
||||
case ItemSetPassiveAbilityID::ShinobiRank2:
|
||||
case ItemSetPassiveAbilityID::ShinobiRank3: {
|
||||
abilities.emplace_back(PassiveAbilityTrigger::EnemySmashed, parent, itemSet);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return abilities;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return abilities;
|
||||
}
|
||||
|
||||
void ItemSetPassiveAbility::OnEnemySmshed()
|
||||
{
|
||||
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
void ItemSetPassiveAbility::OnEnemySmshed() {
|
||||
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || skillComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (destroyableComponent == nullptr || skillComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
|
||||
const auto id = static_cast<ItemSetPassiveAbilityID>(m_ItemSet->GetID());
|
||||
const auto parentID = m_Parent->GetObjectID();
|
||||
const auto equippedCount = m_ItemSet->GetEquippedCount();
|
||||
const auto id = static_cast<ItemSetPassiveAbilityID>(m_ItemSet->GetID());
|
||||
const auto parentID = m_Parent->GetObjectID();
|
||||
const auto equippedCount = m_ItemSet->GetEquippedCount();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
// Bat Lord
|
||||
case ItemSetPassiveAbilityID::BatLord: {
|
||||
if(equippedCount < 5) return;
|
||||
destroyableComponent->Heal(3);
|
||||
break;
|
||||
}
|
||||
// Sentinel
|
||||
case ItemSetPassiveAbilityID::KnightRank1: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::KnightRank2: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::KnightRank3: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
switch (id) {
|
||||
// Bat Lord
|
||||
case ItemSetPassiveAbilityID::BatLord: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Heal(3);
|
||||
break;
|
||||
}
|
||||
// Sentinel
|
||||
case ItemSetPassiveAbilityID::KnightRank1: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::KnightRank2: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::KnightRank3: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank1: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank2: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank3: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank1: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank2: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceRangerRank3: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
|
||||
case ItemSetPassiveAbilityID::SamuraiRank1: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank2: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank3: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank1: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank2: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SamuraiRank3: {
|
||||
if (equippedCount < 5) return;
|
||||
destroyableComponent->Repair(1);
|
||||
break;
|
||||
}
|
||||
|
||||
// Paradox
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(2);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(3);
|
||||
break;
|
||||
}
|
||||
|
||||
case ItemSetPassiveAbilityID::ShinobiRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::ShinobiRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(2);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::ShinobiRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(3);
|
||||
break;
|
||||
}
|
||||
// Paradox
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(2);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SpaceMarauderRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(3);
|
||||
break;
|
||||
}
|
||||
|
||||
case ItemSetPassiveAbilityID::SorcererRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SorcererRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(2);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SorcererRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(3);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::ShinobiRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::ShinobiRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(2);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::ShinobiRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(3);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SorcererRank1: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(1);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SorcererRank2: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(2);
|
||||
break;
|
||||
}
|
||||
case ItemSetPassiveAbilityID::SorcererRank3: {
|
||||
if (equippedCount < 4) return;
|
||||
destroyableComponent->Imagine(3);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -9,11 +9,11 @@ class ItemSet;
|
||||
|
||||
enum class PassiveAbilityTrigger
|
||||
{
|
||||
AssemblyImagination, // Less than 1 imagination
|
||||
ParadoxHealth, // Less or equal to 1 health
|
||||
SentinelArmor, // Less than 1 armor
|
||||
VentureHealth, // Less than 3 health
|
||||
EnemySmashed, // Enemy is smashed
|
||||
AssemblyImagination, // Less than 1 imagination
|
||||
ParadoxHealth, // Less or equal to 1 health
|
||||
SentinelArmor, // Less than 1 armor
|
||||
VentureHealth, // Less than 3 health
|
||||
EnemySmashed, // Enemy is smashed
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -22,50 +22,50 @@ enum class PassiveAbilityTrigger
|
||||
class ItemSetPassiveAbility
|
||||
{
|
||||
public:
|
||||
ItemSetPassiveAbility(PassiveAbilityTrigger trigger, Entity* parent, ItemSet* itemSet);
|
||||
~ItemSetPassiveAbility();
|
||||
void Update(float deltaTime);
|
||||
ItemSetPassiveAbility(PassiveAbilityTrigger trigger, Entity* parent, ItemSet* itemSet);
|
||||
~ItemSetPassiveAbility();
|
||||
void Update(float deltaTime);
|
||||
|
||||
/**
|
||||
* Attempts to trigger a passive ability for this item set, if this is the wrong trigger this is a no-op
|
||||
* @param trigger the trigger to attempt to fire
|
||||
*/
|
||||
void Trigger(PassiveAbilityTrigger trigger);
|
||||
/**
|
||||
* Attempts to trigger a passive ability for this item set, if this is the wrong trigger this is a no-op
|
||||
* @param trigger the trigger to attempt to fire
|
||||
*/
|
||||
void Trigger(PassiveAbilityTrigger trigger);
|
||||
|
||||
/**
|
||||
* Activates the passive ability
|
||||
*/
|
||||
void Activate();
|
||||
/**
|
||||
* Activates the passive ability
|
||||
*/
|
||||
void Activate();
|
||||
|
||||
/**
|
||||
* Finds all the passive abilities associated with a certain item set
|
||||
* @param itemSetID the item set to find abilities for
|
||||
* @param parent the parent to add to the passive abilities
|
||||
* @param itemSet the item set to add to the passive abilities
|
||||
* @return the passive abilities for the provided item set
|
||||
*/
|
||||
static std::vector<ItemSetPassiveAbility> FindAbilities(uint32_t itemSetID, Entity* parent, ItemSet* itemSet);
|
||||
/**
|
||||
* Finds all the passive abilities associated with a certain item set
|
||||
* @param itemSetID the item set to find abilities for
|
||||
* @param parent the parent to add to the passive abilities
|
||||
* @param itemSet the item set to add to the passive abilities
|
||||
* @return the passive abilities for the provided item set
|
||||
*/
|
||||
static std::vector<ItemSetPassiveAbility> FindAbilities(uint32_t itemSetID, Entity* parent, ItemSet* itemSet);
|
||||
|
||||
private:
|
||||
void OnEnemySmshed();
|
||||
void OnEnemySmshed();
|
||||
|
||||
/**
|
||||
* The means of triggering this ability
|
||||
*/
|
||||
PassiveAbilityTrigger m_Trigger;
|
||||
/**
|
||||
* The means of triggering this ability
|
||||
*/
|
||||
PassiveAbilityTrigger m_Trigger;
|
||||
|
||||
/**
|
||||
* The owner of this ability
|
||||
*/
|
||||
Entity* m_Parent;
|
||||
/**
|
||||
* The owner of this ability
|
||||
*/
|
||||
Entity* m_Parent;
|
||||
|
||||
/**
|
||||
* The item set this ability belongs to
|
||||
*/
|
||||
ItemSet* m_ItemSet;
|
||||
/**
|
||||
* The item set this ability belongs to
|
||||
*/
|
||||
ItemSet* m_ItemSet;
|
||||
|
||||
/**
|
||||
* The cooldown on this ability until it can be activated again
|
||||
*/
|
||||
float m_Cooldown;
|
||||
/**
|
||||
* The cooldown on this ability until it can be activated again
|
||||
*/
|
||||
float m_Cooldown;
|
||||
};
|
||||
|
@@ -49,57 +49,57 @@
|
||||
49 [Unnamed] Item Set
|
||||
50 Fire Spinjitzu Item Set
|
||||
51 Ice Spinjitzu Item Set
|
||||
52 Lightning Spinjitzu Item Set
|
||||
52 Lightning Spinjitzu Item Set
|
||||
*/
|
||||
enum class ItemSetPassiveAbilityID
|
||||
{
|
||||
EngineerRank1 = 2,
|
||||
EngineerRank2 = 3,
|
||||
EngineerRank3 = 4,
|
||||
KnightRank1 = 7,
|
||||
KnightRank2 = 8,
|
||||
KnightRank3 = 9,
|
||||
SpaceRangerRank1 = 10,
|
||||
SpaceRangerRank2 = 11,
|
||||
SpaceRangerRank3 = 12,
|
||||
SamuraiRank1 = 13,
|
||||
SamuraiRank2 = 14,
|
||||
SamuraiRank3 = 15,
|
||||
SorcererRank1 = 16,
|
||||
SorcererRank2 = 17,
|
||||
SorcererRank3 = 18,
|
||||
SpaceMarauderRank1 = 19,
|
||||
SpaceMarauderRank2 = 20,
|
||||
SpaceMarauderRank3 = 21,
|
||||
ShinobiRank1 = 22,
|
||||
ShinobiRank2 = 23,
|
||||
ShinobiRank3 = 24,
|
||||
InventorRank1 = 25,
|
||||
InventorRank2 = 26,
|
||||
InventorRank3 = 27,
|
||||
SummonerRank1 = 28,
|
||||
SummonerRank2 = 29,
|
||||
SummonerRank3 = 30,
|
||||
AdventurerRank1 = 31,
|
||||
AdventurerRank2 = 32,
|
||||
AdventurerRank3 = 33,
|
||||
DaredevilRank1 = 34,
|
||||
DaredevilRank2 = 35,
|
||||
DaredevilRank3 = 36,
|
||||
BuccaneerRank1 = 37,
|
||||
BuccaneerRank2 = 38,
|
||||
BuccaneerRank3 = 39,
|
||||
BoneSuit = 40,
|
||||
ImaginationSpinjitzu = 41,
|
||||
BatLord = 42,
|
||||
MosaicJester = 43,
|
||||
ExplorienBot = 44,
|
||||
Unnamed1 = 45,
|
||||
Unnamed2 = 46,
|
||||
Unnamed3 = 47,
|
||||
EarthSpinjitzu = 48,
|
||||
Unnamed4 = 49,
|
||||
FireSpinjitzu = 50,
|
||||
IceSpinjitzu = 51,
|
||||
LightningSpinjitzu = 52
|
||||
EngineerRank1 = 2,
|
||||
EngineerRank2 = 3,
|
||||
EngineerRank3 = 4,
|
||||
KnightRank1 = 7,
|
||||
KnightRank2 = 8,
|
||||
KnightRank3 = 9,
|
||||
SpaceRangerRank1 = 10,
|
||||
SpaceRangerRank2 = 11,
|
||||
SpaceRangerRank3 = 12,
|
||||
SamuraiRank1 = 13,
|
||||
SamuraiRank2 = 14,
|
||||
SamuraiRank3 = 15,
|
||||
SorcererRank1 = 16,
|
||||
SorcererRank2 = 17,
|
||||
SorcererRank3 = 18,
|
||||
SpaceMarauderRank1 = 19,
|
||||
SpaceMarauderRank2 = 20,
|
||||
SpaceMarauderRank3 = 21,
|
||||
ShinobiRank1 = 22,
|
||||
ShinobiRank2 = 23,
|
||||
ShinobiRank3 = 24,
|
||||
InventorRank1 = 25,
|
||||
InventorRank2 = 26,
|
||||
InventorRank3 = 27,
|
||||
SummonerRank1 = 28,
|
||||
SummonerRank2 = 29,
|
||||
SummonerRank3 = 30,
|
||||
AdventurerRank1 = 31,
|
||||
AdventurerRank2 = 32,
|
||||
AdventurerRank3 = 33,
|
||||
DaredevilRank1 = 34,
|
||||
DaredevilRank2 = 35,
|
||||
DaredevilRank3 = 36,
|
||||
BuccaneerRank1 = 37,
|
||||
BuccaneerRank2 = 38,
|
||||
BuccaneerRank3 = 39,
|
||||
BoneSuit = 40,
|
||||
ImaginationSpinjitzu = 41,
|
||||
BatLord = 42,
|
||||
MosaicJester = 43,
|
||||
ExplorienBot = 44,
|
||||
Unnamed1 = 45,
|
||||
Unnamed2 = 46,
|
||||
Unnamed3 = 47,
|
||||
EarthSpinjitzu = 48,
|
||||
Unnamed4 = 49,
|
||||
FireSpinjitzu = 50,
|
||||
IceSpinjitzu = 51,
|
||||
LightningSpinjitzu = 52
|
||||
};
|
||||
|
Reference in New Issue
Block a user