protected MessageListBox(List<ITheoryElement> items, Mods mod)
        {
            InitializeComponent();

            this.mod = mod;
            if (mod == Mods.Edit)
            {
                MessageBoxListEditPanel panel = new MessageBoxListEditPanel(items);
                Box.Content = panel;
            }
            else if (mod == Mods.Choose)
            {
                typeOfElement = typeof(ITheoryElement);
                ListBox listbox = new ListBox();
                ListBoxItem item;
                foreach (ITheoryElement element in items)
                {
                    item = new ListBoxItem();
                    item.Content = element;
                    //item.Content = type;
                    listbox.Items.Add(item);
                }
                listbox.SelectionChanged += new SelectionChangedEventHandler(Listbox_SelectionChanged);
                Box.Content = listbox;
            }
        }
 protected MessageListBox(List<TheoryTypes> items, Mods mod)
 {
     InitializeComponent();
     this.mod = mod;
     if (mod == Mods.Edit)
     {
         throw new NotImplementedException("Так вот.");
     }
     else if (mod == Mods.Choose)
     {
         typeOfElement = typeof(TheoryTypes);
         ListBox listbox = new ListBox();
         ListBoxItem item;
         foreach (TheoryTypes type in items)
         {
             item = new ListBoxItem();
             item.Name = type.ToString();
             item.Content = type;
             listbox.Items.Add(item);
         }
         listbox.SelectionChanged += new SelectionChangedEventHandler(Listbox_SelectionChanged);
         Box.Content = listbox;
     }
     LanguageResource_Updated(null);
 }
Example #3
0
 // Token: 0x060020B6 RID: 8374
 // RVA: 0x000BD78C File Offset: 0x000BB98C
 public override Mods[] vmethod_0()
 {
     Mods[] array = new Mods[Class461.mods_0.Length];
     for (int i = 0; i < Class461.mods_0.Length; i++)
     {
         array[i] = (this.mods_1 | Class461.mods_0[i]);
     }
     return array;
 }
Example #4
0
 // Token: 0x06000E12 RID: 3602
 // RVA: 0x0000EA0A File Offset: 0x0000CC0A
 public Class12(bStatus bStatus_1, bool bool_0, string string_2, string string_3, int int_1, Mods mods_1, PlayModes playModes_1)
 {
     this.bStatus_0 = bStatus_1;
     this.string_0 = string_3;
     this.string_1 = string_2;
     this.mods_0 = mods_1;
     this.playModes_0 = playModes_1;
     this.int_0 = int_1;
 }
Example #5
0
 // Token: 0x060020B4 RID: 8372
 // RVA: 0x0001AB0A File Offset: 0x00018D0A
 public Class463(Class296 class296_1, Mods mods_2)
     : base(class296_1)
 {
     if (class296_1.method_5() == PlayModes.OsuMania)
     {
         mods_2 = Mods.None;
     }
     this.mods_1 = mods_2;
 }
