Skip to content

Commit

Permalink
Merge branch 'queen-update'
Browse files Browse the repository at this point in the history
  • Loading branch information
Triky313 committed Jan 22, 2020
2 parents 8977793 + d0b532a commit dbe2994
Show file tree
Hide file tree
Showing 29 changed files with 803 additions and 595 deletions.
61 changes: 32 additions & 29 deletions StatisticsAnalysisTool/StatisticsAnalysisTool/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,41 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<userSettings>
<StatisticsAnalysisTool.Properties.Settings>
<setting name="RefreshRate" serializeAs="String">
<value>10000</value>
</setting>
<setting name="LanguageDirectoryName" serializeAs="String">
<value>Languages</value>
</setting>
<setting name="SettingsFileName" serializeAs="String">
<value>settings.ini</value>
</setting>
<setting name="ImageResources" serializeAs="String">
<value>ImageResources</value>
</setting>
<setting name="ItemListFileName" serializeAs="String">
<value>ItemList.json</value>
</setting>
<setting name="UpdateItemListByDays" serializeAs="String">
<value>7</value>
</setting>
<StatisticsAnalysisTool.Properties.Settings>
<setting name="RefreshRate" serializeAs="String">
<value>10000</value>
</setting>
<setting name="LanguageDirectoryName" serializeAs="String">
<value>Languages</value>
</setting>
<setting name="SettingsFileName" serializeAs="String">
<value>settings.ini</value>
</setting>
<setting name="ImageResources" serializeAs="String">
<value>ImageResources</value>
</setting>
<setting name="ItemListFileName" serializeAs="String">
<value>ItemList.json</value>
</setting>
<setting name="UpdateItemListByDays" serializeAs="String">
<value>7</value>
</setting>
<setting name="AutoUpdateConfigUrl" serializeAs="String">
<value>https://raw.githubusercontent.com/Triky313/AlbionOnline-StatisticsAnalysis/master/StatisticsAnalysisTool/StatisticsAnalysisTool/ao-update-check.xml</value>
</setting>
</StatisticsAnalysisTool.Properties.Settings>
</userSettings>
<applicationSettings>
<StatisticsAnalysisTool.Properties.Settings>
<setting name="ActiveMode" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="DonateUrl" serializeAs="String">
<value>https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=LEM458PZ4FV4C&amp;source=url</value>
</setting>
<setting name="DefaultItemListSourceUrl" serializeAs="String">
<value>https://raw.githubusercontent.com/broderickhyman/ao-bin-dumps/master/formatted/items.json</value>
</setting>
<StatisticsAnalysisTool.Properties.Settings>
<setting name="ActiveMode" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="DonateUrl" serializeAs="String">
<value>https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=LEM458PZ4FV4C&amp;source=url</value>
</setting>
<setting name="DefaultItemListSourceUrl" serializeAs="String">
<value>https://raw.githubusercontent.com/broderickhyman/ao-bin-dumps/master/formatted/items.json</value>
</setting>
</StatisticsAnalysisTool.Properties.Settings>
</applicationSettings>
</configuration>
97 changes: 78 additions & 19 deletions StatisticsAnalysisTool/StatisticsAnalysisTool/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<system:Double x:Key="BaseFontSize">12</system:Double>

<!--Global colors -->
<Color x:Key="Background.First">#FF3C3C41</Color>
<Color x:Key="Background.Second">#FF2D2D32</Color>
<Color x:Key="Background.Third">#FF222226</Color>
<Color x:Key="Background.First">#FF36363F</Color>
<Color x:Key="Background.Second">#FF2B2B33</Color>
<Color x:Key="Background.Third">#FF202026</Color>

<!-- Item level colors -->
<Color x:Key="Item.Level.Color.0">#FFb1b0ae</Color>
Expand All @@ -19,24 +19,27 @@
<Color x:Key="Item.Level.Color.3">#FFb866fe</Color>

<!-- City colors -->
<Color x:Key="Color.City.Caerleon">#FF262A2E</Color>
<Color x:Key="Color.City.Caerleon">#FF24292D</Color>
<Color x:Key="Color.City.Thetford">#FF3BAFDA</Color>
<Color x:Key="Color.City.Bridgewatch">#FFF76397</Color>
<Color x:Key="Color.City.Martlock">#FF7266BA</Color>
<Color x:Key="Color.City.Lymhurst">#FFFFAA00</Color>
<Color x:Key="Color.City.FortSterling">#FF00B19D</Color>
<Color x:Key="Color.City.ArthursRest">#FFF75656</Color>
<Color x:Key="Color.City.MerlynsRest">#FF435DE0</Color>
<Color x:Key="Color.City.MorganasRest">#FF83AF00</Color>

<!-- City colors -->
<Color x:Key="Color.Button.First">#ff6fccf6</Color>
<Color x:Key="Color.Button.Second">#ff57b6e0</Color>
<Color x:Key="Color.Button.Third">#ff3da2ca</Color>

