public static void Send(Character talkingTo, NonPlayerCharacterClass talker)
        {
            Client client = talkingTo.Client;

            PacketWriter pw = new PacketWriter();

            pw.PushByte(0xdf);
            pw.PushByte(0xdf);
            pw.PushShort(10);
            pw.PushShort(1);
            pw.PushShort(0);
            pw.PushInt(3086);
            pw.PushInt(client.Character.Id);
            pw.PushInt(0x270a4c62);
            pw.PushIdentity(50000, talkingTo.Id);
            pw.PushByte(0);
            pw.PushShort(2);
            pw.PushIdentity(50000, talker.Id);
            pw.PushInt(5);
            pw.PushInt(0);

            byte[] packet = pw.Finish();
            client.SendCompressed(packet);

            // Closing KnuBot window from server side needs to clear KnuBot's variables
            talker.KnuBot.KnuBotCloseChatWindow(talkingTo);
        }
        public static void Send(Character character, int type, int id)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(character.Id);
            packetWriter.PushInt(0x5e477770);
            packetWriter.PushInt(50000);
            packetWriter.PushInt(character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushInt(0xcc);
            packetWriter.PushInt(0);
            packetWriter.PushInt(50000);
            packetWriter.PushInt(character.Id);
            packetWriter.PushInt(type);
            packetWriter.PushInt(id);
            packetWriter.PushShort(0);

            byte[] packet = packetWriter.Finish();
            character.Client.SendCompressed(packet);
        }
        public static void Send(Client client, string text, int color)
        {
            PacketWriter packetWriter = new PacketWriter();
            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushInt(0x206b4b73);
            packetWriter.PushInt(50000);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushByte(1);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0x557e26);
            packetWriter.PushInt(0x21212122);
            packetWriter.PushInt(0x3a212121);
            packetWriter.PushShort(0x293c);
            packetWriter.PushByte(0x73);
            packetWriter.PushByte((byte)text.Length);
            packetWriter.PushString(text);
            packetWriter.PushInt(0);

            byte[] packet = packetWriter.Finish();

            client.SendCompressed(packet);
        }
        public static void SendSource(Character character, int count)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(character.Id);
            packetWriter.PushInt(0x5E477770);
            packetWriter.PushIdentity(50000, character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushInt(0xdf);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);
            packetWriter.PushInt(count);
            packetWriter.PushByte(0);
            packetWriter.PushByte(0);
            byte[] packet = packetWriter.Finish();
            character.Client.SendCompressed(packet);
        }
        public static void SendRequirement(Character character, TradeSkillSkillInfo tradeSkillSkillInfo)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(character.Id);
            packetWriter.PushInt(0x5E477770);
            packetWriter.PushIdentity(50000, character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushInt(0xE3);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);
            packetWriter.PushInt(tradeSkillSkillInfo.Skill);
            packetWriter.PushInt(tradeSkillSkillInfo.Requirement);
            packetWriter.PushByte(0);
            packetWriter.PushByte(0);
            byte[] packet = packetWriter.Finish();
            character.Client.SendCompressed(packet);
        }
        public static void Send(Client cli, NonPlayerCharacterClass knubotTarget, string message)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(cli.Character.Id);
            packetWriter.PushInt(0x5d70532a);
            packetWriter.PushIdentity(cli.Character.Type, cli.Character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushShort(2);
            packetWriter.PushIdentity(knubotTarget.Type, knubotTarget.Id);
            packetWriter.PushInt(0);
            packetWriter.PushInt(message.Length);
            packetWriter.PushString(message);
            packetWriter.PushInt(0);

            byte[] packet = packetWriter.Finish();

            cli.SendCompressed(packet);
        }
