Exemplo n.º 1
0
        public void EstablishCamp(MobileParty parentParty)
        {
            var party = MobileParty.Create("main_player_camp:0");

            party.StringId = "main_player_camp:0";
            party.InitializeMobileParty(new TextObject("Player Camp"), new TroopRoster(), new TroopRoster(), MobileParty.MainParty.Position2D, 1f, 0.5f);

            var roster = MobileParty.MainParty.MemberRoster;

            roster.RemoveTroop(Hero.MainHero.CharacterObject);
            party.Party.AddMembers(roster.ToFlattenedRoster());
            roster.Clear();

            party.Party.ItemRoster.Add(MobileParty.MainParty.ItemRoster);
            MobileParty.MainParty.ItemRoster.RemoveAllItems();

            MobileParty.MainParty.AddElementToMemberRoster(Hero.MainHero.CharacterObject, 1);
            party.DisableAi();
            party.Party.Owner = Hero.MainHero;

            _establishedCamp = new PlayerEstablishedCamp
            {
                Party       = party,
                ParentParty = parentParty,
                IsTraining  = false,
            };

            MBTextManager.SetTextVariable("PLAYER_CAMP_RESOURCES", _establishedCamp.Party.GetNumDaysForFoodToLast());
        }
Exemplo n.º 2
0
        public void RemoveCamp()
        {
            if (_establishedCamp == null)
            {
                return;
            }

            var party  = _establishedCamp.Party;
            var parent = _establishedCamp.ParentParty;

            parent.MemberRoster.Add(party.MemberRoster);
            parent.ItemRoster.Add(party.ItemRoster);

            party.RemoveParty();

            _establishedCamp = null;
        }