public override void Execute()
        {
            removedToken = Receiver.GetTokenByKey(Arguments.Key);
              if(removedToken != null)
              {
            containerCard = (CardModel)removedToken.Parent;
            containerCard.Tokens.Remove(removedToken);

            Log(containerCard);

              }
        }
Exemplo n.º 2
0
 public static MessageContentElement EncodeCardSmartName(CardModel card)
 {
     MessageContentElement element = new MessageContentElement();
       SmartName cardSmartName = card.GetSmartName();
       if(cardSmartName.Visible)
       {
     //element.Value = card.Key;
     element.Value = card.Data.Id;
     element.Text = card.Data.Name;
       }
       else
     element.Text = cardSmartName.Name;
       return element;
 }
Exemplo n.º 3
0
 void Log(CardModel card)
 {
     string playerName = Receiver.GetPlayerByKey(Invoker).Info.NickName;
       string commandName = Receiver.GetCommandByKey(COMMANDCODE).Data.Name;
       MessageContent logContent = new MessageContent(string.Concat("[", playerName, "] ", commandName, " "));
       logContent.Add(CardLogger.EncodeCardSmartName(card));
       Receiver.Console.WriteLog(logContent);
 }
Exemplo n.º 4
0
 public static CardViewItem FromModel(CardModel card, int index)
 {
     return new CardViewItem()
       {
     Data = card.Data,
     OwnerPlayerKey = card.Owner.Key,
     Position = card.Position.Value,
     Reversed = card.Reversed.Value,
     Rotated = card.Rotated.Value,
     Locked = card.Locked.Value,
     CustomCharacteristics = card.CustomCharacteristics.Value,
     Visibility = card.Visibility.Value,
     HiddenCode = card.HiddenCode,
     Index = index,
       };
 }
Exemplo n.º 5
0
        public override void Execute()
        {
            SectorModel sector = Receiver.GetSectorByKey(Arguments.SectorKey);
              PlayerModel player = Receiver.GetSectorPlayer(sector.Key);
              CardItem pawnItem = new CardItem();
              pawnItem.UniqueID = pawnKey;
              pawnItem.Name = Arguments.Name;
              pawnItem.Text = Arguments.Text;
              pawnItem.Type = Arguments.Type;
              pawnItem.Characteristics = Arguments.Characteristics;
              pawnItem.Id = string.Empty;

              CardModel pawn = new CardModel(pawnKey, player, pawnItem, true);
              pawn.Position.Value = Arguments.CardPosition;
              pawn.Data.StyleCode = "PAWN";
              pawn.Data.BgImagePathLarge = "bg_PAWN_Large.png";
              pawn.Data.BgImagePathSmall = "bg_PAWN_Small.png";
              sector.Cards.Insert(0, pawn);

              Log(pawn, sector);
        }
        public override void Execute()
        {
            CardModel card = Receiver.GetCardByKey(Arguments.CardKey);
              CardItem pawnItem = card.Data.Clone();
              pawnItem.UniqueID = pawnKey;

              SectorModel sector = (SectorModel)card.Parent;
              PlayerModel player = (PlayerModel)Receiver.GetPlayerByKey(Invoker);
              CardModel pawn = new CardModel(pawnKey, player, pawnItem, true);
              pawn.Position.Value = Arguments.CardPosition;
              pawn.Data.StyleCode = "PAWN";
              pawn.Data.BgImagePathLarge = "bg_PAWN_Large.png";
              pawn.Data.BgImagePathSmall = "bg_PAWN_Small.png";
              sector.Cards.Insert(0, pawn);

              Log(pawn);
        }
 void Log(CardModel card)
 {
     string playerName = Receiver.GetPlayerByKey(Invoker).Info.NickName;
       string commandName = string.Empty;
       switch(card.Visibility.Value)
       {
     case CardVisibility.Visible: commandName = COMMANDCODE_VISIBLE; break;
     case CardVisibility.Private: commandName = COMMANDCODE_PRIVATE; break;
     case CardVisibility.Hidden: commandName = COMMANDCODE_HIDDEN; break;
       }
       commandName = Receiver.GetCommandByKey(commandName).Data.Name;
       MessageContent logContent = new MessageContent(string.Concat("[", playerName, "] ", commandName, " "));
       logContent.Add(CardLogger.EncodeCardSmartName(card));
       Receiver.Console.WriteLog(logContent);
 }
