public Npc(Variant config) { ID = config.GetStringOrDefault("_id"); NpcType = config.GetStringOrDefault("SubType"); Name = config.GetStringOrDefault("Name"); m_value = config.GetVariantOrDefault("Value"); if (m_value != null) { m_task = m_value.GetVariantOrDefault("Task"); SceneID = m_value.GetStringOrDefault("SceneID"); X = m_value.GetIntOrDefault("X"); Y = m_value.GetIntOrDefault("Y"); object lev; if (m_value.TryGetValueT("MustKill", out lev)) { if (lev is bool) { if ((bool)lev) { m_killLev = 1; } } else if (lev != null) { int.TryParse(lev.ToString(), out m_killLev); } } } }
/// <summary> /// 判断是否存在某等级的技能 /// </summary> /// <param name="v"></param> /// <param name="skillid">技能ID</param> /// <param name="level">技能等级</param> /// <returns>true表示存在,false表示不存在</returns> public bool PetSkillIDLevel(Variant v, string skillid, int level) { if (v == null) return false; IList ls; if (v.TryGetValueT(skillid, out ls)) { if (ls.Contains(level)) return true; } return false; }