public static bool Prefix(ref MobileParty __instance, PartyTemplateObject pt, MobileParty.PartyTypeEnum partyType, int troopNumberLimit = -1)
        {
            bool result = true;

            if (partyType == MobileParty.PartyTypeEnum.Bandit)
            {
                int num = 0;
                for (int i = 0; i < pt.Stacks.Count; i++)
                {
                    num = Support.Random(pt.Stacks[i].MinValue, pt.Stacks[i].MaxValue);
                    if (num > 0 && pt.Stacks[i].Character != null)
                    {
                        __instance.AddElementToMemberRoster(pt.Stacks[i].Character, num);
                    }
                }
                result = false;
            }
            return(result);
        }
示例#2
0
        public static MobileParty SpawnParty(Settlement spawnedSettlement, Clan clan, PartyTemplateObject templateObject, MobileParty.PartyTypeEnum partyType, TextObject partyName = null)
        {
            //get name and show message.
            TextObject textObject = partyName ?? clan.Name;

            ModDebug.ShowMessage("CustomSpawns: Spawning " + textObject.ToString() + " at " + spawnedSettlement.GatePosition + " in settlement " + spawnedSettlement.Name.ToString());

            //create.
            MobileParty mobileParty = MBObjectManager.Instance.CreateObject <MobileParty>(templateObject.StringId + "_" + 1);

            mobileParty.InitializeMobileParty(textObject, ConstructTroopRoster(templateObject), new TroopRoster(), spawnedSettlement.GatePosition, 0);

            //initialize
            Spawner.InitParty(mobileParty, textObject, clan, spawnedSettlement);

            return(mobileParty);
        }
示例#3
0
        public static MobileParty SpawnParty(Settlement spawnedSettlement, Clan clan, PartyTemplateObject templateObject, MobileParty.PartyTypeEnum partyType, TextObject partyName = null, PartyTemplateObject templatePrisoners = null, bool IsInheritClan = false)
        {
            //get name and show message.
            TextObject textObject = partyName ?? clan.Name;

            ModDebug.ShowMessage("CustomSpawns: Spawning " + textObject.ToString() + " at " + spawnedSettlement.GatePosition + " in settlement " + spawnedSettlement.Name.ToString(), DebugMessageType.Spawn);

            //create.
            MobileParty mobileParty = MBObjectManager.Instance.CreateObject <MobileParty>(templateObject.StringId + "_" + 1);

            if (templatePrisoners != null)
            {
                mobileParty.InitializeMobileParty(textObject, ConstructTroopRoster(templateObject, mobileParty.Party), ConstructTroopRoster(templatePrisoners, mobileParty.Party), spawnedSettlement.GatePosition, 0);
            }
            else
            {
                mobileParty.InitializeMobileParty(textObject, ConstructTroopRoster(templateObject, mobileParty.Party), new TroopRoster(mobileParty.Party), spawnedSettlement.GatePosition, 0);
            }

            //initialize
            Clan settlementClan = spawnedSettlement.OwnerClan;

            if (IsInheritClan == true)
            {
                Spawner.InitParty(mobileParty, textObject, settlementClan, spawnedSettlement);
            }
            else
            {
                Spawner.InitParty(mobileParty, textObject, clan, spawnedSettlement);
            }

            return(mobileParty);
        }