Exemplo n.º 1
0
        public void createResults()
        {
            //System.Console.WriteLine("CQuests::createResults");

            if (!this.locales.Keys.Contains(parent.settings.getCurrentLocale()))
            {
                return;
            }
            Dictionary <int, CQuest> results = new Dictionary <int, CQuest>();
            CQuest cur_quest;

            foreach (var loc_quest in this.locales[parent.settings.getCurrentLocale()].Values)
            {
                //System.Console.WriteLine("questID:" + loc_quest.QuestID.ToString());
                CQuest quest = getQuest(loc_quest.QuestID);

                if (quest != null && loc_quest.Version == quest.Version)
                {
                    cur_quest = (CQuest)quest.Clone();
                    cur_quest.QuestInformation = loc_quest.QuestInformation;
                    results.Add(cur_quest.QuestID, cur_quest);
                }
            }

            foreach (var start_quest_id in this.startQuests)
            {
                CQuest start_quest = getQuest(start_quest_id);
                if (start_quest != null && !results.Keys.Contains(start_quest_id))
                {
                    results.Add(start_quest.QuestID, start_quest);
                }
            }
            this.save(parent.settings.questXML, results);
        }
Exemplo n.º 2
0
 public void addLocaleQuest(CQuest quest, string locale)
 {
     if (!this.locales.Keys.Contains(locale))
     {
         this.locales.Add(locale, new Dictionary <int, CQuest>());
     }
     if (this.locales[locale].Keys.Contains(quest.QuestID))
     {
         this.locales[locale].Remove(quest.QuestID);
     }
     this.locales[locale].Add(quest.QuestID, quest);
 }
Exemplo n.º 3
0
        public void replaceQuest(CQuest iQuest)
        {
            var questID = iQuest.QuestID;

            if (quest.Keys.Contains(questID))
            {
                quest[questID] = iQuest;
            }
            else if (buffer.Keys.Contains(questID))
            {
                buffer[questID] = iQuest;
            }
        }
Exemplo n.º 4
0
        public void setClan(int questID, bool IsClan)
        {
            CQuest curQuest = getQuest(questID);

            curQuest.Target.IsClan = IsClan;

            if (curQuest.Additional.ListOfSubQuest.Any())
            {
                foreach (int subQuestID in curQuest.Additional.ListOfSubQuest)
                {
                    setClan(subQuestID, IsClan);
                }
            }
        }
Exemplo n.º 5
0
        public object Clone()
        {
            CQuest copy = new CQuest();

            copy.QuestID          = this.QuestID;
            copy.Version          = 0;
            copy.QuestInformation = (CQuestInformation)this.QuestInformation.Clone();
            copy.Precondition     = (CQuestPrecondition)this.Precondition.Clone();
            copy.QuestRules       = (CQuestRules)this.QuestRules.Clone();
            copy.Reward           = (CQuestReward)this.Reward.Clone();
            copy.QuestPenalty     = (CQuestPenalty)this.QuestPenalty.Clone();
            copy.Additional       = (CQuestAdditional)this.Additional.Clone();
            copy.Target           = (CQuestTarget)this.Target.Clone();
            return(copy);
        }
Exemplo n.º 6
0
        public string getRootTitle(int questID)
        {
            string ret   = "";
            CQuest quest = getQuest(questID);

            if (quest != null)
            {
                if (!quest.Additional.IsSubQuest.Equals(0))
                {
                    ret += getRootTitle(quest.Additional.IsSubQuest);
                }
                else
                {
                    ret += quest.QuestInformation.Title;
                }
            }
            return(ret);
        }
