Ejemplo n.º 1
0
        public static Packet CreateCharacterResult(Character pCharacter, bool pValid)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Create_Character_Result);
            p.WriteByte((byte)(pValid ? 0 : 1));
            HelpPacket.AddCharacterImage(p, pCharacter, false, false);

            return p;
        }
        public static Packet StatChange(Character pCharacter, uint pFlag, short pValue, bool pSelf = false)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Stats_Update);
            p.WriteBool(pSelf);
            p.WriteUInt(pFlag);
            p.WriteShort(pValue);

            return p;
        }
Ejemplo n.º 3
0
        public Inventory(Character pOwner, InventoryType invtype, byte slotLimit = 96)
        {
            Items = new Dictionary<byte, Item>(slotLimit);
              Equips = new Dictionary<short, Equip>();

              if ((int)invtype >= 2 || (int)invtype <= 5)
                  ItemAmounts = new Dictionary<int, short>();

              SlotLimit = slotLimit;
              InventoryType = invtype;
              Owner = pOwner;
        }
Ejemplo n.º 4
0
        public static void UpdatePosition(List<LifeMovementFragment> pMovement, Character pCharacter, short pYOffset)
        {
            if (pMovement == null)
            {
                return;
            }

            foreach (LifeMovementFragment Move in pMovement)
            {
                Pos Position = ((LifeMovement)Move).GetPosition();
                Position.Y += pYOffset;
                pCharacter.Position = Position;
                pCharacter.Stance = (byte)((LifeMovement)Move).GetNewState();
            }
        }
Ejemplo n.º 5
0
        public static void AddCharacterImage(Packet pPacket, Character pCharacter, bool pRanked, bool pViewAll)
        {
            AddCharacterStats(pPacket, pCharacter);
            AddCharacterLooks(pPacket, pCharacter, true);

            if (!pViewAll)
                pPacket.WriteByte(0);

            pPacket.WriteByte((byte)(pRanked ? 1 : 0));

            if (pRanked)
            {
                //TODO: Ranking Stats.
                pPacket.WriteInt(100);
                pPacket.WriteInt(100);
                pPacket.WriteInt(200);
                pPacket.WriteInt(200);
            }
        }
Ejemplo n.º 6
0
        public static void AddStolenSkills(Packet p, Character c, int jobNum, bool writeJob)
        {
            if (writeJob)
            {
                p.WriteInt(jobNum);
            }

            int count = 0;
            while (count < Constants.SkillConstants.getNumSteal(jobNum))
            {
                p.WriteInt(0);
                count++;
            }
        }
Ejemplo n.º 7
0
        public static void AddStealSkills(Packet p, Character c)
        {
            for (int i = 1; i <= 4; i++)
            {
                AddStolenSkills(p, c, i, false);
            }

            AddChosenSkills(p, c);
        }
Ejemplo n.º 8
0
        public static void AddSkillInfo(Packet p, Character c)
        {
            //Dictionairy of skill, skillentry of character's skills.

            p.WriteByte(1);
            p.WriteShort(0); // Skills size.

            //For each skill - writeInt(SkillID), WriteInt(SkillLevel), addExpirationTime of skill, If skill is fourth job skill - WriteInt(MasterLevel).
        }
Ejemplo n.º 9
0
 public static void AddAnnounceBox(Packet p, Character c)
 {
     //TODO.
     p.WriteByte(0);
 }
Ejemplo n.º 10
0
        public static Packet EnterFieldNew(Character pCharacter)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Field_Enter);
            p.WriteShort(2);
            p.WriteLong(1L);
            p.WriteLong(2L);
            p.WriteLong(pCharacter.Client.Channel);
            p.WriteByte(0);
            p.WriteByte(1);
            p.WriteInt(0);
            p.WriteByte(1);
            p.WriteShort(0);

            PlayerRandomStream PRS = new PlayerRandomStream();
            PRS.ConnectData(p);
            HelpPacket.AddCharacterInformation(p, pCharacter);

            p.WriteInt(0);
            p.WriteLong(Tools.GetTime(Tools.CurrentTimeMillis()));
            p.WriteInt(100);
            p.WriteShort(0);
            p.WriteByte(1);

            return p;
        }
