示例#1
0
 internal void OnWorldLoad(HamstarHelpersMod mymod, HamstarHelpersWorld modworld)
 {
     this.IsInitialized         = true;
     this.MismatchBroadcastMade = false;
     this.ScanMods(modworld);
     this.ExitDuration = 60 * 20;
 }
示例#2
0
        ////////////////

        private void ScanMods(HamstarHelpersWorld modworld)
        {
            this.FoundModNames   = new HashSet <string>();
            this.MissingModNames = new HashSet <string>();
            this.ExtraModNames   = new HashSet <string>();

            if (!this.WorldModLocks.ContainsKey(modworld.ObsoleteID2))
            {
                this.IsMismatched = false;
                return;
            }

            ISet <string>     req_mod_names     = this.WorldModLocks[modworld.ObsoleteID2];
            ISet <string>     checked_mod_names = new HashSet <string>();
            IEnumerable <Mod> all_mods          = ModHelpers.GetAllMods();

            foreach (Mod mod in all_mods)
            {
                if (!req_mod_names.Contains(mod.Name))
                {
                    this.ExtraModNames.Add(mod.Name);
                }
                else
                {
                    this.FoundModNames.Add(mod.Name);
                }
                checked_mod_names.Add(mod.Name);
            }

            foreach (string mod_name in req_mod_names)
            {
                if (!checked_mod_names.Contains(mod_name))
                {
                    this.MissingModNames.Add(mod_name);
                }
            }

            this.IsMismatched = ModLockHelpers.IsModMismatchFound();
//LogHelpers.Log( "req_mod_names:"+string.Join(",",req_mod_names)+
//", extra:"+string.Join(",",this.ExtraModNames)+
//", found:"+string.Join(",",this.FoundModNames)+
//", missing:"+string.Join(",",this.MissingModNames ) );
//LogHelpers.Log( "IsInitialized:"+this.IsInitialized+" IsMismatched:"+this.IsMismatched+ ", ExitDuration:" + this.ExitDuration);
        }