private DialogCondition ParseVariableValueCondtion(string name, UniXMLElement element)
        {
            string varName    = element.GetString("name");
            string updateText = string.Empty;

            if (element.HasAttribute("update_text"))
            {
                updateText = element.GetString("update_text");
            }
            switch (name)
            {
            case QuestConditionName.INT_VARIABLE_VALUE_EQ: {
                int val = element.GetInt("value");
                return(new IntVariableValueEQCondition(varName, val, updateText));
            }

            case QuestConditionName.INT_VARIABLE_VARLUE_GE: {
                int val = element.GetInt("value");
                return(new IntVariableValueGECondition(varName, val, updateText));
            }

            case QuestConditionName.BOOL_VARIABLE_VALUE_EQ: {
                bool val = element.GetBool("value");
                return(new BoolVariableValueEQCondition(varName, val, updateText));
            }

            case QuestConditionName.FLOAT_VARIABLE_VALUE_EQ: {
                float val = element.GetFloat("value");
                return(new FloatVariableValueEQCondition(varName, val, updateText));
            }

            default:
                return(null);
            }
        }
Example #2
0
        public ImageComposeData(UniXMLElement element)
            : base(element)
        {
            if (element.HasAttribute("path"))
            {
                m_Path = element.GetString("path");
            }
            else
            {
                m_Path = string.Empty;
            }

            if (element.HasAttribute("width"))
            {
                m_Width = element.GetInt("width");
            }
            else
            {
                m_Width = 0;
            }

            if (element.HasAttribute("height"))
            {
                m_Height = element.GetInt("height");
            }
            else
            {
                m_Height = 0;
            }
        }
Example #3
0
 public ContractItemData(UniXMLElement element)
 {
     id          = element.GetString("id");
     name        = element.GetString("name");
     description = element.GetString("description");
     icon        = element.GetString("icon");
 }
Example #4
0
 public LoreStoryData(UniXMLElement element)
 {
     name    = element.GetString("name");
     records = element.Elements("record").Select(e => {
         return(new LoreRecordData(e));
     }).ToList();
 }
Example #5
0
 public AchievmentTierData(UniXMLElement element)
 {
     id = element.GetInt("id");
     //name            = element.GetString("name");
     count  = element.GetInt("count");
     points = element.GetInt("points");
 }
        public void Load(string xml, string lang)
        {
            UniXmlDocument document    = new UniXmlDocument(xml);
            UniXMLElement  langElement = null;

            switch (lang)
            {
            case "ru": {
                langElement = new UniXMLElement(document.document.Element("compose").Element("ru"));
            }
            break;

            default: {
                langElement = new UniXMLElement(document.document.Element("compose").Element("en"));
            }
            break;
            }

            m_ComposeCollection = new Dictionary <string, ComposeData>();
            var dump = langElement.Elements("data").Select(e => {
                ComposeData composeData = new ComposeData(e);
                m_ComposeCollection.Add(composeData.name, composeData);
                return(composeData);
            }).ToList();
        }
Example #7
0
        public QuestCompletedQuestCondition(UniXMLElement element)
        {
            string questStr = element.GetString("value");

            string[] questArr = questStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            QuestIds = new List <string>();
            QuestIds.AddRange(questArr);
        }
Example #8
0
 public ManStageData(UniXMLElement element)
 {
     stage     = element.GetInt("id");
     textId    = element.GetString("text");
     eventName = element.GetString("event");
     hintId    = element.GetString("hint");
     statName  = element.HasAttribute("statname") ? element.GetString("statname") : string.Empty;
 }
Example #9
0
 public StartPlayerRaceModel(UniXMLElement parent)
 {
     race   = (Race)Enum.Parse(typeof(Race), parent.GetString("id"));
     models = new Dictionary <Workshop, StartPlayerWorkshopModel>();
     var dump = parent.Element("workshops").Elements("workshop").Select(we => {
         StartPlayerWorkshopModel wModel = new StartPlayerWorkshopModel(we);
         models.Add(wModel.workshop, wModel);
         return(wModel);
     }).ToList();
 }
