Change for 'general' slot range light source behavior

This commit is contained in:
Uleat 2015-02-26 21:05:06 -05:00
parent 1f0b86a0d5
commit e15ee6e320
6 changed files with 37 additions and 17 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
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) {

View File

@ -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;
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) {

View File

@ -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;
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) {