mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-19 22:08:08 +00:00
Grim LU
Wincent's attempt at making LU into something it isn't supposed to be, an ARPG.
This commit is contained in:
@@ -41,6 +41,7 @@ Item::Item(const LWOOBJID id, const LOT lot, Inventory* inventory, const uint32_
|
||||
this->info = &Inventory::FindItemComponent(lot);
|
||||
this->preconditions = new PreconditionExpression(this->info->reqPrecondition);
|
||||
this->subKey = subKey;
|
||||
this->stats = {};
|
||||
|
||||
inventory->AddManagedItem(this);
|
||||
}
|
||||
@@ -76,6 +77,7 @@ Item::Item(
|
||||
this->bound = info->isBOP || bound;
|
||||
this->preconditions = new PreconditionExpression(this->info->reqPrecondition);
|
||||
this->subKey = subKey;
|
||||
this->stats = {};
|
||||
|
||||
LWOOBJID id = ObjectIDManager::GenerateRandomObjectID();
|
||||
|
||||
@@ -102,6 +104,21 @@ Item::Item(
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(inventory->GetComponent()->GetParent());
|
||||
}
|
||||
|
||||
if (parent != LWOOBJID_EMPTY) return;
|
||||
|
||||
eItemType itemType = static_cast<eItemType>(info->itemType);
|
||||
|
||||
if (info->stackSize != 1) return;
|
||||
|
||||
if (itemType != eItemType::RIGHT_HAND &&
|
||||
itemType != eItemType::LEFT_HAND &&
|
||||
itemType != eItemType::HAT &&
|
||||
itemType != eItemType::CHEST &&
|
||||
itemType != eItemType::LEGS &&
|
||||
itemType != eItemType::NECK) return;
|
||||
|
||||
ItemModifierTemplate::RollItemModifierTemplates(this, lootSourceType);
|
||||
}
|
||||
|
||||
LWOOBJID Item::GetId() const {
|
||||
@@ -124,6 +141,14 @@ std::vector<LDFBaseData*>& Item::GetConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
std::vector<StatProperty>& Item::GetStats() {
|
||||
return stats;
|
||||
}
|
||||
|
||||
std::vector<ItemModifierTemplate*>& Item::GetModifiers() {
|
||||
return templates;
|
||||
}
|
||||
|
||||
const CDItemComponent& Item::GetInfo() const {
|
||||
return *info;
|
||||
}
|
||||
@@ -220,6 +245,37 @@ void Item::Equip(const bool skipChecks) {
|
||||
}
|
||||
|
||||
inventory->GetComponent()->EquipItem(this, skipChecks);
|
||||
|
||||
if (info->equipLocation != "special_r") return;
|
||||
|
||||
inventory->GetComponent()->GetParent()->AddCallbackTimer(1, [this]() {
|
||||
// Find the greatest stat for this item
|
||||
eStatTypes statType = eStatTypes::Physical;
|
||||
float statValue = 0.0f;
|
||||
|
||||
for (const auto& stat : stats) {
|
||||
if (stat.value > statValue) {
|
||||
statType = stat.type;
|
||||
statValue = stat.value;
|
||||
}
|
||||
}
|
||||
|
||||
switch (statType)
|
||||
{
|
||||
case eStatTypes::Electric:
|
||||
GameMessages::SendPlayFXEffect(id, 4027, u"create", "electric");
|
||||
break;
|
||||
case eStatTypes::Shadow:
|
||||
GameMessages::SendPlayFXEffect(id, 2710, u"create", "shadow");
|
||||
break;
|
||||
case eStatTypes::Corruption:
|
||||
GameMessages::SendPlayFXEffect(id, 663, u"create", "corruption");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Item::UnEquip() {
|
||||
|
@@ -8,6 +8,8 @@
|
||||
#include "Preconditions.h"
|
||||
#include "eInventoryType.h"
|
||||
#include "eLootSourceType.h"
|
||||
#include "StatProperty.h"
|
||||
#include "ItemModifierTemplate.h"
|
||||
|
||||
/**
|
||||
* An item that can be stored in an inventory and optionally consumed or equipped
|
||||
@@ -116,6 +118,18 @@ public:
|
||||
*/
|
||||
std::vector<LDFBaseData*>& GetConfig();
|
||||
|
||||
/**
|
||||
* Returns the stats for this item
|
||||
* @return the stats for this item
|
||||
*/
|
||||
std::vector<StatProperty>& GetStats();
|
||||
|
||||
/**
|
||||
* Returns the modifiers for this item
|
||||
* @return the modifiers for this item
|
||||
*/
|
||||
std::vector<ItemModifierTemplate*>& GetModifiers();
|
||||
|
||||
/**
|
||||
* Returns the database info for this item
|
||||
* @return the database info for this item
|
||||
@@ -255,6 +269,16 @@ private:
|
||||
*/
|
||||
std::vector<LDFBaseData*> config;
|
||||
|
||||
/**
|
||||
* Modifiers
|
||||
*/
|
||||
std::vector<StatProperty> stats;
|
||||
|
||||
/**
|
||||
* Templates
|
||||
*/
|
||||
std::vector<ItemModifierTemplate*> templates;
|
||||
|
||||
/**
|
||||
* The inventory this item belongs to
|
||||
*/
|
||||
|
Reference in New Issue
Block a user