public static void Action(Client pClient, Packet pPacket) { int uniqueIdentifier; short moveIdentifier; bool isUsingAbility; byte usingAbility; Coordinates projectileTarget; if (!pPacket.ReadInt(out uniqueIdentifier) || !pPacket.ReadShort(out moveIdentifier) || !pPacket.ReadBool(out isUsingAbility) || !pPacket.ReadByte(out usingAbility) || !pPacket.ReadCoordinates(out projectileTarget) || !pPacket.ReadSkip(5)) { pClient.Disconnect(); return; } Mob mob = pClient.Player.Map.GetMob(uniqueIdentifier); if (mob == null || mob.Controller != pClient.Player) return; int rewindOffset = pPacket.Cursor; Coordinates unknownPosition; if (!pPacket.ReadCoordinates(out unknownPosition) || !pClient.Player.Map.ReadMovement(mob, pPacket)) { pClient.Disconnect(); return; } Packet packet = new Packet(EOpcode.SMSG_MOB_ACTION_CONFIRM); packet.WriteInt(uniqueIdentifier); packet.WriteShort(moveIdentifier); packet.WriteBool(isUsingAbility); packet.WriteUShort((ushort)mob.Mana); packet.WriteByte(0x00); // Ability Identifier packet.WriteByte(0x00); // Ability Level pClient.SendPacket(packet); pPacket.Rewind(rewindOffset); packet = new Packet(EOpcode.SMSG_MOB_ACTION); packet.WriteInt(uniqueIdentifier); packet.WriteBool(isUsingAbility); packet.WriteByte(usingAbility); packet.WriteCoordinates(projectileTarget); packet.WriteBytes(pPacket.InnerBuffer, pPacket.Cursor, pPacket.Remaining); pClient.Player.Map.SendPacketToAllExcept(packet, pClient.Player); pClient.Player.Map.UpdateMobControllers(true); }
public static void Action(Client pClient, Packet pPacket) { int firstUnknown; short secondUnknown; if (!pPacket.ReadInt(out firstUnknown) || !pPacket.ReadShort(out secondUnknown)) { pClient.Disconnect(); return; } Packet packet = new Packet(EOpcode.SMSG_NPC_ACTION); byte thirdUnknown; if (!pPacket.ReadByte(out thirdUnknown)) { packet.WriteInt(firstUnknown); packet.WriteShort(secondUnknown); } else packet.WriteBytes(pPacket.InnerBuffer, pPacket.Cursor, pPacket.Remaining); 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); }
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 SendReactorDetails(Player pPlayer) { int slot = 0; foreach (Reactor reactor in mReactors) { Packet packet = new Packet(EOpcode.SMSG_REACTOR_DETAILS); packet.WriteInt(slot++); packet.WriteInt(reactor.Data.ReactorIdentifier); packet.WriteByte(reactor.State); packet.WriteShort(reactor.Data.X); packet.WriteShort(reactor.Data.Y); packet.WriteByte(0x00); pPlayer.SendPacket(packet); } }
internal void SendNPCDetails(Player pPlayer) { int index = 0; foreach (NPC npc in mNPCs) { Packet packet = new Packet(EOpcode.SMSG_NPC_DETAILS); packet.WriteInt(index + 0x64); packet.WriteInt(npc.Data.NPCIdentifier); packet.WriteShort(npc.Data.X); packet.WriteShort(npc.Data.Y); packet.WriteBool((npc.Data.Flags & MapData.MapNPCData.EMapNPCFlags.FacesLeft) != MapData.MapNPCData.EMapNPCFlags.None); packet.WriteUShort(npc.Data.Foothold); packet.WriteShort(npc.Data.MinClickX); packet.WriteShort(npc.Data.MaxClickX); packet.WriteBool(true); pPlayer.SendPacket(packet); packet = new Packet(EOpcode.SMSG_NPC_CONTROL); packet.WriteBool(true); packet.WriteInt(index + 0x64); packet.WriteInt(npc.Data.NPCIdentifier); packet.WriteShort(npc.Data.X); packet.WriteShort(npc.Data.Y); packet.WriteBool((npc.Data.Flags & MapData.MapNPCData.EMapNPCFlags.FacesLeft) != MapData.MapNPCData.EMapNPCFlags.None); packet.WriteUShort(npc.Data.Foothold); packet.WriteShort(npc.Data.MinClickX); packet.WriteShort(npc.Data.MaxClickX); packet.WriteBool(true); pPlayer.SendPacket(packet); ++index; } }
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; }