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


C# GS.GameClient类代码示例

本文整理汇总了C#中DOL.GS.GameClient的典型用法代码示例。如果您正苦于以下问题:C# GameClient类的具体用法?C# GameClient怎么用?C# GameClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GameClient类属于DOL.GS命名空间,在下文中一共展示了GameClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DisplayInformations

		// Display the informations
		private void DisplayInformations(GameClient client)
		{
			byte webDisplay = client.Player.NotDisplayedInHerald;
			byte webDisplayFlag;

			string state = "/webdisplay <position|template|equipment|craft> [on|off]\n";
			
			webDisplayFlag = (byte)GlobalConstants.eWebDisplay.equipment;
			if ((webDisplay & webDisplayFlag) == webDisplayFlag)
				state += "Your equipment is not displayed.\n";
			else
				state += "Your equipment is displayed.\n";
			
			webDisplayFlag = (byte)GlobalConstants.eWebDisplay.position;
			if ((webDisplay & webDisplayFlag) == webDisplayFlag)
				state += "Your position is not displayed.\n";
			else
				state += "Your position is displayed.\n";
			
			webDisplayFlag = (byte)GlobalConstants.eWebDisplay.template;
			if ((webDisplay & webDisplayFlag) == webDisplayFlag)
				state += "Your template is not displayed.\n";
			else
				state += "Your template is displayed.\n";
	
			webDisplayFlag = (byte)GlobalConstants.eWebDisplay.craft;
			if ((webDisplay & webDisplayFlag) == webDisplayFlag)
				state += "Your crafting skill is not displayed.\n";
			else
				state += "Your crafting skill is displayed.\n";		
			
			DisplayMessage(client, state);
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:34,代码来源:webdisplay.cs

示例2: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			if (client.Account.PrivLevel == 1 && ServerProperties.Properties.ANON_MODIFIER == -1)
			{
				DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.Error"));
				return;
			}

			client.Player.IsAnonymous = !client.Player.IsAnonymous;
			string[] friendList = new string[]
				{
					client.Player.Name
				};
			if (client.Player.IsAnonymous)
			{
				client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.On"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
				foreach (GameClient pclient in WorldMgr.GetAllPlayingClients())
				{
					if (pclient.Player.Friends.Contains(client.Player.Name))
						pclient.Out.SendRemoveFriends(friendList);
				}
			}
			else
			{
				client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.Off"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
				foreach (GameClient pclient in WorldMgr.GetAllPlayingClients())
				{
					if (pclient.Player.Friends.Contains(client.Player.Name))
						pclient.Out.SendAddFriends(friendList);
				}
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:32,代码来源:anonymous.cs

示例3: DisplayNews

		public static void DisplayNews(GameClient client)
		{
			// N,chanel(0/1/2),index(0-4),string time,\"news\"

			for (int type = 0; type <= 2; type++)
			{
				int index = 0;
				string realm = "";
				//we can see all captures
				IList<DBNews> newsList;
				if (type > 0)
					newsList = GameServer.Database.SelectObjects<DBNews>("`Type` = @Type AND (`Realm` = @DefaultRealm OR `Realm` = @Realm)",
					                                                     new[] { new QueryParameter("@Type", type), new QueryParameter("@DefaultRealm", 0), new QueryParameter("@Realm", realm) });
				else
					newsList = GameServer.Database.SelectObjects<DBNews>("`Type` = @Type", new QueryParameter("@Type", type));

				newsList = newsList.OrderByDescending(it => it.CreationDate).Take(5).ToArray();
				int n = newsList.Count;

				while (n > 0)
				{
					n--;
					DBNews news = newsList[n];
					client.Out.SendMessage(string.Format("N,{0},{1},{2},\"{3}\"", news.Type, index++, RetElapsedTime(news.CreationDate), news.Text), eChatType.CT_SocialInterface, eChatLoc.CL_SystemWindow);
				}
			}
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:27,代码来源:NewsMgr.cs

示例4: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			if (IsSpammingCommand(client.Player, "stats"))
				return;

			if (client == null) return;

            if (args.Length > 1)
            {
                string playerName = "";

                if (args[1].ToLower() == "player")
                {
                    if (args.Length > 2)
                    {
                        playerName = args[2];
                    }
                    else
                    {
                        // try and get player name from target
                        if (client.Player.TargetObject != null && client.Player.TargetObject is GamePlayer)
                        {
                            playerName = client.Player.TargetObject.Name;
                        }
                    }
                }

                client.Player.Statistics.DisplayServerStatistics(client, args[1].ToLower(), playerName);
            }
            else
            {
                DisplayMessage(client, client.Player.Statistics.GetStatisticsMessage());
            }
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:34,代码来源:stats.cs

示例5: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			int housenumber = 0;
			if (args.Length > 1)
			{
				try
				{
					housenumber = int.Parse(args[1]);
				}
				catch
				{
					DisplaySyntax(client);
					return;
				}
			}
			else HouseMgr.GetHouseNumberByPlayer(client.Player);

			if (housenumber == 0)
			{
				DisplayMessage(client, "No house found.");
				return;
			}

			House house = HouseMgr.GetHouse(housenumber);

			ushort direction = client.Player.GetHeading(house);
			client.Player.Heading = direction;
			client.Out.SendPlayerJump(true);
			DisplayMessage(client, "You face house " + housenumber);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:30,代码来源:houseface.cs

示例6: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			const string BROAD_TICK = "Broad_Tick";

			if (args.Length < 2)
			{
				DisplayMessage(client, LanguageMgr.GetTranslation(client, "Scripts.Players.Broadcast.NoText"));
				return;
			}
			if (client.Player.IsMuted)
			{
				client.Player.Out.SendMessage("You have been muted. You cannot broadcast.", eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
				return;
			}
			string message = string.Join(" ", args, 1, args.Length - 1);

			long BroadTick = client.Player.TempProperties.getProperty<long>(BROAD_TICK);
			if (BroadTick > 0 && BroadTick - client.Player.CurrentRegion.Time <= 0)
			{
				client.Player.TempProperties.removeProperty(BROAD_TICK);
			}
			long changeTime = client.Player.CurrentRegion.Time - BroadTick;
			if (changeTime < 800 && BroadTick > 0)
			{
				client.Player.Out.SendMessage("Slow down! Think before you say each word!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				client.Player.TempProperties.setProperty(BROAD_TICK, client.Player.CurrentRegion.Time);
				return;
			}
			Broadcast(client.Player, message);

			client.Player.TempProperties.setProperty(BROAD_TICK, client.Player.CurrentRegion.Time);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:32,代码来源:region.cs

示例7: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			if (IsSpammingCommand(client.Player, "settitle"))
				return;

			int index = -1;
			if (args.Length > 1)
			{
				try { index = int.Parse(args[1]); }
				catch { }

				IPlayerTitle current = client.Player.CurrentTitle;
				if (current != null && current.IsForced(client.Player))
					client.Out.SendMessage("You cannot change the current title.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				else
				{
					IList titles = client.Player.Titles;
					if (index < 0 || index >= titles.Count)
						client.Player.CurrentTitle = PlayerTitleMgr.ClearTitle;
					else
						client.Player.CurrentTitle = (IPlayerTitle)titles[index];
				}
			}
			else
			{
				client.Out.SendPlayerTitles();
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:28,代码来源:settitle.cs

示例8: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			if (args.Length < 2)
			{
				DisplaySyntax(client);
				return;
			}

			GameClient clientc = null;

			if (args[1].StartsWith("#"))
			{
				try
				{
					int sessionID = Convert.ToInt32(args[1].Substring(1));
					clientc = WorldMgr.GetClientFromID(sessionID);
				}
				catch
				{
					DisplayMessage(client, "Invalid client ID");
				}
			}
			else
			{
				clientc = WorldMgr.GetClientByPlayerName(args[1], false, false);
			}
			
			if (clientc == null)
			{
				DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Kick.NoPlayerOnLine"));
				return;
			}

			if (client.Account.PrivLevel < clientc.Account.PrivLevel)
			{
				DisplayMessage(client, "Your privlevel is not high enough to kick this player.");
				return;
			}

			for (int i = 0; i < 8; i++)
			{
				string message;
				if (client != null && client.Player != null)
				{
					message = LanguageMgr.GetTranslation(clientc, "GMCommands.Kick.RemovedFromServerByGM", client.Player.Name);
				}
				else
				{
					message = LanguageMgr.GetTranslation(clientc, "GMCommands.Kick.RemovedFromServer");
				}

				clientc.Out.SendMessage(message, eChatType.CT_Help, eChatLoc.CL_SystemWindow);
				clientc.Out.SendMessage(message, eChatType.CT_Help, eChatLoc.CL_ChatWindow);
			}

			clientc.Out.SendPlayerQuit(true);
			clientc.Player.SaveIntoDatabase();
			clientc.Player.Quit(true);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:59,代码来源:kick.cs

示例9: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			if (client.Player.Group == null || client.Player.Group.MemberCount < 2)
			{
				client.Out.SendMessage("You are not part of a group.",eChatType.CT_System,eChatLoc.CL_SystemWindow);
				return;
			}
			if(client.Player.Group.Leader != client.Player)
			{
				client.Out.SendMessage("You are not the leader of your group.",eChatType.CT_System,eChatLoc.CL_SystemWindow);
				return;
			}

			GamePlayer target;

			if(args.Length<2) // Setting by target
			{
				if(client.Player.TargetObject == null || client.Player.TargetObject == client.Player)
				{
					client.Out.SendMessage("You have not selected a valid player as your target.",eChatType.CT_System,eChatLoc.CL_SystemWindow);
					return;
				}

				if(!(client.Player.TargetObject is GamePlayer))
				{
					client.Out.SendMessage("You have not selected a valid player as your target.",eChatType.CT_System,eChatLoc.CL_SystemWindow);
					return;
				}
				target = (GamePlayer)client.Player.TargetObject;
				if(client.Player.Group != target.Group)
				{
					client.Out.SendMessage("You have not selected a valid player as your target.",eChatType.CT_System,eChatLoc.CL_SystemWindow);
					return;
				}
			}
			else //Setting by name
			{
				string targetName = args[1];
				GameClient targetClient = WorldMgr.GetClientByPlayerName(targetName, false, true);
				if (targetClient == null)
					target = null;
				else target = targetClient.Player;
				if(target==null || client.Player.Group != target.Group)
				{ // Invalid target
					client.Out.SendMessage("No players in group with that name.",eChatType.CT_System,eChatLoc.CL_SystemWindow);
					return;
				}
				if(target==client.Player)
				{
					client.Out.SendMessage("You are the group leader already.",eChatType.CT_System,eChatLoc.CL_SystemWindow);
					return;
				}

			}

            client.Player.Group.MakeLeader(target);
			client.Player.Group.SendMessageToGroupMembers(target.Name + " is new group leader.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:58,代码来源:makeleader.cs

示例10: Init

 public bool Init(uint num, bool up, GameClient dealer)
 {
     if(num < 0 || num > 51) return false;
     m_id = num;
     m_faceup = up;
     m_dealer = dealer;
     m_name = GetCardName(num);
     return true;
 }
开发者ID:boscorillium,项目名称:dol,代码行数:9,代码来源:CardMgr.cs

示例11: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			if (IsSpammingCommand(client.Player, "cancelstyle"))
				return;

			client.Player.CancelStyle = !client.Player.CancelStyle;
			DisplayMessage(client, string.Format(LanguageMgr.GetTranslation(client, "Scripts.Players.Cancelstyle.Set",
				(client.Player.CancelStyle ? LanguageMgr.GetTranslation(client, "Scripts.Players.Cancelstyle.On") : LanguageMgr.GetTranslation(client, "Scripts.Players.Cancelstyle.Off")))));
		}
开发者ID:boscorillium,项目名称:dol,代码行数:9,代码来源:cancelstyle.cs

示例12: OnCommand

		/// <summary>
		/// Command Handling Refreshs.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="args"></param>
		public void OnCommand(GameClient client, string[] args)
		{
			// Init Refresh Attribute Lookup
			if (!m_initialized)
			{
				m_initialized = true;
				InitRefreshCmdCache();
			}
			
			if (args.Length < 2)
			{
				DisplaySyntax(client);
				DisplayAvailableModules(client);
			}
			
			// Join args
			string arg = string.Join(" ", args.Skip(1)).Trim();
			if (string.IsNullOrEmpty(arg))
			{
				DisplaySyntax(client);
				DisplayAvailableModules(client);
				return;
			}
			
			// Check if arg is "list" or try our module directory
			if(arg.ToLower().Equals("list"))
			{
				DisplayAvailableModules(client);
				return;
			}
			else
			{
				var method = m_refreshCommandCache.FirstOrDefault(k => k.Key.ToLower().Equals(arg.ToLower()));
				
				if (method.Value == null)
				{
					DisplayMessage(client, "Wrong Module argument given... try /refresh list!");
				}
				else
				{
					DisplayMessage(client, string.Format("--- Refreshing Module's static cache for: {0}", method.Key));
					try
					{
						object value = method.Value.Invoke(null, new object[] { });
						if (value != null)
							DisplayMessage(client, string.Format("--- Module returned value: {0}", value));
					}
					catch(Exception e)
					{
						DisplayMessage(client, string.Format("-!- Error while refreshing Module's static cache for: {0} - {1}", method.Key, e));
					}
						
					DisplayMessage(client, string.Format("-.- Refresh Module's static cache Finished for: {0}", method.Key));
				}
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:61,代码来源:RefreshCommand.cs

示例13: FriendsManager_RemovePlayer_RetrieveEmptyFriendsList

		public void FriendsManager_RemovePlayer_RetrieveEmptyFriendsList()
		{
			var client = new GameClient(GameServer.Instance) {
				Account = new Account() { Characters = new [] { new DOLCharacters() { SerializedFriendsList = "buddy" }  } },
				Out = new TestPacketLib()
			};
			var gameplayer = new GamePlayer(client, client.Account.Characters[0]);
			
			GameServer.Instance.PlayerManager.Friends.AddPlayerFriendsListToCache(gameplayer);
			GameServer.Instance.PlayerManager.Friends.RemovePlayerFriendsListFromCache(gameplayer);
			
			CollectionAssert.IsEmpty(gameplayer.GetFriends());
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:13,代码来源:FriendsManagerTest.cs

示例14: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			if (client.Player == null)
				return;

			int code = packet.ReadByte();
			if (code != 0)
			{
				if (log.IsWarnEnabled)
					log.WarnFormat("bonuses button: code is other than zero ({0})", code);
			}

			new RegionTimerAction<GamePlayer>(client.Player,
			                                  p => p.Out.SendCustomTextWindow(LanguageMgr.GetTranslation(client.Account.Language, "PlayerBonusesListRequestHandler.HandlePacket.Bonuses")
			                                                                  , new List<string>(client.Player.GetBonuses()))).Start(1);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:16,代码来源:PlayerBonusesListRequestHandler.cs

示例15: OnCommand

        public void OnCommand(GameClient client, string[] args)
        {
        	if (args.Length != 2) {
        		DisplaySyntax(client);
        	}
        	else if (args[1].ToLower().Equals("on")) {

                if (client.Player.IsStealthed != true)
                {
                   client.Player.Stealth(true);
                }
        	}
            else if (args[1].ToLower().Equals("off"))
            {
                    client.Player.Stealth(false);
            }
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:17,代码来源:gmstealth.cs


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