コード例 #1
0
ファイル: ResearchPanel.xaml.cs プロジェクト: update88/mtb
        private void researchList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            capital_city_research_data data = researchList.SelectedItem as capital_city_research_data;

            if (data == null) // set filter changed
            {
                return;
            }
            _SelectedResearchData    = data;
            researchGrid.DataContext = data;
            if (data.Description != 0)
            {
                npc_text t = WorldWorker.GetNpcText(data.Description);
                _SelectedNpcText = t;
                if (t != null)
                {
                    broadcast_text b = WorldWorker.GetBroadCastText(t.BroadcastTextID0);
                    _SelectedBroadcastText = b;
                    if (b != null)
                    {
                        Binding binding = new Binding();
                        binding.Source = b;
                        binding.Path   = new PropertyPath("MaleText");
                        descriptionText.SetBinding(TextBox.TextProperty, binding);
                    }
                }
            }
            else
            {
                _SelectedNpcText       = null;
                _SelectedBroadcastText = null;
                descriptionText.Text   = "";
            }

            if (data.Spell != 0)
            {
                capital_city_research_trainer_data t = WorldWorker.GetResearchSpell(data.Spell);
                _SelectedResearchSpell = t;
            }
            else
            {
                _SelectedResearchSpell = null;
            }

            if (data.Item != 0)
            {
                capital_city_research_vendor_data t = WorldWorker.GetResearchItem(data.Item);
                _SelectedResearchItem = t;
            }
            else
            {
                _SelectedResearchItem = null;
            }

            researchSpellGrid.DataContext = _SelectedResearchSpell;
            researchItemGrid.DataContext  = _SelectedResearchItem;

            _ResearchQuest = WorldWorker.GetResearchQuests(_SelectedResearchData.QuestSet);
            researchQuestList.ItemsSource = _ResearchQuest;
        }
コード例 #2
0
ファイル: ResearchPanel.xaml.cs プロジェクト: update88/mtb
        private void researchDataNew_Click(object sender, RoutedEventArgs e)
        {
            if (_SelectedResearchSet == null)
            {
                return;
            }

            capital_city_research_data data = WorldWorker.CreateNewResearchData(_SelectedResearchSet.ID);

            LegacyToolBox.Data.ResearchData.Add(data);
            LegacyToolBox.AppendMessage("Research Data For Set " + data.ResearchSet + " Rank " + data.Rank + " Created.");
        }
コード例 #3
0
ファイル: ResearchPanel.xaml.cs プロジェクト: update88/mtb
        private void researchDataDelete_Click(object sender, RoutedEventArgs e)
        {
            capital_city_research_data data = researchList.SelectedItem as capital_city_research_data;

            if (data == null)
            {
                return;
            }
            int s = data.ResearchSet;
            int r = data.Rank;

            LegacyToolBox.Data.ResearchData.Remove(data);
            WorldWorker.DeleteResearchData(s, r);
            LegacyToolBox.AppendMessage("Research Data For Set " + s + " Rank " + r + " Deleted.");
        }
コード例 #4
0
ファイル: ResearchPanel.xaml.cs プロジェクト: update88/mtb
        private void researchSetList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            capital_city_research_set set = researchSetList.SelectedItem as capital_city_research_set;

            _SelectedResearchSet        = set;
            researchSetGrid.DataContext = _SelectedResearchSet;
            researchList.Items.Filter   = delegate(object obj)
            {
                if (set == null)
                {
                    return(true);
                }
                capital_city_research_data data = (capital_city_research_data)obj;
                return(data.ResearchSet == set.ID);
            };
        }
コード例 #5
0
 public static capital_city_research_data CreateNewResearchData(int set, int rank = 0)
 {
     capital_city_research_data data = new capital_city_research_data();
     var n = from d in DB.LEGACY.capital_city_research_data where d.ResearchSet == set select d.Rank;
     int nextRank = 1;
     if (n.Count() != 0)
         nextRank = n.Max() + 1;
     data.Comment = "";
     data.Description = 0;
     data.Item = 0;
     data.Progress = 100;
     data.QuestSet = 6;
     data.Rank = rank == 0 ? nextRank : rank;
     data.ReqCityRank = 0;
     data.ReqItem1 = 57345;
     data.ReqItem2 = 0;
     data.ReqItem3 = 0;
     data.ReqItem4 = 0;
     data.ReqItemCount1 = 1;
     data.ReqItemCount2 = 0;
     data.ReqItemCount3 = 0;
     data.ReqItemCount4 = 0;
     data.ResearchSet = set;
     data.Spell = 0;
     if (rank != 0)
     {
         var o = (from d in DB.LEGACY.capital_city_research_data where d.ResearchSet == set && d.Rank == rank select d).SingleOrDefault();
         if (o != null)
             DB.LEGACY.capital_city_research_data.Remove(o);
     }
     DB.LEGACY.capital_city_research_data.Add(data);
     DB.LSave();
     return data;
 }
コード例 #6
0
 public static void SaveResearchData(capital_city_research_data data)
 {
     var o = (from d in DB.LEGACY.capital_city_research_data where d.ResearchSet == data.ResearchSet && d.Rank == data.Rank select d).SingleOrDefault();
     if (o != null)
         DB.LEGACY.capital_city_research_data.Remove(o);
     DB.LEGACY.capital_city_research_data.Add(data);
     DB.LSave();
 }
コード例 #7
0
ファイル: ResearchPanel.xaml.cs プロジェクト: update88/mtb
        private void researchList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            capital_city_research_data data = researchList.SelectedItem as capital_city_research_data;
            if (data == null) // set filter changed
                return;
            _SelectedResearchData = data;
            researchGrid.DataContext = data;
            if (data.Description != 0)
            {
                npc_text t = WorldWorker.GetNpcText(data.Description);
                _SelectedNpcText = t;
                if (t != null)
                {
                    broadcast_text b = WorldWorker.GetBroadCastText(t.BroadcastTextID0);
                    _SelectedBroadcastText = b;
                    if (b != null)
                    {
                        Binding binding = new Binding();
                        binding.Source = b;
                        binding.Path = new PropertyPath("MaleText");
                        descriptionText.SetBinding(TextBox.TextProperty, binding);
                    }
                }
            }
            else
            {
                _SelectedNpcText = null;
                _SelectedBroadcastText = null;
                descriptionText.Text = "";
            }

            if (data.Spell != 0)
            {
                capital_city_research_trainer_data t = WorldWorker.GetResearchSpell(data.Spell);
                _SelectedResearchSpell = t;
            }
            else
                _SelectedResearchSpell = null;

            if (data.Item != 0)
            {
                capital_city_research_vendor_data t = WorldWorker.GetResearchItem(data.Item);
                _SelectedResearchItem = t;
            }
            else
                _SelectedResearchItem = null;

            researchSpellGrid.DataContext = _SelectedResearchSpell;
            researchItemGrid.DataContext = _SelectedResearchItem;

            _ResearchQuest = WorldWorker.GetResearchQuests(_SelectedResearchData.QuestSet);
            researchQuestList.ItemsSource = _ResearchQuest;
        }