Beispiel #1
0
        private async void YesButton_Click(object sender, RoutedEventArgs e)
        {
            DbStatus status = await doctorService.Delete(Mapping.Mapper.Map <Doctor>(doctorViewModel));

            OperationStatus = StatusHandler.Handle(OperationType.Delete, status);
            Close();
        }
Beispiel #2
0
 private void Defend()
 {
     FortifyTarget(ref CharacterParty[ActiveCharacter].DefenceBuffList,
                   Defence.OneTurn(CharacterParty[ActiveCharacter].CurrentDefence));
     StatusHandler.Add(ref CharacterParty[ActiveCharacter].StatusList, new Status(StatusType.DefenceUp, 1));
     AdvanceTurn();
 }
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (!AreSamePasswords())
            {
                FieldValidation.WriteMessage(ErrorLabel, language.PasswordsDontMatch);
                return;
            }
            if (IsValidForm())
            {
                LocalAccount localAccount = new LocalAccount()
                {
                    IdLocalAccount = localAccountViewModel.IdLocalAccount,
                    FullName       = FullNameBox.Text,
                    Email          = EmailBox.Text,
                    PasswordHash   = PasswordBox.Password,
                };
                ObservableCollection <RoleViewModel> roles = RolesComboBox.SelectedItems as ObservableCollection <RoleViewModel>;
                localAccount.SetRoles(roles.Select(x => Mapping.Mapper.Map <Role>(x)).ToList());
                DbStatus status = await localAccountService.Update(localAccount);

                OperationStatus = StatusHandler.Handle(OperationType.Edit, status);
                Close();
            }
            else
            {
                FieldValidation.WriteMessage(ErrorLabel, language.SelectValues);
            }
        }
            public void Initialize(Actor actor)
            {
                Actor     = actor;
                HealthBar = transform.Find("HealthBar").GetComponent <HealthBar>();
                if (HealthBar == null)
                {
                    throw new UnityException("Please verify the structure of the ActorPortrait: HealthBar is missing.");
                }
                HealthBar.Initialize(actor);

                FoodBar = transform.Find("FoodBar").GetComponent <FoodBar>();
                if (FoodBar == null)
                {
                    throw new UnityException("Please verify the structure of the ActorPortrait: FoodBar is missing.");
                }
                FoodBar.Initialize(actor);

                StatusHandler = transform.Find("StatusesHandler").GetComponent <StatusHandler>();
                if (StatusHandler == null)
                {
                    throw new UnityException("Please verify the structure of the ActorPortrait: StatusesHandler is missing.");
                }
                StatusHandler.Initialize(actor.Guid);

                Selection = transform.Find("Selection").gameObject;
                if (Selection == null)
                {
                    throw new UnityException("Please verify the structure of the ActorPortrait: Selection is missing.");
                }
                Selection.SetActive(false);
                actor.OnSelectionEvent += EnableSelection;
            }
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (FormIsValid())
            {
                MedicalRecord medicalRecord = new MedicalRecord()
                {
                    IdMedicalRecord   = medicalRecordViewModel.IdMedicalRecord,
                    Name              = FirstNameBox.Text,
                    LastName          = LastNameBox.Text,
                    BirthDate         = BirthDatePicker.SelectedDate.Value,
                    BirthPlace        = BirthPlaceBox.Text,
                    FathersFullName   = FathersNameBox.Text,
                    MothersFullName   = MothersNameBox.Text,
                    FathersProfession = FathersProfessionBox.Text,
                    MothersProfession = MothersProfessionBox.Text,
                    Gender            = (sbyte)(MaleCheckBox.IsChecked.Value ? 0 : 1),
                    MarriageStatus    = (sbyte)(MarriedCheckBox.IsChecked.Value ? 0 : 1),
                    Jmb             = UNBBox.Text,
                    InsuranceNumber = InsuranceNumberBox.Text,
                    IdResidence     = ((PlaceViewModel)ResidancePlaceComboBox.SelectedItem).IdPlace
                };
                DbStatus status = await medicalRecordService.Update(medicalRecord);

                OperationStatus = StatusHandler.Handle(OperationType.Edit, status);
                Close();
            }
            else
            {
                FieldValidation.WriteMessage(ErrorLabel, language.SelectValues);
            }
        }
