Beispiel #1
0
 public WorkhouseStation LoadStation(string characterID, Res resource, out bool isNew)
 {
     lock (sync) {
         var document = StationDocuments.FindOne(Query <WorkshopDocument> .EQ(d => d.CharacterId, characterID));
         if (document != null)
         {
             isNew = false;
             return(document.SourceObject(resource));
         }
         else
         {
             isNew    = true;
             document = new WorkshopDocument {
                 CharacterId              = characterID,
                 StationInventoryItems    = new List <InventoryItemDocumentElement>(),
                 StationInventoryMaxSlots = 100,
                 petSchemeAdded           = false
             };
             StationDocuments.Save(document);
             return(document.SourceObject(resource));
         }
     }
 }