Esempio 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;
            }
        }
Esempio n. 2
0
        public void Execute(PlayerConfig config)
        {
            if (config == null)
            {
                return;
            }

            GameModel      gameModel     = AmbitionApp.GetModel <GameModel>();
            CalendarModel  calendar      = AmbitionApp.GetModel <CalendarModel>();
            InventoryModel inventory     = AmbitionApp.GetModel <InventoryModel>();
            IncidentModel  incidentModel = AmbitionApp.GetModel <IncidentModel>() ?? AmbitionApp.RegisterModel <IncidentModel>();
            ServantModel   servantModel  = AmbitionApp.GetModel <ServantModel>();
            IncidentVO     incident;

            // Initialize Selected Player
            gameModel.playerID = config.name;
            gameModel.Chapters = new ChapterVO[config.Chapters.Length];
            gameModel.StartInvitationsReqirements = config.InvitationRequirements;
            for (int i = config.Chapters.Length - 1; i >= 0; i--)
            {
                gameModel.Chapters[i] = new ChapterVO()
                {
                    ID                 = config.name + ".chapter." + i,
                    Date               = config.Chapters[i].Date.GetDateTime(),
                    Splash             = config.Chapters[i].Splash,
                    Sting              = config.Chapters[i].Sting,
                    EstateMusic        = config.Chapters[i].EstateMusic,
                    TrivialPartyChance = config.Chapters[i].TrivialPartyChance,
                    DecentPartyChance  = config.Chapters[i].DecentPartyChance,
                    GrandPartyChance   = config.Chapters[i].GrandPartyChance
                };
            }
            Array.Sort(gameModel.Chapters, (x, y) => x.Date <y.Date ? -1 : x.Date> y.Date ? 1 : 0);
            calendar.StartDate = config.Chapters[0].Date.GetDateTime();

            foreach (IncidentConfig iconfig in config.Incidents)
            {
                incident = iconfig.GetIncident();
                if (incident != null)
                {
                    incidentModel.Incidents[iconfig.name] = incident;
                }
            }

            // TODO: Figure out the difference between new and loaded games
            // Then update servants, characters, and inventory to account for any changes in status
            // Right now, this only works because Camille is a known entity and Yvette is the only player
            foreach (ServantConfig sconfig in config.Servants)
            {
                servantModel.Servants.Add(sconfig.GetServant());
            }

            Array.ForEach(config.Inventory, i => inventory.Import(i));

            AmbitionApp.SendMessage(FactionMessages.UPDATE_STANDINGS);
            AmbitionApp.GetModel <LocalizationModel>().SetPlayerName(gameModel.PlayerName);
        }
Esempio n. 3
0
        public void Execute()
        {
            ServantModel servants = AmbitionApp.GetModel <ServantModel>();
            GameModel    model    = AmbitionApp.GetModel <GameModel>();

            foreach (KeyValuePair <string, ServantVO> servant in servants.Servants)
            {
                model.Livre -= servant.Value.Wage;
            }
        }
Esempio n. 4
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();
            }
        }
Esempio n. 5
0
        public void Register(Core.ModelSvc svc)
        {
            ServantModel model = svc.Register <ServantModel>();
            ServantVO    servant;

            foreach (ServantConfig config in Servants)
            {
                servant = config.GetServant();
                model.Servants.Add(servant);
            }
        }
Esempio n. 6
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();
            }
        }
Esempio n. 7
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();
            }
        }
Esempio n. 8
0
        public void Execute(CommodityVO reward)
        {
            ServantModel servants = AmbitionApp.GetModel <ServantModel>();
            ServantVO    servant  = null;

            if (!servants.Servants.ContainsKey(reward.ID) && servants.Applicants.ContainsKey(reward.ID))
            {
                servant = Util.RNG.TakeRandom(servants.Applicants[reward.ID].ToArray());
                servants.Hire(servant);
            }
            if (servant == null)
            {
                reward.Type = CommodityType.Gossip;
                AmbitionApp.Reward(reward);
            }
        }
