示例#1
0
        public void FetchGameobjectCoordinates(Form1 Progress, bool forceUpdate = false)
        {
            Progress.AddProgressBarMaximum(Gameobjects.Count);
            Web web = new Web();

            foreach (KeyValuePair <int, Gameobject> i in Gameobjects)
            {
                if (i.Value.FetchDone() && !forceUpdate)
                {
                    Progress.StepProgressBar();
                    foreach (Coord c in i.Value.D_Locations)
                    {
                        c.Convert();
                    }
                    continue;
                }
                i.Value.FetchWebInformation(web);
                foreach (Coord c in i.Value.D_Locations)
                {
                    c.Convert();
                }
                Progress.StepProgressBar();
            }
            web.Quit();
            Database.Save();
        }
示例#2
0
        public void GetZoneInfo(Form1 ProgressController, Web web)
        {
            ProgressController.Buttons(false);
            Dictionary <int, string> Zones = new Dictionary <int, string>();

            for (int z = 0; z < 2; z++)
            {
                web.Navigate("http://db.vanillagaming.org/?zones=" + z);
                Object Read = (Object)web.GetVar("g_listviews['zones']['data']['length']");
                if (Read == null)
                {
                    return;
                }

                int ZoneLength = int.Parse(Read.ToString());
                //ReadOnlyCollection<Object> read = (ReadOnlyCollection<Object>)r;
                //int ZoneLength = int.Parse(web.GetVar("g_listviews['zones']['data']['length']").ToString());
                string DataPath = "g_listviews['zones']['data']";

                for (int i = 0; i < ZoneLength; i++)
                {
                    string Name = web.GetVar(DataPath + "['" + i + "']['name']").ToString();
                    int    ID   = int.Parse(web.GetVar(DataPath + "['" + i + "']['id']").ToString());
                    Zones.Add(ID, Name);
                }
            }
            ProgressController.SetProgressBarMaximum(Zones.Count);
            //Seems wrong a lot backup with other data.
            //0 == Neutral
            //1 == Alliance
            //2 == Horde
            //3 == both (Seems to be wrong a lot)

            //className var
            //pin pin-2 == horde
            //pin pin-3 == ally
            //pin == neutral

            //innerHTML example "<a style="cursor: pointer;" href="?npc=2437#starts" rel="np"></a>"
            //Cords exists in myMapper.getCoords() but does not return questNPCID so its useless
            //<ZoneID, NPCIDs>
            Dictionary <int, List <int> > NPCs = new Dictionary <int, List <int> >();

            foreach (KeyValuePair <int, string> Zone in Zones)
            {
                web.Navigate("http://db.vanillagaming.org/?zone=" + Zone.Key);
                int Pinlenght = int.Parse(web.GetVar("myMapper['pins']['length']").ToString());
                for (int i = 0; i < Pinlenght; i++)
                {
                    Object X = (Object)web.GetVar("myMapper['pins']['" + i + "']['x']");
                    Object Y = (Object)web.GetVar("myMapper['pins']['" + i + "']['y']");
                    if (X == null || Y == null)
                    {
                        return;
                    }
                    double x         = double.Parse(X.ToString());
                    double y         = double.Parse(Y.ToString());
                    Object InnerHTML = (Object)web.GetVar("myMapper['pins']['" + i + "']['innerHTML']");
                    if (InnerHTML == null)
                    {
                        return;
                    }
                    string NPCID = Regex.Match(InnerHTML.ToString(), @"npc=(.+?)#starts").Groups[1].Value;
                    if (NPCs.ContainsKey(Zone.Key))
                    {
                        if (!NPCs[Zone.Key].Contains(int.Parse(NPCID)))
                        {
                            NPCs[Zone.Key].Add(int.Parse(NPCID));
                        }
                    }
                    else
                    {
                        NPCs.Add(Zone.Key, new List <int>());
                        NPCs[Zone.Key].Add(int.Parse(NPCID));
                    }
                    if (!Database.DB.Creatures.ContainsKey(int.Parse(NPCID)))
                    {
                        Database.DB.Creatures.Add(int.Parse(NPCID), new Creature(Zone.Key, int.Parse(NPCID), null));
                    }
                    //Do something with this?
                }
                ProgressController.StepProgressBar();
            }
            MySql.Data.MySqlClient.MySqlConnection dbConn = new MySql.Data.MySqlClient.MySqlConnection("Persist Security Info=False;server=localhost;database=mangos;uid=root;password="******"SELECT * FROM `creature_questrelation` where id=" + c.Key + ";";
                MySqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    int Quest = int.Parse(reader["quest"].ToString());
                    if (!Database.DB.Quests.ContainsKey(Quest))
                    {
                        Database.DB.Quests.Add(Quest, new Quest(Quest));
                    }
                    else
                    {
                    }
                }
                reader.Close();
                ProgressController.StepProgressBar();
            }
            Database.Save();

            /*int QuestsLength = int.Parse(web.GetVar("g_listviews['quests']['data']['length]"));
             * for (int i = 0; i < Pinlenght; i++)
             * {
             *  Quests.add(new Quest(web));
             * }*/
            ProgressController.Buttons(true);
            web.Quit();
        }
