예제 #1
0
 private void handleAddIgnore(Player player, Packet packet)
 {
     long name = packet.readLong();
     if (name > 0)
     {
         player.getFriends().addIgnore(name);
     }
 }
예제 #2
0
 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);
 }
예제 #3
0
 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");
 }
예제 #4
0
 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);
         }
     }
 }
예제 #5
0
 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);
     }
 }
예제 #6
0
 private void handleDeleteFriend(Player player, Packet packet)
 {
     long name = packet.readLong();
     if (name > 0)
     {
         player.getFriends().removeFriend(name);
     }
 }
예제 #7
0
 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
     }
 }