Пример #1
0
        public void Execute(CommodityVO reward)
        {
            InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>();
            ItemVO         item      = inventory.Instantiate(reward.ID);

            if (item == null)
            {
                ItemConfig config = Resources.Load <ItemConfig>(Filepath.Items + reward.ID);
                inventory.Import(config);
                item = inventory.Instantiate(reward.ID);
            }
            if (item != null)
            {
                if (reward.Value > 0)
                {
                    item.Price = reward.Value;
                }
                item.Created = AmbitionApp.GetModel <CalendarModel>().Today;
                inventory.Inventory.Add(item);
                inventory.Broadcast();
            }
#if DEBUG
            else
            {
                Debug.LogWarningFormat("No inventory template matches reward ID '{0}'; synthesizing one", reward.ID);
            }
#endif
        }
Пример #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);
        }
Пример #3
0
        public void Register(Core.ModelSvc modelService)
        {
            InventoryModel model = modelService.Register <InventoryModel>();

            model.OutOfStyleMultiplier = this.OutOfStyleMultiplier;
            model.SellbackMultiplier   = this.SellbackMultiplier;
            model.NumMarketSlots       = this.NumMarketSlots;
            model.LuxuryLimit          = LuxuriousLimit;
            model.HumbleLimit          = HumbleLimit;
            model.ModestLimit          = ModestyLimit;
            model.RisqueLimit          = RisqueLimit;
            for (int i = Items.Length - 1; i >= 0; --i)
            {
                model.Import(Items[i]);
            }
        }