public ProtoMessage AttackArmy(string aID, TextTestClient client)
        {
            ProtoPlayerCharacter protoMessage = new ProtoPlayerCharacter();

            protoMessage.Message    = client.charID;
            protoMessage.ActionType = Actions.ViewChar;
            client.net.Send(protoMessage);
            var          locReply    = GetActionReply(Actions.ViewChar, client);
            var          locResult   = (ProtoPlayerCharacter)locReply.Result;
            ProtoMessage protoAttack = new ProtoMessage();

            protoAttack.ActionType    = Actions.Attack;
            protoAttack.Message       = locResult.armyID;
            protoAttack.MessageFields = new string[] { aID };
            client.net.Send(protoAttack);
            var reply = GetActionReply(Actions.Attack, client);

            if (reply.GetType() == typeof(ProtoBattle))
            {
                return(reply.Result as ProtoBattle);
            }
            else
            {
                return(reply.Result);
            }
        }
/*
 *  public static ProtoMessage TryForChild(string charID, TextTestClient client)
 *  {
 *      ProtoMessage protoMessage = new ProtoMessage();
 *      protoMessage.ActionType = Actions.TryForChild;
 *      protoMessage.Message = charID;
 *      client.net.Send(protoMessage);
 *      var reply = GetActionReply(Actions.TryForChild, client);
 *      return reply;
 *  }
 */
    /// <summary>
    /// siege functions
    /// </summary>
    /// <param name="client"></param>
    /// <returns></returns>
    public static ProtoMessage SiegeCurrentFief(TextTestClient client)
    {
        ProtoPlayerCharacter protoMessage = new ProtoPlayerCharacter();

        protoMessage.Message    = "Char_158";
        protoMessage.ActionType = Actions.ViewChar;
        client.net.Send(protoMessage);
        var          locReply        = GetActionReply(Actions.ViewChar, client);
        var          locResult       = (ProtoPlayerCharacter)locReply;
        ProtoMessage protoSiegeStart = new ProtoMessage();

        protoSiegeStart.ActionType = Actions.BesiegeFief;
        protoSiegeStart.Message    = locResult.armyID;
        client.net.Send(protoSiegeStart);
        var reply = GetActionReply(Actions.BesiegeFief, client);

        if (reply.GetType() == typeof(ProtoSiegeDisplay))
        {
            return(reply as ProtoSiegeDisplay);
        }
        else
        {
            return(reply);
        }
    }
Example #3
0
        public void DisplayProfile(ProtoPlayerCharacter characterProtoBuf)
        {
            Console.WriteLine("-----------------------------");
            Console.WriteLine("Player Profile");
            Console.WriteLine("-----------------------------");
            Console.WriteLine("Player ID: " + characterProtoBuf.playerID);
            Console.WriteLine("Player Name: " + characterProtoBuf.firstName + " " + characterProtoBuf.familyName);
            Console.WriteLine("-----------------------------");
            Console.Write("Owned Fiefs: ");
            bool written = false;

            foreach (var fief in characterProtoBuf.ownedFiefs)
            {
                if (written == false)
                {
                    Console.Write(fief);
                    written = true;
                }
                else
                {
                    Console.Write(" , " + fief);
                }
            }
            Console.Write("\n");
            Console.WriteLine("-----------------------------");
            Console.WriteLine("Location: " + characterProtoBuf.location);
            Console.WriteLine("Army: " + characterProtoBuf.armyID);
            Console.WriteLine("Purse: " + characterProtoBuf.purse);
            Console.Write("Allies: ");
            if (characterProtoBuf.allies != null && characterProtoBuf.allies.Count > 0)
            {
                for (int i = 0; i < characterProtoBuf.allies.Count; i++)
                {
                    Console.Write(characterProtoBuf.allies.ElementAt(i));
                    if (i != characterProtoBuf.allies.Count - 1)
                    {
                        Console.Write(" , ");
                    }
                }
            }
            Console.WriteLine();
            Console.Write("At war with: ");
            if (characterProtoBuf.atWar != null && characterProtoBuf.atWar.Count > 0)
            {
                for (int i = 0; i < characterProtoBuf.atWar.Count; i++)
                {
                    Console.Write(characterProtoBuf.atWar.ElementAt(i));
                    if (i != characterProtoBuf.atWar.Count - 1)
                    {
                        Console.Write(", ");
                    }
                }
            }
            Console.WriteLine();
            Console.WriteLine("-----------------------------");
        }
    public static ProtoPlayerCharacter Profile(TextTestClient client)
    {
        ProtoPlayerCharacter protoMessage = new ProtoPlayerCharacter();

        protoMessage.Message    = "Char_158";
        protoMessage.ActionType = Actions.ViewChar;
        client.net.Send(protoMessage);
        var reply = GetActionReply(Actions.ViewChar, client);

        return((ProtoPlayerCharacter)reply);
    }