Example #10
0
        public PlanetOreEntry(UniXMLElement element)
        {
            id = element.GetString("id");
            string oresStr = element.GetString("ores");

            ores = new List <string>();
            foreach (string sOre in oresStr.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries))
            {
                ores.Add(sOre.Trim());
            }
        }
 public AchievmentCategoryData(UniXMLElement element)
 {
     id          = element.GetString("id");
     name        = element.GetString("name");
     achievments = new Dictionary <string, AchievmentData>();
     var dump = element.element.Elements("achievment").Select(aElement => {
         AchievmentData data = new AchievmentData(new UniXMLElement(aElement));
         achievments.Add(data.id, data);
         return(data);
     }).ToList();
 }
 public StartPlayerWorkshopModel(UniXMLElement parent)
 {
     workshop = (Workshop)System.Enum.Parse(typeof(Workshop), parent.GetString("id"));
     model    = new Dictionary <ShipModelSlotType, string>();
     var dump = parent.Elements("module").Select(e => {
         ShipModelSlotType type = (ShipModelSlotType)Enum.Parse(typeof(ShipModelSlotType), e.GetString("type"));
         string id = e.GetString("id");
         model.Add(type, id);
         return(type);
     }).ToList();
 }
Example #13
0
        private void LoadBaseData(UniXMLElement parent, Race race, string elementName)
        {
            var raceElement = parent.Element("base_data").Element(elementName);

            if (raceElement != null)
            {
                BaseData data = new BaseData();
                data.Load(raceElement);
                RaceBaseData[race] = data;
            }
        }
        public void Load(string xml)
        {
            UniXmlDocument document = new UniXmlDocument(xml);

            models = new Dictionary <Race, StartPlayerRaceModel>();
            UniXMLElement root = new UniXMLElement(document.document.Element("races"));
            var           dump = root.Elements("race").Select(e => {
                StartPlayerRaceModel raceModel = new StartPlayerRaceModel(e);
                models.Add(raceModel.race, raceModel);
                return(raceModel);
            }).ToList();
        }
Example #15
0
 public ContractReward(UniXMLElement element)
 {
     rewardType = (ContractRewardType)System.Enum.Parse(typeof(ContractRewardType), element.element.GetString("type"));
     if (element.HasAttribute("name"))
     {
         name = element.GetString("name");
     }
     else
     {
         name = string.Empty;
     }
 }
Example #16
0
 public AchievmentData(UniXMLElement element)
 {
     tiers       = new Dictionary <int, Achievments.AchievmentTierData>();
     id          = element.GetString("id");
     name        = element.GetString("name");
     description = element.GetString("description");
     variable    = element.GetString("var");
     var dump = element.element.Elements("tier").Select(tierElement => {
         AchievmentTierData tierData = new Achievments.AchievmentTierData(new UniXMLElement(tierElement));
         tiers.Add(tierData.id, tierData);
         return(tierData);
     }).ToList();
 }
Example #17
0
 public SchemeContractReward(UniXMLElement element)
     : base(element)
 {
     color = (ObjectColor)Enum.Parse(typeof(ObjectColor), element.element.GetString("color"));
     if (element.HasAttribute("count"))
     {
         count = element.GetInt("count");
     }
     else
     {
         count = 0;
     }
 }
        private DialogCondition Create(UniXMLElement element)
        {
            string type = element.GetString("type");

            switch (type)
            {
            case QuestConditionName.ON_STATION: {
                return(new OnStationCondition());
            }

            case QuestConditionName.QUEST_COMPLETED: {
                string questId = element.GetString("id");
                return(new QuestCompletedCondition(questId));
            }

            case QuestConditionName.AT_SPACE: {
                return(new AtSpaceCondition());
            }

            case QuestConditionName.DIALOG_COMPLETED: {
                string id = element.GetString("id");
                return(new DialogCompletedCondition(id));
            }

            case QuestConditionName.USER_EVENT: {
                UserEventName eventName = (UserEventName)Enum.Parse(typeof(UserEventName), element.GetString("name"));
                return(CreateUserEventCondition(element, eventName));
            }

            case QuestConditionName.COUNT_OF_ITEMS_GE: {
                string id = element.GetString("id");
                InventoryObjectType itemType = (InventoryObjectType)Enum.Parse(typeof(InventoryObjectType), element.GetString("item_type"));
                int    value      = element.GetInt("value");
                string updateText = string.Empty;
                if (element.HasAttribute("update_text"))
                {
                    updateText = element.GetString("update_text");
                }
                return(new CountOfItemsGECondition(itemType, id, value, updateText));
            }

            case QuestConditionName.INT_VARIABLE_VALUE_EQ:
            case QuestConditionName.INT_VARIABLE_VARLUE_GE:
            case QuestConditionName.FLOAT_VARIABLE_VALUE_EQ:
            case QuestConditionName.BOOL_VARIABLE_VALUE_EQ:
                return(ParseVariableValueCondtion(type, element));

            default:
                return(null);
            }
        }
        public List <DialogCondition> CreateList(UniXMLElement parent)
        {
            List <DialogCondition> result = new List <DialogCondition>();
            var dumpList = parent.Elements("condition").Select(cElement => {
                var condition = Create(cElement);
                if (condition != null)
                {
                    result.Add(condition);
                }
                return(condition);
            }).ToList();

            return(result);
        }