Exemplo n.º 7
0
        public static void DespawnPacket(int targetId)
        {
            PacketWriter packetWriter = new PacketWriter();
            packetWriter.PushByte(0xDF);
            packetWriter.PushByte(0xDF);
            packetWriter.PushShort(10);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0x1d);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0x36510078);
            packetWriter.PushIdentity(50000, targetId);
            packetWriter.PushByte(1);
            byte[] packet = packetWriter.Finish();

            Dynel dyn = FindDynel.FindDynelById(50000, targetId);
            if (dyn != null)
            {
                NonPlayerCharacterClass npc = dyn as NonPlayerCharacterClass;
                if (npc != null)
                {
                    npc.RemoveFromCache();
                }
                Announce.PlayfieldOthers(dyn.PlayField, packet);
            }
        }
        public static void SendResult(Character character, int min, int max, int low, int high)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(character.Id);
            packetWriter.PushInt(0x5E477770);
            packetWriter.PushIdentity(50000, character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushInt(0xE4);
            packetWriter.PushInt(0);
            packetWriter.PushInt(max);
            packetWriter.PushInt(high);
            packetWriter.PushInt(min);
            packetWriter.PushInt(low);
            packetWriter.PushByte(0);
            packetWriter.PushByte(0);
            byte[] pack = packetWriter.Finish();
            character.Client.SendCompressed(pack);
        }
        public void LeaveTeam(Client sendingPlayer)
        {
            // Send Team Request To Other Player

            PacketWriter pktTeamRequest = new PacketWriter();
            pktTeamRequest.PushByte(0xDF);
            pktTeamRequest.PushByte(0xDF); // Header
            pktTeamRequest.PushShort(0xA); // Packet Type
            pktTeamRequest.PushShort(1); // Unknown 1
            pktTeamRequest.PushShort(0); // Legnth
            pktTeamRequest.PushInt(3086); // Sender
            pktTeamRequest.PushInt(sendingPlayer.Character.Id); // Reciever
            pktTeamRequest.PushInt(0x5e477770); // Packet ID
            pktTeamRequest.PushIdentity(50000, sendingPlayer.Character.Id); // TYPE / ID
            pktTeamRequest.PushByte(0);
            pktTeamRequest.PushInt(0x20); // Action ID
            pktTeamRequest.PushInt(0);
            pktTeamRequest.PushInt(50000);
            pktTeamRequest.PushInt(sendingPlayer.Character.Id);
            pktTeamRequest.PushInt(0x2EA0022); // Team ID Variable Goes Here
            pktTeamRequest.PushByte(0xFF);
            pktTeamRequest.PushByte(0xFF);
            pktTeamRequest.PushByte(0xFF);
            pktTeamRequest.PushByte(0xFF);
            pktTeamRequest.PushShort(0);

            byte[] teamRequestPacket = pktTeamRequest.Finish();
            sendingPlayer.SendCompressed(teamRequestPacket);
        }
        public static void Send(Character character, InventoryEntries inventoryEntries)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(character.Id);
            packetWriter.PushInt(0x52526858);
            packetWriter.PushInt(50000);
            packetWriter.PushInt(character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushInt(1);
            packetWriter.PushInt(3);
            packetWriter.PushInt(3);
            packetWriter.PushInt(0);
            packetWriter.PushInt(50000);
            packetWriter.PushInt(character.Id);
            packetWriter.PushInt(inventoryEntries.Container);
            packetWriter.PushInt(inventoryEntries.Placement);
            byte[] pack = packetWriter.Finish();
            character.Client.SendCompressed(pack);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="client"></param>
 /// <param name="writer"></param>
 /// <param name="statId"></param>
 private static void WriteStat3232(Client client, PacketWriter writer, int statId)
 {
     /* Stat */
     writer.PushInt(statId);
     /* Value */
     writer.PushUInt(client.Character.Stats.GetBaseValue(statId));
 }
Exemplo n.º 12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="client"></param>
        public static void GetDynels(Client client)
        {
            foreach (Client clients in client.Server.Clients)
            {
                PacketWriter packetWriter;
                if ((clients.Character.PlayField == client.Character.PlayField)
                    && (clients.Character.Id != client.Character.Id))
                {
                    SimpleCharFullUpdate.SendToOne(clients.Character, client);

                    // Send CharacterInPlay packet 
                    // TODO: Move this out to own file
                    packetWriter = new PacketWriter();
                    packetWriter.PushByte(0xDF);
                    packetWriter.PushByte(0xDF);
                    packetWriter.PushShort(10);
                    packetWriter.PushShort(1);
                    packetWriter.PushShort(0);
                    packetWriter.PushInt(3086);
                    packetWriter.PushInt(client.Character.Id);
                    packetWriter.PushInt(0x570C2039);
                    packetWriter.PushIdentity(50000, clients.Character.Id);
                    packetWriter.PushByte(0);
                    byte[] reply2 = packetWriter.Finish();
                    client.SendCompressed(reply2);
                }
            }
        }
        public static void Send(Client cli, NonPlayerCharacterClass knubotTarget, AOItem[] items)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(cli.Character.Id);
            packetWriter.PushInt(0x7864401d);
            packetWriter.PushIdentity(cli.Character.Type, cli.Character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushShort(2);
            packetWriter.PushIdentity(knubotTarget.Type, knubotTarget.Id);
            packetWriter.PushInt(items.Length);
            foreach (AOItem item in items)
            {
                packetWriter.PushInt(item.LowID);
                packetWriter.PushInt(item.HighID);
                packetWriter.PushInt(item.Quality);
                packetWriter.PushInt(0x499602d2); // 1234567890  ???????
            }
            packetWriter.PushInt(0);

            byte[] packet = packetWriter.Finish();

            cli.SendCompressed(packet);
        }
        public static void Send(Client cli, NonPlayerCharacterClass knubotTarget, string[] choices)
        {
            PacketWriter pw = new PacketWriter();

            pw.PushByte(0xdf);
            pw.PushByte(0xdf);
            pw.PushShort(0xa);
            pw.PushShort(1);
            pw.PushShort(0);
            pw.PushInt(3086);
            pw.PushInt(cli.Character.Id);
            pw.PushInt(0x55704d31);
            pw.PushIdentity(cli.Character.Type, cli.Character.Id);
            pw.PushByte(0);
            pw.PushShort(2);
            pw.PushIdentity(knubotTarget.Type, knubotTarget.Id);
            pw.PushInt(choices.Length);
            foreach (string choice in choices)
            {
                pw.PushInt(choice.Length);
                pw.PushString(choice);
            }

            byte[] packet = pw.Finish();

            cli.SendCompressed(packet);
        }
        public static void Send(Character character, InventoryEntries inventoryEntry)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(character.Id);
            packetWriter.PushInt(0x35505644);
            packetWriter.PushInt(50000);
            packetWriter.PushInt(character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushInt(inventoryEntry.Item.LowID);
            packetWriter.PushInt(inventoryEntry.Item.HighID);
            packetWriter.PushInt(inventoryEntry.Item.Quality);
            packetWriter.PushInt(1); // Unknown
            packetWriter.PushInt(3); // Consume??
            packetWriter.PushInt(inventoryEntry.Container);
            packetWriter.PushInt(inventoryEntry.Placement);
            packetWriter.PushInt(0); // Unknown
            packetWriter.PushInt(0); // Unknown

            byte[] packet = packetWriter.Finish();
            character.Client.SendCompressed(packet);
        }
Exemplo n.º 16
0
        public static void Send(Client client, int stat, uint value, bool announce)
        {
            PacketWriter writer = new PacketWriter();
            writer.PushBytes(new byte[] { 0xDF, 0xDF, });
            writer.PushShort(10);
            writer.PushShort(1);
            writer.PushShort(0);
            writer.PushInt(3086);
            writer.PushInt(client.Character.Id);
            writer.PushInt(0x2B333D6E);
            writer.PushIdentity(50000, client.Character.Id);
            writer.PushByte(1);
            writer.PushInt(1);
            writer.PushInt(stat);
            writer.PushUInt(value);

            byte[] packet = writer.Finish();
            client.SendCompressed(packet);

            /* announce to playfield? */
            if (announce)
            {
                Announce.PlayfieldOthers(client, packet);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Set own stat (no announce)
        /// </summary>
        /// <param name="client">Affected client</param>
        /// <param name="stat">Stat</param>
        /// <param name="value">Value</param>
        /// <param name="announce">Let others on same playfield know?</param>
        public static uint Set(Client client, int stat, uint value, bool announce)
        {
            PacketWriter packetWriter = new PacketWriter();

            uint oldValue = (uint)client.Character.Stats.StatValueByName(stat);
            client.Character.Stats.SetStatValueByName(stat, value);

            packetWriter.PushBytes(new byte[] { 0xDF, 0xDF, });
            packetWriter.PushShort(10);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushInt(0x2B333D6E);
            packetWriter.PushIdentity(50000, client.Character.Id);
            packetWriter.PushByte(1);
            packetWriter.PushInt(1);
            packetWriter.PushInt(stat);
            packetWriter.PushUInt(value);

            byte[] packet = packetWriter.Finish();
            client.SendCompressed(packet);

            /* announce to playfield? */
            if (announce)
            {
                Announce.Playfield(client.Character.PlayField, packet);
            }

            return oldValue;
        }
        public static void SendOwner(Client client, Character character)
        {
            // ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
            // ## Weapon Item Full Update - Test ## Do Not attempt to send this packet until all values have been Verified ##
            // ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##

            // notes: one packet has to be sent for each hand!!!!!!! (more for each weapon, see below)
            // Packet only sent when Weapons are in Posession or being equipped the first time

            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xDF); // starter
            packetWriter.PushByte(0xDF); // starter
            packetWriter.PushShort(0xA);
            packetWriter.PushShort(0x1);
            packetWriter.PushShort(0); // Length
            packetWriter.PushInt(3086); // Sender
            packetWriter.PushInt(character.Id); // Reciever
            packetWriter.PushInt(0x3B1D2268); // Packet ID
            packetWriter.PushInt(0xC74A); // Type Weapon (always instanced)
            packetWriter.PushInt(0x45AEE789);
            // Instance of Weapon, hardcoding this causes a crash if you want to equip more than one weapon
            packetWriter.PushByte(0);
            packetWriter.PushInt(0xB);
            packetWriter.PushInt(character.Type);
            packetWriter.PushInt(character.Id); // Reciever
            packetWriter.PushInt(0xC0A);
            packetWriter.PushInt(0xF424F); // constant
            packetWriter.PushShort(0);
            packetWriter.PushInt(0x6); // Placement/Location Maybe?
            packetWriter.PushInt(0x1F88); // Another Constant

            // Stat 1
            packetWriter.PushInt(0); // constant Flags
            packetWriter.PushUInt(0x403); // Item Flag
            // Stat 2
            packetWriter.PushInt(0x17); // constant Static Instance?
            packetWriter.PushInt(0x1e6d0); // Weapon ITEM ID
            // Stat 3
            packetWriter.PushInt(0x2BD); //constant ACG Item Level
            packetWriter.PushInt(0x5); // Quality-Level
            // Stat 4
            packetWriter.PushInt(0x2BE); // constant ACGItemTemplateID
            packetWriter.PushInt(0x1e6d0); // Weapon ITEM ID (low ID)
            // Stat 5
            packetWriter.PushInt(0x2BF); // constant ACGItemTemplateID2
            packetWriter.PushInt(0x1e6d1); // High ID
            // Stat 6
            packetWriter.PushInt(0x19C); // Constant MultipleCount
            packetWriter.PushInt(0x1); // Amount
            // Stat 7
            packetWriter.PushInt(0x1A); // Constant Energy
            packetWriter.PushUInt(0x28); // Ammo
            // End
            packetWriter.PushInt(0); // Empty fill

            byte[] packet = packetWriter.Finish();
            client.SendCompressed(packet);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="client"></param>
        /// <param name="writer"></param>
        /// <param name="statId"></param>
        private static void WriteStat816(Client client, PacketWriter writer, int statId)
        {
            if (statId > 255)
            {
                Console.WriteLine("WriteStat816 statId(" + statId + ") > 255");
            }

            /* Stat */
            writer.PushByte((byte)statId);
            /* Value */
            writer.PushShort((short)client.Character.Stats.GetBaseValue(statId));
        }
        public static void Send(Client client, VendingMachine vendingMachine)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushInt(0x7f544905); // 20
            packetWriter.PushIdentity(vendingMachine.Type, vendingMachine.Id);
            packetWriter.PushByte(0);
            packetWriter.PushInt(0xb); // Counter??
            packetWriter.PushInt(0);
            packetWriter.PushInt(0); // 41
            packetWriter.PushCoord(vendingMachine.Coordinates);
            packetWriter.PushQuat(vendingMachine.Heading); // 69
            packetWriter.PushInt(vendingMachine.PlayField);
            packetWriter.PushInt(1000015);
            packetWriter.PushInt(0);
            packetWriter.PushShort(0x6f);
            packetWriter.PushInt(0x2379);
            packetWriter.PushInt(0); // 91
            packetWriter.PushByte(0x80);
            packetWriter.PushByte(2);
            packetWriter.PushShort(0x3603);
            packetWriter.PushInt(0x17);
            packetWriter.PushInt(vendingMachine.TemplateId);
            packetWriter.PushInt(0x2bd);
            packetWriter.PushInt(0); // 111
            packetWriter.PushInt(0x2be);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0x2bf);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0x19c); // 131
            packetWriter.PushInt(1);
            packetWriter.PushInt(0x1f5);
            packetWriter.PushInt(2);
            packetWriter.PushInt(0x1f4);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);
            packetWriter.PushInt(2);
            packetWriter.PushInt(0x32); // 147
            packetWriter.Push3F1Count(0);
            packetWriter.PushInt(3); // 155<

            byte[] packet = packetWriter.Finish();
            client.SendCompressed(packet);
        }
        public static void Send(Client client, int category, int instance, object[] args)
        {
            PacketWriter packetWriter = new PacketWriter();
            packetWriter.PushByte(0xDF);
            packetWriter.PushByte(0xDF);
            packetWriter.PushShort(10);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0x206B4B73);
            packetWriter.PushIdentity(50000, client.Character.Id);
            packetWriter.PushByte(1);
            packetWriter.PushInt(0);

            string message = "&~" + Encode85By4(category) + "&:" + Encode85By4(instance);

            foreach (object arg in args)
            {
                if (arg is Int32)
                {
                    message = message + "i" + Encode85By5((Int32)arg);
                }
                string stringArg = arg as string;
                if (stringArg != null)
                {
                    if (stringArg.Length > 255)
                    {
                        message = message + "S";
                        Int16 len = (Int16)stringArg.Length;
                        message = message + ShortToChar(len) + stringArg;
                    }
                    else
                    {
                        message = message + "s" + ByteToChar((byte)(stringArg.Length));
                    }
                }
            }

            Int16 mlen = (Int16)(message.Length);
            packetWriter.PushShort(mlen);
            packetWriter.PushString(message);
            packetWriter.PushInt(1);

            byte[] packet = packetWriter.Finish();
            client.SendCompressed(packet);
        }
