Esempio n. 1
0
 /// <summary>
 ///  Creates a Pipe to interact with an injected DLL or another program.
 /// </summary>
 public Pipe(Client client, string name)
 {
     this.client = client;
     this.name = name;
     pipe = new NamedPipeServerStream(name, PipeDirection.InOut, -1, PipeTransmissionMode.Message, PipeOptions.Asynchronous);
     pipe.BeginWaitForConnection(new AsyncCallback(BeginWaitForConnection), null);
 }
Esempio n. 2
0
 public Hotkey(Client client, byte number)
 {
     if (number < 0 || number > Addresses.Hotkey.MaxHotkeys)
         throw new ArgumentOutOfRangeException("number", "Hotkey number must be between 0 and Addresses.Hotkey.MaxHotkeys.");
     this.client = client;
     this.number = number;
 }
Esempio n. 3
0
        //packet tile constructors
        internal Tile(Client client, uint groundId, Location location)
        {
            this.type = ObjectType.Packet;
            this.client = client;
            this.location = location;
            this.items = new List<Item>();

            if (groundId > 0)
                this.ground = new Item(client, groundId);
        }
Esempio n. 4
0
        internal Tile(Client client, uint address, uint squareNumber)
        {
            this.type = ObjectType.Memory;
            this.client = client;
            this.squareNumber = squareNumber;
            this.address = address;
            this.memoryLocation = squareNumber.ToMemoryLocation();

            this.objectCount = client.Memory.ReadInt32(address + Pokemon.Addresses.Map.DistanceTileObjectCount) - 1;
            this.ground = new Item(client, client.Memory.ReadUInt32(address + 
                Pokemon.Addresses.Map.DistanceTileObjects + Pokemon.Addresses.Map.DistanceObjectId));
        }
Esempio n. 5
0
        public HookProxy(Client client)
        {
            this.client = client;
            serverRecvMsg = new NetworkMessage(client);
            serverSendMsg = new NetworkMessage(client);
            clientRecvMsg = new NetworkMessage(client);
            clientSendMsg = new NetworkMessage(client);

            if (client.Dll.Pipe == null)
            {
                client.Dll.InitializePipe();
                client.Dll.PipeIsReady.WaitOne();
            }

            client.Dll.Pipe.OnSocketRecv += new Pipe.PipeListener(Pipe_OnSocketRecv);
            client.Dll.Pipe.OnSocketSend += new Pipe.PipeListener(Pipe_OnSocketSend);

            if (client.LoggedIn())
                protocol = Protocol.World;
            else
                protocol = Protocol.None;
        }
Esempio n. 6
0
 public DisplayTextPacket(Client client)
     : base(client)
 {
     Type = PipePacketType.DisplayText;
 }
 public UpdateCreatureTextPacket(Client client)
     : base(client)
 {
     Type = PipePacketType.UpdateCreatureText;
 }
Esempio n. 8
0
 /// <summary>
 /// Create a new container object with the specified client, address, and number.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="address">The address of the container.</param>
 /// <param name="number">The number of the container (0 based).</param>
 public Container(Client client, uint address, byte number)
 {
     this.client = client;
     this.address = address;
     this.number = number;
 }
 public RemoveCreatureTextPacket(Client client)
     : base(client)
 {
     Type = PipePacketType.RemoveCreatureText;
 }
Esempio n. 10
0
 /// <summary>
 /// Create a battlelist object.
 /// </summary>
 /// <param name="c"></param>
 public BattleList(Client c)
 {
     client = c;
 }
Esempio n. 11
0
 public bool ParseServerPacket(Client client, byte[] packet)
 {
     NetworkMessage inMsg = new NetworkMessage(client, packet);
     NetworkMessage outMsg = new NetworkMessage(client);
     while (inMsg.Position < packet.Length)
     {
         if (!ParsePacketFromServer(client, inMsg, outMsg))
             return false;
         outMsg.Reset();
     }
     return true;
 }
Esempio n. 12
0
        public Proxy(Client client)
            : this(client, client.Login.RSA == Constants.RSAKey.OpenTibia)
        {

        }