示例#3
0
        public static void GetConvertion()
        {
            Web web = new Web(true);

            web.Navigate("http://db.vanillagaming.org/?zones=" + 0);
            Object Read = (Object)web.GetVar("g_listviews['zones']['data']['length']");

            if (Read == null)
            {
                return;
            }

            int ZoneLength = int.Parse(Read.ToString());
            int indx       = 1;

            for (int i = 0; i < ZoneLength; i++)
            {
                dynamic id   = web.GetVar("g_listviews['zones']['data'][" + i + "]['id']");
                dynamic name = web.GetVar("g_listviews['zones']['data'][" + i + "]['name']");
                if (name == "Deeprun Tram")
                {
                    continue;
                }
                Convertion.Add(int.Parse(id), new int[] { 2, indx });
                NameConvertion.Add(int.Parse(id), name);
                indx++;
            }

            web.Navigate("http://db.vanillagaming.org/?zones=" + 1);
            Read = (Object)web.GetVar("g_listviews['zones']['data']['length']");
            if (Read == null)
            {
                return;
            }

            ZoneLength = int.Parse(Read.ToString());

            indx = 1;
            for (int i = 0; i < ZoneLength; i++)
            {
                dynamic id   = web.GetVar("g_listviews['zones']['data'][" + i + "]['id']");
                dynamic name = web.GetVar("g_listviews['zones']['data'][" + i + "]['name']");
                Convertion.Add(int.Parse(id), new int[] { 1, indx });
                NameConvertion.Add(int.Parse(id), name);
                indx++;
            }

            web.Quit();

            /*if (WoWHeadZoneID == 331) { return new int[] { 1, 1 }; }//Ashenvale
             * if (WoWHeadZoneID == 16) { return new int[] { 1, 2}; }//Azshara
             * if (WoWHeadZoneID == 148) { return new int[] { 1, 3 }; }//Darkshore
             * if (WoWHeadZoneID == 1657) { return new int[] { 1, 4 }; }//Darnassus
             * if (WoWHeadZoneID == 405) { return new int[] { 1, 5 }; }//Desolace
             * if (WoWHeadZoneID == 14) { return new int[] { 1, 6 }; }
             * if (WoWHeadZoneID == 15) { return new int[] { 1, 7 }; }
             * if (WoWHeadZoneID == 361) { return new int[] { 1, 8 }; }
             * if (WoWHeadZoneID == 357) { return new int[] { 1, 9 }; }
             * if (WoWHeadZoneID == 493) { return new int[] { 1, 10 }; }
             * if (WoWHeadZoneID == 215) { return new int[] { 1, 11 }; }
             * if (WoWHeadZoneID == 1637) { return new int[] { 1, 12 }; }
             * if (WoWHeadZoneID == 357) { return new int[] { 1, 13 }; }
             * if (WoWHeadZoneID == 357) { return new int[] { 1, 14 }; }
             * if (WoWHeadZoneID == 357) { return new int[] { 1, 15 }; }*/
        }