Пример #1
0
 public void SetFlags(string flags)
 {
     string[] words = flags.Split(' ');
     foreach (string word in words)
     {
         Flags += (int)EnumerationExtensions.GetEnumIgnoreCase <AreaFlags>(word);
     }
 }
Пример #2
0
        public static LanguageData LuaCreateLanguage(string name, string type)
        {
            var newLang = new LanguageData(_dbManager.GenerateNewId <LanguageData>(), name,
                                           EnumerationExtensions.GetEnumIgnoreCase <LanguageTypes>(type));

            _luaManager.Proxy.CreateTable("lang");
            AddLastObject(newLang);
            _dbManager.AddToRepository(newLang);

            _logManager.Boot("Language '{0}' created", name);
            return(newLang);
        }
Пример #3
0
        public static ExitData LuaCreateExit(string direction, long destination, string name)
        {
            var dir     = EnumerationExtensions.GetEnumIgnoreCase <DirectionTypes>(direction);
            var newExit = new ExitData((int)dir, name)
            {
                Destination = destination,
                Direction   = dir,
                Keywords    = direction
            };

            _luaManager.Proxy.CreateTable("exit");
            AddLastObject(newExit);

            _logManager.Boot("Exit '{0}' created in direction {1} to room {2}", name, direction, destination);
            return(newExit);
        }
Пример #4
0
        public static ResetData LuaCreateReset(string resetType, int extra, int arg1, int arg2, int arg3)
        {
            var newReset = new ResetData
            {
                Type  = EnumerationExtensions.GetEnumIgnoreCase <ResetTypes>(resetType),
                Extra = extra
            };

            newReset.SetArgs(arg1, arg2, arg3);

            _luaManager.Proxy.CreateTable("reset");
            AddLastObject(newReset);

            _logManager.Boot("Reset '{0}' created", resetType);
            return(newReset);
        }
Пример #5
0
        public static HerbData LuaCreateHerb(int id, string name, string type)
        {
            var newHerb = new HerbData(id, name)
            {
                Type = EnumerationExtensions.GetEnumIgnoreCase <SkillTypes>(type)
            };

            if (!type.EqualsIgnoreCase("herb"))
            {
                throw new InvalidOperationException("Use of LCreateHerb for Non-Herbs is not supported");
            }

            _dbManager.AddToRepository(newHerb);
            _luaManager.Proxy.CreateTable("herb");

            _logManager.Boot("Herb (id={0}, name={1}) created", id, name);
            AddLastObject(newHerb);
            return(newHerb);
        }
Пример #6
0
        public static SkillData LuaCreateSkill(int id, string name, string type)
        {
            var newSkill = new SkillData(id, name)
            {
                Type = EnumerationExtensions.GetEnumIgnoreCase <SkillTypes>(type)
            };

            if (type.EqualsIgnoreCase("herb"))
            {
                throw new InvalidOperationException("Use of LCreateSkill for Herbs is deprecated");
            }

            _dbManager.AddToRepository(newSkill);
            _luaManager.Proxy.CreateTable("skill");

            _logManager.Boot("Skill (id={0}, name={1}) created", id, name);
            AddLastObject(newSkill);
            return(newSkill);
        }
        public void GetEnumIgnoreCaseInvalidTest()
        {
            Action act = () => EnumerationExtensions.GetEnumIgnoreCase <EnumTest>("tester");

            act.Should().Throw <InvalidEnumArgumentException>();
        }
        public void GetEnumIgnoreCaseTest()
        {
            var value = EnumerationExtensions.GetEnumIgnoreCase <EnumTest>("test");

            value.Should().Be(EnumTest.Test);
        }
Пример #9
0
 public static int GetClimate(string type) => (int)EnumerationExtensions.GetEnumIgnoreCase <ClimateTypes>(type);
Пример #10
0
 public static int GetHemisphere(string type)
 => (int)EnumerationExtensions.GetEnumIgnoreCase <HemisphereTypes>(type);