Ejemplo n.º 1
0
        public static Packet CheckNameResult(string pName, bool pUsed)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Check_Name_Result);
            p.WriteMapleString(pName);
            p.WriteByte((byte)(pUsed ? 1 : 0));

            return p;
        }
Ejemplo n.º 2
0
        public static Packet LoginBackground(Dictionary<string, int> pBackgrounds)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Login_Background);

            foreach (KeyValuePair<string, int> Background in pBackgrounds)
            {
                p.WriteMapleString(Background.Key);
                p.WriteByte((byte)Background.Value);
            }

            return p;
        }
Ejemplo n.º 3
0
        public static Packet Login(Client pClient, long pSessionId)
        {
            Packet p = new Packet();

            p.WriteByte((byte)SendOpcodes.Login_Status);
            p.WriteByte(0);
            p.WriteByte(0);
            p.WriteInt(0);

            p.WriteInt(pClient.Account.Id);
            p.WriteByte(0);
            p.WriteBool(false); // TODO: Admin.
            p.WriteByte(1);
            p.WriteMapleString(pClient.Account.Username);
            p.WriteInt(0);
            p.WriteInt(0);
            p.WriteInt(0);

            return p;
        }
Ejemplo n.º 4
0
        public static Packet Worldlist(World pWorld, int[] pLoads)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.World_Information);

            p.WriteByte(pWorld.Id);
            p.WriteMapleString(pWorld.Name);
            p.WriteByte(2); // TODO: Flag.
            p.WriteMapleString(Constants.EventMessage);
            p.WriteShort(100);
            p.WriteShort(100);
            p.WriteByte(0);
            p.WriteByte((byte)pLoads.Length);

            int Id = 1;

            foreach (int Load in pLoads)
            {
                Console.WriteLine("Load: " + Load);
                p.WriteMapleString(String.Format("{0}-{1}", pWorld.Name, Id));
                p.WriteInt(Load * 200);
                p.WriteByte(pWorld.Id);
                p.WriteShort((short)(Id - 1));

                Id++;
            }

            p.WriteShort(0);
            p.WriteInt(0);
            p.WriteByte(0);

            return p;
        }
Ejemplo n.º 5
0
        public static Packet PlayerChat(int pCharacterId, string pMessage, bool pWhiteBackground, byte pShow)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Player_Chat);
            p.WriteInt(pCharacterId);
            p.WriteBool(pWhiteBackground);
            p.WriteMapleString(pMessage);
            p.WriteByte(pShow);

            return p;
        }
Ejemplo n.º 6
0
        public static Packet CharacterEnter(Character pCharacter)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Player_Spawn);
            p.WriteInt(pCharacter.Id);
            p.WriteByte(pCharacter.Level);
            p.WriteMapleString(pCharacter.Name);

            // Quest 111111 -  I don't care for now.
            p.WriteMapleString("");

            // TODO: Guilds!
            p.WriteZero(8);
            p.WriteByte(0);

            // Buffs

            List<Pair<int, int>> BuffValue = new List<Pair<int, int>>();
            List<Pair<int, int>> BuffValueNew = new List<Pair<int, int>>();
            int[] Mask = new int[12];
            Mask[0] |= -33554432;
            Mask[1] |= 512;
            Mask[5] |= 163840;

            for (int i = 0; i < Mask.Length; i++)
            {
                p.WriteInt(Mask[i]);
            }
            foreach (Pair<int, int> i in BuffValue)
            {
                if (i.Right == 3)
                {
                    p.WriteInt(i.Left);
                }
                else if (i.Right == 2)
                {
                    p.WriteShort((short)i.Left);
                }
                else if (i.Right == 1)
                {
                    p.WriteByte((byte)i.Left);
                }
            }
            p.WriteInt(-1);
            if (BuffValueNew.Count < 1)
            {
                p.WriteZero(10);
            }
            else
            {
                p.WriteByte(0);
                foreach (Pair<int, int> i in BuffValueNew)
                {
                    if (i.Right == 4)
                    {
                        p.WriteInt(i.Left);
                    }
                    else if (i.Right == 2)
                    {
                        p.WriteShort((short)i.Left);
                    }
                    else if (i.Right == 1)
                    {
                        p.WriteByte((byte)i.Left);
                    }
                    else if (i.Right == 0)
                    {
                        p.WriteZero((byte)i.Left);
                    }
                }
            }

            p.WriteZero(20);

            int Magic_Spawn = new Random().Next();

            p.WriteByte(1);
            p.WriteInt(Magic_Spawn);
            p.WriteZero(10);
            p.WriteByte(1);
            p.WriteInt(Magic_Spawn);
            p.WriteZero(10);
            p.WriteByte(1);
            p.WriteInt(Magic_Spawn);
            p.WriteShort(0);

            // TODO: Mounts.

            p.WriteLong(0L);

            p.WriteByte(1);
            p.WriteInt(Magic_Spawn);
            p.WriteLong(0L);

            p.WriteByte(1);
            p.WriteInt(Magic_Spawn);
            p.WriteZero(15);

            p.WriteByte(1);
            p.WriteInt(Magic_Spawn);
            p.WriteZero(16);

            p.WriteByte(1);
            p.WriteInt(Magic_Spawn);
            p.WriteShort(0);

            p.WriteShort(pCharacter.Job);
            p.WriteShort(pCharacter.Subcategory);
            HelpPacket.AddCharacterLooks(p, pCharacter, true);
            p.WriteZero(8);

            p.WriteInt(0); // Valentine effect. TODO.
            p.WriteZero(20);
            // Quest 124000.
            p.WriteInt(0);
            p.WriteZero(8);
            p.WriteInt(0);
            p.WriteInt(0); // TODO: Item effect.
            p.WriteInt(0); // TODO: Chair.
            p.WriteInt(0);
            p.WritePosition(pCharacter.Position);
            p.WriteByte(pCharacter.Stance);
            p.WriteShort(pCharacter.Foothold);
            p.WriteByte(0);
            p.WriteByte(0);
            p.WriteByte(0);
            p.WriteShort(1);

            // TODO: Mounts.
            p.WriteInt(0);
            p.WriteInt(0);
            p.WriteInt(0);

            p.WriteByte(0);

            p.WriteByte(0); // TODO: Chalkboard.
            //p.WriteMapleString(Chalkboard Text);

            p.WriteByte(0);
            p.WriteByte(0);

            p.WriteByte(0);

            p.WriteByte(0); // TODO: Berserk.
            p.WriteInt(0);

            p.WriteMapleString("Creating...");
            p.WriteInt(0); // Waru.
            p.WriteInt(0); // Level
            p.WriteInt(0); // EXP
            p.WriteInt(0); // AestheticPoints
            p.WriteInt(0); // Gems
            p.WriteInt(0); // ?
            p.WriteZero(5);
            p.WriteInt(0);

            p.WriteByte(0xFF);
            p.WriteInt(0xFF);

            p.WriteZero(9);

            return p;
        }
