/// <summary> /// Save world info, if world info don't exists create and save new world info /// </summary> /// <param name="world">Target world to be saved</param> public void SetWorld(MmoWorld world) { lock (sync) { var document = GetWorld(world.Zone.Id); if (document == null) { //world info not found in DB, than create new world info var worldInfo = new WorldInfo { worldID = world.Zone.Id, currentRace = (int)(byte)world.ownedRace, startRace = (int)(byte)world.Zone.InitiallyOwnedRace, underAttack = world.underAttack, worldType = (int)world.Zone.worldType, attackRace = (byte)world.attackedRace, playerCount = world.playerCount }; document = new WorldDocument { info = worldInfo }; } else { //check the document info not null if (document.info == null) { document.info = new WorldInfo { worldID = world.Zone.Id }; } //world info found in db, get world info and update data from MmoWorld document.info.currentRace = (int)(byte)world.ownedRace; document.info.startRace = (int)(byte)world.Zone.InitiallyOwnedRace; document.info.underAttack = world.underAttack; document.info.worldType = (int)world.Zone.worldType; document.info.attackRace = (byte)world.attackedRace; document.info.playerCount = world.playerCount; } /* * log.InfoFormat("save world state = [{0}, {1}, {2}, {3}, {4}, {5}] [red]", * document.info.worldID, * (Race)(byte)document.info.currentRace, * (Race)(byte)document.info.startRace, * document.info.underAttack, * (WorldType)(int)document.info.worldType, * document.info.playerCount);*/ //save updated world info Worlds.Save(document); } }
public AdaptiveCard GenerateAdaptiveCard(WorldDocument document) { AdaptiveCard card = this.CreateBaselineCard(document); return(card); }
public WorldDocumentNode(string documentNodeTitle, WorldDocument value) { Name = $"{documentNodeTitle} (GRAPH)"; InputDocument = value; }