예제 #1
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()));
        }