Example #5
0
    public static void ProfileClickEvent(object obj, EventArgs args)
    {
        ProtoPlayerCharacter player = playerOps.Profile(client);

        if (profileTable == null)
        {
            profileTable = new ProfileTable(player.playerID, player.firstName + " " + player.familyName, player.ownedFiefs, player.location, player.armyID, Convert.ToString(player.purse));
        }
        else
        {
            profileTable.DestroyTable();
            profileTable = new ProfileTable(player.playerID, player.firstName + " " + player.familyName, player.ownedFiefs, player.location, player.armyID, Convert.ToString(player.purse));
        }
        tableLayout.Attach(profileTable.getProfileLayout(), 1, 2, 4, 5);
        myWin.ShowAll();
    }
Example #6
0
    public ProtoFief FiefDetails(TextTestClient client)
    {
        ProtoPlayerCharacter protoMessage = new ProtoPlayerCharacter();

        protoMessage.Message    = "Char_158";
        protoMessage.ActionType = Actions.ViewChar;
        client.net.Send(protoMessage);
        var       locReply  = GetActionReply(Actions.ViewChar, client);
        var       locResult = (ProtoPlayerCharacter)locReply;
        ProtoFief protoFief = new ProtoFief();

        protoFief.Message    = locResult.location;
        protoFief.ActionType = Actions.ViewFief;
        client.net.Send(protoFief);
        var reply = GetActionReply(Actions.ViewFief, client);

        return((ProtoFief)reply);
    }
        public ProtoMessage HireNew(int amount, TextTestClient client)
        {
            ProtoPlayerCharacter protoMessage = new ProtoPlayerCharacter();

            protoMessage.Message    = client.charID;
            protoMessage.ActionType = Actions.ViewChar;
            client.net.Send(protoMessage);
            var          armyReply       = GetActionReply(Actions.ViewChar, client);
            var          armyResult      = (ProtoPlayerCharacter)armyReply.Result;
            ProtoRecruit protoRecruitNew = new ProtoRecruit();

            protoRecruitNew.ActionType = Actions.RecruitNew;
            if (amount > 0)
            {
                protoRecruitNew.amount = (uint)amount;
            }
            protoRecruitNew.isConfirm = true;
            client.net.Send(protoRecruitNew);
            var reply = GetActionReply(Actions.RecruitNew, client);

            return(reply.Result);
        }
    public ProtoMessage HireTroops(int amount, TextTestClient client)
    {
        ProtoPlayerCharacter protoMessage = new ProtoPlayerCharacter();

        protoMessage.Message    = "Char_158";
        protoMessage.ActionType = Actions.ViewChar;
        client.net.Send(protoMessage);
        var          armyReply    = GetActionReply(Actions.ViewChar, client);
        var          armyResult   = (ProtoPlayerCharacter)armyReply.Result;
        ProtoRecruit protoRecruit = new ProtoRecruit();

        protoRecruit.ActionType = Actions.RecruitTroops;
        if (amount > 0)
        {
            protoRecruit.amount = (uint)amount;
        }
        protoRecruit.armyID    = armyResult.armyID;
        protoRecruit.isConfirm = true;
        client.net.Send(protoRecruit);
        var reply = GetActionReply(Actions.RecruitTroops, client);

        return(reply.Result);
    }