コード例 #1
0
ファイル: Player.cs プロジェクト: ramatronics/rsps
 public void setLastChatMessage(ChatMessage msg)
 {
     lastChatMessage = msg;
     updateFlags.setChatTextUpdateRequired(true);
 }
コード例 #2
0
ファイル: Packets.cs プロジェクト: ramatronics/rsps
 public void newClanMessage(Clan c, ChatMessage chatMessage)
 {
     PacketBuilder pb = new PacketBuilder();
     pb.setId(54).setSize(Packet.Size.VariableByte);
     pb.addLong(chatMessage.getPlayer().getLoginDetails().getLongName());
     pb.addByte((byte)1); // dummy
     pb.addLong(Misc.playerNameToLong(c.getClanName()));
     pb.addUShort(0); // some message counter bs
     string message = chatMessage.getChatText();
     int messageCounter = player.getFriends().getNextUniqueId();
     pb.addThreeBytes(messageCounter);
     pb.addByte((byte)chatMessage.getPlayer().getRights());
     pb.addBytes(chatMessage.getPacked());
     connection.SendPacket(pb.toPacket());
 }
コード例 #3
0
ファイル: Communication.cs プロジェクト: ramatronics/rsps
        private void handlePublicChat(Player player, Packet packet)
        {
            int colour = packet.readByte();
            int effects = packet.readByte();
            byte[] packedChatData = packet.getRemainingData();
            string unpacked = Misc.textUnpack(packedChatData);
            ChatMessage message;

            if (unpacked.StartsWith("/") && player.getClan() != null)
            {
                packedChatData = Misc.textPack(unpacked.Substring(1));
                message = new ChatMessage(colour, unpacked.Substring(1), effects, player, packedChatData);
                Server.getClanManager().newClanMessage(player.getClan(), message);
                return;
            }
            message = new ChatMessage(colour, unpacked, effects, player, packedChatData);
            player.setLastChatMessage(message);
        }
コード例 #4
0
ファイル: ClanManager.cs プロジェクト: ramatronics/rsps
        public void newClanMessage(Clan c, ChatMessage m)
        {
            Player p = m.getPlayer();
            if (!c.getClanOwner().Equals(p.getLoginDetails().getUsername()))
            {
                if (c.getTalkRights() != Clan.ClanRank.NO_RANK)
                {
                    if (c.getTalkRights() == 0)
                    {
                        if (!c.isFriendOfOwner(p) && !c.userHasRank(p.getLoginDetails().getUsername()))
                        {
                            p.getPackets().sendMessage("You do not have a high enough rank to talk in this clan chat.");
                            return;
                        }
                    }
                    else
                    {
                        foreach (KeyValuePair<string, Clan.ClanRank> u in c.getUsersWithRank())
                        {
                            if (u.Key.Equals(p.getLoginDetails().getUsername()))
                            {
                                if (u.Value < c.getTalkRights())
                                {
                                    p.getPackets().sendMessage("You do not have a high enough rank to talk in this clan chat.");
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            //Send the clan chat message to all clan members.
            foreach (ClanUser cu in c.getUserList())
            {
                p = cu.getClanMember();
                if (p != null)
                    p.getPackets().newClanMessage(c, m);
            }
        }