Ejemplo n.º 1
0
        public void Execute(CommodityVO reward)
        {
            ServantModel model = AmbitionApp.GetModel <ServantModel>();

            switch (reward.Value)
            {
            case -1:
                AmbitionApp.SendMessage(ServantMessages.FIRE_SERVANT, reward.ID);
                model.Servants.RemoveAll(s => s.ID == reward.ID);
                model.Broadcast();
                break;

            case 0:
                ServantVO servant = model.GetServant(reward.ID);
                if (servant?.IsHired ?? false)
                {
                    AmbitionApp.SendMessage(ServantMessages.FIRE_SERVANT, reward.ID);
                }
                else
                {
                    AmbitionApp.SendMessage(ServantMessages.INTRODUCE_SERVANT, reward.ID);
                }
                break;

            default:
                AmbitionApp.SendMessage(ServantMessages.HIRE_SERVANT, reward.ID);
                break;
            }
        }
Ejemplo n.º 2
0
        public void Execute(string servantID)
        {
            ServantModel model   = AmbitionApp.GetModel <ServantModel>();
            ServantVO    servant = model.GetServant(servantID);

            if (servant != null && servant.Status == ServantStatus.Hired)
            {
                servant.Status = ServantStatus.Introduced;
                model.Broadcast();
            }
        }
Ejemplo n.º 3
0
        public void Execute(ServantType type)
        {
            ServantModel model   = AmbitionApp.GetModel <ServantModel>();
            ServantVO    servant = model.GetServant(type);

            if (servant != null)
            {
                servant.Status = ServantStatus.Introduced;
                model.Broadcast();
            }
        }
Ejemplo n.º 4
0
        public void Execute(string servantID)
        {
            ServantModel model   = AmbitionApp.GetModel <ServantModel>();
            ServantVO    servant = model.LoadServant(servantID);

            if (servant != null && !servant.IsHired)
            {
                if (model.GetServant(servant.Type)?.ID != servant.ID)
                {
                    AmbitionApp.SendMessage(ServantMessages.FIRE_SERVANT, servant.Type);
                }
                servant.Status = ServantStatus.Hired;
                model.Broadcast();
            }
        }