Esempio n. 13
0
 /// <summary>
 /// Create a new inventory object with the specified client.
 /// </summary>
 /// <param name="client">The client.</param>
 public Inventory(Client client)
 {
     this.client = client;
 }
 public HooksEnableDisablePacket(Client client)
     : base(client)
 {
     Type = PipePacketType.HooksEnableDisable;
 }
Esempio n. 15
0
        protected bool ParsePacketFromServer(Client client, NetworkMessage msg, NetworkMessage outMsg)
        {
            bool packetKnown = true;
            IncomingPacket packet = null;
            IncomingPacketType type = (IncomingPacketType)msg.PeekByte();

            switch (type)
            {
                case IncomingPacketType.AnimatedText:
                    packet = new Packets.Incoming.AnimatedTextPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedAnimatedTextIncomingPacket != null)
                            packet.Forward = ReceivedAnimatedTextIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ContainerClose:
                    packet = new Packets.Incoming.ContainerClosePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedContainerCloseIncomingPacket != null)
                            packet.Forward = ReceivedContainerCloseIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.CreatureSpeech:
                    packet = new Packets.Incoming.CreatureSpeechPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCreatureSpeechIncomingPacket != null)
                            packet.Forward = ReceivedCreatureSpeechIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ChannelOpen:
                    packet = new Packets.Incoming.ChannelOpenPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedChannelOpenIncomingPacket != null)
                            packet.Forward = ReceivedChannelOpenIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.PlayerWalkCancel:
                    packet = new Packets.Incoming.PlayerWalkCancelPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedPlayerWalkCancelIncomingPacket != null)
                            packet.Forward = ReceivedPlayerWalkCancelIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ChannelList:
                    packet = new Packets.Incoming.ChannelListPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedChannelListIncomingPacket != null)
                            packet.Forward = ReceivedChannelListIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.CreatureMove:
                    packet = new Packets.Incoming.CreatureMovePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCreatureMoveIncomingPacket != null)
                            packet.Forward = ReceivedCreatureMoveIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.TextMessage:
                    packet = new Packets.Incoming.TextMessagePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedTextMessageIncomingPacket != null)
                            packet.Forward = ReceivedTextMessageIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.TileAddThing:
                    packet = new Packets.Incoming.TileAddThingPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedTileAddThingIncomingPacket != null)
                            packet.Forward = ReceivedTileAddThingIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.CreatureOutfit:
                    packet = new Packets.Incoming.CreatureOutfitPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCreatureOutfitIncomingPacket != null)
                            packet.Forward = ReceivedCreatureOutfitIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.CreatureLight:
                    packet = new Packets.Incoming.CreatureLightPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCreatureLightIncomingPacket != null)
                            packet.Forward = ReceivedCreatureLightIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.CreatureHealth:
                    packet = new Packets.Incoming.CreatureHealthPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCreatureHealthIncomingPacket != null)
                            packet.Forward = ReceivedCreatureHealthIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.CreatureSpeed:
                    packet = new Packets.Incoming.CreatureSpeedPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCreatureSpeedIncomingPacket != null)
                            packet.Forward = ReceivedCreatureSpeedIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);

                        return true;
                    }
                    break;
                case IncomingPacketType.CreatureSquare:
                    packet = new Packets.Incoming.CreatureSquarePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCreatureSquareIncomingPacket != null)
                            packet.Forward = ReceivedCreatureSquareIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.TileTransformThing:
                    packet = new Packets.Incoming.TileTransformThingPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedTileTransformThingIncomingPacket != null)
                            packet.Forward = ReceivedTileTransformThingIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);

                        return true;
                    }
                    break;
                case IncomingPacketType.TileRemoveThing:
                    packet = new Packets.Incoming.TileRemoveThingPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedTileRemoveThingIncomingPacket != null)
                            packet.Forward = ReceivedTileRemoveThingIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ContainerAddItem:
                    packet = new Packets.Incoming.ContainerAddItemPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedContainerAddItemIncomingPacket != null)
                            packet.Forward = ReceivedContainerAddItemIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ContainerRemoveItem:
                    packet = new Packets.Incoming.ContainerRemoveItemPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedContainerRemoveItemIncomingPacket != null)
                            packet.Forward = ReceivedContainerRemoveItemIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ContainerUpdateItem:
                    packet = new Packets.Incoming.ContainerUpdateItemPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedContainerUpdateItemIncomingPacket != null)
                            packet.Forward = ReceivedContainerUpdateItemIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ContainerOpen:
                    packet = new Packets.Incoming.ContainerOpenPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedContainerOpenIncomingPacket != null)
                            packet.Forward = ReceivedContainerOpenIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ItemTextWindow:
                    packet = new Packets.Incoming.ItemTextWindowPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedItemTextWindowIncomingPacket != null)
                            packet.Forward = ReceivedItemTextWindowIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.WorldLight:
                    packet = new Packets.Incoming.WorldLightPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedWorldLightIncomingPacket != null)
                            packet.Forward = ReceivedWorldLightIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.Projectile:
                    packet = new Packets.Incoming.ProjectilePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedProjectileIncomingPacket != null)
                            packet.Forward = ReceivedProjectileIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.MapDescription:
                    packet = new Packets.Incoming.MapDescriptionPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client, outMsg))
                    {
                        if (ReceivedMapDescriptionIncomingPacket != null)
                            packet.Forward = ReceivedMapDescriptionIncomingPacket.Invoke(packet);
                    }
                    break;
                case IncomingPacketType.SelfAppear:
                    packet = new Packets.Incoming.SelfAppearPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedSelfAppearIncomingPacket != null)
                            packet.Forward = ReceivedSelfAppearIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.MagicEffect:
                    packet = new Packets.Incoming.MagicEffectPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedMagicEffectIncomingPacket != null)
                            packet.Forward = ReceivedMagicEffectIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.FloorChangeDown:
                    packet = new Packets.Incoming.FloorChangeDownPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client, outMsg))
                    {
                        if (ReceivedFloorChangeDownIncomingPacket != null)
                            packet.Forward = ReceivedFloorChangeDownIncomingPacket.Invoke(packet);
                    }
                    break;
                case IncomingPacketType.FloorChangeUp:
                    packet = new Packets.Incoming.FloorChangeUpPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client, outMsg))
                    {
                        if (ReceivedFloorChangeUpIncomingPacket != null)
                            packet.Forward = ReceivedFloorChangeUpIncomingPacket.Invoke(packet);
                    }
                    break;
                case IncomingPacketType.PlayerStatus:
                    packet = new Packets.Incoming.PlayerStatusPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedPlayerStatusIncomingPacket != null)
                            packet.Forward = ReceivedPlayerStatusIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.CreatureSkull:
                    packet = new Packets.Incoming.CreatureSkullPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCreatureSkullIncomingPacket != null)
                            packet.Forward = ReceivedCreatureSkullIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.WaitingList:
                    packet = new Packets.Incoming.WaitingListPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedWaitingListIncomingPacket != null)
                            packet.Forward = ReceivedWaitingListIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.Ping:
                    packet = new Packets.Incoming.PingPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedPingIncomingPacket != null)
                            packet.Forward = ReceivedPingIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.Death:
                    packet = new Packets.Incoming.DeathPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedDeathIncomingPacket != null)
                            packet.Forward = ReceivedDeathIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.CanReportBugs:
                    packet = new Packets.Incoming.CanReportBugsPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCanReportBugsIncomingPacket != null)
                            packet.Forward = ReceivedCanReportBugsIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.TileUpdate:
                    packet = new Packets.Incoming.TileUpdatePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client, outMsg))
                    {
                        if (ReceivedTileUpdateIncomingPacket != null)
                            packet.Forward = ReceivedTileUpdateIncomingPacket.Invoke(packet);
                    }
                    break;
                case IncomingPacketType.FyiMessage:
                    packet = new Packets.Incoming.FyiMessagePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedFyiMessageIncomingPacket != null)
                            packet.Forward = ReceivedFyiMessageIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.InventorySetSlot:
                    packet = new Packets.Incoming.InventorySetSlotPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedInventorySetSlotIncomingPacket != null)
                            packet.Forward = ReceivedInventorySetSlotIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.InventoryResetSlot:
                    packet = new Packets.Incoming.InventoryResetSlotPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedInventoryResetSlotIncomingPacket != null)
                            packet.Forward = ReceivedInventoryResetSlotIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.SafeTradeRequestAck:
                    packet = new Packets.Incoming.SafeTradeRequestAckPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedSafeTradeRequestAckIncomingPacket != null)
                            packet.Forward = ReceivedSafeTradeRequestAckIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.SafeTradeRequestNoAck:
                    packet = new Packets.Incoming.SafeTradeRequestNoAckPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedSafeTradeRequestNoAckIncomingPacket != null)
                            packet.Forward = ReceivedSafeTradeRequestNoAckIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.SafeTradeClose:
                    packet = new Packets.Incoming.SafeTradeClosePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedSafeTradeCloseIncomingPacket != null)
                            packet.Forward = ReceivedSafeTradeCloseIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.PlayerSkillsUpdate:
                    packet = new Packets.Incoming.PlayerSkillsPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedPlayerSkillsIncomingPacket != null)
                            packet.Forward = ReceivedPlayerSkillsIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.PlayerFlags:
                    packet = new Packets.Incoming.PlayerFlagsPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedPlayerFlagsIncomingPacket != null)
                            packet.Forward = ReceivedPlayerFlagsIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ChannelOpenPrivate:
                    packet = new Packets.Incoming.ChannelOpenPrivatePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedChannelOpenPrivateIncomingPacket != null)
                            packet.Forward = ReceivedChannelOpenPrivateIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.PrivateChannelCreate:
                    packet = new Packets.Incoming.PrivateChannelCreatePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedPrivateChannelCreateIncomingPacket != null)
                            packet.Forward = ReceivedPrivateChannelCreateIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.ChannelClosePrivate:
                    packet = new Packets.Incoming.ChannelClosePrivatePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedChannelClosePrivateIncomingPacket != null)
                            packet.Forward = ReceivedChannelClosePrivateIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.VipState:
                    packet = new Packets.Incoming.VipStatePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedVipStateIncomingPacket != null)
                            packet.Forward = ReceivedVipStateIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.VipLogin:
                    packet = new Packets.Incoming.VipLoginPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedVipLoginIncomingPacket != null)
                            packet.Forward = ReceivedVipLoginIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.VipLogout:
                    packet = new Packets.Incoming.VipLogoutPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedVipLogoutIncomingPacket != null)
                            packet.Forward = ReceivedVipLogoutIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.OutfitWindow:
                    packet = new Packets.Incoming.OutfitWindowPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedOutfitWindowIncomingPacket != null)
                            packet.Forward = ReceivedOutfitWindowIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.RuleViolationOpen:
                    packet = new Packets.Incoming.RuleViolationOpenPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedRuleViolationOpenIncomingPacket != null)
                            packet.Forward = ReceivedRuleViolationOpenIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.RuleViolationRemove:
                    packet = new Packets.Incoming.RuleViolationRemovePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedRuleViolationRemoveIncomingPacket != null)
                            packet.Forward = ReceivedRuleViolationRemoveIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.RuleViolationCancel:
                    packet = new Packets.Incoming.RuleViolationCancelPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedRuleViolationCancelIncomingPacket != null)
                            packet.Forward = ReceivedRuleViolationCancelIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.RuleViolationLock:
                    packet = new Packets.Incoming.RuleViolationLockPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedRuleViolationLockIncomingPacket != null)
                            packet.Forward = ReceivedRuleViolationLockIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case IncomingPacketType.CancelTarget:
                    packet = new Packets.Incoming.CancelTargetPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Client))
                    {
                        if (ReceivedCancelTargetIncomingPacket != null)
                            packet.Forward = ReceivedCancelTargetIncomingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                default:
                    packetKnown = false;
                    break;
            }

            return packetKnown;
        }
