Exemplo n.º 1
0
 public AchievmentSave LoadAchievments(string characterId, out bool isNew)
 {
     lock (sync) {
         s_Log.InfoFormat("load achievments for character: {0}".Color(LogColor.orange), characterId);
         var document = achievmentDocuments.FindOne(Query <AchievmentDocument> .EQ(d => d.characterId, characterId));
         if (document != null)
         {
             isNew = false;
             return(document.SourceObject());
         }
         else
         {
             isNew    = true;
             document = new AchievmentDocument {
                 characterId   = characterId,
                 isNewDocument = isNew,
                 variables     = new Hashtable(),
                 visitedZones  = new System.Collections.Generic.List <string>(),
                 loreRecords   = new System.Collections.Generic.List <string>(),
                 points        = 0
             };
             achievmentDocuments.Save(document);
             return(document.SourceObject());
         }
     }
 }
Exemplo n.º 2
0
 public void SaveAchievment(string characterId, AchievmentSave achievments)
 {
     lock (sync) {
         s_Log.InfoFormat("save achievments for character: {0}".Color(LogColor.yellow), characterId);
         var document = achievmentDocuments.FindOne(Query <AchievmentDocument> .EQ(d => d.characterId, characterId));
         if (document == null)
         {
             document = new AchievmentDocument {
                 characterId = characterId
             };
         }
         document.isNewDocument = false;
         document.Set(achievments);
         achievmentDocuments.Save(document);
     }
 }