Beispiel #1
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);
        }
Beispiel #2
0
        public void Execute(PlayerConfig config)
        {
            AmbitionApp.RegisterModel <LocalizationModel>();
            AmbitionApp.RegisterModel <GameModel>();
            AmbitionApp.RegisterModel <FactionModel>();
            AmbitionApp.RegisterModel <InventoryModel>();
            AmbitionApp.RegisterModel <ServantModel>();
            AmbitionApp.RegisterModel <CalendarModel>();
            AmbitionApp.RegisterModel <PartyModel>();
            AmbitionApp.RegisterModel <CharacterModel>();
            AmbitionApp.RegisterModel <QuestModel>();
            AmbitionApp.RegisterModel <MapModel>();
            AmbitionApp.RegisterModel <ConversationModel>();
            AmbitionApp.RegisterModel <ParisModel>();

            // Initialize Selected Player
            AmbitionApp.GetModel <GameModel>().PlayerName = config.name;
            CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();

            Array.ForEach(config.Incidents, i => calendar.Schedule(i.Incident));

            AmbitionApp.RegisterCommand <SellItemCmd, ItemVO>(InventoryMessages.SELL_ITEM);
            AmbitionApp.RegisterCommand <BuyItemCmd, ItemVO>(InventoryMessages.BUY_ITEM);
            AmbitionApp.RegisterCommand <GrantRewardCmd, CommodityVO>();
            AmbitionApp.RegisterCommand <GrantRewardsCmd, CommodityVO[]>();
            AmbitionApp.RegisterCommand <CheckMilitaryReputationCmd, FactionVO>();
            AmbitionApp.RegisterCommand <IntroServantCmd, ServantVO>(ServantMessages.INTRODUCE_SERVANT);
            AmbitionApp.RegisterCommand <HireServantCmd, ServantVO>(ServantMessages.HIRE_SERVANT);
            AmbitionApp.RegisterCommand <FireServantCmd, ServantVO>(ServantMessages.FIRE_SERVANT);
            AmbitionApp.RegisterCommand <QuitCmd>(GameMessages.QUIT_GAME);
            AmbitionApp.RegisterCommand <GoToRoomCmd, RoomVO>(MapMessage.GO_TO_ROOM);
            AmbitionApp.RegisterCommand <InvokeMachineCmd, string>(PartyMessages.START_PARTY, "PartyController");
            AmbitionApp.RegisterCommand <UpdatePartyCmd, PartyVO>();
            AmbitionApp.RegisterCommand <SelectDateCmd, DateTime>(CalendarMessages.SELECT_DATE);
            AmbitionApp.RegisterCommand <AdvanceDayCmd>(CalendarMessages.NEXT_DAY);
            AmbitionApp.RegisterCommand <CreateEnemyCmd, string>(GameMessages.CREATE_ENEMY);
            AmbitionApp.RegisterCommand <AdjustFactionCmd, AdjustFactionVO>(FactionConsts.ADJUST_FACTION);
            AmbitionApp.RegisterCommand <EquipItemCmd, ItemVO>(InventoryMessages.EQUIP);
            AmbitionApp.RegisterCommand <UnequipItemCmd, ItemVO>(InventoryMessages.UNEQUIP);
            AmbitionApp.RegisterCommand <UnequipSlotCmd, string>(InventoryMessages.UNEQUIP);
            AmbitionApp.RegisterCommand <AddLocationCmd, string>(ParisMessages.ADD_LOCATION);
            AmbitionApp.RegisterCommand <RemoveLocationCmd, string>(ParisMessages.REMOVE_LOCATION);
            AmbitionApp.RegisterCommand <InvokeMachineCmd, string>(IncidentMessages.START_INCIDENT, "IncidentController");
            AmbitionApp.RegisterCommand <GoToPartyCmd, PartyVO>(PartyMessages.GO_TO_PARTY);
            AmbitionApp.RegisterCommand <RestockMerchantCmd, DateTime>();

            // Party
            AmbitionApp.RegisterCommand <TargetGuestCmd, GuestVO>(PartyMessages.TARGET_GUEST);
            AmbitionApp.RegisterCommand <SelectGuestCmd, GuestVO>(PartyMessages.SELECT_GUEST);
            AmbitionApp.RegisterCommand <EnemyAttackCmd, EnemyVO>(PartyMessages.GUEST_SELECTED);
            AmbitionApp.RegisterCommand <GuestSelectedCmd, GuestVO>(PartyMessages.GUEST_SELECTED);
            AmbitionApp.RegisterCommand <GuestIgnoredCmd, GuestVO>(PartyMessages.GUEST_IGNORED);
            AmbitionApp.RegisterCommand <CharmGuestCmd, GuestVO>(PartyMessages.GUEST_CHARMED);
            AmbitionApp.RegisterCommand <OffendGuestCmd, GuestVO>(PartyMessages.GUEST_OFFENDED);
            AmbitionApp.RegisterCommand <AmbushCmd, RoomVO>(PartyMessages.AMBUSH);
            AmbitionApp.RegisterCommand <FillHandCmd>(PartyMessages.FILL_REMARKS);
            AmbitionApp.RegisterCommand <RefillDrinkCmd>(PartyMessages.REFILL_DRINK);
            AmbitionApp.RegisterCommand <GrantRemarkCmd>(PartyMessages.FREE_REMARK);
            AmbitionApp.RegisterCommand <BurnCmd, int>(PartyMessages.BURN_REMARKS);
            AmbitionApp.RegisterCommand <DiscardCmd, RemarkVO>(PartyMessages.DISCARD);
            AmbitionApp.RegisterCommand <ReshuffleCmd, int>(PartyMessages.RESHUFFLE_REMARKS);
            AmbitionApp.RegisterCommand <DrawCmd, int>(PartyMessages.DRAW_REMARKS);
            AmbitionApp.RegisterCommand <DrawOneCmd>(PartyMessages.DRAW_REMARK);
            AmbitionApp.RegisterCommand <SetFashionCmd, PartyVO>(PartyMessages.PARTY_STARTED);
            AmbitionApp.RegisterCommand <FactionTurnModifierCmd, PartyVO>(PartyMessages.PARTY_STARTED);
            AmbitionApp.RegisterCommand <RoomChoiceCmd, RoomVO>();
            AmbitionApp.RegisterCommand <EndPartyCmd>(PartyMessages.END_PARTY);

            AmbitionApp.RegisterCommand <PayDayCmd, DateTime>();
            AmbitionApp.RegisterCommand <RestockMerchantCmd, DateTime>();
            AmbitionApp.RegisterCommand <CheckLivreCmd, int>(GameConsts.LIVRE);

            // Paris
            AmbitionApp.RegisterCommand <RestAtHomeCmd>(ParisMessages.REST);
            AmbitionApp.RegisterCommand <ChooseLocationCmd, LocationPin>(ParisMessages.GO_TO_LOCATION);
            AmbitionApp.RegisterCommand <LoadLocationCmd>(ParisMessages.LOAD_LOCATION);

            // Initially enabled for TUTORIAL
            AmbitionApp.RegisterCommand <StartTutorialCmd>(GameMessages.START_TUTORIAL);
            AmbitionApp.RegisterCommand <SkipTutorialCmd>(GameMessages.SKIP_TUTORIAL);

            // Rewards
            AmbitionApp.RegisterReward <LivreReward>(CommodityType.Livre);
            AmbitionApp.RegisterReward <RepReward>(CommodityType.Reputation);
            AmbitionApp.RegisterReward <GossipReward>(CommodityType.Gossip);
            AmbitionApp.RegisterReward <EnemyReward>(CommodityType.Enemy);
            AmbitionApp.RegisterReward <ItemReward>(CommodityType.Item);
            AmbitionApp.RegisterReward <ServantReward>(CommodityType.Servant);
            AmbitionApp.RegisterReward <MessageReward>(CommodityType.Message);
            AmbitionApp.RegisterReward <IncidentReward>(CommodityType.Incident);
            AmbitionApp.RegisterReward <LocationReward>(CommodityType.Location);
            AmbitionApp.RegisterReward <PartyReward>(CommodityType.Party);

            AmbitionApp.Execute <RegisterPartyControllerCmd>();
            AmbitionApp.Execute <RegisterConversationControllerCmd>();
            AmbitionApp.Execute <RegisterEstateControllerCmd>();
            AmbitionApp.Execute <RegisterIncidentControllerCmd>();
            AmbitionApp.Execute <RegisterGuestActionControllerCmd>();
            AmbitionApp.Execute <RegisterParisControllerCmd>();

            AmbitionApp.InvokeMachine("EstateController");
        }