Beispiel #6
0
        public override void Cast(SkillCast skillCast)
        {
            int spiritCost  = skillCast.GetSpCost();
            int staminaCost = skillCast.GetStaCost();

            if (Value.Stats[StatId.Spirit].Total < spiritCost || Value.Stats[StatId.Stamina].Total < staminaCost)
            {
                return;
            }

            SkillCast = skillCast;

            ConsumeSp(spiritCost);
            ConsumeStamina(staminaCost);
            Value.Session.SendNotice(skillCast.SkillId.ToString());

            // TODO: Move this and all others combat cases like recover sp to its own class.
            // Since the cast is always sent by the skill, we have to check buffs even when not doing damage.
            if (skillCast.IsBuffToOwner() || skillCast.IsBuffToEntity() || skillCast.IsBuffShield() || skillCast.IsDebuffToOwner())
            {
                Status status = new(skillCast, ObjectId, ObjectId, 1);
                StatusHandler.Handle(Value.Session, status);
            }

            Value.Session.FieldManager.BroadcastPacket(SkillUsePacket.SkillUse(skillCast));
            Value.Session.Send(StatPacket.SetStats(this));

            StartCombatStance();
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            Timer timer = new Timer();

            timer.Interval = 5000;
            timer.Elapsed += (sender, eventArgs) =>
            {
                IServiceRepository        serviceRepository = new ServiceRepository();
                List <IObservableService> servicesFromDb    = serviceRepository.GetServices();

                //create statushandler for each elm in db
                foreach (var service in servicesFromDb)
                {
                    IStatusHandler handler = new StatusHandler(service);

                    //run getstatus as individual tasks
                    Task.Factory.StartNew(async() =>
                    {
                        //return status to console
                        Console.WriteLine(DateTime.Now.ToLongTimeString() + " - Status from " + service.Url + ": " +
                                          await handler.GetStatus());
                    });
                }
            };

            timer.Start();

            Console.ReadLine();
        }
Beispiel #8
0
            public void Initialize(Status status, StatusHandler statusHandler)
            {
                _status = status;
                switch (status.StatusEffectData.StatusEffectCategory)
                {
                case StatusEffectCategory.NEUTRAL:
                    _background.color = Color.black;
                    break;

                case StatusEffectCategory.HARMFUL:
                    _background.color = Color.red;
                    break;

                case StatusEffectCategory.BENEFICIAL:
                    _background.color = Color.green;
                    break;

                default:
                    _background.color = Color.white;
                    break;
                }
                UpdateStack(status.Stack);
                if (status.StatusEffectData.Temporary == true)
                {
                    UpdateDuration(status.Duration);
                }
                _image.sprite = status.StatusEffectData.Sprite;
                _image.rectTransform.sizeDelta = statusHandler.GridLayoutGroup.cellSize;
            }
Beispiel #9
0
 void Update()
 {
     if (DeadTeamCheck() == 0)
     {
         ShortenSelectDelay();
         if (AttackingTeam)
         {
             if (!DeadCheck() && !StatusHandler.Check(ref CharacterParty[ActiveCharacter].StatusList, StatusType.Sleep))
             {
                 PartyTurn();
             }
         }
         else
         {
             if (!DeadCheck() && !StatusHandler.Check(ref EnemyParty[ActiveEnemy].StatusList, StatusType.Sleep))
             {
                 EnemyTurn();
             }
         }
         TextDisplays[0].UpdatePlayerDisplay(CharacterParty[ActiveCharacter]);
         TextDisplays[1].UpdateEnemyDisplay(EnemyParty[ActiveEnemy]);
         DetailDisplayUpdate();
     }
     else if (DeadTeamCheck() == 1) //player team wins
     {
         BattleVictory();
     }
     else //player team loses
     {
         BattleDefeat();
     }
 }
