override public void OnEnterState() { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); if (!calendar.Timeline.ContainsKey(calendar.Yesterday)) { return; } PartyVO[] parties = calendar.Timeline[calendar.Yesterday].OfType <PartyVO>().Where(p => p.RSVP == RSVP.New).ToArray(); AmbitionApp.GetModel <GameModel>().Reputation -= 40 * parties.Length; foreach (PartyVO party in parties) { Dictionary <string, string> subs = new Dictionary <string, string>() { { "$PARTYNAME", party.Name } }; AmbitionApp.OpenMessageDialog(DialogConsts.MISSED_RSVP_DIALOG, subs); } }
public override void OnEnterState() { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); DateTime today = calendar.Today; List <PartyVO> parties = calendar.GetEvents <PartyVO>(today).Where(p => p.RSVP == RSVP.New).ToList(); if (Util.RNG.Generate(0, 3) == 0) // Chance of a random future engagement { PartyVO party = new PartyVO { InvitationDate = today, Date = today.AddDays(Util.RNG.Generate(1, 8) + Util.RNG.Generate(1, 8)), // +2d8 days RSVP = RSVP.New }; AmbitionApp.Execute <InitPartyCmd, PartyVO>(party); parties.Add(party); } parties.ForEach(p => AmbitionApp.OpenDialog(RSVPDialog.DIALOG_ID, p)); }
public override void OnEnterState() { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); if (calendar.Incident != null) { calendar.IncidentQueue.Pop(); } if (calendar.Incident != null) { AmbitionApp.SendMessage(calendar.Incident); } else { AmbitionApp.SendMessage(IncidentMessages.END_INCIDENTS); } AmbitionApp.SendMessage(AudioMessages.STOP_MUSIC, 2f); }
private void HandleMonth(DateTime month) { CalendarModel model = AmbitionApp.GetModel <CalendarModel>(); List <ICalendarEvent> events; _month = month.AddDays(1 - month.Day); UpdateDays(); foreach (CalendarButton day in Days) { if (model.Timeline.TryGetValue(day.Date, out events)) { foreach (ICalendarEvent e in events) { day.AddParty(e as PartyVO); } } } }
private void HandleParty(PartyVO party) { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); if (party != null && party.Date == calendar.Today) { if (party.RSVP == RSVP.Accepted) { _party = party; } else { List <ICalendarEvent> events; _party = calendar.Timeline.TryGetValue(calendar.Today, out events) ? events.OfType <PartyVO>().FirstOrDefault(p => p.RSVP == RSVP.Accepted) : null; } _text.text = _party != null ? "Go to the Party!" : "Explore Paris"; } }
public void Execute(CommodityVO reward) { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); IncidentVO incident = calendar.FindIncident(reward.ID); if (incident != null) { if (reward.Value > 0) { calendar.Incident = incident; } else { calendar.Schedule(incident); } } else { UnityEngine.Debug.LogWarning(">> WARNING! The requested incident " + reward.ID + " could not be found!"); } }
public void Execute(CommodityVO reward) { if (!string.IsNullOrEmpty(reward.ID)) { IncidentModel story = AmbitionApp.Story; IncidentVO incident = story.LoadIncident(reward.ID, IncidentType.Reward); if (incident != null) { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); if (reward.Value >= 0) { incident.Date = calendar.Today.AddDays(reward.Value); } story.Incidents[reward.ID] = incident; if (incident.IsScheduled) { AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, incident); } } } }
private void HandleCalendarRefresh(CalendarModel calendar) { PartyVO[] parties = calendar.GetOccasions <PartyVO>(); RendezVO[] liaisons = calendar.GetOccasions <RendezVO>(); if (Array.Exists(parties, p => p.IsAttending)) { ExitText.text = AmbitionApp.Localize(LocalizationConsts.EXIT_PARTY); _needsOutfit = true; } else if (Array.Exists(liaisons, r => r.IsAttending)) { ExitText.text = AmbitionApp.Localize(LocalizationConsts.EXIT_RENDEZVOUS); _needsOutfit = true; } else { ExitText.text = AmbitionApp.Localize(LocalizationConsts.EXIT_PARIS); _needsOutfit = false; } }
public void Execute(DateTime date) { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); PartyModel model = AmbitionApp.GetModel <PartyModel>(); PartyVO[] parties = calendar.GetOccasions <PartyVO>(date); RendezVO[] dates = calendar.GetOccasions <RendezVO>(date); if (parties.Length + dates.Length > 0) { PartyVO party = Array.Find(parties, p => p.IsAttending); RendezVO rendez = Array.Find(dates, p => p.IsAttending); if (party != null) { AmbitionApp.OpenDialog(DialogConsts.RSVP, new CalendarEvent[] { party }); } else if (rendez != null) { AmbitionApp.OpenDialog(DialogConsts.RSVP, new CalendarEvent[] { rendez }); } else { List <CalendarEvent> events = new List <CalendarEvent>(parties); events.AddRange(dates); AmbitionApp.OpenDialog(DialogConsts.RSVP, events.ToArray()); } } else if (date.Subtract(calendar.Today).Days >= 1 && AmbitionApp.Paris.Rendezvous.Count > 0) { CharacterModel cModel = AmbitionApp.GetModel <CharacterModel>(); foreach (CharacterVO character in cModel.Characters.Values) { if (character.IsDateable && !character.IsRendezvousScheduled) { AmbitionApp.OpenDialog(DialogConsts.CREATE_RENDEZVOUS, date); break; } } } }
public void Execute(LocationPin location) { ParisModel model = AmbitionApp.GetModel <ParisModel>(); model.Location = location; if (location != null) { if (location.Name() == "Home") { model.Location = null; } else { IncidentVO incident = location.IntroIncidentConfig?.Incident; if (location != null && incident != null && (!location.Visited || !incident.OneShot)) { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); calendar.Incident = location.IntroIncidentConfig.Incident; } location.Visited = true; } } }
public void Execute(CommodityVO reward) { if (reward.ID != null) { PartyConfig config = UnityEngine.Resources.Load <PartyConfig>("Parties/" + reward.ID); if (config != null && config.Party != null) { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); PartyVO party = config.Party; AmbitionApp.Execute <InitPartyCmd, PartyVO>(party); party.RSVP = (RSVP)reward.Value; party.InvitationDate = calendar.Today; if (default(DateTime) == party.Date) { party.Date = calendar.Today; } calendar.Schedule(party); if (party.RSVP == RSVP.Accepted && party.Date == calendar.Today) { AmbitionApp.GetModel <PartyModel>().Party = party; } } else { UnityEngine.Debug.Log("Warning: PartyReward.cs: No party with ID \"" + reward.ID + "\" exists!"); } config = null; UnityEngine.Resources.UnloadUnusedAssets(); } else { UnityEngine.Debug.Log("Warning: PartyReward.cs: No party ID specified!"); } }
public void Execute(string playerID) { GameModel game = AmbitionApp.Game; if (!game.Initialized) { AmbitionApp.Execute <InitGameCmd>(); } IncidentModel incidentModel = AmbitionApp.GetModel <IncidentModel>(); CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); AmbitionApp.Execute <InitPlayerCmd, string>(playerID); List <IncidentVO> incidents = new List <IncidentVO>(incidentModel.Incidents.Values); foreach (IncidentVO incident in incidents) { if (incident.IsScheduled) { incidentModel.Schedule(incident, incident.Date); } } IncidentVO incdent = incidentModel.UpdateIncident(); game.Tutorials = new List <string>() { TutorialConsts.TUTORIAL_INCIDENT, TutorialConsts.TUTORIAL_CREDIBILITY, TutorialConsts.TUTORIAL_EXHAUSTION, TutorialConsts.TUTORIAL_PERIL, TutorialConsts.TUTORIAL_ALLEGIANCE, TutorialConsts.TUTORIAL_POWER, TutorialConsts.TUTORIAL_LIVRE }; AmbitionApp.UFlow.Register <IncidentTutorialController>(TutorialConsts.TUTORIAL_INCIDENT); AmbitionApp.UFlow.Invoke(FlowConsts.GAME_CONTROLLER); AmbitionApp.SendMessage(AudioMessages.STOP_MUSIC); }
private void Awake() { _model = AmbitionApp.GetModel <CalendarModel>(); }
public void Execute(PartyVO party) { CharacterModel characters = AmbitionApp.GetModel <CharacterModel>(); GameModel game = AmbitionApp.Game; CalendarModel calendar = AmbitionApp.Calendar; IncidentModel story = AmbitionApp.Story; PartyModel model = AmbitionApp.GetModel <PartyModel>(); if (string.IsNullOrEmpty(party.ID) || !model.LoadParty(party.ID, out party)) { party.ID = null; if (party.Faction == FactionType.None) { List <FactionType> factions = new List <FactionType>(AmbitionApp.Politics.Factions.Keys); factions.Remove(FactionType.None); party.Faction = RNG.TakeRandom(factions); } } if (string.IsNullOrEmpty(party.Host)) { string gender = RNG.Generate(2) < 1 ? "male" : "female"; string[] host = new string[3]; IEnumerable <string> locs = AmbitionApp.GetPhrases(gender + "_title").Values; host[0] = RNG.TakeRandom(locs); locs = AmbitionApp.GetPhrases(gender + "_name").Values; host[1] = RNG.TakeRandom(locs); locs = AmbitionApp.GetPhrases("last_name").Values; host[2] = RNG.TakeRandom(locs); party.Host = string.Join(" ", host); } if (party.Size == PartySize.None) { ChapterVO chapter = AmbitionApp.Game.GetChapter(); int chance = RNG.Generate(chapter.TrivialPartyChance + chapter.DecentPartyChance + chapter.GrandPartyChance); if (chance < chapter.GrandPartyChance) { party.Size = PartySize.Grand; } else if (chance < chapter.DecentPartyChance + chapter.GrandPartyChance) { party.Size = PartySize.Decent; } else { party.Size = PartySize.Trivial; } } if (party.phrases?.Length != 4) { party.phrases = new int[4]; party.phrases[0] = GetRandomPhrase(PartyConstants.PARTY_REASON + party.Faction.ToString().ToLower()); party.phrases[1] = GetRandomPhrase(PartyConstants.PARTY_FLUFF_INTRO); party.phrases[2] = GetRandomPhrase(PartyConstants.PARTY_FLUFF_ADJECTIVE); party.phrases[3] = GetRandomPhrase(PartyConstants.PARTY_FLUFF_NOUN); } switch (party.RSVP) { case RSVP.Accepted: case RSVP.Required: AmbitionApp.SendMessage(PartyMessages.ACCEPT_INVITATION, party); break; case RSVP.Declined: AmbitionApp.SendMessage(PartyMessages.DECLINE_INVITATION, party); break; default: if (party.Day >= 0) { AmbitionApp.SendMessage(CalendarMessages.SCHEDULE, party); } break; } }
private void SetIncidentTitle() { CalendarModel model = AmbitionApp.GetModel <CalendarModel>(); titleText.text = model.Incident.Name; }
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; }
public void Execute(string savedGameData) { GameModel game = AmbitionApp.Game; if (!game.Initialized) { AmbitionApp.Execute <InitGameCmd>(); } UFlowSvc uflow = AmbitionApp.GetService <UFlowSvc>(); CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); IncidentModel story = AmbitionApp.Story; ParisModel paris = AmbitionApp.Paris; PartyModel partyModel = AmbitionApp.GetModel <PartyModel>(); AmbitionApp.GetService <ModelSvc>().Restore(savedGameData); PlayerConfig config = Resources.Load <PlayerConfig>(Filepath.PLAYERS + game.playerID); AmbitionApp.Execute <RestorePlayerCmd, PlayerConfig>(config); LocationVO location = paris.GetLocation(paris.Location); AmbitionApp.CloseAllDialogs(); AmbitionApp.SendMessage(AudioMessages.STOP_AMBIENT); AmbitionApp.SendMessage(AudioMessages.STOP_MUSIC); uflow.Reset(); story.RestoreIncident(); foreach (string tutorialID in game.Tutorials) { AmbitionApp.Execute <TutorialReward, CommodityVO>(new CommodityVO() { Type = CommodityType.Tutorial, ID = tutorialID }); } UMachine flow = calendar.Day == 0 ? uflow.Instantiate(FlowConsts.GAME_CONTROLLER) : uflow.Instantiate(FlowConsts.DAY_FLOW_CONTROLLER); string sceneID = null; switch (game.Activity) { case ActivityType.Estate: if (story.Moment == null) { flow = RestoreEstate(flow, out sceneID); } else { flow = Restore(flow, MORNING_INCIDENT); } break; case ActivityType.Party: flow = Restore(flow, PARTY_STATE); if (story.Moment == null) { if (partyModel.TurnsLeft > 0) { Restore(flow, PARTY_MAP); sceneID = SceneConsts.MAP_SCENE; } else { Restore(flow, AFTER_PARTY); sceneID = SceneConsts.AFTER_PARTY_SCENE; } } else if (partyModel.Turn < 0) { flow = Restore(flow, PARTY_INTRO); } else if (partyModel.TurnsLeft > 0) { flow = Restore(flow, PARTY_ROOM); } else { flow = Restore(flow, PARTY_OUTTRO); } break; case ActivityType.Evening: flow = Restore(flow, EVENING_STATE); break; case ActivityType.Paris: flow = Restore(flow, PARIS_STATE); if (story.Moment != null) { flow = Restore(flow, PARIS_INCIDENT); } else { sceneID = location?.SceneID ?? SceneConsts.PARIS_SCENE; Restore(flow, sceneID == SceneConsts.PARIS_SCENE ? PARIS_STATE : PARIS_SCENE); } break; case ActivityType.Rendezvous: flow = Restore(flow, RENDEZVOUS_STATE); flow = Restore(flow, RENDEZVOUS_INCIDENT); break; } if (story.Moment != null) { Restore(flow, MOMENT); sceneID = SceneConsts.INCIDENT_SCENE; } if (!string.IsNullOrEmpty(sceneID)) { AmbitionApp.SendMessage(GameMessages.LOAD_SCENE, sceneID); } uflow.Execute(); AmbitionApp.SendMessage(GameMessages.GAME_LOADED); }
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); }
public void Execute() { CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>(); calendar.Today = calendar.DaysFromNow(1); }
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"); }
void OnEnable() { _calendar = AmbitionApp.GetModel <CalendarModel>(); AmbitionApp.Subscribe <PartyVO>(HandleParty); UpdateParties(); }