public void FillBagNoClassMatch() { SampleRewardList = new List <RVRRewardItem> { new RVRRewardItem { ItemId = 1, CanAwardDuplicate = 0, Class = 2, ItemCount = 1, RRBand = 0, Rarity = 2, RewardId = 123123 }, new RVRRewardItem { ItemId = 2, CanAwardDuplicate = 0, Class = 2, ItemCount = 1, RRBand = 0, Rarity = 2, RewardId = 456465 }, new RVRRewardItem { ItemId = 3, CanAwardDuplicate = 0, Class = 2, ItemCount = 1, RRBand = 0, Rarity = 1, RewardId = 789789 }, }; // Dont use random - turn off shuffle var bagContentSelector = new BagContentSelector(SampleRewardList, new Random(1)); var emptyBag = new LootBagTypeDefinition { Assignee = 1, BagRarity = LootBagRarity.Blue, LootBagNumber = 1 }; var playerExistingItems = new List <uint> { 1 }; var filledBag = bagContentSelector.SelectBagContentForPlayer(Logger, emptyBag, 40, 6, playerExistingItems, false); Assert.IsFalse(filledBag.IsValid()); }
public void AssignLootSortingIsCorrectToBags() { var sortedPairs = new List <KeyValuePair <uint, int> > { new KeyValuePair <uint, int>(50000, 124), new KeyValuePair <uint, int>(50020, 100), new KeyValuePair <uint, int>(12332, 78), new KeyValuePair <uint, int>(42223, 77), new KeyValuePair <uint, int>(73738, 50), new KeyValuePair <uint, int>(12202, 12), new KeyValuePair <uint, int>(12902, 4), new KeyValuePair <uint, int>(12123, 0), new KeyValuePair <uint, int>(33222, 220) }; var rewardAssigner = new RewardAssigner(StaticRandom.Instance, _logger); var numberOfAwards = 4; var x = new LootBagTypeDefinition().BuildLootBagTypeDefinitions(numberOfAwards); var bonusList = new List <RVRPlayerBagBonus>(); var randomRolls = new Dictionary <uint, int>(); var pairingContributions = new Dictionary <uint, int>(); var assignedLoot = rewardAssigner.AssignLootToPlayers(numberOfAwards, x, sortedPairs, bonusList, randomRolls, pairingContributions, new WorldConfigs { AllowBagBonusContribution = "Y", AllowPairingContribution = "Y", AllowRandomContribution = "Y", DebugLootRolls = "N" }); Assert.IsTrue(numberOfAwards == assignedLoot.Count); Assert.IsTrue(assignedLoot[0].Assignee == 33222); Assert.IsTrue(assignedLoot[1].Assignee == 50000); Assert.IsTrue(assignedLoot[2].Assignee == 50020); Assert.IsTrue(assignedLoot[3].Assignee == 12332); }
public void DetermineRVRZoneReward_NMatches_ValidBag_PlayerItemsMatchDupeOk() { var lootDecider = new BagContentSelector(this.SampleZoneItemOptions, new LockedRandomNumberGenerator(10)); var bag = new LootBagTypeDefinition { BagRarity = LootBagRarity.Blue, Assignee = 1, LootBagNumber = 1 }; SamplePlayerItems.Add(301); SamplePlayerItems.Add(601); // SHould match 3 record var result = lootDecider.SelectBagContentForPlayer(Logger, bag, 20, 64, SamplePlayerItems, false); Assert.IsTrue(result.IsValid()); Assert.IsTrue(result.RenownBand == 20); Assert.IsTrue(result.ItemId == 601); SamplePlayerItems.Add(602); // SHould match 3 record var result2 = lootDecider.SelectBagContentForPlayer(Logger, bag, 20, 64, SamplePlayerItems, false); Assert.IsTrue(result2.IsValid()); Assert.IsTrue(result2.RenownBand == 20); Assert.IsTrue(result2.ItemId == 601); }
public void CheckSortOrderBagDefinitions() { var x = new LootBagTypeDefinition().BuildLootBagTypeDefinitions(20); Assert.IsTrue(x[0].BagRarity == LootBagRarity.Gold); Assert.IsTrue(x[1].BagRarity == LootBagRarity.Gold); Assert.IsTrue(x[x.Count - 1].BagRarity == LootBagRarity.Green); }
public void DetermineRVRZoneReward_NoMatches() { var lootDecider = new BagContentSelector(this.SampleZoneItemOptions, StaticRandom.Instance); var bag = new LootBagTypeDefinition(); var result = lootDecider.SelectBagContentForPlayer(Logger, bag, 70, 64, new List <uint>()); Assert.IsFalse(result.IsValid()); }
public void DetermineRVRZoneReward_ManualTest_ValidBag() { var lootDecider = new BagContentSelector(this.SampleZoneItemOptions, new LockedRandomNumberGenerator(10)); var bag = new LootBagTypeDefinition { BagRarity = LootBagRarity.Blue, Assignee = 1, LootBagNumber = 1 }; // SHould match 3 record var result = lootDecider.SelectBagContentForPlayer(Logger, bag, 10, 64, new List <uint>(), true); Assert.IsTrue(1 == 1); }
public void DetermineRVRZoneReward_1Match_ValidBag() { var lootDecider = new BagContentSelector(this.SampleZoneItemOptions, new LockedRandomNumberGenerator(10)); var bag = new LootBagTypeDefinition { BagRarity = LootBagRarity.Blue, Assignee = 1, LootBagNumber = 1 }; // SHould match 1 record var result = lootDecider.SelectBagContentForPlayer(Logger, bag, 20, 64, new List <uint>(), false); Assert.IsTrue(result.IsValid()); Assert.IsTrue(result.RenownBand == 20); Assert.IsTrue(result.ItemId == 601); }
public void AssignLootWithBonusesGoldBagBonus() { var sortedPairs = new List <KeyValuePair <uint, int> > { new KeyValuePair <uint, int>(50000, 124), new KeyValuePair <uint, int>(50020, 100), new KeyValuePair <uint, int>(12332, 78), new KeyValuePair <uint, int>(42223, 77), new KeyValuePair <uint, int>(73738, 50), new KeyValuePair <uint, int>(12202, 12), new KeyValuePair <uint, int>(12902, 4), new KeyValuePair <uint, int>(12123, 0), new KeyValuePair <uint, int>(33222, 220) }; // +100 gold bag bonus should mean 50020 wins gold. And nothing else! var bonusList = new List <RVRPlayerBagBonus> { new RVRPlayerBagBonus { CharacterId = 50020, GoldBag = 200, BlueBag = 1, PurpleBag = 0, GreenBag = 0 } }; var rewardAssigner = new RewardAssigner(StaticRandom.Instance, _logger); var numberOfAwards = 4; var x = new LootBagTypeDefinition().BuildLootBagTypeDefinitions(numberOfAwards); var randomRolls = new Dictionary <uint, int>(); var pairingContributions = new Dictionary <uint, int>(); var assignedLoot = rewardAssigner.AssignLootToPlayers(numberOfAwards, x, sortedPairs, bonusList, randomRolls, pairingContributions, new WorldConfigs { AllowBagBonusContribution = "Y", AllowPairingContribution = "Y", AllowRandomContribution = "Y", DebugLootRolls = "N" }); Assert.IsTrue(numberOfAwards == assignedLoot.Count); Assert.IsTrue(assignedLoot[0].Assignee == 50020); Assert.IsTrue(assignedLoot[1].Assignee == 33222); Assert.IsTrue(assignedLoot[2].Assignee == 50000); Assert.IsTrue(assignedLoot[3].Assignee == 12332); }
public void BuildLootBagTypeDefinitionsCountsCorrect() { var def = new LootBagTypeDefinition(); Assert.IsTrue(def.BuildLootBagTypeDefinitions(0).Count == 0); Assert.IsTrue(def.BuildLootBagTypeDefinitions(1).Count == 1); Assert.IsTrue(def.BuildLootBagTypeDefinitions(2).Count == 2); Assert.IsTrue(def.BuildLootBagTypeDefinitions(3).Count == 2); Assert.IsTrue(def.BuildLootBagTypeDefinitions(4).Count == 3); Assert.IsTrue(def.BuildLootBagTypeDefinitions(6).Count == 5); Assert.IsTrue(def.BuildLootBagTypeDefinitions(12).Count == 12); Assert.IsTrue(def.BuildLootBagTypeDefinitions(10).Count == 10); Assert.IsTrue(def.BuildLootBagTypeDefinitions(20).Count == 20); Assert.IsTrue(def.BuildLootBagTypeDefinitions(30).Count == 31); Assert.IsTrue(def.BuildLootBagTypeDefinitions(40).Count == 41); Assert.IsTrue(def.BuildLootBagTypeDefinitions(50).Count == 51); }
public void BuildLootBagTypeDefinitionsRarityCorrect() { var def = new LootBagTypeDefinition(); var bagList2 = def.BuildLootBagTypeDefinitions(1); Assert.IsTrue(bagList2[0].Assignee == 0); Assert.IsTrue(bagList2[0].LootBagNumber == 0); Assert.IsTrue(bagList2[0].BagRarity == LootBagRarity.Green); var bagList3 = def.BuildLootBagTypeDefinitions(2); Assert.IsTrue(bagList3[0].Assignee == 0); Assert.IsTrue(bagList3[0].LootBagNumber == 0); Assert.IsTrue(bagList3[0].BagRarity == LootBagRarity.Green); Assert.IsTrue(bagList3[1].Assignee == 0); Assert.IsTrue(bagList3[1].LootBagNumber == 1); Assert.IsTrue(bagList3[1].BagRarity == LootBagRarity.Green); var bagList4 = def.BuildLootBagTypeDefinitions(3); Assert.IsTrue(bagList4[0].Assignee == 0); Assert.IsTrue(bagList4[0].LootBagNumber == 0); Assert.IsTrue(bagList4[0].BagRarity == LootBagRarity.Blue); Assert.IsTrue(bagList4[1].Assignee == 0); Assert.IsTrue(bagList4[1].LootBagNumber == 1); Assert.IsTrue(bagList4[1].BagRarity == LootBagRarity.Green); var bagList5 = def.BuildLootBagTypeDefinitions(4); Assert.IsTrue(bagList5[0].Assignee == 0); Assert.IsTrue(bagList5[0].LootBagNumber == 0); Assert.IsTrue(bagList5[0].BagRarity == LootBagRarity.Blue); Assert.IsTrue(bagList5[1].Assignee == 0); Assert.IsTrue(bagList5[1].LootBagNumber == 1); Assert.IsTrue(bagList5[1].BagRarity == LootBagRarity.Green); Assert.IsTrue(bagList5[2].Assignee == 0); Assert.IsTrue(bagList5[2].LootBagNumber == 2); Assert.IsTrue(bagList5[2].BagRarity == LootBagRarity.Green); var bagList7 = def.BuildLootBagTypeDefinitions(12); Assert.IsTrue(bagList7[0].Assignee == 0); Assert.IsTrue(bagList7[0].LootBagNumber == 0); Assert.IsTrue(bagList7[0].BagRarity == LootBagRarity.Gold); Assert.IsTrue(bagList7[1].Assignee == 0); Assert.IsTrue(bagList7[1].LootBagNumber == 1); Assert.IsTrue(bagList7[1].BagRarity == LootBagRarity.Purple); Assert.IsTrue(bagList7[2].Assignee == 0); Assert.IsTrue(bagList7[2].LootBagNumber == 2); Assert.IsTrue(bagList7[2].BagRarity == LootBagRarity.Blue); Assert.IsTrue(bagList7[3].Assignee == 0); Assert.IsTrue(bagList7[3].LootBagNumber == 3); Assert.IsTrue(bagList7[3].BagRarity == LootBagRarity.Blue); Assert.IsTrue(bagList7[4].Assignee == 0); Assert.IsTrue(bagList7[4].LootBagNumber == 4); Assert.IsTrue(bagList7[4].BagRarity == LootBagRarity.Blue); }