Ejemplo n.º 11
0
 public static void AddChosenSkills(Packet p, Character c)
 {
     //TODO: Chosen skills.
     for (int i = 1; i <= 4; i++)
     {
         p.WriteInt(0);
     }
 }
Ejemplo n.º 12
0
        public static void HandleCreateCharacter(Client pClient, Packet pPacket)
        {
            if (pClient.Account.LoggedIn != 1) { return; }

            List<Equip> equips = new List<Equip>();

            string name = pPacket.ReadMapleString();
            pPacket.ReadInt();

            int startMap = 0;

            int jobType = pPacket.ReadInt();
            short jobSubtype = pPacket.ReadShort();
            byte gender = pPacket.ReadByte();
            byte skin = pPacket.ReadByte();
            pPacket.ReadByte();
            int face = pPacket.ReadInt();
            int hair = pPacket.ReadInt();
            int hairColor = -1, faceMark = -1, topId, bottomId = -1, capeId = -1, shoesId, weaponId, shieldId = -1;

            if (Constants.CharacterCreation.hasHairColor(jobType))
                hairColor = pPacket.ReadInt();
            if (Constants.CharacterCreation.hasSkinColor(jobType))
                pPacket.ReadInt();
            if (Constants.CharacterCreation.hasFaceMark(jobType))
                faceMark = pPacket.ReadInt();
            if (Constants.CharacterCreation.hasHat(jobType))
            {
                int capId = pPacket.ReadInt();
                Equip cap = new Equip();
                cap.ItemID = capId;
                cap.GiveStats(false);
                cap.InventorySlot = -1;

                equips.Add(cap);
            }
            topId = pPacket.ReadInt();
            Equip top = new Equip();
            top.ItemID = topId;
            top.GiveStats(false);
            top.InventorySlot = -5;

            equips.Add(top);
            if (Constants.CharacterCreation.hasBottom(jobType))
            {
                bottomId = pPacket.ReadInt();
                Equip bottom = new Equip();
                bottom.ItemID = bottomId;
                bottom.GiveStats(false);
                bottom.InventorySlot = -6;

                equips.Add(bottom);
            }
            if (Constants.CharacterCreation.hasCape(jobType))
            {
                capeId = pPacket.ReadInt();
                Equip cape = new Equip();
                cape.ItemID = capeId;
                cape.GiveStats(false);
                cape.InventorySlot = -9;

                equips.Add(cape);
            }
            shoesId = pPacket.ReadInt();
            Equip shoes = new Equip();
            shoes.ItemID = shoesId;
            shoes.GiveStats(false);
            shoes.InventorySlot = -7;

            equips.Add(shoes);
            weaponId = pPacket.ReadInt();
            Equip weapon = new Equip();
            weapon.ItemID = weaponId;
            weapon.GiveStats(false);
            weapon.InventorySlot = -11;

            equips.Add(weapon);
            if (jobType == (int)Constants.CharacterCreation.CreateTypes.Demon)
            {
                shieldId = pPacket.ReadInt();
                Equip shield = new Equip();
                shield.ItemID = shieldId;
                shield.GiveStats(false);
                shield.InventorySlot = -10;

                equips.Add(shield);
            }
            Character newChr = new Character();

            newChr.Client = pClient;
            newChr.AccountId = pClient.Account.Id;
            newChr.WorldId = pClient.World;

            newChr.Name = name;

            newChr.MapId = Constants.CharacterCreation.GetMapByType(jobType);
            if (hairColor < 0) hairColor = 0;
            if (jobType != (short)Constants.CharacterCreation.CreateTypes.Mihile)
            {
                hair += hairColor;
            }
            newChr.HairId = hair;
            newChr.FaceId = face;
            newChr.SkinColor = (byte)skin;
            newChr.Gender = gender;
            if (faceMark < 0) faceMark = 0;
            newChr.FaceMarking = faceMark;

            newChr.Job = Constants.CharacterCreation.GetJobByType(jobType);
            newChr.Level = 1;
            newChr.HP = 50;
            newChr.MaxHP = 50;
            newChr.MP = 50;
            newChr.MaxMP = 50;
            newChr.Str = 4;
            newChr.Dex = 4;
            newChr.Int = 4;
            newChr.Luk = 4;

            newChr.ApHp = 0;

            newChr.MapId = startMap;

            pClient.Account.Characters.Add(newChr);

            try
            {
                newChr.Create();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error creating character for {0}, Exception: {1}.", pClient.Session.IP, ex.Message);
                pClient.Session.Disconnect();
                return;
            }

            newChr.Id = Master.Instance.Accessor.GetLastId();

            Master.Instance.Accessor.AppendInventories(newChr, true);
            Master.Instance.Accessor.LoadInventoriesId(newChr);
            Master.Instance.Accessor.CreateEquips(newChr, equips);

            foreach (KeyValuePair<InventoryType, Inventory> inv in newChr.Inventory)
                inv.Value.Save();

            //TODO: Check for forbidden names and stuff like so.
            pClient.SendPacket(LoginPacket.CreateCharacterResult(newChr, true));
        }
