Пример #1
0
        internal UInt32 SetZoneTransfer(
            ZoneTransfer NewZoneTransferSetting,
            String[] NewSecondaryServers,
            Notify NewNotifySetting,
            String[] NewNotifyServers)
        {
            if (this.ZoneType != ZoneType.Primary)
            {
                return(1);
            }

            ManagementBaseObject Parameters = this.wmiZone.GetMethodParameters("ResetSecondaries");

            Parameters["SecureSecondaries"] = NewZoneTransferSetting;
            if (NewSecondaryServers[0] != String.Empty)
            {
                Parameters["SecondaryServers"] = NewSecondaryServers;
            }
            Parameters["Notify"] = NewNotifySetting;
            if (NewNotifyServers[0] != String.Empty)
            {
                Parameters["NotifyServers"] = NewNotifyServers;
            }

            this.wmiZone.InvokeMethod("ResetSecondaries", Parameters, null);
            return(0);
        }
Пример #2
0
        void AnalyzeSingleZoneTransfer(ZoneTransfer zt)
        {
            var gameObject = gsm.Raw.gameStateMessage.gameObjects?.FirstOrDefault(i => i.instanceId == zt.instanceId);
            //if (gameObject != null)
            {
                var playerId = currentGameProgress.GetPlayerFromId(zt.instanceId);
                if (playerId == PlayerEnum.Unknown)
                {
                    // Cannot retrace the ids changes to the original card...probably because of summarized messages

                    if (gameObject != null)
                    {
                        if (gameObject.ownerSeatId == gameObject.controllerSeatId)
                        {
                            playerId = gameObject.ownerSeatId == currentGameProgress.SystemSeatId
                                ? PlayerEnum.Me
                                : PlayerEnum.Opponent;
                        }
                        else
                        {
                            //System.Diagnostics.Debugger.Break();
                            //Log.Error("OUTPUTLOG {outputLogError}. User {userId}, Match id {matchId}",
                            //    "Unknown zone transfer",

                            //    JsonConvert.SerializeObject(gsm));
                            Errors.Add(new OutputLogError(OutputLogErrorType.UnknownZoneTransfer, gsm.Timestamp));
                            return;
                        }
                    }
                    else
                    {
                        if (zt.zone_src.Player == zt.zone_dest.Player)
                        {
                            playerId = zt.zone_dest.Player;
                        }
                        else
                        {
                            //System.Diagnostics.Debugger.Break();
                            //Log
                            playerId = zt.zone_dest.Player;
                        }
                    }
                }

                var c = new CardForTurn
                {
                    CardGrpId = gameObject?.grpId ?? default(int),
                    Player    = playerId,
                    Turn      = currentGameProgress.CurrentTurn,
                };

                if (zt.zone_src.Name == "ZoneType_Library" && zt.zone_dest.Name == "ZoneType_Hand")
                {
                    c.Action = CardForTurnEnum.Drew;
                }
                else if (zt.zone_src.Name == "ZoneType_Hand" && (zt.zone_dest.Name == "ZoneType_Battlefield" || zt.zone_dest.Name == "ZoneType_Stack"))
                {
                    c.Action = CardForTurnEnum.Played;
                }
                else if (zt.zone_src.Name == "ZoneType_Hand" && zt.zone_dest.Name == "ZoneType_Graveyard")
                {
                    c.Action = CardForTurnEnum.Discarded;
                }

                else if (zt.zone_src.Name == "ZoneType_Library" && zt.zone_dest.Name == "ZoneType_Battlefield")
                {
                    c.Action = CardForTurnEnum.FromLibraryToBattlefield;
                }
                else if (zt.zone_src.Name == "ZoneType_Library" && zt.zone_dest.Name == "ZoneType_Exile")
                {
                    c.Action = CardForTurnEnum.FromLibraryToExile;
                }
                else if (zt.zone_src.Name == "ZoneType_Library" && zt.zone_dest.Name == "ZoneType_Graveyard")
                {
                    c.Action = CardForTurnEnum.FromLibraryToGraveyard;
                }

                else if (zt.zone_src.Name == "ZoneType_Battlefield" && (zt.zone_dest.Name == "ZoneType_Graveyard" || zt.zone_dest.Name == "ZoneType_Exile"))
                {
                    c.Action = CardForTurnEnum.PermanentRemoved;
                }

                else if (zt.zone_src.Name == "ZoneType_Stack" && (zt.zone_dest.Name == "ZoneType_Battlefield" || zt.zone_dest.Name == "ZoneType_Graveyard"))
                {
                    c.Action = CardForTurnEnum.SpellResolved;
                }

                else if (zt.zone_src.Name == "ZoneType_Graveyard" && zt.zone_dest.Name == "ZoneType_Battlefield")
                {
                    c.Action = CardForTurnEnum.FromGraveyardToBattlefield;
                }
                else if (zt.zone_src.Name == "ZoneType_Graveyard" && zt.zone_dest.Name == "ZoneType_Hand")
                {
                    c.Action = CardForTurnEnum.FromGraveyardToHand;
                }
                else if (zt.zone_src.Name == "ZoneType_Graveyard" && zt.zone_dest.Name == "ZoneType_Stack")
                {
                    c.Action = CardForTurnEnum.FromGraveyardToStack;
                }
                else if (zt.zone_src.Name == "ZoneType_Graveyard" && zt.zone_dest.Name == "ZoneType_Exile")
                {
                    c.Action = CardForTurnEnum.FromGraveyardToExile;
                }

                else if (zt.zone_src.Name == "ZoneType_Exile" && zt.zone_dest.Name == "ZoneType_Stack")
                {
                    c.Action = CardForTurnEnum.FromExileToStack;
                }
                else if (zt.zone_src.Name == "ZoneType_Exile" && zt.zone_dest.Name == "ZoneType_Battlefield")
                {
                    c.Action = CardForTurnEnum.FromExileToBattlefield;
                }
                else if (zt.zone_src.Name == "ZoneType_Exile" && zt.zone_dest.Name == "ZoneType_Hand")
                {
                    c.Action = CardForTurnEnum.FromExileToHand;
                }

                if (c.Player == 0 /* || c.Turn == 14*/)
                {
                    //System.Diagnostics.Debugger.Break();
                    Errors.Add(new OutputLogError(OutputLogErrorType.PlayerZero, gsm.Timestamp));
                    return;
                }

                /*if (c.Action == CardForTurnEnum.Unknown)
                 * {
                 *  Errors.Add(new OutputLogError(OutputLogErrorType.CardForTurnUnknown, gsm.Timestamp));
                 *  return;
                 * }
                 * else*/
                if (c.Action == CardForTurnEnum.Drew || c.Action == CardForTurnEnum.Played || c.Action == CardForTurnEnum.Discarded)
                {
                    if (dictAllCards.ContainsKey(c.CardGrpId))
                    {
                        currentGameProgress.AddCardTransfer(c);
                    }
                }
            }
            //else
            //if (gameObject == null)
            //{
            //    System.Diagnostics.Debugger.Break();
            //}
        }