Esempio n. 16
0
        protected bool ParsePacketFromClient(Client client, NetworkMessage msg, NetworkMessage outMsg)
        {
            bool packetKnown = true;
            OutgoingPacket packet = null;
            OutgoingPacketType type = (OutgoingPacketType)msg.PeekByte();
            //System.Console.WriteLine(type.ToString());

            switch (type)
            {
                case OutgoingPacketType.ChannelClose:
                    packet = new Packets.Outgoing.ChannelClosePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedChannelCloseOutgoingPacket != null)
                            packet.Forward = ReceivedChannelCloseOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.ChannelOpen:
                    packet = new Packets.Outgoing.ChannelOpenPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedChannelOpenOutgoingPacket != null)
                            packet.Forward = ReceivedChannelOpenOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.PlayerSpeech:
                    packet = new Packets.Outgoing.PlayerSpeechPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedPlayerSpeechOutgoingPacket != null)
                            packet.Forward = ReceivedPlayerSpeechOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.Attack:
                    packet = new Packets.Outgoing.AttackPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedAttackOutgoingPacket != null)
                            packet.Forward = ReceivedAttackOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.Follow:
                    packet = new Packets.Outgoing.FollowPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedFollowOutgoingPacket != null)
                            packet.Forward = ReceivedFollowOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.LookAt:
                    packet = new Packets.Outgoing.LookAtPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedLookAtOutgoingPacket != null)
                            packet.Forward = ReceivedLookAtOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.ItemUse:
                    packet = new Packets.Outgoing.ItemUsePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedItemUseOutgoingPacket != null)
                            packet.Forward = ReceivedItemUseOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.ItemUseOn:
                    packet = new Packets.Outgoing.ItemUseOnPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedItemUseOnOutgoingPacket != null)
                            packet.Forward = ReceivedItemUseOnOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.ItemMove:
                    packet = new Packets.Outgoing.ItemMovePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedItemMoveOutgoingPacket != null)
                            packet.Forward = ReceivedItemMoveOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.CancelMove:
                    packet = new Packets.Outgoing.CancelMovePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedCancelMoveOutgoingPacket != null)
                            packet.Forward = ReceivedCancelMoveOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.ItemUseBattlelist:
                    packet = new Packets.Outgoing.ItemUseBattlelistPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedItemUseBattlelistOutgoingPacket != null)
                            packet.Forward = ReceivedItemUseBattlelistOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.Logout:
                    packet = new Packets.Outgoing.LogoutPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedLogoutOutgoingPacket != null)
                            packet.Forward = ReceivedLogoutOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.ContainerClose:
                    packet = new Packets.Outgoing.ContainerClosePacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedContainerCloseOutgoingPacket != null)
                            packet.Forward = ReceivedContainerCloseOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.ContainerOpenParent:
                    packet = new Packets.Outgoing.ContainerOpenParentPacket(client);
                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedContainerOpenParentOutgoingPacket != null)
                            packet.Forward = ReceivedContainerOpenParentOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.AutoWalk:
                    packet = new Packets.Outgoing.AutoWalkPacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedAutoWalkOutgoingPacket != null)
                            packet.Forward = ReceivedAutoWalkOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.VipAdd:
                    packet = new Packets.Outgoing.VipAddPacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedVipAddOutgoingPacket != null)
                            packet.Forward = ReceivedVipAddOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.VipRemove:
                    packet = new Packets.Outgoing.VipRemovePacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedVipRemoveOutgoingPacket != null)
                            packet.Forward = ReceivedVipRemoveOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.ItemRotate:
                    packet = new Packets.Outgoing.ItemRotatePacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedItemRotateOutgoingPacket != null)
                            packet.Forward = ReceivedItemRotateOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.SetOutfit:
                    packet = new Packets.Outgoing.SetOutfitPacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedSetOutfitOutgoingPacket != null)
                            packet.Forward = ReceivedSetOutfitOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.AutoWalkCancel:
                    packet = new Packets.Outgoing.AutoWalkCancelPacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedAutoWalkCancelOutgoingPacket != null)
                            packet.Forward = ReceivedAutoWalkCancelOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.Ping:
                    packet = new Packets.Outgoing.PingPacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedPingOutgoingPacket != null)
                            packet.Forward = ReceivedPingOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.FightModes:
                    packet = new Packets.Outgoing.FightModesPacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedFightModesOutgoingPacket != null)
                            packet.Forward = ReceivedFightModesOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.TileUpdate:
                    packet = new Packets.Outgoing.TileUpdatePacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedTitleUpdateOutgoingPacket != null)
                            packet.Forward = ReceivedTitleUpdateOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.PrivateChannelOpen:
                    packet = new Packets.Outgoing.PrivateChannelOpenPacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedPrivateChannelOpenOutgoingPacket != null)
                            packet.Forward = ReceivedPrivateChannelOpenOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                case OutgoingPacketType.ChannelList:
                    packet = new Packets.Outgoing.ChannelListPacket(client);

                    if (packet.ParseMessage(msg, PacketDestination.Server))
                    {
                        if (ReceivedChannelListOutgoingPacket != null)
                            packet.Forward = ReceivedChannelListOutgoingPacket.Invoke(packet);

                        if (packet.Forward)
                            packet.ToNetworkMessage(outMsg);
                    }
                    break;
                default:
                    packetKnown = false;
                    break;
            }

            return packetKnown;
        }