Beispiel #3
0
        public void Execute()
        {
            Util.RNG.Randomize();
            // Model, Message, Command, and Loc services registered in StartupInitBehavior
            App.Register <UFlow.UFlowSvc>();
            App.Register <FactorySvc>();
            App.Register <RewardFactorySvc>();
            App.Register <RequirementsSvc>();
            App.Register <ModelSvc>();

            CalendarModel calendar = AmbitionApp.RegisterModel <CalendarModel>();

            AmbitionApp.RegisterModel <LocalizationModel>();
            AmbitionApp.RegisterModel <ParisModel>();
            AmbitionApp.RegisterModel <GossipModel>();
            IncidentModel incidents = AmbitionApp.RegisterModel <IncidentModel>();

#if DEBUG
            AmbitionApp.RegisterModel <ConsoleModel>();
#endif

            // MENU
            AmbitionApp.RegisterCommand <AutosaveCmd>(GameMessages.AUTOSAVE);
            AmbitionApp.RegisterCommand <SaveGameCmd>(GameMessages.SAVE_GAME);
            AmbitionApp.RegisterCommand <ResetGameCmd>(GameMessages.EXIT_GAME);

            AmbitionApp.RegisterCommand <SchedulePartyCmd, PartyVO>(CalendarMessages.SCHEDULE);
            AmbitionApp.RegisterCommand <ScheduleIncidentCmd, IncidentVO>(CalendarMessages.SCHEDULE);
            AmbitionApp.RegisterCommand <ScheduleRendezvousCmd, RendezVO>(CalendarMessages.SCHEDULE);
            AmbitionApp.RegisterCommand <TransitionInputCmd, TransitionVO>(IncidentMessages.TRANSITION);
            AmbitionApp.RegisterCommand <SellItemCmd, ItemVO>(InventoryMessages.SELL_ITEM);
            AmbitionApp.RegisterCommand <SellGossipCmd, GossipVO>(InventoryMessages.SELL_GOSSIP);
            AmbitionApp.RegisterCommand <PeddleInfluenceCmd, GossipVO>(InventoryMessages.PEDDLE_INFLUENCE);
            AmbitionApp.RegisterCommand <BuyItemCmd, ItemVO>(InventoryMessages.BUY_ITEM);
            AmbitionApp.RegisterCommand <DeleteItemCmd, ItemVO>(InventoryMessages.DELETE_ITEM);
            AmbitionApp.RegisterCommand <InitPartyCmd, PartyVO>(PartyMessages.INITIALIZE_PARTY);

            AmbitionApp.RegisterCommand <GrantRewardCmd, CommodityVO>();
            AmbitionApp.RegisterCommand <GrantRewardsCmd, CommodityVO[]>();
            AmbitionApp.RegisterCommand <CheckMilitaryReputationCmd, FactionVO>();
            AmbitionApp.RegisterCommand <IntroServantCmd, string>(ServantMessages.INTRODUCE_SERVANT);
            AmbitionApp.RegisterCommand <HireServantCmd, string>(ServantMessages.HIRE_SERVANT);
            AmbitionApp.RegisterCommand <FireServantCmd, string>(ServantMessages.FIRE_SERVANT);
            AmbitionApp.RegisterCommand <FireServantTypeCmd, ServantType>(ServantMessages.FIRE_SERVANT);
            AmbitionApp.RegisterCommand <SelectDateCmd, DateTime>(CalendarMessages.SELECT_DATE);
            AmbitionApp.RegisterCommand <UpdateGossipModelCmd, CalendarModel>(CalendarMessages.UPDATE_CALENDAR);
            AmbitionApp.RegisterCommand <GenerateInvitationsCmd, CalendarModel>(CalendarMessages.UPDATE_CALENDAR);
            AmbitionApp.RegisterCommand <GenerateRendezvousCmd, CalendarModel>(CalendarMessages.UPDATE_CALENDAR);
            AmbitionApp.RegisterCommand <PoliticalIncidentCmd, CalendarModel>(CalendarMessages.UPDATE_CALENDAR);
            AmbitionApp.RegisterCommand <UpdateStandingsCmd>(FactionMessages.UPDATE_STANDINGS);
            AmbitionApp.RegisterCommand <EquipItemCmd, ItemVO>(InventoryMessages.EQUIP);
            AmbitionApp.RegisterCommand <UnequipItemCmd, ItemVO>(InventoryMessages.UNEQUIP);
            AmbitionApp.RegisterCommand <UnequipItemSlotCmd, ItemType>(InventoryMessages.UNEQUIP);
            AmbitionApp.RegisterCommand <GoToPartyCmd, PartyVO>(PartyMessages.GO_TO_PARTY);
            AmbitionApp.RegisterCommand <CreateGossipCmd, GossipVO>(InventoryMessages.CREATE_GOSSIP);
            AmbitionApp.RegisterCommand <CompleteQuestCmd, QuestVO>(QuestMessages.COMPLETE_QUEST);
            AmbitionApp.RegisterCommand <FailQuestCmd, QuestVO>(QuestMessages.QUEST_FAILED);
            AmbitionApp.RegisterCommand <FailLastQuestCmd>(QuestMessages.QUEST_FAILED);
            AmbitionApp.RegisterCommand <UpdateMerchantCmd>(InventoryMessages.UPDATE_MERCHANT);
            AmbitionApp.RegisterCommand <StartTutorialCmd, string>(TutorialMessages.START_TUTORIAL);
            AmbitionApp.RegisterCommand <EndTutorialCmd, string>(TutorialMessages.END_TUTORIAL);

            // Party
            AmbitionApp.RegisterCommand <RoomChoiceCmd, RoomVO>();
            AmbitionApp.RegisterCommand <ShowRoomCmd, string>(PartyMessages.SHOW_ROOM);

            AmbitionApp.RegisterCommand <IncreaseExhaustionCmd>(GameMessages.ADD_EXHAUSTION);
            AmbitionApp.RegisterCommand <ApplyExhaustionPenaltyCmd>(GameMessages.EXHAUSTION_EFFECT);
            AmbitionApp.RegisterCommand <ApplyOutfitEffectCmd>(GameMessages.OUTFIT_EFFECT);
            AmbitionApp.RegisterCommand <RestAtHomeCmd>(ParisMessages.REST);
            AmbitionApp.RegisterCommand <CheckPerilCmd, int>(GameConsts.PERIL);

            AmbitionApp.RegisterCommand <AcceptInvitationCmd, PartyVO>(PartyMessages.ACCEPT_INVITATION);
            AmbitionApp.RegisterCommand <DeclineInvitationCmd, PartyVO>(PartyMessages.DECLINE_INVITATION);

            AmbitionApp.RegisterCommand <AcceptRendezvousCmd, RendezVO>(PartyMessages.ACCEPT_INVITATION);
            AmbitionApp.RegisterCommand <DeclineRendezvousCmd, RendezVO>(PartyMessages.DECLINE_INVITATION);

            // Paris
            AmbitionApp.RegisterCommand <SelectDailiesCmd, string[]>(ParisMessages.SELECT_DAILIES);
            AmbitionApp.RegisterCommand <ChooseRendezvousCmd, string>(ParisMessages.CHOOSE_LOCATION);
            AmbitionApp.RegisterCommand <ChooseLocationCmd, string>(ParisMessages.CHOOSE_LOCATION);
            AmbitionApp.RegisterCommand <CalculateRendezvousResponseCmd, RendezVO>(RendezvousMessages.CREATE_RENDEZVOUS_RESPONSE);

            // REWARDS
            AmbitionApp.RegisterReward <LivreReward>(CommodityType.Livre);
            AmbitionApp.RegisterReward <GossipReward>(CommodityType.Gossip);
            AmbitionApp.RegisterReward <ItemReward>(CommodityType.Item);
            AmbitionApp.RegisterReward <ServantReward>(CommodityType.Servant);
            AmbitionApp.RegisterReward <MessageReward>(CommodityType.Message);
            AmbitionApp.RegisterReward <IncidentReward>(CommodityType.Incident);
            AmbitionApp.RegisterReward <LocationReward>(CommodityType.Location);
            AmbitionApp.RegisterReward <PartyReward>(CommodityType.Party);
            AmbitionApp.RegisterReward <CredReward>(CommodityType.Credibility);
            AmbitionApp.RegisterReward <PerilReward>(CommodityType.Peril);
            AmbitionApp.RegisterReward <FavorReward>(CommodityType.Favor);
            AmbitionApp.RegisterReward <FactionAllegianceReward>(CommodityType.Allegiance);
            AmbitionApp.RegisterReward <FactionPowerReward>(CommodityType.Power);
            AmbitionApp.RegisterReward <LiaisonReward>(CommodityType.Liaison);
            AmbitionApp.RegisterReward <MiscReward>(CommodityType.Misc);
            AmbitionApp.RegisterReward <TutorialReward>(CommodityType.Tutorial);
            AmbitionApp.RegisterReward <CharacterReward>(CommodityType.Character);
            AmbitionApp.RegisterReward <RendezvousOutfitReward>(CommodityType.RendezvousOutfit);
            AmbitionApp.RegisterReward <QuestReward>(CommodityType.Quest);
            AmbitionApp.RegisterReward <ExhaustionReward>(CommodityType.Exhaustion);
            AmbitionApp.RegisterReward <DateReward>(CommodityType.Date);

            // REQUIREMENTS
            AmbitionApp.RegisterRequirement(CommodityType.Chance, ChanceReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Random, ChanceReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Livre, LivreReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Credibility, CredReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Peril, PerilReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Date, DateReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Item, ItemReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Location, LocationReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Servant, ServantReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Favor, FavorReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Allegiance, FactionAllegianceReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Power, FactionPowerReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Exhaustion, ExhaustionReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Quest, ActiveQuestReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Incident, IncidentReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.OutfitReaction, OutfitReactionReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Liaison, LiaisonReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Misc, MiscReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Rendezvous, RendezvousReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.RendezvousFavor, RendezvousFavorReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.RendezvousOutfit, RendezvousOutfitReq.Check);
            AmbitionApp.RegisterRequirement(CommodityType.Character, CharacterReq.Check);

            AmbitionApp.UFlow.Register <GameFlow>(FlowConsts.GAME_CONTROLLER);
            AmbitionApp.UFlow.Register <PartyFlow>(FlowConsts.PARTY_CONTROLLER);
            AmbitionApp.UFlow.Register <EstateFlow>(FlowConsts.ESTATE_CONTROLLER);
            AmbitionApp.UFlow.Register <IncidentFlow>(FlowConsts.INCIDENT_CONTROLLER);
            AmbitionApp.UFlow.Register <ParisFlow>(FlowConsts.PARIS_CONTROLLER);
            AmbitionApp.UFlow.Register <DayFlow>(FlowConsts.DAY_FLOW_CONTROLLER);
            AmbitionApp.UFlow.Register <RendezvousFlow>(FlowConsts.RENDEZVOUS_CONTROLLER);

            //AmbitionApp.GetService<AssetBundleSvc>().Load(AssetBundleIDs.ON_LOAD, HandleLoaded);
            AmbitionApp.Game.Initialized = true;
        }