public TradableMaterialTest() { var tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); _materialRow = tableSheets.MaterialItemSheet.First; }
public Buy2Test(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()); } _tableSheets = new TableSheets(sheets); var currency = new Currency("NCG", 2, minters: null); _goldCurrencyState = new GoldCurrencyState(currency); _sellerAgentAddress = new PrivateKey().ToAddress(); var sellerAgentState = new AgentState(_sellerAgentAddress); _sellerAvatarAddress = new PrivateKey().ToAddress(); var rankingMapAddress = new PrivateKey().ToAddress(); var sellerAvatarState = new AvatarState( _sellerAvatarAddress, _sellerAgentAddress, 0, _tableSheets.GetAvatarSheets(), new GameConfigState(), rankingMapAddress) { worldInformation = new WorldInformation( 0, _tableSheets.WorldSheet, GameConfig.RequireClearedStageLevel.ActionsInShop), }; sellerAgentState.avatarAddresses[0] = _sellerAvatarAddress; _buyerAgentAddress = new PrivateKey().ToAddress(); var buyerAgentState = new AgentState(_buyerAgentAddress); _buyerAvatarAddress = new PrivateKey().ToAddress(); _buyerAvatarState = new AvatarState( _buyerAvatarAddress, _buyerAgentAddress, 0, _tableSheets.GetAvatarSheets(), new GameConfigState(), rankingMapAddress) { worldInformation = new WorldInformation( 0, _tableSheets.WorldSheet, GameConfig.RequireClearedStageLevel.ActionsInShop), }; buyerAgentState.avatarAddresses[0] = _buyerAvatarAddress; var equipment = ItemFactory.CreateItemUsable( _tableSheets.EquipmentItemSheet.First, Guid.NewGuid(), 0); var shopState = new ShopState(); shopState.Register(new ShopItem( _sellerAgentAddress, _sellerAvatarAddress, Guid.NewGuid(), new FungibleAssetValue(_goldCurrencyState.Currency, 100, 0), equipment)); var result = new CombinationConsumable5.ResultModel() { id = default,
public SellCancellationTest(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)); _initialState = _initialState .SetState(GoldCurrencyState.Address, goldCurrencyState.Serialize()) .SetState(Addresses.Shop, shopState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.Serialize()); }
public CostumeTest() { _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); }
public RedeemCodeTest() { _sheets = TableSheetsImporter.ImportSheets(); _tableSheets = new TableSheets(_sheets); }
public SimulatorTest() { _materialItemSheet = new MaterialItemSheet(); _materialItemSheet.Set(TableSheetsImporter.ImportSheets()[nameof(MaterialItemSheet)]); _random = new ItemEnhancementTest.TestRandom(); }
public Buy3Test(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()); } _tableSheets = new TableSheets(sheets); var currency = new Currency("NCG", 2, minters: null); _goldCurrencyState = new GoldCurrencyState(currency); _sellerAgentAddress = new PrivateKey().ToAddress(); var sellerAgentState = new AgentState(_sellerAgentAddress); _sellerAvatarAddress = new PrivateKey().ToAddress(); var rankingMapAddress = new PrivateKey().ToAddress(); var sellerAvatarState = new AvatarState( _sellerAvatarAddress, _sellerAgentAddress, 0, _tableSheets.GetAvatarSheets(), new GameConfigState(), rankingMapAddress) { worldInformation = new WorldInformation( 0, _tableSheets.WorldSheet, GameConfig.RequireClearedStageLevel.ActionsInShop), }; sellerAgentState.avatarAddresses[0] = _sellerAvatarAddress; _buyerAgentAddress = new PrivateKey().ToAddress(); var buyerAgentState = new AgentState(_buyerAgentAddress); _buyerAvatarAddress = new PrivateKey().ToAddress(); _buyerAvatarState = new AvatarState( _buyerAvatarAddress, _buyerAgentAddress, 0, _tableSheets.GetAvatarSheets(), new GameConfigState(), rankingMapAddress) { worldInformation = new WorldInformation( 0, _tableSheets.WorldSheet, GameConfig.RequireClearedStageLevel.ActionsInShop), }; buyerAgentState.avatarAddresses[0] = _buyerAvatarAddress; var equipment = ItemFactory.CreateItemUsable( _tableSheets.EquipmentItemSheet.First, Guid.NewGuid(), 0); var consumable = ItemFactory.CreateItemUsable( _tableSheets.ConsumableItemSheet.First, Guid.NewGuid(), 0); var costume = ItemFactory.CreateCostume( _tableSheets.CostumeItemSheet.First, Guid.NewGuid()); var shopState = new ShopState(); shopState.Register(new ShopItem( _sellerAgentAddress, _sellerAvatarAddress, Guid.NewGuid(), new FungibleAssetValue(_goldCurrencyState.Currency, ProductPrice, 0), equipment)); shopState.Register(new ShopItem( _sellerAgentAddress, _sellerAvatarAddress, Guid.NewGuid(), new FungibleAssetValue(_goldCurrencyState.Currency, ProductPrice, 0), consumable)); shopState.Register(new ShopItem( _sellerAgentAddress, _sellerAvatarAddress, Guid.NewGuid(), new FungibleAssetValue(_goldCurrencyState.Currency, ProductPrice, 0), costume)); _initialState = _initialState .SetState(GoldCurrencyState.Address, _goldCurrencyState.Serialize()) .SetState(Addresses.Shop, shopState.Serialize()) .SetState(_sellerAgentAddress, sellerAgentState.Serialize()) .SetState(_sellerAvatarAddress, sellerAvatarState.Serialize()) .SetState(_buyerAgentAddress, buyerAgentState.Serialize()) .SetState(_buyerAvatarAddress, _buyerAvatarState.Serialize()) .MintAsset(_buyerAgentAddress, shopState.Products .Select(pair => pair.Value.Price) .Aggregate((totalPrice, next) => totalPrice + next)); }
public EquipmentTest() { var tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); _equipmentRow = tableSheets.EquipmentItemSheet.First; }
public CreateAvatar2Test() { _agentAddress = default; _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); }
public MonsterCollectionState0Test() { _address = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7"); _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); }
public CostumeTest() { var tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); _costumeRow = tableSheets.CostumeItemSheet.First; }
public SkillsTest() { _skillSheet = new SkillSheet(); _skillSheet.Set(TableSheetsImporter.ImportSheets()[nameof(SkillSheet)]); _random = new TestRandom(); }
public ItemGradeQuestTest() { _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); }
public static MakeInitialStateResult MakeInitialState() { var goldCurrencyState = new GoldCurrencyState(new Currency("NCG", 2, minter: null)); var ranking = new RankingState1(); for (var i = 0; i < RankingState1.RankingMapCapacity; i++) { ranking.RankingMap[RankingState1.Derive(i)] = new HashSet <Address>().ToImmutableHashSet(); } var sheets = TableSheetsImporter.ImportSheets(); var weeklyArenaAddress = WeeklyArenaState.DeriveAddress(0); var initialState = new Tests.Action.State() .SetState(GoldCurrencyState.Address, goldCurrencyState.Serialize()) .SetState( Addresses.GoldDistribution, GoldDistributionTest.Fixture.Select(v => v.Serialize()).Serialize() ) .SetState( Addresses.GameConfig, new GameConfigState(sheets[nameof(GameConfigSheet)]).Serialize() ) .SetState(Addresses.Ranking, ranking.Serialize()) .SetState(weeklyArenaAddress, new WeeklyArenaState(0).Serialize()); foreach (var(key, value) in sheets) { initialState = initialState.SetState(Addresses.TableSheet.Derive(key), value.Serialize()); } var tableSheets = new TableSheets(sheets); var rankingMapAddress = new PrivateKey().ToAddress(); var agentAddress = new PrivateKey().ToAddress(); var agentState = new AgentState(agentAddress); var avatarAddress = 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 initCurrencyGold = goldCurrencyState.Currency * 100000000000; var agentCurrencyGold = goldCurrencyState.Currency * 1000; var remainCurrencyGold = initCurrencyGold - agentCurrencyGold; initialState = initialState .SetState(GoldCurrencyState.Address, goldCurrencyState.Serialize()) .SetState(agentAddress, agentState.Serialize()) .SetState(avatarAddress, avatarState.Serialize()) .SetState(Addresses.Shop, new ShopState().Serialize()) .MintAsset(GoldCurrencyState.Address, initCurrencyGold) .TransferAsset(Addresses.GoldCurrency, agentAddress, agentCurrencyGold); var action = new CreateTestbed { weeklyArenaAddress = weeklyArenaAddress, }; var nextState = action.Execute(new ActionContext() { BlockIndex = 0, PreviousStates = initialState, Random = new TestRandom(), Rehearsal = false, }); return(new MakeInitialStateResult( nextState, action, agentState, avatarState, goldCurrencyState, rankingMapAddress, tableSheets, remainCurrencyGold, agentCurrencyGold)); }
public CombinationAndRapidCombinationTest(ITestOutputHelper outputHelper) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.TestOutput(outputHelper) .CreateLogger(); var sheets = TableSheetsImporter.ImportSheets(); _tableSheets = new TableSheets(sheets); var gold = new GoldCurrencyState(new Currency("NCG", 2, minter: null)); var gameConfigState = new GameConfigState(sheets[nameof(GameConfigSheet)]); _agentAddress = new PrivateKey().ToAddress(); _avatarAddress = _agentAddress.Derive("avatar"); _slot0Address = _avatarAddress.Derive( string.Format( CultureInfo.InvariantCulture, CombinationSlotState.DeriveFormat, 0 ) ); var slot0State = new CombinationSlotState( _slot0Address, GameConfig.RequireClearedStageLevel.CombinationEquipmentAction); var agentState = new AgentState(_agentAddress); agentState.avatarAddresses[0] = _avatarAddress; var avatarState = new AvatarState( _avatarAddress, _agentAddress, 1, _tableSheets.GetAvatarSheets(), gameConfigState, default ) { worldInformation = new WorldInformation( 0, _tableSheets.WorldSheet, GameConfig.RequireClearedStageLevel.CombinationEquipmentAction), }; _inventoryAddress = _avatarAddress.Derive(LegacyInventoryKey); _worldInformationAddress = _avatarAddress.Derive(LegacyWorldInformationKey); _questListAddress = _avatarAddress.Derive(LegacyQuestListKey); _initialState = new Tests.Action.State() .SetState(GoldCurrencyState.Address, gold.Serialize()) .SetState(gameConfigState.address, gameConfigState.Serialize()) .SetState(_agentAddress, agentState.Serialize()) .SetState(_avatarAddress, avatarState.SerializeV2()) .SetState(_inventoryAddress, avatarState.inventory.Serialize()) .SetState(_worldInformationAddress, avatarState.worldInformation.Serialize()) .SetState(_questListAddress, avatarState.questList.Serialize()) .SetState(_slot0Address, slot0State.Serialize()); foreach (var(key, value) in sheets) { _initialState = _initialState .SetState(Addresses.TableSheet.Derive(key), value.Serialize()); } }
public StageSimulatorTest() { _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); _random = new TestRandom(); _avatarState = new AvatarState(
public AvatarStateTest() { var sheets = TableSheetsImporter.ImportSheets(); _tableSheets = new TableSheets(sheets); }
public RankingSimulatorTest() { _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); _random = new TestRandom(); }
public WeeklyArenaStateUpdateScenarioTest() { _initialState = new Tests.Action.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 rankingMapAddress = new PrivateKey().ToAddress(); _agent1Address = new PrivateKey().ToAddress(); _avatar1Address = new PrivateKey().ToAddress(); var agentState = new AgentState(_agent1Address); var avatarState = new AvatarState( _avatar1Address, _agent1Address, 0, tableSheets.GetAvatarSheets(), new GameConfigState(sheets[nameof(GameConfigSheet)]), rankingMapAddress ) { worldInformation = new WorldInformation( 0, tableSheets.WorldSheet, Math.Max( tableSheets.StageSheet.First?.Id ?? 1, GameConfig.RequireClearedStageLevel.ActionsInRankingBoard)), level = 100, }; agentState.avatarAddresses.Add(0, _avatar1Address); var agent2Address = new PrivateKey().ToAddress(); _avatar2Address = new PrivateKey().ToAddress(); var agent2State = new AgentState(agent2Address); var avatar2State = new AvatarState( _avatar2Address, agent2Address, 0, tableSheets.GetAvatarSheets(), new GameConfigState(sheets[nameof(GameConfigSheet)]), rankingMapAddress ) { worldInformation = new WorldInformation( 0, tableSheets.WorldSheet, Math.Max( tableSheets.StageSheet.First?.Id ?? 1, GameConfig.RequireClearedStageLevel.ActionsInRankingBoard)), level = 100, }; agent2State.avatarAddresses.Add(0, _avatar2Address); var agent3Address = new PrivateKey().ToAddress(); _avatar3Address = new PrivateKey().ToAddress(); var agent3State = new AgentState(agent3Address); var avatar3State = new AvatarState( _avatar3Address, agent2Address, 0, tableSheets.GetAvatarSheets(), new GameConfigState(sheets[nameof(GameConfigSheet)]), rankingMapAddress ) { worldInformation = new WorldInformation( 0, tableSheets.WorldSheet, Math.Max( tableSheets.StageSheet.First?.Id ?? 1, GameConfig.RequireClearedStageLevel.ActionsInRankingBoard)), level = 100, }; agent3State.avatarAddresses.Add(0, _avatar3Address); var prevWeeklyArenaState = new WeeklyArenaState(RankingBattle.UpdateTargetWeeklyArenaIndex - 2); var weeklyArenaState = new WeeklyArenaState(RankingBattle.UpdateTargetWeeklyArenaIndex - 1); weeklyArenaState.SetV2(avatarState, tableSheets.CharacterSheet, tableSheets.CostumeStatSheet); weeklyArenaState[_avatar1Address].Activate(); weeklyArenaState.SetV2(avatar2State, tableSheets.CharacterSheet, tableSheets.CostumeStatSheet); weeklyArenaState[_avatar2Address].Activate(); _weeklyArenaAddress = WeeklyArenaState.DeriveAddress(RankingBattle.UpdateTargetWeeklyArenaIndex); var gold = new GoldCurrencyState(new Currency("NCG", 2, minter: null)); _initialState = _initialState .SetState(_agent1Address, agentState.Serialize()) .SetState(_avatar1Address, avatarState.Serialize()) .SetState(agent2Address, agent2State.Serialize()) .SetState(_avatar2Address, avatar2State.Serialize()) .SetState(agent3Address, agent2State.Serialize()) .SetState(_avatar3Address, avatar2State.Serialize()) .SetState(Addresses.GameConfig, new GameConfigState(sheets[nameof(GameConfigSheet)]).Serialize()) .SetState(prevWeeklyArenaState.address, prevWeeklyArenaState.Serialize()) .SetState(weeklyArenaState.address, weeklyArenaState.Serialize()) .SetState(_weeklyArenaAddress, new WeeklyArenaState(RankingBattle.UpdateTargetWeeklyArenaIndex).Serialize()) .SetState(GoldCurrencyState.Address, gold.Serialize()) .SetState(Addresses.GoldDistribution, GoldDistributionTest.Fixture.Select(v => v.Serialize()).Serialize()) .MintAsset(GoldCurrencyState.Address, gold.Currency * 100000000000); }
public ConsumableTest() { _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); }
public BattleLogTest() { _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); _random = new TestRandom(); }
public QuestListTest() { _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); }
public PlayerTest() { _random = new TestRandom(); _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); _avatarState = new AvatarState(
public MonsterCollectMailTest() { _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); }
public Buy7Test(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()); } _tableSheets = new TableSheets(sheets); var currency = new Currency("NCG", 2, minters: null); _goldCurrencyState = new GoldCurrencyState(currency); _sellerAgentAddress = new PrivateKey().ToAddress(); var sellerAgentState = new AgentState(_sellerAgentAddress); _sellerAvatarAddress = new PrivateKey().ToAddress(); var rankingMapAddress = new PrivateKey().ToAddress(); var sellerAvatarState = new AvatarState( _sellerAvatarAddress, _sellerAgentAddress, 0, _tableSheets.GetAvatarSheets(), new GameConfigState(), rankingMapAddress) { worldInformation = new WorldInformation( 0, _tableSheets.WorldSheet, GameConfig.RequireClearedStageLevel.ActionsInShop), }; sellerAgentState.avatarAddresses[0] = _sellerAvatarAddress; _buyerAgentAddress = new PrivateKey().ToAddress(); var buyerAgentState = new AgentState(_buyerAgentAddress); _buyerAvatarAddress = new PrivateKey().ToAddress(); _buyerAvatarState = new AvatarState( _buyerAvatarAddress, _buyerAgentAddress, 0, _tableSheets.GetAvatarSheets(), new GameConfigState(), rankingMapAddress) { worldInformation = new WorldInformation( 0, _tableSheets.WorldSheet, GameConfig.RequireClearedStageLevel.ActionsInShop), }; buyerAgentState.avatarAddresses[0] = _buyerAvatarAddress; _productId = new Guid("6d460c1a-755d-48e4-ad67-65d5f519dbc8"); _initialState = _initialState .SetState(GoldCurrencyState.Address, _goldCurrencyState.Serialize()) .SetState(_sellerAgentAddress, sellerAgentState.Serialize()) .SetState(_sellerAvatarAddress, sellerAvatarState.Serialize()) .SetState(_buyerAgentAddress, buyerAgentState.Serialize()) .SetState(_buyerAvatarAddress, _buyerAvatarState.Serialize()) .SetState(Addresses.Shop, new ShopState().Serialize()) .MintAsset(_buyerAgentAddress, _goldCurrencyState.Currency * 100); }
public CreateAvatarTest() { _agentAddress = default; _avatarAddress = _agentAddress.Derive("avatar"); _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); }
public StandaloneQueryTest(ITestOutputHelper output) : base(output) { var fixturePath = Path.Combine("..", "..", "..", "..", "Lib9c", ".Lib9c.Tests", "Data", "TableCSV"); _sheets = TableSheetsImporter.ImportSheets(fixturePath); }
public InitializeStatesTest() { _sheets = TableSheetsImporter.ImportSheets(); }
public ChargeActionPointTest() { _sheets = TableSheetsImporter.ImportSheets(); _tableSheets = new TableSheets(_sheets); }
public RankingMapStateTest() { _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets()); _agentAddress = default(Address); _rankingMapAddress = _agentAddress.Derive("ranking_map"); }