Exemplo n.º 1
0
 private static void AnimsXML(XmlNode xmlNode, ObjModel obj)
 {
     for (XmlNode xmlNode1 = xmlNode.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
     {
         if ("Anims".Equals(xmlNode1.Name))
         {
             for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
             {
                 if ("Anim".Equals(xmlNode2.Name))
                 {
                     XmlNamedNodeMap attributes = (XmlNamedNodeMap)xmlNode2.Attributes;
                     AnimModel       animModel  = new AnimModel()
                     {
                         _id        = int.Parse(attributes.GetNamedItem("Id").Value),
                         _duration  = float.Parse(attributes.GetNamedItem("Duration").Value),
                         _nextAnim  = int.Parse(attributes.GetNamedItem("Next").Value),
                         _otherObj  = int.Parse(attributes.GetNamedItem("OtherOBJ").Value),
                         _otherAnim = int.Parse(attributes.GetNamedItem("OtherANIM").Value)
                     };
                     if (animModel._id == 0)
                     {
                         obj._noInstaSync = true;
                     }
                     if (animModel._id != (int)byte.MaxValue)
                     {
                         obj._updateId = 3;
                     }
                     obj._anims.Add(animModel);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 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);
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 private static void ObjectsXML(XmlNode xmlNode, MapModel map)
 {
     for (XmlNode xmlNode1 = xmlNode.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
     {
         if ("objects".Equals(xmlNode1.Name))
         {
             for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
             {
                 if ("Obj".Equals(xmlNode2.Name))
                 {
                     XmlNamedNodeMap attributes = (XmlNamedNodeMap)xmlNode2.Attributes;
                     XmlNode         namedItem1 = attributes.GetNamedItem("Type");
                     XmlNode         namedItem2 = attributes.GetNamedItem("NeedSync");
                     string          str        = namedItem1 != null ? namedItem1.Value : "";
                     ObjModel        objModel   = new ObjModel(namedItem2 != null && bool.Parse(namedItem2.Value))
                     {
                         _id    = int.Parse(attributes.GetNamedItem("Id").Value),
                         _life  = int.Parse(attributes.GetNamedItem("Life").Value),
                         _anim1 = int.Parse(attributes.GetNamedItem("Anim1").Value)
                     };
                     if (str == "usable")
                     {
                         objModel.canBeUsed = true;
                     }
                     if (objModel._life > -1)
                     {
                         objModel.isDestroyable = true;
                     }
                     if (objModel._anim1 > (int)byte.MaxValue)
                     {
                         if (objModel._anim1 == 256)
                         {
                             objModel._ultraSYNC = 1;
                         }
                         else if (objModel._anim1 == 257)
                         {
                             objModel._ultraSYNC = 2;
                         }
                         else if (objModel._anim1 == 258)
                         {
                             objModel._ultraSYNC = 3;
                         }
                         else if (objModel._anim1 == 259)
                         {
                             objModel._ultraSYNC = 4;
                         }
                         objModel._anim1 = (int)byte.MaxValue;
                     }
                     MappingXML.AnimsXML(xmlNode2, objModel);
                     MappingXML.DEffectsXML(xmlNode2, objModel);
                     map._objects.Add(objModel);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 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);
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
 public static void SetObjectives(ObjModel obj, Room room)
 {
     if (obj._ultraSYNC == 0)
     {
         return;
     }
     if (obj._ultraSYNC == 1 || obj._ultraSYNC == 3)
     {
         room._bar1     = obj._life;
         room._default1 = room._bar1;
     }
     else if (obj._ultraSYNC == 2 || obj._ultraSYNC == 4)
     {
         room._bar2     = obj._life;
         room._default2 = room._bar2;
     }
 }
Exemplo n.º 6
0
        public void GetAnim(int animId, float time, float duration, ObjectInfo obj)
        {
            if (animId == 255 || obj == null || obj._model == null || obj._model._anims == null || obj._model._anims.Count == 0)
            {
                return;
            }
            ObjModel objModel = obj._model;

            for (int i = 0; i < objModel._anims.Count; i++)
            {
                AnimModel anim = objModel._anims[i];
                if (anim._id == animId)
                {
                    obj._anim    = anim;
                    time        -= duration;
                    obj._useDate = DateTime.Now.AddSeconds(time * -1);
                    break;
                }
            }
        }
Exemplo n.º 7
0
        public void SelectAnimToObj(int animId, float time, float duration, ObjectInfo obj)
        {
            if (animId == (int)byte.MaxValue || obj == null || (obj._model == null || obj._model._anims == null) || obj._model._anims.Count == 0)
            {
                return;
            }
            ObjModel model = obj._model;

            for (int index = 0; index < model._anims.Count; ++index)
            {
                AnimModel anim = model._anims[index];
                if (anim._id == animId)
                {
                    obj._anim = anim;
                    time     -= duration;
                    obj.lastInteractionTime = DateTime.Now.AddSeconds((double)time * -1.0);
                    break;
                }
            }
        }
Exemplo n.º 8
0
 private static void DEffectsXML(XmlNode xmlNode, ObjModel obj)
 {
     for (XmlNode xmlNode1 = xmlNode.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
     {
         if ("DestroyEffects".Equals(xmlNode1.Name))
         {
             for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
             {
                 if ("Effect".Equals(xmlNode2.Name))
                 {
                     XmlNamedNodeMap attributes   = (XmlNamedNodeMap)xmlNode2.Attributes;
                     DEffectModel    deffectModel = new DEffectModel()
                     {
                         _id   = int.Parse(attributes.GetNamedItem("Id").Value),
                         _life = int.Parse(attributes.GetNamedItem("Percent").Value)
                     };
                     obj._effects.Add(deffectModel);
                 }
             }
         }
     }
 }
Exemplo n.º 9
0
 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 = int.Parse(xml6.GetNamedItem("Percent").Value)
                     };
                     obj._effects.Add(anim);
                 }
             }
         }
     }
 }