本文整理汇总了C#中CSAngband.Parser.getstr方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.getstr方法的具体用法?C# Parser.getstr怎么用?C# Parser.getstr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSAngband.Parser
的用法示例。
在下文中一共展示了Parser.getstr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parse_k_n
/* Parsing functions for object.txt */
public static Parser.Error parse_k_n(Parser p)
{
int idx = p.getint("index");
string name = p.getstr("name");
Object_Kind h = p.priv as Object_Kind;
Object_Kind k = new Object_Kind();
k.next = h;
p.priv = k;
k.kidx = (uint)idx;
k.Name = name;
return Parser.Error.NONE;
}
示例2: 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;
}
示例3: parse_c_n
/* Parsing functions for pclass.txt */
public static Parser.Error parse_c_n(Parser p)
{
Player_Class h = p.priv as Player_Class;
Player_Class c = new Player_Class();
c.cidx = p.getuint("index");
c.Name = p.getstr("name");
c.next = h;
p.priv = c;
return Parser.Error.NONE;
}
示例4: parse_a_d
public static Parser.Error parse_a_d(Parser p)
{
Artifact a = p.priv as Artifact;
Misc.assert(a != null);
a.Text = a.Text + p.getstr("text");
return Parser.Error.NONE;
}
示例5: parse_a_l
public static Parser.Error parse_a_l(Parser p)
{
Artifact a = p.priv as Artifact;
string s;
Misc.assert(a != null);
a.pval[a.num_pvals] = (short)p.getint("pval");
if (!p.hasval("flags"))
return Parser.Error.MISSING_FIELD;
s = p.getstr("flags");
return grab_flag_helper3(s, a);
//t = strtok(s, " |");
//while (t) {
// if (grab_flag(a.flags, OF_SIZE, k_info_flags, t) ||
// grab_flag(a.pval_flags[a.num_pvals], OF_SIZE, k_info_flags, t))
// break;
// t = strtok(null, " |");
//}
//a.num_pvals++;
//if (a.num_pvals > MAX_PVALS)
// return Parser.Error.TOO_MANY_ENTRIES;
//mem_free(s);
//return t ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;
}
示例6: parse_s_n
/* Parsing functions for spell.txt */
public static Parser.Error parse_s_n(Parser p)
{
Spell s = new Spell();
s.next = p.priv as Spell;
s.sidx = p.getuint("index");
s.name = p.getstr("name");
p.priv = s;
return Parser.Error.NONE;
}
示例7: parse_v_n
/* Parsing functions for vault.txt */
public static Parser.Error parse_v_n(Parser p)
{
Vault h = p.priv as Vault;
Vault v = new Vault();
v.vidx = p.getuint("index");
v.name = p.getstr("name");
v.next = h;
p.priv = v;
return Parser.Error.NONE;
}
示例8: parse_p_n
/* Parsing functions for prace.txt */
public static Parser.Error parse_p_n(Parser p)
{
Player_Race h = p.priv as Player_Race;
Player_Race r = new Player_Race();
r.Next = h;
r.ridx = p.getuint("index");
r.Name = p.getstr("name");
p.priv = r;
return Parser.Error.NONE;
}
示例9: parse_p_y
public static Parser.Error parse_p_y(Parser p)
{
Player_Race r = p.priv as Player_Race;
string flags;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("flags"))
return Parser.Error.NONE;
flags = p.getstr("flags");
return grab_flag_helper5(flags, r.pflags);
//s = strtok(flags, " |");
//while (s) {
// if (grab_flag(r.pflags, PF_SIZE, player_info_flags, s))
// break;
// s = strtok(null, " |");
//}
//mem_free(flags);
//return s ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;
}
示例10: parse_pit_s2
public static Parser.Error parse_pit_s2(Parser p)
{
Pit_Profile pit = p.priv as Pit_Profile;
string flags;
if (pit == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("spells"))
return Parser.Error.NONE;
flags = p.getstr("spells");
return grab_flag_helper_msf(flags, pit.forbidden_spell_flags);
/*
s = strtok(flags, " |");
while (s) {
if (grab_flag(pit.forbidden_spell_flags, RSF_SIZE, r_info_spell_flags, s)) {
mem_free(flags);
return Parser.Error.INVALID_FLAG;
}
s = strtok(null, " |");
}
mem_free(flags);
return Parser.Error.NONE;*/
}
示例11: parse_p_c
public static Parser.Error parse_p_c(Parser p)
{
Player_Race r = p.priv as Player_Race;
string classes;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("classes"))
return Parser.Error.NONE;
classes = p.getstr("classes");
string[] tokens = classes.Split(new string[]{" ", "|"}, StringSplitOptions.RemoveEmptyEntries);
foreach(string token in tokens) {
r.choice |= (byte)(1 << int.Parse(token));
}
return Parser.Error.NONE;
}
示例12: parse_pit_n
/*
* Initialize monster pits
*/
public static Parser.Error parse_pit_n(Parser p)
{
Pit_Profile h = p.priv as Pit_Profile;
Pit_Profile pit = new Pit_Profile();
pit.next = h;
pit.pit_idx = (int)p.getuint("index");
pit.name = p.getstr("name");
p.priv = pit;
return Parser.Error.NONE;
}
示例13: parse_names_d
public static Parser.Error parse_names_d(Parser p)
{
string name = p.getstr("name");
names_parse s = p.priv as names_parse;
name ns = new name();
if(s.section >= s.nnames.Length) {
return Parser.Error.OUT_OF_BOUNDS;
}
s.nnames[s.section]++;
ns.next = s.names[s.section];
ns.str = name;
s.names[s.section] = ns;
return Parser.Error.NONE;
}
示例14: parse_mp_m
public static Parser.Error parse_mp_m(Parser p)
{
Monster_Pain mp = p.priv as Monster_Pain;
int i;
if (mp == null)
return Parser.Error.MISSING_RECORD_HEADER;
for (i = 0; i < 7; i++)
if (mp.Messages[i] == null)
break;
if (i == 7)
return Parser.Error.TOO_MANY_ENTRIES;
mp.Messages[i] = p.getstr("message");
return Parser.Error.NONE;
}
示例15: parse_r_s
public static Parser.Error parse_r_s(Parser p)
{
Monster_Race r = p.priv as Monster_Race;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
Parser.Error ret = Parser.Error.NONE;
int pct = 0;
string flags = p.getstr("spells");
string[] tokens = flags.Split(new string[]{" ","|"}, StringSplitOptions.RemoveEmptyEntries);
int tat = 0;
while (tat < tokens.Length) {
string s = tokens[tat++];
if(s.StartsWith("1_IN_") && int.TryParse(s.Substring(5), out pct)) {
if (pct < 1 || pct > 100) {
ret = Parser.Error.INVALID_SPELL_FREQ;
break;
}
r.freq_spell = (byte)(100 / pct);
r.freq_innate = r.freq_spell;
} else {
if (grab_flag_msf(r.spell_flags, Monster_Spell_Flag.list, s) != Parser.Error.NONE) {
ret = Parser.Error.INVALID_FLAG;
break;
}
}
}
/*string s = strtok(flags, " |");
while (s) {
if (1 == sscanf(s, "1_IN_%d", &pct)) {
if (pct < 1 || pct > 100) {
ret = Parser.Error.INVALID_SPELL_FREQ;
break;
}
r.freq_spell = 100 / pct;
r.freq_innate = r.freq_spell;
} else {
if (grab_flag(r.spell_flags, RSF_SIZE, r_info_spell_flags, s)) {
ret = Parser.Error.INVALID_FLAG;
break;
}
}
s = strtok(null, " |");
}*/
/* Add the "base monster" flags to the monster */
if (r.Base != null)
r.spell_flags.union(r.Base.spell_flags);
//mem_free(flags);
return ret;
}