protected async override Task <bool> Process() { switch (type) { case AugmentationType.Organ: { switch (action) { case AugmentationAction.Install: { Economics.Exchange.TakeItem(implant as Organ); bool successful = Patient.InstallOrgan((implant as Organ).Slot); if (successful) { Journal.AddRecord("Орган \"" + implant.Name + "\" установлен в пациента " + Patient.Name + ".", Controller.LogOutputDuringOperation); } return(successful); } case AugmentationAction.Remove: { Organ ejected = Patient.EjectOrgan((target as Organ).Slot); if (ejected != null) { Economics.Exchange.AddItem(ejected); Journal.AddRecord("Из пациента " + Patient.Name + " извлечён орган \"" + ejected.Name + "\" и убран на склад.", Controller.LogOutputDuringOperation); return(true); } else { return(false); } } default: return(false); } } case AugmentationType.Primary: { switch (action) { case AugmentationAction.Install: { Augment ejected = Patient.InstallAugmentToOrganSlot(implant as Augment); Economics.Exchange.TakeItem(implant as Augment); if ((implant as Augment).IsReplacement) { Journal.AddRecord("Протез \"" + implant.Name + "\" органа \"" + implant.SlotString + "\" установлен в пациента " + Patient.Name + ".", Controller.LogOutputDuringOperation); } else { Journal.AddRecord("Аугмент \"" + implant.Name + "\" для органа \"" + implant.SlotString + "\" установлен в пациента " + Patient.Name + ".", Controller.LogOutputDuringOperation); if (ejected != null) { Economics.Exchange.AddItem(ejected); Journal.AddRecord("Взамен, аугмент \"" + ejected.Name + "\" извлечён и убран на склад.", Controller.LogOutputDuringOperation); } } return(true); } case AugmentationAction.Remove: { Augment ejected = Patient.EjectAugmentFromOrganSlot((target as Organ).Slot); if (ejected != null) { Economics.Exchange.AddItem(ejected); if (ejected.IsReplacement) { Journal.AddRecord("Протез \"" + ejected.Name + "\" органа \"" + ((Character.BodyPartSlot.SlotType)(ejected.Slot)).GetDescription() + "\" извлечён из пациента " + Patient.Name + " и убран на склад.", Controller.LogOutputDuringOperation); } else { Journal.AddRecord("Аугмент \"" + ejected.Name + "\" для органа \"" + ((Character.BodyPartSlot.SlotType)(ejected.Slot)).GetDescription() + "\" извлечён из пациента " + Patient.Name + " и убран на склад.", Controller.LogOutputDuringOperation); } return(true); } else { return(false); } } default: return(false); } } case AugmentationType.Auxilary: { switch (action) { case AugmentationAction.Install: { Economics.Exchange.TakeItem(implant as Augment); Patient.AddAugment(implant as Augment); Journal.AddRecord("Аугмент \"" + implant.Name + "\" успешно имплантирован в пациента" + Patient.Name + ".", Controller.LogOutputDuringOperation); return(true); } case AugmentationAction.Remove: { bool didEject = Patient.EjectAugment(target as Augment); if (didEject) { Journal.AddRecord("Извлечён имплант " + target.Name + " из пациента " + Patient.Name, Controller.LogOutputDuringOperation); } return(didEject); } default: return(false); } } default: return(false); } }