Example #20
0
        public TextComposeData(UniXMLElement element)
            : base(element)
        {
            m_Text = element.innerValue.Trim();

            if (element.HasAttribute("size"))
            {
                m_Size = (ComposeTextSize)System.Enum.Parse(typeof(ComposeTextSize), element.GetString("size"));
            }
            else
            {
                m_Size = ComposeTextSize.medium;
            }
        }
Example #21
0
        private StageMarker ParseMarker(UniXMLElement element)
        {
            MarkerType type = (MarkerType)Enum.Parse(typeof(MarkerType), element.GetString("type"));

            switch (type)
            {
            case MarkerType.point: {
                string  world = element.GetString("world");
                Vector3 point = element.GetFloatArray("point").ToVector3();
                return(new PointMarker(world, point));
            }

            default:
                return(null);
            }
        }
        public void Load(UniXMLElement parent)
        {
            Repeat    = parent.GetInt("repeat", 1);
            HintWorld = parent.GetString("hint_world", string.Empty);

            Conditions.Clear();
            QuestConditionParser parser = new QuestConditionParser();

            foreach (UniXMLElement conditionElement in parent.Elements("condition"))
            {
                QuestCondition condition = parser.Parse(conditionElement);
                if (condition != null)
                {
                    Conditions.Add(condition);
                }
            }
        }
Example #23
0
        public QuestCondition Parse(UniXMLElement element)
        {
            QuestConditionType type = element.GetEnum <QuestConditionType>("type");

            switch (type)
            {
            case QuestConditionType.player_level_ge: {
                return(new PlayerLevelGEQuestCondition(element));
            }

            case QuestConditionType.npc_killed_with_level: {
                return(new NpcKilledWithLevelQuestCondition(element));
            }

            case QuestConditionType.npc_killed_with_class: {
                return(new NpcKilledWithClassQuestCondition(element));
            }

            case QuestConditionType.npc_killed_with_color: {
                return(new NpcKilledWithColorQuestCondition(element));
            }

            case QuestConditionType.quest_completed: {
                return(new QuestCompletedQuestCondition(element));
            }

            case QuestConditionType.module_crafted: {
                return(new ModuleCraftedQuestCondition(element));
            }

            case QuestConditionType.collect_ore: {
                return(new CollectOreQuestCondition(element));
            }

            case QuestConditionType.create_structure: {
                return(new CreateStructureQuestCondition(element));
            }

            case QuestConditionType.npc_killed_with_bot_group: {
                return(new NpcKilledWithBotGroupQuestCondition(element));
            }
            }
            return(null);
        }
Example #24
0
        public NpcKilledWithClassQuestCondition(UniXMLElement element)
        {
            Classes = new List <Workshop>();
            string classStr = element.GetString("value");

            if (string.IsNullOrEmpty(classStr) || (classStr.ToLower() == "any"))
            {
                Classes.AddRange((Workshop[])Enum.GetValues(typeof(Workshop)));
            }
            else
            {
                string[] classesArr = classStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string str in classesArr)
                {
                    Workshop workshop = (Workshop)Enum.Parse(typeof(Workshop), str);
                    Classes.Add(workshop);
                }
            }
        }