Ejemplo n.º 13
0
 public static void AddJaguarInfo(Packet p, Character c)
 {
     p.WriteByte(0); // Record of quest: 111112.
     p.WriteZero(20);
 }
Ejemplo n.º 14
0
 public static void AddItemInfo(Packet p, Item item, Character c)
 {
     //TODO: This shit.
 }
Ejemplo n.º 15
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.º 16
0
        public static void AddInventoryInfo(Packet p, Character c)
        {
            p.WriteLong(c.Meso);
            p.WriteLong(0);

            p.WriteByte(c.Inventory[InventoryType.EQUIP].SlotLimit);
            p.WriteByte(c.Inventory[InventoryType.USE].SlotLimit);
            p.WriteByte(c.Inventory[InventoryType.SETUP].SlotLimit);
            p.WriteByte(c.Inventory[InventoryType.ETC].SlotLimit);
            p.WriteByte(c.Inventory[InventoryType.CASH].SlotLimit);

            //Quest:122700, idc.
            p.WriteLong(Tools.GetTime(-2L));

            //foreach (KeyValuePair<short, Equip> equip in c.Inventory[InventoryType.EQUIPPED].Equips)
            //{
            //    if (equip.Key < 0 && equip.Key > -100)
            //    {
            //        AddEquipPosition(p, equip.Value, false, false);
            //        AddEquipInfo(p, equip.Value, c);
            //    }
            //}
            p.WriteShort(0);

            //foreach (KeyValuePair<short, Equip> equip in c.Inventory[InventoryType.EQUIPPED].Equips)
            //{
            //    if (equip.Key <= -100 && equip.Key > -1000)
            //    {
            //        AddEquipPosition(p, equip.Value, false, false);
            //        AddEquipInfo(p, equip.Value, c);
            //    }
            //}
            p.WriteShort(0);

            //foreach (KeyValuePair<short, Equip> equip in c.Inventory[InventoryType.EQUIP].Equips)
            //{
            //        AddEquipPosition(p, equip.Value, false, false);
            //        AddEquipInfo(p, equip.Value, c);
            //}
            p.WriteShort(0);

            //foreach (KeyValuePair<short, Equip> equip in c.Inventory[InventoryType.EQUIPPED].Equips)
            //{
            //    if (equip.Key <= -1000 && equip.Key > - 1100) {
            //        AddEquipPosition(p, equip.Value, false, false);
            //        AddEquipInfo(p, equip.Value, c);
            //    }
            //}
            p.WriteShort(0);

            //foreach (KeyValuePair<short, Equip> equip in c.Inventory[InventoryType.EQUIPPED].Equips)
            //{
            //    if (equip.Key <= -1100 && equip.Key > - 1200) {
            //        AddEquipPosition(p, equip.Value, false, false);
            //        AddEquipInfo(p, equip.Value, c);
            //    }
            //}
            p.WriteShort(0);

            //foreach (KeyValuePair<short, Equip> equip in c.Inventory[InventoryType.EQUIPPED].Equips)
            //{
            //    if (equip.Key >= -1200) {
            //        AddEquipPosition(p, equip.Value, false, false);
            //        AddEquipInfo(p, equip.Value, c);
            //    }
            //}

            p.WriteShort(0);
            p.WriteShort(0);
            p.WriteShort(0);

            //foreach (KeyValuePair<short, Equip> equip in c.Inventory[InventoryType.EQUIPPED].Equips)
            //{
            //    if (equip.Key <= -5000 && equip.Key >= -5002) {
            //        AddEquipPosition(p, equip.Value, false, false);
            //        AddEquipInfo(p, equip.Value, c);
            //    }
            //}

            p.WriteShort(0);
            p.WriteShort(0);
            p.WriteShort(0);
            p.WriteShort(0);
            p.WriteShort(0);

            //foreach (KeyValuePair<byte, Item> item in c.Inventory[InventoryType.USE].Items)
            //{
            //    AddItemPosition(p, item.Value, false, false);
            //    AddItemInfo(p, item.Value, c);
            //}
            p.WriteByte(0);
            //foreach (KeyValuePair<byte, Item> item in c.Inventory[InventoryType.SETUP].Items)
            //{
            //    AddItemPosition(p, item.Value, false, false);
            //    AddItemInfo(p, item.Value, c);
            //}
            p.WriteByte(0);
            //foreach (KeyValuePair<byte, Item> item in c.Inventory[InventoryType.ETC].Items)
            //{
            //    AddItemPosition(p, item.Value, false, false);
            //    AddItemInfo(p, item.Value, c);
            //}
            p.WriteByte(0);
            //foreach (KeyValuePair<byte, Item> item in c.Inventory[InventoryType.CASH].Items)
            //{
            //    AddItemPosition(p, item.Value, false, false);
            //    AddItemInfo(p, item.Value, c);
            //}
            p.WriteByte(0);

            //TODO: Extended slots~

            p.WriteZero(17);
        }
