Example #1
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);
                }
            }
        }
Example #2
0
        public void openClanSetup(Player p)
        {
            p.getPackets().displayInterface(590);
            Clan clan = getClanByOwner(p.getLoginDetails().getUsername());

            if (clan == null)
            {
                Clan newClan = new Clan(p, "Clan name", p.getLoginDetails().getUsername());
                addChannel(newClan);
                p.getPackets().sendMessage("Your clan chat has been succesfully set up.");
                return;
            }
            p.getPackets().modifyText(misc.formatPlayerNameForDisplay(clan.getClanName()), 590, 22);
            p.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
            p.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
            p.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25);
            p.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
        }