Example #6
0
 // Token: 0x060028DD RID: 10461
 // RVA: 0x00101C30 File Offset: 0x000FFE30
 internal Class661(int int_4, Class861 class861_1, MatchScoringTypes matchScoringTypes_1, PlayModes playModes_1, SlotTeams slotTeams_1, Mods mods_1)
     : base(int_4, class861_1.Name, playModes_1)
 {
     base.method_1(slotTeams_1);
     this.class861_0 = class861_1;
     this.matchScoringTypes_0 = matchScoringTypes_1;
     this.mods_0 = mods_1;
     for (int i = 0; i < this.list_0.Count; i++)
     {
         Class531 class = this.list_0[i];
 public CreateElementPanel(Core.Session session)
 {
     InitializeComponent();
     this.currentSession = session;
     basis = new List<ITheoryElement>();
     TheoryTypeBox.Text = type.ToString();
     LinksItemBox.ItemsSource = basis;
     mod = Mods.Create;
     LanguageResource.Updated += new Updated(LanguageResource_Updated);
     FormulationTextBox.Focus();
     LanguageResource_Updated(null);
 }
Example #8
0
 // Token: 0x06002AA5 RID: 10917
 // RVA: 0x00113CD0 File Offset: 0x00111ED0
 public Class692(Vector2 vector2_0, Mods[] mods_1)
 {
     EventHandler eventHandler = null;
     this.list_0 = new List<Class531>();
     base..ctor();
     this.list_1 = new List<Mods>(mods_1);
     int i = 0;
     while (i < mods_1.Length)
     {
         Mods mods = mods_1[i];
         string string_ = "selection-mod-" + mods.ToString().ToLower();
         Class531 class = new Class531(Class885.Load(string_, Enum112.flag_6), Enum115.const_5, Origins.Centre, Enum114.const_0, vector2_0, 0.94f, true, Color.get_TransparentWhite(), null);
Example #9
0
 private unsafe void ParseSets(Mods* set, int count)
 {
     DoodadSets = new List<DoodadSet>(count);
     for (int i = 0; i < count; i++)
     {
         DoodadSets.Add(new DoodadSet
         {
             Name = MiscUtils.ConvertToAscii(set->name, Mods.NameLength),
             FirstDefinition = set->firstInstanceIndex,
             DefinitionCount = set->instanceCount
         });
         set++;
     }
 }
Example #10
0
 // Token: 0x060020A2 RID: 8354
 // RVA: 0x000BD190 File Offset: 0x000BB390
 public static Mods smethod_1(Mods mods_1, PlayModes playModes_0, Class296 class296_1)
 {
     switch (playModes_0)
     {
     case PlayModes.Taiko:
         return mods_1 & Class465.smethod_2();
     case PlayModes.CatchTheBeat:
         return mods_1 & Class462.smethod_2();
     case PlayModes.OsuMania:
         return Class421.smethod_5(class296_1, mods_1) & Class463.smethod_2();
     default:
         return mods_1 & Class464.smethod_2();
     }
 }
Example #11
0
        void build(Build type)
        {
            // :)
            Random rand = new Random();
            if (rand.Next(0, 1000000) % 1000 == 0)
                status.Text = "Infiltrating Rebel forces....";
            else
                status.Text = "Working...";

            Mods mods = new Mods();

            if (wallhack.Checked)
                mods.wallhack = 0x38C0FFFF;

            if (steadyAim.Checked)
                mods.steady_aim = 0x2C040000;

            if (noRecoil.Checked)
                mods.no_recoil = 0x60000000;

            if (vsat.Checked)
                mods.vsat = 0x60000000;

            if (loadSPRX.Checked && !string.IsNullOrEmpty(sprxName.Text))
                mods.load_sprx = sprxName.Text;

            if (fpsCheckbox.Checked)
                mods.fps = 0x60000000;

            if (weaponsFlag.Checked)
                mods.weapons_flag = 0x38C0FFFF;

            if (deadBodiesFlag.Checked)
                mods.dead_bodies_flag = 0x38C0FFFF;

            switch (Functions.compile(eboot_buffer, mods, Build.npeb_debug))
            {
                case "good":
                    status.Text = "Successfully created EBOOT";
                    break;
                case "nodir":
                    status.Text = "ERROR: \"tools\" directory is missing. Please redownload and extract all files and folders!";
                break;
                case "noeboot":
                    status.Text = "ERROR: Failed to build EBOOT. Please try again.";
                break;
            }
        }
Example #12
0
 // Token: 0x06000E13 RID: 3603
 // RVA: 0x0004DAD0 File Offset: 0x0004BCD0
 public Class12(Class32 class32_0)
 {
     this.bStatus_0 = (bStatus)class32_0.ReadByte();
     this.string_1 = class32_0.ReadString();
     this.string_0 = class32_0.ReadString();
     if (Class213.int_0 > 10)
     {
         this.mods_0 = (Mods)class32_0.ReadUInt32();
     }
     else
     {
         this.mods_0 = (Mods)class32_0.ReadInt16();
     }
     this.playModes_0 = (PlayModes)Math.Max(0, Math.Min(3, class32_0.ReadByte()));
     this.int_0 = class32_0.ReadInt32();
 }
        public CreateElementPanel(ITheoryElement element, List<ITheoryElement> basis, Core.Session session, TheoryTree tree)
        {
            InitializeComponent();
            this.element = element;
            this.basis = basis;
            this.currentSession = session;
            this.type = element.GetTheoryType();
            this.tree = tree;

            TheoryTypeBox.Text = type.ToString();
            LinksItemBox.ItemsSource = basis;
            FormulationTextBox.Text = element.Formulation;
            TemplateTextBox.Text = element.Template;
            if (element is Theorem)
                ProofTextBox.Text = ((Theorem)element).Proof;
            mod = Mods.Edit;
            LanguageResource.Updated += new Updated(LanguageResource_Updated);
            Update();
            LanguageResource_Updated(null);
        }
Example #14
0
 // Token: 0x060033AB RID: 13227
 // RVA: 0x001616F4 File Offset: 0x0015F8F4
 public static bool smethod_3(Mods mods_0)
 {
     if (Class62.Mode == PlayModes.OsuMania)
     {
         if (Class876.smethod_6(Mods.HardRock | Mods.Random, mods_0))
         {
             return false;
         }
         if (Class876.smethod_6(Mods.KeyCoop, mods_0))
         {
             return false;
         }
         if (Class466.Current.method_5() == PlayModes.Osu)
         {
             int num = Class421.smethod_3(Class466.Current, mods_0);
             if (num < 4 || num > 8)
             {
                 return false;
             }
         }
     }
     return !Class876.smethod_6(Mods.Autoplay, mods_0) && !Class876.smethod_6(Mods.Target, mods_0);
 }
Example #15
0
 IEnumerable <string> GetAllContainedMods() => Mods.Concat(AdditionalMods);
Example #16
0
        /// <summary>
        /// Calculates beatmap difficulty and stores it in total, aim, speed, nsingles, nsingles_speed fields.
        /// </summary>
        /// <param name="mods"></param>
        /// <param name="singletapThreshold">
        /// The smallest milliseconds interval that will be considered singletappable. for example, 125ms is 240 1/2
        /// singletaps ((60000 / 240) / 2)
        /// </param>
        /// <returns>Itself</returns>
        public DiffCalc Calc(Mods mods, double singletapThreshold)
        {
            Reset();

            var mapstats = new MapStats {
                CS = Beatmap.CS
            };

            mapstats = MapStats.ModsApply(mods, mapstats, ModApplyFlags.ApplyCS);
            speedMul = mapstats.Speed;

            double radius = (PlayfieldWidth / 16.0) * (1.0 - 0.7 * (mapstats.CS - 5.0) / 5.0);

            //positions are normalized on circle radius so that we can calc as if everything was the same circlesize
            double scalingFactor = 52.0 / radius;

            if (radius < CirclesizeBuffThreshold)
            {
                scalingFactor *= 1.0 + Math.Min(CirclesizeBuffThreshold - radius, 5.0) / 50.0;
            }

            Vector2 normalizedCenter = new Vector2(PlayfieldCenter) * scalingFactor;

            //calculate normalized positions
            for (int i = 0; i < Beatmap.Objects.Count; i++)
            {
                HitObject obj = Beatmap.Objects[i];

                if ((obj.Type & HitObjectType.Spinner) != 0)
                {
                    obj.Normpos = new Vector2(normalizedCenter);
                }
                else
                {
                    Vector2 pos;

                    if ((obj.Type & HitObjectType.Slider) != 0)
                    {
                        pos = ((Slider)obj.Data).Position;
                    }
                    else if ((obj.Type & HitObjectType.Circle) != 0)
                    {
                        pos = ((Circle)obj.Data).Position;
                    }
                    else
                    {
                        //TODO: warn $"W: unknown object type {obj.Type:X8}\n"
                        pos = new Vector2();
                    }

                    obj.Normpos = new Vector2(pos) * scalingFactor;
                }

                if (i >= 2)
                {
                    var     prev1 = Beatmap.Objects[i - 1];
                    var     prev2 = Beatmap.Objects[i - 2];
                    Vector2 v1    = prev2.Normpos - prev1.Normpos;
                    Vector2 v2    = obj.Normpos - prev1.Normpos;
                    double  dot   = Vector2.Dot(v1, v2);
                    double  det   = v1.X * v2.Y - v1.Y * v2.X;
                    obj.Angle = Math.Abs(Math.Atan2(det, dot));
                }
                else
                {
                    obj.Angle = double.NaN;
                }
            }

            //speed and aim stars
            Speed = CalcIndividual(StrainType.Speed);
            Aim   = CalcIndividual(StrainType.Aim);

            Speed = Math.Sqrt(Speed) * StarScalingFactor;
            Aim   = Math.Sqrt(Aim) * StarScalingFactor;
            if ((mods & Mods.TouchDevice) != 0)
            {
                Aim = Math.Pow(Aim, 0.8);
            }

            //total stars
            Total = Aim + Speed + Math.Abs(Speed - Aim) * ExtremeScalingFactor;

            //singletap stats
            for (int i = 1; i < Beatmap.Objects.Count; ++i)
            {
                HitObject prev = Beatmap.Objects[i - 1];
                HitObject curr = Beatmap.Objects[i];

                if (curr.IsSingle)
                {
                    CountSingles++;
                }

                if ((curr.Type & (HitObjectType.Circle | HitObjectType.Slider)) == 0)
                {
                    continue;
                }

                double interval = (curr.Time - prev.Time) / speedMul;

                if (interval >= singletapThreshold)
                {
                    CountSinglesThreshold++;
                }
            }

            return(this);
        }
 private void OpenModsFolder()
 {
     Mods.InitLocalDirectory();
     Game.Network.OpenFileBrowser(Path.Combine(App.SavePath, "mods"));
 }
Example #18
0
                       ar_ms_step2 = 150; // ar5-10

        public Dictionary <string, float> ApplyMods(Beatmap map, Mods mods)
        {
            float  od       = map.OverallDifficulty;
            float  ar       = map.ApproachRate;
            float  cs       = map.CircleSize;
            float  hp       = map.HpDrainRate;
            double minBpm   = map.MinBpm;
            double maxBpm   = map.MaxBpm;
            var    retValue = new Dictionary <string, float>();

            if ((mods & Mods.MapChanging) == 0)
            {
                retValue.Add("AR", ar);
                retValue.Add("CS", cs);
                retValue.Add("OD", od);
                retValue.Add("HP", hp);
                retValue.Add("MinBpm", (float)minBpm);
                retValue.Add("MaxBpm", (float)maxBpm);
                return(retValue);
            }

            float speed = 1;

            if ((mods & Mods.Dt) != 0 || (mods & Mods.Nc) != 0)
            {
                speed *= 1.5f;
            }
            if ((mods & Mods.Ht) != 0)
            {
                speed *= 0.75f;
            }

            float od_multiplier = 1;

            if ((mods & Mods.Hr) != 0)
            {
                od_multiplier *= 1.4f;
            }
            if ((mods & Mods.Ez) != 0)
            {
                od_multiplier *= 0.5f;
            }

            od *= od_multiplier;
            float odms = od0_ms - (float)Math.Ceiling(od_ms_step * od);

            //hp
            if ((mods & Mods.Ez) != 0)
            {
                hp *= 0.5f;
            }
            else if ((mods & Mods.Hr) != 0)
            {
                hp *= 1.4f;
            }

            //bpm
            double modifier = 1;

            if ((mods & Mods.Dt) != 0)
            {
                modifier *= 1.5;
            }
            else if ((mods & Mods.Ht) != 0)
            {
                modifier *= 0.75;
            }

            minBpm *= modifier;
            maxBpm *= modifier;

            //ar
            float ar_multiplier = 1;

            if ((mods & Mods.Hr) != 0)
            {
                ar_multiplier *= 1.4f;
            }
            if ((mods & Mods.Ez) != 0)
            {
                ar_multiplier *= 0.5f;
            }

            ar *= ar_multiplier;
            float arms = ar <= 5
            ? (ar0_ms - ar_ms_step1 * ar)
            : (ar5_ms - ar_ms_step2 * (ar - 5));

            //cs
            float cs_multiplier = 1;

            if ((mods & Mods.Hr) != 0)
            {
                cs_multiplier *= 1.3f;
            }
            if ((mods & Mods.Ez) != 0)
            {
                cs_multiplier *= 0.5f;
            }

            // stats must be capped to 0-10 before HT/DT which bring them to a range
            // of -4.42 to 11.08 for OD and -5 to 11 for AR
            odms = Math.Min(od0_ms, Math.Max(od10_ms, odms));
            arms = Math.Min(ar0_ms, Math.Max(ar10_ms, arms));

            // apply speed-changing mods
            odms /= speed;
            arms /= speed;

            // convert OD and AR back into their stat form
            //od = (-(odms - od0_ms)) / od_ms_step;
            od = (od0_ms - odms) / od_ms_step;
            ar = ar <= 5.0f
                ? ((ar0_ms - arms) / ar_ms_step1)
                : (5.0f + (ar5_ms - arms) / ar_ms_step2);

            cs *= cs_multiplier;
            cs  = Math.Max(0.0f, Math.Min(10.0f, cs));

            retValue.Add("AR", ar);
            retValue.Add("CS", cs);
            retValue.Add("OD", od);
            retValue.Add("HP", hp);
            retValue.Add("MinBpm", (float)minBpm);
            retValue.Add("MaxBpm", (float)maxBpm);
            if ((mods & Mods.SpeedChanging) == 0)
            {
                return(retValue);
            }

            return(retValue);
        }
Example #19
0
 /// <summary>
 /// Sets beatmap field and calls <see cref="Calc(Mods, double)"/>
 /// </summary>
 public DiffCalc Calc(Beatmap beatmap, Mods mods, double singletapThreshold)
 {
     Beatmap = beatmap;
     return(Calc(mods, singletapThreshold));
 }
Example #20
0
 public void Add(EquipmentSetMod mod)
 {
     Mods.Add(mod);
 }
Example #21
0
 public bool Remove(EquipmentSetMod mod)
 {
     return(Mods.Remove(mod));
 }
 public void RemoveFileLink(IVirtualModLink p_ivlVirtualLink, Mods.IMod p_modMod)
 {
     throw new NotImplementedException();
 }
Example #23
0
 // Token: 0x06000DFE RID: 3582
 // RVA: 0x0004D28C File Offset: 0x0004B48C
 public bMatch(MatchTypes matchTypes_0, MatchScoringTypes matchScoringTypes_0, MatchTeamTypes matchTeamTypes_0, PlayModes playModes_0, string string_0, string string_1, int int_0, string string_2, string string_3, int int_1, Mods mods_0, int int_2, MultiSpecialModes multiSpecialModes_0, int int_3)
 {
     this.matchType = matchTypes_0;
     this.playMode = playModes_0;
     this.matchScoringType = matchScoringTypes_0;
     this.matchTeamType = matchTeamTypes_0;
     this.gameName = string_0;
     this.gamePassword = string_1;
     this.beatmapName = string_2;
     this.beatmapChecksum = string_3;
     this.beatmapId = int_1;
     this.activeMods = mods_0;
     this.hostId = int_2;
     this.specialModes = multiSpecialModes_0;
     this.Seed = int_3;
     this.SendPassword = true;
     for (int i = 0; i < bMatch.smethod_0(); i++)
     {
         this.slotStatus[i] = ((i < int_0) ? SlotStatus.flag_0 : SlotStatus.flag_1);
         this.slotId[i] = -1;
     }
     if (string_0.Length > 50)
     {
         string_0 = string_0.Remove(50);
     }
 }
 public void LogIniEdits(Mods.IMod p_modMod, string p_strSettingsFileName, string p_strSection, string p_strKey, string p_strValue)
 {
     throw new NotImplementedException();
 }
 public void RemoveFileLink(string p_strFilePath, Mods.IMod p_modMod)
 {
     throw new NotImplementedException();
 }
 public void FinalizeModDeactivation(Mods.IMod p_modMod)
 {
     throw new NotImplementedException();
 }
 public void EnableMod(Mods.IMod p_modMod)
 {
     throw new NotImplementedException();
 }
 public void DisableModFiles(Mods.IMod p_modMod)
 {
     throw new NotImplementedException();
 }
Example #29
0
 // Token: 0x0600215A RID: 8538
 // RVA: 0x0001AFA8 File Offset: 0x000191A8
 public static double smethod_8(double double_0, Mods mods_0)
 {
     if (Class876.smethod_6(mods_0, Mods.DoubleTime))
     {
         return double_0 / 1.5;
     }
     if (Class876.smethod_6(mods_0, Mods.HalfTime))
     {
         return double_0 / 0.75;
     }
     return double_0;
 }
Example #30
0
 // Token: 0x06000DFF RID: 3583
 // RVA: 0x0004D394 File Offset: 0x0004B594
 public bMatch(Class32 class32_0)
 {
     this.SendPassword = false;
     this.matchId = (int)class32_0.ReadUInt16();
     this.inProgress = class32_0.ReadBoolean();
     this.matchType = (MatchTypes)class32_0.ReadByte();
     this.activeMods = (Mods)class32_0.ReadUInt32();
     this.gameName = class32_0.ReadString();
     this.gamePassword = class32_0.ReadString();
     this.beatmapName = class32_0.ReadString();
     this.beatmapId = class32_0.ReadInt32();
     this.beatmapChecksum = class32_0.ReadString();
     for (int i = 0; i < bMatch.smethod_0(); i++)
     {
         this.slotStatus[i] = (SlotStatus)class32_0.ReadByte();
     }
     for (int j = 0; j < bMatch.smethod_0(); j++)
     {
         this.slotTeam[j] = (SlotTeams)class32_0.ReadByte();
     }
     for (int k = 0; k < bMatch.smethod_0(); k++)
     {
         this.slotId[k] = (((this.slotStatus[k] & SlotStatus.flag_7) > (SlotStatus)0) ? class32_0.ReadInt32() : -1);
     }
     this.hostId = class32_0.ReadInt32();
     this.playMode = (PlayModes)class32_0.ReadByte();
     this.matchScoringType = (MatchScoringTypes)class32_0.ReadByte();
     this.matchTeamType = (MatchTeamTypes)class32_0.ReadByte();
     this.specialModes = (MultiSpecialModes)class32_0.ReadByte();
     if (this.gameName.Length > 50)
     {
         this.gameName = this.gameName.Remove(50);
     }
     if ((this.specialModes & MultiSpecialModes.FreeMod) > MultiSpecialModes.None)
     {
         for (int l = 0; l < bMatch.smethod_0(); l++)
         {
             this.slotMods[l] = (Mods)class32_0.ReadInt32();
         }
     }
     this.Seed = class32_0.ReadInt32();
 }
 public bool CheckHasActiveLinks(Mods.IMod p_modMod)
 {
     throw new NotImplementedException();
 }
        public void SimpleConsoleInputHandler()
        {
            MinecraftModUpdater.Logger.Log(Logger.Level.Info, "Simple Console Input Handler is online and ready.  \r\nEnter \"help\" for a list of commands.");
            while (Online)
            {
                string input = Console.ReadLine();
                if (!Online)
                {
                    break;
                }
                switch (input)
                {
                case "connected":
                    MinecraftModUpdater.Logger.Log(Logger.Level.Info, "There are {0} connected clients.", Clients.Count);
                    if (Clients.Count > 0)
                    {
                        MinecraftModUpdater.Logger.Log(Logger.Level.Info, "Connected Clients:");
                        foreach (Client c in Clients)
                        {
                            MinecraftModUpdater.Logger.Log(Logger.Level.Info, c.ToString());
                        }
                    }
                    break;

                case "exit":
                case "stop":
                    foreach (Client c in Clients)
                    {
                        Packet.Send(new MetadataPacket {
                            SData = new string[] { "shutdown", "The Server is shutting down." }
                        }, c.PacketHandler.Stream);
                    }
                    if (Clients.Count > 0)
                    {
                        MinecraftModUpdater.Logger.Log(Logger.Level.Info, "Waiting for {0} clients to exit.", Clients.Count);
                    }
                    while (Clients.Count > 0)
                    {
                        Thread.Sleep(500);
                    }
                    Dispose();
                    break;

                case "populate":
                    foreach (string s in Directory.GetFiles(Config.ModsPath + "/mods"))
                    {
                        Mod m = new Mod
                        {
                            Author           = "null",
                            Description      = "",
                            FileSize         = 0,
                            ModFile          = "mods/" + Path.GetFileName(s),
                            ModName          = Path.GetFileName(s),
                            BlacklistedUsers = new List <string>(),
                            WhitelistedUsers = new List <string>(),
                            PostDownloadCLI  = new string[0],
                            Identifier       = Extras.GenerateHashFromString(Path.GetFileName(s)),
                            ConfigFile       = Config.ModsPath + "/xml/" + Path.GetFileName(s) + ".xml",
                            RequiredMods     = new List <Mod>()
                        };
                        m.Save();
                    }
                    Mods.Clear();
                    ModImages.Clear();
                    LoadMods();
                    break;

                case "help":
                case "?":
                default:
                    MinecraftModUpdater.Logger.Log(Logger.Level.Info, "exit, stop - Safely stops the update server after all clients exit.");
                    MinecraftModUpdater.Logger.Log(Logger.Level.Info, "connected - Shows a list of connected clients.");
                    MinecraftModUpdater.Logger.Log(Logger.Level.Info, "populate - Automagicly reads all of the files in the mods folder and creates XML files for them.");
                    break;
                }
            }
        }
Example #33
0
 public void AddRange(IEnumerable <EquipmentSetMod> mods)
 {
     Mods.AddRange(mods);
 }
Example #34
0
        /// <summary>
        /// Translate osu mods to string
        /// </summary>
        /// <param name="mods">Osu mods</param>
        /// <returns></returns>
        public string ModsToString(Mods mods)
        {
            StringBuilder sb = new StringBuilder(20);

            if (mods is Mods.None)
            {
                return(" NM");
            }

            if (mods.HasFlag(Mods.NoFail))
            {
                sb.Append(" NF");
            }

            if (mods.HasFlag(Mods.Easy))
            {
                sb.Append(" EZ");
            }

            if (mods.HasFlag(Mods.TouchDevice))
            {
                sb.Append(" TD");
            }

            if (mods.HasFlag(Mods.Hidden))
            {
                sb.Append(" HD");
            }

            if (mods.HasFlag(Mods.HardRock))
            {
                sb.Append(" HR");
            }

            if (mods.HasFlag(Mods.SuddenDeath))
            {
                sb.Append(" SD");
            }

            if (mods.HasFlag(Mods.DoubleTime))
            {
                sb.Append(" DT");
            }

            if (mods.HasFlag(Mods.Relax))
            {
                sb.Append(" RX");
            }

            if (mods.HasFlag(Mods.HalfTime))
            {
                sb.Append(" HT");
            }

            if (mods.HasFlag(Mods.Nightcore))
            {
                sb.Append(" NC");
            }

            if (mods.HasFlag(Mods.Flashlight))
            {
                sb.Append(" FL");
            }

            if (mods.HasFlag(Mods.Autoplay))
            {
                sb.Append(" Auto");
            }

            if (mods.HasFlag(Mods.Relax2))
            {
                sb.Append(" AP");
            }

            if (mods.HasFlag(Mods.Perfect))
            {
                sb.Append(" PF");
            }

            if (mods.HasFlag(Mods.Key1))
            {
                sb.Append(" K1");
            }

            if (mods.HasFlag(Mods.Key2))
            {
                sb.Append(" K2");
            }

            if (mods.HasFlag(Mods.Key3))
            {
                sb.Append(" K3");
            }

            if (mods.HasFlag(Mods.Key4))
            {
                sb.Append(" K4");
            }

            if (mods.HasFlag(Mods.Key5))
            {
                sb.Append(" K5");
            }

            if (mods.HasFlag(Mods.Key6))
            {
                sb.Append(" K6");
            }

            if (mods.HasFlag(Mods.Key7))
            {
                sb.Append(" K7");
            }

            if (mods.HasFlag(Mods.Key8))
            {
                sb.Append(" K8");
            }

            if (mods.HasFlag(Mods.Key9))
            {
                sb.Append(" K9");
            }

            if (mods.HasFlag(Mods.FadeIn))
            {
                sb.Append(" FI");
            }

            if (mods.HasFlag(Mods.Cinema))
            {
                sb.Append(" Cinema");
            }

            if (mods.HasFlag(Mods.Random))
            {
                sb.Append(" Random");
            }

            if (mods.HasFlag(Mods.Target))
            {
                sb.Append(" Target Practice");
            }

            if (mods.HasFlag(Mods.KeyCoop))
            {
                sb.Append(" KeyCoop");
            }

            if (mods.HasFlag(Mods.ScoreV2))
            {
                sb.Append(" ScoreV2");
            }

            if (mods.HasFlag(Mods.Mirror))
            {
                sb.Append(" Mirror");
            }

            return(sb.ToString());
        }
Example #35
0
 public IEnumerable <EquipmentSetMod> FindAvailableMods(Mobile m, EquipmentSetPart[] equipped)
 {
     return(Mods.Where(mod => equipped.Length >= mod.PartsRequired));
 }
 public ModLoadSetting GetTopPriorityEnabledMod()
 {
     return(Mods
            .OrderBy(setting => setting, new LoadOrderComparer())
            .FirstOrDefault());
 }
Example #37
0
 /// <returns>
 /// <see cref="Calc(Mods,double)"/> with <seealso cref="DefaultSingletapThreshold"/> as second parameter
 /// </returns>
 public DiffCalc Calc(Mods mods) => Calc(mods, DefaultSingletapThreshold);
Example #38
0
 public static bool IsModInstalled(string modId)
 {
     return(Mods.ContainsKey(modId) && Mods[modId].RequiresMods.All(IsModInstalled));
 }
Example #39
0
 /// <summary>
 /// Sets beatmap field and calls <see cref="Calc(Mods, double)"/> with
 /// <seealso cref="DefaultSingletapThreshold"/> as second parameter
 /// </summary>
 public DiffCalc Calc(Beatmap beatmap, Mods mods) => Calc(beatmap, mods, DefaultSingletapThreshold);
 public TestCaseSpinnerHidden()
 {
     Mods.Add(new OsuModHidden());
 }
        protected override void OnUpdate(float dt)
        {
            base.OnUpdate(dt);

            // Refresh GUI if mods change
            if (!m_editor && Mods.Refresh(Game.Network))
            {
                bool needsLoad = false;
                foreach (var mod in Mods.RemovedLoadedMods)
                {
                    Assets.RemoveSource(mod.Assets);
                    mod.Loaded = false;
                    needsLoad  = true;
                }
                foreach (var mod in Mods.AllMods)
                {
                    if (mod.AutoLoad && !mod.Loaded)
                    {
                        Assets.AddSource(mod.Assets);
                        mod.Loaded = true;
                        needsLoad  = true;
                    }
                }

                if (needsLoad)
                {
                    LoadToState(delegate()
                    {
                        return(new CampaignSelectState(Game));
                    });
                    return;
                }
                else
                {
                    m_campaigns.Refresh();
                }
            }

            // Update GUI
            ShowSelectPrompt    = m_campaigns.Highlight >= 0 && (Game.Screen.InputMethod != InputMethod.Mouse);
            ShowAltSelectPrompt = m_campaigns.HighlightedAction != CampaignThumbnailAction.None && (Game.Screen.InputMethod != InputMethod.Mouse);
            switch (m_campaigns.HighlightedAction)
            {
            case CampaignThumbnailAction.Delete:
            {
                AltSelectPrompt = "menus.mod_select.delete";
                break;
            }

            case CampaignThumbnailAction.Edit:
            {
                AltSelectPrompt = "menus.mod_select.edit";
                break;
            }

            case CampaignThumbnailAction.ShowInWorkshop:
            {
                AltSelectPrompt = "menus.mod_editor.open_workshop";
                break;
            }
            }
        }
Example #42
0
        public static void InitializeMod(string mod, Arguments args)
        {
            // Clear static state if we have switched mods
            LobbyInfoChanged       = () => { };
            ConnectionStateChanged = om => { };
            BeforeGameStart        = () => { };
            OnRemoteDirectConnect  = (a, b) => { };
            delayedActions         = new ActionQueue();

            Ui.ResetAll();

            if (worldRenderer != null)
            {
                worldRenderer.Dispose();
            }
            worldRenderer = null;
            if (server != null)
            {
                server.Shutdown();
            }
            if (OrderManager != null)
            {
                OrderManager.Dispose();
            }

            if (ModData != null)
            {
                ModData.ModFiles.UnmountAll();
                ModData.Dispose();
            }

            ModData = null;

            if (mod == null)
            {
                throw new InvalidOperationException("Game.Mod argument missing.");
            }

            if (!Mods.ContainsKey(mod))
            {
                throw new InvalidOperationException("Unknown or invalid mod '{0}'.".F(mod));
            }

            Console.WriteLine("Loading mod: {0}", mod);

            Sound.StopVideo();

            ModData = new ModData(Mods[mod], Mods, true);

            LocalPlayerProfile = new LocalPlayerProfile(Platform.ResolvePath(Path.Combine("^", Settings.Game.AuthProfile)), ModData.Manifest.Get <PlayerDatabase>());

            if (!ModData.LoadScreen.BeforeLoad())
            {
                return;
            }

            using (new PerfTimer("LoadMaps"))
                ModData.MapCache.LoadMaps();

            ModData.InitializeLoaders(ModData.DefaultFileSystem);
            Renderer.InitializeFonts(ModData);

            var grid = ModData.Manifest.Contains <MapGrid>() ? ModData.Manifest.Get <MapGrid>() : null;

            Renderer.InitializeDepthBuffer(grid);

            if (Cursor != null)
            {
                Cursor.Dispose();
            }

            if (Settings.Graphics.HardwareCursors)
            {
                try
                {
                    Cursor = new HardwareCursor(ModData.CursorProvider);
                }
                catch (Exception e)
                {
                    Log.Write("debug", "Failed to initialize hardware cursors. Falling back to software cursors.");
                    Log.Write("debug", "Error was: " + e.Message);

                    Console.WriteLine("Failed to initialize hardware cursors. Falling back to software cursors.");
                    Console.WriteLine("Error was: " + e.Message);

                    Cursor = new SoftwareCursor(ModData.CursorProvider);
                }
            }
            else
            {
                Cursor = new SoftwareCursor(ModData.CursorProvider);
            }

            PerfHistory.Items["render"].HasNormalTick         = false;
            PerfHistory.Items["batches"].HasNormalTick        = false;
            PerfHistory.Items["render_widgets"].HasNormalTick = false;
            PerfHistory.Items["render_flip"].HasNormalTick    = false;

            JoinLocal();

            try
            {
                if (discoverNat != null)
                {
                    discoverNat.Wait();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("NAT discovery failed: {0}", e.Message);
                Log.Write("nat", e.ToString());
            }

            ChromeMetrics.TryGet("ChatMessageColor", out chatMessageColor);
            ChromeMetrics.TryGet("SystemMessageColor", out systemMessageColor);

            ModData.LoadScreen.StartGame(args);
        }
Example #43
0
        public static void InitializeMod(string mod, Arguments args)
        {
            // Clear static state if we have switched mods
            LobbyInfoChanged       = () => { };
            ConnectionStateChanged = om => { };
            BeforeGameStart        = () => { };
            OnRemoteDirectConnect  = endpoint => { };
            delayedActions         = new ActionQueue();

            Ui.ResetAll();

            worldRenderer?.Dispose();
            worldRenderer = null;
            server?.Shutdown();
            OrderManager?.Dispose();

            if (ModData != null)
            {
                ModData.ModFiles.UnmountAll();
                ModData.Dispose();
            }

            ModData = null;

            if (mod == null)
            {
                throw new InvalidOperationException("Game.Mod argument missing.");
            }

            if (!Mods.ContainsKey(mod))
            {
                throw new InvalidOperationException("Unknown or invalid mod '{0}'.".F(mod));
            }

            Console.WriteLine("Loading mod: {0}", mod);

            Sound.StopVideo();

            ModData = new ModData(Mods[mod], Mods, true);

            LocalPlayerProfile = new LocalPlayerProfile(Path.Combine(Platform.SupportDir, Settings.Game.AuthProfile), ModData.Manifest.Get <PlayerDatabase>());

            if (!ModData.LoadScreen.BeforeLoad())
            {
                return;
            }

            using (new PerfTimer("LoadMaps"))
                ModData.MapCache.LoadMaps();

            ModData.InitializeLoaders(ModData.DefaultFileSystem);
            Renderer.InitializeFonts(ModData);

            var grid = ModData.Manifest.Contains <MapGrid>() ? ModData.Manifest.Get <MapGrid>() : null;

            Renderer.InitializeDepthBuffer(grid);

            Cursor?.Dispose();

            Cursor = new CursorManager(ModData.CursorProvider);

            PerfHistory.Items["render"].HasNormalTick           = false;
            PerfHistory.Items["batches"].HasNormalTick          = false;
            PerfHistory.Items["render_world"].HasNormalTick     = false;
            PerfHistory.Items["render_widgets"].HasNormalTick   = false;
            PerfHistory.Items["render_flip"].HasNormalTick      = false;
            PerfHistory.Items["terrain_lighting"].HasNormalTick = false;

            JoinLocal();

            try
            {
                discoverNat?.Wait();
            }
            catch (Exception e)
            {
                Console.WriteLine("NAT discovery failed: {0}", e.Message);
                Log.Write("nat", e.ToString());
            }

            ChromeMetrics.TryGet("ChatMessageColor", out chatMessageColor);
            ChromeMetrics.TryGet("SystemMessageColor", out systemMessageColor);
            if (!ChromeMetrics.TryGet("SystemMessageLabel", out systemMessageLabel))
            {
                systemMessageLabel = "Battlefield Control";
            }

            ModData.LoadScreen.StartGame(args);
        }
 public void AddInactiveLink(Mods.IMod p_modMod, string p_strBaseFilePath, int p_intPriority)
 {
     throw new NotImplementedException();
 }
Example #45
0
 // Token: 0x0600215C RID: 8540
 // RVA: 0x000C4BB0 File Offset: 0x000C2DB0
 public static double smethod_10(double double_0, double double_1, Mods mods_0)
 {
     if (Class115.osuModes_1 != OsuModes.Edit && Class876.smethod_6(mods_0, Mods.Easy))
     {
         double_0 = Math.Max(0.0, double_0 / 2.0);
     }
     if (Class115.osuModes_1 != OsuModes.Edit && Class876.smethod_6(mods_0, Mods.HardRock))
     {
         double_0 = Math.Min(10.0, double_0 * double_1);
     }
     return double_0;
 }
Example #46
0
 public bool Contains(EquipmentSetMod mod)
 {
     return(Mods.Contains(mod));
 }
Example #47
0
        private static Beatmap ConvertToSCBeatmap(IBeatmap lazerBeatmap, DifficultyAttributes difficultyAttributes, string fullFilePath, Mods mods)
        {
            short circles, sliders, spinners;

            circles = sliders = spinners = 0;
            if (difficultyAttributes is OsuDifficultyAttributes osuAttributes)
            {
                circles  = (short)osuAttributes.HitCircleCount;
                spinners = (short)osuAttributes.SpinnerCount;
                sliders  = (short)osuAttributes.SliderCount;
            }

            lazerBeatmap.BeatmapInfo.StarDifficulty = Math.Round(difficultyAttributes?.StarRating ?? 0, 2);

            return(new Beatmap
            {
                PlayMode = (PlayMode)lazerBeatmap.BeatmapInfo.RulesetID,
                ArtistRoman = lazerBeatmap.Metadata.Artist ?? string.Empty,
                ArtistUnicode = lazerBeatmap.Metadata.ArtistUnicode ?? string.Empty,
                TitleRoman = lazerBeatmap.Metadata.Title ?? string.Empty,
                TitleUnicode = lazerBeatmap.Metadata.TitleUnicode ?? string.Empty,
                DiffName = lazerBeatmap.BeatmapInfo.Version ?? string.Empty,
                Md5 = lazerBeatmap.BeatmapInfo.MD5Hash,
                MapId = lazerBeatmap.BeatmapInfo.OnlineBeatmapID ?? 0,
                ModPpStars = new PlayModeStars {
                    { (PlayMode)lazerBeatmap.BeatmapInfo.RulesetID, new StarRating {
                          { (int)(mods & Mods.MapChanging), lazerBeatmap.BeatmapInfo.StarDifficulty }
                      } }
                },
                MainBpm = Math.Round(lazerBeatmap.ControlPointInfo.BPMMode),
                MinBpm = Math.Round(lazerBeatmap.ControlPointInfo.BPMMinimum),
                MaxBpm = Math.Round(lazerBeatmap.ControlPointInfo.BPMMaximum),
                Creator = lazerBeatmap.Metadata.AuthorString ?? string.Empty,
                ApproachRate = lazerBeatmap.BeatmapInfo.BaseDifficulty.ApproachRate,
                CircleSize = lazerBeatmap.BeatmapInfo.BaseDifficulty.CircleSize,
                SliderVelocity = lazerBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier,
                OverallDifficulty = lazerBeatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty,
                HpDrainRate = lazerBeatmap.BeatmapInfo.BaseDifficulty.DrainRate,
                Circles = circles,
                Dir = string.IsNullOrEmpty(fullFilePath) ? null : Path.GetFileName(Path.GetDirectoryName(fullFilePath)),
                MapSetId = lazerBeatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID ?? 0,
                Mp3Name = lazerBeatmap.Metadata.AudioFile,
                PreviewTime = Convert.ToInt32(lazerBeatmap.BeatmapInfo.Metadata.PreviewTime),
                Sliders = sliders,
                Source = lazerBeatmap.Metadata.Source ?? string.Empty,
                Spinners = spinners,
                StackLeniency = lazerBeatmap.BeatmapInfo.StackLeniency,
                Tags = lazerBeatmap.Metadata.Tags ?? string.Empty,
                TotalTime = Convert.ToInt32(CalculateLength(lazerBeatmap)),
                OsuFileName = string.IsNullOrEmpty(fullFilePath) ? null : Path.GetFileName(fullFilePath),
                AudioOffset = 0,
                DrainingTime = Convert.ToInt32(CalculateLength(lazerBeatmap, true)),
                ThreadId = 0,
                EditDate = DateTime.UtcNow,
                LastPlayed = DateTime.MinValue,
                LastSync = DateTime.MinValue
            });
        }
 public int CheckFileLink(string p_strFilePath, out Mods.IMod p_modMod, out List<IVirtualModLink> lstFileLinks)
 {
     throw new NotImplementedException();
 }
Example #49
0
        public Item(NormalInventoryItem item)
        {
            Original = item;
            Path     = item.Item.Path;
            BaseItemType baseItemType = BasePlugin.API.GameController.Files.BaseItemTypes.Translate(Path);

            ClassName = baseItemType.ClassName;
            BaseName  = baseItemType.BaseName;
            List <string> weaponClass = new List <string>
            {
                "One Hand Mace",
                "Two Hand Mace",
                "One Hand Axe",
                "Two Hand Axe",
                "One Hand Sword",
                "Two Hand Sword",
                "Thrusting One Hand Sword",
                "Bow",
                "Claw",
                "Dagger",
                "Sceptre",
                "Staff",
                "Wand"
            };

            if (item.Item.HasComponent <Base>())
            {
                Base @base = item.Item.GetComponent <Base>();
            }

            if (item.Item.HasComponent <Mods>())
            {
                Mods mods = item.Item.GetComponent <Mods>();
                Rarity        = mods.ItemRarity;
                IsIdentified  = mods.Identified;
                ItemLevel     = mods.ItemLevel;
                RequiredLevel = mods.RequiredLevel;
                if (Rarity != ItemRarity.Normal && IsIdentified && !string.IsNullOrEmpty(item.Item.Path))
                {
                    List <ItemMod> itemMods = mods.ItemMods;
                    Mods = itemMods.Select(it => new ModValue(it, BasePlugin.API.GameController.Files, ItemLevel, baseItemType)).ToList();
                }
            }

            if (item.Item.HasComponent <Sockets>())
            {
                Sockets sockets = item.Item.GetComponent <Sockets>();
                Sockets     = sockets.NumberOfSockets;
                LargestLink = sockets.LargestLinkSize;
            }

            if (weaponClass.Any(ClassName.Equals))
            {
                IsWeapon = true;
            }

            if (Path.StartsWith("Metadata/Items/Amulets"))
            {
                BaseItemType = ItemTypeParent.Amulet;
            }
            else if (Path.StartsWith("Metadata/Items/Rings"))
            {
                BaseItemType = ItemTypeParent.Ring;
            }
            else if (Path.StartsWith("Metadata/Items/Belts"))
            {
                BaseItemType = ItemTypeParent.Armour;
                SubItemType  = ItemTypeChild.Belt;
            }
            else if (Path.StartsWith("Metadata/Items/Armours"))
            {
                BaseItemType = ItemTypeParent.Armour;
                if (Path.StartsWith("Metadata/Items/Armours/BodyArmours"))
                {
                    SubItemType = ItemTypeChild.BodyArmor;
                }
                else if (Path.StartsWith("Metadata/Items/Armours/Boots"))
                {
                    SubItemType = ItemTypeChild.Boots;
                }
                else if (Path.StartsWith("Metadata/Items/Armours/Gloves"))
                {
                    SubItemType = ItemTypeChild.Gloves;
                }
                else if (Path.StartsWith("Metadata/Items/Armours/Helmets"))
                {
                    SubItemType = ItemTypeChild.Helmet;
                }
                else if (Path.StartsWith("Metadata/Items/Armours/Shields"))
                {
                    SubItemType = ItemTypeChild.Shield;
                }
            }
            else if (Path.StartsWith("Metadata/Items/Flasks"))
            {
                BaseItemType = ItemTypeParent.Flask;
            }
            else if (Path.StartsWith("Metadata/Items/Quivers"))
            {
                BaseItemType = ItemTypeParent.Quiver;
            }
            else if (Path.StartsWith("Metadata/Items/Weapons"))
            {
                //BaseItemType = ItemTypeParent.Weapon;
                if (Path.StartsWith("Metadata/Items/Weapons/OneHandWeapons"))
                {
                    BaseItemType = ItemTypeParent.OneHandedWeapon;
                    //if (Path.StartsWith("Metadata/Items/Weapons/OneHandWeapons/Claws"))
                    //    SubItemType = ItemTypeChild.Claw;
                    //else if (Path.StartsWith("Metadata/Items/Weapons/OneHandWeapons/Daggers"))
                    //    SubItemType = ItemTypeChild.Dagger;
                    //else if (Path.StartsWith("Metadata/Items/Weapons/OneHandWeapons/OneHandAxes"))
                    //    SubItemType = ItemTypeChild.OneHandedAxe;
                    //else if (Path.StartsWith("Metadata/Items/Weapons/OneHandWeapons/OneHandMaces"))
                    //    SubItemType = ItemTypeChild.OneHandedMace;
                    //else if (Path.StartsWith("Metadata/Items/Weapons/OneHandWeapons/OneHandSwords"))
                    //    SubItemType = ItemTypeChild.OneHandedSword;
                    //if (Path.StartsWith("Metadata/Items/Weapons/OneHandWeapons/Wands"))
                    //    SubItemType = ItemTypeChild.Wand;
                }
                else if (Path.StartsWith("Metadata/Items/Weapons/TwoHandWeapons"))
                {
                    BaseItemType = ItemTypeParent.TwoHandedWeapon;
                    if (Path.StartsWith("Metadata/Items/Weapons/TwoHandWeapons/Bows"))
                    {
                        SubItemType = ItemTypeChild.Bow;
                    }
                    else if (Path.StartsWith("Metadata/Items/Weapons/TwoHandWeapons/Staves"))
                    {
                        SubItemType = ItemTypeChild.Stave;
                    }
                    //else if (Path.StartsWith("Metadata/Items/Weapons/TwoHandWeapons/TwoHandAxes"))
                    //    SubItemType = ItemTypeChild.TwoHandedAxe;
                    //else if (Path.StartsWith("Metadata/Items/Weapons/TwoHandWeapons/TwoHandMaces"))
                    //    SubItemType = ItemTypeChild.TwoHandedMace;
                    //else if (Path.StartsWith("Metadata/Items/Weapons/TwoHandWeapons/TwoHandSwords"))
                    //    SubItemType = ItemTypeChild.TwoHandedSword;
                }
            }
        }
 public string AddFileLink(Mods.IMod p_modMod, string p_strBaseFilePath, string p_strSourceFile, bool p_booIsSwitching)
 {
     return AddFileLink(p_modMod, p_strBaseFilePath, p_strSourceFile, p_booIsSwitching, false);
 }
 public bool ContainsMod(string modName)
 {
     return(Mods.Any(setting => setting.ModName.EqualsIgnoreCase(modName)));
 }
 public string AddFileLink(Mods.IMod p_modMod, string p_strBaseFilePath, string p_strSourceFile, bool p_booIsSwitching, bool p_booHandlePlugin)
 {
     // nop, linking is done by MO
       return string.Empty;
 }
 public ModLoadSetting GetModLoadSettingByName(string modName)
 {
     return(Mods.FirstOrDefault(setting => setting.ModName.EqualsIgnoreCase(modName)));
 }
Example #54
0
 private static bool GetValue(Mods key) => ListOfMod[key];
Example #55
0
 public static bool IsModInstalled(KeyValuePair <string, string> mod)
 {
     return(Mods.ContainsKey(mod.Key) &&
            Mods[mod.Key].Metadata.Version == mod.Value &&
            IsModInstalled(mod.Key));
 }
Example #56
0
 internal static void SetValue(Mods key, bool value) => ListOfMod[key] = value;
Example #57
0
        private void ExportLoadButtonClick(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog
            {
                Filter          = "Text files|*.txt",
                DefaultExt      = "txt",
                CheckPathExists = true,
                CheckFileExists = true,
                Multiselect     = false,
            };

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            bool OverrideTags;

            if (!Settings.NeverImportTags)
            {
                OverrideTags = MessageBox.Show("Do you want to override the tags and categories of your current mods with the tags saved in your profile?\r\n" +
                                               "Warning: This action cannot be undone", "Importing profile", MessageBoxButtons.YesNo) == DialogResult.Yes;
            }
            else
            {
                OverrideTags = false;
            }
            // parse file

            var categoryRegex = new Regex(@"^(?<category>.*?)\s\(\d*\):$", RegexOptions.Compiled | RegexOptions.Multiline);
            var modEntryRegex = new Regex(@"^\s*(?<name>.*?)[ ]*\t(?<id>.*?)[ ]*\t(?:.*=)?(?<sourceID>\d+)([ ]*\t(?<tags>.*?))?$", RegexOptions.Compiled | RegexOptions.Multiline);

            var mods         = Mods.All.ToList();
            var activeMods   = new List <ModEntry>();
            var missingMods  = new List <Match>();
            var categoryName = "";

            foreach (var line in File.ReadAllLines(dialog.FileName))
            {
                var categoryMatch = categoryRegex.Match(line);
                if (categoryMatch.Success)
                {
                    categoryName = categoryMatch.Groups["category"].Value;
                }

                var modMatch = modEntryRegex.Match(line);
                if (!modMatch.Success)
                {
                    continue;
                }

                //        var active = false;
                //        if (modMatch.Groups["active"].Success)
                //        {
                //// Try just in case the value doesn't work, failsafe value is false, so this shouldn't be an issue
                //         try
                //{
                //	active = bool.Parse(modMatch.Groups["active"].Value);
                //}
                //catch
                //{ }
                //        }

                var entries = mods.Where(mod => mod.ID == modMatch.Groups["id"].Value).ToList();

                if (entries.Count == 0)
                {
                    // Mod missing
                    // -> add to list
                    missingMods.Add(modMatch);
                    continue;
                }

                activeMods.AddRange(entries);

                if (OverrideTags)
                {
                    var tags = modMatch.Groups["tags"].Value.Split(';').Where(t => !string.IsNullOrWhiteSpace(t));

                    foreach (var tag in tags)
                    {
                        if (AvailableTags.ContainsKey(tag.ToLower()) == false)
                        {
                            AvailableTags[tag.ToLower()] = new ModTag(tag);
                        }
                    }

                    foreach (var modEntry in entries)
                    {
                        modEntry.Tags = tags.ToList();
                        Mods.RemoveMod(modEntry);
                        Mods.AddMod(categoryName, modEntry);
                    }
                }
            }

            // Check entries
            if (activeMods.Count == 0)
            {
                MessageBox.Show("No mods found. Bad profile?");
                return;
            }

            // Check missing
            if (missingMods.Count > 0)
            {
                var steamMissingMods = missingMods.Where(match => match.Groups["sourceID"].Value != "Unknown").ToList();

                var text = $"This profile contains {missingMods.Count} mod(s) that are not currently installed:\r\n\r\n";

                foreach (var match in missingMods)
                {
                    text += match.Groups["name"].Value;

                    if (steamMissingMods.Contains(match))
                    {
                        text += "*";
                    }

                    text += "\r\n";
                }

                if (steamMissingMods.Count != 0)
                {
                    text += "\r\nDo you want to subscribe to the mods marked with an asterisk on Steam?";

                    var result = FlexibleMessageBox.Show(this, text, "Mods missing!", MessageBoxButtons.YesNoCancel);

                    if (result == DialogResult.Cancel)
                    {
                        return;
                    }

                    if (result == DialogResult.Yes)
                    {
                        // subscribe
                        foreach (var id in steamMissingMods.Select(match => ulong.Parse(match.Groups["sourceID"].Value)))
                        {
                            SteamUGC.SubscribeItem(id.ToPublishedFileID());
                        }

                        MessageBox.Show("Done. Close the launcher, wait for steam to download the mod(s) and try again.");
                        return;
                    }
                }
                else
                {
                    text += "\r\nDo you wish to continue?";

                    if (FlexibleMessageBox.Show(this, text, "Mods missing!", MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        return;
                    }
                }
            }

            // Confirm
            if (FlexibleMessageBox.Show(this, $"Adopt profile? {activeMods.Count} mods found.", "Confirm", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            // Apply changes
            foreach (var mod in mods)
            {
                mod.isActive = false;
            }

            foreach (var mod in activeMods)
            {
                mod.isActive = true;
            }

            modlist_ListObjectListView.UpdateObjects(mods);

            UpdateExport();
            UpdateLabels();
        }
        /// <summary>
        /// Called when [activated].
        /// </summary>
        /// <param name="disposables">The disposables.</param>
        protected override void OnActivated(CompositeDisposable disposables)
        {
            // Set default order and sort order text
            var state = appStateService.Get();

            InitSortersAndFilters(state);

            Bind();

            this.WhenAnyValue(v => v.ModNameSortOrder.IsActivated, v => v.ModVersionSortOrder.IsActivated, v => v.ModSelectedSortOrder.IsActivated).Where(s => s.Item1 && s.Item2 && s.Item3)
            .Subscribe(s =>
            {
                Observable.Merge(ModNameSortOrder.SortCommand.Select(_ => ModNameKey),
                                 ModVersionSortOrder.SortCommand.Select(_ => ModVersionKey),
                                 ModSelectedSortOrder.SortCommand.Select(_ => ModSelectedKey)).Subscribe(s =>
                {
                    ApplySort(s);
                }).DisposeWith(disposables);
            }).DisposeWith(disposables);

            OpenUrlCommand = ReactiveCommand.Create(() =>
            {
                var url = GetHoveredModUrl();
                if (!string.IsNullOrWhiteSpace(url))
                {
                    appAction.OpenAsync(url).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            CopyUrlCommand = ReactiveCommand.Create(() =>
            {
                var url = GetHoveredModUrl();
                if (!string.IsNullOrWhiteSpace(url))
                {
                    appAction.CopyAsync(url).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            OpenInSteamCommand = ReactiveCommand.Create(() =>
            {
                var url = GetHoveredModSteamUrl();
                if (!string.IsNullOrWhiteSpace(url))
                {
                    appAction.OpenAsync(url).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            OpenInAssociatedAppCommand = ReactiveCommand.Create(() =>
            {
                if (!string.IsNullOrWhiteSpace(HoveredMod?.FullPath))
                {
                    appAction.OpenAsync(HoveredMod.FullPath).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            this.WhenAnyValue(s => s.FilterMods.Text).Subscribe(s =>
            {
                var searchString = FilterMods.Text ?? string.Empty;
                FilteredMods     = Mods?.Where(p => p.Name.Contains(searchString, StringComparison.InvariantCultureIgnoreCase) ||
                                               (p.RemoteId.HasValue && p.RemoteId.GetValueOrDefault().ToString().Contains(searchString))).ToObservableCollection();
                AllModsEnabled = FilteredMods?.Where(p => p.IsValid).Count() > 0 && FilteredMods.Where(p => p.IsValid).All(p => p.IsSelected);
                ApplyDefaultSort();
                SaveState();
            }).DisposeWith(disposables);

            EnableAllCommand = ReactiveCommand.Create(() =>
            {
                if (FilteredMods?.Count() > 0)
                {
                    PerformingEnableAll = true;
                    bool enabled        = Mods.Where(p => p.IsValid).All(p => p.IsSelected);
                    foreach (var item in FilteredMods)
                    {
                        item.IsSelected = !enabled;
                    }
                    AllModsEnabled      = FilteredMods.Where(p => p.IsValid).Count() > 0 && FilteredMods.Where(p => p.IsValid).All(p => p.IsSelected);
                    PerformingEnableAll = false;
                }
            }).DisposeWith(disposables);

            DeleteDescriptorCommand = ReactiveCommand.Create(() =>
            {
                if (HoveredMod != null)
                {
                    DeleteDescriptorAsync(new List <IMod>()
                    {
                        HoveredMod
                    }).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            DeleteAllDescriptorsCommand = ReactiveCommand.Create(() =>
            {
                if (FilteredMods != null)
                {
                    DeleteDescriptorAsync(FilteredMods).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            LockDescriptorCommand = ReactiveCommand.Create(() =>
            {
                if (HoveredMod != null)
                {
                    LockDescriptorAsync(new List <IMod>()
                    {
                        HoveredMod
                    }, true).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            LockAllDescriptorsCommand = ReactiveCommand.Create(() =>
            {
                if (FilteredMods != null)
                {
                    LockDescriptorAsync(FilteredMods, true).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            UnlockDescriptorCommand = ReactiveCommand.Create(() =>
            {
                if (HoveredMod != null)
                {
                    LockDescriptorAsync(new List <IMod>()
                    {
                        HoveredMod
                    }, false).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            UnlockAllDescriptorsCommand = ReactiveCommand.Create(() =>
            {
                if (FilteredMods != null)
                {
                    LockDescriptorAsync(FilteredMods, false).ConfigureAwait(true);
                }
            }).DisposeWith(disposables);

            CheckNewModsCommand = ReactiveCommand.Create(() =>
            {
                CheckNewModsAsync().ConfigureAwait(true);
            }).DisposeWith(disposables);

            base.OnActivated(disposables);
        }
Example #59
0
 // Token: 0x06002AB1 RID: 10929
 // RVA: 0x001146D4 File Offset: 0x001128D4
 internal bool method_11(Mods mods_0, bool? nullable_0)
 {
     Class692 class = null;
 public ModsDoublePair(Mods mods, double doubleValue)
 {
     Mods   = mods;
     Double = doubleValue;
 }