Exemplo n.º 8
0
        public static void LogMovement(GameModel game, string executorPlayerKey, CardModel card, SectorModel fromSector, 
            SectorModel toSector, int fromIndex, int toIndex, CardVisibility? toCardVisibility, bool verbose)
        {
            if(fromSector.Key == toSector.Key && fromSector.Data.Behavior != SectorBehavior.Simple)
            return;

              IEnumerable<SectorModel> sectors = game.Players.Cast<PlayerModel>().SelectMany(e => e.Sectors).Cast<SectorModel>();
              SectorCardsVisibility fromSectorVisibility = sectors.First(e => e.Data.Code == fromSector.Data.Code).Data.CardsVisibility;
              SectorCardsVisibility toSectorVisibility = sectors.First(e => e.Data.Code == toSector.Data.Code).Data.CardsVisibility;

              PlayerModel fromPlayer = (PlayerModel)fromSector.Parent;
              PlayerModel toPlayer = (PlayerModel)toSector.Parent;
              PlayerModel executorPlayer = game.GetPlayerByKey(executorPlayerKey);

              MessageContent logContent = new MessageContent();
              StringBuilder logText = new StringBuilder(200);

              if(verbose)
              {
            logText.Append("[").Append(executorPlayer.Info.NickName).Append("] ");
            logText.Append(game.GetCommandByKey(MoveCardsCommand.COMMANDCODE_SINGLE).Data.Name).Append(" ");
              }

              bool fromVisible = fromSectorVisibility == SectorCardsVisibility.Visibile ||
            (fromSectorVisibility == SectorCardsVisibility.Private && fromPlayer.Key == game.ActivePlayer.Key);
              if(fromVisible)
              {
            fromVisible = (card.Visibility.Value == CardVisibility.Visible ||
              (card.Visibility.Value == CardVisibility.Private && fromPlayer.Key == game.ActivePlayer.Key));
              }
              bool toVisible = toSectorVisibility == SectorCardsVisibility.Visibile ||
            (toSectorVisibility == SectorCardsVisibility.Private && toPlayer.Key == game.ActivePlayer.Key);
              if(toVisible)
              {
            if(toCardVisibility.HasValue)
              toVisible = (toCardVisibility.Value == CardVisibility.Visible ||
            (toCardVisibility.Value == CardVisibility.Private && toPlayer.Key == game.ActivePlayer.Key));
            else
              toVisible = (card.Visibility.Value == CardVisibility.Visible ||
            (card.Visibility.Value == CardVisibility.Private && toPlayer.Key == game.ActivePlayer.Key));
              }
              logContent.Add(logText.ToString());
              logText.Length = 0;
              logContent.Add(EncodeCardSmartName(card, fromVisible || toVisible));
              if(verbose)
              {
            logText.Append(" (");
            if(fromPlayer.Key != executorPlayerKey)
              logText.Append(fromPlayer.Info.NickName).Append("-");
            logText.Append(fromSector.Data.Name);
            if(fromSector.Data.Behavior == SectorBehavior.Simple)
              logText.Append("[").Append(fromIndex + 1).Append("]");
            logText.Append(">");
            if(toPlayer.Key != executorPlayerKey)
              logText.Append(toPlayer.Info.NickName).Append("-");
            logText.Append(toSector.Data.Name);
            if(toSector.Data.Behavior == SectorBehavior.Simple)
              logText.Append("[").Append(toIndex + 1).Append("]");
            logText.Append(")");
              }
              else
              {
            if(fromSector.Data.Behavior == SectorBehavior.Simple)
              logText.Append("[").Append(fromIndex + 1).Append("]");
            if(toSector.Data.Behavior == SectorBehavior.Simple)
              logText.Append("[").Append(toIndex + 1).Append("]");
              }
              logContent.Add(logText.ToString());
              game.Console.WriteLog(logContent);
        }
Exemplo n.º 9
0
 static MessageContentElement EncodeCardSmartName(CardModel card, bool visible)
 {
     MessageContentElement element = new MessageContentElement();
       SmartName cardSmartName = visible ? card.GetVisibleName() : card.GetHiddenName();
       if(cardSmartName.Visible)
       {
     //element.Value = card.Key;
     element.Value = card.Data.Id;
     element.Text = card.Data.Name;
       }
       else
     element.Text = cardSmartName.Name;
       return element;
 }