/// <summary> /// Like the above, but sends messages to multiple players /// </summary> static public void Player_RouteChat(IChatTarget target, Player from, CS_Chat chat) { //Formulate the chat notification! SC_Chat schat = new SC_Chat(); schat.chatType = chat.chatType; schat.from = from._alias; schat.message = chat.message; schat.bong = chat.bong; //Go! foreach (Player player in target.getChatTargets()) { if (player == from) { continue; } if (from != null) { if (player._accountIgnore.ContainsKey(from._alias)) { continue; } if (player._accountIgnore.ContainsValue(from._ipAddress)) { continue; } } player._client.sendReliable(schat); } }
/// <summary> /// Provides an easy means of routing chat messages between players /// </summary> static public void Player_RouteChat(Player p, Player from, CS_Chat chat) { //Formulate the chat notification! SC_Chat schat = new SC_Chat(); schat.chatType = chat.chatType; schat.from = from._alias; schat.message = chat.message; schat.bong = chat.bong; //Go! p._client.sendReliable(schat); }
/// <summary> /// Like the above, but sends messages to multiple players /// </summary> static public void Player_RouteChat(IChatTarget target, Player from, CS_Chat chat) { //Formulate the chat notification! SC_Chat schat = new SC_Chat(); schat.chatType = chat.chatType; schat.from = from._alias; schat.message = chat.message; schat.bong = chat.bong; //Go! foreach (Player player in target.getChatTargets()) { if (player != from) { player._client.sendReliable(schat); } } }
/// <summary> /// Provides an easy means of routing chat messages between players /// </summary> static public void Player_RouteChat(Player p, Player from, CS_Chat chat) { //We ignoring them? if (from != null) { if (p._accountIgnore.ContainsKey(from._alias) || p._accountIgnore.ContainsValue(from._ipAddress)) { return; } } //Formulate the chat notification! SC_Chat schat = new SC_Chat(); schat.chatType = chat.chatType; schat.from = from._alias; schat.message = chat.message; schat.bong = chat.bong; //Go! p._client.sendReliable(schat); }
/// <summary> /// Creates a new packet based on the typeID and the received content /// inside the buffer. The user has to create an own implementation /// of this interface. /// </summary> public PacketBase createPacket(NetworkClient client, ushort typeID, byte[] buffer, int offset, int size) { //Ready our packet base PacketBase packet = null; size--; //Was it a system packet? if (buffer[offset++] == 0) { //Yes, find the appropriate type return(createSystemPacket(typeID, buffer, offset, size)); } //So what was the typeid? switch (typeID) { case CS_Login.TypeID: packet = new CS_Login(typeID, buffer, offset, size); break; case CS_ArenaJoin.TypeID: packet = new CS_ArenaJoin(typeID, buffer, offset, size); break; case CS_PlayerJoin.TypeID: packet = new CS_PlayerJoin(typeID, buffer, offset, size); break; case CS_Ready.TypeID: packet = new CS_Ready(typeID, buffer, offset, size); break; case CS_PlayerPickup.TypeID: packet = new CS_PlayerPickup(typeID, buffer, offset, size); break; case CS_PlayerDrop.TypeID: packet = new CS_PlayerDrop(typeID, buffer, offset, size); break; case CS_Chat.TypeID: packet = new CS_Chat(typeID, buffer, offset, size); break; case CS_PlayerUseItem.TypeID: packet = new CS_PlayerUseItem(typeID, buffer, offset, size); break; case CS_Explosion.TypeID: packet = new CS_Explosion(typeID, buffer, offset, size); break; case CS_PlayerUpdate.TypeID: packet = new CS_PlayerUpdate(typeID, buffer, offset, size); break; case CS_Shop.TypeID: packet = new CS_Shop(typeID, buffer, offset, size); break; case CS_ShopSkill.TypeID: packet = new CS_ShopSkill(typeID, buffer, offset, size); break; case CS_PlayerSwitch.TypeID: packet = new CS_PlayerSwitch(typeID, buffer, offset, size); break; case CS_PlayerFlag.TypeID: packet = new CS_PlayerFlag(typeID, buffer, offset, size); break; case CS_RequestUpdate.TypeID: packet = new CS_RequestUpdate(typeID, buffer, offset, size); break; case CS_StartUpdate.TypeID: packet = new CS_StartUpdate(typeID, buffer, offset, size); break; case CS_VehicleDeath.TypeID: packet = new CS_VehicleDeath(typeID, buffer, offset, size); break; case CS_PlayerPortal.TypeID: packet = new CS_PlayerPortal(typeID, buffer, offset, size); break; case CS_AllowSpectator.TypeID: packet = new CS_AllowSpectator(typeID, buffer, offset, size); break; case CS_RequestSpectator.TypeID: packet = new CS_RequestSpectator(typeID, buffer, offset, size); break; case CS_ItemExpired.TypeID: packet = new CS_ItemExpired(typeID, buffer, offset, size); break; case CS_PlayerProduce.TypeID: packet = new CS_PlayerProduce(typeID, buffer, offset, size); break; case CS_SetBanner.TypeID: packet = new CS_SetBanner(typeID, buffer, offset, size); break; case CS_FileSend.TypeID: packet = new CS_FileSend(typeID, buffer, offset, size); break; case CS_Environment.TypeID: packet = new CS_Environment(typeID, buffer, offset, size); break; case CS_Frames.TypeID: packet = new CS_Frames(typeID, buffer, offset, size); break; case CS_ChartRequest.TypeID: packet = new CS_ChartRequest(typeID, buffer, offset, size); break; case CS_SecurityCheck.TypeID: packet = new CS_SecurityCheck(typeID, buffer, offset, size); break; case CS_BallPickup.TypeID: packet = new CS_BallPickup(typeID, buffer, offset, size); break; case CS_BallDrop.TypeID: packet = new CS_BallDrop(typeID, buffer, offset, size); break; case CS_GoalScored.TypeID: packet = new CS_GoalScored(typeID, buffer, offset, size); break; case CS_VehiclePickup.TypeID: packet = new CS_VehiclePickup(typeID, buffer, offset, size); break; case CS_SendBanner.TypeID: packet = new CS_SendBanner(typeID, buffer, offset, size); break; case CS_DamageEvent.TypeID: packet = new CS_DamageEvent(typeID, buffer, offset, size); break; case CS_PlayerZoneDisconnected.TypeID: packet = new CS_PlayerZoneDisconnected(typeID, buffer, offset, size); break; case CS_RegResponse.TypeID: packet = new CS_RegResponse(typeID, buffer, offset, size); break; case CS_Unknown.TypeID: packet = new CS_Unknown(typeID, buffer, offset, size); break; default: //An undefined packet. packet = new PacketDummy(typeID, buffer, offset, size); break; } return(packet); }