示例#1
0
 public void LogOutgoing(GameMessage msg)
 {
     Log(Level.Dump, "[O] " + msg.AsText(), null);
 }
示例#2
0
文件: Logger.cs 项目: loonbg/mooege
 /// <summary>
 /// Logs an outgoing game-server packet.
 /// </summary>
 /// <param name="message">Gameserver packet to log.</param>
 public void LogOutgoingPacket(GameMessage message)
 {
     Log(Level.PacketDump, "[O] " + message.AsText(), null);
 }
示例#3
0
 // ingame packet loggers
 public void LogIncoming(GameMessage msg)
 {
     Log(Level.Dump, "[I] " + msg.AsText(), null);
 }
示例#4
0
 public void LogOutgoing(GameMessage msg) { Log(Level.Trace, msg.AsText(), null); }
示例#5
0
文件: Logger.cs 项目: loonbg/mooege
 /// <summary>
 /// Logs an incoming game-server packet.
 /// </summary>
 /// <param name="message">Gameserver packet to log.</param>
 public void LogIncomingPacket(GameMessage message)
 {
     Log(Level.PacketDump, "[I] " + message.AsText(), null);
 }
示例#6
0
 /// <summary>
 /// Logs an incoming game-server packet.
 /// </summary>
 /// <param name="message">Gameserver packet to log.</param>
 public void LogIncomingPacket(GameMessage message)
 {
     Log(Level.PacketDump, "[I] " + message.AsText(), null);
 }
示例#7
0
 /// <summary>
 /// Logs an outgoing game-server packet.
 /// </summary>
 /// <param name="message">Gameserver packet to log.</param>
 public void LogOutgoingPacket(GameMessage message)
 {
     Log(Level.PacketDump, "[O] " + message.AsText(), null);
 }
示例#8
0
 public void LogOutgoing(GameMessage msg) { Log(Level.Dump, "[O] " + msg.AsText(), null); }