Ejemplo n.º 17
0
        public static void AddInnerStats(Packet p, Character c)
        {
            p.WriteShort(0); //Inner skills count.
            //TODO: Inner skills.

            p.WriteInt(c.HonorLevel);
            p.WriteInt(c.HonorEXP);
        }
Ejemplo n.º 18
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);
        }
Ejemplo n.º 19
0
        public static void AddCooldownInfo(Packet p, Character c)
        {
            // Insert cooldowns of character to a list.

            p.WriteShort(0); // Cooldowns size.

            //For each cd - WriteInt(SkillID), WriteInt(TimeLeft).

            p.WriteShort(0); // CD is empty.
        }
Ejemplo n.º 20
0
 public void ShowDrop(Character chr)
 {
     if (QuestID != 0 && chr.Id != PlayerID)
     {
         return;
     }
     //DropPacket.ShowDrop(chr, this, (byte)DropPacket.DropTypes.ShowExisting, false, new Pos());
 }
Ejemplo n.º 21
0
 public void TakeDrop(Character chr, bool petPickup)
 {
     //DropPacket.TakeDrop(chr, this, petPickup);
     Master.Instance.DataProvider.Maps[MapID].RemoveDrop(this);
 }
Ejemplo n.º 22
0
        public bool giveDamage(Character f****r, int amount)
        {
            //if (HP == 0) return false;
            //if (!Damages.ContainsKey(f****r.mID))
            //    Damages.Add(f****r.mID, 0);
            //Damages[f****r.mID] += (ulong)amount;

            //if (HP < amount)
            //    HP = 0;
            //else
            //    HP -= amount;

            return true;
        }
