Esempio n. 1
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();
 }
Esempio n. 2
0
        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
        }
Esempio n. 3
0
 public static byte[] Blocked(byte reason, long time)
 {
     PacketWriter packet = new PacketWriter();
     packet.WriteOpcode(SendOps.CheckPassword);
     packet.WriteByte(2);
     packet.WriteByte(0);
     packet.WriteInt(0);
     packet.WriteByte(reason);
     packet.WriteLong(time);
     return packet.ToArray();
 }
Esempio n. 4
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);
     }
 }
Esempio n. 5
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
     }
 }
Esempio n. 6
0
 public static byte[] UpdatePrimaryStat(Dictionary<PrimaryStat, int> stats, bool itemReaction = false, Character chr = null)
 {
     var packet = new PacketWriter();
     packet.WriteOpcode(SendOps.SetTemporaryStat);
     packet.WriteBool(itemReaction);
     long mask = 0;
     foreach (var stat in stats)
         mask |= ((long)stat.Key);
     packet.WriteLong(mask);
     foreach (var stat in stats)
         switch (stat.Key)
         {
             case PrimaryStat.Null:
                 break;
             default:
                 packet.WriteInt(stat.Value);
                 break;
         }
     if (mask == 0 && !itemReaction)
         packet.WriteByte(1);
     packet.WriteByte(0);
     packet.WriteByte(0);
     return packet.ToArray();
 }
Esempio n. 7
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();
        }