private void CreateChosenBoosterNeedMessage(BoosterDefinition boosterDefinition) { EvaluableMessage_LavaboostNeeded evaluableMessage_LavaboostNeeded = null; IEnumerable <EvaluableMessage_LavaboostNeeded> messages = base.AIEntity.AIPlayer.Blackboard.GetMessages <EvaluableMessage_LavaboostNeeded>(BlackboardLayerID.Empire); foreach (EvaluableMessage_LavaboostNeeded evaluableMessage_LavaboostNeeded2 in messages) { if (evaluableMessage_LavaboostNeeded2.State == BlackboardMessage.StateValue.Message_InProgress) { if (evaluableMessage_LavaboostNeeded == null) { evaluableMessage_LavaboostNeeded = evaluableMessage_LavaboostNeeded2; } else { evaluableMessage_LavaboostNeeded2.Cancel(); } } } if (evaluableMessage_LavaboostNeeded == null) { evaluableMessage_LavaboostNeeded = new EvaluableMessage_LavaboostNeeded(1f, 1f, boosterDefinition, AILayer_AccountManager.NoAccountName); base.AIEntity.AIPlayer.Blackboard.AddMessage(evaluableMessage_LavaboostNeeded); } else { evaluableMessage_LavaboostNeeded.Refresh(1f, 1f, boosterDefinition); } }
private void OrderBuyoutAndActivateBooster_TicketRaised(object sender, TicketRaisedEventArgs e) { OrderBuyoutAndActivateBooster orderBuyoutAndActivateBooster = e.Order as OrderBuyoutAndActivateBooster; EvaluableMessage_LavaboostNeeded firstMessage = base.AIEntity.AIPlayer.Blackboard.GetFirstMessage <EvaluableMessage_LavaboostNeeded>(BlackboardLayerID.Empire, (EvaluableMessage_LavaboostNeeded match) => match.EvaluationState == EvaluableMessage.EvaluableMessageState.Pending && match.BoosterDefinition.Name == orderBuyoutAndActivateBooster.BoosterDefinitionName); if (firstMessage != null) { if (e.Result != PostOrderResponse.Processed) { firstMessage.SetFailedToObtain(); return; } firstMessage.SetObtained(); } }