private void handleClanChat(Player player, Packet packet) { long clanOwner = packet.readLong(); if (clanOwner < 0) { return; } if (clanOwner == 0) { Server.getClanManager().leaveChannel(player); return; } string ownerName = misc.longToPlayerName(clanOwner).ToLower(); Server.getClanManager().enterChannel(player, ownerName); }
private void handleEnterText(Player player, Packet packet) { if (player.getTemporaryAttribute("interfaceVariable") == null) { player.getPackets().sendMessage("An error occured, please try again."); return; } long textAsLong = packet.readLong(); EnterVariable var = (EnterVariable) player.getTemporaryAttribute("interfaceVariable"); switch(var.getInterfaceId()) { case 590: // Clan chat setup Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername()); if (clan != null) { clan.setClanName(misc.longToPlayerName(textAsLong)); Server.getClanManager().updateClan(clan); player.getPackets().modifyText(misc.formatPlayerNameForDisplay(clan.getClanName()), 590, 22); break; } player.getPackets().sendMessage("Please set up a clan channel before trying to change the name."); break; } player.removeTemporaryAttribute("interfaceVariable"); }
private void handleDeleteFriend(Player player, Packet packet) { long name = packet.readLong(); if (name > 0) { player.getFriends().removeFriend(name); } }
private void handleClanKick(Player player, Packet packet) { long name = packet.readLong(); if (name < 0) { return; } Clan clan = Server.getClanManager().getClanByPlayer(player); if (clan != null) { ClanUser user = clan.getUserByName(player.getLoginDetails().getUsername()); if (user != null) { if (user.getClanRights() < clan.getKickRights()) { player.getPackets().sendMessage("You do not have a high enough rank to kick users from this clan chat."); return; } clan.kickUser(name); } } }
private void handleClanRanks(Player player, Packet packet) { int rank = packet.readByteA(); long name = packet.readLong(); if (name < 0 || (rank < 0 || rank > 6)) { return; } Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername()); if (clan != null) { ClanUser user = clan.getUserByName(misc.longToPlayerName(name)); if (user != null) { user.setClanRights((Clan.ClanRank)rank); Server.getClanManager().updateClan(clan); } Clan.ClanRank userExists; if (clan.getUsersWithRank().TryGetValue(misc.longToPlayerName(name), out userExists)) clan.getUsersWithRank()[misc.longToPlayerName(name)] = (Clan.ClanRank)rank; //Exists already, so altar. else clan.getUsersWithRank().Add(misc.longToPlayerName(name), (Clan.ClanRank)rank); //Not existed yet. so add } }
private void handleSendPm(Player player, Packet packet) { long name = packet.readLong(); byte[] privateMsgPacked = packet.getRemainingData(); string privateMsg = misc.textUnpack(privateMsgPacked); if (privateMsg != null && name > 0) { player.getFriends().sendMessage(name, privateMsg, privateMsgPacked); } }
private void handleAddIgnore(Player player, Packet packet) { long name = packet.readLong(); if (name > 0) { player.getFriends().addIgnore(name); } }