public static object GetImgPropVal(this WzProperty prop, Type type, string attributeName) { var tc = Type.GetTypeCode(type); switch (tc) { case TypeCode.Boolean: return(prop.GetInt32(attributeName) != 0); case TypeCode.Byte: return(prop.GetInt8(attributeName)); case TypeCode.Int16: return(prop.GetInt16(attributeName)); case TypeCode.Int32: if (prop.GetAllChildren().Count > 0) { return(0); } return(prop.GetInt32(attributeName)); case TypeCode.Int64: return(prop.GetInt64(attributeName)); case TypeCode.String: return(prop.GetString(attributeName)); case TypeCode.Object: switch (type.Name) { case "Point": { if (prop[attributeName] is WzVector2D vector) { return(new Point(vector.X, vector.Y)); } else { return(new Point()); } } } break; case TypeCode.Double: return(Convert.ToDouble(prop.Get(attributeName))); } throw new InvalidOperationException(); }
private static QuestAct RegisterQuestAct(WzProperty baseNode) { if (baseNode.GetAllChildren().Count <= 0) { return(null); } var rewards = new QuestAct { IncExp = baseNode.GetInt32("exp"), IncMoney = baseNode.GetInt32("money"), IncPop = baseNode.GetInt32("pop"), IncPetTameness = baseNode.GetInt32("pettameness"), IncPetSpeed = baseNode.GetInt32("petspeed"), PetSkill = baseNode.GetInt32("petskill"), NextQuest = baseNode.GetInt32("nextQuest"), BuffItemID = baseNode.GetInt32("buffItemID"), LevelMin = baseNode.GetInt32("lvmin"), LevelMax = baseNode.GetInt32("lvmax"), Info = baseNode.GetString("info") }; if (baseNode["item"] is WzProperty itemRewards) { rewards.Items = itemRewards.GetAllChildren() .Values .Cast <WzProperty>() .Select(item => new QuestAct.ActItem { Item = new ItemInfo { ItemID = item.GetInt32("id"), Count = item.GetInt32("count"), }, Period = item.GetInt32("period"), JobFlag = item.GetInt32("job"), Gender = item.GetInt32("gender"), ProbRate = item.GetInt32("prop"), ItemVariation = item.GetInt32("var"), }) .ToArray(); } if (baseNode["skill"] is WzProperty skillRewards) { rewards.Skills = skillRewards.GetAllChildren() .Values .Cast <WzProperty>() .Select(item => new QuestAct.ActSkill { SkillID = item.GetInt32("id"), MasterLevel = item.GetInt32("masterLevel"), SkillLevel = item.GetInt32("skillLevel") != 0 ? item.GetInt32("skillLevel") : item.GetInt32("acquire"), Job = (item["job"] as WzProperty)?.GetAllChildren().Values.Cast <int>() .ToArray() ?? new int[0] }) .ToArray(); } return(rewards); }
private void ProcessSkillData(WzProperty baseNode, SkillTemplate entry) { // level data entry.ItemConsumeAmount = baseNode.GetInt32("itemConNo"); entry.BulletCount = baseNode.GetInt32("bulletCount"); entry.BulletConsume = baseNode.GetInt32("bulletCon"); entry.ItemConsume = baseNode.GetInt32("itemCon"); entry.OptionalItemCost = baseNode.GetInt32("itemConsume"); entry.Morph = baseNode.GetInt32("morph"); // verified if (baseNode.Get("lt") is WzVector2D lt) { entry.LT = new Point(lt.X, lt.Y); } // verified if (baseNode["rb"] is WzVector2D rb) { entry.RB = new Point(rb.X, rb.Y); } entry.InitSLD(entry.MaxLevel + entry.CombatOrders); var isLevelNode = baseNode.Name.Equals("level"); var parentNode = baseNode; // verified for (var i = 0; i < entry.DataLength; i++) { var level = i + 1; entry[level] = new SkillLevelData(); if (isLevelNode) { baseNode = parentNode[level.ToString()] as WzProperty ?? parentNode; } entry[level].FixDamage = GetEvalInt(baseNode.GetString("fixdamage"), level); entry[level].AttackCount = GetEvalInt(baseNode.GetString("attackCount"), level); entry[level].MobCount = GetEvalInt(baseNode.GetString("mobCount"), level); entry[level].Time = GetEvalInt(baseNode.GetString("time"), level); entry[level].SubTime = GetEvalInt(baseNode.GetString("subTime"), level); entry[level].MpCon = GetEvalInt(baseNode.GetString("mpCon"), level); entry[level].HpCon = GetEvalInt(baseNode.GetString("hpCon"), level); entry[level].Damage = GetEvalInt(baseNode.GetString("damage"), level); entry[level].Mastery = GetEvalInt(baseNode.GetString("mastery"), level); entry[level].DamR = GetEvalInt(baseNode.GetString("damR"), level); entry[level].Dot = GetEvalInt(baseNode.GetString("dot"), level); entry[level].DotTime = GetEvalInt(baseNode.GetString("dotTime"), level); entry[level].MESOr = GetEvalInt(baseNode.GetString("mesoR"), level); entry[level].Speed = GetEvalInt(baseNode.GetString("speed"), level); entry[level].Jump = GetEvalInt(baseNode.GetString("jump"), level); entry[level].PAD = GetEvalInt(baseNode.GetString("pad"), level); entry[level].MAD = GetEvalInt(baseNode.GetString("mad"), level); entry[level].PDD = GetEvalInt(baseNode.GetString("pdd"), level); entry[level].MDD = GetEvalInt(baseNode.GetString("mdd"), level); entry[level].EVA = GetEvalInt(baseNode.GetString("eva"), level); entry[level].ACC = GetEvalInt(baseNode.GetString("acc"), level); entry[level].HP = GetEvalInt(baseNode.GetString("hp"), level); entry[level].MHPr = GetEvalInt(baseNode.GetString("mhpR"), level); entry[level].MP = GetEvalInt(baseNode.GetString("mp"), level); entry[level].MMPr = GetEvalInt(baseNode.GetString("mmpR"), level); entry[level].Prop = GetEvalInt(baseNode.GetString("prop"), level); entry[level].SubProp = GetEvalInt(baseNode.GetString("subProp"), level); entry[level].Cooltime = GetEvalInt(baseNode.GetString("cooltime"), level); entry[level].ASRr = GetEvalInt(baseNode.GetString("asrR"), level); entry[level].TERr = GetEvalInt(baseNode.GetString("terR"), level); entry[level].EMDD = GetEvalInt(baseNode.GetString("emdd"), level); entry[level].EMHP = GetEvalInt(baseNode.GetString("emhp"), level); entry[level].EMMP = GetEvalInt(baseNode.GetString("emmp"), level); entry[level].EPAD = GetEvalInt(baseNode.GetString("epad"), level); entry[level].EPDD = GetEvalInt(baseNode.GetString("epdd"), level); entry[level].Cr = GetEvalInt(baseNode.GetString("cr"), level); entry[level].T = GetEvalDouble(baseNode.GetString("t"), level); entry[level].U = GetEvalDouble(baseNode.GetString("u"), level); entry[level].V = GetEvalDouble(baseNode.GetString("v"), level); entry[level].W = GetEvalDouble(baseNode.GetString("w"), level); entry[level].X = GetEvalDouble(baseNode.GetString("x"), level); entry[level].Y = GetEvalDouble(baseNode.GetString("y"), level); entry[level].Z = GetEvalDouble(baseNode.GetString("z"), level); entry[level].PADr = GetEvalInt(baseNode.GetString("padR"), level); entry[level].PADx = GetEvalInt(baseNode.GetString("padX"), level); entry[level].MADr = GetEvalInt(baseNode.GetString("madR"), level); entry[level].MADx = GetEvalInt(baseNode.GetString("madX"), level); entry[level].PDDr = GetEvalInt(baseNode.GetString("pddR"), level); entry[level].MDDr = GetEvalInt(baseNode.GetString("mddR"), level); entry[level].EVAr = GetEvalInt(baseNode.GetString("evaR"), level); entry[level].ACCr = GetEvalInt(baseNode.GetString("accR"), level); entry[level].IMPr = GetEvalInt(baseNode.GetString("ignoreMobpdpR"), level); entry[level].IMDr = GetEvalInt(baseNode.GetString("ignoreMobDamR"), level); entry[level].CDMin = GetEvalInt(baseNode.GetString("criticaldamageMin"), level); entry[level].CDMax = GetEvalInt(baseNode.GetString("criticaldamageMax"), level); entry[level].EXPr = GetEvalInt(baseNode.GetString("expR"), level); entry[level].Er = GetEvalInt(baseNode.GetString("er"), level); entry[level].Ar = GetEvalInt(baseNode.GetString("ar"), level); entry[level].OCr = GetEvalInt(baseNode.GetString("overChargeR"), level); entry[level].DCr = GetEvalInt(baseNode.GetString("disCountR"), level); entry[level].PDamr = GetEvalInt(baseNode.GetString("pdR"), level); entry[level].MDamr = GetEvalInt(baseNode.GetString("mdR"), level); entry[level].PsdJump = GetEvalInt(baseNode.GetString("psdJump"), level); entry[level].PsdSpeed = GetEvalInt(baseNode.GetString("psdSpeed"), level); // skill bufftime modification switch ((Skills)entry.TemplateId) { case Skills.MECHANIC_FLAMETHROWER: case Skills.MECHANIC_FLAMETHROWER_UP: entry[level].Time = 1; break; case Skills.MECHANIC_HN07: // mount case Skills.WILDHUNTER_JAGUAR_RIDING: // mount case Skills.MECHANIC_SAFETY: // permanent case Skills.MECHANIC_PERFECT_ARMOR: // permanent case Skills.MECHANIC_SIEGE2: // semi-permanent (uses hp per sec) entry[level].Time = -1; break; case Skills.MECHANIC_SG88: case Skills.MECHANIC_SATELITE: case Skills.MECHANIC_SATELITE2: case Skills.MECHANIC_SATELITE3: entry[level].Time = 2100000; break; case Skills.CROSSBOWMAN_FINAL_ATTACK_CROSSBOW: case Skills.FIGHTER_FINAL_ATTACK: case Skills.HUNTER_FINAL_ATTACK_BOW: case Skills.PAGE_FINAL_ATTACK: case Skills.SOULMASTER_FINAL_ATTACK_SWORD: case Skills.SPEARMAN_FINAL_ATTACK: case Skills.WILDHUNTER_FINAL_ATTACK: case Skills.WINDBREAKER_FINAL_ATTACK_BOW: entry[level].MobCount = 3; break; } // bullet/attack/mob count modification switch ((Skills)entry.TemplateId) { case Skills.MECHANIC_SIEGE1: case Skills.MECHANIC_SIEGE2: case Skills.MECHANIC_SIEGE2_SPECIAL: entry[level].AttackCount = 6; entry.BulletCount = 6; break; } } }