Example #25
0
        public NpcKilledWithColorQuestCondition(UniXMLElement element)
        {
            Colors = new List <ObjectColor>();
            string colorStr = element.GetString("value");

            if (string.IsNullOrEmpty(colorStr) || colorStr.ToLower() == "any")
            {
                Colors.AddRange((ObjectColor[])Enum.GetValues(typeof(ObjectColor)));
            }
            else
            {
                string[] colorArr = colorStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string c in colorArr)
                {
                    ObjectColor color = (ObjectColor)Enum.Parse(typeof(ObjectColor), c);
                    Colors.Add(color);
                }
            }
        }
Example #26
0
        public List <StageMarker> ParseMarkerList(UniXMLElement parent)
        {
            List <StageMarker> markers = new List <StageMarker>();

            if (parent == null)
            {
                return(markers);
            }

            var dump = parent.Elements("marker").Select(me => {
                StageMarker marker = ParseMarker(me);
                if (marker != null)
                {
                    markers.Add(marker);
                }
                return(marker);
            }).ToList();

            return(markers);
        }
Example #27
0
        public ComposeData(UniXMLElement element)
        {
            m_Name     = element.GetString("name");
            m_Elements = new List <ComposeElementData>();

            var dump = element.Elements().Select(e => {
                switch (e.name)
                {
                case "text": {
                    m_Elements.Add(new TextComposeData(e));
                }
                break;

                case "image": {
                    m_Elements.Add(new ImageComposeData(e));
                }
                break;
                }
                return(e);
            }).ToList();
        }
Example #28
0
 public ComposeElementData(UniXMLElement element)
 {
     if (element.HasAttribute("color"))
     {
         string     colorString = element.GetString("color");
         string[]   tokens      = colorString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
         List <int> colorList   = new List <int>();
         foreach (string tok in tokens)
         {
             colorList.Add(int.Parse(tok));
         }
         while (colorList.Count < 4)
         {
             colorList.Add(255);
         }
         m_Color = colorList.ToArray();
     }
     else
     {
         m_Color = new int[] { 255, 255, 255, 255 };
     }
 }
Example #29
0
        public ManQuestData(UniXMLElement element)
        {
            id = element.GetString("id");
            //type = (ManQuestCategory)System.Enum.Parse(typeof(ManQuestCategory), element.GetString("type"));
            name         = element.GetString("name");
            startText    = element.GetString("start_text");
            completeText = element.GetString("complete_text");
            index        = element.GetInt("index");

            prevQuests = new List <string>();
            string prevQuestString = element.GetString("prev_quests");

            string[] tokens = prevQuestString.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);

            if (tokens.Length > 0)
            {
                prevQuests.AddRange(tokens);
            }

            stages = element.Elements("stage").Select(se => {
                return(new ManStageData(se));
            }).ToList();
        }
Example #30
0
        public void Load(UniXMLElement element)
        {
            Id           = element.GetString("id");
            Type         = element.GetEnum <QuestType>("type");
            RaceBaseData = new Dictionary <Race, BaseData>();
            LoadBaseData(element, Race.Humans, "humans");
            LoadBaseData(element, Race.Borguzands, "borgs");
            LoadBaseData(element, Race.Criptizoids, "krips");

            Rewards = new List <QuestRewardData>();
            foreach (var rewardElement in element.Element("rewards").Elements("reward"))
            {
                QuestRewardData reward = new QuestRewardData();
                reward.Load(rewardElement);
                Rewards.Add(reward);
            }

            var humansCompleteConditions = element.Element("complete_conditions").Element("humans");
            var borgsCompleteConditions  = element.Element("complete_conditions").Element("borgs");
            var kripsCompleteConditions  = element.Element("complete_conditions").Element("krips");

            QuestConditionCollection humanComplete = new QuestConditionCollection();

            humanComplete.Load(humansCompleteConditions);

            QuestConditionCollection borgsComple = new QuestConditionCollection();

            borgsComple.Load(borgsCompleteConditions);

            QuestConditionCollection kripsComplete = new QuestConditionCollection();

            kripsComplete.Load(kripsCompleteConditions);

            CompleteConditions[Race.Humans]      = humanComplete;
            CompleteConditions[Race.Borguzands]  = borgsComple;
            CompleteConditions[Race.Criptizoids] = kripsComplete;
        }