예제 #1
0
        void SearchCreateCopyButton_Click(object sender, EventArgs e)
        {
            if (SearchDataGrid.Rows.Count < 0)
            {
                MessageBox.Show("Error: Search data are empty! Search first for any creature and select row, after use this button again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            int query_id = Convert.ToInt32(SearchDataGrid.Rows[SearchDataGrid.CurrentCell.RowIndex].Cells["Entry"].Value.ToString());

            if (query_id.ToString() == null)
            {
                MessageBox.Show("Error: You haven't selected row!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            creature_template query = world.creature_template.Where(x => x.entry == query_id).SingleOrDefault();

            Editor.Copy copyNPC = new Editor.Copy("Copy NPC");

            if (copyNPC.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            cTemplate = query;
            cTemplateBinding.DataSource = cTemplate;

            EditBox_entry.Text = copyNPC.Entry.ToString();

            CreatureTab.SelectedTab = EditPage;
        }
예제 #2
0
        private void creatureCopy_Click(object sender, RoutedEventArgs e)
        {
            creature_template c = creatureList.SelectedItem as creature_template;

            if (c == null)
            {
                return;
            }

            creature_template c2 = WorldWorker.GetCreatureTemplate(c.entry);

            if (c2 == null)
            {
                return;
            }
            WorldWorker.SetEntityState(c2, System.Data.EntityState.Added);

            int id = (from d in LegacyToolBox.Data.CreatureTemplate select d.entry).Max() + 1;

            c2.entry = id;

            LegacyToolBox.Data.CreatureTemplate.Add(c2);
            WorldWorker.SaveCreatureTemplate(c2);
            LegacyToolBox.AppendMessage("Creature " + c.entry + " To Creature " + c2.entry + " Copied.");
        }
예제 #3
0
        private void npcFlagsBtn_Click(object sender, RoutedEventArgs e)
        {
            creature_template c = creatureList.SelectedItem as creature_template;

            if (c == null)
            {
                return;
            }
            new CreatureNpcFlagSelector(c).Show();
        }
예제 #4
0
        public void SaveCreatureTemplate(creature_template c)
        {
            var o = (from d in CreatureTemplate where d.entry == c.entry select d).SingleOrDefault();

            if (o != null)
            {
                CreatureTemplate.Remove(o);
            }
            CreatureTemplate.Add(c);
            WorldWorker.SaveCreatureTemplate(c);
        }
예제 #5
0
 private void ApplySearchFilter()
 {
     creatureList.Items.Filter = delegate(object obj)
     {
         string name = searchFilter.Text;
         if (name == "")
         {
             return(true);
         }
         creature_template creature = (creature_template)obj;
         return(creature.name.Contains(name) || creature.entry.ToString().Contains(name));
     };
 }
예제 #6
0
 private void creatureTab_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.S)
     {
         creature_template c = creatureList.SelectedItem as creature_template;
         if (c != null)
         {
             WorldWorker.SaveCreatureTemplate(c);
             LegacyToolBox.AppendMessage("Creature Template " + c.entry + " Saved.", "#FF00FF00");
         }
         e.Handled = true;
     }
 }
예제 #7
0
        private void creatureDelete_Click(object sender, RoutedEventArgs e)
        {
            creature_template c = creatureList.SelectedItem as creature_template;

            if (c == null)
            {
                return;
            }

            LegacyToolBox.Data.CreatureTemplate.Remove(c);
            DB.LEGACY.creature_template.Remove(c);
            LegacyToolBox.AppendMessage("Creature " + c.entry + " Deleted.");
        }
예제 #8
0
        public CreatureInfo(ObjectGUID objectGUID, creature creature, creature_template template) : base(objectGUID)
        {
            DisplayID = NativeDisplayID = creature.modelid;
            Health    = (int)creature.curhealth;
            MaxHealth = (int)template.MaxLevelHealth;
            Level     = template.MaxLevel;

            NPCFlags        = (int)template.NpcFlags;
            DynamicFlags    = (int)template.DynamicFlags;
            UnitFlag        = (int)template.UnitFlags;
            FactionTemplate = (uint)template.FactionAlliance;
            Entry           = template.Entry; //Used to set the creature name.

            CombatReach = 30f;
        }
예제 #9
0
        private void Load(int entry)
        {
            if (entry == 0)
            {
                return;
            }

            creature_template c = (from d in LegacyToolBox.Data.CreatureTemplate where d.entry == entry select d).SingleOrDefault();

            if (c != null)
            {
                creatureTab.IsEnabled = true;
                Load(c);
                creatureTrainerPanel.Load(entry);
                creatureLootPanel.Load(entry);
                vendorPanel.Load(entry);
            }
            else
            {
                creatureTab.IsEnabled = false;
            }
        }
예제 #10
0
        public override void Initialize()
        {
            SetDataGridViewColumns(SearchDataGrid, new string[] { "entry", "name", "subname", "minlevel", "maxlevel", "npcflag" });
            SetDataGridViewColumns(LocationDataGrid, new string[] { "guid", "id", "map", "spawnMask", "phaseMask", "modelid", "equipment_id", "position_x", "position_y", "position_z", "orientation", "spawntimesecs", "spawndist", "currentwaypoint", "curhealth", "curmana", "MovementType", "npcflag", "unit_flags", "dynamicflags" });
            SetDataGridViewColumns(ModelInfoDataGrid, new string[] { "modelid", "bounding_radius", "combat_reach", "gender", "modelid_other_gender" });
            SetDataGridViewColumns(LootDataGrid, new string[] { "Entry", "Item", "Reference", "Chance", "QuestRequired", "LootMode", "GroupId", "MinCount", "MaxCount", "Comment" });
            SetDataGridViewColumns(PickPocketLootDataGrid, new string[] { "Entry", "Item", "Reference", "Chance", "QuestRequired", "LootMode", "GroupId", "MinCount", "MaxCount", "Comment" });
            SetDataGridViewColumns(SkinningLootDataGrid, new string[] { "Entry", "Item", "Reference", "Chance", "QuestRequired", "LootMode", "GroupId", "MinCount", "MaxCount", "Comment" });
            SetDataGridViewColumns(InvolvedInTabStartsDataGrid, new string[] { "Id", "Title", "Level", "faction", "RewardOrRequiredMoney" });
            SetDataGridViewColumns(InvolvedInTabEndsDataGrid, new string[] { "Id", "Title", "Level", "faction", "RewardOrRequiredMoney" });
            SetDataGridViewColumns(SmartAIDataGrid, new string[] { "entryorguid", "source_type", "id", "link", "event_type", "event_phase_mask", "event_chance", "event_flags", "event_param1", "event_param2", "event_param3", "event_param4", "action_type", "action_param1", "action_param2", "action_param3", "action_param4", "action_param5", "action_param6", "target_type", "target_param1", "target_param2", "target_param3", "target_x", "target_y", "target_z", "target_o", "comment" });

            // Bindings
            cTemplate         = new creature_template(true);
            cEquipTemplate    = new creature_equip_template();
            cTemplateAddon    = new creature_template_addon();
            cAddon            = new creature_addon();
            cOnKillReputation = new creature_onkill_reputation();

            cTemplateBinding            = new BindingSource();
            cTemplateBinding.DataSource = cTemplate;
            cTemplateBinding.ReflectionBinding(this, "EditBox_");

            cEquipTemplateBinding            = new BindingSource();
            cEquipTemplateBinding.DataSource = cEquipTemplate;
            cEquipTemplateBinding.ReflectionBinding(this, "EquipTemplateBox_");

            cTemplateAddonBinding            = new BindingSource();
            cTemplateAddonBinding.DataSource = cTemplateAddon;
            cTemplateAddonBinding.ReflectionBinding(this, "TemplateAddonBox_");

            cAddonBinding            = new BindingSource();
            cAddonBinding.DataSource = cAddon;
            cAddonBinding.ReflectionBinding(this, "AddonBox_");

            cOnKillReputationBinding            = new BindingSource();
            cOnKillReputationBinding.DataSource = cOnKillReputation;
            cOnKillReputationBinding.ReflectionBinding(this, "OKRBox_");
        }
예제 #11
0
 public CreatureNpcFlagSelector(creature_template creature)
 {
     InitializeComponent();
     _creature = creature;
     CheckFlags(creature.npcflag);
 }
예제 #12
0
 public NpcFlagSelector(creature_template c)
 {
     InitializeComponent();
     _c = c;
     CheckFlags(_c.npcflag);
 }
예제 #13
0
 public static void DeleteCreatureTemplate(creature_template t)
 {
     DB.LEGACY.creature_template.Remove(t);
     DB.LSave();
 }
예제 #14
0
파일: WorldWorker.cs 프로젝트: update88/mtb
 public static void DeleteCreatureTemplate(creature_template t)
 {
     DB.LEGACY.creature_template.Remove(t);
     DB.LEGACY.SaveChanges(); DB.Refresh();
 }
예제 #15
0
        void SearchDataGrid_DoubleClick(object sender, EventArgs e)
        {
            if (SearchDataGrid.Rows.Count < 1)
            {
                return;
            }

            int query_id = Convert.ToInt32(SearchDataGrid.Rows[SearchDataGrid.CurrentCell.RowIndex].Cells[0].Value.ToString());

            //// EDIT PAGE
            creature_template query = world.creature_template.Where(x => x.entry == query_id).Single();

            cTemplate = query;
            cTemplateBinding.DataSource = cTemplate;

            // Location
            var query_location = world.creature.Where(x => x.id == query_id).Select(x => new { x.guid, x.id, x.map, x.position_x, x.position_y, x.position_z, x.orientation, x.spawnMask, x.phaseMask, x.modelid, x.equipment_id, x.spawntimesecs, x.spawndist, x.currentwaypoint, x.curhealth, x.curmana, x.MovementType, x.npcflag, x.unit_flags, x.dynamicflags }).ToList();

            LocationDataGrid.Load(query_location);

            // Model info
            var query_modelInfo = world.creature_model_info.Where(x => (new string[] { EditBox_modelid1.Text, EditBox_modelid2.Text, EditBox_modelid3.Text, EditBox_modelid4.Text }).Contains(x.modelid.ToString())).Select(x => new { x.modelid, x.bounding_radius, x.combat_reach, x.gender, x.modelid_other_gender }).ToList();

            ModelInfoDataGrid.Load(query_modelInfo);

            // Loot
            var query_loot = world.creature_loot_template.Where(x => x.Entry.ToString() == EditBox_lootid.Text).Select(x => new { x.Entry, x.Item, x.Reference, x.Chance, x.QuestRequired, x.LootMode, x.GroupId, x.MinCount, x.MaxCount, x.Comment }).ToList();

            LootDataGrid.Load(query_loot);

            // Pick pocket
            var query_pickPocket = world.pickpocketing_loot_template.Where(x => x.Entry.ToString() == EditBox_pickpocketloot.Text).Select(x => new { x.Entry, x.Item, x.Reference, x.Chance, x.QuestRequired, x.LootMode, x.GroupId, x.MinCount, x.MaxCount, x.Comment }).ToList();

            PickPocketLootDataGrid.Load(query_pickPocket);

            // Skinning
            var query_skinning = world.skinning_loot_template.Where(x => x.Entry.ToString() == EditBox_skinloot.Text).Select(x => new { x.Entry, x.Item, x.Reference, x.Chance, x.QuestRequired, x.LootMode, x.GroupId, x.MinCount, x.MaxCount, x.Comment }).ToList();

            SkinningLootDataGrid.Load(query_skinning);

            // Equip template
            var query_equip = world.creature_equip_template.Where(x => x.entry.ToString() == EditBox_equipment_id.Text).SingleOrDefault();//.Select(x => new { x.entry, x.id, x.itemEntry1, x.itemEntry2, x.itemEntry3 }).SingleOrDefault();

            cEquipTemplate = query_equip ?? new creature_equip_template();
            cEquipTemplateBinding.DataSource = cEquipTemplate;

            // Template addon
            var query_templateAddon = world.creature_template_addon.Where(x => x.entry == query_id).SingleOrDefault();

            cTemplateAddon = query_templateAddon ?? new creature_template_addon();
            cTemplateAddonBinding.DataSource = cTemplateAddon;

            // Addon
            cAddon = new creature_addon();
            cAddonBinding.DataSource = cAddon;

            // On kill reputation
            var query_onKillReputation = world.creature_onkill_reputation.Where(x => x.creature_id == query_id).SingleOrDefault();

            cOnKillReputation = query_onKillReputation ?? new creature_onkill_reputation();
            cOnKillReputationBinding.DataSource = cOnKillReputation;

            // Involved in
            var query_questStarter = world.creature_queststarter.Where(x => x.id == query_id).ToList();
            var query_questEnder   = world.creature_questender.Where(x => x.id == query_id).ToList();

            InvolvedInTabStartsDataGrid.Reset();
            InvolvedInTabEndsDataGrid.Reset();

            if (query_questStarter.Count > 1)
            {
                InvolvedInTabStartsDataGrid.Rows.Add(query_questStarter.Count - 1);
            }

            if (query_questEnder.Count > 1)
            {
                InvolvedInTabEndsDataGrid.Rows.Add(query_questEnder.Count - 1);
            }

            /* start quests */
            for (int i = 0; i < query_questStarter.Count; i++)
            {
                int quest = query_questStarter[i].quest;

                var query_startQuest = world.quest_template.Where(x => x.Id == quest).SingleOrDefault();

                if (query_startQuest == null)
                {
                    continue;
                }

                InvolvedInTabStartsDataGrid.Rows[i].Cells[0].Value = query_startQuest.Id;
                InvolvedInTabStartsDataGrid.Rows[i].Cells[1].Value = query_startQuest.Title;
                InvolvedInTabStartsDataGrid.Rows[i].Cells[2].Value = query_startQuest.Level;

                if (query_startQuest.RewardOrRequiredMoney != 0)
                {
                    InvolvedInTabStartsDataGrid.Rows[i].Cells[4].Value = $"{query_startQuest.RewardOrRequiredMoney} Min coppers, {query_startQuest.RewardMoneyMaxLevel} Max level coppers.";
                }
                else
                {
                    InvolvedInTabStartsDataGrid.Rows[i].Cells[4].Value = $"{query_startQuest.RewardMoneyMaxLevel} at Max level coppers.";
                }

                bool QuestIsAlliance = false;
                bool QuestIsHorde    = false;

                string QuestFaction = String.Empty;

                string binary = Convert.ToString(query_startQuest.RequiredRaces, 2).PadLeft(22, '0');

                for (int k = binary.Length - 1; k >= 0; k--)
                {
                    if (binary[k] == '1' && WoW.Common.AllianceRaces.Contains(k))
                    {
                        QuestIsAlliance = true;
                    }
                    else if (binary[k] == '1' && WoW.Common.HordeRaces.Contains(k))
                    {
                        QuestIsHorde = true;
                    }
                }

                if (QuestIsAlliance)
                {
                    QuestFaction = "Alliance";
                }
                if (QuestIsHorde)
                {
                    QuestFaction = "Horde";
                }
                if (QuestIsAlliance && QuestIsHorde)
                {
                    QuestFaction = "Neutral";
                }

                InvolvedInTabStartsDataGrid.Rows[i].Cells[3].Value = QuestFaction;
            }

            /* end quests */
            for (int i = 0; i < query_questEnder.Count; i++)
            {
                int quest = query_questEnder[i].quest;

                var query_endQuest = world.quest_template.Where(x => x.Id == quest).SingleOrDefault();

                if (query_endQuest == null)
                {
                    continue;
                }

                InvolvedInTabEndsDataGrid.Rows[i].Cells[0].Value = query_endQuest.Id;
                InvolvedInTabEndsDataGrid.Rows[i].Cells[1].Value = query_endQuest.Title;
                InvolvedInTabEndsDataGrid.Rows[i].Cells[2].Value = query_endQuest.Level;

                if (query_endQuest.RewardOrRequiredMoney != 0)
                {
                    InvolvedInTabEndsDataGrid.Rows[i].Cells[4].Value = $"{query_endQuest.RewardOrRequiredMoney} Min coppers, {query_endQuest.RewardMoneyMaxLevel} Max level coppers.";
                }
                else
                {
                    InvolvedInTabEndsDataGrid.Rows[i].Cells[4].Value = $"{query_endQuest.RewardMoneyMaxLevel} at Max level coppers.";
                }

                bool QuestIsAlliance = false;
                bool QuestIsHorde    = false;

                string QuestFaction = String.Empty;

                string binary = Convert.ToString(query_endQuest.RequiredRaces, 2).PadLeft(22, '0');

                for (int k = binary.Length - 1; k >= 0; k--)
                {
                    if (binary[k] == '1' && WoW.Common.AllianceRaces.Contains(k))
                    {
                        QuestIsAlliance = true;
                    }
                    else if (binary[k] == '1' && WoW.Common.HordeRaces.Contains(k))
                    {
                        QuestIsHorde = true;
                    }
                }

                if (QuestIsAlliance)
                {
                    QuestFaction = "Alliance";
                }
                if (QuestIsHorde)
                {
                    QuestFaction = "Horde";
                }
                if (QuestIsAlliance && QuestIsHorde)
                {
                    QuestFaction = "Neutral";
                }

                InvolvedInTabEndsDataGrid.Rows[i].Cells[3].Value = QuestFaction;
            }

            // Smart AI
            SmartAIDataGrid.Reset();

            var query_smartAI_guids = world.creature.Where(x => x.id == query_id).ToList();
            var query_smartAI_entry = world.smart_scripts.Where(x => x.entryorguid == query_id && x.source_type == 0).ToList();

            if (query_smartAI_guids.Count > 1)
            {
                SmartAIDataGrid.Rows.Add(query_smartAI_guids.Count - 1);
            }

            /* based on entry */
            SmartAIDataGrid.Load(query_smartAI_entry);

            /* based on guid */
            for (int i = 0; i < query_smartAI_guids.Count; i++)
            {
                var guid = -query_smartAI_guids[i].guid;

                var query_smartAI = world.smart_scripts.Where(x => x.entryorguid == guid && x.source_type == 0).ToList();

                for (int j = 0; j < query_smartAI.Count; j++)
                {
                    PropertyInfo[] properties = query_smartAI[j].GetType().GetProperties(); // get properties name

                    foreach (PropertyInfo property in properties)                           // bind property.Name and property.Value to target column
                    {
                        SmartAIDataGrid.SetColumnValue(j + query_smartAI_entry.Count, DisplayColumnName(property.Name), property.GetValue(query_smartAI[j]));
                    }
                }
            }

            CreatureTab.SelectedTab = EditPage;
        }
예제 #16
0
 private void Load(creature_template creature)
 {
     creatureTab.DataContext = creature;
 }
예제 #17
0
 public void DeleteCreatureTemplate(creature_template c)
 {
     CreatureTemplate.Remove(c);
     DataProcessor.DeleteCreatureTemplate(c);
 }
예제 #18
0
 public void DeleteCreatureTemplate(creature_template c)
 {
     CreatureTemplate.Remove(c);
     WorldWorker.DeleteCreatureTemplate(c);
 }
예제 #19
0
파일: DataStore.cs 프로젝트: update88/mtb
 public void DeleteCreatureTemplate(creature_template c)
 {
     CreatureTemplate.Remove(c);
     WorldWorker.DeleteCreatureTemplate(c);
 }
예제 #20
0
파일: DataStore.cs 프로젝트: update88/mtb
 public void SaveCreatureTemplate(creature_template c)
 {
     var o = (from d in CreatureTemplate where d.entry == c.entry select d).SingleOrDefault();
     if (o != null)
         CreatureTemplate.Remove(o);
     CreatureTemplate.Add(c);
     WorldWorker.SaveCreatureTemplate(c);
 }
예제 #21
0
 private void Load(creature_template creature)
 {
     creatureTab.DataContext = creature;
 }
예제 #22
0
 public static void SaveCreatureTemplate(creature_template c)
 {
     var o = (from d in DB.LEGACY.creature_template where d.entry == c.entry select d).SingleOrDefault();
     if (o != null)
         DB.LEGACY.creature_template.Remove(o);
     DB.LEGACY.creature_template.Add(c);
     DB.LSave();
 }
예제 #23
0
 public NpcFlagSelector(creature_template c)
 {
     InitializeComponent();
     _c = c;
     CheckFlags(_c.npcflag);
 }
예제 #24
0
 public CreatureNpcFlagSelector(creature_template creature)
 {
     InitializeComponent();
     _creature = creature;
     CheckFlags(creature.npcflag);
 }