/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { StringBuilder str = new StringBuilder(); foreach (PacketLog log in context.LogManager.Logs) { str.AppendFormat("StreamName:{0}\n", log.StreamName); str.AppendFormat("PacketCounts:{0}\n", log.Count); } str.AppendFormat("PacketLocation(LogIndex:{0} PacketIndex:{1} GetHashCode:{2})\n", selectedPacket.LogIndex, selectedPacket.PacketIndex, selectedPacket.GetHashCode()); Packet pak = context.LogManager.GetPacket(selectedPacket); str.AppendFormat("ver:{0} code:0x{1:X2} dir:{2} prot:{3}", (pak.Attribute == null ? "unk" : pak.Attribute.Version.ToString()), pak.Code, pak.Direction, pak.Protocol); str.Append('\n'); InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show Context info (right click to close)"; infoWindow.Width = 640; infoWindow.Height = 300; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { int currentRegion; int currentZone; PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); SortedList oidInfo = MakeOidList(selectedPacket.PacketIndex, log, out currentRegion, out currentZone); StringBuilder str = new StringBuilder(); str.AppendFormat("Info for region {0}, zone {1}\n\n", currentRegion, currentZone); foreach (DictionaryEntry entry in oidInfo) { ushort oid = (ushort)entry.Key; ObjectInfo objectInfo = (ObjectInfo)entry.Value; str.AppendFormat("0x{0:X4}: {1}\n", oid, objectInfo.ToString()); } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show known Oids (right click to close)"; infoWindow.Width = 550; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; Packet originalPak = log[selectedIndex]; bool found = false; Packet pak = originalPak; for (int i = selectedIndex - 1; i > 0; --i) { pak = log[i]; found = IsValidPacket(originalPak, pak); if (found) break; } if (!found) return false; StringBuilder str = new StringBuilder(); str.Append(pak.ToHumanReadableString(pak.Time, true)); str.Append('\n'); str.Append('\n'); str.Append("Raw data, can be copy/pasted to CustomPacket.cs script to send directly to the client.\n"); string header = string.Format("ver:{0} code:0x{1:X2} dir:{2} prot:{3}", (pak.Attribute == null ? "unk" : pak.Attribute.Version.ToString()), pak.Code, pak.Direction, pak.Protocol); str.Append(header).Append('\n'); pak.Position = 0; while (pak.Position < pak.Length) { if (((int)pak.Position & 0x0F) == 0) str.Append('\n'); str.Append(pak.ReadByte().ToString("X2")).Append(' '); } str.Append("\n\n\n"); str.Append("Another copy with first byte indexes (dec), Len:").Append(pak.Length.ToString("D")); ArrayList bytes = new ArrayList(); pak.Position = 0; while (pak.Position < pak.Length) { if (((int)pak.Position & 0x0F) == 0) { AppendChars(bytes, str); str.AppendFormat("\n{0:D4}: ", pak.Position); } byte pakByte = pak.ReadByte(); str.Append(pakByte.ToString("X2")).Append(' '); bytes.Add(pakByte); } AppendChars(bytes, str); InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Packet raw data " + header + " (right click to close)"; infoWindow.Width = 640; infoWindow.Height = 300; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; Packet[] quests = new Packet[26]; for (int i = 0; i < selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x83_QuestUpdate_186) { if ((pak as StoC_0x83_QuestUpdate_186).InNewQuestUpdate != null) { quests[((pak as StoC_0x83_QuestUpdate_186).InNewQuestUpdate).index] = pak; } else if ((pak as StoC_0x83_QuestUpdate).InQuestUpdate != null) { int index = ((pak as StoC_0x83_QuestUpdate).InQuestUpdate).index; if (((pak as StoC_0x83_QuestUpdate).InQuestUpdate).lenName == 0 && ((pak as StoC_0x83_QuestUpdate).InQuestUpdate).lenDesc == 0) { quests[index] = null; } else quests[index] = pak; } } else if (pak is StoC_0x83_QuestUpdate) { int index = ((pak as StoC_0x83_QuestUpdate).InQuestUpdate).index; if (((pak as StoC_0x83_QuestUpdate).InQuestUpdate).lenName == 0 && ((pak as StoC_0x83_QuestUpdate).InQuestUpdate).lenDesc == 0) { quests[index] = null; } else quests[index] = pak; } } StringBuilder str = new StringBuilder(); for (int i = 0; i < quests.Length; i++) { Packet pak = quests[i]; if (pak != null) { str.Append(pak.GetPacketDataString(true)); str.Append('\n'); } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player quest info (right click to close)"; infoWindow.Width = 820; infoWindow.Height = 320; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { Packet pak = context.LogManager.GetPacket(selectedPacket); StringBuilder str = new StringBuilder(); str.Append("Raw data, can be copy/pasted to CustomPacket.cs script to send directly to the client.\n"); string header = string.Format("ver:{0} code:0x{1:X2} dir:{2} prot:{3}", (pak.Attribute == null ? "unk" : pak.Attribute.Version.ToString()), pak.Code, pak.Direction, pak.Protocol); str.Append(header).Append('\n'); pak.Position = 0; while (pak.Position < pak.Length) { if (((int)pak.Position & 0x0F) == 0) { str.Append('\n'); } str.Append(pak.ReadByte().ToString("X2")).Append(' '); } str.Append("\n\n\n"); str.Append("Another copy with first byte indexes (dec), Len:").Append(pak.Length.ToString("D")); ArrayList bytes = new ArrayList(); pak.Position = 0; while (pak.Position < pak.Length) { if (((int)pak.Position & 0x0F) == 0) { AppendChars(bytes, str); str.AppendFormat("\n{0:D4}: ", pak.Position); } byte pakByte = pak.ReadByte(); str.Append(pakByte.ToString("X2")).Append(' '); bytes.Add(pakByte); } AppendChars(bytes, str); InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Packet raw data " + header + " (right click to close)"; infoWindow.Width = 640; infoWindow.Height = 300; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; ushort sessionId = 0; ushort[] objectIds = null; ushort[] keepIds = null; ushort houseId = 0; Packet pak = log[selectedIndex]; if (pak is IObjectIdPacket) objectIds = (pak as IObjectIdPacket).ObjectIds; if (pak is ISessionIdPacket) sessionId = (pak as ISessionIdPacket).SessionId; if (pak is IHouseIdPacket) houseId = (pak as IHouseIdPacket).HouseId; if (pak is IKeepIdPacket) keepIds = (pak as IKeepIdPacket).KeepIds; StringBuilder str = new StringBuilder(); if (sessionId == 0 && houseId == 0 && (objectIds == null || objectIds.Length == 0) && (keepIds == null || keepIds.Length == 0)) str.AppendFormat("packet not have any ID\n"); if (sessionId > 0) str.Append(MakeSidInfo(log, selectedIndex, sessionId)); if (houseId > 0) str.Append(MakeHidInfo(log, selectedIndex, houseId)); if (objectIds != null && objectIds.Length > 0) { for (int i = 0; i < objectIds.Length; i++) if (objectIds[i] > 0) str.Append(MakeOidInfo(log, selectedIndex, objectIds[i], 0, 0)); } if (keepIds != null && keepIds.Length > 0) { for (int i = 0; i < keepIds.Length; i++) if (keepIds[i] > 0) str.Append(MakeOidInfo(log, selectedIndex, 0xFFFF, 0, keepIds[i])); // str.Append(MakeKidInfo(log, selectedIndex, keepIds[i])); } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show info about Objects (right click to close)"; infoWindow.Width = 620; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; Packet originalPak = log[selectedIndex]; ushort[] objectIds = null; if (originalPak is IObjectIdPacket) { objectIds = (originalPak as IObjectIdPacket).ObjectIds; } StringBuilder str = new StringBuilder(); if ((objectIds == null || objectIds.Length == 0)) { str.AppendFormat("packet not have any ID\n"); return(false); } TimeSpan zeroTimeSpan = new TimeSpan(0); for (int i = 0; i < log.Count; i++) { Packet pak = log[i]; if (pak.Code == originalPak.Code && pak.Direction == originalPak.Direction && pak.Protocol == originalPak.Protocol) { if (pak is IObjectIdPacket && pak.Length > 0 && (pak as IObjectIdPacket).ObjectIds[0] == objectIds[0]) { str.Append(pak.ToHumanReadableString(zeroTimeSpan, true)); str.Append('\n'); } } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show object same packets (right click to close)"; infoWindow.Width = 620; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); Hashtable plrInfo = MakeCombatList(selectedPacket.PacketIndex, log); StringBuilder str = new StringBuilder(); foreach (DictionaryEntry entry in plrInfo) { PlayerInfo plr = (PlayerInfo)entry.Value; if (plr != null) { // str.AppendFormat("key = {0}\n", entry.Key); int playerAttacks = plr.hit + plr.miss + plr.fumble + plr.failAttacks; int playerAttacked = plr.block + plr.evade + plr.parry + plr.attacked; if ((playerAttacks + playerAttacked) > 0) { str.AppendFormat("Level:{0} Name:{1} Class:{2} WS:{3} WeaponDamage:{4}\n", plr.level, plr.name, plr.className, plr.weaponSkill, plr.weaponDamage); str.AppendFormat("player->target\tHits:{0} ({8:0.00}%)\t Miss:{1} ({9:0.00}%)\t Fumble:{2} ({10:0.00}%)\t FailAttacks:{3} ({11:0.00}%)\ntarget->player\tParry:{4} ({12:0.00}%)\t Block:{5} ({13:0.00}%)\t Evade:{6} ({14:0.00}%)\t attacked:{7} ({15:0.00}%)\n\n", plr.hit, plr.miss, plr.fumble, plr.failAttacks, plr.parry, plr.block, plr.evade, plr.attacked, (plr.hit + plr.miss) > 0 ? 100.0 * plr.hit / (plr.hit + plr.miss) : 0, (plr.hit + plr.miss) > 0 ? 100.0 * plr.miss / (plr.hit + plr.miss): 0, playerAttacks > 0 ? 100.0 * plr.fumble / playerAttacks : 0, playerAttacks > 0 ? 100.0 * plr.failAttacks / playerAttacks : 0, (playerAttacked - plr.evade) > 0 ? 100.0 * plr.parry / (playerAttacked - plr.evade) : 0, (playerAttacked - plr.parry - plr.evade) > 0 ? 100.0 * plr.block / (playerAttacked - plr.parry - plr.evade): 0, playerAttacked > 0 ? 100.0 * plr.evade / playerAttacked: 0, playerAttacked > 0 ? 100.0 * plr.attacked / playerAttacked: 0); } } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show weapon use statistics (right click to close)"; infoWindow.Width = 550; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { StringBuilder str = new StringBuilder(); foreach(PacketLog log in context.LogManager.Logs) { str.AppendFormat("StreamName:{0}\n", log.StreamName); str.AppendFormat("PacketCounts:{0}\n", log.Count); } str.AppendFormat("PacketLocation(LogIndex:{0} PacketIndex:{1} GetHashCode:{2})\n", selectedPacket.LogIndex, selectedPacket.PacketIndex, selectedPacket.GetHashCode()); Packet pak = context.LogManager.GetPacket(selectedPacket); str.AppendFormat("ver:{0} code:0x{1:X2} dir:{2} prot:{3}", (pak.Attribute == null ? "unk" : pak.Attribute.Version.ToString()), pak.Code, pak.Direction, pak.Protocol); str.Append('\n'); InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show Context info (right click to close)"; infoWindow.Width = 640; infoWindow.Height = 300; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; Packet originalPak = log[selectedIndex]; ushort[] objectIds = null; if (originalPak is IObjectIdPacket) objectIds = (originalPak as IObjectIdPacket).ObjectIds; StringBuilder str = new StringBuilder(); if ((objectIds == null || objectIds.Length == 0)) { str.AppendFormat("packet not have any ID\n"); return false; } TimeSpan zeroTimeSpan = new TimeSpan(0); for (int i = 0; i < log.Count; i++) { Packet pak = log[i]; if (pak.Code == originalPak.Code && pak.Direction == originalPak.Direction && pak.Protocol == originalPak.Protocol) { if (pak is IObjectIdPacket && pak.Length > 0 && (pak as IObjectIdPacket).ObjectIds[0] == objectIds[0]) { str.Append(pak.ToHumanReadableString(zeroTimeSpan, true)); str.Append('\n'); } } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show object same packets (right click to close)"; infoWindow.Width = 620; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; SortedList m_inventoryItems = new SortedList(); int preAction = 0; int lastVaultPreAction = -1; int vaultNumber = -1; int VisibleSlots = 0xFF; for (int i = 0; i <= selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x20_PlayerPositionAndObjectID_171) { VisibleSlots = 0xFF; m_inventoryItems.Clear(); } else if (pak is StoC_0x02_InventoryUpdate) { StoC_0x02_InventoryUpdate invPack = (StoC_0x02_InventoryUpdate)pak; if (invPack.PreAction != 0 && invPack.PreAction != 10) preAction = invPack.PreAction; // rememer last opened inventory action, if it not update if (preAction > 10) preAction -= 10; if (invPack.PreAction == 1 || invPack.PreAction == 0 || invPack.PreAction == 11 || invPack.PreAction == 10) VisibleSlots = invPack.VisibleSlots; if (invPack.PreAction == 2) { for (byte j = 40; j < 80; j++) { if (m_inventoryItems.ContainsKey(j)) m_inventoryItems.Remove(j); } } else if (invPack.PreAction == 7) { for (byte j = 80; j <= 95; j++) { if (m_inventoryItems.ContainsKey(j)) m_inventoryItems.Remove(j); } } else if (invPack.PreAction == 3) { for (byte j = 110; j < 150; j++) { if (m_inventoryItems.ContainsKey(j)) m_inventoryItems.Remove(j); } } else if (invPack.PreAction == 4 || invPack.PreAction == 5 || invPack.PreAction == 6) { lastVaultPreAction = invPack.PreAction; vaultNumber = invPack.VisibleSlots; for (byte j = 150; j < 250; j++) { if (m_inventoryItems.ContainsKey(j)) m_inventoryItems.Remove(j); } } for (int j = 0; j < invPack.SlotsCount; j++) { StoC_0x02_InventoryUpdate.Item item = (StoC_0x02_InventoryUpdate.Item)invPack.Items[j]; if (item.name == null || item.name == "") { if (m_inventoryItems.ContainsKey(item.slot)) m_inventoryItems.Remove(item.slot); } else { if (m_inventoryItems.ContainsKey(item.slot)) m_inventoryItems[item.slot] = item; else m_inventoryItems.Add(item.slot, item); } } } } StringBuilder str = new StringBuilder(); str.AppendFormat("VisibleSlots:0x{0:X2} last initialized preAction:{1}({2})\n", VisibleSlots, preAction, (StoC_0x02_InventoryUpdate.ePreActionType)preAction); eWindowType prevWindowType = eWindowType.Unknown; eWindowType windowType = eWindowType.Unknown; foreach (StoC_0x02_InventoryUpdate.Item item in m_inventoryItems.Values) { // if (item.slot > 95 /*&& item.slot < 1000*/) { string selected = " "; if (item.slot >= 7 && item.slot <= 9) windowType = eWindowType.Horse; else if (item.slot >= 10 && item.slot <= 13) { windowType = eWindowType.Weapon; if (((item.slot - 10) == (VisibleSlots & 0x0F)) || ((item.slot - 10) == ((VisibleSlots >> 4) & 0x0F))) selected = "*"; } else if (item.slot >= 14 && item.slot <= 17) windowType = eWindowType.Quiver; else if (item.slot >= 21 && item.slot <= 37) windowType = eWindowType.Doll; else if (item.slot >= 40 && item.slot <= 79) windowType = eWindowType.Backpack; else if (item.slot >= 80 && item.slot <= 95) windowType = eWindowType.Horsebag; else if (item.slot >= 110 && item.slot <= 149) windowType = eWindowType.Vault; else if (item.slot >= 150 && item.slot <= 249) windowType = eWindowType.HouseVault; if (windowType != prevWindowType) { str.Append('\n'); str.Append(windowType); if (windowType == eWindowType.HouseVault) { if (lastVaultPreAction == 4 && vaultNumber != -1) { str.Append(' '); str.Append(vaultNumber); } str.AppendFormat(" ({0})", (StoC_0x02_InventoryUpdate.ePreActionType)lastVaultPreAction); } } str.AppendFormat("\n{16}slot:{0,-3} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"", item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name, selected); if (item.name != null && item.name != "") str.AppendFormat(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType); prevWindowType = windowType; } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player inventory info (right click to close)"; infoWindow.Width = 800; infoWindow.Height = 400; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; int currentRegion = 0; int currentZone = 0; Hashtable keepComponentsByOids = new Hashtable(); Hashtable keepComponents = new Hashtable(); Hashtable keeps = new Hashtable(); StringBuilder str = new StringBuilder(); for (int i = 0; i < selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x6C_KeepComponentOverview) { StoC_0x6C_KeepComponentOverview keep = (StoC_0x6C_KeepComponentOverview)pak; string key = keep.KeepId + "C:" + keep.ComponentId; Component kc; if (!keepComponents.ContainsKey(key)) { kc = new Component(); kc.KeepId = keep.KeepId; kc.ComponentId = keep.ComponentId; kc.Oid = keep.Uid; kc.Skin = keep.Skin; kc.addX = (sbyte)keep.X; kc.addY = (sbyte)keep.Y; kc.Rotate = keep.Heading; kc.Height = keep.Height; kc.Health = keep.Health; kc.Status = keep.Status; kc.Flag = keep.Flag; kc.Zone = 0; keepComponents[key] = kc; } else { kc = (Component)keepComponents[key]; } keepComponentsByOids[keep.Uid] = kc; } else if (pak is StoC_0x69_KeepOverview) { StoC_0x69_KeepOverview keep = (StoC_0x69_KeepOverview)pak; if (!keeps.ContainsKey(keep.KeepId)) { Keep k = new Keep(); k.KeepId = keep.KeepId; k.Angle = keep.Heading; k.X = keep.KeepX; k.Y = keep.KeepY; keeps[keep.KeepId] = k; } } else if (pak is StoC_0xA1_NpcUpdate) { StoC_0xA1_NpcUpdate obj = (StoC_0xA1_NpcUpdate)pak; if (keepComponentsByOids.ContainsKey(obj.NpcOid)) { Component kc = (Component)keepComponentsByOids[obj.NpcOid]; string key = kc.KeepId + "C:" + kc.ComponentId; kc.Zone = obj.CurrentZoneId; kc.Heading = (ushort)(obj.Heading & 0xFFF); kc.X = obj.CurrentZoneX; kc.Y = obj.CurrentZoneY; kc.Z = obj.CurrentZoneZ; keepComponentsByOids[obj.NpcOid] = kc; keepComponents[key] = kc; } } else if (pak is StoC_0xB7_RegionChange) { StoC_0xB7_RegionChange region = (StoC_0xB7_RegionChange)pak; if (region.RegionId != currentRegion) { currentRegion = region.RegionId; currentZone = region.ZoneId; keepComponentsByOids.Clear(); } } else if (pak is StoC_0x20_PlayerPositionAndObjectID_171) { StoC_0x20_PlayerPositionAndObjectID_171 region = (StoC_0x20_PlayerPositionAndObjectID_171)pak; if (region.Region != currentRegion) { currentRegion = region.Region; keepComponentsByOids.Clear(); } } } foreach (Component kc in keepComponents.Values) { if (kc.Zone != 0) { Keep k = (Keep)keeps[kc.KeepId]; str.AppendFormat("keepId:{0,-4} keepX:{1,-6} keepY:{2,-6} angle:{3,-3} ", k.KeepId, k.X, k.Y, k.Angle); str.AppendFormat("componentId:{0,-2} oid:{1,-5} Skin:{2,-2} X:{3,-4} Y:{4,-4} Rotate:{5} ", kc.ComponentId, kc.Oid, kc.Skin, kc.addX, kc.addY, kc.Rotate); str.AppendFormat("Heading:{0,-4} Zone:{1,-3} @X:{2,-5} @Y:{3,-5} Z:{4}\n", kc.Heading, kc.Zone, kc.X, kc.Y, kc.Z); } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show keep components info (right click to close)"; infoWindow.Width = 650; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; int MaxHealth = -1; int MaxPower = -1; int level = -1; int champ_level = -1; string className = ""; int classId = 0; bool flagFound = false; bool flagScarsOfBattleFound = false; bool flagSkillsChecked = false; StringBuilder str = new StringBuilder(); StoC_0xFB_CharStatsUpdate_175 charStats = null; int RASkillHPBonus = 0; int RASkillMPBonus = 0; for (int i = selectedIndex; i >= 0; i--) { Packet pak = log[i]; if (pak is StoC_0xFB_CharStatsUpdate_175) { if (charStats == null && (pak as StoC_0xFB_CharStatsUpdate_175).Flag != 0xFF) { charStats = pak as StoC_0xFB_CharStatsUpdate_175; if (MaxHealth == -1) MaxHealth = charStats.MaxHealth; } } else if (pak is CtoS_0x9D_RegionListRequest_174) { if (classId == 0 && (pak as CtoS_0x9D_RegionListRequest_174).Flag > 0) { classId = (pak as CtoS_0x9D_RegionListRequest_174).ClassId; } } else if (pak is StoC_0xAD_StatusUpdate_190) { if (MaxHealth == -1) MaxHealth = (pak as StoC_0xAD_StatusUpdate_190).MaxHealth; if (MaxPower == -1) MaxPower = (pak as StoC_0xAD_StatusUpdate_190).MaxPower; } else if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate stat = (StoC_0x16_VariousUpdate)pak; if (stat.SubCode == 3) { if (level == -1) { StoC_0x16_VariousUpdate.PlayerUpdate subData = (StoC_0x16_VariousUpdate.PlayerUpdate)stat.SubData; level = subData.playerLevel; if (className != subData.className) { for (int j = 0; j < ClassInfo.Length; j++) { // TODO check for realm, while it not too nessery, becose same class name on different realms have same same HPBase if ((string)ClassInfo[j][1] == subData.className) { classId = j; break; } } } className = subData.className; if (MaxHealth == -1) MaxHealth = (((subData.maxHealthHigh & 0xFF) << 8) | (subData.maxHealthLow & 0xFF)); // charName = subData.playerName; if (subData is StoC_0x16_VariousUpdate_179.PlayerUpdate_179) { champ_level = (subData as StoC_0x16_VariousUpdate_179.PlayerUpdate_179).championLevel; } } } else if (stat.SubCode == 1) { if (!flagSkillsChecked) { StoC_0x16_VariousUpdate.SkillsUpdate subData = (StoC_0x16_VariousUpdate.SkillsUpdate)stat.SubData; for (int j = (pak as StoC_0x16_VariousUpdate).SubCount - 1; j >=0; j--) { bool flagPrintSkill = false; StoC_0x16_VariousUpdate.Skill skill = subData.data[j]; if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.StartsWith("Toughness ")) { switch (skill.name.Substring(10)) { case "I": RASkillHPBonus = 25; break; case "II": RASkillHPBonus = 75; break; case "III": RASkillHPBonus = 150; break; case "IV": RASkillHPBonus = 250; break; case "V": RASkillHPBonus = 400; break; default: RASkillHPBonus = 0; // something wrong... break; } flagPrintSkill = true; } else if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.StartsWith("Ethereal Bond ")) { switch (skill.name.Substring(14)) { case "I": RASkillMPBonus = 20; // +20 for scout (20) break; case "II": RASkillMPBonus = 50; // +30 for scout (50) break; case "III": RASkillMPBonus = 80; // +30 for scout (80) break; case "IV": RASkillMPBonus = 130; // +50 for scout (130) break; case "V": RASkillMPBonus = 200; // +70 for scout (200) break; default: RASkillMPBonus = 0; // something wrong... break; } flagPrintSkill = true; } else if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.StartsWith("Augmented Constitution ")) { flagPrintSkill = true; } else if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.StartsWith("Augmented Acuity ")) { flagPrintSkill = true; } else if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.Equals("Scars of Battle")) { flagPrintSkill = true; flagScarsOfBattleFound = true; } if (flagPrintSkill) str.AppendFormat("level:{0,-2} type:{1}({2,-14}) stlOpen:0x{3:X4} bonus:{4,-2} icon:0x{5:X4} name:\"{6}\"\n", skill.level, (int)skill.page, skill.page.ToString().ToLower(), skill.stlOpen, skill.bonus, skill.icon, skill.name); } if ((pak as StoC_0x16_VariousUpdate).StartIndex == 0)// not found any RA flagSkillsChecked = true; } } } if (charStats != null && level != -1 && classId != 0 && flagSkillsChecked) { flagFound = true; break; } } if (flagFound) { bool flagPureCaster = (bool)ClassInfo[classId][4]; str.Append(charStats.GetPacketDataString(true)); str.Append('\n'); str.Append('\n'); str.AppendFormat("class:{0}({1}) level:{2} PureCaster:{3}", classId, className, level, flagPureCaster); if (champ_level > -1) str.AppendFormat(" champLevel:{0}", champ_level); str.Append('\n'); str.AppendFormat("ManaStat:{0}", (eManaStat)ClassInfo[classId][3]); int ManaStat = 0; int ManaStatBuffBonus = 0; int ManaStatItemBonus = 0; int ManaStatRealmAbilitiesBonus = 0; switch ((eManaStat)ClassInfo[classId][3]) { case eManaStat.Intelligence: ManaStat = charStats.@int; ManaStatBuffBonus = charStats.B_int; ManaStatItemBonus = Math.Min(charStats.I_int, charStats.C_int); ManaStatRealmAbilitiesBonus = charStats.R_int; break; case eManaStat.Piety: ManaStat = charStats.pie; ManaStatBuffBonus = charStats.B_pie; ManaStatItemBonus = Math.Min(charStats.I_pie, charStats.C_pie); ManaStatRealmAbilitiesBonus = charStats.R_pie; break; case eManaStat.Empathy: ManaStat = charStats.emp; ManaStatBuffBonus = charStats.B_emp; ManaStatItemBonus = Math.Min(charStats.I_emp, charStats.C_emp); ManaStatRealmAbilitiesBonus = charStats.R_emp; break; case eManaStat.Charisma: ManaStat = charStats.chr; ManaStatBuffBonus = charStats.B_chr; ManaStatItemBonus = Math.Min(charStats.I_chr, charStats.C_chr); ManaStatRealmAbilitiesBonus = charStats.R_chr; break; default: break; } if (ManaStat != 0) str.AppendFormat(":{0}", ManaStat); // ManaStat += (int)(ManaStatRealmAbilitiesBonus * 1.2); if (ManaStatRealmAbilitiesBonus != 0) str.AppendFormat(" RA_ManaStat:{0}", ManaStatRealmAbilitiesBonus); // ManaStat += ManaStatBuffBonus; if (ManaStatBuffBonus != 0) str.AppendFormat(" BuffBonus:{0}", ManaStatBuffBonus); ManaStat += (int)(ManaStatItemBonus * 1.2); if (ManaStatItemBonus != 0) str.AppendFormat(" ItemBonus:{0}", ManaStatItemBonus); if (RASkillMPBonus != 0) str.AppendFormat(" RealmAbilitiesMana:{0}", RASkillMPBonus); str.Append('\n'); int Constitution = charStats.con; str.AppendFormat("classBaseHP:{0} CON:{1}", (int)ClassInfo[classId][2], charStats.con); if (classId == 58) // Vampiir { str.AppendFormat(" VampBonus CON:{0}(calced:{1})", charStats.Flag * 3, (level - 5) * 3); Constitution += charStats.Flag * 3; } int RealmAbilitiesBonusConstitution = charStats.R_con; Constitution += RealmAbilitiesBonusConstitution; if (RealmAbilitiesBonusConstitution != 0) str.AppendFormat(" RA_CON:{0}", RealmAbilitiesBonusConstitution); int BuffBonusConstitution = charStats.B_con; Constitution += BuffBonusConstitution; if (BuffBonusConstitution!= 0) str.AppendFormat(" BuffBonus:{0}", BuffBonusConstitution); int ItemBonusConstitution = Math.Min(charStats.I_con, charStats.C_con); Constitution += ItemBonusConstitution; if (ItemBonusConstitution != 0) str.AppendFormat(" ItemBonus:{0}", ItemBonusConstitution); if (RASkillHPBonus != 0) str.AppendFormat(" RealmAbilitiesHP:{0}", RASkillHPBonus); int ItemBonusHits = 0; int MaxHealthCalculated = CalculateMaxHealth(level, Constitution, (int)ClassInfo[classId][2], champ_level); if (flagScarsOfBattleFound) { int HeavyTankBonusHP = (int)(MaxHealthCalculated * (1.0 + (level - 40) * 0.01)); str.AppendFormat(" HeavyTankBonusHP:{0}", HeavyTankBonusHP - MaxHealthCalculated); MaxHealthCalculated = HeavyTankBonusHP; } str.Append('\n'); MaxHealthCalculated += ItemBonusHits + RASkillHPBonus; int MaxManaCalculated = CalculateMaxMana(level, ManaStat, champ_level, flagPureCaster, str); str.AppendFormat("HP:{0} CalcedHP:{1}(calcedCON:{2})\n", MaxHealth, MaxHealthCalculated, Constitution); str.AppendFormat("MaxMana:{0} CalcedMaxMana:{1}(ManaStat:{2})\n", MaxPower, MaxManaCalculated, ManaStat); int insertPos = str.Length; int ItemHitsBonus = 0; int ItemHitsBonusCap = 0; int ItemPowerBonus = 0; int ItemPowerPoolBonus = 0; int ItemPowerPoolCapBonus = 0; CheckItemsHitsBonus(log, selectedIndex, str, ref ItemHitsBonus, ref ItemHitsBonusCap, ref ItemPowerBonus, ref ItemPowerPoolBonus, ref ItemPowerPoolCapBonus); str.Insert(insertPos, string.Format("\nCalcedMP:{0} ItemBonusPower:{1} ItemBonusPowerPool:{2} (+cap:{3})\n", (int)((MaxManaCalculated + ItemPowerBonus) * (1 + 0.01 * ItemPowerPoolBonus)) + RASkillMPBonus + ManaStatRealmAbilitiesBonus * 1.2, ItemPowerBonus, ItemPowerPoolBonus, ItemPowerPoolCapBonus)); if (MaxHealthCalculated != MaxHealth) { int CapItemBonusHits = ItemHitsBonusCap + level * 4; if (MaxHealth - MaxHealthCalculated - Math.Min(ItemHitsBonus, CapItemBonusHits) == 0) str.Insert(insertPos, string.Format("\nCalcedHP:{2} ItemBonusHits:{0} (+cap:{1})", Math.Min(ItemHitsBonus, CapItemBonusHits), ItemHitsBonusCap, MaxHealthCalculated + Math.Min(ItemHitsBonus, CapItemBonusHits))); else str.Insert(insertPos, string.Format("\nCalcedHP:{3} unknown Hits:{0}, ItemBonusHits:{1} (+cap:{2})", MaxHealth - MaxHealthCalculated - Math.Min(ItemHitsBonus, CapItemBonusHits), Math.Min(ItemHitsBonus, CapItemBonusHits), ItemHitsBonusCap, MaxHealthCalculated + Math.Min(ItemHitsBonus, CapItemBonusHits))); } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player calc info (right click to close)"; infoWindow.Width = 820; infoWindow.Height = 320; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; StoC_0x7F_UpdateIcons.Effect[] effects = new StoC_0x7F_UpdateIcons.Effect[40]; StoC_0x75_SetConcentrationList concPak = null; for (int i = 0; i <= selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x7F_UpdateIcons) { StoC_0x7F_UpdateIcons.Effect[] listeffects = (pak as StoC_0x7F_UpdateIcons).Effects; for (int j = 0; j < listeffects.Length; j++) { effects[listeffects[j].iconIndex] = listeffects[j]; } } else if (pak is StoC_0x75_SetConcentrationList) { concPak = pak as StoC_0x75_SetConcentrationList; } } StringBuilder str = new StringBuilder(); for (int i = 0; i < effects.Length; i++) { StoC_0x7F_UpdateIcons.Effect effect = effects[i]; if (effect.name != null && effect.name != "") { str.AppendFormat("iconIndex:{0,-2} {6} immunity:0x{1:X2} icon:0x{2:X4} remainingTime:{3,-4} internalId:{4,-5} name:\"{5}\"\n", effect.iconIndex, effect.immunity, effect.icon, (short)effect.remainingTime, effect.internalId, effect.name, effect.unk1 == 0xFF ? "SKL" : "SPL"); } } if (concPak != null && concPak.EffectsCount > 0) { str.Append("\n"); str.Append(concPak.ToString()); str.Append(concPak.GetPacketDataString(true)); } StoC_0x16_VariousUpdate.Skill[] Skills = null; for (int i = selectedIndex; i >= 0; i--) { Packet pak = log[i]; if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate skills = (pak as StoC_0x16_VariousUpdate); if (skills.SubCode == 1) { if (Skills == null) { Skills = new StoC_0x16_VariousUpdate.Skill[skills.StartIndex + skills.SubCount]; } int j = skills.StartIndex; foreach (StoC_0x16_VariousUpdate.Skill skill in skills.InSkillsUpdate.data) { Skills[j++] = skill; } if (skills.StartIndex == 0) { break; } } } } int index = -1; if (effects.Length > 0) { str.Append("\n"); } if (Skills != null) { if (Skills.Length > 0) { str.Append("Skills:"); } foreach (StoC_0x16_VariousUpdate.Skill skill in Skills) { str.Append("\n"); if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.Styles && skill.stlOpen >= 0x6400) // 0x6400 = 100 << 8 { str.AppendFormat("*({0,-2})", (skill.stlOpen >> 8) - 100); } str.Append("\t"); if ((int)skill.page > 0) { index++; } str.AppendFormat("[{0,-2}] ", index); str.AppendFormat("level:{0,-2} type:{1}({2,-14}) stlOpen:0x{3:X4} bonus:{4,-3} icon:0x{5:X4} name:\"{6}\"", skill.level, (int)skill.page, skill.page.ToString().ToLower(), skill.stlOpen, skill.bonus, skill.icon, skill.name); } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player effects info (right click to close)"; infoWindow.Width = 820; infoWindow.Height = 320; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; SortedList m_inventoryItems = new SortedList(); int preAction = 0; int lastVaultPreAction = -1; int vaultNumber = -1; int VisibleSlots = 0xFF; for (int i = 0; i <= selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x20_PlayerPositionAndObjectID_171) { VisibleSlots = 0xFF; m_inventoryItems.Clear(); } else if (pak is StoC_0x02_InventoryUpdate) { StoC_0x02_InventoryUpdate invPack = (StoC_0x02_InventoryUpdate)pak; if (invPack.PreAction != 0 && invPack.PreAction != 10) { preAction = invPack.PreAction; // rememer last opened inventory action, if it not update } if (preAction > 10) { preAction -= 10; } if (invPack.PreAction == 1 || invPack.PreAction == 0 || invPack.PreAction == 11 || invPack.PreAction == 10) { VisibleSlots = invPack.VisibleSlots; } if (invPack.PreAction == 2) { for (byte j = 40; j < 80; j++) { if (m_inventoryItems.ContainsKey(j)) { m_inventoryItems.Remove(j); } } } else if (invPack.PreAction == 7) { for (byte j = 80; j <= 95; j++) { if (m_inventoryItems.ContainsKey(j)) { m_inventoryItems.Remove(j); } } } else if (invPack.PreAction == 3) { for (byte j = 110; j < 150; j++) { if (m_inventoryItems.ContainsKey(j)) { m_inventoryItems.Remove(j); } } } else if (invPack.PreAction == 4 || invPack.PreAction == 5 || invPack.PreAction == 6) { lastVaultPreAction = invPack.PreAction; vaultNumber = invPack.VisibleSlots; for (byte j = 150; j < 250; j++) { if (m_inventoryItems.ContainsKey(j)) { m_inventoryItems.Remove(j); } } } for (int j = 0; j < invPack.SlotsCount; j++) { StoC_0x02_InventoryUpdate.Item item = (StoC_0x02_InventoryUpdate.Item)invPack.Items[j]; if (item.name == null || item.name == "") { if (m_inventoryItems.ContainsKey(item.slot)) { m_inventoryItems.Remove(item.slot); } } else { if (m_inventoryItems.ContainsKey(item.slot)) { m_inventoryItems[item.slot] = item; } else { m_inventoryItems.Add(item.slot, item); } } } } } StringBuilder str = new StringBuilder(); str.AppendFormat("VisibleSlots:0x{0:X2} last initialized preAction:{1}({2})\n", VisibleSlots, preAction, (StoC_0x02_InventoryUpdate.ePreActionType)preAction); eWindowType prevWindowType = eWindowType.Unknown; eWindowType windowType = eWindowType.Unknown; foreach (StoC_0x02_InventoryUpdate.Item item in m_inventoryItems.Values) { // if (item.slot > 95 /*&& item.slot < 1000*/) { string selected = " "; if (item.slot >= 7 && item.slot <= 9) { windowType = eWindowType.Horse; } else if (item.slot >= 10 && item.slot <= 13) { windowType = eWindowType.Weapon; if (((item.slot - 10) == (VisibleSlots & 0x0F)) || ((item.slot - 10) == ((VisibleSlots >> 4) & 0x0F))) { selected = "*"; } } else if (item.slot >= 14 && item.slot <= 17) { windowType = eWindowType.Quiver; } else if (item.slot >= 21 && item.slot <= 37) { windowType = eWindowType.Doll; } else if (item.slot >= 40 && item.slot <= 79) { windowType = eWindowType.Backpack; } else if (item.slot >= 80 && item.slot <= 95) { windowType = eWindowType.Horsebag; } else if (item.slot >= 110 && item.slot <= 149) { windowType = eWindowType.Vault; } else if (item.slot >= 150 && item.slot <= 249) { windowType = eWindowType.HouseVault; } if (windowType != prevWindowType) { str.Append('\n'); str.Append(windowType); if (windowType == eWindowType.HouseVault) { if (lastVaultPreAction == 4 && vaultNumber != -1) { str.Append(' '); str.Append(vaultNumber); } str.AppendFormat(" ({0})", (StoC_0x02_InventoryUpdate.ePreActionType)lastVaultPreAction); } } str.AppendFormat("\n{16}slot:{0,-3} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"", item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name, selected); if (item.name != null && item.name != "") { str.AppendFormat(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType); } prevWindowType = windowType; } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player inventory info (right click to close)"; infoWindow.Width = 800; infoWindow.Height = 400; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; string charName = ""; GroupMemberInfo[] groupMembers = new GroupMemberInfo[8]; for (int i = 0 ; i <= selectedIndex; i++) { Packet pak = log[i]; if (pak is CtoS_0x10_CharacterSelectRequest) { CtoS_0x10_CharacterSelectRequest login = (CtoS_0x10_CharacterSelectRequest)pak; charName = login.CharName; } else if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate groupPak = (StoC_0x16_VariousUpdate)pak; if (groupPak.SubCode == 3) { StoC_0x16_VariousUpdate.PlayerUpdate subData = (StoC_0x16_VariousUpdate.PlayerUpdate)groupPak.SubData; charName = subData.playerName; } else if (groupPak.SubCode == 6) // group update { StoC_0x16_VariousUpdate.PlayerGroupUpdate grpUpdate = groupPak.InPlayerGroupUpdate; if (grpUpdate != null) { for (int grpIndex = 0; grpIndex < 8; grpIndex++) { if (grpUpdate.groupMembers.Length > grpIndex) { if (groupMembers[grpIndex] == null) { groupMembers[grpIndex] = new GroupMemberInfo(); } groupMembers[grpIndex].groupMember = grpUpdate.groupMembers[grpIndex]; groupMembers[grpIndex].flag_0x16_UpdateIsLast = true; groupMembers[grpIndex].flagMemberInGroup= true; } else { if (groupMembers[grpIndex] != null) groupMembers[grpIndex].flagMemberInGroup = false; } } } } } else if (pak is StoC_0x70_PlayerGroupUpdate) { StoC_0x70_PlayerGroupUpdate groupPak = (StoC_0x70_PlayerGroupUpdate)pak; foreach (object o in groupPak.Updates) { if (o is StoC_0x70_PlayerGroupUpdate.PlayerStatusData) { StoC_0x70_PlayerGroupUpdate.PlayerStatusData stat = o as StoC_0x70_PlayerGroupUpdate.PlayerStatusData; if (groupMembers[stat.playerIndex] == null) { groupMembers[stat.playerIndex] = new GroupMemberInfo(); } groupMembers[stat.playerIndex].playerStatusData = stat; groupMembers[stat.playerIndex].flag_0x16_UpdateIsLast = false; } else if (o is StoC_0x70_PlayerGroupUpdate.PlayerBuffsData) { StoC_0x70_PlayerGroupUpdate.PlayerBuffsData buffs = o as StoC_0x70_PlayerGroupUpdate.PlayerBuffsData; if (groupMembers[buffs.playerIndex] == null) { groupMembers[buffs.playerIndex] = new GroupMemberInfo(); } groupMembers[buffs.playerIndex].playerBuffsData = buffs; } else if (o is StoC_0x70_PlayerGroupUpdate_173.PlayerMapData) { StoC_0x70_PlayerGroupUpdate_173.PlayerMapData map = o as StoC_0x70_PlayerGroupUpdate_173.PlayerMapData; if (groupMembers[map.player] == null) { groupMembers[map.player] = new GroupMemberInfo(); } groupMembers[map.player].playerMapData = map; } } } } StringBuilder str = new StringBuilder(); bool found = false; for (int i = 0; i < groupMembers.Length; i++) { if (groupMembers[i] != null) { bool flagMemberInfoPrinted = false; if (!groupMembers[i].flagMemberInGroup) continue; found = true; str.AppendFormat("player{0}: level:{1,-2} oid:0x{2:X4} class:\"{3}\"\t name:\"{4}\"", i, groupMembers[i].groupMember.level, groupMembers[i].groupMember.oid, groupMembers[i].groupMember.classname, groupMembers[i].groupMember.name); if (charName == groupMembers[i].groupMember.name) str.Append(" (YOU)"); str.Append("\n"); if (groupMembers[i].flag_0x16_UpdateIsLast) { str.AppendFormat("player{0}: health:{1,3}% mana:{2,3}% endurance:{3,3}% status:0x{4:X2}", i, groupMembers[i].groupMember.health, groupMembers[i].groupMember.mana, groupMembers[i].groupMember.endurance, groupMembers[i].groupMember.status); flagMemberInfoPrinted = true; str.Append("\n"); } if (groupMembers[i].playerStatusData != null && !flagMemberInfoPrinted) { str.Append(groupMembers[i].playerStatusData.ToString()); str.Append("\n"); } if (groupMembers[i].playerMapData != null) { str.Append(groupMembers[i].playerMapData.ToString()); str.Append("\n"); } if (groupMembers[i].playerBuffsData != null) { str.Append(groupMembers[i].playerBuffsData.ToString()); str.Append("\n"); } str.Append("\n"); } } if (!found) str.Append("Group info not found\n"); InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player group info (right click to close)"; infoWindow.Width = 820; infoWindow.Height = 320; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; int currentRegion = 0; int currentZone = 0; Hashtable keepComponentsByOids = new Hashtable(); Hashtable keepComponents = new Hashtable(); Hashtable keeps = new Hashtable(); StringBuilder str = new StringBuilder(); for (int i = 0; i < selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x6C_KeepComponentOverview) { StoC_0x6C_KeepComponentOverview keep = (StoC_0x6C_KeepComponentOverview)pak; string key = keep.KeepId + "C:" + keep.ComponentId; Component kc; if (!keepComponents.ContainsKey(key)) { kc = new Component(); kc.KeepId = keep.KeepId; kc.ComponentId = keep.ComponentId; kc.Oid = keep.Uid; kc.Skin = keep.Skin; kc.addX = (sbyte)keep.X; kc.addY = (sbyte)keep.Y; kc.Rotate = keep.Heading; kc.Height = keep.Height; kc.Health = keep.Health; kc.Status = keep.Status; kc.Flag = keep.Flag; kc.Zone = 0; keepComponents[key] = kc; } else kc = (Component)keepComponents[key]; keepComponentsByOids[keep.Uid] = kc; } else if (pak is StoC_0x69_KeepOverview) { StoC_0x69_KeepOverview keep = (StoC_0x69_KeepOverview)pak; if (!keeps.ContainsKey(keep.KeepId)) { Keep k = new Keep(); k.KeepId = keep.KeepId; k.Angle = keep.Heading; k.X = keep.KeepX; k.Y = keep.KeepY; keeps[keep.KeepId] = k; } } else if (pak is StoC_0xA1_NpcUpdate) { StoC_0xA1_NpcUpdate obj = (StoC_0xA1_NpcUpdate)pak; if (keepComponentsByOids.ContainsKey(obj.NpcOid)) { Component kc = (Component)keepComponentsByOids[obj.NpcOid]; string key = kc.KeepId + "C:" + kc.ComponentId; kc.Zone = obj.CurrentZoneId; kc.Heading = (ushort)(obj.Heading & 0xFFF); kc.X = obj.CurrentZoneX; kc.Y = obj.CurrentZoneY; kc.Z = obj.CurrentZoneZ; keepComponentsByOids[obj.NpcOid] = kc; keepComponents[key] = kc; } } else if (pak is StoC_0xB7_RegionChange) { StoC_0xB7_RegionChange region = (StoC_0xB7_RegionChange)pak; if (region.RegionId != currentRegion) { currentRegion = region.RegionId; currentZone = region.ZoneId; keepComponentsByOids.Clear(); } } else if (pak is StoC_0x20_PlayerPositionAndObjectID_171) { StoC_0x20_PlayerPositionAndObjectID_171 region = (StoC_0x20_PlayerPositionAndObjectID_171)pak; if (region.Region!= currentRegion) { currentRegion = region.Region; keepComponentsByOids.Clear(); } } } foreach (Component kc in keepComponents.Values) { if (kc.Zone != 0) { Keep k = (Keep)keeps[kc.KeepId]; str.AppendFormat("keepId:{0,-4} keepX:{1,-6} keepY:{2,-6} angle:{3,-3} ", k.KeepId, k.X, k.Y, k.Angle); str.AppendFormat("componentId:{0,-2} oid:{1,-5} Skin:{2,-2} X:{3,-4} Y:{4,-4} Rotate:{5} ", kc.ComponentId, kc.Oid, kc.Skin, kc.addX, kc.addY, kc.Rotate); str.AppendFormat("Heading:{0,-4} Zone:{1,-3} @X:{2,-5} @Y:{3,-5} Z:{4}\n", kc.Heading, kc.Zone, kc.X, kc.Y, kc.Z); } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show keep components info (right click to close)"; infoWindow.Width = 650; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; string serverName = "UNKNOWN"; int serverId = -1; int serverColorHandling = -1; int sessionId = -1; int objectId = -1; int petId = -1; int healthPercent = -1; int endurancePercent = -1; int manaPercent = -1; int concentrationPercent = -1; int speed = -1; int maxspeed = -1; int clientTargetOid = -1; int serverTargetOid = -1; int regionXOffset = 0; int regionYOffset = 0; int glocX = -1; int glocY = -1; int glocRegion = -1; string loc = "UNKNOWN"; string gloc = "UNKNOWN"; string state = ""; string charName = "UNKNOWN"; string lastName = ""; int playersInGroup = -1; int indexInGroup = -1; int mountId = -1; int mountSlot = -1; int level = -1; int mana = -1; int manaMax = -1; int health = -1; int healthMax = -1; int conc = -1; int concMax = -1; string className = "UNKNOWN"; string raceName = ""; int realm_level = -1; string realm_title = ""; int champ_level = -1; string champ_title = ""; int ml_level = -1; int houseLot = -1; string ml_title = ""; int guildID = -1; string guildName = "None"; string guildRank = ""; string enterRegionName = ""; string petInfo = ""; int insideHouseId = 0; Hashtable enterSubRegion = new Hashtable(); bool flagAwait0xA9 = false; for (int i = 0; i <= selectedIndex; i++) { Packet pak = log[i]; if (pak is CtoS_0xA9_PlayerPosition) { CtoS_0xA9_PlayerPosition pos = (CtoS_0xA9_PlayerPosition)pak; speed = pos.Status & 0x1FF; byte plrState = (byte)((pos.Status >> 10) & 7); state = plrState > 0 ? ((StoC_0xA9_PlayerPosition.PlrState)plrState).ToString() : ""; if ((pos.Status & 0x200) == 0x200) { state += ",Backward"; } if ((pos.Status & 0x8000) == 0x8000) { state += ",StrafeRight"; } if ((pos.Status & 0x4000) == 0x4000) { state += ",StrafeLeft"; } if ((pos.Status & 0x2000) == 0x2000) { state += "Move"; } if ((pos.Flag & 0x01) == 0x01) { state += ",CtoS_0xA9_Flagx01"; } if ((pos.Flag & 0x02) == 0x02) { state += ",Underwater"; } if ((pos.Flag & 0x04) == 0x04) { state += ",PetInView"; } if ((pos.Flag & 0x08) == 0x08) { state += ",GT"; } if ((pos.Flag & 0x10) == 0x10) { state += ",CheckTargetInView"; } if ((pos.Flag & 0x20) == 0x20) { state += ",TargetInView"; } if ((pos.Flag & 0x40) == 0x40) { state += ",MoveTo"; } if ((pos.Health & 0x80) == 0x80) { state += ",Combat"; } if ((pos.Speed & 0x8000) == 0x8000) { state += ",FallDown"; } loc = string.Format("({0,-3}): ({1,-6} {2,-6} {3,-5})", pos.CurrentZoneId, pos.CurrentZoneX, pos.CurrentZoneY, pos.CurrentZoneZ); if (flagAwait0xA9) { if (glocX != -1 && glocY != -1) { regionXOffset = glocX - pos.CurrentZoneX; regionYOffset = glocY - pos.CurrentZoneY; } flagAwait0xA9 = false; } gloc = string.Format("({0,-3}): ({1,-6} {2,-6} {3,-5})", glocRegion, regionXOffset + pos.CurrentZoneX, regionYOffset + pos.CurrentZoneY, pos.CurrentZoneZ); } else if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate stat = (StoC_0x16_VariousUpdate)pak; if (stat.SubCode == 3) { StoC_0x16_VariousUpdate.PlayerUpdate subData = (StoC_0x16_VariousUpdate.PlayerUpdate)stat.SubData; level = subData.playerLevel; className = subData.className; raceName = subData.raceName; healthMax = (ushort)(((subData.maxHealthHigh & 0xFF) << 8) | (subData.maxHealthLow & 0xFF)); realm_level = subData.realmLevel; realm_title = subData.realmTitle; ml_level = subData.mlLevel; ml_title = subData.mlTitle; houseLot = subData.personalHouse; guildName = subData.guildName; guildRank = subData.guildRank; lastName = subData.lastName; charName = subData.playerName; if (subData is StoC_0x16_VariousUpdate_179.PlayerUpdate_179) { champ_level = (subData as StoC_0x16_VariousUpdate_179.PlayerUpdate_179).championLevel; champ_title = (subData as StoC_0x16_VariousUpdate_179.PlayerUpdate_179).championTitle; } } else if (stat.SubCode == 6) { StoC_0x16_VariousUpdate.PlayerGroupUpdate subData = (StoC_0x16_VariousUpdate.PlayerGroupUpdate)stat.SubData; playersInGroup = stat.SubCount; for (int j = 0; j < stat.SubCount; j++) { StoC_0x16_VariousUpdate.GroupMember member = subData.groupMembers[j]; if (objectId >= 0 && objectId == member.oid) { indexInGroup = j; } } } } else if (pak is CtoS_0x10_CharacterSelectRequest) { CtoS_0x10_CharacterSelectRequest login = (CtoS_0x10_CharacterSelectRequest)pak; charName = login.CharName; } else if (pak is CtoS_0xB0_TargetChange) { CtoS_0xB0_TargetChange trg = (CtoS_0xB0_TargetChange)pak; clientTargetOid = trg.Oid; } else if (pak is StoC_0xAF_Message) { StoC_0xAF_Message msg = (StoC_0xAF_Message)pak; if (msg.Text.StartsWith("You have entered ")) { enterRegionName = regionNameFromMessage(msg.Text.Substring(17)); } else if (msg.Text.StartsWith("(Region) You have entered ")) { string enterSubRegionName = regionNameFromMessage(msg.Text.Substring(26)); if (!enterSubRegion.ContainsKey(enterSubRegionName)) { enterSubRegion.Add(enterSubRegionName, enterSubRegionName); } } else if (msg.Text.StartsWith("(Region) You have left ")) { string enterSubRegionName = regionNameFromMessage(msg.Text.Substring(23)); enterSubRegion.Remove(enterSubRegionName); } } else if (pak is StoC_0xF6_ChangeTarget) { StoC_0xF6_ChangeTarget trg = (StoC_0xF6_ChangeTarget)pak; serverTargetOid = trg.Oid; } else if (pak is StoC_0xB6_UpdateMaxSpeed) { StoC_0xB6_UpdateMaxSpeed spd = (StoC_0xB6_UpdateMaxSpeed)pak; maxspeed = spd.MaxSpeedPercent; } else if (pak is StoC_0xAD_StatusUpdate) { StoC_0xAD_StatusUpdate status = (StoC_0xAD_StatusUpdate)pak; healthPercent = status.HealthPercent; endurancePercent = status.EndurancePercent; manaPercent = status.ManaPercent; concentrationPercent = status.ConcentrationPercent; if (pak is StoC_0xAD_StatusUpdate_190) { health = (pak as StoC_0xAD_StatusUpdate_190).Health; healthMax = (pak as StoC_0xAD_StatusUpdate_190).MaxHealth; mana = (pak as StoC_0xAD_StatusUpdate_190).Power; manaMax = (pak as StoC_0xAD_StatusUpdate_190).MaxPower; conc = (pak as StoC_0xAD_StatusUpdate_190).Concentration; concMax = (pak as StoC_0xAD_StatusUpdate_190).MaxConcentration; } } else if (pak is StoC_0x28_SetSessionId) { StoC_0x28_SetSessionId session = (StoC_0x28_SetSessionId)pak; sessionId = session.SessionId; } else if (pak is StoC_0x20_PlayerPositionAndObjectID) { StoC_0x20_PlayerPositionAndObjectID posAndOid = (StoC_0x20_PlayerPositionAndObjectID)pak; objectId = posAndOid.PlayerOid; glocX = (int)posAndOid.X; glocY = (int)posAndOid.Y; if ((pak as StoC_0x20_PlayerPositionAndObjectID_171) != null) { glocRegion = (pak as StoC_0x20_PlayerPositionAndObjectID_171).Region; } loc = "UNKNOWN"; gloc = string.Format("({0,-3}): ({1,-6} {2,-6} {3,-5})", glocRegion, posAndOid.X, posAndOid.Y, posAndOid.Z); flagAwait0xA9 = true; enterSubRegion.Clear(); enterRegionName = ""; insideHouseId = 0; } else if (pak is StoC_0xDE_SetObjectGuildId) { StoC_0xDE_SetObjectGuildId guildId = (StoC_0xDE_SetObjectGuildId)pak; if (objectId == guildId.Oid) { guildID = guildId.GuildId; } if (guildId.ServerId == 0xFF) // set ObjectID for old logs (1.70-) { objectId = guildId.Oid; } } else if (pak is StoC_0x04_CharacterJump) { StoC_0x04_CharacterJump plrJump = (StoC_0x04_CharacterJump)pak; if (plrJump.X == 0 && plrJump.Y == 0 && plrJump.Z == 0) // skip /faceloc { continue; } objectId = plrJump.PlayerOid; glocX = (int)plrJump.X; glocY = (int)plrJump.Y; insideHouseId = plrJump.HouseId; loc = "UNKNOWN"; gloc = string.Format("({0,-3}): ({1,-6} {2,-6} {3,-5})", glocRegion, plrJump.X, plrJump.Y, plrJump.Z); flagAwait0xA9 = true; } else if (pak is StoC_0x88_PetWindowUpdate) { StoC_0x88_PetWindowUpdate pet = (StoC_0x88_PetWindowUpdate)pak; petId = pet.PetId; } else if (pak is StoC_0xDA_NpcCreate) { if (petId == -1) { continue; } StoC_0xDA_NpcCreate npc = (StoC_0xDA_NpcCreate)pak; if (npc.Oid != petId) { continue; } petInfo = string.Format(" \"{0}\" level:{1} model:0x{2:X4}", npc.Name, npc.Level, npc.Model); } else if (pak is StoC_0xC8_PlayerRide) { StoC_0xC8_PlayerRide ride = (StoC_0xC8_PlayerRide)pak; if (objectId >= 0 && objectId == ride.RiderOid) { if (ride.Flag == 0) { mountId = -1; mountSlot = -1; } else { mountId = ride.MountOid; mountSlot = ride.Slot; } } } else if (pak is StoC_0xFB_CharStatsUpdate_175) { if ((pak as StoC_0xFB_CharStatsUpdate_175).Flag != 0xFF) { healthMax = (pak as StoC_0xFB_CharStatsUpdate_175).MaxHealth; } } else if (pak is StoC_0xFB_CharStatsUpdate) { healthMax = (pak as StoC_0xFB_CharStatsUpdate).MaxHealth; } else if (pak is StoC_0x2A_LoginGranted) { StoC_0x2A_LoginGranted server = (StoC_0x2A_LoginGranted)pak; serverName = server.ServerName; serverId = server.ServerId; serverColorHandling = server.ColorHandling; } } int additionStrings = 0; StringBuilder str = new StringBuilder(); if (serverId > 0) { str.AppendFormat(" server: \"{0}\" id:0x{1:X2} color:{2}\n", serverName, serverId, serverColorHandling); additionStrings++; } str.AppendFormat("session id: 0x{0}\n", ValueToString(sessionId, "X4")); str.AppendFormat(" object id: 0x{0}\n", ValueToString(objectId, "X4")); str.AppendFormat(" pet id: 0x{0}{1}\n", ValueToString(petId, "X4"), petInfo); str.AppendFormat(" char name: {0}{1}\n", charName, lastName != "None" ? string.Format(" \"{0}\"", lastName) : ""); str.AppendFormat(" level: {0} {1}{2}\n", ValueToString(level), className, (raceName != "" ? " (" + raceName + ")" : "")); if (guildName != "None") { str.AppendFormat(" guild: {0}", guildName); str.AppendFormat(" rank:{0}", guildRank); if (guildID != -1) { str.AppendFormat(" guildId:0x{0:X4}", guildID); } str.AppendFormat("\n"); additionStrings++; } if (realm_level > 0) { str.AppendFormat("RealmLevel: {0} \"{1}\"\n", ValueToString(realm_level), realm_title); additionStrings++; } if (ml_level > 0) { str.AppendFormat(" ML level: {0} \"{1}\"\n", ValueToString(ml_level), ml_title); additionStrings++; } if (champ_level > 0) { str.AppendFormat("ChampLevel: {0} \"{1}\"\n", ValueToString(champ_level), champ_title); additionStrings++; } str.AppendFormat("\n"); if (houseLot > 0) { str.AppendFormat(" HouseLot: 0x{0}\n", ValueToString(houseLot, "X4")); additionStrings++; } if (mountId > 0) { str.AppendFormat(" mount id: 0x{0} (slot:{1})\n", ValueToString(mountId, "X4"), ValueToString(mountSlot)); additionStrings++; } if (playersInGroup > 0) { str.AppendFormat(" group: {0}[{1}]\n", ValueToString(indexInGroup), ValueToString(playersInGroup)); additionStrings++; } str.AppendFormat(" speed: {0,3}\n", ValueToString(speed)); str.AppendFormat(" maxSpeed: {0,3}%\n", ValueToString(maxspeed)); str.AppendFormat(" health: {0,3}%", ValueToString(healthPercent)); if (health != -1) { str.AppendFormat(" ({0}/{1})", health, healthMax); } else if (healthMax != -1) { str.AppendFormat(" (maxHealth:{0})", healthMax); } str.Append('\n'); str.AppendFormat(" mana: {0,3}%", ValueToString(manaPercent)); if (mana != -1) { str.AppendFormat(" ({0}/{1})", mana, manaMax); } str.Append('\n'); str.AppendFormat(" endurance: {0,3}%\n", ValueToString(endurancePercent)); str.AppendFormat("concentration: {0,3}%", ValueToString(concentrationPercent)); if (conc != -1) { str.AppendFormat(" ({0}/{1})", conc, concMax); } str.Append('\n'); str.AppendFormat(" clientTarget: 0x{0}\n", ValueToString(clientTargetOid, "X4")); str.AppendFormat(" checkTarget: 0x{0}\n", ValueToString(serverTargetOid, "X4")); str.AppendFormat(" current zone: {0}{1}\n", loc, enterRegionName == "" ? "" : " (" + enterRegionName + ")"); str.AppendFormat(" calced gloc: {0}\n", gloc); int subReg = 0; foreach (string subRegionName in enterSubRegion.Values) { str.AppendFormat(" subRegion[{0}]: {1}\n", subReg++, subRegionName); additionStrings++; } if (insideHouseId != 0) { str.AppendFormat(" inside House: {0}\n", insideHouseId); additionStrings++; } str.AppendFormat(" flags: {0}\n", state); InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player info (right click to close)"; infoWindow.Width = 500; infoWindow.Height = 310 + 15 * additionStrings; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; StoC_0x7F_UpdateIcons.Effect[] effects = new StoC_0x7F_UpdateIcons.Effect[40]; StoC_0x75_SetConcentrationList concPak = null; for (int i = 0; i <= selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x7F_UpdateIcons) { StoC_0x7F_UpdateIcons.Effect[] listeffects = (pak as StoC_0x7F_UpdateIcons).Effects; for (int j = 0; j < listeffects.Length; j++) effects[listeffects[j].iconIndex] = listeffects[j]; } else if (pak is StoC_0x75_SetConcentrationList) { concPak = pak as StoC_0x75_SetConcentrationList; } } StringBuilder str = new StringBuilder(); for (int i = 0; i < effects.Length; i++) { StoC_0x7F_UpdateIcons.Effect effect = effects[i]; if (effect.name != null && effect.name != "") str.AppendFormat("iconIndex:{0,-2} {6} immunity:0x{1:X2} icon:0x{2:X4} remainingTime:{3,-4} internalId:{4,-5} name:\"{5}\"\n", effect.iconIndex, effect.immunity, effect.icon, (short)effect.remainingTime, effect.internalId, effect.name, effect.unk1 == 0xFF ? "SKL" : "SPL"); } if (concPak != null && concPak.EffectsCount > 0) { str.Append("\n"); str.Append(concPak.ToString()); str.Append(concPak.GetPacketDataString(true)); } StoC_0x16_VariousUpdate.Skill[] Skills = null; for (int i = selectedIndex; i >= 0; i--) { Packet pak = log[i]; if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate skills = (pak as StoC_0x16_VariousUpdate); if (skills.SubCode == 1) { if (Skills == null) Skills = new StoC_0x16_VariousUpdate.Skill[skills.StartIndex + skills.SubCount]; int j = skills.StartIndex; foreach (StoC_0x16_VariousUpdate.Skill skill in skills.InSkillsUpdate.data) { Skills[j++] = skill; } if (skills.StartIndex == 0) break; } } } int index = -1; if (effects.Length > 0) str.Append("\n"); if (Skills != null) { if (Skills.Length > 0) str.Append("Skills:"); foreach(StoC_0x16_VariousUpdate.Skill skill in Skills) { str.Append("\n"); if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.Styles && skill.stlOpen >= 0x6400) // 0x6400 = 100 << 8 { str.AppendFormat("*({0,-2})", (skill.stlOpen >> 8) - 100); } str.Append("\t"); if((int)skill.page > 0) index++; str.AppendFormat("[{0,-2}] ", index); str.AppendFormat("level:{0,-2} type:{1}({2,-14}) stlOpen:0x{3:X4} bonus:{4,-3} icon:0x{5:X4} name:\"{6}\"", skill.level, (int)skill.page, skill.page.ToString().ToLower(), skill.stlOpen, skill.bonus, skill.icon, skill.name); } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player effects info (right click to close)"; infoWindow.Width = 820; infoWindow.Height = 320; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; Packet originalPak = log[selectedIndex]; if (!(originalPak is CtoS_0xDD_PlayerMoveItemRequest || originalPak is CtoS_0x79_SellItem || originalPak is CtoS_0xE0_AppraiseItem || originalPak is CtoS_0x71_UseItem || originalPak is CtoS_0x80_DestroyInventoryItem || originalPak is CtoS_0x41_UseNewQuestItem || originalPak is CtoS_0x0C_HouseItemPlacementRequest || originalPak is CtoS_0xEB_ModifyTradeWindow || originalPak is StoC_0xEA_TradeWindow || originalPak is CtoS_0xD8_DetailDisplayRequest)) // activate condition return false; IList slots = new ArrayList(); if (originalPak is CtoS_0xDD_PlayerMoveItemRequest) { if ((originalPak as CtoS_0xDD_PlayerMoveItemRequest).FromSlot < 1000) slots.Add((ushort)(originalPak as CtoS_0xDD_PlayerMoveItemRequest).FromSlot); if ((originalPak as CtoS_0xDD_PlayerMoveItemRequest).ToSlot <= 250 && (originalPak as CtoS_0xDD_PlayerMoveItemRequest).ToSlot > 1) slots.Add((ushort)(originalPak as CtoS_0xDD_PlayerMoveItemRequest).ToSlot); } else if (originalPak is CtoS_0x0C_HouseItemPlacementRequest) { slots.Add((ushort)(originalPak as CtoS_0x0C_HouseItemPlacementRequest).Slot); } else if (originalPak is CtoS_0x41_UseNewQuestItem) { slots.Add((ushort)(originalPak as CtoS_0x41_UseNewQuestItem).GoalIndex); } else if (originalPak is CtoS_0x71_UseItem) { slots.Add((ushort)(originalPak as CtoS_0x71_UseItem).Slot); } else if (originalPak is CtoS_0x79_SellItem) { slots.Add((ushort)(originalPak as CtoS_0x79_SellItem).Slot); } else if (originalPak is CtoS_0x80_DestroyInventoryItem) { slots.Add((ushort)(originalPak as CtoS_0x80_DestroyInventoryItem).Slot); } else if (originalPak is CtoS_0xE0_AppraiseItem) { slots.Add((ushort)(originalPak as CtoS_0xE0_AppraiseItem).Slot); } else if (originalPak is StoC_0xEA_TradeWindow) { foreach(byte slot in ((byte[])(originalPak as StoC_0xEA_TradeWindow).Slots)) { if (slot != 0) slots.Add((ushort)slot); } } else if (originalPak is CtoS_0xEB_ModifyTradeWindow) { foreach(byte slot in ((byte[])(originalPak as CtoS_0xEB_ModifyTradeWindow).Slots)) { if (slot != 0) slots.Add((ushort)slot); } } else if (originalPak is CtoS_0xD8_DetailDisplayRequest) { if ((originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectType == 1) { slots.Add((ushort)(originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectId); } } if (slots.Count == 0) return false; TimeSpan zeroTimeSpan = new TimeSpan(0); StringBuilder str = new StringBuilder(); // int additionStringCount = 0; str.Append(originalPak.ToHumanReadableString(zeroTimeSpan, true)); str.Append('\n'); for (int i = selectedIndex; i >= 0 ; i--) { Packet pak = log[i]; if ((originalPak is CtoS_0xDD_PlayerMoveItemRequest || originalPak is CtoS_0x79_SellItem || originalPak is CtoS_0xE0_AppraiseItem || originalPak is CtoS_0x71_UseItem || originalPak is CtoS_0x80_DestroyInventoryItem || originalPak is CtoS_0x0C_HouseItemPlacementRequest || originalPak is CtoS_0xEB_ModifyTradeWindow || originalPak is StoC_0xEA_TradeWindow || originalPak is CtoS_0xD8_DetailDisplayRequest)) { if (pak is StoC_0x02_InventoryUpdate) { StoC_0x02_InventoryUpdate itemsPak = (pak as StoC_0x02_InventoryUpdate); for (int j = 0; j < itemsPak.SlotsCount; j++) { StoC_0x02_InventoryUpdate.Item item = itemsPak.Items[j]; int slotIndex = 0; do { if (slotIndex < slots.Count) { ushort slot = (ushort)slots[slotIndex]; if (item.slot == slot) { str.AppendFormat("\nslot:{0,-3} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"", item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name); if (item.name != null && item.name != "") str.AppendFormat(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType); str.Append("\n"); slots.RemoveAt(slotIndex); break; } } slotIndex++; } while (slotIndex < slots.Count); if (slots.Count == 0) break; } if (slots.Count == 0) break; } } else if (originalPak is CtoS_0x41_UseNewQuestItem) { if (pak is StoC_0x83_QuestUpdate_186) { StoC_0x83_QuestUpdate_186.NewQuestUpdate_186 newQuest = (pak as StoC_0x83_QuestUpdate_186).SubData as StoC_0x83_QuestUpdate_186.NewQuestUpdate_186; if (newQuest != null && newQuest.index == (originalPak as CtoS_0x41_UseNewQuestItem).QuestIndex && newQuest.goalsCount > (ushort)slots[0]) { StoC_0x02_InventoryUpdate.Item item = newQuest.goalItems[(ushort)slots[0]]; str.AppendFormat("\nslot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} flag:0x{15:X2} extension:{16} \"{17}\"", item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.flag, item.extension, item.name); if (item.name != null && item.name != "") str.AppendFormat(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType); if ((item.flag & 0x08) == 0x08) str.AppendFormat("\n\t\teffectIcon:0x{0:X4} effectName:\"{1}\"", item.effectIcon, item.effectName); if ((item.flag & 0x10) == 0x10) str.AppendFormat("\n\t\teffectIcon2:0x{0:X4} effectName2:\"{1}\"", item.effectIcon2, item.effectName2); break; } } } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Use skill/Cast spell info (right click to close)"; infoWindow.Width = 800; infoWindow.Height = 200; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; Packet originalPak = log[selectedIndex]; if (!(originalPak is CtoS_0xBB_UseSkill || originalPak is CtoS_0x7D_UseSpellList || originalPak is CtoS_0xD8_DetailDisplayRequest)) // activate condition return false; int spellIndex = -1; int spellLineIndex = -1; if (originalPak is CtoS_0xBB_UseSkill) spellIndex = (originalPak as CtoS_0xBB_UseSkill).Index; else if (originalPak is CtoS_0x7D_UseSpellList) { spellLineIndex = (originalPak as CtoS_0x7D_UseSpellList).SpellLineIndex; spellIndex = (originalPak as CtoS_0x7D_UseSpellList).SpellLevel; } else if (originalPak is CtoS_0xD8_DetailDisplayRequest) { switch((originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectType) { case 2: spellLineIndex = (originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectId / 100; spellIndex = (originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectId % 100; break; default: return false; } } else return false; StringBuilder str = new StringBuilder(); IList skillList = new ArrayList(); int additionStringCount = 0; ushort spellIcon = 0xFFFF; string spellName = "UNKNOWN"; bool searchInSpellEffects = false; str.Append(originalPak.ToHumanReadableString(TimeSpan.Zero, true)); str.Append('\n'); for (int i = selectedIndex; i >= 0 ; i--) { Packet pak = log[i]; if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate variousPak = (pak as StoC_0x16_VariousUpdate); if (originalPak is CtoS_0xBB_UseSkill) { if (variousPak.SubCode == 1) { StoC_0x16_VariousUpdate.SkillsUpdate data = (variousPak.SubData as StoC_0x16_VariousUpdate.SkillsUpdate); for (int j = variousPak.SubCount - 1; j >= 0; j--) { StoC_0x16_VariousUpdate.Skill skill = data.data[j]; if ((originalPak as CtoS_0xBB_UseSkill).Type == 0 && (int)skill.page == 0) skillList.Add(skill); else if ((originalPak as CtoS_0xBB_UseSkill).Type == 1 && (int)skill.page > 0) skillList.Add(skill); } if (variousPak.StartIndex == 0) { int index = skillList.Count; int lineIndex = -1; string skillInfo = ""; foreach (StoC_0x16_VariousUpdate.Skill skill in skillList) { index--; if (index == spellIndex) { if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.Spells && skill.stlOpen != 0xFE) lineIndex = skill.stlOpen; if (log.Version >= 180) { if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.Styles) { str.AppendFormat("\nSpec:\"{0}\"", GetSpecNameFromInternalIndex(skill.bonus)); } } skillInfo = string.Format("\nlevel:{0,-2} type:{1}({2,-14}) stlOpen:0x{3:X4} bonus:{4,-2} icon:0x{5:X4} name:\"{6}\"\n", skill.level, (int)skill.page, skill.page.ToString().ToLower(), skill.stlOpen, skill.bonus, skill.icon, skill.name); spellIcon = skill.icon; spellName = skill.name; additionStringCount += 2; searchInSpellEffects = skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities || skill.page == StoC_0x16_VariousUpdate.eSkillPage.Spells || skill.page == StoC_0x16_VariousUpdate.eSkillPage.Songs; break; } } if (lineIndex >= 0) { index = 0; foreach (StoC_0x16_VariousUpdate.Skill skill in data.data) { if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.Specialization) { if (index++ == lineIndex) { str.AppendFormat("\nSpec:\"{0}\"", skill.name); // str.AppendFormat("\nlevel:{0,-2} type:{1}({2,-14}) stlOpen:0x{3:X4} bonus:{4,-2} icon:0x{5:X4} name:\"{6}\"\n", // skill.level, (int)skill.page, skill.page.ToString().ToLower(), skill.stlOpen, skill.bonus, skill.icon, skill.name); break; } } else break; } } str.Append(skillInfo); break; } } } else if (spellLineIndex >= 0) { if (variousPak.SubCode == 2) { StoC_0x16_VariousUpdate.SpellsListUpdate data = (variousPak.SubData as StoC_0x16_VariousUpdate.SpellsListUpdate); if (variousPak.StartIndex == spellLineIndex) { string spellLineName = ""; for (int j = 0; j < variousPak.SubCount; j++) { StoC_0x16_VariousUpdate.Spell spell = data.list[j]; if (spell.level == spellIndex) { str.AppendFormat("\nspellLineIndex:{0}(\"{4}\") spellLevel:{1,-2} icon:0x{2:X4} name:\"{3}\"\n", spellLineIndex, spell.level, spell.icon, spell.name, spellLineName); spellIcon = spell.icon; spellName = spell.name; searchInSpellEffects = true; additionStringCount += 2; break; } else if (spell.level == 0) spellLineName = spell.name; } } if (variousPak.SubType == 2 && variousPak.StartIndex == 0) // not this spell found in spellList break; } } } } if (searchInSpellEffects) { bool spellEffectFound = false; bool concEffectFound = false; for (int i = selectedIndex; i < log.Count ; i++) { Packet pak = log[i]; if (pak is StoC_0x7F_UpdateIcons) { if (spellEffectFound) continue; StoC_0x7F_UpdateIcons effectsPak = (pak as StoC_0x7F_UpdateIcons); if (effectsPak != null) { for (int j = 0; j < effectsPak.EffectsCount; j++) { if (effectsPak.Effects[j].name == spellName) { StoC_0x7F_UpdateIcons.Effect effect = effectsPak.Effects[j]; str.Append('\n'); str.Append(pak.ToHumanReadableString(TimeSpan.Zero, true)); str.Append('\n'); spellIcon = effect.icon; additionStringCount += (2 + effectsPak.EffectsCount); spellEffectFound = true; break; } } if (spellEffectFound && concEffectFound) break; } } else if (pak is StoC_0x75_SetConcentrationList) { if (concEffectFound) continue; if (spellIcon != 0xFFFF) { StoC_0x75_SetConcentrationList concPak = (pak as StoC_0x75_SetConcentrationList); if (concPak != null) { for (int j = 0; j < concPak.EffectsCount; j++) { if (concPak.Effects[j].icon == spellIcon) { // if (concPak.Effects[j].effectName.Substring(10) != spellName.Substring(10)) continue; StoC_0x75_SetConcentrationList.ConcentrationEffect effect = concPak.Effects[j]; str.AppendFormat("\nCONC index:{0,-2} conc:{1,-2} icon:0x{2:X4} ownerName:\"{3}\" effectName:\"{4}\"", effect.index, effect.concentration, effect.icon, effect.ownerName, effect.effectName); str.Append('\n'); additionStringCount += (2 + concPak.EffectsCount); concEffectFound = true; break; } } if (/*spellEffectFound && */concEffectFound) // conc packet always after effect packet, so we can break on conc packet break; } } } } } if (spellName != "UNKNOWN") additionStringCount += FormInfoString(log, selectedIndex, str, spellIcon, spellName); InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Use skill/Cast spell info (right click to close)"; infoWindow.Width = 800; infoWindow.Height = 100; infoWindow.Height += 14 * additionStringCount; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; Packet originalPak = log[selectedIndex]; if (!(originalPak is CtoS_0xDD_PlayerMoveItemRequest || originalPak is CtoS_0x79_SellItem || originalPak is CtoS_0xE0_AppraiseItem || originalPak is CtoS_0x71_UseItem || originalPak is CtoS_0x80_DestroyInventoryItem || originalPak is CtoS_0x41_UseNewQuestItem || originalPak is CtoS_0x0C_HouseItemPlacementRequest || originalPak is CtoS_0xEB_ModifyTradeWindow || originalPak is StoC_0xEA_TradeWindow || originalPak is CtoS_0xD8_DetailDisplayRequest)) // activate condition { return(false); } IList slots = new ArrayList(); if (originalPak is CtoS_0xDD_PlayerMoveItemRequest) { if ((originalPak as CtoS_0xDD_PlayerMoveItemRequest).FromSlot < 1000) { slots.Add((ushort)(originalPak as CtoS_0xDD_PlayerMoveItemRequest).FromSlot); } if ((originalPak as CtoS_0xDD_PlayerMoveItemRequest).ToSlot <= 250 && (originalPak as CtoS_0xDD_PlayerMoveItemRequest).ToSlot > 1) { slots.Add((ushort)(originalPak as CtoS_0xDD_PlayerMoveItemRequest).ToSlot); } } else if (originalPak is CtoS_0x0C_HouseItemPlacementRequest) { slots.Add((ushort)(originalPak as CtoS_0x0C_HouseItemPlacementRequest).Slot); } else if (originalPak is CtoS_0x41_UseNewQuestItem) { slots.Add((ushort)(originalPak as CtoS_0x41_UseNewQuestItem).GoalIndex); } else if (originalPak is CtoS_0x71_UseItem) { slots.Add((ushort)(originalPak as CtoS_0x71_UseItem).Slot); } else if (originalPak is CtoS_0x79_SellItem) { slots.Add((ushort)(originalPak as CtoS_0x79_SellItem).Slot); } else if (originalPak is CtoS_0x80_DestroyInventoryItem) { slots.Add((ushort)(originalPak as CtoS_0x80_DestroyInventoryItem).Slot); } else if (originalPak is CtoS_0xE0_AppraiseItem) { slots.Add((ushort)(originalPak as CtoS_0xE0_AppraiseItem).Slot); } else if (originalPak is StoC_0xEA_TradeWindow) { foreach (byte slot in ((byte[])(originalPak as StoC_0xEA_TradeWindow).Slots)) { if (slot != 0) { slots.Add((ushort)slot); } } } else if (originalPak is CtoS_0xEB_ModifyTradeWindow) { foreach (byte slot in ((byte[])(originalPak as CtoS_0xEB_ModifyTradeWindow).Slots)) { if (slot != 0) { slots.Add((ushort)slot); } } } else if (originalPak is CtoS_0xD8_DetailDisplayRequest) { if ((originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectType == 1) { slots.Add((ushort)(originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectId); } } if (slots.Count == 0) { return(false); } TimeSpan zeroTimeSpan = new TimeSpan(0); StringBuilder str = new StringBuilder(); // int additionStringCount = 0; str.Append(originalPak.ToHumanReadableString(zeroTimeSpan, true)); str.Append('\n'); for (int i = selectedIndex; i >= 0; i--) { Packet pak = log[i]; if ((originalPak is CtoS_0xDD_PlayerMoveItemRequest || originalPak is CtoS_0x79_SellItem || originalPak is CtoS_0xE0_AppraiseItem || originalPak is CtoS_0x71_UseItem || originalPak is CtoS_0x80_DestroyInventoryItem || originalPak is CtoS_0x0C_HouseItemPlacementRequest || originalPak is CtoS_0xEB_ModifyTradeWindow || originalPak is StoC_0xEA_TradeWindow || originalPak is CtoS_0xD8_DetailDisplayRequest)) { if (pak is StoC_0x02_InventoryUpdate) { StoC_0x02_InventoryUpdate itemsPak = (pak as StoC_0x02_InventoryUpdate); for (int j = 0; j < itemsPak.SlotsCount; j++) { StoC_0x02_InventoryUpdate.Item item = itemsPak.Items[j]; int slotIndex = 0; do { if (slotIndex < slots.Count) { ushort slot = (ushort)slots[slotIndex]; if (item.slot == slot) { str.AppendFormat("\nslot:{0,-3} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"", item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name); if (item.name != null && item.name != "") { str.AppendFormat(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType); } str.Append("\n"); slots.RemoveAt(slotIndex); break; } } slotIndex++; }while (slotIndex < slots.Count); if (slots.Count == 0) { break; } } if (slots.Count == 0) { break; } } } else if (originalPak is CtoS_0x41_UseNewQuestItem) { if (pak is StoC_0x83_QuestUpdate_186) { StoC_0x83_QuestUpdate_186.NewQuestUpdate_186 newQuest = (pak as StoC_0x83_QuestUpdate_186).SubData as StoC_0x83_QuestUpdate_186.NewQuestUpdate_186; if (newQuest != null && newQuest.index == (originalPak as CtoS_0x41_UseNewQuestItem).QuestIndex && newQuest.goalsCount > (ushort)slots[0]) { StoC_0x02_InventoryUpdate.Item item = newQuest.goalItems[(ushort)slots[0]]; str.AppendFormat("\nslot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} flag:0x{15:X2} extension:{16} \"{17}\"", item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.flag, item.extension, item.name); if (item.name != null && item.name != "") { str.AppendFormat(" ({0})", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType); } if ((item.flag & 0x08) == 0x08) { str.AppendFormat("\n\t\teffectIcon:0x{0:X4} effectName:\"{1}\"", item.effectIcon, item.effectName); } if ((item.flag & 0x10) == 0x10) { str.AppendFormat("\n\t\teffectIcon2:0x{0:X4} effectName2:\"{1}\"", item.effectIcon2, item.effectName2); } break; } } } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Use skill/Cast spell info (right click to close)"; infoWindow.Width = 800; infoWindow.Height = 200; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); Hashtable plrInfo = MakeCombatList(selectedPacket.PacketIndex, log); StringBuilder str = new StringBuilder(); foreach (DictionaryEntry entry in plrInfo) { PlayerInfo plr = (PlayerInfo)entry.Value; if (plr != null) { // str.AppendFormat("key = {0}\n", entry.Key); int playerAttacks = plr.hit + plr.miss + plr.fumble + plr.failAttacks; int playerAttacked = plr.block + plr.evade + plr.parry + plr.attacked; if ((playerAttacks + playerAttacked) > 0) { str.AppendFormat("Level:{0} Name:{1} Class:{2} WS:{3} WeaponDamage:{4}\n", plr.level, plr.name, plr.className, plr.weaponSkill, plr.weaponDamage); str.AppendFormat("player->target\tHits:{0} ({8:0.00}%)\t Miss:{1} ({9:0.00}%)\t Fumble:{2} ({10:0.00}%)\t FailAttacks:{3} ({11:0.00}%)\ntarget->player\tParry:{4} ({12:0.00}%)\t Block:{5} ({13:0.00}%)\t Evade:{6} ({14:0.00}%)\t attacked:{7} ({15:0.00}%)\n\n", plr.hit, plr.miss, plr.fumble, plr.failAttacks, plr.parry, plr.block, plr.evade, plr.attacked, (plr.hit + plr.miss) > 0 ? 100.0 * plr.hit / (plr.hit + plr.miss) : 0, (plr.hit + plr.miss ) > 0 ? 100.0 * plr.miss / (plr.hit + plr.miss): 0, playerAttacks > 0 ? 100.0 * plr.fumble / playerAttacks : 0, playerAttacks > 0 ? 100.0 * plr.failAttacks / playerAttacks : 0, (playerAttacked - plr.evade) > 0 ? 100.0 * plr.parry / (playerAttacked - plr.evade) : 0, (playerAttacked - plr.parry - plr.evade) > 0 ? 100.0 * plr.block / (playerAttacked - plr.parry - plr.evade): 0, playerAttacked > 0 ? 100.0 * plr.evade / playerAttacked: 0, playerAttacked > 0 ? 100.0 * plr.attacked / playerAttacked: 0); } } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show weapon use statistics (right click to close)"; infoWindow.Width = 550; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; int MaxHealth = -1; int MaxPower = -1; int level = -1; int champ_level = -1; string className = ""; int classId = 0; bool flagFound = false; bool flagScarsOfBattleFound = false; bool flagSkillsChecked = false; StringBuilder str = new StringBuilder(); StoC_0xFB_CharStatsUpdate_175 charStats = null; int RASkillHPBonus = 0; int RASkillMPBonus = 0; for (int i = selectedIndex; i >= 0; i--) { Packet pak = log[i]; if (pak is StoC_0xFB_CharStatsUpdate_175) { if (charStats == null && (pak as StoC_0xFB_CharStatsUpdate_175).Flag != 0xFF) { charStats = pak as StoC_0xFB_CharStatsUpdate_175; if (MaxHealth == -1) { MaxHealth = charStats.MaxHealth; } } } else if (pak is CtoS_0x9D_RegionListRequest_174) { if (classId == 0 && (pak as CtoS_0x9D_RegionListRequest_174).Flag > 0) { classId = (pak as CtoS_0x9D_RegionListRequest_174).ClassId; } } else if (pak is StoC_0xAD_StatusUpdate_190) { if (MaxHealth == -1) { MaxHealth = (pak as StoC_0xAD_StatusUpdate_190).MaxHealth; } if (MaxPower == -1) { MaxPower = (pak as StoC_0xAD_StatusUpdate_190).MaxPower; } } else if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate stat = (StoC_0x16_VariousUpdate)pak; if (stat.SubCode == 3) { if (level == -1) { StoC_0x16_VariousUpdate.PlayerUpdate subData = (StoC_0x16_VariousUpdate.PlayerUpdate)stat.SubData; level = subData.playerLevel; if (className != subData.className) { for (int j = 0; j < ClassInfo.Length; j++) { // TODO check for realm, while it not too nessery, becose same class name on different realms have same same HPBase if ((string)ClassInfo[j][1] == subData.className) { classId = j; break; } } } className = subData.className; if (MaxHealth == -1) { MaxHealth = (((subData.maxHealthHigh & 0xFF) << 8) | (subData.maxHealthLow & 0xFF)); } // charName = subData.playerName; if (subData is StoC_0x16_VariousUpdate_179.PlayerUpdate_179) { champ_level = (subData as StoC_0x16_VariousUpdate_179.PlayerUpdate_179).championLevel; } } } else if (stat.SubCode == 1) { if (!flagSkillsChecked) { StoC_0x16_VariousUpdate.SkillsUpdate subData = (StoC_0x16_VariousUpdate.SkillsUpdate)stat.SubData; for (int j = (pak as StoC_0x16_VariousUpdate).SubCount - 1; j >= 0; j--) { bool flagPrintSkill = false; StoC_0x16_VariousUpdate.Skill skill = subData.data[j]; if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.StartsWith("Toughness ")) { switch (skill.name.Substring(10)) { case "I": RASkillHPBonus = 25; break; case "II": RASkillHPBonus = 75; break; case "III": RASkillHPBonus = 150; break; case "IV": RASkillHPBonus = 250; break; case "V": RASkillHPBonus = 400; break; default: RASkillHPBonus = 0; // something wrong... break; } flagPrintSkill = true; } else if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.StartsWith("Ethereal Bond ")) { switch (skill.name.Substring(14)) { case "I": RASkillMPBonus = 20; // +20 for scout (20) break; case "II": RASkillMPBonus = 50; // +30 for scout (50) break; case "III": RASkillMPBonus = 80; // +30 for scout (80) break; case "IV": RASkillMPBonus = 130; // +50 for scout (130) break; case "V": RASkillMPBonus = 200; // +70 for scout (200) break; default: RASkillMPBonus = 0; // something wrong... break; } flagPrintSkill = true; } else if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.StartsWith("Augmented Constitution ")) { flagPrintSkill = true; } else if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.StartsWith("Augmented Acuity ")) { flagPrintSkill = true; } else if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities && skill.name.Equals("Scars of Battle")) { flagPrintSkill = true; flagScarsOfBattleFound = true; } if (flagPrintSkill) { str.AppendFormat("level:{0,-2} type:{1}({2,-14}) stlOpen:0x{3:X4} bonus:{4,-2} icon:0x{5:X4} name:\"{6}\"\n", skill.level, (int)skill.page, skill.page.ToString().ToLower(), skill.stlOpen, skill.bonus, skill.icon, skill.name); } } if ((pak as StoC_0x16_VariousUpdate).StartIndex == 0) // not found any RA { flagSkillsChecked = true; } } } } if (charStats != null && level != -1 && classId != 0 && flagSkillsChecked) { flagFound = true; break; } } if (flagFound) { bool flagPureCaster = (bool)ClassInfo[classId][4]; str.Append(charStats.GetPacketDataString(true)); str.Append('\n'); str.Append('\n'); str.AppendFormat("class:{0}({1}) level:{2} PureCaster:{3}", classId, className, level, flagPureCaster); if (champ_level > -1) { str.AppendFormat(" champLevel:{0}", champ_level); } str.Append('\n'); str.AppendFormat("ManaStat:{0}", (eManaStat)ClassInfo[classId][3]); int ManaStat = 0; int ManaStatBuffBonus = 0; int ManaStatItemBonus = 0; int ManaStatRealmAbilitiesBonus = 0; switch ((eManaStat)ClassInfo[classId][3]) { case eManaStat.Intelligence: ManaStat = charStats.@int; ManaStatBuffBonus = charStats.B_int; ManaStatItemBonus = Math.Min(charStats.I_int, charStats.C_int); ManaStatRealmAbilitiesBonus = charStats.R_int; break; case eManaStat.Piety: ManaStat = charStats.pie; ManaStatBuffBonus = charStats.B_pie; ManaStatItemBonus = Math.Min(charStats.I_pie, charStats.C_pie); ManaStatRealmAbilitiesBonus = charStats.R_pie; break; case eManaStat.Empathy: ManaStat = charStats.emp; ManaStatBuffBonus = charStats.B_emp; ManaStatItemBonus = Math.Min(charStats.I_emp, charStats.C_emp); ManaStatRealmAbilitiesBonus = charStats.R_emp; break; case eManaStat.Charisma: ManaStat = charStats.chr; ManaStatBuffBonus = charStats.B_chr; ManaStatItemBonus = Math.Min(charStats.I_chr, charStats.C_chr); ManaStatRealmAbilitiesBonus = charStats.R_chr; break; default: break; } if (ManaStat != 0) { str.AppendFormat(":{0}", ManaStat); } // ManaStat += (int)(ManaStatRealmAbilitiesBonus * 1.2); if (ManaStatRealmAbilitiesBonus != 0) { str.AppendFormat(" RA_ManaStat:{0}", ManaStatRealmAbilitiesBonus); } // ManaStat += ManaStatBuffBonus; if (ManaStatBuffBonus != 0) { str.AppendFormat(" BuffBonus:{0}", ManaStatBuffBonus); } ManaStat += (int)(ManaStatItemBonus * 1.2); if (ManaStatItemBonus != 0) { str.AppendFormat(" ItemBonus:{0}", ManaStatItemBonus); } if (RASkillMPBonus != 0) { str.AppendFormat(" RealmAbilitiesMana:{0}", RASkillMPBonus); } str.Append('\n'); int Constitution = charStats.con; str.AppendFormat("classBaseHP:{0} CON:{1}", (int)ClassInfo[classId][2], charStats.con); if (classId == 58) // Vampiir { str.AppendFormat(" VampBonus CON:{0}(calced:{1})", charStats.Flag * 3, (level - 5) * 3); Constitution += charStats.Flag * 3; } int RealmAbilitiesBonusConstitution = charStats.R_con; Constitution += RealmAbilitiesBonusConstitution; if (RealmAbilitiesBonusConstitution != 0) { str.AppendFormat(" RA_CON:{0}", RealmAbilitiesBonusConstitution); } int BuffBonusConstitution = charStats.B_con; Constitution += BuffBonusConstitution; if (BuffBonusConstitution != 0) { str.AppendFormat(" BuffBonus:{0}", BuffBonusConstitution); } int ItemBonusConstitution = Math.Min(charStats.I_con, charStats.C_con); Constitution += ItemBonusConstitution; if (ItemBonusConstitution != 0) { str.AppendFormat(" ItemBonus:{0}", ItemBonusConstitution); } if (RASkillHPBonus != 0) { str.AppendFormat(" RealmAbilitiesHP:{0}", RASkillHPBonus); } int ItemBonusHits = 0; int MaxHealthCalculated = CalculateMaxHealth(level, Constitution, (int)ClassInfo[classId][2], champ_level); if (flagScarsOfBattleFound) { int HeavyTankBonusHP = (int)(MaxHealthCalculated * (1.0 + (level - 40) * 0.01)); str.AppendFormat(" HeavyTankBonusHP:{0}", HeavyTankBonusHP - MaxHealthCalculated); MaxHealthCalculated = HeavyTankBonusHP; } str.Append('\n'); MaxHealthCalculated += ItemBonusHits + RASkillHPBonus; int MaxManaCalculated = CalculateMaxMana(level, ManaStat, champ_level, flagPureCaster, str); str.AppendFormat("HP:{0} CalcedHP:{1}(calcedCON:{2})\n", MaxHealth, MaxHealthCalculated, Constitution); str.AppendFormat("MaxMana:{0} CalcedMaxMana:{1}(ManaStat:{2})\n", MaxPower, MaxManaCalculated, ManaStat); int insertPos = str.Length; int ItemHitsBonus = 0; int ItemHitsBonusCap = 0; int ItemPowerBonus = 0; int ItemPowerPoolBonus = 0; int ItemPowerPoolCapBonus = 0; CheckItemsHitsBonus(log, selectedIndex, str, ref ItemHitsBonus, ref ItemHitsBonusCap, ref ItemPowerBonus, ref ItemPowerPoolBonus, ref ItemPowerPoolCapBonus); str.Insert(insertPos, string.Format("\nCalcedMP:{0} ItemBonusPower:{1} ItemBonusPowerPool:{2} (+cap:{3})\n", (int)((MaxManaCalculated + ItemPowerBonus) * (1 + 0.01 * ItemPowerPoolBonus)) + RASkillMPBonus + ManaStatRealmAbilitiesBonus * 1.2, ItemPowerBonus, ItemPowerPoolBonus, ItemPowerPoolCapBonus)); if (MaxHealthCalculated != MaxHealth) { int CapItemBonusHits = ItemHitsBonusCap + level * 4; if (MaxHealth - MaxHealthCalculated - Math.Min(ItemHitsBonus, CapItemBonusHits) == 0) { str.Insert(insertPos, string.Format("\nCalcedHP:{2} ItemBonusHits:{0} (+cap:{1})", Math.Min(ItemHitsBonus, CapItemBonusHits), ItemHitsBonusCap, MaxHealthCalculated + Math.Min(ItemHitsBonus, CapItemBonusHits))); } else { str.Insert(insertPos, string.Format("\nCalcedHP:{3} unknown Hits:{0}, ItemBonusHits:{1} (+cap:{2})", MaxHealth - MaxHealthCalculated - Math.Min(ItemHitsBonus, CapItemBonusHits), Math.Min(ItemHitsBonus, CapItemBonusHits), ItemHitsBonusCap, MaxHealthCalculated + Math.Min(ItemHitsBonus, CapItemBonusHits))); } } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player calc info (right click to close)"; infoWindow.Width = 820; infoWindow.Height = 320; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; Packet originalPak = log[selectedIndex]; if (!(originalPak is CtoS_0xBB_UseSkill || originalPak is CtoS_0x7D_UseSpellList || originalPak is CtoS_0xD8_DetailDisplayRequest)) // activate condition { return(false); } int spellIndex = -1; int spellLineIndex = -1; if (originalPak is CtoS_0xBB_UseSkill) { spellIndex = (originalPak as CtoS_0xBB_UseSkill).Index; } else if (originalPak is CtoS_0x7D_UseSpellList) { spellLineIndex = (originalPak as CtoS_0x7D_UseSpellList).SpellLineIndex; spellIndex = (originalPak as CtoS_0x7D_UseSpellList).SpellLevel; } else if (originalPak is CtoS_0xD8_DetailDisplayRequest) { switch ((originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectType) { case 2: spellLineIndex = (originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectId / 100; spellIndex = (originalPak as CtoS_0xD8_DetailDisplayRequest).ObjectId % 100; break; default: return(false); } } else { return(false); } StringBuilder str = new StringBuilder(); IList skillList = new ArrayList(); int additionStringCount = 0; ushort spellIcon = 0xFFFF; string spellName = "UNKNOWN"; bool searchInSpellEffects = false; str.Append(originalPak.ToHumanReadableString(TimeSpan.Zero, true)); str.Append('\n'); for (int i = selectedIndex; i >= 0; i--) { Packet pak = log[i]; if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate variousPak = (pak as StoC_0x16_VariousUpdate); if (originalPak is CtoS_0xBB_UseSkill) { if (variousPak.SubCode == 1) { StoC_0x16_VariousUpdate.SkillsUpdate data = (variousPak.SubData as StoC_0x16_VariousUpdate.SkillsUpdate); for (int j = variousPak.SubCount - 1; j >= 0; j--) { StoC_0x16_VariousUpdate.Skill skill = data.data[j]; if ((originalPak as CtoS_0xBB_UseSkill).Type == 0 && (int)skill.page == 0) { skillList.Add(skill); } else if ((originalPak as CtoS_0xBB_UseSkill).Type == 1 && (int)skill.page > 0) { skillList.Add(skill); } } if (variousPak.StartIndex == 0) { int index = skillList.Count; int lineIndex = -1; string skillInfo = ""; foreach (StoC_0x16_VariousUpdate.Skill skill in skillList) { index--; if (index == spellIndex) { if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.Spells && skill.stlOpen != 0xFE) { lineIndex = skill.stlOpen; } if (log.Version >= 180) { if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.Styles) { str.AppendFormat("\nSpec:\"{0}\"", GetSpecNameFromInternalIndex(skill.bonus)); } } skillInfo = string.Format("\nlevel:{0,-2} type:{1}({2,-14}) stlOpen:0x{3:X4} bonus:{4,-2} icon:0x{5:X4} name:\"{6}\"\n", skill.level, (int)skill.page, skill.page.ToString().ToLower(), skill.stlOpen, skill.bonus, skill.icon, skill.name); spellIcon = skill.icon; spellName = skill.name; additionStringCount += 2; searchInSpellEffects = skill.page == StoC_0x16_VariousUpdate.eSkillPage.RealmAbilities || skill.page == StoC_0x16_VariousUpdate.eSkillPage.Spells || skill.page == StoC_0x16_VariousUpdate.eSkillPage.Songs; break; } } if (lineIndex >= 0) { index = 0; foreach (StoC_0x16_VariousUpdate.Skill skill in data.data) { if (skill.page == StoC_0x16_VariousUpdate.eSkillPage.Specialization) { if (index++ == lineIndex) { str.AppendFormat("\nSpec:\"{0}\"", skill.name); // str.AppendFormat("\nlevel:{0,-2} type:{1}({2,-14}) stlOpen:0x{3:X4} bonus:{4,-2} icon:0x{5:X4} name:\"{6}\"\n", // skill.level, (int)skill.page, skill.page.ToString().ToLower(), skill.stlOpen, skill.bonus, skill.icon, skill.name); break; } } else { break; } } } str.Append(skillInfo); break; } } } else if (spellLineIndex >= 0) { if (variousPak.SubCode == 2) { StoC_0x16_VariousUpdate.SpellsListUpdate data = (variousPak.SubData as StoC_0x16_VariousUpdate.SpellsListUpdate); if (variousPak.StartIndex == spellLineIndex) { string spellLineName = ""; for (int j = 0; j < variousPak.SubCount; j++) { StoC_0x16_VariousUpdate.Spell spell = data.list[j]; if (spell.level == spellIndex) { str.AppendFormat("\nspellLineIndex:{0}(\"{4}\") spellLevel:{1,-2} icon:0x{2:X4} name:\"{3}\"\n", spellLineIndex, spell.level, spell.icon, spell.name, spellLineName); spellIcon = spell.icon; spellName = spell.name; searchInSpellEffects = true; additionStringCount += 2; break; } else if (spell.level == 0) { spellLineName = spell.name; } } } if (variousPak.SubType == 2 && variousPak.StartIndex == 0) // not this spell found in spellList { break; } } } } } if (searchInSpellEffects) { bool spellEffectFound = false; bool concEffectFound = false; for (int i = selectedIndex; i < log.Count; i++) { Packet pak = log[i]; if (pak is StoC_0x7F_UpdateIcons) { if (spellEffectFound) { continue; } StoC_0x7F_UpdateIcons effectsPak = (pak as StoC_0x7F_UpdateIcons); if (effectsPak != null) { for (int j = 0; j < effectsPak.EffectsCount; j++) { if (effectsPak.Effects[j].name == spellName) { StoC_0x7F_UpdateIcons.Effect effect = effectsPak.Effects[j]; str.Append('\n'); str.Append(pak.ToHumanReadableString(TimeSpan.Zero, true)); str.Append('\n'); spellIcon = effect.icon; additionStringCount += (2 + effectsPak.EffectsCount); spellEffectFound = true; break; } } if (spellEffectFound && concEffectFound) { break; } } } else if (pak is StoC_0x75_SetConcentrationList) { if (concEffectFound) { continue; } if (spellIcon != 0xFFFF) { StoC_0x75_SetConcentrationList concPak = (pak as StoC_0x75_SetConcentrationList); if (concPak != null) { for (int j = 0; j < concPak.EffectsCount; j++) { if (concPak.Effects[j].icon == spellIcon) { // if (concPak.Effects[j].effectName.Substring(10) != spellName.Substring(10)) continue; StoC_0x75_SetConcentrationList.ConcentrationEffect effect = concPak.Effects[j]; str.AppendFormat("\nCONC index:{0,-2} conc:{1,-2} icon:0x{2:X4} ownerName:\"{3}\" effectName:\"{4}\"", effect.index, effect.concentration, effect.icon, effect.ownerName, effect.effectName); str.Append('\n'); additionStringCount += (2 + concPak.EffectsCount); concEffectFound = true; break; } } if (/*spellEffectFound && */ concEffectFound) // conc packet always after effect packet, so we can break on conc packet { break; } } } } } } if (spellName != "UNKNOWN") { additionStringCount += FormInfoString(log, selectedIndex, str, spellIcon, spellName); } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Use skill/Cast spell info (right click to close)"; infoWindow.Width = 800; infoWindow.Height = 100; infoWindow.Height += 14 * additionStringCount; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; ushort sessionId = 0; ushort[] objectIds = null; ushort[] keepIds = null; ushort houseId = 0; Packet pak = log[selectedIndex]; if (pak is IObjectIdPacket) { objectIds = (pak as IObjectIdPacket).ObjectIds; } if (pak is ISessionIdPacket) { sessionId = (pak as ISessionIdPacket).SessionId; } if (pak is IHouseIdPacket) { houseId = (pak as IHouseIdPacket).HouseId; } if (pak is IKeepIdPacket) { keepIds = (pak as IKeepIdPacket).KeepIds; } StringBuilder str = new StringBuilder(); if (sessionId == 0 && houseId == 0 && (objectIds == null || objectIds.Length == 0) && (keepIds == null || keepIds.Length == 0)) { str.AppendFormat("packet not have any ID\n"); } if (sessionId > 0) { str.Append(MakeSidInfo(log, selectedIndex, sessionId)); } if (houseId > 0) { str.Append(MakeHidInfo(log, selectedIndex, houseId)); } if (objectIds != null && objectIds.Length > 0) { for (int i = 0; i < objectIds.Length; i++) { if (objectIds[i] > 0) { str.Append(MakeOidInfo(log, selectedIndex, objectIds[i], 0, 0)); } } } if (keepIds != null && keepIds.Length > 0) { for (int i = 0; i < keepIds.Length; i++) { if (keepIds[i] > 0) { str.Append(MakeOidInfo(log, selectedIndex, 0xFFFF, 0, keepIds[i])); } } // str.Append(MakeKidInfo(log, selectedIndex, keepIds[i])); } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show info about Objects (right click to close)"; infoWindow.Width = 620; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { int currentRegion; int currentZone; PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); SortedList oidInfo = MakeOidList(selectedPacket.PacketIndex, log, out currentRegion, out currentZone); StringBuilder str = new StringBuilder(); str.AppendFormat("Info for region {0}, zone {1}\n\n", currentRegion, currentZone); foreach (DictionaryEntry entry in oidInfo) { ushort oid = (ushort)entry.Key; ObjectInfo objectInfo = (ObjectInfo)entry.Value; str.AppendFormat("0x{0:X4}: {1}\n", oid, objectInfo.ToString()); } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Show known Oids (right click to close)"; infoWindow.Width = 550; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; string charName = ""; GroupMemberInfo[] groupMembers = new GroupMemberInfo[8]; for (int i = 0; i <= selectedIndex; i++) { Packet pak = log[i]; if (pak is CtoS_0x10_CharacterSelectRequest) { CtoS_0x10_CharacterSelectRequest login = (CtoS_0x10_CharacterSelectRequest)pak; charName = login.CharName; } else if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate groupPak = (StoC_0x16_VariousUpdate)pak; if (groupPak.SubCode == 3) { StoC_0x16_VariousUpdate.PlayerUpdate subData = (StoC_0x16_VariousUpdate.PlayerUpdate)groupPak.SubData; charName = subData.playerName; } else if (groupPak.SubCode == 6) // group update { StoC_0x16_VariousUpdate.PlayerGroupUpdate grpUpdate = groupPak.InPlayerGroupUpdate; if (grpUpdate != null) { for (int grpIndex = 0; grpIndex < 8; grpIndex++) { if (grpUpdate.groupMembers.Length > grpIndex) { if (groupMembers[grpIndex] == null) { groupMembers[grpIndex] = new GroupMemberInfo(); } groupMembers[grpIndex].groupMember = grpUpdate.groupMembers[grpIndex]; groupMembers[grpIndex].flag_0x16_UpdateIsLast = true; groupMembers[grpIndex].flagMemberInGroup = true; } else { if (groupMembers[grpIndex] != null) { groupMembers[grpIndex].flagMemberInGroup = false; } } } } } } else if (pak is StoC_0x70_PlayerGroupUpdate) { StoC_0x70_PlayerGroupUpdate groupPak = (StoC_0x70_PlayerGroupUpdate)pak; foreach (object o in groupPak.Updates) { if (o is StoC_0x70_PlayerGroupUpdate.PlayerStatusData) { StoC_0x70_PlayerGroupUpdate.PlayerStatusData stat = o as StoC_0x70_PlayerGroupUpdate.PlayerStatusData; if (groupMembers[stat.playerIndex] == null) { groupMembers[stat.playerIndex] = new GroupMemberInfo(); } groupMembers[stat.playerIndex].playerStatusData = stat; groupMembers[stat.playerIndex].flag_0x16_UpdateIsLast = false; } else if (o is StoC_0x70_PlayerGroupUpdate.PlayerBuffsData) { StoC_0x70_PlayerGroupUpdate.PlayerBuffsData buffs = o as StoC_0x70_PlayerGroupUpdate.PlayerBuffsData; if (groupMembers[buffs.playerIndex] == null) { groupMembers[buffs.playerIndex] = new GroupMemberInfo(); } groupMembers[buffs.playerIndex].playerBuffsData = buffs; } else if (o is StoC_0x70_PlayerGroupUpdate_173.PlayerMapData) { StoC_0x70_PlayerGroupUpdate_173.PlayerMapData map = o as StoC_0x70_PlayerGroupUpdate_173.PlayerMapData; if (groupMembers[map.player] == null) { groupMembers[map.player] = new GroupMemberInfo(); } groupMembers[map.player].playerMapData = map; } } } } StringBuilder str = new StringBuilder(); bool found = false; for (int i = 0; i < groupMembers.Length; i++) { if (groupMembers[i] != null) { bool flagMemberInfoPrinted = false; if (!groupMembers[i].flagMemberInGroup) { continue; } found = true; str.AppendFormat("player{0}: level:{1,-2} oid:0x{2:X4} class:\"{3}\"\t name:\"{4}\"", i, groupMembers[i].groupMember.level, groupMembers[i].groupMember.oid, groupMembers[i].groupMember.classname, groupMembers[i].groupMember.name); if (charName == groupMembers[i].groupMember.name) { str.Append(" (YOU)"); } str.Append("\n"); if (groupMembers[i].flag_0x16_UpdateIsLast) { str.AppendFormat("player{0}: health:{1,3}% mana:{2,3}% endurance:{3,3}% status:0x{4:X2}", i, groupMembers[i].groupMember.health, groupMembers[i].groupMember.mana, groupMembers[i].groupMember.endurance, groupMembers[i].groupMember.status); flagMemberInfoPrinted = true; str.Append("\n"); } if (groupMembers[i].playerStatusData != null && !flagMemberInfoPrinted) { str.Append(groupMembers[i].playerStatusData.ToString()); str.Append("\n"); } if (groupMembers[i].playerMapData != null) { str.Append(groupMembers[i].playerMapData.ToString()); str.Append("\n"); } if (groupMembers[i].playerBuffsData != null) { str.Append(groupMembers[i].playerBuffsData.ToString()); str.Append("\n"); } str.Append("\n"); } } if (!found) { str.Append("Group info not found\n"); } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player group info (right click to close)"; infoWindow.Width = 820; infoWindow.Height = 320; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; Packet[] quests = new Packet[26]; for (int i = 0; i < selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x83_QuestUpdate_186) { if ((pak as StoC_0x83_QuestUpdate_186).InNewQuestUpdate != null) { quests[((pak as StoC_0x83_QuestUpdate_186).InNewQuestUpdate).index] = pak; } else if ((pak as StoC_0x83_QuestUpdate).InQuestUpdate != null) { int index = ((pak as StoC_0x83_QuestUpdate).InQuestUpdate).index; if (((pak as StoC_0x83_QuestUpdate).InQuestUpdate).lenName == 0 && ((pak as StoC_0x83_QuestUpdate).InQuestUpdate).lenDesc == 0) { quests[index] = null; } else { quests[index] = pak; } } } else if (pak is StoC_0x83_QuestUpdate) { int index = ((pak as StoC_0x83_QuestUpdate).InQuestUpdate).index; if (((pak as StoC_0x83_QuestUpdate).InQuestUpdate).lenName == 0 && ((pak as StoC_0x83_QuestUpdate).InQuestUpdate).lenDesc == 0) { quests[index] = null; } else { quests[index] = pak; } } } StringBuilder str = new StringBuilder(); for (int i = 0; i < quests.Length; i++) { Packet pak = quests[i]; if (pak != null) { str.Append(pak.GetPacketDataString(true)); str.Append('\n'); } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player quest info (right click to close)"; infoWindow.Width = 820; infoWindow.Height = 320; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }
private void listSelectedButton_Click(object sender, EventArgs e) { InfoWindowForm info = new InfoWindowForm(); StringBuilder str = new StringBuilder(1024); bool found = false; for (int i = 0; i < Packet.MAX_CODE; i++) { if (stocCheckedListBox.GetItemChecked(i)) { if (!found) { found = true; str.Append("server to client packets:\n"); } str.AppendFormat("0x{0:X2} - ", i); string scDesc = DefaultPacketDescriptions.GetDescription(i, ePacketDirection.ClientToServer); str.Append(scDesc == null ? "unknown" : scDesc); str.Append("\n"); } } if (found) str.Append("\n\n"); found = false; for (int i = 0; i < Packet.MAX_CODE; i++) { if (ctosCheckedListBox.GetItemChecked(i)) { if (!found) { found = true; str.Append("client to server packets:\n"); } str.AppendFormat("0x{0:X2} - ", i); string csDesc = DefaultPacketDescriptions.GetDescription(i, ePacketDirection.ClientToServer); str.Append(csDesc == null ? "unknown" : csDesc); str.Append("\n"); } } if (found) str.Append("\n\n"); info.InfoRichTextBox.Text = str.ToString(); info.StartWindowThread(); }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; int VisibleSlots = 0xFF; int weaponSkill = -1; double DPS = -1; StoC_0x02_InventoryUpdate.Item[] weapons = new StoC_0x02_InventoryUpdate.Item[4]; Packet charStats = null; for (int i = 0; i < selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate stat = (StoC_0x16_VariousUpdate)pak; if (stat.SubCode == 5) { StoC_0x16_VariousUpdate.PlayerStateUpdate subData = (StoC_0x16_VariousUpdate.PlayerStateUpdate)stat.SubData; DPS = subData.weaponDamageHigh + 0.01 * subData.weaponDamageLow; weaponSkill = (subData.weaponSkillHigh << 8) + subData.weaponSkillLow; } } else if (pak is StoC_0xFB_CharStatsUpdate_175) { if ((pak as StoC_0xFB_CharStatsUpdate_175).Flag != 0xFF) charStats = pak; } else if (pak is StoC_0xFB_CharStatsUpdate) { charStats = pak; } else if (pak is StoC_0x02_InventoryUpdate) { StoC_0x02_InventoryUpdate invPack = (StoC_0x02_InventoryUpdate)pak; if (invPack.PreAction == 1 || invPack.PreAction == 0) { VisibleSlots = invPack.VisibleSlots; for (int j = 0; j < invPack.SlotsCount; j++) { StoC_0x02_InventoryUpdate.Item item = (StoC_0x02_InventoryUpdate.Item)invPack.Items[j]; switch (item.slot) { case 10: weapons[0] = item; // Logger.Say(string.Format("{16:X2}\tslot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"", // item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name, invPack.VisibleSlots)); break; case 11: weapons[1] = item; break; case 12: weapons[2] = item; break; case 13: weapons[3] = item; break; default: break; } } } } } StringBuilder str = new StringBuilder(); str.AppendFormat("Weapon damage = {0:0.00}\n", DPS); str.AppendFormat("Weapon skill = {0}\n", weaponSkill); if (charStats != null) { str.Append(charStats.GetPacketDataString(true)); str.AppendFormat("\n"); } str.AppendFormat("\n"); str.AppendFormat("Visible slots = 0x{0:X2}", VisibleSlots); str.AppendFormat("\n"); //((VisibleSlots & 0x0F) == 0) string weaponName1 = ""; string weaponName2 = ""; for (int i = 0; i < 4; i++) { if ((i == (VisibleSlots & 0x0F)) || (i == ((VisibleSlots >> 4) & 0x0F))) { StoC_0x02_InventoryUpdate.Item item = (StoC_0x02_InventoryUpdate.Item)weapons[i]; // str.AppendFormat("slot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"\n", // item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name); if (item.objectType == 42)//shield str.AppendFormat("slot:{0,-2} level:{1,-2} size:{2} con:{3,-3} qual:{4,-3} bonus:{5,-2} model:0x{6:X4} \"{7}\"", item.slot, item.level, item.value1, item.condition, item.quality, item.bonus, item.model, item.name); else str.AppendFormat("slot:{0,-2} level:{1,-2} dps:{2:0.00} spd:{3:0.00} damageType:{4} con:{5,-3} qual:{6,-3} bonus:{7,-2} model:0x{8:X4} \"{9}\"", item.slot, item.level, 0.1 * item.value1, 0.1 * item.value2, item.damageType, item.condition, item.quality, item.bonus, item.model, item.name); str.AppendFormat(" ({0})\n", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType); if (weaponName1 == "") weaponName1 = item.name; else if (item.name != weaponName1) weaponName2 = item.name; } } for (int i = 0; i < log.Count; i++) { if (weaponName1 == "" && weaponName2 == "") break; Packet pak = log[i]; if (pak is StoC_0xC4_CustomTextWindow) { if (weaponName1 != "" && (pak as StoC_0xC4_CustomTextWindow).Caption == weaponName1) { str.Append('\n'); str.Append(pak.GetPacketDataString(true)); weaponName1 = ""; } else if (weaponName2 != "" && (pak as StoC_0xC4_CustomTextWindow).Caption == weaponName2) { str.Append('\n'); str.Append(pak.GetPacketDataString(true)); weaponName2 = ""; } } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player weapon info (right click to close)"; infoWindow.Width = 800; if (charStats == null) infoWindow.Height = 300; else infoWindow.Height = 400; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public override bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; string serverName = "UNKNOWN"; int serverId = -1; int serverColorHandling = -1; int sessionId = -1; int objectId = -1; int petId = -1; int healthPercent = -1; int endurancePercent = -1; int manaPercent = -1; int concentrationPercent = -1; int speed = -1; int maxspeed = -1; int clientTargetOid = -1; int serverTargetOid = -1; int regionXOffset = 0; int regionYOffset = 0; int glocX = -1; int glocY = -1; int glocRegion = -1; string loc = "UNKNOWN"; string gloc = "UNKNOWN"; string state = ""; string charName = "UNKNOWN"; string lastName = ""; int playersInGroup = -1; int indexInGroup = -1; int mountId = -1; int mountSlot = -1; int level = -1; int mana = -1; int manaMax = -1; int health = -1; int healthMax = -1; int conc = -1; int concMax = -1; string className = "UNKNOWN"; string raceName = ""; int realm_level = -1; string realm_title = ""; int champ_level = -1; string champ_title = ""; int ml_level = -1; int houseLot = -1; string ml_title = ""; int guildID = -1; string guildName = "None"; string guildRank = ""; string enterRegionName = ""; string petInfo = ""; int insideHouseId = 0; Hashtable enterSubRegion = new Hashtable(); bool flagAwait0xA9 = false; for (int i = 0; i <= selectedIndex; i++) { Packet pak = log[i]; if (pak is CtoS_0xA9_PlayerPosition) { CtoS_0xA9_PlayerPosition pos = (CtoS_0xA9_PlayerPosition)pak; speed = pos.Status & 0x1FF; byte plrState = (byte)((pos.Status >> 10) & 7); state = plrState > 0 ? ((StoC_0xA9_PlayerPosition.PlrState)plrState).ToString() : ""; if ((pos.Status & 0x200) == 0x200) state += ",Backward"; if ((pos.Status & 0x8000) == 0x8000) state += ",StrafeRight"; if ((pos.Status & 0x4000) == 0x4000) state += ",StrafeLeft"; if ((pos.Status & 0x2000) == 0x2000) state += "Move"; if ((pos.Flag & 0x01) == 0x01) state += ",CtoS_0xA9_Flagx01"; if ((pos.Flag & 0x02) == 0x02) state += ",Underwater"; if ((pos.Flag & 0x04) == 0x04) state += ",PetInView"; if ((pos.Flag & 0x08) == 0x08) state += ",GT"; if ((pos.Flag & 0x10) == 0x10) state += ",CheckTargetInView"; if ((pos.Flag & 0x20) == 0x20) state += ",TargetInView"; if ((pos.Flag & 0x40) == 0x40) state += ",MoveTo"; if ((pos.Health & 0x80) == 0x80) state += ",Combat"; if ((pos.Speed & 0x8000) == 0x8000) state += ",FallDown"; loc = string.Format("({0,-3}): ({1,-6} {2,-6} {3,-5})", pos.CurrentZoneId, pos.CurrentZoneX, pos.CurrentZoneY, pos.CurrentZoneZ); if (flagAwait0xA9) { if (glocX != -1 && glocY != -1) { regionXOffset = glocX - pos.CurrentZoneX; regionYOffset = glocY - pos.CurrentZoneY; } flagAwait0xA9 = false; } gloc = string.Format("({0,-3}): ({1,-6} {2,-6} {3,-5})", glocRegion, regionXOffset + pos.CurrentZoneX, regionYOffset + pos.CurrentZoneY, pos.CurrentZoneZ); } else if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate stat = (StoC_0x16_VariousUpdate)pak; if (stat.SubCode == 3) { StoC_0x16_VariousUpdate.PlayerUpdate subData = (StoC_0x16_VariousUpdate.PlayerUpdate)stat.SubData; level = subData.playerLevel; className = subData.className; raceName = subData.raceName; healthMax = (ushort)(((subData.maxHealthHigh & 0xFF) << 8) | (subData.maxHealthLow & 0xFF)); realm_level = subData.realmLevel; realm_title = subData.realmTitle; ml_level = subData.mlLevel; ml_title = subData.mlTitle; houseLot = subData.personalHouse; guildName = subData.guildName; guildRank = subData.guildRank; lastName = subData.lastName; charName = subData.playerName; if (subData is StoC_0x16_VariousUpdate_179.PlayerUpdate_179) { champ_level = (subData as StoC_0x16_VariousUpdate_179.PlayerUpdate_179).championLevel; champ_title = (subData as StoC_0x16_VariousUpdate_179.PlayerUpdate_179).championTitle; } } else if (stat.SubCode == 6) { StoC_0x16_VariousUpdate.PlayerGroupUpdate subData = (StoC_0x16_VariousUpdate.PlayerGroupUpdate)stat.SubData; playersInGroup = stat.SubCount; for (int j = 0; j < stat.SubCount; j++) { StoC_0x16_VariousUpdate.GroupMember member = subData.groupMembers[j]; if (objectId >= 0 && objectId == member.oid) indexInGroup = j; } } } else if (pak is CtoS_0x10_CharacterSelectRequest) { CtoS_0x10_CharacterSelectRequest login = (CtoS_0x10_CharacterSelectRequest)pak; charName = login.CharName; } else if (pak is CtoS_0xB0_TargetChange) { CtoS_0xB0_TargetChange trg = (CtoS_0xB0_TargetChange)pak; clientTargetOid = trg.Oid; } else if (pak is StoC_0xAF_Message) { StoC_0xAF_Message msg = (StoC_0xAF_Message)pak; if (msg.Text.StartsWith("You have entered ")) { enterRegionName = regionNameFromMessage(msg.Text.Substring(17)); } else if (msg.Text.StartsWith("(Region) You have entered ")) { string enterSubRegionName = regionNameFromMessage(msg.Text.Substring(26)); if (!enterSubRegion.ContainsKey(enterSubRegionName)) enterSubRegion.Add(enterSubRegionName, enterSubRegionName); } else if (msg.Text.StartsWith("(Region) You have left ")) { string enterSubRegionName = regionNameFromMessage(msg.Text.Substring(23)); enterSubRegion.Remove(enterSubRegionName); } } else if (pak is StoC_0xF6_ChangeTarget) { StoC_0xF6_ChangeTarget trg = (StoC_0xF6_ChangeTarget)pak; serverTargetOid = trg.Oid; } else if (pak is StoC_0xB6_UpdateMaxSpeed) { StoC_0xB6_UpdateMaxSpeed spd = (StoC_0xB6_UpdateMaxSpeed)pak; maxspeed = spd.MaxSpeedPercent; } else if (pak is StoC_0xAD_StatusUpdate) { StoC_0xAD_StatusUpdate status = (StoC_0xAD_StatusUpdate)pak; healthPercent = status.HealthPercent; endurancePercent = status.EndurancePercent; manaPercent = status.ManaPercent; concentrationPercent = status.ConcentrationPercent; if (pak is StoC_0xAD_StatusUpdate_190) { health = (pak as StoC_0xAD_StatusUpdate_190).Health; healthMax = (pak as StoC_0xAD_StatusUpdate_190).MaxHealth; mana = (pak as StoC_0xAD_StatusUpdate_190).Power; manaMax = (pak as StoC_0xAD_StatusUpdate_190).MaxPower; conc = (pak as StoC_0xAD_StatusUpdate_190).Concentration; concMax = (pak as StoC_0xAD_StatusUpdate_190).MaxConcentration; } } else if (pak is StoC_0x28_SetSessionId) { StoC_0x28_SetSessionId session = (StoC_0x28_SetSessionId)pak; sessionId = session.SessionId; } else if (pak is StoC_0x20_PlayerPositionAndObjectID) { StoC_0x20_PlayerPositionAndObjectID posAndOid = (StoC_0x20_PlayerPositionAndObjectID)pak; objectId = posAndOid.PlayerOid; glocX = (int)posAndOid.X; glocY = (int)posAndOid.Y; if ((pak as StoC_0x20_PlayerPositionAndObjectID_171) != null) glocRegion = (pak as StoC_0x20_PlayerPositionAndObjectID_171).Region; loc = "UNKNOWN"; gloc = string.Format("({0,-3}): ({1,-6} {2,-6} {3,-5})", glocRegion, posAndOid.X, posAndOid.Y, posAndOid.Z); flagAwait0xA9 = true; enterSubRegion.Clear(); enterRegionName = ""; insideHouseId = 0; } else if (pak is StoC_0xDE_SetObjectGuildId) { StoC_0xDE_SetObjectGuildId guildId = (StoC_0xDE_SetObjectGuildId)pak; if (objectId == guildId.Oid) guildID = guildId.GuildId; if (guildId.ServerId == 0xFF) // set ObjectID for old logs (1.70-) objectId = guildId.Oid; } else if (pak is StoC_0x04_CharacterJump) { StoC_0x04_CharacterJump plrJump = (StoC_0x04_CharacterJump)pak; if (plrJump.X == 0 && plrJump.Y == 0 && plrJump.Z == 0) // skip /faceloc continue; objectId = plrJump.PlayerOid; glocX = (int)plrJump.X; glocY = (int)plrJump.Y; insideHouseId = plrJump.HouseId; loc = "UNKNOWN"; gloc = string.Format("({0,-3}): ({1,-6} {2,-6} {3,-5})", glocRegion, plrJump.X, plrJump.Y, plrJump.Z); flagAwait0xA9 = true; } else if (pak is StoC_0x88_PetWindowUpdate) { StoC_0x88_PetWindowUpdate pet = (StoC_0x88_PetWindowUpdate)pak; petId = pet.PetId; } else if (pak is StoC_0xDA_NpcCreate) { if (petId == -1) continue; StoC_0xDA_NpcCreate npc = (StoC_0xDA_NpcCreate)pak; if (npc.Oid != petId) continue; petInfo = string.Format(" \"{0}\" level:{1} model:0x{2:X4}", npc.Name, npc.Level, npc.Model); } else if (pak is StoC_0xC8_PlayerRide) { StoC_0xC8_PlayerRide ride = (StoC_0xC8_PlayerRide)pak; if (objectId >= 0 && objectId == ride.RiderOid) { if (ride.Flag == 0) { mountId = -1; mountSlot = -1; } else { mountId = ride.MountOid; mountSlot = ride.Slot; } } } else if (pak is StoC_0xFB_CharStatsUpdate_175) { if ((pak as StoC_0xFB_CharStatsUpdate_175).Flag != 0xFF) healthMax = (pak as StoC_0xFB_CharStatsUpdate_175).MaxHealth; } else if (pak is StoC_0xFB_CharStatsUpdate) { healthMax = (pak as StoC_0xFB_CharStatsUpdate).MaxHealth; } else if (pak is StoC_0x2A_LoginGranted) { StoC_0x2A_LoginGranted server = (StoC_0x2A_LoginGranted)pak; serverName = server.ServerName; serverId = server.ServerId; serverColorHandling = server.ColorHandling; } } int additionStrings = 0; StringBuilder str = new StringBuilder(); if (serverId > 0) { str.AppendFormat(" server: \"{0}\" id:0x{1:X2} color:{2}\n", serverName, serverId, serverColorHandling); additionStrings++; } str.AppendFormat("session id: 0x{0}\n", ValueToString(sessionId, "X4")); str.AppendFormat(" object id: 0x{0}\n", ValueToString(objectId, "X4")); str.AppendFormat(" pet id: 0x{0}{1}\n", ValueToString(petId, "X4"), petInfo); str.AppendFormat(" char name: {0}{1}\n", charName, lastName != "None" ? string.Format(" \"{0}\"", lastName) : ""); str.AppendFormat(" level: {0} {1}{2}\n", ValueToString(level), className, (raceName != "" ? " (" + raceName + ")" : "")); if (guildName != "None") { str.AppendFormat(" guild: {0}", guildName); str.AppendFormat(" rank:{0}", guildRank); if (guildID != -1) str.AppendFormat(" guildId:0x{0:X4}", guildID); str.AppendFormat("\n"); additionStrings++; } if (realm_level > 0) { str.AppendFormat("RealmLevel: {0} \"{1}\"\n", ValueToString(realm_level), realm_title); additionStrings++; } if (ml_level > 0) { str.AppendFormat(" ML level: {0} \"{1}\"\n", ValueToString(ml_level), ml_title); additionStrings++; } if (champ_level > 0) { str.AppendFormat("ChampLevel: {0} \"{1}\"\n", ValueToString(champ_level), champ_title); additionStrings++; } str.AppendFormat("\n"); if(houseLot > 0) { str.AppendFormat(" HouseLot: 0x{0}\n", ValueToString(houseLot, "X4")); additionStrings++; } if (mountId > 0) { str.AppendFormat(" mount id: 0x{0} (slot:{1})\n", ValueToString(mountId, "X4"), ValueToString(mountSlot)); additionStrings++; } if (playersInGroup > 0) { str.AppendFormat(" group: {0}[{1}]\n", ValueToString(indexInGroup), ValueToString(playersInGroup)); additionStrings++; } str.AppendFormat(" speed: {0,3}\n", ValueToString(speed)); str.AppendFormat(" maxSpeed: {0,3}%\n", ValueToString(maxspeed)); str.AppendFormat(" health: {0,3}%", ValueToString(healthPercent)); if (health != -1) str.AppendFormat(" ({0}/{1})", health, healthMax); else if (healthMax != -1) str.AppendFormat(" (maxHealth:{0})", healthMax); str.Append('\n'); str.AppendFormat(" mana: {0,3}%", ValueToString(manaPercent)); if (mana != -1) str.AppendFormat(" ({0}/{1})", mana, manaMax); str.Append('\n'); str.AppendFormat(" endurance: {0,3}%\n", ValueToString(endurancePercent)); str.AppendFormat("concentration: {0,3}%", ValueToString(concentrationPercent)); if (conc != -1) str.AppendFormat(" ({0}/{1})", conc, concMax); str.Append('\n'); str.AppendFormat(" clientTarget: 0x{0}\n", ValueToString(clientTargetOid, "X4")); str.AppendFormat(" checkTarget: 0x{0}\n", ValueToString(serverTargetOid, "X4")); str.AppendFormat(" current zone: {0}{1}\n", loc, enterRegionName == "" ? "" : " (" + enterRegionName + ")"); str.AppendFormat(" calced gloc: {0}\n", gloc); int subReg = 0; foreach (string subRegionName in enterSubRegion.Values) { str.AppendFormat(" subRegion[{0}]: {1}\n", subReg++, subRegionName); additionStrings++; } if (insideHouseId != 0) { str.AppendFormat(" inside House: {0}\n", insideHouseId); additionStrings++; } str.AppendFormat(" flags: {0}\n", state); InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player info (right click to close)"; infoWindow.Width = 500; infoWindow.Height = 310 + 15 * additionStrings; infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return false; }
/// <summary> /// Activates a log action. /// </summary> /// <param name="context">The context.</param> /// <param name="selectedPacket">The selected packet.</param> /// <returns><c>true</c> if log data tab should be updated.</returns> public bool Activate(IExecutionContext context, PacketLocation selectedPacket) { PacketLog log = context.LogManager.GetPacketLog(selectedPacket.LogIndex); int selectedIndex = selectedPacket.PacketIndex; int VisibleSlots = 0xFF; int weaponSkill = -1; double DPS = -1; StoC_0x02_InventoryUpdate.Item[] weapons = new StoC_0x02_InventoryUpdate.Item[4]; Packet charStats = null; for (int i = 0; i < selectedIndex; i++) { Packet pak = log[i]; if (pak is StoC_0x16_VariousUpdate) { StoC_0x16_VariousUpdate stat = (StoC_0x16_VariousUpdate)pak; if (stat.SubCode == 5) { StoC_0x16_VariousUpdate.PlayerStateUpdate subData = (StoC_0x16_VariousUpdate.PlayerStateUpdate)stat.SubData; DPS = subData.weaponDamageHigh + 0.01 * subData.weaponDamageLow; weaponSkill = (subData.weaponSkillHigh << 8) + subData.weaponSkillLow; } } else if (pak is StoC_0xFB_CharStatsUpdate_175) { if ((pak as StoC_0xFB_CharStatsUpdate_175).Flag != 0xFF) { charStats = pak; } } else if (pak is StoC_0xFB_CharStatsUpdate) { charStats = pak; } else if (pak is StoC_0x02_InventoryUpdate) { StoC_0x02_InventoryUpdate invPack = (StoC_0x02_InventoryUpdate)pak; if (invPack.PreAction == 1 || invPack.PreAction == 0) { VisibleSlots = invPack.VisibleSlots; for (int j = 0; j < invPack.SlotsCount; j++) { StoC_0x02_InventoryUpdate.Item item = (StoC_0x02_InventoryUpdate.Item)invPack.Items[j]; switch (item.slot) { case 10: weapons[0] = item; // Logger.Say(string.Format("{16:X2}\tslot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"", // item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name, invPack.VisibleSlots)); break; case 11: weapons[1] = item; break; case 12: weapons[2] = item; break; case 13: weapons[3] = item; break; default: break; } } } } } StringBuilder str = new StringBuilder(); str.AppendFormat("Weapon damage = {0:0.00}\n", DPS); str.AppendFormat("Weapon skill = {0}\n", weaponSkill); if (charStats != null) { str.Append(charStats.GetPacketDataString(true)); str.AppendFormat("\n"); } str.AppendFormat("\n"); str.AppendFormat("Visible slots = 0x{0:X2}", VisibleSlots); str.AppendFormat("\n"); //((VisibleSlots & 0x0F) == 0) string weaponName1 = ""; string weaponName2 = ""; for (int i = 0; i < 4; i++) { if ((i == (VisibleSlots & 0x0F)) || (i == ((VisibleSlots >> 4) & 0x0F))) { StoC_0x02_InventoryUpdate.Item item = (StoC_0x02_InventoryUpdate.Item)weapons[i]; // str.AppendFormat("slot:{0,-2} level:{1,-2} value1:0x{2:X2} value2:0x{3:X2} hand:0x{4:X2} damageType:0x{5:X2} objectType:0x{6:X2} weight:{7,-4} con:{8,-3} dur:{9,-3} qual:{10,-3} bonus:{11,-2} model:0x{12:X4} color:0x{13:X4} effect:0x{14:X2} \"{15}\"\n", // item.slot, item.level, item.value1, item.value2, item.hand, item.damageType, item.objectType, item.weight, item.condition, item.durability, item.quality, item.bonus, item.model, item.color, item.effect, item.name); if (item.objectType == 42) //shield { str.AppendFormat("slot:{0,-2} level:{1,-2} size:{2} con:{3,-3} qual:{4,-3} bonus:{5,-2} model:0x{6:X4} \"{7}\"", item.slot, item.level, item.value1, item.condition, item.quality, item.bonus, item.model, item.name); } else { str.AppendFormat("slot:{0,-2} level:{1,-2} dps:{2:0.00} spd:{3:0.00} damageType:{4} con:{5,-3} qual:{6,-3} bonus:{7,-2} model:0x{8:X4} \"{9}\"", item.slot, item.level, 0.1 * item.value1, 0.1 * item.value2, item.damageType, item.condition, item.quality, item.bonus, item.model, item.name); } str.AppendFormat(" ({0})\n", (StoC_0x02_InventoryUpdate.eObjectType)item.objectType); if (weaponName1 == "") { weaponName1 = item.name; } else if (item.name != weaponName1) { weaponName2 = item.name; } } } for (int i = 0; i < log.Count; i++) { if (weaponName1 == "" && weaponName2 == "") { break; } Packet pak = log[i]; if (pak is StoC_0xC4_CustomTextWindow) { if (weaponName1 != "" && (pak as StoC_0xC4_CustomTextWindow).Caption == weaponName1) { str.Append('\n'); str.Append(pak.GetPacketDataString(true)); weaponName1 = ""; } else if (weaponName2 != "" && (pak as StoC_0xC4_CustomTextWindow).Caption == weaponName2) { str.Append('\n'); str.Append(pak.GetPacketDataString(true)); weaponName2 = ""; } } } InfoWindowForm infoWindow = new InfoWindowForm(); infoWindow.Text = "Player weapon info (right click to close)"; infoWindow.Width = 800; if (charStats == null) { infoWindow.Height = 300; } else { infoWindow.Height = 400; } infoWindow.InfoRichTextBox.Text = str.ToString(); infoWindow.StartWindowThread(); return(false); }