예제 #1
0
        public EnemyPlayerDigestTest()
        {
            _tableSheets = new TableSheets(TableSheetsImporter.ImportSheets());
            var avatarState = new AvatarState(
                new PrivateKey().ToAddress(),
                new PrivateKey().ToAddress(),
                1234,
                _tableSheets.GetAvatarSheets(),
                new GameConfigState(),
                new PrivateKey().ToAddress(),
                "test"
                );

            avatarState.hair = 2;
            avatarState.lens = 3;
            avatarState.ear  = 4;
            avatarState.tail = 5;

            var costumeRow = _tableSheets.CostumeStatSheet.Values.First(r => r.StatType == StatType.ATK);
            var costume    = (Costume)ItemFactory.CreateItem(_tableSheets.ItemSheet[costumeRow.CostumeId], new TestRandom());

            costume.equipped = true;
            avatarState.inventory.AddItem(costume);

            var costume2Row = _tableSheets.CostumeStatSheet.Values.First(r => r.StatType == StatType.DEF);
            var costume2    = (Costume)ItemFactory.CreateItem(_tableSheets.ItemSheet[costume2Row.CostumeId], new TestRandom());

            avatarState.inventory.AddItem(costume2);

            var weaponRow = _tableSheets.EquipmentItemSheet.Values.First(r => r.ItemSubType == ItemSubType.Weapon);
            var weapon    = (Weapon)ItemFactory.CreateItem(_tableSheets.ItemSheet[weaponRow.Id], new TestRandom());

            weapon.equipped = true;
            avatarState.inventory.AddItem(weapon);

            var armorRow =
                _tableSheets.EquipmentItemSheet.Values.First(
                    r => r.ItemSubType == ItemSubType.Armor);
            var armor = (Armor)ItemFactory.CreateItem(_tableSheets.ItemSheet[armorRow.Id], new TestRandom());

            avatarState.inventory.AddItem(armor);
            _avatarState = avatarState;
        }
예제 #2
0
        private Block<PolymorphicAction<ActionBase>> MakeGenesisBlock(
            Address adminAddress,
            IImmutableSet<Address> activatedAddresses,
            AuthorizedMinersState authorizedMinersState = null,
            DateTimeOffset? timestamp = null,
            PendingActivationState[] pendingActivations = null
        )
        {
            if (pendingActivations is null)
            {
                var nonce = new byte[] { 0x00, 0x01, 0x02, 0x03 };
                var privateKey = new PrivateKey();
                (ActivationKey activationKey, PendingActivationState pendingActivation) =
                    ActivationKey.Create(privateKey, nonce);
                pendingActivations = new[] { pendingActivation };
            }

            return BlockChain<PolymorphicAction<ActionBase>>.MakeGenesisBlock(
                    new PolymorphicAction<ActionBase>[]
                    {
                        new InitializeStates(
                            rankingState: new RankingState(),
                            shopState: new ShopState(),
                            tableSheets: TableSheetsImporter.ImportSheets(),
                            gameConfigState: new GameConfigState(),
                            redeemCodeState: new RedeemCodeState(Dictionary.Empty
                                .Add("address", RedeemCodeState.Address.Serialize())
                                .Add("map", Dictionary.Empty)
                            ),
                            adminAddressState: new AdminState(adminAddress, 1500000),
                            activatedAccountsState: new ActivatedAccountsState(activatedAddresses),
                            goldCurrencyState: new GoldCurrencyState(
                                new Currency("NCG", 2, minter: null)
                            ),
                            goldDistributions: new GoldDistribution[0],
                            pendingActivationStates: pendingActivations,
                            authorizedMinersState: authorizedMinersState
                        ),
                    },
                    timestamp: timestamp ?? DateTimeOffset.MinValue
                );
        }