本文整理汇总了C#中CSAngband.Parser.getsym方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.getsym方法的具体用法?C# Parser.getsym怎么用?C# Parser.getsym使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSAngband.Parser
的用法示例。
在下文中一共展示了Parser.getsym方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parse_r_mimic
public static Parser.Error parse_r_mimic(Parser p)
{
Monster_Race r = p.priv as Monster_Race;
int tval, sval;
Object_Kind kind;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
tval = TVal.find_idx(p.getsym("tval"));
if (tval < 0)
return Parser.Error.UNRECOGNISED_TVAL;
sval = SVal.lookup_sval(tval, p.getsym("sval"));
if (sval < 0)
return Parser.Error.UNRECOGNISED_SVAL;
kind = Object_Kind.objkind_get(tval, sval);
if (kind == null)
return Parser.Error.GENERIC;
Monster_Mimic m = new Monster_Mimic();
m.kind = kind;
m.Next = r.mimic_kinds;
r.mimic_kinds = m;
return Parser.Error.NONE;
}
示例2: parse_r_b
public static Parser.Error parse_r_b(Parser p)
{
Monster_Race r = p.priv as Monster_Race;
int i;
random_value dam;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
for (i = 0; i < Monster_Blow.MONSTER_BLOW_MAX; i++)
//used to check .method
if (r.blow[i] == null)
break;
if (i == Monster_Blow.MONSTER_BLOW_MAX)
return Parser.Error.TOO_MANY_ENTRIES;
r.blow[i] = new Monster_Blow();
r.blow[i].method = find_blow_method(p.getsym("method"));
if (r.blow[i].method == null)
return Parser.Error.UNRECOGNISED_BLOW;
if (p.hasval("effect")) {
r.blow[i].effect = find_blow_effect(p.getsym("effect"));
if (r.blow[i].effect == null)
return Parser.Error.INVALID_EFFECT;
}
if (p.hasval("damage")) {
dam = p.getrand("damage");
r.blow[i].d_dice = (byte)dam.dice;
r.blow[i].d_side = (byte)dam.sides;
}
return Parser.Error.NONE;
}
示例3: parse_r_c
public static Parser.Error parse_r_c(Parser p)
{
Monster_Race r = p.priv as Monster_Race;
string color;
ConsoleColor attr;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
color = p.getsym("color");
attr = Utilities.color_text_to_attr(color);
if (attr < 0)
return Parser.Error.INVALID_COLOR;
r.d_attr = attr;
return Parser.Error.NONE;
}
示例4: parse_prefs_f
static Parser.Error parse_prefs_f(Parser p)
{
int idx;
Feature feature;
string lighting;
int light_idx;
prefs_data d = p.priv as prefs_data;
Misc.assert(d != null);
if (d.bypass) return Parser.Error.NONE;
idx = (int)p.getuint("idx");
if (idx >= Misc.z_info.f_max)
return Parser.Error.OUT_OF_BOUNDS;
lighting = p.getsym("lighting");
if (lighting == "bright")
light_idx = (int)Grid_Data.grid_light_level.FEAT_LIGHTING_BRIGHT;
else if (lighting == "lit")
light_idx = (int)Grid_Data.grid_light_level.FEAT_LIGHTING_LIT;
else if (lighting == "dark")
light_idx = (int)Grid_Data.grid_light_level.FEAT_LIGHTING_DARK;
else if (lighting == "all")
light_idx = (int)Grid_Data.grid_light_level.FEAT_LIGHTING_MAX;
else
return Parser.Error.GENERIC; /* xxx fixme */
if (light_idx < (int)Grid_Data.grid_light_level.FEAT_LIGHTING_MAX)
{
feature = Misc.f_info[idx];
feature.x_attr[light_idx] = Utilities.num_to_attr(p.getint("attr"));
feature.x_char[light_idx] = (char)p.getint("char");
}
else
{
for (light_idx = 0; light_idx < (int)Grid_Data.grid_light_level.FEAT_LIGHTING_MAX; light_idx++)
{
feature = Misc.f_info[idx];
feature.x_attr[light_idx] = Utilities.num_to_attr(p.getint("attr"));
feature.x_char[light_idx] = (char)p.getint("char");
}
}
return Parser.Error.NONE;
}
示例5: parse_pit_t
public static Parser.Error parse_pit_t(Parser p)
{
Pit_Profile pit = p.priv as Pit_Profile;
Monster_Base Base = Monster.Monster.lookup_monster_base(p.getsym("base"));
if (pit == null)
return Parser.Error.MISSING_RECORD_HEADER;
else if (pit.n_bases == Misc.MAX_RVALS)
return Parser.Error.TOO_MANY_ENTRIES;
else if (Base == null)
return Parser.Error.UNRECOGNISED_TVAL;
else {
pit.Base[pit.n_bases++] = Base;
return Parser.Error.NONE;
}
}
示例6: parse_a_e
public static Parser.Error parse_a_e(Parser p)
{
Artifact a = p.priv as Artifact;
Misc.assert(a != null);
a.effect = grab_one_effect(p.getsym("name"));
a.time = p.getrand("time");
if (a.effect == null)
return Parser.Error.GENERIC;
return Parser.Error.NONE;
}
示例7: parse_c_e
public static Parser.Error parse_c_e(Parser p)
{
Player_Class c = p.priv as Player_Class;
Start_Item si;
int tval, sval;
if (c == null)
return Parser.Error.MISSING_RECORD_HEADER;
tval = TVal.find_idx(p.getsym("tval"));
if (tval < 0)
return Parser.Error.UNRECOGNISED_TVAL;
sval = SVal.lookup_sval(tval, p.getsym("sval"));
if (sval < 0)
return Parser.Error.UNRECOGNISED_SVAL;
si = new Start_Item();
si.kind = Object_Kind.objkind_get(tval, sval);
si.min = (byte)p.getuint("min");
si.max = (byte)p.getuint("max");
if (si.min > 99 || si.max > 99) {
//mem_free(si.kind);
return Parser.Error.INVALID_ITEM_NUMBER;
}
si.next = c.start_items;
c.start_items = si;
return Parser.Error.NONE;
}
示例8: 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;
}
示例9: parse_kb_n
public static Parser.Error parse_kb_n(Parser p)
{
kb_parsedata d = p.priv as kb_parsedata;
Misc.assert(d != null);
Object.Object_Base kb = new Object.Object_Base();
kb.Copy(d.defaults);
kb.Next = d.kb;
d.kb = kb;
kb.tval = Object.TVal.find_idx(p.getsym("tval"));
if (kb.tval == -1)
return Parser.Error.UNRECOGNISED_TVAL;
kb.Name = p.getstr("name");
return Parser.Error.NONE;
}
示例10: parse_flavor_n
/* Parsing functions for flavor.txt */
public static Parser.Error parse_flavor_n(Parser p)
{
Flavor h = p.priv as Flavor;
Flavor f = new Flavor();
f.next = h;
f.fidx = p.getuint("index");
f.tval = (byte)TVal.find_idx(p.getsym("tval"));
/* Misc.assert(f.tval); */
if (p.hasval("sval"))
f.sval = (byte)SVal.lookup_sval(f.tval, p.getsym("sval"));
else
f.sval = SVal.SV_UNKNOWN;
p.priv = f;
return Parser.Error.NONE;
}
示例11: parse_f_g
public static Parser.Error parse_f_g(Parser p)
{
char glyph = p.getchar("glyph");
string color = p.getsym("color");
ConsoleColor attr = 0;
Feature f = (Feature)p.priv;
if (f == null)
return Parser.Error.MISSING_RECORD_HEADER;
f.d_char = glyph;
attr = Utilities.color_text_to_attr(color);
if (attr < 0)
return Parser.Error.INVALID_COLOR;
f.d_attr = attr;
return Parser.Error.NONE;
}
示例12: parse_flavor_g
public static Parser.Error parse_flavor_g(Parser p)
{
Flavor f = p.priv as Flavor;
ConsoleColor d_attr;
string attr;
if (f == null)
return Parser.Error.MISSING_RECORD_HEADER;
f.d_char = p.getchar("glyph");
attr = p.getsym("attr");
d_attr = Utilities.color_text_to_attr(attr);
if (d_attr < 0)
return Parser.Error.GENERIC;
f.d_attr = d_attr;
return Parser.Error.NONE;
}
示例13: parse_e_t
public static Parser.Error parse_e_t(Parser p)
{
int i;
int tval;
int min_sval, max_sval;
Ego_Item e = p.priv as Ego_Item;
if (e == null)
return Parser.Error.MISSING_RECORD_HEADER;
tval = TVal.find_idx(p.getsym("tval"));
if (tval < 0)
return Parser.Error.UNRECOGNISED_TVAL;
min_sval = p.getint("min-sval");
max_sval = p.getint("max-sval");
i = e.tval_at++;
if(i < e.tval.Length) {
e.tval[i] = (byte)tval;
e.min_sval[i] = (byte)min_sval;
e.max_sval[i] = (byte)max_sval;
}
if (i == Misc.EGO_TVALS_MAX)
return Parser.Error.GENERIC;
return Parser.Error.NONE;
}
示例14: parse_prefs_m
static Parser.Error parse_prefs_m(Parser p)
{
Message_Type type;
string attr;
prefs_data d = p.priv as prefs_data;
Misc.assert(d != null);
if (d.bypass) return Parser.Error.NONE;
type = (Message_Type)p.getint("type");
attr = p.getsym("attr");
ConsoleColor a = Utilities.color_text_to_attr(attr);
if (a < 0)
return Parser.Error.INVALID_COLOR;
Message.color_define(type, a);
return Parser.Error.NONE;
}
示例15: parse_r_t
public static Parser.Error parse_r_t(Parser p)
{
Monster_Race r = p.priv as Monster_Race;
r.Base = Monster.Monster.lookup_monster_base(p.getsym("base"));
if (r.Base == null)
/* Todo: make new error for this */
return Parser.Error.UNRECOGNISED_TVAL;
/* The template sets the default display character */
r.d_char = r.Base.d_char;
/* Give the monster its default flags */
r.flags.union(r.Base.flags);
return Parser.Error.NONE;
}