//private Dictionary<FilterItem, FilterItem> filter = new Dictionary<FilterItem, FilterItem>(); public void AddPacket(L2Packet p) { this.packetList.Add(p); //wenn nicht im Filter, auch der Anzeigenden liste hinzufügen if (!this.filter.ContainsKey(new FilterItem(p.OpCode, (p is GameServerPacket)).GetHashCode())) { this.diplayedList.Add(p); } }
/// <summary> /// Mappt den Opcode in einen Aussagekräftigen String um /// </summary> /// <param name="p">Das L2Packet</param> /// <returns>den Namen des L2Packets</returns> public string GetName(L2Packet p) { string name = String.Format("0x{0:x2}", p.OpCode); if (p is GameServerPacket) { if (this.knownServerPackets.ContainsKey(p.OpCode)) { name = ((PacketInfo)this.knownServerPackets[p.OpCode]).name + String.Format(": 0x{0:x2}", p.OpCode); } } else if (p is ClientPacket) { if (this.knownClientPackets.ContainsKey(p.OpCode)) { name = ((PacketInfo)this.knownClientPackets[p.OpCode]).name + String.Format(": 0x{0:x2}", p.OpCode); ; } } return name; }
void sniffer_NewPacketArrived(object sender, L2Packet packet) { if (packet is ClientPacket) return; int opCode = packet.OpCode; switch (opCode) { case 0x62: //SystemMessage this.onSpoil(packet); break; case 0x0b: //CharSelected this.onCharSelected(packet); break; case 0xb9: //MyTargetSelected this.onMyTargetSelected(packet); break; case 0x0c: //NpcInfo onNpcInfo(packet); break; case 0x31: //CharInfo onCharInfo(packet); break; case 0x32: // Userinfo onUserInfo(packet); break; case 0x08: //DeleteObject onDeleteObject(packet); break; case 0x89: //PlegdeInfo onPledgeInfo(packet); break; case 0xfe1e: //ExFishingStart // Expanderausklappen onExFishingStart(packet); break; case 0xfe1f: //ExFishingStop // Expander einklappen onExFishingStop(packet); break; case 0xfe27: //ExFishingStartCombat onExFishingStartCombat(packet); break; case 0xfe28: //ExFishingHpRegen onExFishingHpRegen(packet); break; } }
private void onUserInfo(L2Packet packet) { packet.Data.SetIndex(3); packet.Data.ReadInt32(); packet.Data.ReadInt32(); packet.Data.ReadInt32(); packet.Data.ReadInt32(); this.myCharObjId = packet.Data.ReadInt32(); //string ownName = packet.Data.ReadString(); }
private void onSpoil(L2Packet packet) { packet.Data.SetIndex(3); int messageId = packet.Data.ReadInt32(); switch (messageId) { case 612: // Spoil ok this.labelName.Text = "Gespoilt"; if (!OptionsForm.Instance.MuteSounds) this.beep.Play(); break; case 357: // Allready Spoiled this.labelName.Text = "Schon gespoilt"; break; } }
private void onPledgeInfo(L2Packet packet) { packet.Data.SetIndex(3); L2Plegde clan = new L2Plegde((GameServerPacket)packet); if (this.knownPlegdes.ContainsKey(clan.ClanId)) return; this.knownPlegdes.Add(clan.ClanId, clan); }
private void onNpcInfo(L2Packet packet) { packet.Data.SetIndex(3); //writeD(_activeChar.getObjectId()); //writeD(_idTemplate + 1000000); // npctype id int objId = packet.Data.ReadInt32(); int npcId = packet.Data.ReadInt32() - 1000000; if (this.knownNpcs.ContainsKey(objId)) return; this.knownNpcs.Add(objId, npcId); }
private void onMyTargetSelected(L2Packet packet) { packet.Data.SetIndex(3); int objId = packet.Data.ReadInt32(); if (this.lastTarget != objId) { this.labelClan.Text = ""; if (this.knownNpcs.ContainsKey(objId)) { int npcId = this.knownNpcs[objId]; this.labelName.Text = NpcNames.GetInstance().GetName(npcId); this.labelName.ForeColor = Color.LightGray; this.labelTitle.Text = NpcNames.GetInstance().GetTitle(npcId); this.labelTitle.ForeColor = NpcNames.GetInstance().GetColor(npcId); this.lastNpcId = npcId; } else if (this.knownPcs.ContainsKey(objId)) { L2Pc pc = this.knownPcs[objId]; this.labelName.Text = pc.VisibleName; this.labelTitle.Text = pc.Title; this.labelTitle.ForeColor = Color.LightGray; // Karma/PvP this.labelName.ForeColor = Color.LightGray; if (pc.PvpFlag) this.labelName.ForeColor = Color.Pink; if (pc.Karma > 0) this.labelName.ForeColor = Color.Red; // Clan if (this.knownPlegdes.ContainsKey(pc.ClanId)) { this.labelClan.Text = "Clan: " + this.knownPlegdes[pc.ClanId].ClanName; } } else if (this.myCharObjId == objId) // myself { this.labelName.Text = this.myCharName; this.labelTitle.Text = ""; this.labelTitle.ForeColor = Color.LightGray; } else { this.labelName.Text = "id:" + objId; this.labelName.ForeColor = Color.LightGray; this.labelTitle.Text = ""; } this.lastTarget = objId; } }
private void onExFishingStop(L2Packet packet) { // Stop Fishing, Collapse the Window packet.Data.SetIndex(5); int obId = packet.Data.ReadInt32(); if (obId != this.myCharObjId) return; this.Expanded = false; this.labelExpanderHint.Text = ""; this.labelExpanderHint2.Text = ""; }
private void onExFishingStartCombat(L2Packet packet) { packet.Data.SetIndex(5); int obId = packet.Data.ReadInt32(); if (obId != this.myCharObjId) return; int time = packet.Data.ReadInt32(); int hp = packet.Data.ReadInt32(); short mode = packet.Data.ReadInt16(); short lureType = packet.Data.ReadInt16(); short deceptiveMode = packet.Data.ReadInt16(); if (deceptiveMode == 1) this.labelExpanderHint2.Text = "Täuschender Modus!"; }
private void onExFishingStart(L2Packet packet) { // Start Fishing, Expand the Window packet.Data.SetIndex(5); int obId = packet.Data.ReadInt32(); if (obId != this.myCharObjId) return; this.Expanded = true; this.labelExpanderHint.Text = "Warte auf einen Fisch..."; this.labelExpanderHint2.Text = ""; }
private void onExFishingHpRegen(L2Packet packet) { packet.Data.SetIndex(5); int obId = packet.Data.ReadInt32(); if (obId != this.myCharObjId) return; int time = packet.Data.ReadInt32(); int hp = packet.Data.ReadInt32(); short hpMode = packet.Data.ReadInt16(); short gootUse = packet.Data.ReadInt16(); short anim = packet.Data.ReadInt16(); int penalty = packet.Data.ReadInt32(); byte hpBarCol = packet.Data.ReadByte(); switch (hpMode) { case 0: this.labelExpanderHint.Text = hpBarCol == 0 ? "Pumping" : "Reeling"; //this.fishBot.UsePump(); if (OptionsForm.Instance.EnableFishbot) { if (hpBarCol == 0x00) this.fishBot.UsePump(); else this.fishBot.UseReel(); } break; case 1: this.labelExpanderHint.Text = hpBarCol == 0 ? "Reeling" : "Pumping"; //this.fishBot.UseReel(); if (OptionsForm.Instance.EnableFishbot) { if (hpBarCol == 0x00) this.fishBot.UseReel(); else this.fishBot.UsePump(); } break; } }
private void onDeleteObject(L2Packet packet) { packet.Data.SetIndex(3); int objId = packet.Data.ReadInt32(); if (this.knownNpcs.ContainsKey(objId)) { this.knownNpcs.Remove(objId); } if (this.knownPcs.ContainsKey(objId)) { this.knownPcs.Remove(objId); } }
private void onCharSelected(L2Packet packet) { packet.Data.SetIndex(3); this.myCharName = packet.Data.ReadString(); this.labelStatus.Text = String.Format("Verbunden als {0}", this.myCharName); }
private void onCharInfo(L2Packet packet) { packet.Data.SetIndex(3 + 16); //writeD(_x); //writeD(_y); //writeD(_z); //writeD(0x00); //writeD(_activeChar.getObjectId()); int objId = packet.Data.ReadInt32(); if (this.knownPcs.ContainsKey(objId)) return; this.knownPcs.Add(objId, new L2Pc((GameServerPacket)packet)); }
public ArrayList GetStructure(L2Packet p) { if (p is GameServerPacket) { if (this.knownServerPackets.ContainsKey(p.OpCode)) { return ((PacketInfo)this.knownServerPackets[p.OpCode]).structure.structure; } } else if (p is ClientPacket) { if (this.knownClientPackets.ContainsKey(p.OpCode)) { return ((PacketInfo)this.knownClientPackets[p.OpCode]).structure.structure; } } return null; }