Esempio n. 17
0
 public SetConstantPacket(Client client)
     : base(client)
 {
     Type = PipePacketType.SetConstant;
 }
Esempio n. 18
0
 /// <summary>
 /// Create a new inventory object with the specified client.
 /// </summary>
 /// <param name="c"></param>
 public Console(Client client)
 {
     this.client = client;
 }
Esempio n. 19
0
 //memory tile contructors
 internal Tile(Client client, uint address, uint squareNumber, Location location)
     : this(client, address, squareNumber)
 {
     this.location = location;
 }
Esempio n. 20
0
 public HookSendToServerPacket(Client client)
     : base(client)
 {
     Type = PipePacketType.HookSendToServer;
 }
Esempio n. 21
0
 public RemoveAllTextPacket(Client client)
     : base(client)
 {
     Type = PipePacketType.RemoveAllText;
 }
Esempio n. 22
0
        /// <summary>
        /// Get a list of all the open clients of certain version. Class method.
        /// </summary>
        /// <returns></returns>
        public static List<Client> GetClients(string version, bool offline)
        {
            List<Client> clients = new List<Client>();
            Client client = null;

            foreach (Process process in Process.GetProcesses())
            {
                StringBuilder classname = new StringBuilder();
                Util.WinAPI.GetClassName(process.MainWindowHandle, classname, 12);

                if (classname.ToString().Equals("DirectX5Wnd", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (version == null)
                    {
                        client = new Client(process);
                        if (!offline || !client.LoggedIn())
                            clients.Add(client);
                    }
                    else if (process.MainModule.FileVersionInfo.FileVersion == version)
                    {
                        clients.Add(new Client(process));
                        if (!offline || !client.LoggedIn())
                            clients.Add(client);
                    }
                }
            }
            return clients;
        }
Esempio n. 23
0
 public Window(Client c)
 {
     this.client = c;
     this.statusBar = new Objects.StatusBar(c);
 }
Esempio n. 24
0
 /// <summary>
 /// Create a map object.
 /// </summary>
 /// <param name="c"></param>
 public Map(Client c)
 {
     client = c;
 }
Esempio n. 25
0
 public Proxy(Client client, bool isOtServer)
 {
     try
     {
         this.isOtServer = isOtServer;
         this.client = client;
         Initialize();
     }
     catch (Exception ex)
     {
         WriteDebug(ex.ToString());
     }
 }
Esempio n. 26
0
 /// <summary>
 /// Default constructor, same as Objects.Creature.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="address">The address.</param>
 public Player(Client client, uint address)
     : base(client, address) { }
Esempio n. 27
0
 /// <summary>
 /// Create a new inventory object with the specified client.
 /// </summary>
 /// <param name="c"></param>
 public Console(Client client)
 {
     this.client = client;
 }
Esempio n. 28
0
 /// <summary>
 /// Create a new creature object with the given client and address.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="address">The address.</param>
 public Creature(Client client, uint address)
 {
     this.client = client;
     this.address = address;
 }
Esempio n. 29
0
 internal LoginHelper(Client client) 
 {
     this.client = client; 
 }
Esempio n. 30
0
 public Screen(Client c)
 {
     client = c;
 }
Esempio n. 31
0
 internal PlayerHelper(Client client)
 {
     this.client = client;
 }
Esempio n. 32
0
 internal Vip(Client client, uint address)
 {
     this.client = client;
     this.address = address;
 }