예제 #1
0
 internal void WriteInitial(Packet pPacket)
 {
     pPacket.WriteByte((byte)mMacros.Length);
     Array.ForEach(mMacros, m =>
     {
         if (m != null)
         {
             pPacket.WriteString(m.Name);
             pPacket.WriteBool(m.Shout);
             pPacket.WriteInt(m.FirstSkillIdentifier);
             pPacket.WriteInt(m.SecondSkillIdentifier);
             pPacket.WriteInt(m.ThirdSkillIdentifier);
         }
         else
         {
             pPacket.WriteString("");
             pPacket.WriteBool(false);
             pPacket.WriteInt(0);
             pPacket.WriteInt(0);
             pPacket.WriteInt(0);
         }
     });
 }
        public static void Chat(Client pClient, Packet pPacket)
        {
            string message;
            bool bubble;
            if (!pPacket.ReadString(out message) ||
                !pPacket.ReadBool(out bubble))
            {
                pClient.Disconnect();
                return;
            }

            Packet packet = new Packet(EOpcode.SMSG_PLAYER_CHAT);
            packet.WriteInt(pClient.Player.Identifier);
            packet.WriteBool(pClient.Account.Level > 0);
            packet.WriteString(message);
            packet.WriteBool(bubble);
            pClient.Player.Map.SendPacketToAll(packet);
        }
예제 #3
0
 internal void WriteInitial(Packet pPacket)
 {
     List<PlayerQuest> active = new List<PlayerQuest>(mQuests.Values);
     active.RemoveAll(q => q.Completed != 0);
     pPacket.WriteUShort((ushort)active.Count);
     foreach (PlayerQuest quest in active)
     {
         pPacket.WriteUShort(quest.QuestIdentifier);
         pPacket.WriteString(quest.State);
     }
     List<PlayerQuest> completed = new List<PlayerQuest>(mQuests.Values);
     completed.RemoveAll(q => q.Completed == 0);
     pPacket.WriteUShort((ushort)completed.Count);
     foreach (PlayerQuest quest in completed)
     {
         pPacket.WriteInt(quest.QuestIdentifier);
         pPacket.WriteLong(quest.Completed);
     }
 }
 private static void SendPlayerNameCheck(Client pClient, string pName, bool pUnusable)
 {
     Packet packet = new Packet(EOpcode.SMSG_PLAYER_NAME_CHECK);
     packet.WriteString(pName);
     packet.WriteBool(pUnusable);
     pClient.SendPacket(packet);
 }
        private static void SendWorldList(Client pClient)
        {
            Packet packet = new Packet(EOpcode.SMSG_WORLD_LIST);
            packet.WriteByte(0);
            packet.WriteString("Scania");
            packet.WriteByte(Config.Instance.World.Ribbon);
            packet.WriteString(Config.Instance.World.EventMessage);
            packet.WriteByte(Config.Instance.World.ExperienceModifier);
            packet.WriteByte(0);
            packet.WriteByte(Config.Instance.World.DropModifier);
            packet.WriteByte(0);
            packet.WriteByte(0);

            packet.WriteByte(1);
            packet.WriteString("Scania-1");
            packet.WriteInt(Server.Population);
            packet.WriteByte(0);
            packet.WriteByte(0);
            packet.WriteByte(0);

            packet.WriteShort(0);
            pClient.SendPacket(packet);

            packet = new Packet(EOpcode.SMSG_WORLD_LIST);
            packet.WriteByte(0xFF);
            pClient.SendPacket(packet);
        }
 private static void SendAuthentication(Client pClient, EAuthenticationResult pResult)
 {
     Packet packet = new Packet(EOpcode.SMSG_AUTHENTICATION);
     packet.WriteUInt((uint)pResult);
     packet.WriteSkip(2);
     if (pClient.Account != null)
     {
         packet.WriteInt(pClient.Account.Identifier);
         packet.WriteSkip(4);
         packet.WriteString(pClient.Account.Username);
         packet.WriteSkip(22);
     }
     pClient.SendPacket(packet);
 }
