Exemple #1
0
        void acceptor_OnClientConnected(Session session)
        {
            Logger.Write(Logger.LogTypes.연결, "클라이언트 {0} 연결됨", session.Socket.RemoteEndPoint.ToString());

            Random rand = new Random();
            int riv = rand.Next();
            int siv = rand.Next();

            session.RIV = new MapleCrypto(BitConverter.GetBytes(riv), Config.MajorVersion);
            session.SIV = new MapleCrypto(BitConverter.GetBytes(siv), Config.MajorVersion);

            PacketWriter packet = new PacketWriter();
            packet.WriteShort(0);
            packet.WriteShort(Config.MajorVersion);
            packet.WriteShort(1);
            packet.WriteByte(0x31);
            packet.WriteInt(riv);
            packet.WriteInt(siv);
            packet.WriteByte(0x08);
            packet.SetShort(0, packet.Length - 2);
            session.SendRawPacket(packet.ToArray());

            Client c = new Client(session);
            mGameServer.Clients.Add(c);
        }
 // 0 = public
 // 1 = lime
 // 2 = pink
 // 3 = orange
 // 4 = purple
 // 5 = green
 // 6 = magenta
 // 7 = gray
 // 8 = yellow
 // 9 = light yellow
 // A = cyan
 // B = white background
 // C = red
 // D = ligt blue background
 public static byte[] ChatMessage(short type, string message)
 {
     var packet = new PacketWriter();
     packet.WriteOpcode(SendOps.ChatMsg);
     packet.WriteShort(type);
     packet.WriteMapleString(message);
     return packet.ToArray();
 }
 public static byte[] Migrate(int accid, int cid, byte[] ip, ushort port)
 {
     PacketWriter packet = new PacketWriter();
     packet.WriteCenterServerOpcode(CenterSendOps.Migrate);
     packet.WriteInt(accid);
     packet.WriteInt(cid);
     packet.WriteBytes(ip);
     packet.WriteShort(port);
     return packet.ToArray();
 }
        void _Acceptor_OnClientConnected(Session session)
        {
            Logger.Write(Logger.LogTypes.연결, "opened connection with {0}", session.Socket.RemoteEndPoint.ToString());

            session.RIV = new MapleCrypto(new byte[4], Common.Config.MajorVersion);
            session.SIV = new MapleCrypto(new byte[4], Common.Config.MajorVersion);

            PacketWriter packet = new PacketWriter();
            packet.WriteShort(0);
            packet.WriteShort(Common.Config.MajorVersion);
            packet.WriteShort(1);
            packet.WriteByte(0x31);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteByte(0x08);
            packet.SetShort(0, packet.Length - 2);
            session.SendRawPacket(packet.ToArray());

            GameServerConnection con = new GameServerConnection(session);
            _ConnectedClients.Add(con);
        }
 public static byte[] GuildOperation(int cid, Guild guild)
 {
     var packet = new PacketWriter();
     packet.WriteCenterServerOpcode(CenterSendOps.GuildOperation);
     packet.WriteInt(cid);
     packet.WriteInt(guild.GuildID);
     packet.WriteMapleString(guild.Name ?? string.Empty);
     packet.WriteInt(guild.Point);
     packet.WriteInt(guild.MemberCap);
     packet.WriteShort(guild.EmblemBG);
     packet.WriteShort(guild.EmblemBGColour);
     packet.WriteShort(guild.Emblem);
     packet.WriteShort(guild.EmblemColour);
     packet.WriteInt(guild.Members.Length);
     foreach (var member in guild.Members)
     {
         packet.WriteInt(member.CharacterID);
         packet.WriteInt(member.Grade);
     }
     return packet.ToArray();
 }
        public static void AddPlayerStats(PacketWriter packet, Character chr)
        {
            packet.WriteInt(chr.mID);
            packet.WriteStringPad(chr.mName, 0, 13);
            packet.WriteByte(chr.mGender);
            packet.WriteByte(chr.mSkin);
            packet.WriteInt(chr.mFace);
            packet.WriteInt(chr.mHair);
            for (int i = 0; i < 3; ++i)
                packet.WriteLong(0); // pet serial numbers
            packet.WriteByte(chr.mPrimaryStats.Level);
            packet.WriteShort(chr.mPrimaryStats.Job);
            packet.WriteShort(chr.mPrimaryStats.Str);
            packet.WriteShort(chr.mPrimaryStats.Dex);
            packet.WriteShort(chr.mPrimaryStats.Int);
            packet.WriteShort(chr.mPrimaryStats.Luk);
            packet.WriteInt(chr.mPrimaryStats.HP);
            packet.WriteInt(chr.mPrimaryStats.MaxHP);
            packet.WriteInt(chr.mPrimaryStats.MP);
            packet.WriteInt(chr.mPrimaryStats.MaxMP);
            packet.WriteShort(chr.mPrimaryStats.AP);
            if (Tools.is_extendsp_job(chr.mPrimaryStats.Job))
            {
                int length = 0;
                for (int i = 0; i < chr.mPrimaryStats.SP.Length; ++i)
                    if (chr.mPrimaryStats.SP[i] > 0)
                        length++;
                packet.WriteByte(length);
                for (int i = 0; i < chr.mPrimaryStats.SP.Length; ++i)
                    if (chr.mPrimaryStats.SP[i] > 0)
                    {
                        packet.WriteByte(i + 1);
                        packet.WriteByte(chr.mPrimaryStats.SP[i]);
                    }
            }
            else
            {
                packet.WriteShort(chr.mPrimaryStats.SP[0]);
            }
            packet.WriteInt(chr.mPrimaryStats.EXP);
            packet.WriteInt(chr.mPrimaryStats.Fame);
            packet.WriteInt(0); // gacha exp according to other sources
            packet.WriteInt(chr.mMap);
            packet.WriteByte(chr.mMapPosition);
            packet.WriteInt(0); // time played in seconds according to other sources
            if (chr.mPrimaryStats.Job >= 430 && chr.mPrimaryStats.Job <= 434) // dual blade
                packet.WriteShort(1);
            else if (chr.mPrimaryStats.Job >= 530 && chr.mPrimaryStats.Job <= 532) // cannoneer
                packet.WriteShort(2);
            else
                packet.WriteShort(0);
            if (chr.mPrimaryStats.Job >= 3001 && chr.mPrimaryStats.Job <= 3112) // demon slayer
                packet.WriteInt(chr.mPrimaryStats.DemonSlayerAccessory);
            packet.WriteByte(chr.mPrimaryStats.Fatigue);

            packet.WriteInt(0); // time (year month day 00) 8 digets

            packet.WriteInt(chr.mTraits.Ambition);
            packet.WriteInt(chr.mTraits.Insight);
            packet.WriteInt(chr.mTraits.Willpower);
            packet.WriteInt(chr.mTraits.Diligence);
            packet.WriteInt(chr.mTraits.Empathy);
            packet.WriteInt(chr.mTraits.Charm);
            packet.WriteShort(chr.mTraits.AmbitionGained);
            packet.WriteShort(chr.mTraits.InsightGained);
            packet.WriteShort(chr.mTraits.WillpowerGained);
            packet.WriteShort(chr.mTraits.DiligenceGained);
            packet.WriteShort(chr.mTraits.EmpathyGained);
            packet.WriteShort(chr.mTraits.CharmGained);

            packet.WriteInt(chr.mPrimaryStats.BattleEXP);
            packet.WriteByte(chr.mPrimaryStats.BattleRank);
            packet.WriteInt(chr.mPrimaryStats.BattlePoints);
            packet.WriteByte(5);
            packet.WriteInt(0);
            // could always just write a buffer of 8, but oh well lol
            packet.WriteInt((int)(DateTime.Now.ToFileTime() >> 32)); // FileTime.dwHighDateTime
            packet.WriteInt((int)(DateTime.Now.ToFileTime() << 32 >> 32)); // FileTime.dwLowDateTime
        }
 public static void AddQuestData(PacketWriter packet, Character chr)
 {
     packet.WriteByte(1);
     packet.WriteShort(0);
     packet.WriteShort(0);
     packet.WriteByte(1);
     packet.WriteShort(0);
 }
 public static byte[] SelectCharacter(byte primary, byte secondary, byte[] IP = null, ushort port = 0, int clientID = 0)
 {
     PacketWriter packet = new PacketWriter();
     packet.WriteOpcode(SendOps.SelectCharacter);
     packet.WriteByte(primary);
     packet.WriteByte(secondary);
     packet.WriteBytes(IP);
     packet.WriteShort(port);
     packet.WriteInt(clientID);
     packet.WriteByte(0);
     packet.WriteInt(0);
     packet.WriteByte(0);
     packet.WriteShort(0);
     packet.WriteShort(0);
     return packet.ToArray();
 }
        public static byte[] WorldInformation(byte serverId, string worldName, byte flag, string eventmessage, short expPercent, short dropPercent, Dictionary<int, int> channels)
        {
            PacketWriter packet = new PacketWriter();
            packet.WriteOpcode(SendOps.WorldInformation);
            packet.WriteByte(serverId);
            packet.WriteMapleString(worldName);
            packet.WriteByte(flag); // 1 = event, 2 = new, 3 = hot time
            packet.WriteMapleString(eventmessage);
            packet.WriteShort(expPercent);
            packet.WriteShort(dropPercent);
            packet.WriteByte(0);
            packet.WriteByte(channels.Count);

            foreach (KeyValuePair<int, int> channel in channels)
            {
                packet.WriteMapleString(worldName + "-" + (channel.Key + 1));
                packet.WriteInt(channel.Value * 100); // max is 1000
                packet.WriteByte(0);
                packet.WriteByte(channel.Key);
                packet.WriteByte(0);
            }

            Dictionary<Point, string> chatBubbles = new Dictionary<Point, string>();
            chatBubbles.Add(new Point(0, 265), "왛라오! ㅇㅇ");
            chatBubbles.Add(new Point(500, 370), "ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ");
            packet.WriteShort(chatBubbles.Count);

            foreach (KeyValuePair<Point, string> pair in chatBubbles)
            {
                packet.WriteShort(pair.Key.X);
                packet.WriteShort(pair.Key.Y);
                packet.WriteMapleString(pair.Value);
            }

            packet.WriteInt(0);
            return packet.ToArray();
        }