示例#9
0
        public bool Parse()
        {
            //allNodes.Clear();

            while (Buffer.IsPacketAvailable())
            {
                int end = Buffer.Position;
                end += Buffer.ReadInt(32) * 8;
                if (end < Buffer.Position)
                {
                    break;
                }

                while ((end - Buffer.Position) >= 9)
                {
                    int start = Buffer.Position;

                    #region Try parsing a message
                    try
                    {
                        GameMessage message = Buffer.ParseMessage();
                        if (message != null)
                        {
                            if (message is ACDEnterKnownMessage)
                            {
                                String hex = (message as ACDEnterKnownMessage).ActorID.ToString("X8");
                                //string name;
                                //SNOAliases.Aliases.TryGetValue((message as ACDEnterKnownMessage).ActorSNOId.ToString(), out name);
                                string name = SNOAliases.GetAlias((message as ACDEnterKnownMessage).ActorSNOId);
                                if (!actors.ContainsKey(hex))
                                {
                                    TreeNode actorNode = new TreeNode(hex + "  " + name);
                                    actors.Add(hex, actorNode);
                                    actorMap.Add((message as ACDEnterKnownMessage).ActorID, actorNode);
                                    actorNode.Tag = hex;
                                }
                            }

                            if (message is QuestUpdateMessage)
                            {
                                string name = SNOAliases.GetAlias((message as QuestUpdateMessage).snoQuest);
                                //SNOAliases.Aliases.TryGetValue(.ToString(), out name);
                                if (!quests.ContainsKey((message as QuestUpdateMessage).snoQuest.ToString("X8")))
                                {
                                    TreeNode questNode = new TreeNode(name);
                                    questNode.Tag = (message as QuestUpdateMessage).snoQuest.ToString("X8");
                                    quests.Add(questNode.Tag.ToString(), questNode);
                                }
                            }

                            MessageNode node = new MessageNode(message);
                            allNodes.Add(node);

                            /// THIS IS FOR QUICKER PARSING BUT IM TOO LAZY TO DO THAT FOR ALL MESSAGES
                            #region quickparse

                            // skip messages without actor or quest id
                            if (message is GameTickMessage ||
                                message is SNODataMessage ||
                                message is SNONameDataMessage ||
                                message is SimpleMessage ||
                                message is RevealSceneMessage ||
                                message is DestroySceneMessage ||
                                message is MapRevealSceneMessage
                                )
                            {
                                continue;
                            }

                            try
                            {
                                if (gg.ContainsKey(message.GetType()))
                                {
                                    gg[message.GetType()]++;
                                }
                                else
                                {
                                    gg.Add(message.GetType(), 1);
                                }

                                if (message is ANNDataMessage)
                                {
                                    if (actorMap.ContainsKey((uint)(message as ANNDataMessage).ActorID))
                                    {
                                        actorMap[(uint)(message as ANNDataMessage).ActorID].Nodes.Add(node.Clone());
                                    }
                                    continue;
                                }
                                if (message is ACDTranslateFacingMessage)
                                {
                                    actorMap[(uint)(message as ACDTranslateFacingMessage).ActorId].Nodes.Add(node.Clone());
                                    continue;
                                }

                                if (message is AttributeSetValueMessage)
                                {
                                    var msg = message as AttributeSetValueMessage;
                                    actorMap[(uint)(message as AttributeSetValueMessage).ActorID].Nodes.Add(node.Clone());

                                    if (msg.Field1.Attribute != GameAttribute.Attached_To_ACD &&
                                        msg.Field1.Attribute != GameAttribute.Attachment_ACD &&
                                        msg.Field1.Attribute != GameAttribute.Banner_ACDID &&
                                        msg.Field1.Attribute != GameAttribute.Follow_Target_ACDID &&
                                        msg.Field1.Attribute != GameAttribute.Forced_Enemy_ACDID &&
                                        msg.Field1.Attribute != GameAttribute.Gizmo_Operator_ACDID &&
                                        msg.Field1.Attribute != GameAttribute.Guard_Object_ACDID &&
                                        msg.Field1.Attribute != GameAttribute.Item_Bound_To_ACD &&
                                        msg.Field1.Attribute != GameAttribute.Last_Damage_ACD &&
                                        msg.Field1.Attribute != GameAttribute.Last_ACD_Attacked &&
                                        msg.Field1.Attribute != GameAttribute.Last_ACD_Attacked_By &&
                                        msg.Field1.Attribute != GameAttribute.Attached_To_ACD &&
                                        msg.Field1.Attribute != GameAttribute.Last_Blocked_ACD &&
                                        msg.Field1.Attribute != GameAttribute.Loading_Player_ACD &&
                                        msg.Field1.Attribute != GameAttribute.RootTargetACD &&
                                        msg.Field1.Attribute != GameAttribute.Script_Target_ACDID &&
                                        msg.Field1.Attribute != GameAttribute.Spawned_by_ACDID &&
                                        msg.Field1.Attribute != GameAttribute.Summoned_By_ACDID &&
                                        msg.Field1.Attribute != GameAttribute.Taunt_Target_ACD &&
                                        msg.Field1.Attribute != GameAttribute.Wizard_Slowtime_Proxy_ACD)
                                    {
                                        //actorMap[(uint)(message as AttributeSetValueMessage).Field1.Int].Nodes.Add(node.Clone());
                                        continue;
                                    }
                                }

                                if (message is NotifyActorMovementMessage)
                                {
                                    actorMap[(uint)(message as NotifyActorMovementMessage).ActorId].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is PlayerMovementMessage)
                                {
                                    // If the client sends a PlayerMoveMessage, but the actor is not yet in the
                                    // actor list, its due to a broken cap that starts too late...add the node for speed (and grouping)
                                    if (!actorMap.ContainsKey((uint)(message as PlayerMovementMessage).ActorId))
                                    {
                                        String hex = (message as PlayerMovementMessage).ActorId.ToString("X8");

                                        if (!actors.ContainsKey(hex))
                                        {
                                            TreeNode actorNode = new TreeNode(hex + " Capper");
                                            actorMap.Add((uint)(message as PlayerMovementMessage).ActorId, actorNode);
                                            actorNode.Tag = hex;
                                            actors.Add(hex, actorNode);
                                        }
                                    }

                                    actorMap[(uint)(message as PlayerMovementMessage).ActorId].Nodes.Add(node.Clone());
                                    continue;
                                }

                                if (message is ACDGroupMessage)
                                {
                                    actorMap[(uint)(message as ACDGroupMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is ACDCollFlagsMessage)
                                {
                                    actorMap[(uint)(message as ACDCollFlagsMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is AffixMessage)
                                {
                                    actorMap[(uint)(message as AffixMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is TrickleMessage)
                                {
                                    if (actorMap.ContainsKey((uint)(message as TrickleMessage).ActorId))
                                    {
                                        actorMap[(uint)(message as TrickleMessage).ActorId].Nodes.Add(node.Clone());
                                    }
                                    continue;
                                }
                                if (message is ACDEnterKnownMessage)
                                {
                                    actorMap[(uint)(message as ACDEnterKnownMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is ACDCreateActorMessage)
                                {
                                    actorMap[(uint)(message as ACDCreateActorMessage).ActorId].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is ACDDestroyActorMessage)
                                {
                                    actorMap[(uint)(message as ACDDestroyActorMessage).ActorId].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is ACDTranslateFixedMessage)
                                {
                                    actorMap[(uint)(message as ACDTranslateFixedMessage).ActorId].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is AttributesSetValuesMessage)
                                {
                                    actorMap[(uint)(message as AttributesSetValuesMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is SetIdleAnimationMessage)
                                {
                                    actorMap[(uint)(message as SetIdleAnimationMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is ACDWorldPositionMessage)
                                {
                                    actorMap[(uint)(message as ACDWorldPositionMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is PlayEffectMessage)
                                {
                                    actorMap[(uint)(message as PlayEffectMessage).ActorId].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is PlayAnimationMessage)
                                {
                                    actorMap[(uint)(message as PlayAnimationMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is FloatingNumberMessage)
                                {
                                    actorMap[(uint)(message as FloatingNumberMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is ACDTranslateSyncMessage)
                                {
                                    actorMap[(uint)(message as ACDTranslateSyncMessage).Field0].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is ACDTranslateDetPathMessage)
                                {
                                    actorMap[(uint)(message as ACDTranslateDetPathMessage).Field0].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is PlayHitEffectMessage)
                                {
                                    actorMap[(uint)(message as PlayHitEffectMessage).ActorID].Nodes.Add(node.Clone());
                                    continue;
                                }
                                if (message is AimTargetMessage)
                                {
                                    actorMap[(uint)(message as AimTargetMessage).Field0].Nodes.Add(node.Clone());
                                    if ((message as AimTargetMessage).Field2 != -1)
                                    {
                                        actorMap[(uint)(message as AimTargetMessage).Field2].Nodes.Add(node.Clone());
                                    }
                                    continue;
                                }
                                if (message is TargetMessage)
                                {
                                    if ((message as TargetMessage).TargetID != 0xFFFFFFFF)
                                    {
                                        actorMap[(uint)(message as TargetMessage).TargetID].Nodes.Add(node.Clone());
                                    }
                                    continue;
                                }
                            }
                            catch (Exception) {}

                            #endregion

                            // Bruteforce find actor ID and add to actor tree
                            string text = message.AsText();
                            foreach (TreeNode an in actors.Values)
                            {
                                if (text.Contains((string)an.Tag))
                                {
                                    MessageNode nodeb = node.Clone();
                                    nodeb.BackColor = this.BackColor;
                                    an.Nodes.Add(nodeb);
                                }
                            }

                            // Bruteforce find quest SNO and add to quest tree
                            foreach (TreeNode qn in quests.Values)
                            {
                                if (text.Contains(qn.Tag.ToString()))
                                {
                                    MessageNode nodeb = node.Clone();
                                    nodeb.BackColor = this.BackColor;
                                    qn.Nodes.Add(nodeb);
                                }
                            }
                        }
                        else
                        {
                            int pos = Buffer.Position;
                            Buffer.Position = start;
                            ErrorNode errorNode = new ErrorNode(String.Format("No message handler found for message id {0}", (Opcodes)Buffer.ReadInt(9)), "");
                            errorNode.BackColor = Color.Pink;
                            allNodes.Add(errorNode);
                            Buffer.Position = pos;
                        }
                    }

                    catch (Exception e)
                    {
                        int pos = Buffer.Position;
                        Buffer.Position = start;
                        ErrorNode errorNode = new ErrorNode(String.Format("Error parsing messsage {0}", (Opcodes)Buffer.ReadInt(9)), e.Message);
                        errorNode.BackColor = Color.Pink;
                        allNodes.Add(errorNode);
                        Buffer.Position = pos;
                    }
                    #endregion
                }

                Buffer.Position = end;
            }

            return(Buffer.Position != Buffer.Length);
        }
示例#10
0
 // ingame packet loggers
 public void LogIncoming(GameMessage msg) { Log(Level.Dump, "[I] " + msg.AsText(), null); }
示例#11
0
 public string AsText()
 {
     return(gameMessage.AsText());
 }
示例#12
0
 public void LogOutgoing(GameMessage msg)
 {
     Log(Level.Outgoing, msg.AsText(), null);
 }
示例#13
0
 public void LogIncoming(GameMessage msg)
 {
     Log(Level.Incoming, msg.AsText(), null);
 }
示例#14
0
 public void LogIncoming(GameMessage msg) { Log(Level.Incoming, msg.AsText(), null); }