private static void AnimsXML(XmlNode xmlNode, ObjModel obj) { for (XmlNode xmlNode5 = xmlNode.FirstChild; xmlNode5 != null; xmlNode5 = xmlNode5.NextSibling) { if ("Anims".Equals(xmlNode5.Name)) { for (XmlNode xmlNode6 = xmlNode5.FirstChild; xmlNode6 != null; xmlNode6 = xmlNode6.NextSibling) { if ("Sync".Equals(xmlNode6.Name)) { XmlNamedNodeMap xml6 = xmlNode6.Attributes; AnimModel anim = new AnimModel { Id = int.Parse(xml6.GetNamedItem("Id").Value), Duration = float.Parse(xml6.GetNamedItem("Date").Value), NextAnim = int.Parse(xml6.GetNamedItem("Next").Value), OtherObj = int.Parse(xml6.GetNamedItem("OtherOBJ").Value), OtherAnim = int.Parse(xml6.GetNamedItem("OtherANIM").Value) }; if (anim.Id == 0) { obj.NoInstaSync = true; } if (anim.Id != 255) { obj.UpdateId = 3; } obj.Anims.Add(anim); } } } } }
private static void ObjectsXML(XmlNode xmlNode, MapModel map) { for (XmlNode xmlNode3 = xmlNode.FirstChild; xmlNode3 != null; xmlNode3 = xmlNode3.NextSibling) { if ("objects".Equals(xmlNode3.Name)) { for (XmlNode xmlNode4 = xmlNode3.FirstChild; xmlNode4 != null; xmlNode4 = xmlNode4.NextSibling) { if ("Obj".Equals(xmlNode4.Name)) { XmlNamedNodeMap xml4 = xmlNode4.Attributes; ObjModel obj = new ObjModel(bool.Parse(xml4.GetNamedItem("NeedSync").Value)) { Id = int.Parse(xml4.GetNamedItem("Id").Value), Life = int.Parse(xml4.GetNamedItem("Life").Value), Anim1 = int.Parse(xml4.GetNamedItem("Anim1").Value) }; if (obj.Life > -1) { obj.IsDestroyable = true; } if (obj.Anim1 > 255) { if (obj.Anim1 == 256) { obj.UltraSYNC = 1; } else if (obj.Anim1 == 257) { obj.UltraSYNC = 2; } else if (obj.Anim1 == 258) { obj.UltraSYNC = 3; } else if (obj.Anim1 == 259) { obj.UltraSYNC = 4; } obj.Anim1 = 255; } AnimsXML(xmlNode4, obj); DEffectsXML(xmlNode4, obj); map.objects.Add(obj); } } } } }
public void GetAnim(int animId, float time, float duration, ObjectInfo obj) { if (animId == 255 || obj == null || obj.info == null || obj.info.Anims == null || obj.info.Anims.Count == 0) { return; } ObjModel objModel = obj.info; for (int i = 0; i < objModel.Anims.Count; i++) { AnimModel anim = objModel.Anims[i]; if (anim.Id == animId) { obj.animation = anim; time -= duration; obj.useDate = DateTime.Now.AddSeconds(time * -1); break; } } }
private static void DEffectsXML(XmlNode xmlNode, ObjModel obj) { for (XmlNode xmlNode5 = xmlNode.FirstChild; xmlNode5 != null; xmlNode5 = xmlNode5.NextSibling) { if ("DestroyEffects".Equals(xmlNode5.Name)) { for (XmlNode xmlNode6 = xmlNode5.FirstChild; xmlNode6 != null; xmlNode6 = xmlNode6.NextSibling) { if ("Effect".Equals(xmlNode6.Name)) { XmlNamedNodeMap xml6 = xmlNode6.Attributes; DEffectModel anim = new DEffectModel { Id = int.Parse(xml6.GetNamedItem("Id").Value), Life = uint.Parse(xml6.GetNamedItem("Percent").Value) }; obj.Effects.Add(anim); } } } } }