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


C# IActor.Loot方法代码示例

本文整理汇总了C#中IActor.Loot方法的典型用法代码示例。如果您正苦于以下问题:C# IActor.Loot方法的具体用法?C# IActor.Loot怎么用?C# IActor.Loot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IActor的用法示例。


在下文中一共展示了IActor.Loot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NextPlayerLoots

		//the way this works is the current looter can either loot all or loot a specific item and then his turn is over and the next player gets a chance to loot.
		//the next player can choose to loot something from the current corpse
		private void NextPlayerLoots(IUser looter, List<string> commands, IActor npc) {
			if (NextLooterList == null) {
				//create th elist of looters in no particular order
				NextLooterList = new Dictionary<int, ObjectId>();
				int index = 0;
				foreach (var player in PlayerList) {
					NextLooterList.Add(index, player);
					index++;
				}
			}

			if (looter.UserID == NextLooterList[CurrentLooter]) {
				if (npc.Loot(looter, commands, true)) {
					//if the player actually loots something then we'll increment the counter
					CurrentLooter++;
					if (CurrentLooter > NextLooterList.Count) {
						CurrentLooter = 0;
					}
				}
			}
			else {
				int playerPosition = 0;
				foreach (var keyValue in NextLooterList) {
					if (keyValue.Value == looter.UserID) {
						break;
					}
					playerPosition++;
				}

				playerPosition -= CurrentLooter;

				if (playerPosition < 0) {
					playerPosition = playerPosition + NextLooterList.Count;
				}

				Server.GetAUser(looter.UserID).MessageHandler(string.Format("You are not eligible to loot at this time, it will be your turn in {0} more lootings.", playerPosition));
			}
		}
开发者ID:jandar78,项目名称:Novus,代码行数:40,代码来源:Group.cs

示例2: MasterLooterLoots

		private void MasterLooterLoots(IUser looter, List<string> commands, IActor npc) {
			if (string.Equals(looter.UserID, MasterLooter)) {
				npc.Loot(looter, commands, true);
			}
			else {
				looter.MessageHandler("Only the master looter can loot corpses killed by the group.");
			}
		}
开发者ID:jandar78,项目名称:Novus,代码行数:8,代码来源:Group.cs

示例3: ChanceLoot

		//one player will randomly be chosen as the loot winner and can loot something. Once he loots something looting should be opne for all for
		//the corpse that was looted, otherwise another winner is randomly chosen again.
		//this has the drawback that only one corpse is remembered and not all the corpses that got looted not cool.
		private void ChanceLoot(IUser looter, List<string> commands, IActor npc) {
			//we don't have a loot winner yet so let's roll the dice
			if (MasterLooter == null) {
				int highestRoll = 0;
                ObjectId winner = ObjectId.Empty;
				foreach (var player in PlayerList) {
					int currentRoll = Extensions.RandomNumber.GetRandomNumber().NextNumber(0, 20);
					if (currentRoll > highestRoll) {
						winner = player;
					}
				}
			}

			//so the looter was the winner or another player in the group is looting a corpse that was previously looted by a previous winner
			if (string.Equals(looter.UserID, MasterLooter) || LastLootedCorpse.Contains(npc.Id)) {
				if (npc.Loot(looter, commands, true)) {
					//if player actually looted something
					MasterLooter = ObjectId.Empty;
					if (!LastLootedCorpse.Contains(npc.Id)) {
						LastLootedCorpse.Add(npc.Id);
					}
				}
				//we don't need to keep any old Id's since they probably rotted away anyways. Seriously doubt the group looted 100 bodies and then wanted to go
				//back and re-loot one of the 50 first corpses.  This number is subject to change once testing starts happening.
				if (LastLootedCorpse.Count > 100) {
					LastLootedCorpse.RemoveRange(0, 49);
				}
			}
			else {
				Server.GetAUser(looter.UserID).MessageHandler("You dId not win the loot draw and can not loot this corpse.");
			}

		}
开发者ID:jandar78,项目名称:Novus,代码行数:36,代码来源:Group.cs


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