public override bool HandleException(ref CONTEXT ctx, ProcessDebugger pd) { // Esi - pUnit var hide = false; var pUnit = ctx.Esi; if (pUnit == 0) { hide = true; } else if (Game.Settings.Infravision.HideCorpses.IsEnabled() || Game.Settings.Infravision.HideDying.IsEnabled() || Game.Settings.Infravision.HideItems.IsEnabled()) { var unit = pd.Read <UnitAny>(pUnit); switch ((UnitType)unit.dwType) { case UnitType.Monster: { if (Game.Settings.Infravision.HideCorpses.IsEnabled() && unit.dwMode == (uint)NpcMode.Dead || Game.Settings.Infravision.HideDying.IsEnabled() && unit.dwMode == (uint)NpcMode.Death) { hide = true; } break; } case UnitType.Item: { if (!Game.Settings.Infravision.HideItems.IsEnabled()) { break; } var itemInfo = ItemStorage.GetInfo(unit.dwTxtFileNo); if (itemInfo != null) { var itemData = pd.Read <ItemData>(unit.pItemData); var pTxt = Game.GetItemText(unit.dwTxtFileNo); var txt = pd.Read <ItemTxt>(pTxt); var sock = Game.GetItemSockets(pUnit, unit.dwUnitId); var configEntries = Game.ItemProcessingSettings.GetMatches(itemInfo, sock, (itemData.dwFlags & 0x400000) != 0, (ItemQuality)itemData.dwQuality).Where(it => it.Hide); if (configEntries.Count() != 0) { hide = true; } } break; } } } ctx.Eax = hide ? 1u : 0u; ctx.Eip += 0x77; return(true); }
public override bool HandleException(ref CONTEXT ctx, ProcessDebugger pd) { ctx.Al = pd.ReadByte(ctx.Ebp + 0x12A); ctx.Eip += 6; var pString = ctx.Edi; var pItem = ctx.Ebx; var str = pd.ReadUTF16String(pString); //"ÿc"; //str = "ÿc1" + str; var item = pd.Read <UnitAny>(pItem); var itemData = pd.Read <ItemData>(item.pItemData); var changed = false; var appendix = ""; if (Game.Settings.ItemNameHack.ShowItemCode.IsEnabled()) { var pTxt = Game.GetItemText(item.dwTxtFileNo); var txt = pd.Read <ItemTxt>(pTxt); appendix += "(" + txt.GetCode() + ")"; } if (Game.Settings.ItemNameHack.ShowEth.IsEnabled() && (itemData.dwFlags & 0x400000) != 0) { appendix += "{E}"; } var runeNumber = item.RuneNumber(); if (runeNumber > 0 && Game.Settings.ItemNameHack.ShowRuneNumber.IsEnabled()) { appendix += "(" + runeNumber + ")"; } if (Game.Settings.ItemNameHack.ShowSockets.IsEnabled()) { var cnt = Game.GetItemSockets(pItem, item.dwUnitId); if (cnt > 0 && cnt != uint.MaxValue) { appendix += "(" + cnt + ")"; } } if (Game.Settings.ItemNameHack.ShowItemLevel.IsEnabled() && itemData.dwItemLevel > 1) { appendix += "(L" + itemData.dwItemLevel + ")"; } if (Game.Settings.ItemNameHack.ShowItemPrice.IsEnabled()) { var price = Game.GetItemPrice(pItem, item.dwUnitId); if (price > 0 && price != uint.MaxValue) { appendix += "($" + price + ")"; } } if (Game.Settings.ItemNameHack.ChangeItemColor.IsEnabled()) { var itemInfo = ItemStorage.GetInfo(item.dwTxtFileNo); if (itemInfo != null) { var sock = Game.GetItemSockets(pItem, item.dwUnitId); var configEntries = Game.ItemProcessingSettings.GetMatches(itemInfo, sock, (itemData.dwFlags & 0x400000) != 0, (ItemQuality)itemData.dwQuality).Where(it => it.Color != D2Color.Default); if (configEntries.Count() != 0) { var entry = configEntries.First(); str = "ÿc" + entry.Color.GetCode() + str; changed = true; } } } if (appendix != "") { str += " " + appendix; changed = true; } if (changed) { pd.WriteUTF16String(pString, str); } return(true); }