Ejemplo n.º 23
0
        public static void AddMonsterBookInfo(Packet p, Character c)
        {
            p.WriteInt(0);

            //Getscore>0, writeFinished. Else, writeUnfinished.
            p.WriteByte(0);
            p.WriteShort(0);

            p.WriteInt(0);
        }
Ejemplo n.º 24
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.º 25
0
 public void setControl(Character control, bool spawn, Character display)
 {
     //Controller = control;
     //if (HP == 0) return;
     //if (control != null)
     //{
     //    MobPacket.SendMobRequestControl(control, this, spawn, null);
     //}
     //else if (ControlStatus == MobControlStatus.ControlNone)
     //{
     //    MobPacket.SendMobRequestControl(control, this, spawn, display);
     //}
 }
Ejemplo n.º 26
0
        public static void AddQuestInfo(Packet p, Character c)
        {
            // Started quests's list.
            p.WriteByte(1);

            p.WriteShort(0); // Started quests size.
            // For each started quest, writeShort(id), if the quest has mob kills - build a string of kills and shit, and write the string as maple string. If not, get custom data as maplestring.

            p.WriteShort(0);
            p.WriteByte(1);
            //List of completed quests.
            p.WriteShort(0); // Completed quests size.
            // For each completed quest, write short the ID and writeInt the completion time.
        }
Ejemplo n.º 27
0
        public static Packet EnterField(Character pCharacter)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Field_Enter);
            p.WriteShort(2);
            p.WriteLong(1);
            p.WriteLong(2);
            p.WriteLong(pCharacter.Client.Channel);
            p.WriteByte(pCharacter.PortalCount);
            p.WriteByte(2);
            p.WriteBytes(new byte[8]);
            p.WriteInt(pCharacter.MapId);
            p.WriteByte(pCharacter.MapPosition);
            p.WriteInt(pCharacter.HP);
            p.WriteByte(0);
            p.WriteLong(Tools.GetTime(Tools.CurrentTimeMillis()));
            p.WriteInt(100);
            p.WriteShort(0);
            p.WriteByte(1);

            return p;
        }
Ejemplo n.º 28
0
        public static void AddRocksInfo(Packet p, Character c)
        {
            //Put reg rocks maps into array. Write map ID of each one
            //In order: Regular Rocks, VIP Rocks, Hyper Rocks.
            for (int i = 0; i < 5; i++)
            {
                p.WriteInt(999999999);
            }

            for (int i = 0; i < 10; i++)
            {
                p.WriteInt(999999999);
            }

            for (int i = 0; i < 13; i++)
            {
                p.WriteInt(999999999);
            }

            for (int i = 0; i < 13; i++)
            {
                p.WriteInt(999999999);
            }
        }
Ejemplo n.º 29
0
        public static void AddRingInfo(Packet p, Character c)
        {
            p.WriteShort(0);

            //Triple<List<MpaleRing>, List<MapleRing>, List<MapleRing>> - of character's rings.
            //The following applies 3 times: 3 ring slots.
            p.WriteShort(0); // Rings size.
            p.WriteShort(0); // Rings size.
            p.WriteShort(0); // Rings size.
            // For each ring, writeInt(partnerCharacterID), writeString(ParterName, 13), writeLong(RingID), writeLong(PartnerRingID).
        }
