diff --git a/changelog.txt b/changelog.txt index dd3d32e13..8fbdecd1f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 02/26/2015 == Uleat: Updated light source criteria to (hopefully) match what the client uses (still needs tweaking) +Uleat: Changed 'general' light source checks to accept the last valid light source (client behavior) +Notes: + - "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) == 02/23/2015 == Uleat: Fix for RoF+ clients showing active 'Return Home' button when action is not available (swapped 'GoHome' and 'Enabled' fields in RoF-era CharacterSelectEntry structs) diff --git a/common/item.cpp b/common/item.cpp index e3b7102b1..aca10b258 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1010,6 +1010,7 @@ uint8 Inventory::FindBrightestLightType() brightest_light_type = item->Light; } + uint8 general_light_type = 0; for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) { if (iter->first < EmuConstants::GENERAL_BEGIN || iter->first > EmuConstants::GENERAL_END) { continue; } @@ -1028,10 +1029,13 @@ uint8 Inventory::FindBrightestLightType() break; } - if (LightProfile_Struct::IsLevelGreater(item->Light, brightest_light_type)) - brightest_light_type = item->Light; + if (LightProfile_Struct::TypeToLevel(item->Light)) + general_light_type = item->Light; } + if (LightProfile_Struct::IsLevelGreater(general_light_type, brightest_light_type)) + brightest_light_type = general_light_type; + return brightest_light_type; } diff --git a/common/item.h b/common/item.h index 1fc2f9a72..5a60292c0 100644 --- a/common/item.h +++ b/common/item.h @@ -486,6 +486,8 @@ struct LightProfile_Struct - 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 + - "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) */ static uint8 TypeToLevel(uint8 lightType); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 53e94da5e..c213368f0 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1430,12 +1430,11 @@ void Corpse::UpdateEquipmentLight() auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } - if (m_Light.IsLevelGreater(item->Light, m_Light.Type.Equipment)) { + if (m_Light.IsLevelGreater(item->Light, m_Light.Type.Equipment)) m_Light.Type.Equipment = item->Light; - m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment); - } } + uint8 general_light_type = 0; for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) { if ((*iter)->equip_slot < EmuConstants::GENERAL_BEGIN || (*iter)->equip_slot > EmuConstants::GENERAL_END) { continue; } @@ -1452,11 +1451,14 @@ void Corpse::UpdateEquipmentLight() break; } - if (m_Light.IsLevelGreater(item->Light, m_Light.Type.Equipment)) { - m_Light.Type.Equipment = item->Light; - m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment); - } + if (m_Light.TypeToLevel(item->Light)) + general_light_type = item->Light; } + + if (m_Light.IsLevelGreater(general_light_type, m_Light.Type.Equipment)) + m_Light.Type.Equipment = general_light_type; + + m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment); } void Corpse::AddLooter(Mob* who) { diff --git a/zone/merc.cpp b/zone/merc.cpp index 9172f5f0c..99621a145 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -5049,6 +5049,7 @@ void Merc::UpdateEquipmentLight() } } + uint8 general_light_type = 0; for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) { auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } @@ -5063,11 +5064,14 @@ void Merc::UpdateEquipmentLight() break; } - if (m_Light.IsLevelGreater(item->Light, m_Light.Type.Equipment)) { - m_Light.Type.Equipment = item->Light; - m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment); - } + if (m_Light.TypeToLevel(item->Light)) + general_light_type = item->Light; } + + if (m_Light.IsLevelGreater(general_light_type, m_Light.Type.Equipment)) + m_Light.Type.Equipment = general_light_type; + + m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment); } void Merc::AddItem(uint8 slot, uint32 item_id) { diff --git a/zone/npc.cpp b/zone/npc.cpp index 42022f73e..511d4fb98 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -732,6 +732,7 @@ void NPC::UpdateEquipmentLight() } } + uint8 general_light_type = 0; for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) { auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } @@ -746,11 +747,14 @@ void NPC::UpdateEquipmentLight() break; } - if (m_Light.IsLevelGreater(item->Light, m_Light.Type.Equipment)) { - m_Light.Type.Equipment = item->Light; - m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment); - } + if (m_Light.TypeToLevel(item->Light)) + general_light_type = item->Light; } + + if (m_Light.IsLevelGreater(general_light_type, m_Light.Type.Equipment)) + m_Light.Type.Equipment = general_light_type; + + m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment); } void NPC::Depop(bool StartSpawnTimer) {