internal void WriteUpdate(Packet pPacket, EBuddyUpdateType pType) { pPacket.WriteByte((byte)pType); pPacket.WriteByte((byte)mBuddies.Count); foreach (PlayerBuddy buddy in mBuddies) buddy.WriteGeneral(pPacket); foreach (PlayerBuddy buddy in mBuddies) pPacket.WriteUInt(0); }
internal void WriteInitial(Packet pPacket) { for (byte index = 0; index < MAX_KEYS; ++index) { pPacket.WriteByte(mTypes[index]); pPacket.WriteUInt(mActions[index]); } }
internal void WriteInitial(Packet pPacket) { pPacket.WriteUInt(0); pPacket.WriteByte(0x00); pPacket.WriteUShort((ushort)mCards.Count); foreach (PlayerCard card in mCards.Values) { pPacket.WriteUShort(ItemData.ReduceCardIdentifier(card.CardIdentifier)); pPacket.WriteByte(card.Level); } }
internal void WriteGeneral(Packet pPacket) { pPacket.WriteInt(mSkillIdentifier); pPacket.WriteUInt(mLevel); if (SkillData.IsFourthJobRelated(mSkillIdentifier)) pPacket.WriteUInt(mMaxLevel); }
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); }
private static void SendAllPlayerList(Client pClient) { Packet packet = new Packet(EOpcode.SMSG_ALL_PLAYER_LIST); packet.WriteByte(0x01); packet.WriteUInt(1); byte playerCount = (byte)(long)Database.Scalar("SELECT COUNT(*) FROM player WHERE account_identifier=@account_identifier", new MySqlParameter("@account_identifier", pClient.Account.Identifier)); packet.WriteInt(playerCount); pClient.SendPacket(packet); packet = new Packet(EOpcode.SMSG_ALL_PLAYER_LIST); packet.WriteByte(0x00); packet.WriteByte(0x00); packet.WriteByte(playerCount); if (playerCount > 0) { using (DatabaseQuery query = Database.Query("SELECT * FROM player WHERE account_identifier=@account_identifier", new MySqlParameter("@account_identifier", pClient.Account.Identifier))) { while (query.NextRow()) WritePlayer(packet, query); } } pClient.SendPacket(packet); }
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); } }
internal void WriteAppearance(Packet pPacket) { pPacket.WriteByte(mGender); pPacket.WriteByte(mSkin); pPacket.WriteInt(mEyesIdentifier); pPacket.WriteBool(true); pPacket.WriteInt(mHairIdentifier); mItems.WriteEquipment(pPacket); pPacket.WriteUInt(0); pPacket.WriteUInt(0); pPacket.WriteUInt(0); }
internal void SendInitialMapChange() { Packet packet = new Packet(EOpcode.SMSG_MAP_CHANGE); packet.WriteUInt(0); packet.WriteByte(0x01); packet.WriteByte(0x01); packet.WriteUShort(0); packet.WriteInt(mRandom.Next()); packet.WriteInt(mRandom.Next()); packet.WriteInt(mRandom.Next()); packet.WriteInt(-1); packet.WriteInt(-1); packet.WriteInt(mIdentifier); packet.WritePaddedString(mName, 13); packet.WriteByte(mGender); packet.WriteByte(mSkin); packet.WriteInt(mEyesIdentifier); packet.WriteInt(mHairIdentifier); packet.WriteSkip(24); packet.WriteByte(mLevel); packet.WriteUShort(mJob); packet.WriteUShort(mStrength); packet.WriteUShort(mDexterity); packet.WriteUShort(mIntellect); packet.WriteUShort(mLuck); packet.WriteUShort(mHealth); packet.WriteUShort(mMaxHealth); packet.WriteUShort(mMana); packet.WriteUShort(mMaxMana); packet.WriteUShort(mAbilityPoints); packet.WriteUShort(mSkillPoints); packet.WriteInt(mExperience); packet.WriteUShort(mFame); packet.WriteUInt(0); packet.WriteInt(mMap.Data.Identifier); packet.WriteByte(mSpawn); packet.WriteUInt(0); packet.WriteByte(mBuddies.MaxBuddies); mItems.WriteInitial(packet); mSkills.WriteInitial(packet); mQuests.WriteInitial(packet); packet.WriteUInt(0); packet.WriteUInt(0); mTeleports.WriteInitial(packet); mCards.WriteInitial(packet); packet.WriteUInt(0); packet.WriteUShort(0); packet.WriteLong(DateTime.Now.ToBinary()); mClient.SendPacket(packet); }
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; }
public void SendPortalBlocked() { Packet packet = new Packet(EOpcode.SMSG_PLAYER_UPDATE); packet.WriteByte(0x01); packet.WriteUInt(0); SendPacket(packet); }