private void buttonFilterImport_Click(object sender, RoutedEventArgs e) { FilterStructure f; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Text file (*.xml)|*.xml"; if (ofd.ShowDialog() == true) { using (StreamReader r = new StreamReader(ofd.OpenFile())) { XmlSerializer xsr = new XmlSerializer(typeof(FilterStructure)); f = xsr.Deserialize(r) as FilterStructure; } comboBoxType.SelectedIndex = f.indexRecvSend; listBoxWhite.Items.Clear(); if (f.whiteList != null) { foreach (var el in f.whiteList) { listBoxWhite.Items.Add(TeraPacketCreator.getOpCode((ushort)el)); } } listBoxBlack.Items.Clear(); if (f.blackList != null) { foreach (var el in f.blackList) { listBoxBlack.Items.Add(TeraPacketCreator.getOpCode((ushort)el)); } } } }
public DataPacket(int num, TeraPacket packet) { this.packet = packet; this.num = num; this.type = packet.type; this.size = packet.size; this.opCode = TeraPacketCreator.getOpCode(packet.opCode); }
public TeraConnection(Type[] types) { plugins = new IPlugin[types.Length]; for (int i = 0; i < types.Length; i++) { plugins[i] = Activator.CreateInstance(types[i]) as IPlugin; } version = TeraPacketCreator.getVersion(); }
public void parsePacket(object sender, EventArgs e) { PacketEventArgs ev = (PacketEventArgs)e; switch (version) { case OpCodeVersion.P2805: switch ((OpCode2805)ev.packet.opCode) { case OpCode2805.S_LOGIN: { TeraPacketParser p = TeraPacketCreator.create(ev.packet); var pl = login(p); if (onLogin != null) { onLogin(this, new PlayerEventArgs(pl)); } } break; case OpCode2805.S_SPAWN_USER: { TeraPacketParser p = TeraPacketCreator.create(ev.packet); var pl = spawnPlayer(p); if (onSpawnPlayer != null) { onSpawnPlayer(this, new PlayerEventArgs(pl)); } } break; case OpCode2805.S_DESPAWN_USER: { TeraPacketParser p = TeraPacketCreator.create(ev.packet); var pl = deSpawnPlayer(p); if (onDeSpawnPlayer != null) { onDeSpawnPlayer(this, new PlayerEventArgs(pl)); } } break; case OpCode2805.S_SPAWN_PROJECTILE: { TeraPacketParser p = TeraPacketCreator.create(ev.packet); spawnProjectile(p); } break; case OpCode2805.S_DESPAWN_PROJECTILE: { TeraPacketParser p = TeraPacketCreator.create(ev.packet); deSpawnProjectile(p); } break; case OpCode2805.S_EACH_SKILL_RESULT: { TeraPacketParser p = TeraPacketCreator.create(ev.packet); var el = damage(p); if (el != null) { if (onDamage != null) { onDamage(this, el); } } } break; case OpCode2805.S_USER_STATUS: { TeraPacketParser p = TeraPacketCreator.create(ev.packet); var pl = userStatusChange(p); if (pl != null) { if (pl.inBattle) { if (onBattleStart != null) { onBattleStart(this, new PlayerEventArgs(pl)); } } else { if (onBattleEnd != null) { onBattleEnd(this, new PlayerEventArgs(pl)); } } } } break; case OpCode2805.S_CLEAR_ALL_HOLDED_ABNORMALITY: clearAllAbnormality(); if (onClearAbnormality != null) { onClearAbnormality(this, EventArgs.Empty); } break; } break; } }