public static void IssueReport(AhhhDragonsReport report) { if (!(report.Map == 38 || report.Map == 94 || report.Map == 95 || report.Map == 96)) return; var serializer = new JavaScriptSerializer(); if (!string.IsNullOrWhiteSpace(report.Name)) { using (var wb = new WebClient()) { var data = new NameValueCollection(); data["mtc"] = report.MistsTrackingCode; data["name"] = report.Name; data["map"] = report.Map.ToString(); data["posx"] = report.PosX.ToString(); data["posy"] = report.PosY.ToString(); data["posz"] = report.PosZ.ToString(); data["friendly"] = report.GroupAllegiance == AhhhDragonsReport.PlayerGroupAllegiance.Friend ? "1" : "0"; data["size"] = ((int)report.GroupSize).ToString(); var response = wb.UploadValues("http://ahhhdragons.com/db/wvw.php", "POST", data); System.Diagnostics.Debug.WriteLine(Encoding.ASCII.GetString(response)); } } }
/// <summary> /// Saves the current report from the user to be sent to the server on regular 10s intervals /// </summary> /// <param name="allegiance"></param> /// <param name="amount"></param> /// <returns></returns> private AhhhDragonsReport BuildReport(AhhhDragonsReport.PlayerGroupAllegiance allegiance, MistPositioningSystem.AhhhDragonsReport.PlayerGroupSize amount) { var position = _GW2.Read(); if (!string.IsNullOrWhiteSpace(position.name)) { var identity = new JavaScriptSerializer().Deserialize<GW2Identity>(position.identity); var report = new AhhhDragonsReport { MistsTrackingCode = txtMistsTrackingCode.Text, Name = identity.Name, Map = identity.Map_Id, PosX = position.fAvatarPosition[0], PosY = position.fAvatarPosition[1], PosZ = position.fAvatarPosition[2], GroupAllegiance = allegiance, GroupSize = amount }; return report; } return null; }
private void button4_Click(object sender, EventArgs e) { _nextReport = BuildReport(AhhhDragonsReport.PlayerGroupAllegiance.Enemy, MistPositioningSystem.AhhhDragonsReport.PlayerGroupSize.Zerg); }
void _keyHook_KeyPressed(object sender, KeyPressedEventArgs e) { switch (e.Key) { case Keys.F9: _nextReport = BuildReport(AhhhDragonsReport.PlayerGroupAllegiance.Enemy, AhhhDragonsReport.PlayerGroupSize.Few); Console.Beep(300,300); break; case Keys.F10: _nextReport = BuildReport(AhhhDragonsReport.PlayerGroupAllegiance.Enemy, AhhhDragonsReport.PlayerGroupSize.Many); Console.Beep(300, 300); break; case Keys.F11: _nextReport = BuildReport(AhhhDragonsReport.PlayerGroupAllegiance.Enemy, AhhhDragonsReport.PlayerGroupSize.Zerg); Console.Beep(300, 300); break; } }
private void tmrAutoReport_Tick(object sender, EventArgs e) { if (_nextReport == null && chkSendMyPosition.Checked) { //build friendly report _nextReport = BuildReport(AhhhDragonsReport.PlayerGroupAllegiance.Friend, MistPositioningSystem.AhhhDragonsReport.PlayerGroupSize.Few); } if (_nextReport != null) { AhhhDragonsReporter.IssueReport(_nextReport); _nextReport = null; } }