protected override void ActualPerformGameMessage(Message_Game msg) { switch (msg.SubKind) { case KnownSubkinds.BotPositionChange: MapObjectPositionChangeContext ctxt = (MapObjectPositionChangeContext)msg.RequestContext; //LogXmlGEMovement2(msg.MessageKind, msg.SubKind, ctxt); break; case KnownSubkinds.TurnStart: case KnownSubkinds.TickStart: GameStructureNotificationContext ctxt2 = (GameStructureNotificationContext)msg.RequestContext; if (ctxt2.Turn % 250 == 0) { Console.WriteLine("Turn " + ctxt2.Turn + " battle still running"); } // LogStructureMessage(msg.MessageKind, msg.SubKind, ctxt2); break; case KnownSubkinds.BattleStarts: SystemMessageContext ctxt4 = (SystemMessageContext)msg.RequestContext; // LogSystemMessage(msg.MessageKind, msg.SubKind, ctxt4); break; case KnownSubkinds.BattleEnds: // CloseDownAndRecreateXDocument(); break; case KnownSubkinds.GameCombatEvent: default: Console.WriteLine("UNLOGGED - Game Message - " + msg.MessageKind.ToString() + " : " + msg.SubKind.ToString()); break; } }
private void LogStructureMessage(MainMessageKind mainMessageKind, KnownSubkinds gameMessageSubKind, GameStructureNotificationContext ctxt2) { var el = GetEventElement(mainMessageKind.ToString(), gameMessageSubKind.ToString()); using (var w = el.CreateWriter()) { var sr = new DataContractSerializer(ctxt2.GetType()); sr.WriteObject(w, ctxt2); } eventsParentElement.Add(el); ActiveTurn = ctxt2.Turn; ActiveTick = ctxt2.Tick; if (gameMessageSubKind == KnownSubkinds.TurnStart) { if ((ctxt2.Turn > 0) && (ctxt2.Turn % TURNS_BEFORE_WRITE == 0)) { CloseDownAndRecreateXDocument(); } } }