mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-30 13:47:57 +00:00
Changes to how valid light sources are critiqued
This commit is contained in:
@@ -21,6 +21,53 @@
|
||||
#include "skills.h"
|
||||
#include "types.h"
|
||||
|
||||
/*
|
||||
** Light Types
|
||||
**
|
||||
*/
|
||||
enum LightTypes
|
||||
{
|
||||
lightTypeNone = 0,
|
||||
lightTypeCandle,
|
||||
lightTypeTorch,
|
||||
lightTypeTinyGlowingSkull,
|
||||
lightTypeSmallLantern,
|
||||
lightTypeSteinOfMoggok,
|
||||
lightTypeLargeLantern,
|
||||
lightTypeFlamelessLantern,
|
||||
lightTypeGlobeOfStars,
|
||||
lightTypeLightGlobe,
|
||||
lightTypeLightstone,
|
||||
lightTypeGreaterLightstone,
|
||||
lightTypeFireBeetleEye,
|
||||
lightTypeColdlight,
|
||||
lightTypeUnknown1,
|
||||
lightTypeUnknown2
|
||||
};
|
||||
|
||||
#define LIGHT_TYPES_COUNT 16
|
||||
|
||||
/*
|
||||
** Light Levels
|
||||
**
|
||||
*/
|
||||
enum LightLevels
|
||||
{
|
||||
lightLevelUnlit = 0,
|
||||
lightLevelCandle,
|
||||
lightLevelTorch,
|
||||
lightLevelSmallMagic,
|
||||
lightLevelRedLight,
|
||||
lightLevelBlueLight,
|
||||
lightLevelSmallLantern,
|
||||
lightLevelMagicLantern,
|
||||
lightLevelLargeLantern,
|
||||
lightLevelLargeMagic,
|
||||
lightLevelBrilliant
|
||||
};
|
||||
|
||||
#define LIGHT_LEVELS_COUNT 11
|
||||
|
||||
/*
|
||||
** Item attributes
|
||||
**
|
||||
|
||||
+85
-10
@@ -993,34 +993,46 @@ int Inventory::GetSlotByItemInst(ItemInst *inst) {
|
||||
return INVALID_INDEX;
|
||||
}
|
||||
|
||||
uint8 Inventory::FindHighestLightValue()
|
||||
uint8 Inventory::FindBrightestLightType()
|
||||
{
|
||||
uint8 light_value = NOT_USED;
|
||||
uint8 brightest_light_type = 0;
|
||||
|
||||
// NOTE: The client does not recognize augment light sources, applied or otherwise, and should not be parsed
|
||||
for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) {
|
||||
if ((iter->first < EmuConstants::EQUIPMENT_BEGIN || iter->first > EmuConstants::EQUIPMENT_END) && iter->first != MainPowerSource) { continue; }
|
||||
if (iter->first == MainAmmo) { continue; }
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr) { continue; }
|
||||
if (item->Light & 0xF0) { continue; }
|
||||
if (item->Light > light_value) { light_value = item->Light; }
|
||||
|
||||
if (LightProfile_Struct::IsLevelGreater(item->Light, brightest_light_type))
|
||||
brightest_light_type = item->Light;
|
||||
}
|
||||
|
||||
for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) {
|
||||
if (iter->first < EmuConstants::GENERAL_BEGIN || iter->first > EmuConstants::GENERAL_END) { continue; }
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr) { continue; }
|
||||
// 'Gloomingdeep lantern' is ItemTypeArmor in the database..there may be others instances and/or types that need to be handled
|
||||
if (item->ItemType != ItemTypeMisc && item->ItemType != ItemTypeLight && item->ItemType != ItemTypeArmor) { continue; }
|
||||
if (item->Light & 0xF0) { continue; }
|
||||
if (item->Light > light_value) { light_value = item->Light; }
|
||||
|
||||
switch (item->Light) {
|
||||
case lightTypeCandle:
|
||||
case lightTypeTorch:
|
||||
case lightTypeSmallLantern:
|
||||
case lightTypeLargeLantern:
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (LightProfile_Struct::IsLevelGreater(item->Light, brightest_light_type))
|
||||
brightest_light_type = item->Light;
|
||||
}
|
||||
|
||||
return light_value;
|
||||
return brightest_light_type;
|
||||
}
|
||||
|
||||
void Inventory::dumpEntireInventory() {
|
||||
@@ -2361,3 +2373,66 @@ bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const
|
||||
|
||||
return (IsRace && IsClass);
|
||||
}
|
||||
|
||||
//
|
||||
// struct LightProfile_Struct
|
||||
//
|
||||
uint8 LightProfile_Struct::TypeToLevel(uint8 lightType)
|
||||
{
|
||||
switch (lightType) {
|
||||
case lightTypeGlobeOfStars:
|
||||
return lightLevelBrilliant; // 10
|
||||
case lightTypeFlamelessLantern:
|
||||
case lightTypeGreaterLightstone:
|
||||
return lightLevelLargeMagic; // 9
|
||||
case lightTypeLargeLantern:
|
||||
return lightLevelLargeLantern; // 8
|
||||
case lightTypeSteinOfMoggok:
|
||||
case lightTypeLightstone:
|
||||
return lightLevelMagicLantern; // 7
|
||||
case lightTypeSmallLantern:
|
||||
return lightLevelSmallLantern; // 6
|
||||
case lightTypeColdlight:
|
||||
case lightTypeUnknown2:
|
||||
return lightLevelBlueLight; // 5
|
||||
case lightTypeFireBeetleEye:
|
||||
case lightTypeUnknown1:
|
||||
return lightLevelRedLight; // 4
|
||||
case lightTypeTinyGlowingSkull:
|
||||
case lightTypeLightGlobe:
|
||||
return lightLevelSmallMagic; // 3
|
||||
case lightTypeTorch:
|
||||
return lightLevelTorch; // 2
|
||||
case lightLevelCandle:
|
||||
return lightLevelCandle; // 1
|
||||
default:
|
||||
return lightLevelUnlit; // 0
|
||||
}
|
||||
}
|
||||
|
||||
bool LightProfile_Struct::IsLevelGreater(uint8 leftType, uint8 rightType)
|
||||
{
|
||||
static const uint8 light_levels[LIGHT_TYPES_COUNT] = {
|
||||
lightLevelUnlit, /* lightTypeNone */
|
||||
lightLevelCandle, /* lightTypeCandle */
|
||||
lightLevelTorch, /* lightTypeTorch */
|
||||
lightLevelSmallMagic, /* lightTypeTinyGlowingSkull */
|
||||
lightLevelSmallLantern, /* lightTypeSmallLantern */
|
||||
lightLevelMagicLantern, /* lightTypeSteinOfMoggok */
|
||||
lightLevelLargeLantern, /* lightTypeLargeLantern */
|
||||
lightLevelLargeMagic, /* lightTypeFlamelessLantern */
|
||||
lightLevelBrilliant, /* lightTypeGlobeOfStars */
|
||||
lightLevelSmallMagic, /* lightTypeLightGlobe */
|
||||
lightLevelMagicLantern, /* lightTypeLightstone */
|
||||
lightLevelLargeMagic, /* lightTypeGreaterLightstone */
|
||||
lightLevelRedLight, /* lightTypeFireBeetleEye */
|
||||
lightLevelBlueLight, /* lightTypeColdlight */
|
||||
lightLevelRedLight, /* lightTypeUnknown1 */
|
||||
lightLevelBlueLight /* lightTypeUnknown2 */
|
||||
};
|
||||
|
||||
if (leftType >= LIGHT_TYPES_COUNT) { leftType = lightTypeNone; }
|
||||
if (rightType >= LIGHT_TYPES_COUNT) { rightType = lightTypeNone; }
|
||||
|
||||
return (light_levels[leftType] > light_levels[rightType]);
|
||||
}
|
||||
|
||||
+37
-1
@@ -204,7 +204,7 @@ public:
|
||||
|
||||
int GetSlotByItemInst(ItemInst *inst);
|
||||
|
||||
uint8 FindHighestLightValue();
|
||||
uint8 FindBrightestLightType();
|
||||
|
||||
void dumpEntireInventory();
|
||||
void dumpWornItems();
|
||||
@@ -472,4 +472,40 @@ public:
|
||||
~EvolveInfo();
|
||||
};
|
||||
|
||||
struct LightProfile_Struct
|
||||
{
|
||||
/*
|
||||
Current criteria (light types):
|
||||
Equipment: { 0 .. 15 }
|
||||
General: { 0 .. 15 } =/= { 1, 2, 4, 6 }
|
||||
|
||||
Notes:
|
||||
- MainAmmo is not considered when determining light sources
|
||||
- No 'Sub' or 'Aug' items are recognized as light sources
|
||||
- Extinguishable light types { Candle, Torch, SmallLantern, LargeLantern } are not considered for general (carried) light sources
|
||||
- Client calls '__debugbreak' for type values > 127
|
||||
- If values > 0x0F are valid, then assignment limiters will need to be removed
|
||||
- MainCursor 'appears' to be a valid light source update slot..but, have not experienced updates during debug sessions
|
||||
*/
|
||||
|
||||
static uint8 TypeToLevel(uint8 lightType);
|
||||
static bool IsLevelGreater(uint8 leftType, uint8 rightType);
|
||||
|
||||
// Light types (classifications)
|
||||
struct {
|
||||
uint8 Innate; // Defined by db field `npc_types`.`light` - where appropriate
|
||||
uint8 Equipment; // Item_Struct::light value of worn/carried equipment
|
||||
uint8 Spell; // Set value of any light-producing spell (can be modded to mimic equip_light behavior)
|
||||
uint8 Active; // Highest value of all light sources
|
||||
} Type;
|
||||
|
||||
// Light levels (intensities) - used to determine which light source should be active
|
||||
struct {
|
||||
uint8 Innate;
|
||||
uint8 Equipment;
|
||||
uint8 Spell;
|
||||
uint8 Active;
|
||||
} Level;
|
||||
};
|
||||
|
||||
#endif // #define __ITEM_H
|
||||
|
||||
Reference in New Issue
Block a user