Ejemplo n.º 1
0
        private static RootCommand BuildRootCommand()
        {
            var cmd          = new RootCommand();
            var kafkaService = new KafkaService();
            var copyCommand  = new CopyCommand(kafkaService);

            cmd.AddCommand(copyCommand);

            var consumeCommand = new ConsumeCommand(kafkaService);

            cmd.AddCommand(consumeCommand);

            return(cmd);
        }
Ejemplo n.º 2
0
        public override void DoAction(Command p_command)
        {
            ConsumeCommand           consumeCommand           = (ConsumeCommand)p_command;
            Consumable               consumable               = (Consumable)consumeCommand.Slot.GetItem();
            Character                member                   = LegacyLogic.Instance.WorldManager.Party.GetMember(consumeCommand.TargetCharacter);
            PartyInventoryController partyInventoryController = (PartyInventoryController)consumeCommand.Slot.Inventory;

            if (consumable is Potion)
            {
                Potion p_potion = (Potion)consumable;
                member.UsePotion(p_potion);
                partyInventoryController.ConsumeSuccess(consumeCommand.Slot.Slot);
            }
            else if (consumable is Scroll)
            {
                Scroll p_scroll = (Scroll)consumable;
                m_consumeType = EConsumeType.NONE;
                Character.UseScroll(p_scroll);
            }
        }
Ejemplo n.º 3
0
        public ProducerConsumer()
        {
            Consummer = new Shell()
            {
                StatusExecutable = true
            };
            Consummer2 = new Shell()
            {
                StatusExecutable = true
            };
            QueueShell = new Shell()
            {
                StatusExecutable = true
            };
            ProducerShell = new Shell()
            {
                StatusExecutable = true
            };
            ProducerShell2 = new Shell()
            {
                StatusExecutable = true
            };
            List <IShell> shellList = new List <IShell>();

            shellList.Add(Consummer);
            shellList.Add(Consummer2);
            shellList.Add(ProducerShell);
            shellList.Add(ProducerShell2);
            ProduceCommand2 = new ProduceCommand(ProducerShell2, QueueShell);
            ProduceCommand  = new ProduceCommand(ProducerShell, QueueShell);
            ConsumeCommand  = new ConsumeCommand(Consummer, QueueShell);
            ConsumeCommand2 = new ConsumeCommand(Consummer2, QueueShell);
            QueueCommand    = new QueueCommandG <string>(QueueShell);
            StopCommand     = new StopCommand(QueueShell, shellList);

            StopProduce   = new StopTask(ProducerShell);
            StopProduce2  = new StopTask(ProducerShell2);
            StopConsumer1 = new StopTask(Consummer);
            StopConsumer2 = new StopTask(Consummer2);
        }
Ejemplo n.º 4
0
        public override Boolean CanDoAction(Command p_command)
        {
            ConsumeCommand consumeCommand = (ConsumeCommand)p_command;
            Consumable     consumable     = (Consumable)consumeCommand.Slot.GetItem();
            Character      member         = LegacyLogic.Instance.WorldManager.Party.GetMember(consumeCommand.TargetCharacter);

            if (consumable is Potion)
            {
                Potion potion = (Potion)consumable;
                switch (potion.Target)
                {
                case EPotionTarget.HP:
                    return(member.HealthPoints < member.MaximumHealthPoints);

                case EPotionTarget.MANA:
                    return(member.ManaPoints < member.MaximumManaPoints);

                case EPotionTarget.MANA_AND_HP:
                    return(member.HealthPoints < member.MaximumHealthPoints || member.ManaPoints < member.MaximumManaPoints);

                case EPotionTarget.CONDITION_CONFUSED:
                    return(member.ConditionHandler.HasCondition(ECondition.CONFUSED));

                case EPotionTarget.CONDITION_POISONED:
                    return(member.ConditionHandler.HasCondition(ECondition.POISONED));

                case EPotionTarget.CONDITION_WEAK:
                    return(member.ConditionHandler.HasCondition(ECondition.WEAK));
                }
                if (potion.PotionType == EPotionType.ELIXIR || potion.PotionType == EPotionType.DROPPABLE_ELIXIR)
                {
                    return(true);
                }
            }
            else if (consumable is Scroll)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 5
0
        public Customer()
        {
            // MyCommand = new CustomerCommand(ExcuteMethod, CanExecuteMethod);
            Consummer = new Shell()
            {
                StatusExecutable = true
            };
            Consummer2 = new Shell()
            {
                StatusExecutable = true
            };
            QueueShell = new Shell()
            {
                StatusExecutable = true
            };
            ProducerShell = new Shell()
            {
                StatusExecutable = true
            };
            ProducerShell2 = new Shell()
            {
                StatusExecutable = true
            };
            OpenCommand = new OpenCommand(ProducerShell);

            ProduceCommand2 = new ProduceCommand(ProducerShell2, QueueShell);
            ProduceCommand  = new ProduceCommand(ProducerShell, QueueShell);
            ConsumeCommand  = new ConsumeCommand(Consummer, QueueShell);
            ConsumeCommand2 = new ConsumeCommand(Consummer2, QueueShell);
            QueueCommand    = new QueueCommandG <string>(QueueShell);
            StopCommand     = new StopCommand(QueueShell);

            StopProduce   = new StopTask(ProducerShell);
            StopProduce2  = new StopTask(ProducerShell2);
            StopConsumer1 = new StopTask(Consummer);
            StopConsumer2 = new StopTask(Consummer2);
        }
Ejemplo n.º 6
0
        public override void Consume(InventorySlotRef p_slot, Int32 p_targetCharacter)
        {
            ConsumeCommand p_command = new ConsumeCommand(p_slot, p_targetCharacter);

            LegacyLogic.Instance.CommandManager.AddCommand(p_command);
        }