//storage => base => public container -> owner character public void ReturnToLocalPublicContainer(out VolumeWrapperContainer volumeWrapperContainer, out PublicContainer publicContainer) { GetLocalPublicContainer(ownercharacter, out volumeWrapperContainer, ownercharacter, out publicContainer); publicContainer.AddItem(volumeWrapperContainer, false); volumeWrapperContainer.Owner = ownercharacter.Eid; volumeWrapperContainer.ClearAssignmentId(); volumeWrapperContainer.Save(); }
public void GiveToVolunteer(out VolumeWrapperContainer volumeWrapperContainer, out PublicContainer publicContainer) { if (volunteercharacter == Character.None) { throw new PerpetuumException(ErrorCodes.WTFErrorMedicalAttentionSuggested); } GetLocalPublicContainer(ownercharacter, out volumeWrapperContainer, volunteercharacter, out publicContainer); volumeWrapperContainer.Owner = volunteercharacter.Eid; publicContainer.AddItem(volumeWrapperContainer, false); volumeWrapperContainer.Save(); }
private static void AdministerDelivery(TransportAssignment transportAssignmentInfo, VolumeWrapperContainer volumeWrapperContainer, PublicContainer container) { //normal procedure //successful delivery transportAssignmentInfo.PayOutReward(); volumeWrapperContainer.ReloadItems(transportAssignmentInfo.volunteercharacter); volumeWrapperContainer.PrintDebug(); container.AddItem(volumeWrapperContainer, transportAssignmentInfo.ownercharacter.Eid, false); volumeWrapperContainer.Owner = transportAssignmentInfo.ownercharacter.Eid; volumeWrapperContainer.ClearAssignmentId(); volumeWrapperContainer.Save(); volumeWrapperContainer.PrintDebug(); //owner transportAssignmentInfo.WriteLog(TransportAssignmentEvent.deliver, container.Parent); transportAssignmentInfo.DeleteFromDb(); transportAssignmentInfo.SendDeliveryMessage(container); }
public void RetrieveToBasePublicContainer(VolumeWrapperContainer volumeWrapperContainer, long targetBaseEid = 0) { var baseEid = sourcebaseeid; if (targetBaseEid != 0) { baseEid = targetBaseEid; } var volumeInitCharacter = taken ? volunteercharacter : ownercharacter; var sourcePublicContainer = Container.GetFromStructure(volumeWrapperContainer.TraverseForStructureRootEid()); sourcePublicContainer.ReloadItems(volumeInitCharacter); var wrapperContainer = sourcePublicContainer.GetItem(volumeWrapperContainer.Eid) as VolumeWrapperContainer; if (wrapperContainer != null && wrapperContainer.Parent == sourcePublicContainer.Eid) { sourcePublicContainer.RemoveItemOrThrow(wrapperContainer); } volumeWrapperContainer.ReloadItems(volumeInitCharacter); var targetPublicContainer = Container.GetFromStructure(baseEid); targetPublicContainer.ReloadItems(ownercharacter); volumeWrapperContainer.Owner = ownercharacter.Eid; volumeWrapperContainer.ClearAssignmentId(); targetPublicContainer.AddItem(volumeWrapperContainer, false); PaybackCollateral(); PaybackReward(); targetPublicContainer.Save(); sourcePublicContainer.Save(); volumeWrapperContainer.Save(); WriteLog(TransportAssignmentEvent.containerRetrieved, baseEid); DeleteFromDb(); Transaction.Current.OnCommited(() => { var info = new Dictionary <string, object> { { k.assignment, ToPrivateDictionary() }, { k.container, sourcePublicContainer.ToDictionary() } }; if (taken) { //inform volunteer Message.Builder.SetCommand(Commands.TransportAssignmentContainerRetrieved).WithData(info).ToCharacter(volunteercharacter).Send(); } //inform principal info[k.container] = targetPublicContainer.ToDictionary(); info[k.assignment] = ToDictionary(); Message.Builder.SetCommand(Commands.TransportAssignmentContainerRetrieved).WithData(info).ToCharacter(ownercharacter).Send(); }); }