Esempio n. 9
0
        // Use this for initialization
        void Start()
        {
            FactionModel fmod     = AmbitionApp.GetModel <FactionModel>();
            ServantModel servants = AmbitionApp.GetModel <ServantModel>();
            ServantVO    spymaster;

            availableSpymasterTestTheWaters = servants.Servants.TryGetValue(ServantConsts.SPYMASTER, out spymaster);
            availableTestTheWaters          = true;

            _allegianceTimers = new Dictionary <string, int>();
            _powerTimers      = new Dictionary <string, int>();
            foreach (string faction in fmod.Factions.Keys)
            {
                _powerTimers.Add(faction, 0);
                _allegianceTimers.Add(faction, 0);
            }

            IncrementKnowledgeTimers();
            UpdateInfo();
        }
Esempio n. 10
0
        public void Execute(ServantVO servant)
        {
            ServantModel model = AmbitionApp.GetModel <ServantModel>();

            // Block if the position is filled
            if (!model.Servants.ContainsKey(servant.Slot))
            {
                List <ServantVO> servants;
                model.Servants.Add(servant.Slot, servant);
                servant.Status = ServantStatus.Hired;
                if (model.Applicants.TryGetValue(servant.Slot, out servants))
                {
                    servants.Remove(servant);
                }
                if (model.Unknown.TryGetValue(servant.Slot, out servants))
                {
                    servants.Remove(servant);
                }
                AmbitionApp.GetModel <GameModel>().Livre -= servant.Wage;
            }
        }
Esempio n. 11
0
        public void Initialize(PartyVO party)
        {
            ServantModel smod = AmbitionApp.GetModel <ServantModel>();
            Dictionary <string, string> dialogsubs = new Dictionary <string, string>()
            {
                { "$PARTYSIZE", AmbitionApp.GetString("party_importance." + ((int)party.Importance).ToString()) }
            };

            _party        = party;
            TitleTxt.text = party.Host;

            if (smod.Servants.ContainsKey(ServantConsts.SPYMASTER))
            {
                if (_party.Enemies != null && _party.Enemies.Length > 0)
                {
                    string enemyList = "";
                    Dictionary <string, string> subs = new Dictionary <string, string>();
                    foreach (EnemyVO enemy in _party.Enemies)
                    {
                        enemyList += "\n" + enemy.Name;
                    }
                    subs.Add("$ENEMYLIST", enemyList);
                    dialogsubs.Add("$PROMPT", AmbitionApp.GetString("party_enemies", subs));
                }
                else
                {
                    dialogsubs.Add("$PROMPT", AmbitionApp.GetString("party_no_enemies"));
                }
            }
            else
            {
                dialogsubs.Add("$PROMPT", AmbitionApp.GetString("party_prompt"));
            }

            ObjectiveText.text = AmbitionApp.GetString("party_objectives");
            HostText.text      = AmbitionApp.GetString("rsvp");
            Seal.sprite        = InvitationConfig.GetSprite("seal." + party.Faction);
            Stamp.sprite       = InvitationConfig.GetSprite(party.Faction.ToLower());
            BodyTxt.text       = party.Invitiation;
        }
Esempio n. 12
0
        public void Execute(ServantVO servant)
        {
            ServantModel model = AmbitionApp.GetModel <ServantModel>();

            model.Introduce(servant);
        }
Esempio n. 13
0
        public bool CheckRequirements(CommodityVO[] requirments)
        {
            GameModel model = AmbitionApp.GetModel <GameModel>();

            foreach (CommodityVO req in requirments)
            {
                switch (req.Type)
                {
                case CommodityType.Item:
                    InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>();
                    ItemVO         item      = inventory.Inventory.Find(i => i.Name == req.ID);
                    if (item == null || item.Quantity < req.Value)
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Livre:
                    if (model.Livre < req.Value)
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Location:
                    ParisModel paris = AmbitionApp.GetModel <ParisModel>();
                    if (!paris.Locations.Contains(req.ID))
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Reputation:
                    FactionModel factions = AmbitionApp.GetModel <FactionModel>();
                    return((req.ID != null && factions.Factions.ContainsKey(req.ID))
                            ? factions[req.ID].Reputation >= req.Value
                            : model.Reputation >= req.Value);

                case CommodityType.Servant:
                    ServantModel servants = AmbitionApp.GetModel <ServantModel>();
                    if (!servants.Servants.ContainsKey(req.ID))
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Date:
                    CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();
                    if (calendar.Today.Ticks < req.Value)
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Mark:
                    MapModel map = AmbitionApp.GetModel <MapModel>();
                    return(Array.Exists(map.Map.Rooms, r => r.HostHere && r.Cleared));
                }
            }
            return(true);
        }