Ejemplo n.º 1
0
        public GameObjectInfo(ObjectGUID guid, gameobject gameObject, gameobject_template template)
            : base(guid)
        {
            DisplayID   = template.displayId;
            Flags       = (int)template.flags;
            TypeID      = template.type;
            State       = gameObject.state;
            X           = gameObject.position_x;
            Y           = gameObject.position_y;
            Z           = gameObject.position_z;
            Rotation0   = gameObject.rotation0;
            Rotation1   = gameObject.rotation1;
            Orientation = gameObject.orientation;

            if (gameObject.rotation2 == 0 && gameObject.rotation3 == 0)
            {
                gameObject.rotation2 = (float)Math.Sin(gameObject.orientation / 2);
                gameObject.rotation3 = (float)Math.Cos(gameObject.orientation / 2);
            }

            Rotation2 = gameObject.rotation2;
            Rotation3 = gameObject.rotation3;

            Type |= (int)TypeMask.TYPEMASK_GAMEOBJECT;
        }
Ejemplo n.º 2
0
        void SearchCopyButton_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;
            }

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

            Copy copyGO = new Copy("Copy GO");

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

            goTemplate = query;
            goTemplateBinding.DataSource = goTemplate;

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

            GameObjectTab.SelectedTab = EditPage;
        }
Ejemplo n.º 3
0
        private static void OnGameObjectUsePacket(WorldSession session, PCGameObjectUse packet)
        {
            GameObjectEntity gameObject = session.Core.GetComponent <EntityComponent>().GameObjectEntities.SingleOrDefault(g => g.ObjectGUID.RawGUID == packet.GUID);

            gameobject_template template = gameObject.Template;

            if (gameObject != null && GameObjectUseHandlers.ContainsKey((GameObjectType)template.type))
            {
                GameObjectUseHandlers[(GameObjectType)template.type](session, gameObject);
            }
        }
Ejemplo n.º 4
0
        public PSGameObjectQueryResponse(gameobject_template gameObjectTemplate)
            : base(WorldOpcodes.SMSG_GAMEOBJECT_QUERY_RESPONSE)
        {
            this.Write((uint)gameObjectTemplate.entry);
            this.Write((uint)gameObjectTemplate.type);
            this.Write((uint)gameObjectTemplate.displayId);
            this.Write(Encoding.UTF8.GetBytes(gameObjectTemplate.name));
            this.Write((ushort)0);
            this.Write((byte)0);
            this.Write((byte)0);

            // 24 byte clear
            this.Write((short)0);
        }
Ejemplo n.º 5
0
        public override void Initialize()
        {
            SetDataGridViewColumns(SearchDataGrid, new string[] { "entry", "name", "displayId", "type", "flags", "size" });
            SetDataGridViewColumns(LocationDataGrid, new string[] { "guid", "id", "map", "zoneId", "areaId", "position_x", "position_y", "position_z", "orientation", "rotation0", "rotation1", "rotation2", "rotation3", "animprogress", "state", "spawnMask", "phaseMask", "PhaseId", "PhaseGroup", "spawntimesecs" });
            SetDataGridViewColumns(LootDataGrid, 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
            goTemplate = new gameobject_template(true);

            goTemplateBinding            = new BindingSource();
            goTemplateBinding.DataSource = goTemplate;
            goTemplateBinding.ReflectionBinding(this, "EditBox_");
        }
Ejemplo n.º 6
0
 public GameObjectEntity(ObjectGUID objectGUID, gameobject databaseGameObject, gameobject_template template)
     : base(objectGUID)
 {
     this.Template   = template;
     this.GameObject = databaseGameObject;
 }
Ejemplo n.º 7
0
        public void OnGameObjectQuery(WorldSession session, PCGameObjectQuery packet)
        {
            gameobject_template template = Core.WorldDatabase.GetRepository <gameobject_template>().SingleOrDefault(g => g.entry == packet.EntryID);

            session.SendPacket(new PSGameObjectQueryResponse(template));
        }
Ejemplo n.º 8
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
            gameobject_template query = world.gameobject_template.Where(x => x.entry == query_id).Single();

            goTemplate = query;
            goTemplateBinding.DataSource = goTemplate;

            // Location
            var query_location = world.gameobject.Where(x => x.id == query_id).Select(x => new { x.guid, x.id, x.map, x.zoneId, x.areaId, x.position_x, x.position_y, x.position_z, x.orientation, x.rotation0, x.rotation1, x.rotation2, x.rotation3, x.animprogress, x.state, x.spawnMask, x.phaseMask, x.PhaseId, x.PhaseGroup, x.spawntimesecs }).ToList();

            LocationDataGrid.Load(query_location);

            // Loot
            var query_loot = world.gameobject_loot_template.Where(x => x.Entry.ToString() == query.data1.ToString()).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); // type == 3 || 25

            // Involved in
            var query_questStarter = world.gameobject_queststarter.Where(x => x.id == query_id).ToList();
            var query_questEnder   = world.gameobject_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.gameobject.Where(x => x.id == query_id).ToList();
            var query_smartAI_entry = world.smart_scripts.Where(x => x.entryorguid == query_id && x.source_type == 1).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 == 1).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]));
                    }
                }
            }

            GameObjectTab.SelectedTab = EditPage;
        }