Skip to content

Commit 6f3a882

Browse files
committed
Fixed EU realm lookups/changed top10 to new raid
1 parent 211b4cd commit 6f3a882

File tree

4 files changed

+47
-16
lines changed

4 files changed

+47
-16
lines changed

Modules/Wow/WarcraftLogs.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@ public List<CharClasses> GetCharClasses()
9595
public List<Reports> GetReportsFromGuild(string guildName = "The benchwarmers", string realm = "Thunderlord", string region = "US")
9696
{
9797
string url = string.Empty;
98+
string realmSlug = string.Empty;
99+
switch (region.ToLower())
100+
{
101+
case "us":
102+
{
103+
realmSlug = WowApi.RealmInfo.realms.Where(r => r.name.ToLower().Contains(realm.ToLower())).Select(s => s.slug).FirstOrDefault();
104+
break;
105+
}
106+
case "eu":
107+
{
108+
realmSlug = WowApi.RealmInfoEu.realms.Where(r => r.name.ToLower().Contains(realm.ToLower())).Select(s => s.slug).FirstOrDefault();
109+
break;
110+
}
111+
}
112+
System.Console.WriteLine($"SLUG: {realmSlug}");
113+
System.Console.WriteLine($"SLUGS: {WowApi.RealmInfoEu.realms[0].name}");
98114
url = $"/reports/guild/{guildName.Replace(" ", "%20")}/{realm}/{region}?";
99115
List<Reports> logs;
100116

Modules/Wow/WowApi.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using NinjaBotCore.Database;
1313
using System.Net.Http;
1414
using System.Net.Http.Headers;
15-
15+
1616
namespace NinjaBotCore.Modules.Wow
1717
{
1818
public class WowApi
@@ -22,6 +22,7 @@ public class WowApi
2222
private static Race _race;
2323
private static List<Achievement2> _achievements;
2424
private static WowRealm _realmInfo;
25+
private static WowRealm _realmInfoEu;
2526

2627
public WowApi()
2728
{
@@ -32,6 +33,7 @@ public WowApi()
3233
Achievements cheeves = this.GetWoWAchievements();
3334
Achievements = cheeves.achievements.Select(m => m.categories).Skip(1).SelectMany(i => i).Select(a => a.achievements).SelectMany(d => d).ToList();
3435
RealmInfo = this.GetRealmStatus();
36+
RealmInfoEu = this.GetRealmStatus("eu");
3537
}
3638
catch (Exception ex)
3739
{
@@ -50,6 +52,17 @@ private set
5052
_realmInfo = value;
5153
}
5254
}
55+
public static WowRealm RealmInfoEu
56+
{
57+
get
58+
{
59+
return _realmInfoEu;
60+
}
61+
private set
62+
{
63+
_realmInfoEu = value;
64+
}
65+
}
5366
public static List<Achievement2> Achievements
5467
{
5568
get
@@ -87,6 +100,7 @@ private set
87100
}
88101

89102
public WowClasses wowclasses;
103+
90104
//public TalentList wowtalents;
91105

92106
public string GetAPIRequest(string url, string region = "us")
@@ -116,7 +130,7 @@ public string GetAPIRequest(string url, string region = "us")
116130

117131
public string GetAPIRequest(string url, bool fileDownload)
118132
{
119-
string response;
133+
string response;
120134
url = $"{url}";
121135

122136
Console.WriteLine($"Wow API request to {url}");
@@ -133,7 +147,7 @@ public string GetAPIRequest(string url, bool fileDownload)
133147
}
134148

135149
public WowRealm GetRealmStatus(string locale = "us")
136-
{
150+
{
137151
string localeName = GetRegionFromString(locale);
138152
WowRealm w = new WowRealm();
139153
string url = $"/realm/status?locale={localeName}";
@@ -289,12 +303,12 @@ public Character GetCharInfo(string name, string realm, string regionName = "us"
289303
{
290304
c = JsonConvert.DeserializeObject<Character>(GetAPIRequest(url));
291305
}
292-
string thumbUrl = $"http://render-{regionName}.worldofwarcraft.com/character/{c.thumbnail}";
306+
string thumbUrl = $"http://render-{regionName}.worldofwarcraft.com/character/{c.thumbnail}";
293307
c.thumbnailURL = thumbUrl;
294308
string insetUrl = $"http://render-{regionName}.worldofwarcraft.com/character/{c.thumbnail.Replace("-avatar", "-inset")}";
295309
c.insetURL = insetUrl;
296310
string profilePicUrl = $"http://render-{regionName}.worldofwarcraft.com/character/{c.thumbnail.Replace("-avatar", "-profilemain")}";
297-
c.profilePicURL = profilePicUrl;
311+
c.profilePicURL = profilePicUrl;
298312
string armoryUrl = $"http://{regionName}.battle.net/wow/en/character/{c.realm}/{c.name}/advanced";
299313
c.armoryURL = armoryUrl;
300314
return c;

Modules/Wow/WowCommands.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,8 +1081,8 @@ public async Task GetTop10([Remainder] string args = null)
10811081
string guildName = guildObject.guildName;
10821082
region = guildObject.regionName;
10831083

1084-
var fightList = WarcraftLogs.Zones.Where(z => z.id == 13).Select(z => z.encounters).FirstOrDefault();
1085-
raidName = WarcraftLogs.Zones.Where(z => z.id == 13).Select(z => z.name).FirstOrDefault();
1084+
var fightList = WarcraftLogs.Zones.Where(z => z.id == 17).Select(z => z.encounters).FirstOrDefault();
1085+
raidName = WarcraftLogs.Zones.Where(z => z.id == 17).Select(z => z.name).FirstOrDefault();
10861086

10871087
//Get Guild Information for Discord Server (or channel for DM)
10881088
if (Context.Channel is IDMChannel)
@@ -1104,19 +1104,19 @@ public async Task GetTop10([Remainder] string args = null)
11041104
sb.AppendLine($"Get a list of all encounters and shortcut IDs");
11051105
sb.AppendLine();
11061106
sb.AppendLine($"**{Config.Prefix}top10** 1");
1107-
sb.AppendLine($"The above command would get all top 10 **dps** results for **Goroth** on **{realmName}**.");
1107+
sb.AppendLine($"The above command would get all top 10 **dps** results for **Garothi Worldbreaker** on **{realmName}**.");
11081108
sb.AppendLine();
11091109
sb.AppendLine($"**{Config.Prefix}top10** 1, guild");
1110-
sb.AppendLine($"The above command would get the top 10 **dps** results for **Goroth** on **{realmName}** for **{guildName}**.");
1110+
sb.AppendLine($"The above command would get the top 10 **dps** results for **Garothi Worldbreaker** on **{realmName}** for **{guildName}**.");
11111111
sb.AppendLine();
11121112
sb.AppendLine($"**{Config.Prefix}top10** 1, guild, hps");
1113-
sb.AppendLine($"The above command would get the top 10 **hps** results for **Goroth** on **{realmName}** for **{guildName}**.");
1113+
sb.AppendLine($"The above command would get the top 10 **hps** results for **Garothi Worldbreaker** on **{realmName}** for **{guildName}**.");
11141114
sb.AppendLine();
11151115
sb.AppendLine($"**{Config.Prefix}top10** 1, all, hps");
1116-
sb.AppendLine($"The above command would get all top 10 **hps** results for **Goroth** on **{realmName}**.");
1116+
sb.AppendLine($"The above command would get all top 10 **hps** results for **Garothi Worldbreaker** on **{realmName}**.");
11171117
sb.AppendLine();
11181118
sb.AppendLine($"**{Config.Prefix}top10** 1, guild, dps, mythic");
1119-
sb.AppendLine($"The above command would get the top 10 **dps** results for **Goroth** on **{realmName}** for **{guildName}** on **mythic** difficulty.");
1119+
sb.AppendLine($"The above command would get the top 10 **dps** results for **Garothi Worldbreaker** on **{realmName}** for **{guildName}** on **mythic** difficulty.");
11201120
embed.Title = $"{Context.User.Username}, here are some examples for **{Config.Prefix}top10**";
11211121
embed.Description = sb.ToString();
11221122
await _cc.Reply(Context, embed);
@@ -1315,7 +1315,7 @@ public async Task GetTop10([Remainder] string args = null)
13151315
}
13161316
else
13171317
{
1318-
l = _logsApi.GetRankingsByEncounter(encounterID, realmName, "2", metric, difficultyID, region);
1318+
l = _logsApi.GetRankingsByEncounter(encounterID, realmName, metric, difficultyID, region);
13191319
}
13201320
string fightNameFromEncounterID = fightList.Where(f => f.id == encounterID).Select(f => f.name).FirstOrDefault();
13211321
var top10 = l.rankings.OrderByDescending(a => a.total).Take(10);

NinjaBotCore.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
<TargetFramework>netcoreapp1.1</TargetFramework>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="Discord.Net" Version="1.0.1" />
8-
<PackageReference Include="Discord.Net.Commands" Version="1.0.1" />
9-
<PackageReference Include="Discord.Net.WebSocket" Version="1.0.1" />
7+
<PackageReference Include="Discord.Net" Version="1.0.2" />
8+
<PackageReference Include="Discord.Net.Commands" Version="1.0.2" />
9+
<PackageReference Include="Discord.Net.Core" Version="1.0.2" />
10+
<PackageReference Include="Discord.Net.WebSocket" Version="1.0.2" />
1011
<PackageReference Include="Google.Apis" Version="1.27.1" />
1112
<PackageReference Include="Google.Apis.Core" Version="1.27.1" />
1213
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.27.1.760" />

0 commit comments

Comments
 (0)