Пример #1
0
		//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));
			}
		}
Пример #2
0
		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.");
			}
		}
Пример #3
0
		//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.");
			}

		}