<!-- Text colors -->
<Color x:Key="Color.Text.Normal">#FFDCDCDC</Color>
<Color x:Key="Color.Text.ToOldFirst">#FF9898A5</Color>
<Color x:Key="Color.Text.ToOldSecond">#FF81818C</Color>
<Color x:Key="Color.Text.ToOldThird">#FF696972</Color>
<Color x:Key="Color.Text.NoValue">#FF525259</Color>
<Color x:Key="Color.Text.Normal">#FFDEDEEA</Color>
<Color x:Key="Color.Text.ToOldFirst">#FF8C8CA5</Color>
<Color x:Key="Color.Text.ToOldSecond">#FF77778C</Color>
<Color x:Key="Color.Text.ToOldThird">#FF616172</Color>
<Color x:Key="Color.Text.NoValue">#FF4B4B59</Color>

<SolidColorBrush x:Key="SolidColorBrush.Foreground.First" Color="Gainsboro"/>
<SolidColorBrush x:Key="SolidColorBrush.Foreground.Second" Color="#B4B4B4"/>
Expand All @@ -49,7 +52,7 @@
<SolidColorBrush x:Key="Item.MouseOver.Background" Color="#FF00799f"/>
<SolidColorBrush x:Key="Item.IsSelected.Background" Color="#FF0e89b1"/>
<SolidColorBrush x:Key="GridView.Column.Header.Font" Color="{StaticResource Color.Button.Second}"/>
<SolidColorBrush x:Key="WindowButtonForeground" Color="#FF3C3C41"/>
<SolidColorBrush x:Key="WindowButtonForeground" Color="#FF36363F"/>
<SolidColorBrush x:Key="SolidColorBrush.Hyperlink.First" Color="#FF329bc3"/>
<SolidColorBrush x:Key="SolidColorBrush.Progressbar" Color="#FF3BAFDA"/>
<SolidColorBrush x:Key="SolidColorBrush.Item.Level.Color.1" Color="{StaticResource Item.Level.Color.1}"/>
Expand All @@ -67,6 +70,9 @@
<SolidColorBrush x:Key="SolidColorBrush.City.Martlock" Color="{StaticResource Color.City.Martlock}"/>
<SolidColorBrush x:Key="SolidColorBrush.City.Lymhurst" Color="{StaticResource Color.City.Lymhurst}"/>
<SolidColorBrush x:Key="SolidColorBrush.City.FortSterling" Color="{StaticResource Color.City.FortSterling}"/>
<SolidColorBrush x:Key="SolidColorBrush.City.ArthursRest" Color="{StaticResource Color.City.ArthursRest}"/>
<SolidColorBrush x:Key="SolidColorBrush.City.MerlynsRest" Color="{StaticResource Color.City.MerlynsRest}"/>
<SolidColorBrush x:Key="SolidColorBrush.City.MorganasRest" Color="{StaticResource Color.City.MorganasRest}"/>

<!-- ######################################################################################### -->

Expand All @@ -80,7 +86,7 @@
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF3C3C41" Offset="1"/>
<GradientStop Color="#FF33333F" Offset="1"/>
<GradientStop Color="{StaticResource Color.City.Caerleon}"/>
</LinearGradientBrush>
</Setter.Value>
Expand All @@ -95,7 +101,7 @@
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF3C3C41" Offset="1"/>
<GradientStop Color="#FF33333F" Offset="1"/>
<GradientStop Color="{StaticResource Color.City.Thetford}"/>
</LinearGradientBrush>
</Setter.Value>
Expand All @@ -110,7 +116,7 @@
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF3C3C41" Offset="1"/>
<GradientStop Color="#FF33333F" Offset="1"/>
<GradientStop Color="{StaticResource Color.City.Bridgewatch}"/>
</LinearGradientBrush>
</Setter.Value>
Expand All @@ -125,7 +131,7 @@
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF3C3C41" Offset="1"/>
<GradientStop Color="#FF33333F" Offset="1"/>
<GradientStop Color="{StaticResource Color.City.Martlock}"/>
</LinearGradientBrush>
</Setter.Value>
Expand All @@ -140,7 +146,7 @@
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF3C3C41" Offset="1"/>
<GradientStop Color="#FF33333F" Offset="1"/>
<GradientStop Color="{StaticResource Color.City.Lymhurst}"/>
</LinearGradientBrush>
</Setter.Value>
Expand All @@ -155,12 +161,57 @@
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF3C3C41" Offset="1"/>
<GradientStop Color="#FF33333F" Offset="1"/>
<GradientStop Color="{StaticResource Color.City.FortSterling}"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Label" x:Key="ArthursRestStyle" >
<Setter Property="Height" Value="28" />
<Setter Property="Width" Value="150" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Foreground" Value="{StaticResource SolidColorBrush.Foreground.First}" />
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF33333F" Offset="1"/>
<GradientStop Color="{StaticResource Color.City.ArthursRest}"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Label" x:Key="MerlynsRestStyle" >
<Setter Property="Height" Value="28" />
<Setter Property="Width" Value="150" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Foreground" Value="{StaticResource SolidColorBrush.Foreground.First}" />
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF33333F" Offset="1"/>
<GradientStop Color="{StaticResource Color.City.MerlynsRest}"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Label" x:Key="MorganasRestStyle" >
<Setter Property="Height" Value="28" />
<Setter Property="Width" Value="150" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Foreground" Value="{StaticResource SolidColorBrush.Foreground.First}" />
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FF33333F" Offset="1"/>
<GradientStop Color="{StaticResource Color.City.MorganasRest}"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Label" x:Key="DefaultCityStyle" >
<Setter Property="Height" Value="28" />
<Setter Property="Width" Value="150" />
Expand Down Expand Up @@ -255,7 +306,7 @@
<Setter.Value>
<LinearGradientBrush EndPoint = "1,0" MappingMode = "RelativeToBoundingBox" StartPoint = "0,0" Opacity = "0.5">
<GradientStop Color = "#FF1DC160" />
<GradientStop Color = "#FF3C3C41" Offset = "1" />
<GradientStop Color = "#FF33333F" Offset = "1" />
<GradientStop Color = "#FF384A44" Offset = "0.45" />
</LinearGradientBrush>
</Setter.Value>
Expand Down Expand Up @@ -651,7 +702,7 @@
</Setter>
</Style>

