Beispiel #1
0
 public void setClanRights(Clan.ClanRank rights)
 {
     if (rights == Clan.ClanRank.NO_RANK)
     {
         if (clan.getOwnerFriends().Contains(p.getLoginDetails().getLongName()))
         {
             rights = Clan.ClanRank.FRIEND;
         }
     }
     else
     {
         if (!clan.getUsersWithRank().ContainsKey(p.getLoginDetails().getUsername()))
         {
             clan.getUsersWithRank().Add(p.getLoginDetails().getUsername(), rights);
         }
         if (clan.getUsersWithRank().Count >= 250)
         {
             misc.WriteError("Clan 'usersWithRank' map size needs increasing!");
         }
     }
     this.rights = rights;
 }
Beispiel #2
0
        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);
                }
            }
        }