Ejemplo n.º 1
0
    public static ProtoCharacter GetCharacterDetails(string charID, TextTestClient client)
    {
        ProtoCharacter request = new ProtoCharacter {
            Message    = charID,
            ActionType = Actions.ViewChar
        };

        client.net.Send(request);
        return((ProtoCharacter)GetActionReply(Actions.ViewChar, client));
    }
Ejemplo n.º 2
0
    public static ProtoMessage PillageFief(TextTestClient client)
    {
        ProtoCharacter armyResult   = GetCharacterDetails("Char_158", client);
        ProtoMessage   protoMessage = new ProtoMessage();

        protoMessage.ActionType = Actions.PillageFief;
        protoMessage.Message    = armyResult.armyID;

        client.net.Send(protoMessage);
        var reply = GetActionReply(Actions.PillageFief, client);

        return(reply);
    }
Ejemplo n.º 3
0
    public static ProtoMessage PickUpTroops(string armyID, string[] detachmentIDs, TextTestClient client)
    {
        ProtoCharacter armyResult   = GetCharacterDetails("Char_158", client);
        ProtoMessage   protoMessage = new ProtoMessage();

        protoMessage.ActionType    = Actions.PickUpTroops;
        protoMessage.Message       = armyResult.armyID;
        protoMessage.MessageFields = detachmentIDs;
        client.net.Send(protoMessage);
        var reply = GetActionReply(Actions.PickUpTroops, client);

        return(reply);
    }
Ejemplo n.º 4
0
    public static ProtoMessage DropOffTroops(uint[] Troops, TextTestClient client)
    {
        ProtoCharacter  armyResult      = GetCharacterDetails("Char_158", client);
        ProtoDetachment protoDetachment = new ProtoDetachment();

        protoDetachment.ActionType = Actions.DropOffTroops;
        protoDetachment.troops     = Troops;
        protoDetachment.armyID     = armyResult.armyID;
        protoDetachment.leftFor    = "Char_158";
        client.net.Send(protoDetachment);
        var reply = GetActionReply(Actions.DropOffTroops, client);

        return(reply);
    }
Ejemplo n.º 5
0
    public static ProtoMessage HireTroops(int amount, TextTestClient client)
    {
        ProtoCharacter armyResult   = GetCharacterDetails("Char_158", client);
        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);
    }
Ejemplo n.º 6
0
    // Start is called before the first frame update
    new void Start()
    {
        btnViewArmy.onClick.AddListener(BtnViewArmy);
        btnHireNPC.onClick.AddListener(BtnHireNPC);
        btnFireNPC.onClick.AddListener(BtnFireNPC);
        btnAddToEntourage.onClick.AddListener(BtnAddToEntourage);
        btnRemoveFromEntourage.onClick.AddListener(BtnRemoveFromEntourage);

        lblMessageForUser.text              = "";
        txtOffer.interactable               = false;
        btnViewArmy.interactable            = false;
        btnHireNPC.interactable             = false;
        btnFireNPC.interactable             = false;
        btnAddToEntourage.interactable      = false;
        btnRemoveFromEntourage.interactable = false;

        ProtoMessage reply = GetCharacterDetails(characterToViewID, tclient);

        if (reply.ResponseType == DisplayMessages.Success)
        {
            currentlyViewedCharacter = (ProtoCharacter)reply;
            fullName = currentlyViewedCharacter.firstName + " " + currentlyViewedCharacter.familyName;
            DisplayCharacterDetails();

            if (!string.IsNullOrWhiteSpace(currentlyViewedCharacter.armyID))  // Viewed char is leading an army.
            {
                btnViewArmy.interactable = true;
            }
            if (currentlyViewedCharacter is ProtoNPC)
            {
                var temp = currentlyViewedCharacter as ProtoNPC;

                if (temp.employer != null)
                {
                    if (temp.employer.charID.Equals(protoClient.playerChar.charID)) // This NPC is employed by you.
                    {
                        btnFireNPC.interactable = true;                             // Can only fire NPCs you employ.

                        if (temp.inEntourage)                                       // Is in YOUR playerchar's entourage.
                        {
                            btnRemoveFromEntourage.interactable = true;
                        }
                        else if (temp.location.Equals(protoClient.playerChar.location))  // Not in entourage but is in same place as playerchar.
                        {
                            btnAddToEntourage.interactable = true;
                        }
                    }
                    else   // Can try to poach NPCs hired by other players (not 100% sure this is true).
                    {
                        txtOffer.interactable   = true;
                        btnHireNPC.interactable = true;
                    }
                }
                else   // Can hire NPCs who aren't employed.
                {
                    txtOffer.interactable   = true;
                    btnHireNPC.interactable = true;
                }
            }

            if (currentlyViewedCharacter is ProtoNPC && currentlyViewedCharacter.location == protoClient.playerChar.location)
            {
            }
        }
        else
        {
            DisplayMessageToUser("ERROR: Response type: " + reply.ResponseType.ToString());
        }

        if (string.IsNullOrWhiteSpace(currentlyViewedCharacter.armyID))
        {
            btnViewArmy.interactable = false;
        }
    }