Beispiel #10
0
 private void HealFriend()
 {
     //casts can't revive party members, certain items can, however
     if (CharacterParty[FriendlyTarget].CurrentHealth == 0)
     {
         //attempting to cast on a dead party member does nothing.
         //this space here is in preparation for the ITEM menu
     }
     else
     {
         if (OptionID == 2) //cast
         {
             if (CharacterParty[ActiveCharacter].Commands[CastID].CastType == CastType.Heal)
             {
                 CastCooldown(ref CharacterParty[ActiveCharacter].Commands[CastID]);
                 HealTarget(ref CharacterParty[FriendlyTarget].CurrentHealth, CharacterMaxHealth(FriendlyTarget), CharacterParty[ActiveCharacter].Commands[CastID].CastValue);
                 StatusHandler.Add(ref CharacterParty[FriendlyTarget].StatusList, CharacterParty[ActiveCharacter].Commands[CastID].Status);
                 CharacterParty[FriendlyTarget].ValueUpdate();
                 CharacterParty[ActiveCharacter].HealthLimit();
                 ModeBarUpdate();
                 AdvanceTurn();
             }
             else if (CharacterParty[ActiveCharacter].Commands[CastID].CastType == CastType.Fortify)
             {
                 CastCooldown(ref CharacterParty[ActiveCharacter].Commands[CastID]);
                 FortifyTarget(ref CharacterParty[FriendlyTarget].DefenceBuffList, new Defence(CharacterParty[ActiveCharacter].Commands[CastID].CastValue, CharacterParty[ActiveCharacter].Commands[CastID].Status.StatusDuration));
                 StatusHandler.Add(ref CharacterParty[FriendlyTarget].StatusList, CharacterParty[ActiveCharacter].Commands[CastID].Status);
                 CharacterParty[FriendlyTarget].ValueUpdate();
                 AdvanceTurn();
             }
         }
     }
 }
Beispiel #11
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (FormIsValid())
            {
                Place place = new Place()
                {
                    Name                     = NameBox.Text,
                    CountryName              = CountryNameBox.Text,
                    PostalCode               = PostalCodeBox.Text,
                    FoodQuality              = (int)FoodQualityComboBox.SelectedItem,
                    AirQuality               = (int)AirQualityComboBox.SelectedItem,
                    DrinkingWaterQuality     = (int)DrinkingWaterComboBox.SelectedItem,
                    RecreationalWaterQuality = (int)RecreationalWaterComboBox.SelectedItem,
                    TerrainQuality           = (int)TerrainQualityComboBox.SelectedItem,
                    InlandWaterQuality       = (int)InlandWaterQualityComboBox.SelectedItem,
                    MedicalVasteInformation  = (int)MedicalVasteComboBox.SelectedItem,
                    NoiseInformation         = (int)NoiseInformationComboBox.SelectedItem,
                    Radiation                = (int)RadiationComboBox.SelectedItem
                };
                DbStatus status = await placeService.Add(place);

                OperationStatus = StatusHandler.Handle(OperationType.Create, status);
                Close();
            }
            else
            {
                FieldValidation.WriteMessage(ErrorLabel, language.SelectValues);
            }
        }
        private async void YesButton_Click(object sender, RoutedEventArgs e)
        {
            DbStatus status = await medicalTitleService.Delete(Mapping.Mapper.Map <MedicalTitle>(medicalTitle));

            OperationStatus = StatusHandler.Handle(OperationType.Delete, status);
            Close();
        }
Beispiel #13
0
        /// <summary>
        /// Find the next DriveCommand to be issued to ROCKS.
        /// </summary>
        /// <returns>DriveCommand - the next drive command for ROCKS to execute.</returns>
        public DriveCommand FindNextDriveCommand()
        {
            TennisBall ball = this.camera.GetBallCopy();

            // If verified to be within required distance, send success to ROCKS and halt
            if (this.isWithinRequiredDistance)
            {
                // Send success back to base station until receive ACK
                StatusHandler.SendSimpleAIPacket(Status.AIS_FOUND_GATE);
                Console.WriteLine("Within required distance - halting ");

                return(DriveCommand.Straight(Speed.HALT));
            }

            // Recently detected ball but now don't now. Stop driving to redetect since we may have dropped it due to bouncing.
            if (ball == null && DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() < this.camera.BallTimestamp + DROP_BALL_DELAY)
            {
                StatusHandler.SendSimpleAIPacket(Status.AIS_DROP_BALL);
                Console.WriteLine("Dropped ball - halting ");

                this.verificationQueue.Clear();
                return(DriveCommand.Straight(Speed.HALT));
            }

            // Ball detected
            if (ball != null)
            {
                return(DriveBallDetected(ball));
            }

            // No ball detected
            return(DriveNoBallDetected(ball));
        }
