public void UpdateV2() { Address avatarAddress = new PrivateKey().ToAddress(); Address agentAddress = new PrivateKey().ToAddress(); var avatarState = GetNewAvatarState(avatarAddress, agentAddress); var result = new CombinationConsumable5.ResultModel() { id = default,
public SellCancellation2Test(ITestOutputHelper outputHelper) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.TestOutput(outputHelper) .CreateLogger(); _initialState = new State(); var sheets = TableSheetsImporter.ImportSheets(); foreach (var(key, value) in sheets) { _initialState = _initialState .SetState(Addresses.TableSheet.Derive(key), value.Serialize()); } var tableSheets = new TableSheets(sheets); var currency = new Currency("NCG", 2, minters: null); var goldCurrencyState = new GoldCurrencyState(currency); _agentAddress = new PrivateKey().ToAddress(); var agentState = new AgentState(_agentAddress); _avatarAddress = new PrivateKey().ToAddress(); var rankingMapAddress = new PrivateKey().ToAddress(); var avatarState = new AvatarState( _avatarAddress, _agentAddress, 0, tableSheets.GetAvatarSheets(), new GameConfigState(), rankingMapAddress) { worldInformation = new WorldInformation( 0, tableSheets.WorldSheet, GameConfig.RequireClearedStageLevel.ActionsInShop), }; agentState.avatarAddresses[0] = _avatarAddress; var equipment = ItemFactory.CreateItemUsable( tableSheets.EquipmentItemSheet.First, Guid.NewGuid(), 0); var shopState = new ShopState(); shopState.Register(new ShopItem( _agentAddress, _avatarAddress, Guid.NewGuid(), new FungibleAssetValue(goldCurrencyState.Currency, 100, 0), equipment)); var result = new CombinationConsumable5.ResultModel() { id = default,
public void Execute(int avatarLevel, int worldId, int stageId, int clearStageId) { Assert.True(_tableSheets.WorldSheet.TryGetValue(worldId, out var worldRow)); Assert.True(stageId >= worldRow.StageBegin); Assert.True(stageId <= worldRow.StageEnd); Assert.True(_tableSheets.StageSheet.TryGetValue(stageId, out _)); var previousAvatarState = _initialState.GetAvatarState(_avatarAddress); previousAvatarState.level = avatarLevel; previousAvatarState.worldInformation = new WorldInformation( 0, _tableSheets.WorldSheet, clearStageId); var costumeId = _tableSheets .CostumeItemSheet .Values .First(r => r.ItemSubType == ItemSubType.FullCostume) .Id; var costume = ItemFactory.CreateItem(_tableSheets.ItemSheet[costumeId], new TestRandom()); previousAvatarState.inventory.AddItem2(costume); var mimisbrunnrSheet = _tableSheets.MimisbrunnrSheet; if (!mimisbrunnrSheet.TryGetValue(stageId, out var mimisbrunnrSheetRow)) { throw new SheetRowNotFoundException("MimisbrunnrSheet", stageId); } var equipments = new List <Guid>(); var equipmentRow = _tableSheets.EquipmentItemSheet.Values.Last(x => x.Id == 10151001); var equipment = ItemFactory.CreateItemUsable(equipmentRow, Guid.NewGuid(), 0); previousAvatarState.inventory.AddItem(equipment); var armorEquipmentRow = _tableSheets.EquipmentItemSheet.Values.Last(x => x.Id == 10251001); var armorEquipment = ItemFactory.CreateItemUsable(armorEquipmentRow, Guid.NewGuid(), 0); previousAvatarState.inventory.AddItem(armorEquipment); var beltEquipment = ItemFactory.CreateItemUsable( _tableSheets.EquipmentItemSheet.Values.Last(x => x.Id == 10351000), Guid.NewGuid(), 0); previousAvatarState.inventory.AddItem(beltEquipment); var necklaceEquipment = ItemFactory.CreateItemUsable( _tableSheets.EquipmentItemSheet.Values.Last(x => x.Id == 10451000), Guid.NewGuid(), 0); previousAvatarState.inventory.AddItem(necklaceEquipment); equipments.Add(equipment.ItemId); equipments.Add(armorEquipment.ItemId); equipments.Add(beltEquipment.ItemId); equipments.Add(necklaceEquipment.ItemId); foreach (var equipmentId in previousAvatarState.inventory.Equipments) { if (previousAvatarState.inventory.TryGetNonFungibleItem(equipmentId, out ItemUsable itemUsable)) { var elementalType = ((Equipment)itemUsable).ElementalType; Assert.True(mimisbrunnrSheetRow.ElementalTypes.Exists(x => x == elementalType)); } } var result = new CombinationConsumable5.ResultModel() { id = default,