예제 #7
0
 public void WriteGeneral(Packet pPacket, bool pRealSlot)
 {
     if (mInventorySlot != 0)
     {
         if (pRealSlot) pPacket.WriteShort(mInventorySlot);
         else
         {
             byte slot = (byte)Math.Abs(mInventorySlot);
             if (slot > 100) slot -= 100;
             pPacket.WriteByte(slot);
         }
     }
     pPacket.WriteByte((byte)(mInventoryType == EInventoryType.Equipment ? 0x01 : 0x02));
     pPacket.WriteInt(mItemIdentifier);
     pPacket.WriteByte(0x00);
     pPacket.WriteLong(0);
     if (mInventoryType == EInventoryType.Equipment)
     {
         pPacket.WriteByte(mUnusedScrollSlots);
         pPacket.WriteByte(mUsedScrollSlots);
         pPacket.WriteUShort(mStrength);
         pPacket.WriteUShort(mDexterity);
         pPacket.WriteUShort(mIntellect);
         pPacket.WriteUShort(mLuck);
         pPacket.WriteUShort(mHealth);
         pPacket.WriteUShort(mMana);
         pPacket.WriteUShort(mWeaponAttack);
         pPacket.WriteUShort(mMagicAttack);
         pPacket.WriteUShort(mWeaponDefense);
         pPacket.WriteUShort(mMagicDefense);
         pPacket.WriteUShort(mAccuracy);
         pPacket.WriteUShort(mAvoidance);
         pPacket.WriteUShort(mHands);
         pPacket.WriteUShort(mSpeed);
         pPacket.WriteUShort(mJump);
         pPacket.WriteString(mOwner);
         pPacket.WriteUShort(mFlags);
         pPacket.WriteByte(0x00);
         pPacket.WriteByte(0x00);
         pPacket.WriteUShort(0);
         pPacket.WriteUShort(0);
         pPacket.WriteUInt(0);
         pPacket.WriteLong(-1);
         pPacket.WriteLong(0); // 0040E0FD3B374F01
         pPacket.WriteInt(-1);
     }
     else
     {
         pPacket.WriteUShort(mQuantity);
         pPacket.WriteString(mOwner);
         pPacket.WriteUShort(mFlags);
         if (ItemData.IsRechargeable(ItemData.GetType(mItemIdentifier))) pPacket.WriteLong(0);
     }
 }
예제 #8
0
        internal Packet GetPlayerDetails()
        {
            Packet packet = new Packet(EOpcode.SMSG_PLAYER_DETAILS);
            packet.WriteInt(mIdentifier);
            packet.WriteString(mName);

            packet.WriteString("");
            packet.WriteUShort(0);
            packet.WriteByte(0x00);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteByte(0xF8);
            packet.WriteByte(0x03);
            packet.WriteUShort(0);

            byte[] types = mBuffs.MapTypes;
            packet.WriteBytes(types, PlayerBuffs.BUFF_BYTE_5, 4);
            packet.WriteBytes(types, PlayerBuffs.BUFF_BYTE_1, 4);
            for (byte index = 0; index < PlayerBuffs.BUFF_ENTRY_ORDER.Length; ++index)
            {
                byte entryIndex = PlayerBuffs.BUFF_ENTRY_ORDER[index];
                if (types[entryIndex] != 0)
                {
                    foreach (KeyValuePair<byte, PlayerBuffs.MapValue> kv in mBuffs.MapValues[entryIndex])
                    {
                        if (kv.Value.Debuff)
                        {
                            if (!(kv.Key == 0x01 && entryIndex == PlayerBuffs.BUFF_BYTE_5))
                            {
                                packet.WriteUShort(kv.Value.SkillIdentifier);
                                packet.WriteShort(kv.Value.Value);
                            }
                        }
                        else if (kv.Value.Use)
                        {
                            if (entryIndex == PlayerBuffs.BUFF_BYTE_3)
                            {
                                if (kv.Key == 0x20) packet.WriteByte((byte)(mBuffs.Combo + 1));
                                else if (kv.Key == 0x40) packet.WriteInt(mBuffs.ChargeSkillIdentifier);
                            }
                            else if (entryIndex == PlayerBuffs.BUFF_BYTE_5) packet.WriteShort(kv.Value.Value);
                            else packet.WriteByte((byte)kv.Value.Value);
                        }
                    }
                }
            }
            packet.WriteUShort(0);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteInt(mBuffs.MountIdentifier);
            packet.WriteInt(mBuffs.MountSkillIdentifier);
            packet.WriteUInt(1065638850);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUInt(0);
            packet.WriteUInt(0);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUInt(0);
            packet.WriteByte(0x00);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(1065638850);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteUShort(mJob);
            WriteAppearance(packet);

            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteCoordinates(mPosition);
            packet.WriteByte(0x00);
            packet.WriteUShort(0);
            packet.WriteByte(0x00);

            packet.WriteByte(0x00);
            packet.WriteUShort(1);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUInt(0);
            packet.WriteUShort(0);

            return packet;
        }
예제 #9
0
        internal void EnterMap()
        {
            Log.WriteLine(ELogLevel.Info, "[{0}] Entered Map {1}", mClient.Host, mMap.Data.Identifier);
            if (mMap.Data.Music.Length > 0)
            {
                Packet packet = new Packet(EOpcode.SMSG_MAP_EFFECT);
                packet.WriteByte(0x06);
                packet.WriteString(mMap.Data.Music);
                mClient.SendPacket(packet);
            }
            if (mMap.Data.FieldTypes == MapData.EMapFieldType.ForceMapEquip) mClient.SendPacket(new Packet(EOpcode.SMSG_MAP_FORCE_EQUIPMENT));

            mMap.SendPlayerDetails(this);
            mMap.SendNPCDetails(this);
            mMap.SendReactorDetails(this);
            mMap.SendMobDetails(this);
            mMap.UpdateMobControllers(false);
        }
예제 #10
0
 public void SendMessage(EMessageType pType, string pMessage, params object[] pArgs)
 {
     Packet packet = new Packet(EOpcode.SMSG_MESSAGE);
     packet.WriteByte((byte)pType);
     packet.WriteString(string.Format(pMessage, pArgs));
     if (pType == EMessageType.GMText) packet.WriteInt(0);
     mClient.SendPacket(packet);
 }