<!--Scrollbar Thumbs-->
<!-- Scrollbar Thumbs -->
<Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
<Setter Property="Template">
<Setter.Value>
Expand All @@ -671,7 +722,7 @@
</Setter>
</Style>

<!--ScrollBars-->
<!-- ScrollBars -->
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
<Setter Property="Stylus.IsFlicksEnabled" Value="false" />
<Setter Property="Foreground" Value="{StaticResource Item.MouseOver.Background}" />
Expand Down Expand Up @@ -732,6 +783,14 @@
</Setter>
</Style>

<!-- ListBox -->
<Style TargetType="{x:Type ListBox}">
<Setter Property="SelectionMode" Value="Multiple" />
<Setter Property="Foreground" Value="{StaticResource SolidColorBrush.Foreground.First}" />
<Setter Property="Background" Value="{StaticResource SolidColorBrush.Background.First}" />
<Setter Property="BorderBrush" Value="{StaticResource SolidColorBrush.Background.Third}" />
</Style>

</Application.Resources>
</Application>

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
namespace StatisticsAnalysisTool.Common
{
using Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Threading.Tasks;

public class ApiController
{

public static async Task<ItemData> GetItemDataFromJsonAsync(Item item)
{
try
{
using (var wc = new WebClient())
{
var itemDataJsonUrl = $"https://gameinfo.albiononline.com/api/gameinfo/items/{item.UniqueName}/data";
var itemString = await wc.DownloadStringTaskAsync(itemDataJsonUrl);
var parsedObject = JObject.Parse(itemString);

var itemData = new ItemData
{
ItemType = (string)parsedObject["itemType"],
UniqueName = (string)parsedObject["uniqueName"],
//UiSprite = (string)parsedObject["uiSprite"],
Showinmarketplace = (bool)parsedObject["showinmarketplace"],
Level = (int)parsedObject["level"],
Tier = (int)parsedObject["tier"],
LocalizedNames = new List<ItemData.KeyValueStruct>(),
//CategoryId = (string)parsedObject["categoryId"],
//CategoryName = (string)parsedObject["categoryName"],
//LocalizedDescriptions = (string)parsedObject["localizedDescriptions"]["DE-DE"],
//SlotType = (string)parsedObject["slotType"],
//Stackable = (bool)parsedObject["stackable"],
//Equipable = (bool)parsedObject["equipable"],
};

StatisticsAnalysisManager.AddLocalizedName(ref itemData, parsedObject);
return itemData;
}
}
catch (Exception ex)
{
Debug.Print(ex.ToString());
return null;
}
}

public static async Task<List<MarketResponse>> GetCityItemPricesFromJsonAsync(string uniqueName, List<string> locations)
{
if (locations?.Count < 1)
return new List<MarketResponse>();

using (var wc = new WebClient())
{
var statPricesDataJsonUrl = "https://www.albion-online-data.com/api/v2/stats/prices/";
statPricesDataJsonUrl += uniqueName;
statPricesDataJsonUrl += $"?locations=";
foreach (var location in locations)
{
statPricesDataJsonUrl += $"{location},";
}

var itemString = await wc.DownloadStringTaskAsync(statPricesDataJsonUrl);
return JsonConvert.DeserializeObject<List<MarketResponse>>(itemString);
}
}

public static async Task<decimal> GetMarketStatAvgPriceFromJsonAsync(string uniqueName, Location location)
{
using (var wc = new WebClient())
{
var apiString =
$"https://www.albion-online-data.com/api/v1/stats/charts/" +
$"{uniqueName}?date={DateTime.Now:MM-dd-yyyy}?locations={Locations.GetName(location)}";

try
{
var itemString = await wc.DownloadStringTaskAsync(apiString);
var values = JsonConvert.DeserializeObject<List<MarketStatChartResponse>>(itemString);

return values.FirstOrDefault()?.Data.PricesAvg.FirstOrDefault() ?? 0;
}
catch
{
return 0;
}
}
}

}
}
Loading

0 comments on commit dbe2994

Please sign in to comment.