当前位置: 首页>>代码示例>>C#>>正文


C# Player.getClan方法代码示例

本文整理汇总了C#中RunescapeServer.player.Player.getClan方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getClan方法的具体用法?C# Player.getClan怎么用?C# Player.getClan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RunescapeServer.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);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:16,代码来源:Communication.cs

示例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);
	    }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:55,代码来源:ClanManager.cs


注:本文中的RunescapeServer.player.Player.getClan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。