public EnemyAttributeFormat(int slotID, BossTable dbData) { this.EnemeyType = ENEMY_TYPE.BOSS; this.SlotID = slotID; this.DBEnemyID = dbData.ID; this.DBNameID = dbData.BossNameID; this.EXPOutput = dbData.EXPOutput; this.AuraOutput = dbData.AuraOutput; this.DimensionChipOutput = dbData.DimensionChipOutput; this.DimensionChipOutputProbability = dbData.DimensionChipOutputProbability; this.Level = dbData.Level; this.HPMax = dbData.HPMax; this.HP = this.HPMax; this.RES = dbData.RES; this.ATK = dbData.ATK; this.MAG = dbData.MAG; this.DEF = dbData.DEF; this.AC = dbData.AC; this.CRI = dbData.CRI; this.PEN = dbData.PEN; this.HIT = dbData.HIT; this.AVD = dbData.AVD; }
public EnemyAnimationFormat(BossTable dbData) { base.TexturePath = dbData.TexturePath; base.IconID = dbData.TextureIconID; base.IdleID = dbData.TextureIdleID; base.AttackID = dbData.TextureAttackID; base.GetDamageID = dbData.TextureGetDamageID; base.DeadID = dbData.TextureDeadID; }
public EnemyDataFormat(int slotID, BossTable dbData, EnemySaveDataFormat enemySaveData = null) { this.Attributes = new EnemyAttributeFormat(slotID, dbData); if (enemySaveData != null) { this.AttributesAggregateBuff = enemySaveData.AttributesAggregateBuff.CloneEx(); } this.AnimationInfo = new EnemyAnimationFormat(dbData); var _skillDataList = BossSkillTableReader.Instance.FindDefaultByMonsterID(dbData.ID); if (_skillDataList != null) { this.SkillList = new List <EnemySkillFormat> (); _skillDataList.ForEach(_skillData => { this.SkillList.Add(new EnemySkillFormat(_skillData)); }); } this.EquipmentList = new List <EnemyEquipmentFormat> (); }
public void InitLocalMySQL() { if (this.Database.CreateIfNotExists()) { EntityGenerator <Items> generatorItems = new EntityGenerator <Items>(); for (int i = 0; i < 60; i++) { ItemsTable.Add(generatorItems.GenerateItem()); } EntityGenerator <Party> generatorParty = new EntityGenerator <Party>(); for (int i = 0; i < 3; i++) { PartyTable.Add(generatorParty.GenerateItem()); } EntityGenerator <Character> generatorPersonnage = new EntityGenerator <Character>(); for (int i = 0; i < 15; i++) { CharacterTable.Add(generatorPersonnage.GenerateItem()); } EntityGenerator <Boss> generatorBoss = new EntityGenerator <Boss>(); for (int i = 0; i < 20; i++) { BossTable.Add(generatorBoss.GenerateItem()); } EntityGenerator <Donjon> generatorDonjon = new EntityGenerator <Donjon>(); for (int i = 0; i < 5; i++) { DonjonTable.Add(generatorDonjon.GenerateItem()); } this.SaveChangesAsync(); } }
///<inheritdoc/> public async Task <uint256> ProcessCounterChainSession(int blockHeight) { //todo this method is doing too much. factor some of this into private methods after we added the counterchainid. this.logger.LogTrace("({0}:'{1}'", nameof(blockHeight), blockHeight); this.logger.LogInformation("Session Registered."); // Check if this has already been done then we just return the transactionId if (this.sessions.TryGetValue(blockHeight, out var counterchainSession)) { // This is the mechanism that tells the round robin not to continue and also // notifies the monitorChain of the completed transactionId from the counterChain transaction. if (counterchainSession.CounterChainTransactionId != uint256.Zero) { // If we get here: // 1. One of the nodes became the boss and successfully broadcast a completed transaction. // 2. The monitor in this node received the block with the transaction (identified by the sessionId in the op_return). // 3. The monitor wrote the CounterChainTransactionId into the counterChainSession to indicate all was done. // This method then does not try to process the transaction and instead signals to the monitorChain that this // transaction already completed by passing back the transactionId. this.logger.LogInformation($"Counterchain Session for block: {blockHeight} was already completed. Doing nothing."); return(counterchainSession.CounterChainTransactionId); } } else { throw new InvalidOperationException($"No CounterChainSession found in the counter chain for block height {blockHeight}."); } // Check if the password has been added. If not, no need to go further. if (this.federationWalletManager.Secret == null || string.IsNullOrEmpty(this.federationWalletManager.Secret.WalletPassword)) { string errorMessage = "The password needed for signing multisig transactions is missing."; this.logger.LogError(errorMessage); throw new WalletException(errorMessage); } var wallet = this.federationWalletManager.GetWallet(); var multiSigAddress = wallet.MultiSigAddress; var recipients = counterchainSession.CrossChainTransactions.Select(s => new Recipient.Recipient { Amount = s.Amount, ScriptPubKey = BitcoinAddress.Create(s.DestinationAddress, this.network).ScriptPubKey }).ToList(); // We are the Boss so first I build the multisig transaction template. var multiSigContext = new TransactionBuildContext(recipients, this.federationWalletManager.Secret.WalletPassword, Encoding.UTF8.GetBytes(blockHeight.ToString())) { TransactionFee = Money.Coins(0.01m), MinConfirmations = 1, Shuffle = true, MultiSig = multiSigAddress, IgnoreVerify = true, Sign = false }; this.logger.LogInformation("Building template Transaction."); var templateTransaction = this.federationWalletTransactionHandler.BuildTransaction(multiSigContext); //add my own partial this.logger.LogInformation("Verify own partial."); var counterChainSession = this.VerifySession(blockHeight, templateTransaction); if (counterChainSession == null) { var exists = this.sessions.TryGetValue(blockHeight, out counterChainSession); if (exists) { return(counterChainSession.CounterChainTransactionId); } throw new InvalidOperationException($"No CounterChainSession found in the counter chain for block height {blockHeight}."); } this.MarkSessionAsSigned(counterChainSession); var partialTransaction = wallet.SignPartialTransaction(templateTransaction, this.federationWalletManager.Secret.WalletPassword); uint256 bossCard = BossTable.MakeBossTableEntry(blockHeight, this.federationGatewaySettings.PublicKey); this.logger.LogInformation("My bossCard: {0}.", bossCard); this.ReceivePartial(blockHeight, partialTransaction, bossCard); //now build the requests for the partials var requestPartialTransactionPayload = new RequestPartialTransactionPayload(templateTransaction, blockHeight); // Only broadcast to the federation members. var federationNetworkPeers = this.connectionManager.ConnectedPeers .Where(p => !p.Inbound && federationGatewaySettings.FederationNodeIpEndPoints.Any(e => this.ipAddressComparer.Equals(e.Address, p.PeerEndPoint.Address))); foreach (INetworkPeer peer in federationNetworkPeers) { try { this.logger.LogInformation("Broadcasting Partial Transaction Request to {0}.", peer.PeerEndPoint); await peer.SendMessageAsync(requestPartialTransactionPayload).ConfigureAwait(false); } catch (OperationCanceledException) { } } this.logger.LogTrace("(-)"); // We don't want to say this is complete yet. We wait until we get the transaction back in a block. return(uint256.Zero); }