Exemple #10
0
 public static byte[] BroadcastMessage(byte type, string message)
 {
     int channel = 0;
     bool megaEar = true;
     var packet = new PacketWriter();
     packet.WriteOpcode(SendOps.BroadcastMsg);
     packet.WriteByte(type);
     if (type == 4)
         packet.WriteByte(1);
     if (type != 23 && type != 24)
         packet.WriteMapleString(message);
     switch (type)
     {
         case 3: // Super Megaphone
         case 22: // Skull Megaphone
         case 25:
         case 26:
             packet.WriteByte(channel - 1);
             packet.WriteByte(megaEar ? 1 : 0);
             break;
         case 9: // Like Item Megaphone (Without Item)
             packet.WriteByte(channel - 1);
             break;
         case 12: // Weather Effect
             packet.WriteInt(channel); // item id
             break;
         case 6:
         case 11:
         case 20:
             packet.WriteInt(channel >= 1000000 && channel < 6000000 ? channel : 0); // Item Id
             //E.G. All new EXP coupon {Ruby EXP Coupon} is now available in the Cash Shop!
             break;
         case 24:
             packet.WriteShort(0); // ?
             break;
     }
     return packet.ToArray();
 }
Exemple #11
0
 public static byte[] LoginSuccess(Client c)
 {
     PacketWriter packet = new PacketWriter();
     packet.WriteOpcode(SendOps.CheckPassword);
     packet.WriteByte(0);
     packet.WriteByte(0);
     packet.WriteInt(0);
     packet.WriteInt(c.AccountId);
     packet.WriteByte(0); // Gender
     packet.WriteByte(c.Admin);
     packet.WriteShort(0); // GM Mask
     packet.WriteByte(0);
     packet.WriteMapleString(c.Username);
     packet.WriteByte(3);
     packet.WriteByte(c.TradeBlock);
     packet.WriteLong(c.TradeBlockExpiration);
     packet.WriteByte(1);
     packet.WriteLong(0); // Creation date. That's not important!
     packet.WriteInt(0x0C); // Tooltip bubble at World/Channel select
     packet.WriteByte(1); // Use SessionID
     packet.WriteByte(1);
     packet.WriteLong(c.SessionID);
     return packet.ToArray();
 }
