当前位置: 首页>>代码示例>>C#>>正文


C# Parser.getint方法代码示例

本文整理汇总了C#中CSAngband.Parser.getint方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.getint方法的具体用法?C# Parser.getint怎么用?C# Parser.getint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSAngband.Parser的用法示例。


在下文中一共展示了Parser.getint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: parse_e_x

        public static Parser.Error parse_e_x(Parser p)
        {
            int rating = p.getint("rating");
            int xtra = p.getint("xtra");
            Ego_Item e = p.priv as Ego_Item;

            if (e == null)
                return Parser.Error.MISSING_RECORD_HEADER;
            e.rating = (byte)rating;
            e.xtra = (byte)xtra;
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:12,代码来源:Init2.cs

示例2: parse_c_b

        public static Parser.Error parse_c_b(Parser p)
        {
            Player_Class c = p.priv as Player_Class;
            uint spell;

            if (c == null)
                return Parser.Error.MISSING_RECORD_HEADER;
            spell = p.getuint("spell");
            if (spell >= Misc.PY_MAX_SPELLS)
                return Parser.Error.OUT_OF_BOUNDS;
            c.spells.info[spell] = new Magic_Type();
            c.spells.info[spell].slevel = (byte)p.getint("level");
            c.spells.info[spell].smana = (byte)p.getint("mana");
            c.spells.info[spell].sfail = (byte)p.getint("fail");
            c.spells.info[spell].sexp = (byte)p.getint("exp");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:17,代码来源:Init2.cs

示例3: parse_c_i

        public static Parser.Error parse_c_i(Parser p)
        {
            Player_Class c = p.priv as Player_Class;

            if (c == null)
                return Parser.Error.MISSING_RECORD_HEADER;
            c.c_mhp = (short)p.getint("mhp");
            c.c_exp = (short)p.getint("exp");
            c.sense_base = (uint)p.getint("sense-base");
            c.sense_div = (ushort)p.getint("sense-div");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:12,代码来源:Init2.cs

示例4: parse_a_n

        /* Parsing functions for artifact.txt */
        public static Parser.Error parse_a_n(Parser p)
        {
            Bitflag f = new Bitflag(Object_Flag.SIZE);
            int idx = p.getint("index");
            string name = p.getstr("name");
            Artifact h = p.priv as Artifact;

            Artifact a = new Artifact();
            a.Next = h;
            p.priv = a;
            a.aidx = (byte)idx;
            a.Name = name;

            /* Ignore all elements */
            Object_Flag.create_mask(f, false, Object_Flag.object_flag_type.IGNORE);
            a.flags.union(f);

            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:20,代码来源:Init2.cs

示例5: parse_a_w

        public static Parser.Error parse_a_w(Parser p)
        {
            Artifact a = p.priv as Artifact;
            Misc.assert(a != null);

            a.level = (byte)p.getint("level");
            a.rarity = (byte)p.getint("rarity");
            a.weight = (byte)p.getint("weight");
            a.cost = p.getint("cost");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:11,代码来源:Init2.cs

示例6: parse_v_x

        public static Parser.Error parse_v_x(Parser p)
        {
            Vault v = p.priv as Vault;

            if (v == null)
                return Parser.Error.MISSING_RECORD_HEADER;
            v.typ = (byte)p.getuint("type");
            v.rat = (byte)p.getint("rating");
            v.hgt = (byte)p.getuint("height");
            v.wid = (byte)p.getuint("width");

            /* XXX: huh? These checks were in the original code and I have no idea
             * why. */
            if (v.typ == 6 && (v.wid > 33 || v.hgt > 22))
                return Parser.Error.VAULT_TOO_BIG;
            if (v.typ == 7 && (v.wid > 66 || v.hgt > 44))
                return Parser.Error.VAULT_TOO_BIG;
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:19,代码来源:Init2.cs

示例7: parse_a_a

        public static Parser.Error parse_a_a(Parser p)
        {
            Artifact a = p.priv as Artifact;
            string tmp = p.getstr("minmax");
            int amin, amax;
            Misc.assert(a != null);

            a.alloc_prob = (byte)p.getint("common");

            string[] tokens = tmp.Split(new string[] { " to " }, StringSplitOptions.RemoveEmptyEntries);
            if(tokens.Length != 2)
                return Parser.Error.GENERIC;
            if(!int.TryParse(tokens[0], out amin) || !int.TryParse(tokens[1], out amax))
                return Parser.Error.GENERIC;

            if (amin > 255 || amax > 255 || amin < 0 || amax < 0)
                return Parser.Error.OUT_OF_BOUNDS;

            a.alloc_min = (byte)amin;
            a.alloc_max = (byte)amax;
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:22,代码来源:Init2.cs

示例8: parse_k_i

        public static Parser.Error parse_k_i(Parser p)
        {
            Object_Kind k = p.priv as Object_Kind;
            Misc.assert(k != null);

            int tval = TVal.find_idx(p.getsym("tval"));
            if (tval < 0)
                return Parser.Error.UNRECOGNISED_TVAL;

            k.tval = (byte)tval;
            k.sval = (byte)p.getint("sval");

            k.Base = Misc.kb_info[k.tval];

            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:16,代码来源:Init2.cs

示例9: parse_k_m

        public static Parser.Error parse_k_m(Parser p)
        {
            Object_Kind k = p.priv as Object_Kind;
            Misc.assert(k != null);

            k.gen_mult_prob = (byte)p.getint("prob");
            k.stack_size = (random_value)p.getrand("stack");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:9,代码来源:Init2.cs

示例10: parse_kb_d

        public static Parser.Error parse_kb_d(Parser p)
        {
            string label;
            int value;

            kb_parsedata d = p.priv as kb_parsedata;
            Misc.assert(d != null);

            label = p.getsym("label");
            value = p.getint("value");

            if (label == "B")
                d.defaults.break_perc = value;
            else
                return Parser.Error.UNDEFINED_DIRECTIVE;

            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:18,代码来源:Init2.cs

示例11: parse_k_a

        public static Parser.Error parse_k_a(Parser p)
        {
            Object_Kind k = p.priv as Object_Kind;
            string tmp = p.getstr("minmax");
            Misc.assert(k != null);

            k.alloc_prob = (byte)p.getint("common");

            int amin, amax;

            string[] tokens = tmp.Split(new string[] { " to " }, StringSplitOptions.RemoveEmptyEntries);

            if(tokens.Length != 2)
                return Parser.Error.GENERIC;

            if(!int.TryParse(tokens[0], out amin) || !int.TryParse(tokens[1], out amax))
                return Parser.Error.GENERIC;

            k.alloc_min = (byte)amin;
            k.alloc_max = (byte)amax;
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:22,代码来源:Init2.cs

示例12: parse_kb_b

        public static Parser.Error parse_kb_b(Parser p)
        {
            Object.Object_Base kb;

            kb_parsedata d = p.priv as kb_parsedata;
            Misc.assert(d != null);

            kb = d.kb;
            Misc.assert(kb != null);

            kb.break_perc = p.getint("breakage");

            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:14,代码来源:Init2.cs

示例13: parse_h_n

        /* Parsing functions for p_hist.txt */
        public static Parser.Error parse_h_n(Parser p)
        {
            History_Chart oc = p.priv as History_Chart;
            History_Chart c;
            History_Entry e = new History_Entry();
            uint idx = p.getuint("chart");

            if ((c = findchart(oc, idx)) == null) {
                c = new History_Chart();
                c.next = oc;
                c.idx = idx;
                p.priv = c;
            }

            e.isucc = p.getint("next");
            e.roll = p.getint("roll");
            e.bonus = p.getint("bonus");

            e.next = c.entries;
            c.entries = e;
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:23,代码来源:Init2.cs

示例14: parse_f_x

        public static Parser.Error parse_f_x(Parser p)
        {
            Feature f = p.priv as Feature;

            if (f == null)
                return Parser.Error.MISSING_RECORD_HEADER;
            f.locked = (byte)p.getint("locked");
            f.jammed = (byte)p.getint("jammed");
            f.shopnum = (byte)p.getint("shopnum");
            f.dig = (byte)p.getint("dig");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:12,代码来源:Init2.cs

示例15: parse_r_i

        public static Parser.Error parse_r_i(Parser p)
        {
            Monster_Race r = p.priv as Monster_Race;

            if (r == null)
                return Parser.Error.MISSING_RECORD_HEADER;
            r.speed = (byte)p.getint("speed");
            r.avg_hp = (ushort)p.getint("hp");
            r.aaf = (byte)p.getint("aaf");
            r.ac = (short)p.getint("ac");
            r.sleep = (short)p.getint("sleep");
            return Parser.Error.NONE;
        }
开发者ID:jobjingjo,项目名称:csangband,代码行数:13,代码来源:Init2.cs


注:本文中的CSAngband.Parser.getint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。