From 8dfa0a72200e822da0eb091c0ccce3748c958635 Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 27 Feb 2015 19:28:28 -0500 Subject: [PATCH] Final tweak for light sources --- common/item.cpp | 11 ++--------- common/item.h | 11 ++++++----- zone/corpse.cpp | 11 ++--------- zone/merc.cpp | 11 ++--------- zone/npc.cpp | 11 ++--------- 5 files changed, 14 insertions(+), 41 deletions(-) diff --git a/common/item.cpp b/common/item.cpp index aca10b258..3e8be66ca 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1019,15 +1019,8 @@ uint8 Inventory::FindBrightestLightType() auto item = inst->GetItem(); if (item == nullptr) { continue; } - switch (item->Light) { - case lightTypeCandle: - case lightTypeTorch: - case lightTypeSmallLantern: - case lightTypeLargeLantern: - continue; - default: - break; - } + if (item->ItemClass != ItemClassCommon) { continue; } + if (item->Light < 9 || item->Light > 13) { continue; } if (LightProfile_Struct::TypeToLevel(item->Light)) general_light_type = item->Light; diff --git a/common/item.h b/common/item.h index 5a60292c0..a5dd01f95 100644 --- a/common/item.h +++ b/common/item.h @@ -477,17 +477,18 @@ struct LightProfile_Struct /* Current criteria (light types): Equipment: { 0 .. 15 } - General: { 0 .. 15 } =/= { 1, 2, 4, 6 } + General: { 9 .. 13 } Notes: + - Initial character load and item movement updates use different light source update behaviors + -- Server procedure matches the item movement behavior since most updates occur post-character load - 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 + - Light types '< 9' and '> 13' are not considered for general (carried) light sources - 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 - - "Fire Beetle Eyes" are still causing issues in general slots (no item movement sound effect) - - Wearable equipment types still register as valid light sources when in general slots (needs exemption criteria) + - All clients have a bug regarding stackable items (light and sound updates are not processed when picking up an item) + -- The timer-based update cancels out the invalid light source */ static uint8 TypeToLevel(uint8 lightType); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index c213368f0..755fd3957 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1441,15 +1441,8 @@ void Corpse::UpdateEquipmentLight() auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } - switch (item->Light) { - case lightTypeCandle: - case lightTypeTorch: - case lightTypeSmallLantern: - case lightTypeLargeLantern: - continue; - default: - break; - } + if (item->ItemClass != ItemClassCommon) { continue; } + if (item->Light < 9 || item->Light > 13) { continue; } if (m_Light.TypeToLevel(item->Light)) general_light_type = item->Light; diff --git a/zone/merc.cpp b/zone/merc.cpp index 99621a145..4609487cf 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -5054,15 +5054,8 @@ void Merc::UpdateEquipmentLight() auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } - switch (item->Light) { - case lightTypeCandle: - case lightTypeTorch: - case lightTypeSmallLantern: - case lightTypeLargeLantern: - continue; - default: - break; - } + if (item->ItemClass != ItemClassCommon) { continue; } + if (item->Light < 9 || item->Light > 13) { continue; } if (m_Light.TypeToLevel(item->Light)) general_light_type = item->Light; diff --git a/zone/npc.cpp b/zone/npc.cpp index 511d4fb98..a9a383d55 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -737,15 +737,8 @@ void NPC::UpdateEquipmentLight() auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } - switch (item->Light) { - case lightTypeCandle: - case lightTypeTorch: - case lightTypeSmallLantern: - case lightTypeLargeLantern: - continue; - default: - break; - } + if (item->ItemClass != ItemClassCommon) { continue; } + if (item->Light < 9 || item->Light > 13) { continue; } if (m_Light.TypeToLevel(item->Light)) general_light_type = item->Light;