Exemplo n.º 7
0
 void updateLabel()
 {
     lItems.Text = "";
     foreach (CheckBox obj in splitContainer1.Panel1.Controls)
     {
         if (obj.Checked)
         {
             int    qID = int.Parse(obj.Text);
             CQuest q   = itemParent.parent.getQuestOnQuestID(qID);
             if (q != null)
             {
                 lItems.Text += "Квест ID:" + q.QuestID.ToString() + "\n";
                 if (q.Reward.AttrOfItems.Contains(1))
                 {
                     lItems.Text += "\tНаграда:\n";
                     for (int index = 0; index < q.Reward.AttrOfItems.Count; ++index)
                     {
                         if (q.Reward.AttrOfItems[index] == 1)
                         {
                             lItems.Text += q.Reward.NumOfItems[index].ToString() + " X " + itemParent.parent.itemConst.getDescriptionOnID(q.Reward.TypeOfItems[index]) + "\n";
                         }
                     }
                 }
                 if (q.QuestRules.AttrOfItems.Contains(1))
                 {
                     lItems.Text += "\tПравила квеста:\n";
                     for (int index = 0; index < q.QuestRules.AttrOfItems.Count; ++index)
                     {
                         if (q.QuestRules.AttrOfItems[index] == 1)
                         {
                             lItems.Text += q.QuestRules.NumOfItems[index].ToString() + " X " + itemParent.parent.itemConst.getDescriptionOnID(q.QuestRules.TypeOfItems[index]) + "\n";
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 8
0
        public SelectQuestItem(EditQuestForm itemParent, int QuestID)
        {
            this.itemParent = itemParent;
            InitializeComponent();
            CQuest quest = new CQuest();

            //try
            //{
            quest = itemParent.getQuest();
            //}
            //catch
            //{
            //    itemParent.Visible = true;
            //    this.Close();
            //}

            List <CQuest> wayIDs = new List <CQuest>();

            if (quest.Reward.AttrOfItems.Contains(1) || quest.QuestRules.AttrOfItems.Contains(1))
            {
                foreach (CQuest q in wayIDs)
                {
                    if (q.QuestID == QuestID)
                    {
                        wayIDs.Remove(q);
                        break;
                    }
                }
                wayIDs.Add(quest);
            }

            List <CQuest> getted = new List <CQuest>();

            if (quest.Additional.IsSubQuest.Equals(0))
            {
                getted = itemParent.parent.getTreesItemIDs(quest.QuestID);
            }
            else
            {
                getted = itemParent.parent.getTreesItemIDs(quest.Additional.IsSubQuest);
            }
            CQuest rem = null;

            foreach (CQuest q in getted)
            {
                if (q.QuestID == QuestID)
                {
                    rem = q;
                }
            }
            if (rem != null)
            {
                getted.Remove(rem);
            }


            wayIDs.AddRange(getted);



            if (!wayIDs.Any())
            {
                System.Console.WriteLine("Ways empty");
                this.Close();
            }
            else
            {
                this.Enabled = true;
                this.Visible = true;
            }
            foreach (CQuest q in wayIDs)
            {
                CheckBox box = new CheckBox();
                box.Text = q.QuestID.ToString();
                box.Dock = DockStyle.Top;
                if (quest.Target.AObjectAttrs.Contains(q.QuestID))
                {
                    box.Checked = true;
                }
                box.CheckedChanged += new EventHandler(box_CheckedChanged);
                splitContainer1.Panel1.Controls.Add(box);
            }
            updateLabel();
        }
Exemplo n.º 9
0
        //! Возвращает словарь из квестов для локализации (устаревшие, актуальные или все)
        public DifferenceDict getQuestDifference(string locale, FindType findType)
        {
            //System.Console.WriteLine("CQuests::getQuestDifference");
            QuestLocales sorted_locale = new QuestLocales();

            if (this.locales.Keys.Contains(locale))
            {
                foreach (var locale_quest in this.locales[locale].Values)
                {
                    if (!sorted_locale.Keys.Contains(locale_quest.Additional.Holder))
                    {
                        sorted_locale.Add(locale_quest.Additional.Holder, new Dictionary <int, CQuest>());
                    }
                    sorted_locale[locale_quest.Additional.Holder].Add(locale_quest.QuestID, locale_quest);
                }
            }

            DifferenceDict ret = new DifferenceDict();

            foreach (var cur_quest in quest.Values)
            {
                if (sorted_locale.Keys.Contains(cur_quest.Additional.Holder))
                {
                    CQuest locale_quest = new CQuest();
                    locale_quest.Version = 0;

                    if (sorted_locale[cur_quest.Additional.Holder].Keys.Contains(cur_quest.QuestID))
                    {
                        locale_quest.Version = sorted_locale[cur_quest.Additional.Holder][cur_quest.QuestID].Version;
                    }

                    if (!ret.Keys.Contains(cur_quest.Additional.Holder))
                    {
                        ret.Add(cur_quest.Additional.Holder, new Dictionary <int, CDifference>());
                    }
                    switch (findType)
                    {
                    case FindType.all:
                        ret[cur_quest.Additional.Holder].Add(cur_quest.QuestID, new CDifference(cur_quest.Version, locale_quest.Version));
                        break;

                    case FindType.outdatedOnly:
                        if (cur_quest.Version != locale_quest.Version)
                        {
                            ret[cur_quest.Additional.Holder].Add(cur_quest.QuestID, new CDifference(cur_quest.Version, locale_quest.Version));
                        }
                        break;

                    case FindType.actualOnly:
                        if (cur_quest.Version == locale_quest.Version)
                        {
                            ret[cur_quest.Additional.Holder].Add(cur_quest.QuestID, new CDifference(cur_quest.Version, locale_quest.Version));
                        }
                        break;
                    }
                }
            }

            //foreach (var locale_npc_name in sorted_locale.Keys)
            //{
            //    foreach (var locale_quest in sorted_locale[locale_npc_name].Values)
            //    {
            //        var locale_version = locale_quest.Version;
            //        var quest = this.quest[locale_quest.QuestID];
            //        if (quest.Version != locale_version)
            //        {
            //            if (sorted_locale[locale_npc_name].Any())
            //                ret.Add(locale_npc_name, new Dictionary<int, CDifference>());
            //            ret[locale_npc_name].Add(quest.QuestID, new CDifference(quest.Version, locale_version));
            //        }
            //    }
            //}

            /*
             * foreach (var name in ret.Keys)
             * {
             *  System.Console.WriteLine("npc:" + name);
             *  foreach (var quest_id in ret[name].Keys)
             *      System.Console.WriteLine("id:" + quest_id.ToString());
             * }
             */
            return(ret);
        }
Exemplo n.º 10
0
 public void addQuest(CQuest iQuest)
 {
     quest.Add(iQuest.QuestID, iQuest);
 }