Exemplo n.º 22
0
 public static void Send(Client client)
 {
     PacketWriter packetWriter = new PacketWriter();
     packetWriter.PushByte(0xdf);
     packetWriter.PushByte(0xdf);
     packetWriter.PushShort(0xa);
     packetWriter.PushShort(1);
     packetWriter.PushShort(0); // Length
     packetWriter.PushInt(3086);
     packetWriter.PushInt(client.Character.Id);
     packetWriter.PushInt(0x343c287f);
     packetWriter.PushIdentity(50000, client.Character.Id);
     packetWriter.PushByte(1);
     packetWriter.PushInt(0);
     packetWriter.PushInt(0);
     packetWriter.PushInt(0);
     packetWriter.Push3F1Count(client.Character.Bank.Count);
     foreach (AOItem item in client.Character.Bank)
     {
         packetWriter.PushInt(item.Flags); // misused the flags for position in the bank
         short flags = 0;
         if (item.isInstanced())
         {
             flags |= 0xa0;
         }
         if (item.LowID == item.HighID)
         {
             flags |= 2;
         }
         else
         {
             flags |= 1;
         }
         // perhaps there are more flags...
         packetWriter.PushShort(flags);
         packetWriter.PushShort((short)item.MultipleCount);
         packetWriter.PushInt(item.Type);
         packetWriter.PushInt(item.Instance);
         packetWriter.PushInt(item.LowID);
         packetWriter.PushInt(item.HighID);
         packetWriter.PushInt(item.Quality);
         packetWriter.PushInt(0); // didnt encounter any other value
     }
     byte[] reply = packetWriter.Finish();
     client.SendCompressed(reply);
 }