Ejemplo n.º 30
0
        public static void AddCharacterStats(Packet pPacket, Character pCharacter)
        {
            pCharacter.Subcategory = Constants.JobConstants.GetSubcategory(pCharacter.Job);

            pPacket.WriteInt(pCharacter.Id);
            pPacket.WritePaddedString(pCharacter.Name, 13);
            pPacket.WriteByte(pCharacter.Gender);
            pPacket.WriteByte(pCharacter.SkinColor);
            pPacket.WriteInt(pCharacter.FaceId);
            pPacket.WriteInt(pCharacter.HairId);
            pPacket.WriteZero(24);

            pPacket.WriteByte(pCharacter.Level);
            pPacket.WriteShort(pCharacter.Job);
            pPacket.WriteShort(pCharacter.Str);
            pPacket.WriteShort(pCharacter.Dex);
            pPacket.WriteShort(pCharacter.Int);
            pPacket.WriteShort(pCharacter.Luk);
            pPacket.WriteInt(pCharacter.HP);
            pPacket.WriteInt(pCharacter.MaxHP);
            pPacket.WriteInt(pCharacter.MP);
            pPacket.WriteInt(pCharacter.MaxMP);
            pPacket.WriteShort(pCharacter.AP);

            if (Constants.JobConstants.isSeparatedSp(pCharacter.Job))
            {
                byte length = (byte)pCharacter.SP.Count((b) => b > 0);

                pPacket.WriteByte(length);

                foreach (int i in pCharacter.SP)
                {
                    if (i > 0)
                    {
                        pPacket.WriteByte((byte)(i + 1));
                        pPacket.WriteInt(pCharacter.SP[i]);
                    }
                }
            }
            else
            {
                pPacket.WriteShort(pCharacter.SP[0]);
            }

            pPacket.WriteLong(pCharacter.EXP);
            pPacket.WriteInt(pCharacter.Fame);
            pPacket.WriteShort(0); // Migration Data, v141.
            pPacket.WriteShort(-1800); // Migration Data, v141.
            pPacket.WriteInt(0); // Gachapon EXP.
            pPacket.WriteInt(pCharacter.MapId);
            pPacket.WriteByte(pCharacter.MapPosition);
            pPacket.WriteInt(0);
            pPacket.WriteShort(pCharacter.Subcategory);

            if (Constants.JobConstants.isDemonAvenger(pCharacter.Job) || Constants.JobConstants.isDemonSlayer(pCharacter.Job) || Constants.JobConstants.isXenon(pCharacter.Job))
                pPacket.WriteInt(pCharacter.FaceMarking);

            pPacket.WriteByte(pCharacter.Fatigue);
            pPacket.WriteInt(Constants.GetCurrentDate());

            pPacket.WriteInt(pCharacter.Ambition);
            pPacket.WriteInt(pCharacter.Insight);
            pPacket.WriteInt(pCharacter.Willpower);
            pPacket.WriteInt(pCharacter.Diligence);
            pPacket.WriteInt(pCharacter.Empathy);
            pPacket.WriteInt(pCharacter.Charm);

            pPacket.WriteZero(13);

            pPacket.WriteLong(Tools.GetTime(Tools.CurrentTimeMillis()));

            pPacket.WriteInt(pCharacter.BattleEXP);
            pPacket.WriteByte(pCharacter.BattleRank);
            pPacket.WriteInt(pCharacter.BattlePoints);
            pPacket.WriteByte(5);
            pPacket.WriteByte(6);
            pPacket.WriteByte(0);
            pPacket.WriteInt(0);

            pPacket.WriteBytes(new byte[] { 59, 55, 79, 1, 0, 64 });
            pPacket.WriteSByte(-32);
            pPacket.WriteSByte(-3);

            pPacket.WriteShort(0);
            pPacket.WriteZero(3);

            for (int i = 0; i < 9; i++)
            {
                pPacket.WriteInt(0);
                pPacket.WriteByte(0);
                pPacket.WriteInt(0);
            }

            pPacket.WriteReversedLong(Tools.GetTime(Tools.CurrentTimeMillis()));
        }