public void FetchWebInformation(Web web, bool forceUpdate = false) { if (DeepFetchDone && !forceUpdate) { return; } web.Navigate("http://db.vanillagaming.org/?quest=" + QuestID); ParseQuestObjectives(web); /*IWebElement table = driver.FindElement(By.Class("infobox")); * foreach (IWebElement table in table) * { * //Todo: see what information is here then use that to read this: * /* * Log Levels * Log RequiredLevel * Log Side * Log Start (this should be written to the quest) and NPCs * Log End (this should be written to the quest) and NPCs * Log QuestSeries, Before and Next quest * */ //}*/ web.State = WorkingState.Idle; }
public Quest(Web web, int ZoneID, int StarterNPC) { //Expects driver to be on the page already. if (!web.Url().ToLower().Contains("zone=" + ZoneID)) { web.Navigate("http://db.vanillagaming.org/?zone=" + ZoneID); } int Length = int.Parse(web.GetVar("g_listviews['quests']['data'].length").ToString()); //Todo: Do conversions! for (int i = 0; i < Length; i++) { this.category = int.Parse(web.GetVar("g_listviews['quests']['data']['" + i + "']['category']").ToString()); this.category2 = int.Parse(web.GetVar("g_listviews['quests']['data']['" + i + "']['category2']").ToString()); this.QuestID = int.Parse(web.GetVar("g_listviews['quests']['data']['" + i + "']['id']").ToString()); this.level = int.Parse(web.GetVar("g_listviews['quests']['data']['" + i + "']['level']").ToString()); this.name = web.GetVar("g_listviews['quests']['data']['" + i + "']['name']").ToString(); this.reqLevel = int.Parse(web.GetVar("g_listviews['quests']['data']['" + i + "']['reqlevel']").ToString()); this.reqRaces = int.Parse(web.GetVar("g_listviews['quests']['data']['" + i + "']['side']").ToString()); this.type = int.Parse(web.GetVar("g_listviews['quests']['data']['" + i + "']['type']").ToString()); this.xp = int.Parse(web.GetVar("g_listviews['quests']['data']['" + i + "']['xp']").ToString()); } //Todo: Check if the itemrewards var even exists /*int ItemRewardsLength = Web.GetVar("g_listviews['quests']['data']['" + i + "']['itemrewards']['length']"); * for (int i = 0; i < ItemRewardsLength; i++) * { * ItemRewards.Add(int.Parse(web.GetVar("g_listviews['quests']['data']['" + i + "']['itemrewards']['" + i + "'][0]").ToString())); * }*/ }
public void FetchWebInformation(Web web, bool forceUpdate = false) { if (DeepFetchDone && !forceUpdate) { return; } web.Navigate("http://db.vanillagaming.org/?item=" + ID); //TODO Do stuff //Get Where it drops / where it is contained in DeepFetchDone = true; }
public void FetchFaction(Web web) { if (FactionFetchDone != null && FactionFetchDone == true) { return; } if (D_React == null) { D_React = new Dictionary <string, int>(); } web.Navigate("http://db.vanillagaming.org/?npc=" + ID); try { IWebElement table = web.driver.FindElement(By.ClassName("infobox")); IWebElement targetElement = table.FindElement(By.CssSelector("div[id*='markup-']")); ReadOnlyCollection <IWebElement> t = targetElement.FindElements(By.CssSelector("div")); //string s = t[2].GetAttribute("innerHTML"); foreach (IWebElement e in t) { string s = e.GetAttribute("innerHTML"); if (s.ToLower().Contains("react:")) { foreach (IWebElement Span in e.FindElements(By.CssSelector("span"))) { string c = Span.GetAttribute("class"); if (c == "q10") //Hostile { D_React.Add(Span.Text, -1); } else if (c == "q2") //Friendly { D_React.Add(Span.Text, 1); } else if (c == "q") //Neutral { D_React.Add(Span.Text, 0); } } } } } catch { } FactionFetchDone = true; }
public void FetchWebInformation(Web web, bool forceUpdate = false) { if (DeepFetchDone && !forceUpdate) { return; } web.Navigate("http://db.vanillagaming.org/?object=" + ID); if (D_Locations == null) { D_Locations = new List <Coord>(); } Object Read = (Object)web.GetVar("myMapper.zone"); if (Read == null) { return; } int MapID = int.Parse(Read.ToString()); Read = (Object)web.GetVar("myMapper.getCoords()"); if (Read != null) { ReadOnlyCollection <Object> read = (ReadOnlyCollection <Object>)Read; foreach (dynamic o in read) { double X = o[0]; double Y = o[1]; D_Locations.Add(new Coord(MapID, X, Y)); } } //TODO Do stuff //Get Coords myMapper.getCoords() //Get locations, get what it contains //GetWHMapID //Name DeepFetchDone = true; }
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(); }
public void FetchWebInformation(Web web, bool forceUpdate = false) { if (DeepFetchDone && !forceUpdate) { return; } web.Navigate("http://db.vanillagaming.org/?npc=" + ID); //Object Read = (Object)web.GetVar("g_listviews['drop']['data'].length"); /*if (Read != null) * { * int ItemLength = int.Parse(Read.ToString()); * * for (int i = 0; i < ItemLength; i++) * { * int ItemID = int.Parse(web.GetVar("g_listviews['drop']['data']['" + i + "']['id']").ToString()); * string ItemName = web.GetVar("g_listviews['drop']['data']['" + i + "']['name']").ToString().Remove(1); * if(!Database.DB.Items.ContainsKey(ItemID)){ * Database.DB.Items.Add(ItemID,new Item(ItemID, ItemName)); * } * } * }*/ if (D_Locations == null) { D_Locations = new List <Coord>(); } Object Read = (Object)web.GetVar("myMapper.zone"); if (Read != null) { int MapID = int.Parse(Read.ToString()); Read = (Object)web.GetVar("myMapper.getCoords()"); if (Read != null) { ReadOnlyCollection <Object> read = (ReadOnlyCollection <Object>)Read; foreach (dynamic o in read) { double X = o[0]; double Y = o[1]; D_Locations.Add(new Coord(MapID, X, Y)); } } } /* * Object Chck = web.GetVar("g_listviews['starts']['data'].length"); * int Length = int.Parse((Chck != null ? Chck : 0).ToString()); * //Todo: Do conversions! * for (int i = 0; i < Length; i++) * { * Object c = web.GetVar("g_listviews['starts']['data']['" + i + "']['category']"); * int category = int.Parse((c!=null?c:-1).ToString()); * * c = web.GetVar("g_listviews['starts']['data']['" + i + "']['category2']"); * int category2 = int.Parse((c != null ? c : -1).ToString()); * * c =web.GetVar("g_listviews['starts']['data']['" + i + "']['id']"); * int QuestID = int.Parse((c != null ? c : -1).ToString()); * * c = web.GetVar("g_listviews['starts']['data']['" + i + "']['level']"); * int level = int.Parse((c != null ? c : -1).ToString()); * * c=web.GetVar("g_listviews['starts']['data']['" + i + "']['name']"); * string name = (c != null ? c : "").ToString(); * * c=web.GetVar("g_listviews['starts']['data']['" + i + "']['reqlevel']"); * int reqLevel = int.Parse((c != null ? c : -1).ToString()); * * c=web.GetVar("g_listviews['starts']['data']['" + i + "']['side']"); * int side = int.Parse((c != null ? c : -1).ToString()); * * c=web.GetVar("g_listviews['starts']['data']['" + i + "']['type']"); * int type = int.Parse((c != null ? c : -1).ToString()); * * c=web.GetVar("g_listviews['starts']['data']['" + i + "']['xp']"); * int xp = int.Parse((c != null ? c : -1).ToString()); * if(!Database.DB.Quests.ContainsKey(QuestID)){ * Database.DB.Quests.Add(QuestID, new Quest(category,category2,QuestID,level,name,reqLevel,side,xp)); //TODO * } * if (Database.DB.Quests.ContainsKey(QuestID)) * { * //Database.DB.Quests[QuestID].StarterNPC.Add(ID); TODO * } * } * Chck = web.GetVar("g_listviews['ends']['data'].length"); * Length = int.Parse((Chck != null ? Chck : 0).ToString()); * //Todo: Do conversions! * for (int i = 0; i < Length; i++) * { * Object c = web.GetVar("g_listviews['ends']['data']['" + i + "']['category']"); * int category = int.Parse((c != null ? c : -1).ToString()); * * c = web.GetVar("g_listviews['ends']['data']['" + i + "']['category2']"); * int category2 = int.Parse((c != null ? c : -1).ToString()); * * c = web.GetVar("g_listviews['ends']['data']['" + i + "']['id']"); * int QuestID = int.Parse((c != null ? c : -1).ToString()); * * c = web.GetVar("g_listviews['ends']['data']['" + i + "']['level']"); * int level = int.Parse((c != null ? c : -1).ToString()); * * c = web.GetVar("g_listviews['ends']['data']['" + i + "']['name']"); * string name = (c != null ? c : "").ToString(); * * c = web.GetVar("g_listviews['ends']['data']['" + i + "']['reqlevel']"); * int reqLevel = int.Parse((c != null ? c : -1).ToString()); * * c = web.GetVar("g_listviews['ends']['data']['" + i + "']['side']"); * int side = int.Parse((c != null ? c : -1).ToString()); * * c = web.GetVar("g_listviews['ends']['data']['" + i + "']['type']"); * int type = int.Parse((c != null ? c : -1).ToString()); * * c = web.GetVar("g_listviews['ends']['data']['" + i + "']['xp']"); * int xp = int.Parse((c != null ? c : -1).ToString()); * if (!Database.DB.Quests.ContainsKey(QuestID)) * { * Database.DB.Quests.Add(QuestID, new Quest(category, category2, QuestID, level, name, reqLevel, side, xp)); //TODO * } * if (Database.DB.Quests.ContainsKey(QuestID)) * { * //Database.DB.Quests[QuestID].EndNPC.Add(ID); TODO * } * } * //TODO Do stuff * //Get Coords myMapper.getCoords() DONE * //Get Drops DONE * //Get Starts DONE * //Get Ends DONE * //Get Drops DONE * //Get Alligiance (Horde/Ally/Both) DONE*/ DeepFetchDone = true; }
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 }; }*/ }