Exemplo n.º 23
0
        public static void OrgInfoPacket(Character character)
        {
            PacketWriter writer = new PacketWriter();

            writer.PushByte(0xDF);
            writer.PushByte(0xDF);
            writer.PushShort(10);
            writer.PushShort(1);
            writer.PushShort(0);
            writer.PushInt(3086);
            writer.PushInt(character.Id);
            writer.PushInt(0x2E2A4A6B);
            writer.PushIdentity(50000, character.Id);
            writer.PushByte(0);
            writer.PushShort((short)character.OrgName.Length);
            writer.PushBytes(Encoding.ASCII.GetBytes(character.OrgName));
            byte[] mReply = writer.Finish();
            Announce.Playfield(character.PlayField, mReply);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="client"></param>
        public static void Send(Client client)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushBytes(new byte[] { 0xDF, 0xDF });
            packetWriter.PushShort(10);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushInt(0x5F4B1A39);
            packetWriter.PushIdentity(40016, client.Character.PlayField);
            packetWriter.PushByte(0);

            packetWriter.PushInt(4);
            packetWriter.PushCoord(client.Character.Coordinates);
            packetWriter.PushByte(97);
            packetWriter.PushIdentity(51100, client.Character.PlayField);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);
            packetWriter.PushIdentity(40016, client.Character.PlayField);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);

            int vendorcount = VendorHandler.GetNumberofVendorsinPlayfield(client.Character.PlayField);
            if (vendorcount > 0)
            {
                packetWriter.PushInt(51035);
                packetWriter.PushInt(1);
                packetWriter.PushInt(1);
                packetWriter.PushInt(vendorcount);
                packetWriter.PushInt(VendorHandler.GetFirstVendor(client.Character.PlayField));
            }
            // TODO: Use correct World Position for each "outdoors" playfield -Suiv-
            // Playfield WorldPos X
            packetWriter.PushInt(Playfields.GetPlayfieldX(client.Character.PlayField));
            // Playfield WorldPos Z
            packetWriter.PushInt(Playfields.GetPlayfieldZ(client.Character.PlayField));

            byte[] packet = packetWriter.Finish();
            client.SendCompressed(packet);
        }
