Esempio n. 1
0
        private void town_menu_granary_on_consequence(MenuCallbackArgs args)
        {
            LocationEncounter locationEncounter = PlayerEncounter.LocationEncounter;

            InventoryManager.OpenScreenAsTrade(this.granaryRoster, Settlement.CurrentSettlement.GetComponent <Town>(), InventoryManager.InventoryCategoryType.Goods, new InventoryManager.DoneLogicExtrasDelegate(this.doneStashDelegate));
            int availableSpace = Settlement.CurrentSettlement.Town.FoodStocksUpperLimit() - (int)Settlement.CurrentSettlement.Town.FoodStocks;

            InformationManager.DisplayMessage(new InformationMessage("Available granary space: " + availableSpace));
        }
Esempio n. 2
0
 private void OnConversationEnded(CharacterObject character)
 {
     if (meetingEncounter != null)
     {
         PlayerEncounter.Finish(false);
         meetingEncounter = null;
         meetingHero      = null;
         AccessTools.Property(typeof(Campaign), "PlayerEncounter").SetValue(Campaign.Current, keepEncounter);
         keepEncounter = null;
         AccessTools.Property(typeof(Campaign), "LocationEncounter").SetValue(Campaign.Current, keepLocation);
         keepLocation = null;
         Hero.MainHero.PartyBelongedTo.CurrentSettlement = keepSettlement;
         keepSettlement = null;
     }
 }
Esempio n. 3
0
        private void StartMeeting(Hero hero)
        {
            var player      = Hero.MainHero;
            var playerParty = player.PartyBelongedTo?.Party;
            var heroParty   = hero.PartyBelongedTo?.Party;

            if (heroParty == null || heroParty == playerParty)
            {
                heroParty = hero.HomeSettlement.Party;
            }

            if (!hero.IsWanderer || heroParty != null)
            {
                keepEncounter  = PlayerEncounter.Current;
                keepLocation   = (LocationEncounter)AccessTools.Property(typeof(Campaign), "LocationEncounter").GetValue(Campaign.Current);
                keepSettlement = player.PartyBelongedTo.CurrentSettlement;
                if (heroParty == null && hero.CurrentSettlement != null)
                {
                    player.PartyBelongedTo.CurrentSettlement = hero.CurrentSettlement;
                }
                PlayerEncounter.Start();
                PlayerEncounter.Current.SetupFields(playerParty, heroParty ?? playerParty);
                meetingEncounter = PlayerEncounter.Current;
                meetingHero      = hero;

                Campaign.Current.TimeControlMode            = CampaignTimeControlMode.Stop;
                Campaign.Current.CurrentConversationContext = ConversationContext.Default;
                AccessTools.Field(typeof(PlayerEncounter), "_mapEventState").SetValue(PlayerEncounter.Current, PlayerEncounterState.Begin);
                AccessTools.Field(typeof(PlayerEncounter), "_stateHandled").SetValue(PlayerEncounter.Current, true);
                AccessTools.Field(typeof(PlayerEncounter), "_meetingDone").SetValue(PlayerEncounter.Current, true);
            }

            ConversationCharacterData playerCharacterData     = new ConversationCharacterData(CharacterObject.PlayerCharacter, playerParty);
            ConversationCharacterData conversationPartnerData = new ConversationCharacterData(hero.CharacterObject, heroParty);

            CampaignMission.OpenConversationMission(playerCharacterData, conversationPartnerData);
        }