public static new MoveNpcStatueAction FromXmlElement(XmlElement xmlData) {
      MoveNpcStatueAction resultingAction = new MoveNpcStatueAction();
      resultingAction.NpcType = int.Parse(xmlData["NpcId"].InnerText);
      resultingAction.SpawnIfNotExistent = bool.Parse(xmlData["SpawnIfNotExistent"].InnerText);
      resultingAction.CheckRange = int.Parse(xmlData["CheckRange"].InnerText);

      return resultingAction;
    }
Example #2
0
        public static new MoveNpcStatueAction FromXmlElement(XmlElement xmlData)
        {
            MoveNpcStatueAction resultingAction = new MoveNpcStatueAction();

            resultingAction.NpcType            = int.Parse(xmlData["NpcId"].InnerText);
            resultingAction.SpawnIfNotExistent = bool.Parse(xmlData["SpawnIfNotExistent"].InnerText);
            resultingAction.CheckRange         = int.Parse(xmlData["CheckRange"].InnerText);

            return(resultingAction);
        }
        public static StatueConfig FromXmlElement(XmlElement xmlData)
        {
            StatueConfig resultingStatueConfig = new StatueConfig();

            if (xmlData["PlayerCheckRange"] != null)
            {
                resultingStatueConfig.PlayerCheckRange = int.Parse(xmlData["PlayerCheckRange"].InnerText);
            }
            resultingStatueConfig.Cooldown = int.Parse(xmlData["Cooldown"].InnerText);
            if (xmlData["TriggerPermission"] != null)
            {
                resultingStatueConfig.TriggerPermission = xmlData["TriggerPermission"].InnerText;
            }
            if (xmlData["WirePermission"] != null)
            {
                resultingStatueConfig.WirePermission = xmlData["WirePermission"].InnerText;
            }

            XmlElement actionListNode = xmlData["Actions"];

            resultingStatueConfig.ActionsProcessingMethod = (ActionListProcessingMethod)Enum.Parse(
                typeof(ActionListProcessingMethod), actionListNode.Attributes["ProcessingMethod"].Value
                );
            foreach (XmlElement actionNode in actionListNode.ChildNodes)
            {
                switch (actionNode.LocalName)
                {
                case "NullAction":
                    resultingStatueConfig.Actions.Add(NullStatueAction.FromXmlElement(actionNode));
                    break;

                case "MoveNpcAction":
                    resultingStatueConfig.Actions.Add(MoveNpcStatueAction.FromXmlElement(actionNode));
                    break;

                case "SpawnNpcAction":
                    resultingStatueConfig.Actions.Add(SpawnNpcStatueAction.FromXmlElement(actionNode));
                    break;

                case "SpawnItemAction":
                    resultingStatueConfig.Actions.Add(SpawnItemStatueAction.FromXmlElement(actionNode));
                    break;

                case "BuffPlayerAction":
                    resultingStatueConfig.Actions.Add(BuffPlayerStatueAction.FromXmlElement(actionNode));
                    break;
                }
            }

            return(resultingStatueConfig);
        }