Exemplo n.º 25
0
        public override void ExecuteCommand(Client client, Identity target, string[] args)
        {
            // No check needed, its done by CheckCommandArguments
            int gfx = int.Parse(args[3]);

            //begin assembling packet here
            PacketWriter packet = new PacketWriter();
            packet.PushByte(0xDF);
            packet.PushByte(0xDF);
            packet.PushShort(10);
            packet.PushShort(1);
            packet.PushShort(0);
            packet.PushInt(3086);
            packet.PushInt(client.Character.Id);
            packet.PushInt(0x4D450114);
            packet.PushIdentity(target);
            packet.PushByte(0);
            packet.Push3F1Count(1); // effects count
            // effect starts
            packet.PushIdentity(53030, 0); // effect ID (53030 = GfxEffect)
            packet.PushInt(4); // ?
            packet.PushInt(0); // Criterion count
            packet.PushInt(1); // Hits
            packet.PushInt(0); // Delay
            packet.PushInt(0); // 
            packet.PushInt(0); // 
            // effect args
            packet.PushInt(gfx); // Value
            packet.PushInt(0); // GfxLife
            packet.PushInt(0); // GfxSize
            packet.PushInt(0); // GfxRed
            packet.PushInt(0); // GfxGreen
            packet.PushInt(0); // GfxBlue
            packet.PushInt(0); // GfxFade
            // effect args end
            // effect ends
            packet.PushIdentity(50000, client.Character.Id);
            byte[] reply = packet.Finish();
            //done creating the packet
            Announce.Playfield(client.Character.PlayField, reply);
        }
