本文整理匯總了C#中RS2.Server.player.Player.getClan方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.getClan方法的具體用法?C# Player.getClan怎麽用?C# Player.getClan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RS2.Server.player.Player
的用法示例。
在下文中一共展示了Player.getClan方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: handlePublicChat
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);
}
示例2: enterChannel
public void enterChannel(Player p, string owner)
{
if (p.getClan() != null)
{
return;
}
p.getPackets().sendMessage("Attempting to join channel...:clan:");
if (owner.Equals(p.getLoginDetails().getUsername()))
{
Clan newClan = new Clan(p, owner, owner);
addChannel(newClan);
}
Event enterChannelEvent = new Event(700);
enterChannelEvent.setAction(() =>
{
enterChannelEvent.stop();
foreach (Clan c in clans)
{
if (c != null)
{
if (c.getClanOwner().Equals(owner))
{
if (c.getUserList().Count >= 100)
{
p.getPackets().sendMessage("The channel is full.");
return;
}
if (!owner.Equals(p.getLoginDetails().getUsername()))
{
if (c.getEnterRights() != Clan.ClanRank.NO_RANK)
{
if (c.getEnterRights() == Clan.ClanRank.FRIEND)
{
if (!c.isFriendOfOwner(p) && !c.userHasRank(p.getLoginDetails().getUsername()))
{
p.getPackets().sendMessage("You do not have a high enough rank to enter this clan chat.");
return;
}
}
else
{
bool canEnter = true;
foreach (KeyValuePair<string, Clan.ClanRank> u in c.getUsersWithRank())
{
if (u.Key.Equals(p.getLoginDetails().getUsername()))
{
if (u.Value < c.getEnterRights())
{
canEnter = false;
break;
}
}
}
if (!canEnter)
{
p.getPackets().sendMessage("You do not have a high enough rank to enter this clan chat.");
return;
}
}
}
}
c.addUser(p);
updateClan(c);
p.getPackets().sendMessage("Now talking in channel : " + Misc.formatPlayerNameForDisplay(c.getClanName() + ":clan:"));
p.getPackets().sendMessage("To talk, start each line of chat with the / symbol. :clan:");
return;
}
}
}
p.getPackets().sendMessage("The channel you tried to join does not exist. :clan:");
});
Server.registerEvent(enterChannelEvent);
}