Exemple #12
0
 public static byte[] NpcEnterField(Npc npc, bool show = true)
 {
     var packet = new PacketWriter();
     packet.WriteOpcode(SendOps.NpcEnterField);
     packet.WriteInt(npc.mObjectID);
     packet.WriteInt(npc.mID);
     packet.WriteShort(npc.mX);
     packet.WriteShort(npc.mCy);
     packet.WriteByte(Math.Abs(npc.mF - 1));
     packet.WriteShort(npc.mFh);
     packet.WriteShort(npc.mRx0);
     packet.WriteShort(npc.mRx1);
     packet.WriteBool(show); // visible
     return packet.ToArray();
 }
 public void SendInitialPacket(int pVersion, string pPatchLoc, byte[] pRIV, byte[] pSIV, byte pServerType)
 {
     PacketWriter writer = new PacketWriter();
     writer.WriteShort(pPatchLoc == "" ? 0x0D : 0x0E);
     writer.WriteShort(pVersion);
     writer.WriteMapleString(pPatchLoc);
     writer.WriteBytes(pRIV);
     writer.WriteBytes(pSIV);
     writer.WriteByte(pServerType);
     SendRawPacket(writer);
 }
Exemple #14
0
        public static byte[] SetField(Client c, bool connecting = false)
        {
            var packet = new PacketWriter();
            packet.WriteOpcode(SendOps.SetField);
            packet.WriteShort(2);
            packet.WriteInt(1);
            packet.WriteInt(0);
            packet.WriteInt(2);
            packet.WriteInt(0);
            packet.WriteInt(Program.mServer.ServerId);
            packet.WriteByte(0);
            packet.WriteInt(0);
            packet.WriteByte(1);
            packet.WriteInt(0);
            packet.WriteBool(connecting);
            if (!connecting)
            {
                packet.WriteInt(c.mCharacter.mField);
                packet.WriteByte(c.mCharacter.mFieldPosition);
                packet.WriteInt(c.mCharacter.mPrimaryStats.HP);
                packet.WriteByte(0);
                packet.WriteLong(c.mAccount.SessionID);
                packet.WriteInt(100);
                packet.WriteByte(0);
                packet.WriteByte(0);
                return packet.ToArray();
            }
            packet.WriteShort(0);
            packet.WriteInt(unchecked((int)(0xF05A5CB3))); // rand
            packet.WriteInt(unchecked((int)(0xF05A5CB3))); // rand
            packet.WriteInt(unchecked((int)(0xF05A5CB3))); // rand

            ulong flagmask = (unchecked((ulong)-1));
            flagmask = (flagmask & 0xFFFFFFFFF0FFFFFF) | ((ulong)0x01 << 24);
            flagmask = (flagmask & 0xFFFFFFF0FFFFFFFF) | ((ulong)0x0D << 32);
            flagmask = (flagmask & 0x0FFFFFFFFFFFFFFF) | ((ulong)0x01 << 60);
            packet.WriteLong(unchecked((long)flagmask)); // flags?

            packet.WriteByte(0);
            packet.WriteByte(0);
            packet.WriteInt(0);
            packet.WriteByte(0);

            Global.AddCharacterData(packet, c.mCharacter);
            packet.WriteByte(0x0A); // buddylist cap
            packet.WriteByte(0); // blessing of fairy
            packet.WriteByte(0); // blessing of empress
            packet.WriteByte(0); // ultimate explorer
            Global.AddInventoryData(packet, c.mCharacter);
            Global.AddSkillData(packet, c.mCharacter);

            Global.AddQuestData(packet, c.mCharacter);
            //Global.AddRingData(packet, c.mCharacter);//01 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00
            packet.WriteShort(0); // rings...something like that ?
            packet.WriteShort(0); // rings...something like that ?
            packet.WriteShort(0); // rings...something like that ?
            packet.WriteShort(0); // rings...something like that ?
            //FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B FF C9 9A 3B
            Global.AddRockData(packet, c.mCharacter);
            //00 00 00 00 00 00 00 FF FF FF FF
            Global.AddMonsterBookData(packet, c.mCharacter);
            packet.WriteShort(0);
            packet.WriteShort(0);
            //AddPartyQuestData(packet, c.mCharacter);
            packet.WriteShort(0);
            packet.WriteShort(0);
            packet.WriteShort(0);
            for (int i = 0; i < 17; ++i)
                packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteByte(1);
            packet.WriteShort(0);
            packet.WriteShort(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteLong(0x1CD6E06D3A75370);
            packet.WriteInt(100);
            packet.WriteByte(0);
            packet.WriteByte(1);

            return packet.ToArray();
        }
Exemple #15
0
 public static void AddSkillData(PacketWriter packet, Character chr)
 {
     /*
     packet.WriteByte(0);
     packet.WriteShort(0);
     packet.WriteShort(0);
     packet.WriteShort(0);
     packet.WriteShort(0);
     packet.WriteShort(0);
     packet.WriteShort(0);
     packet.WriteShort(0);*/
     List<Skill> cooldowns = new List<Skill>();
     packet.WriteByte(1);
     packet.WriteShort(chr.mSkills.Count);
     foreach (Skill s in chr.mSkills)
     {
         if (s.Cooldown > DateTime.Now.ToFileTime())
             cooldowns.Add(s);
         packet.WriteInt(s.SkillID);
         packet.WriteInt(s.SkillLevel);
         packet.WriteLong(s.Expiration);
         if (s.MasterLevel != 0)
             packet.WriteInt(s.SkillMastery);
     }
     packet.WriteShort(cooldowns.Count);
     foreach (Skill s in cooldowns)
     {
         packet.WriteInt(s.SkillID);
         packet.WriteShort(DateTime.FromFileTime(s.Cooldown).Subtract(DateTime.Now).Seconds);
     }
 }
Exemple #16
0
 public static void AddPartyQuestData(PacketWriter packet, Character chr)
 {
     packet.WriteShort(0);
 }
Exemple #17
0
 public static void AddMonsterBookData(PacketWriter packet, Character chr)
 {
     packet.WriteInt(0);
     packet.WriteByte(0);
     packet.WriteShort(0);
     packet.WriteInt(-1);
 }
Exemple #18
0
        public static byte[] UserEnterField(Character chr)
        {
            var packet = new PacketWriter();
            packet.WriteOpcode(SendOps.UserEnterField);
            packet.WriteInt(chr.mID);
            packet.WriteByte(chr.mPrimaryStats.Level);
            packet.WriteMapleString(chr.mName);
            packet.WriteMapleString(""); // ultimate explourer
            packet.WriteMapleString(chr.mGuild.Name);
            packet.WriteShort(chr.mGuild.EmblemBG);
            packet.WriteByte(chr.mGuild.EmblemBGColour);
            packet.WriteShort(chr.mGuild.Emblem);
            packet.WriteByte(chr.mGuild.EmblemColour);
            int[] buffs = new int[8];
            foreach (Buff buff in chr.mBuffs)
                buffs[buff.Position] |= buff.BuffID;
            //foreach (int i in buffs)
            //    packet.WriteInt(i); // buffer 32
            packet.WriteHexString("00 00 00 FE 00 00 A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ");
            //buff values

            packet.WriteInt(-1); // end buff values reading ?

            //packet.WriteByte(0);
            //packet.WriteByte(0);
            //packet.WriteByte(0);
            //packet.WriteByte(0);

            //packet.WriteBytes(new byte[4]);
            //packet.WriteBytes(new byte[4]);
            //packet.WriteByte(1);

            packet.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 01");

            packet.WriteInt(Environment.TickCount);
            packet.WriteShort(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteShort(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteShort(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteByte(1);
            packet.WriteInt(0);
            packet.WriteShort(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteShort(0);

            packet.WriteShort(chr.mPrimaryStats.Job);
            packet.WriteShort(0);
            Global.AddAvatarData(packet, chr);
            packet.WriteInt(0);
            packet.WriteBytes(new byte[12]);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);

            packet.WriteShort(chr.mPosition.X);
            packet.WriteShort(chr.mPosition.Y);
            packet.WriteByte(chr.mStance); // chr.mStance
            packet.WriteShort(chr.mFoothold);

            packet.WriteByte(0);
            packet.WriteByte(0);

            packet.WriteByte(1);
            packet.WriteByte(0);

            packet.WriteInt(1); // mount level
            packet.WriteInt(0); // mount exp
            packet.WriteInt(0); // mount fatigue

            packet.WriteByte(0); // ``Announce Box''

            packet.WriteByte(0); // Chalk Board

            Global.AddRingData(packet, chr);
            Global.AddRingData(packet, chr);
            Global.AddRingData(packet, chr);

            packet.WriteByte(0); // berserk
            packet.WriteInt(0);
            packet.WriteByte(0); // new year cards
            packet.WriteInt(0);
            return packet.ToArray();
        }
Exemple #19
0
 //0005 01 000FDF15 00 00-00-00-00-00-00-00-00 FFFFFFFF 07 00 0000 0000 0000 0000 0000 0000 0000 0000 0003 0000 0000 0000 0000 0000 0000 "Ij#z쨳" 0000
 //00 01 00000000 FFFFFFFF 00000000 0000 00 00 0000 0000 0000 0000 0000 0000 FFFF FFFF FFFF 00-00-00-00-00-00-00-00 00-40-E0-FD-3B-37-4F-01 FFFFFFFF
 public static void AddItemData(PacketWriter packet, AbstractItem aitem)
 {
     Equip eitem = null;
     Item item = null;
     if (aitem.Position < 0)
         eitem = (Equip)aitem;
     else
         item = (Item)aitem;
     if (eitem == null)
         packet.WriteByte(item.Position);
     else
         packet.WriteShort(Math.Abs(eitem.Position));
     packet.WriteByte(eitem == null ? 2 : 1);
     packet.WriteInt(aitem.ItemId);
     packet.WriteByte(aitem.cash);
     if (aitem.cash > 0)
         packet.WriteLong(aitem.specialID);
     packet.WriteLong(aitem.Expiration);
     packet.WriteInt(-1);
     if (eitem != null)
     {
         packet.WriteByte(eitem.PossibleUpgrades);
         packet.WriteByte(0); // level
         packet.WriteShort(eitem.Str);
         packet.WriteShort(eitem.Dex);
         packet.WriteShort(eitem.Int);
         packet.WriteShort(eitem.Luk);
         packet.WriteShort(eitem.IncHP);
         packet.WriteShort(eitem.IncMP);
         packet.WriteShort(eitem.Watk);
         packet.WriteShort(eitem.Matk);
         packet.WriteShort(eitem.Wdef);
         packet.WriteShort(eitem.Mdef);
         packet.WriteShort(eitem.Accuracy);
         packet.WriteShort(eitem.Avoid);
         packet.WriteShort(0); // hands
         packet.WriteShort(eitem.Speed);
         packet.WriteShort(eitem.Jump);
         packet.WriteMapleString(eitem.Owner);
         packet.WriteShort(eitem.Flag);
         packet.WriteByte(0); // skill
         packet.WriteByte(1); // base level
         packet.WriteInt(0); // item exp
         packet.WriteInt(-1); // eitem.Durability
         packet.WriteInt(0); // vicious
         packet.WriteShort(0); // pvp damage
         packet.WriteByte(eitem.State);
         packet.WriteByte(eitem.Enhancements);
         packet.WriteShort(eitem.Pot1);
         if (eitem.specialID == 0)
         {
             packet.WriteShort(eitem.Pot2);
             packet.WriteShort(eitem.Pot3);
             packet.WriteShort(eitem.Pot4);
             packet.WriteShort(eitem.Pot5);
         }
         packet.WriteShort(eitem.SocketMask);
         packet.WriteShort(-1); // eitem.Socket1
         packet.WriteShort(-1); // eitem.Socket2
         packet.WriteShort(-1); // eitem.Socket3
         packet.WriteLong(0); // inventory id
         packet.WriteLong(0x217E57D909BC000);
         packet.WriteInt(-1);
     }
     else
     {
         packet.WriteShort(item.Quantity);
         packet.WriteMapleString(item.Owner);
         packet.WriteShort(item.Flag);
         //packet.WriteLong(-1); // if is bullet/star
     }
 }
Exemple #20
0
 public static void AddInventoryData(PacketWriter packet, Character chr)
 {
     packet.WriteInt(chr.mMeso);
     packet.WriteInt(0);
     packet.WriteByte(96); // equip slots
     packet.WriteByte(96); // consume slot cap
     packet.WriteByte(96); // install slot cap
     packet.WriteByte(96); // etc slot cap
     packet.WriteByte(96); // cash slot cap
     packet.WriteInt(0);
     packet.WriteInt(0);
     foreach (AbstractItem item in chr.mInventory[0].Values.Where(item => item.Position > -100))
         AddItemData(packet, item);
     packet.WriteShort(0); // end equipped
     foreach (AbstractItem item in chr.mInventory[0].Values.Where(item => item.Position < -100))
         AddItemData(packet, item);
     packet.WriteShort(0); // end cash equipped
     foreach (AbstractItem item in chr.mInventory[1].Values)
         AddItemData(packet, item);
     packet.WriteShort(0); // end equip
     packet.WriteShort(0); // end evan equipped
     packet.WriteShort(0); // end mech equipped
     packet.WriteShort(0); // end android equipped
     foreach (AbstractItem item in chr.mInventory[2].Values)
         AddItemData(packet, item);
     packet.WriteByte(0); // end consume
     foreach (AbstractItem item in chr.mInventory[3].Values)
         AddItemData(packet, item);
     packet.WriteByte(0); // end install
     foreach (AbstractItem item in chr.mInventory[4].Values)
         AddItemData(packet, item);
     packet.WriteByte(0); // end etc
     foreach (AbstractItem item in chr.mInventory[5].Values)
         AddItemData(packet, item);
     packet.WriteByte(0); // end cash
     packet.WriteInt(-1);
     packet.WriteInt(0);
     packet.WriteInt(0);
     packet.WriteByte(0);
     //05 00 01 15 DF 0F 00 00 00 80 05 BB 46 E6 17 02 FF FF FF FF 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 40 E0 FD 3B 37 4F 01 FF FF FF FF
     //06 00 01 2D 2D 10 00 00 00 80 05 BB 46 E6 17 02 FF FF FF FF 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 40 E0 FD 3B 37 4F 01 FF FF FF FF
     //07 00 01 A6 5B 10 00 00 00 80 05 BB 46 E6 17 02 FF FF FF FF 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 40 E0 FD 3B 37 4F 01 FF FF FF FF
     //0B 00 01 F0 DD 13 00 00 00 80 05 BB 46 E6 17 02 FF FF FF FF 07 00 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 40 E0 FD 3B 37 4F 01 FF FF FF FF
     //37 00 01 20 E2 11 00 00 00 80 05 BB 46 E6 17 02 FF FF FF FF 00 00 01 00 01 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 40 E0 FD 3B 37 4F 01 FF FF FF FF
 }