Esempio n. 1
0
        public static NeutronStar ResumeEncounter(GameDatabase gamedb)
        {
            if (gamedb.AssetDatabase.GetFaction("grandmenaces") == null)
            {
                return((NeutronStar)null);
            }
            NeutronStar neutronStar = new NeutronStar();
            PlayerInfo  playerInfo  = gamedb.GetPlayerInfos().ToList <PlayerInfo>().FirstOrDefault <PlayerInfo>((Func <PlayerInfo, bool>)(x =>
            {
                if (!x.isStandardPlayer)
                {
                    return(x.Name.Contains("NetronStar"));
                }
                return(false);
            }));

            neutronStar.PlayerId = playerInfo == null?gamedb.InsertPlayer("NetronStar", "grandmenaces", new int?(), new Vector3(0.0f), new Vector3(0.0f), "", "\\base\\factions\\grandmenaces\\avatars\\Neutron_Star_Avatar.tga", 0.0, 0, false, false, false, 0, AIDifficulty.Normal) : playerInfo.ID;

            DesignInfo designInfo = gamedb.GetDesignInfosForPlayer(neutronStar.PlayerId).ToList <DesignInfo>().FirstOrDefault <DesignInfo>((Func <DesignInfo, bool>)(x => x.DesignSections[0].FilePath.EndsWith("neutron_star.section")));

            if (designInfo == null)
            {
                DesignInfo design = new DesignInfo(neutronStar.PlayerId, nameof(NeutronStar), new string[1]
                {
                    string.Format("factions\\{0}\\sections\\{1}", (object)"grandmenaces", (object)"neutron_star.section")
                });
                neutronStar._neutronDesignId = gamedb.InsertDesignByDesignInfo(design);
            }
            else
            {
                neutronStar._neutronDesignId = designInfo.ID;
            }
            return(neutronStar);
        }
Esempio n. 2
0
        public static NeutronStar InitializeEncounter(
            GameDatabase gamedb,
            AssetDatabase assetdb)
        {
            if (assetdb.GetFaction("grandmenaces") == null)
            {
                return((NeutronStar)null);
            }
            NeutronStar neutronStar = new NeutronStar();

            neutronStar.PlayerId = gamedb.InsertPlayer("NetronStar", "grandmenaces", new int?(), assetdb.RandomEncounterPrimaryColor, new Vector3(0.0f), "", "\\base\\factions\\grandmenaces\\avatars\\Neutron_Star_Avatar.tga", 0.0, 0, false, false, false, 0, AIDifficulty.Normal);
            DesignInfo design = new DesignInfo(neutronStar.PlayerId, nameof(NeutronStar), new string[1]
            {
                string.Format("factions\\{0}\\sections\\{1}", (object)"grandmenaces", (object)"neutron_star.section")
            });

            neutronStar._neutronDesignId = gamedb.InsertDesignByDesignInfo(design);
            foreach (int towardsPlayerID in gamedb.GetPlayerIDs().ToList <int>())
            {
                gamedb.UpdateDiplomacyState(neutronStar.PlayerId, towardsPlayerID, DiplomacyState.NEUTRAL, 1000, true);
            }
            return(neutronStar);
        }