Ejemplo n.º 7
0
        public static void AddCharacterInformation(Packet pPacket, Character pCharacter)
        {
            pPacket.WriteInt(-1);
            pPacket.WriteInt(-2097153);
            pPacket.WriteZero(20);
            AddCharacterStats(pPacket, pCharacter);
            pPacket.WriteByte(20); // TODO: Buddylist class.

            pPacket.WriteByte(0);
            pPacket.WriteByte(0);
            pPacket.WriteByte(0);

            AddInventoryInfo(pPacket, pCharacter);
            AddSkillInfo(pPacket, pCharacter);
            AddCooldownInfo(pPacket, pCharacter);
            AddQuestInfo(pPacket, pCharacter);
            AddRingInfo(pPacket, pCharacter);
            AddRocksInfo(pPacket, pCharacter);
            AddMonsterBookInfo(pPacket, pCharacter);

            pPacket.WriteShort(0);
            pPacket.WriteShort(0);

            // TODO: Quest info packet.
            pPacket.WriteShort(0);

            if (Constants.JobConstants.isWildHunter(pCharacter.Job))
                AddJaguarInfo(pPacket, pCharacter);

            pPacket.WriteByte(0);
            AddStealSkills(pPacket, pCharacter);
            AddInnerStats(pPacket, pCharacter);

            pPacket.WriteLong(1);
            pPacket.WriteLong(1);
            pPacket.WriteLong(0);
            pPacket.WriteLong(0);
            pPacket.WriteByte(0);
            pPacket.WriteLong(Tools.GetTime(-2));
            pPacket.WriteInt(0);
            pPacket.WriteByte(0);

            //TODO: Farm Info.
            pPacket.WriteMapleString("Creating...");
            pPacket.WriteInt(0); // Waru.
            pPacket.WriteInt(0); // Level
            pPacket.WriteInt(0); // EXP
            pPacket.WriteInt(0); // AestheticPoints
            pPacket.WriteInt(0); // Gems
            pPacket.WriteInt(0); // ?
            pPacket.WriteZero(5);
            pPacket.WriteInt(0);

            pPacket.WriteZero(13);

            pPacket.WriteLong(Tools.GetTime(-2));

            pPacket.WriteInt(0);
            pPacket.WriteInt(322037760);
            pPacket.WriteZero(68);
            pPacket.WriteLong(Tools.GetTime(Tools.CurrentTimeMillis()));
            pPacket.WriteInt(0);
            pPacket.WriteByte(1);
            pPacket.WriteShort(0);
            pPacket.WriteInt(41870555);
            pPacket.WriteInt(6550069);
            pPacket.WriteLong(4);

            for (int i = 0; i < 4; i++)
                pPacket.WriteLong(9410165 + i);
        }
Ejemplo n.º 8
0
        public static void AddEquipInfo(Packet p, Equip equip, Character c)
        {
            p.WriteByte(1); // Item type. 2 - An item, 3 - A pet. TODO: Pets.
            p.WriteInt(equip.ItemID);

            p.WriteByte(0); // todo: unique id.
            AddExpirationTime(p, equip.Expiration);

            p.WriteByte(0); // TODO: Extended slots.

            p.WriteInt(0); // All values of all stats.

            p.WriteByte(equip.Slots);
            p.WriteByte(equip.Level);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);
            p.WriteShort(equip.Str);

            p.WriteByte(0); // Inc skills?

            p.WriteByte(equip.ItemLevel);
            p.WriteInt(equip.ItemEXP * 100000);
            p.WriteInt(0); // Durability.
            p.WriteInt(equip.ViciousHammer);
            p.WriteShort(0); // PVP Damage.

            p.WriteInt(4);
            p.WriteByte(0xFF);
            p.WriteMapleString(""); // Owner.
            p.WriteByte(0); // State.
            p.WriteByte(0); // Enhance.
            p.WriteShort(0); // ptl1
            p.WriteShort(0); // ptl2
            p.WriteShort(0); // ptl3
            p.WriteShort(0); // bonus ptl 1
            p.WriteShort(0); // bonus ptl2
            p.WriteShort(0);
            p.WriteShort(0);
            p.WriteShort(0); // socket state
            p.WriteShort(0); // socket1
            p.WriteShort(0); // socket 2
            p.WriteShort(0); // socket 3
            //if (equip.CashId > 0)
            //p.writelong
            p.WriteLong(Tools.GetTime(-2));
            p.WriteInt(-1);
        }