Beispiel #14
0
        private async void YesButton_Click(object sender, RoutedEventArgs e)
        {
            DbStatus status = await localAccountService.Delete(Mapping.Mapper.Map <LocalAccount>(localAccountViewModel));

            OperationStatus = StatusHandler.Handle(OperationType.Delete, status);
            Close();
        }
Beispiel #15
0
        private static bool validateStatus(StatusHandler statusHandler, AutomatedBackupsForm automatedBackupsForm)
        {
            if (statusHandler == null)
            {
                automatedBackupsForm.AppendText("Done. All books have been processed");
                return(false);
            }

            if (statusHandler.HasErrors)
            {
                automatedBackupsForm.AppendText("ERROR. All books have not been processed. Most recent valid book: processing failed");
                foreach (var errorMessage in statusHandler.Errors)
                {
                    automatedBackupsForm.AppendText(errorMessage);
                }
                return(false);
            }

            if (!automatedBackupsForm.KeepGoing)
            {
                if (automatedBackupsForm.KeepGoingVisible && !automatedBackupsForm.KeepGoingChecked)
                {
                    automatedBackupsForm.AppendText("'Keep going' is unchecked");
                }
                return(false);
            }

            return(true);
        }
Beispiel #16
0
        public void ValueUpdate()
        {
            float AttackMultiplier = 1;

            if (StatusHandler.Check(ref StatusList, StatusType.AttackUp))
            {
                AttackMultiplier += GameController_.AttackModifier;
            }
            else if (StatusHandler.Check(ref StatusList, StatusType.AttackDown))
            {
                AttackMultiplier -= GameController_.AttackModifier;
            }

            CurrentAttack  = (int)(BaseAttack * AttackMultiplier);
            CurrentDefence = BaseDefence;
            for (int i = 0; i < DefenceBuffList.Count; i++)
            {
                CurrentDefence += DefenceBuffList[i].DefenceValue;
            }

            for (int i = 0; i < Commands.Length; i++)
            {
                Commands[i].CastValue = Commands[i].CastBaseValue;
            }
        }