Exemplo n.º 26
0
        public static void Send(Client client, Dynel dynel1, Dynel dynel2)
        {
            PacketWriter packetWriter = new PacketWriter();
            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushInt(0x36284f6e);
            packetWriter.PushIdentity(dynel1.Type, dynel1.Id);
            packetWriter.PushByte(0);
            packetWriter.PushInt(1); // Knubot sends 2 here
            packetWriter.PushByte(0); // and 2 here too
            packetWriter.PushIdentity(dynel2.Type, dynel2.Id); // knubot 0
            packetWriter.PushIdentity(0xc767, 0x39da2458); // temp bag ID?? Knubot 0, needs more testing....

            byte[] packet = packetWriter.Finish();
            client.SendCompressed(packet);
        }
        /// <summary>
        /// Sends chat server info to client
        /// </summary>
        /// <param name="client">Client that gets the info</param>
        public static void Send(Client client)
        {
            /* get chat settings from config */
            string chatServerIp = string.Empty;
            IPAddress tempIp;
            if (IPAddress.TryParse(ConfigReadWrite.Instance.CurrentConfig.ChatIP, out tempIp))
            {
                chatServerIp = ConfigReadWrite.Instance.CurrentConfig.ChatIP;
            }
            else
            {
                IPHostEntry chatHost = Dns.GetHostEntry(ConfigReadWrite.Instance.CurrentConfig.ChatIP);
                foreach (IPAddress ip in chatHost.AddressList)
                {
                    if (ip.AddressFamily == AddressFamily.InterNetwork)
                    {
                        chatServerIp = ip.ToString();
                        break;
                    }
                }
            }
            int chatPort = Convert.ToInt32(ConfigReadWrite.Instance.CurrentConfig.ChatPort);

            PacketWriter writer = new PacketWriter();

            writer.PushBytes(new byte[] { 0xDF, 0xDF });
            writer.PushShort(1);
            writer.PushShort(1);
            writer.PushShort(0);
            writer.PushInt(3086);
            writer.PushInt(client.Character.Id);
            writer.PushInt(67);
            writer.PushInt(1);
            writer.PushInt(chatServerIp.Length);
            writer.PushBytes(Encoding.ASCII.GetBytes(chatServerIp));
            writer.PushInt(chatPort);
            writer.PushInt(0);
            byte[] packet = writer.Finish();
            client.SendCompressed(packet);
        }
        public static void SendOwner(Client client, VendingMachine vendingMachine, int itemNumber)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushInt(0x3b11256f);
            packetWriter.PushIdentity(0xc76e, 0x021fa86f); // whats this one???
            packetWriter.PushByte(0);
            packetWriter.PushInt(11);
            packetWriter.PushIdentity(client.Character.Type, client.Character.Id);
            packetWriter.PushInt(client.Character.PlayField);
            packetWriter.PushInt(0x0f424f);
            packetWriter.PushInt(0);
            packetWriter.PushShort(0x656f); // ??????
            packetWriter.Push3F1Count(6);
            packetWriter.PushInt(0);
            packetWriter.PushByte(0x80);
            packetWriter.PushByte(0);
            packetWriter.PushShort(0x0203);
            packetWriter.PushInt(0x17);
            packetWriter.PushInt(vendingMachine.Inventory[itemNumber].Item.LowID);
            // TODO: Three times low id and no high id?
            packetWriter.PushInt(0x2bd);
            packetWriter.PushInt(1);
            packetWriter.PushInt(0x2be);
            packetWriter.PushInt(vendingMachine.Inventory[itemNumber].Item.LowID);
            packetWriter.PushInt(0x2bf);
            packetWriter.PushInt(vendingMachine.Inventory[itemNumber].Item.LowID);
            packetWriter.PushInt(0x19c);
            packetWriter.PushInt(1);
            packetWriter.PushInt(0);
            // TODO: Actually send the data, probably research needed
        }
        public static void Send(Client client, NonPlayerCharacterClass knubotTarget)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushInt(0x3b132d64);
            packetWriter.PushIdentity(client.Character.Type, client.Character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushShort(2);
            packetWriter.PushIdentity(knubotTarget.Type, knubotTarget.Id);
            packetWriter.PushInt(1);
            packetWriter.PushInt(0);

            byte[] packet = packetWriter.Finish();

            client.SendCompressed(packet);
        }
        public static void Send(Client client, InventoryEntries inventoryEntry)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushByte(0xdf);
            packetWriter.PushByte(0xdf);
            packetWriter.PushShort(0xa);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushInt(0x052e2f0c);
            packetWriter.PushIdentity(client.Character.Type, client.Character.Id);
            packetWriter.PushByte(0);
            packetWriter.PushInt(inventoryEntry.Item.LowID);
            packetWriter.PushInt(inventoryEntry.Item.HighID);
            packetWriter.PushInt(inventoryEntry.Item.Quality);
            packetWriter.PushInt(inventoryEntry.Item.MultipleCount);

            byte[] packet = packetWriter.Finish();

            client.SendCompressed(packet);
        }