Beispiel #17
0
        public override void Execute(GameCommandTrigger trigger)
        {
            int id = trigger.Get <int>("id");

            if (SkillMetadataStorage.GetSkill(id) == null)
            {
                trigger.Session.SendNotice($"No skill found with id: {id}");
                return;
            }

            short level = trigger.Get <short>("level") <= 10 && trigger.Get <short>("level") != 0 ? trigger.Get <short>("level") : (short)1;
            // The Status packet needs this in miliseconds, we are converting them here for the user to just input the actual seconds.
            int duration = trigger.Get <int>("duration") <= 3600 && trigger.Get <int>("duration") != 0 ? trigger.Get <int>("duration") * 1000 : 10000;
            int stacks   = trigger.Get <int>("stacks") == 0 ? 1 : trigger.Get <int>("stacks");

            SkillCast skillCast = new SkillCast(id, level);

            if (skillCast.IsBuffToOwner() || skillCast.IsBuffToEntity() || skillCast.IsBuffShield() || skillCast.IsGM() || skillCast.IsGlobal() || skillCast.IsHealFromBuff())
            {
                Status status = new Status(skillCast, trigger.Session.FieldPlayer.ObjectId, trigger.Session.FieldPlayer.ObjectId, stacks);
                StatusHandler.Handle(trigger.Session, status);
                return;
            }

            trigger.Session.SendNotice($"Skill with id: {id} is not a buff to the owner.");
        }
 /// <summary>
 /// Edits the shelf from the database
 /// </summary>
 public void Edit(string description, int maxUnitStorageSize)
 {
     base.Update($@" UPDATE shelves
                     SET description = '{description}', maxUnitStorageSize = {maxUnitStorageSize}
                     WHERE id = {this.Id}");
     StatusHandler.Write($"Edited shelf {this.Identifier}", StatusHandler.Codes.SUCCESS);
     LoadShelves();
 }
 /// <summary>
 /// Edits the product from the database
 /// </summary>
 public void Edit(string name, ProductCategory category, int unitSize, int unitPrice, Shelf shelf)
 {
     base.Update($@"UPDATE products
                     SET name = '{name}', category_id = {category.Id}, unitSize = {unitSize}, unitPrice = {unitPrice}, shelf_id = {shelf.Id}
                     WHERE id = {this.Id}");
     // Write a status
     StatusHandler.Write($"Edited product {this.Name}", StatusHandler.Codes.SUCCESS);
 }
Beispiel #20
0
 public void StartTurn()
 {
     ActionPointHandler.ResetActionPoints();
     StatusHandler.PerTurnStatuses();
     AbilityHandler.TickCooldowns();
     active = true;
     UpdateAvailability();
 }
 public BaseActorState(Node2D node)
 {
     this.node        = node;
     tickHandler      = new TickHandler();
     statusHandler    = new StatusHandler(node as ISufferStatusEffects);
     elevationHandler = new ElevationHandler(node as IElevatable, (node as IHaveRuntime).runtime);
     (node as BaseActorNode).state = this;
 }
Beispiel #22
0
 public Engine()
 {
     this.screenHandler    = new ScreenHandler();
     this.playerController = new PlayerController();
     this.enemyController  = new EnemyController();
     this.statusHandler    = new StatusHandler();
     this.messageHandler   = new MessageHandler();
     this.eindex           = new List <int>();
 }
        /// <summary>
        /// Removes the product from the database
        /// </summary>
        public void Remove()
        {
            // Call the base Delete which also will handle the Saved variable

            base.Delete($@" DELETE FROM products
                            WHERE id = {this.Id}");
            // Write a status
            StatusHandler.Write($"Deleted product {this.Name}", StatusHandler.Codes.SUCCESS);
        }
 /// <summary>
 /// Save the product to the database
 /// </summary>
 /// <param name="shelfId">The id of the shelf the product is going to be added to</param>
 public void Save(int shelfId)
 {
     // Call the base insert which also will handle the Saved variable
     base.Insert($@" INSERT INTO products
                     (name, category_id, unitSize, unitPrice, shelf_id)
                     VALUES ('{this.Name}',{this.Category.Id},{this.UnitSize}, {this.UnitPrice}, {shelfId})");
     // Write a status
     StatusHandler.Write($"Saved product {this.Name}", StatusHandler.Codes.SUCCESS);
 }
        /// <summary>
        /// Saves the shelf from the database
        /// </summary>
        public void Save()
        {
            base.Insert($@" INSERT INTO shelves
                            (identifier, description, maxUnitStorageSize)
                            VALUES ('{this.Identifier}','{this.Description}',{this.MaxUnitStorageSize})");

            StatusHandler.Write($"Saved shelf {this.Identifier}", StatusHandler.Codes.SUCCESS);
            LoadShelves();
        }
Beispiel #26
0
    private void BattleVictory()
    {
        for (int i = 0; i < CharacterPartySize; i++)
        {
            StatusHandler.Reset(ref CharacterParty[i].StatusList);
        }

        //disable battle screen
    }
Beispiel #27
0
        private static void ExitFromInvalidArgrument(String errorMessage)
        {
            // Invalid command line argument - write to error output, debug output, and base station
            Console.Error.Write(errorMessage + "\n");
            System.Diagnostics.Debug.Write(errorMessage + "\n");
            StatusHandler.SendDebugAIPacket(Status.AIS_FATAL_ERROR, "Error: " + errorMessage);

            // Exit with Windows ERROR_BAD_ARGUMENTS system error code
            Environment.Exit(160);
        }
Beispiel #28
0
        /// <summary>
        /// Get the next StateType. This is used to check if the state must be switched by Autonomous Service.
        /// </summary>
        /// <returns>StateType - the next StateType</returns>
        public StateType GetNextStateType()
        {
            if (this.switchToGPS)
            {
                StatusHandler.SendDebugAIPacket(Status.AIS_SWITCH_TO_GPS, "Drive state switch: Vision to GPS.");
                return(StateType.GPSState);
            }

            return(StateType.VisionState);
        }
Beispiel #29
0
        public ICommand Act()
        {
            // TODO: need to decouple status effects from actor turns
            StatusHandler.Process();
            if (IsDead)
            {
                TriggerDeath();
            }

            return(GetAction());
        }
Beispiel #30
0
 private void PostActionInfliction(ref List <Status> StatusList, ref int Health)
 {
     if (StatusHandler.Check(ref StatusList, StatusType.Dying))
     {
         Health -= Mathf.Max(1, (int)(Health * GameController_.HealthModifier));
     }
     else if (StatusHandler.Check(ref StatusList, StatusType.Regenerate))
     {
         Health += Mathf.Max(1, (int)(Health * GameController_.HealthModifier));
     }
 }