Skip to content

Commit

Permalink
feat: add caravan score to discord rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
DorielRivalet committed Oct 5, 2022
1 parent ff29acc commit 98b3761
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
39 changes: 30 additions & 9 deletions MHFZ_Overlay/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,22 @@ public string GetAreaName(int id)
return areaname + "";
}

/// <summary>
/// Gets the caravan score.
/// </summary>
/// <returns></returns>
public string GetCaravanScore()
{
if (DataLoader.model.ShowCaravanScore())
return string.Format("Caravan Score: {0} | ", DataLoader.model.CaravanScore());
else
return "";
}

/// <summary>
/// Gets the caravan skills.
/// </summary>
/// <returns></returns>
public string GetCaravanSkills()
{
int id1 = DataLoader.model.CaravanSkill1();
Expand All @@ -641,6 +657,11 @@ public string GetCaravanSkills()
return caravanSkillName1 + ", " + caravanSkillName2 + ", " + caravanSkillName3;
}

/// <summary>
/// Gets the diva skill name from identifier.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns></returns>
public string GetDivaSkillNameFromID(int id)
{
Dictionary.DivaSkillList.DivaSkillID.TryGetValue(id, out string? divaskillaname);
Expand Down Expand Up @@ -1252,7 +1273,7 @@ public string GetObjectiveNameFromID(int id, bool isLargeImageText = false)
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns></returns>
public string getAreaIconFromID(int id) //TODO: are highlands, tidal island or painted falls icons correct?
public string GetAreaIconFromID(int id) //TODO: are highlands, tidal island or painted falls icons correct?
{
switch (id)
{
Expand Down Expand Up @@ -1612,7 +1633,7 @@ public string getAreaIconFromID(int id) //TODO: are highlands, tidal island or p
/// </summary>
/// <param name="isHighGradeEdition">if set to <c>true</c> [is high grade edition].</param>
/// <returns></returns>
public string getGameMode(bool isHighGradeEdition)
public string GetGameMode(bool isHighGradeEdition)
{
if (isHighGradeEdition)
return " [High-Grade Edition]";
Expand All @@ -1624,7 +1645,7 @@ public string getGameMode(bool isHighGradeEdition)
/// Gets the overlay mode.
/// </summary>
/// <returns></returns>
public string getOverlayMode()
public string GetOverlayMode()
{
Settings s = (Settings)Application.Current.TryFindResource("Settings");
if (!(inQuest) || s.EnableDamageNumbers || s.HealthBarsShown || s.EnableSharpness || s.PartThresholdShown || s.HitCountShown || s.PlayerAtkShown || s.MonsterAtkMultShown || s.MonsterDefrateShown || s.MonsterSizeShown || s.MonsterPoisonShown || s.MonsterParaShown || s.MonsterSleepShown || s.MonsterBlastShown || s.MonsterStunShown)
Expand Down Expand Up @@ -2420,7 +2441,7 @@ private void UpdateDiscordRPC()
Dictionary.Items.initiate();
}

presenceTemplate.Details = string.Format("{0}{1}{2}", getOverlayMode(), GetAreaName(DataLoader.model.AreaID()), getGameMode(DataLoader.isHighGradeEdition));
presenceTemplate.Details = string.Format("{0}{1}{2}{3}",GetCaravanScore(), GetOverlayMode(), GetAreaName(DataLoader.model.AreaID()), GetGameMode(DataLoader.isHighGradeEdition));

//quest ids:
//mp road: 23527
Expand Down Expand Up @@ -2485,19 +2506,19 @@ private void UpdateDiscordRPC()
//Gathering/etc
if ((DataLoader.model.ObjectiveType() == 0x0 || DataLoader.model.ObjectiveType() == 0x02 || DataLoader.model.ObjectiveType() == 0x1002) && (DataLoader.model.QuestID() != 23527 && DataLoader.model.QuestID() != 23628 && DataLoader.model.QuestID() != 21731 && DataLoader.model.QuestID() != 21749 && DataLoader.model.QuestID() != 21746 && DataLoader.model.QuestID() != 21750))
{
presenceTemplate.Assets.LargeImageKey = getAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageKey = GetAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageText = string.Format("{0}{1}",GetQuestInformation(),GetAreaName(DataLoader.model.AreaID()));
}
//Tenrou Sky Corridor areas
else if (DataLoader.model.AreaID() == 391 || DataLoader.model.AreaID() == 392 || DataLoader.model.AreaID() == 394 || DataLoader.model.AreaID() == 415 || DataLoader.model.AreaID() == 416)
{
presenceTemplate.Assets.LargeImageKey = getAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageKey = GetAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageText = string.Format("{0}{1}", GetQuestInformation(), GetAreaName(DataLoader.model.AreaID()));
}
//Duremudira Doors
else if (DataLoader.model.AreaID() == 399 || DataLoader.model.AreaID() == 414)
{
presenceTemplate.Assets.LargeImageKey = getAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageKey = GetAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageText = string.Format("{0}{1}", GetQuestInformation(), GetAreaName(DataLoader.model.AreaID()));
}
//Duremudira Arena
Expand All @@ -2509,7 +2530,7 @@ private void UpdateDiscordRPC()
//Hunter's Road Base Camp
else if (DataLoader.model.AreaID() == 459)
{
presenceTemplate.Assets.LargeImageKey = getAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageKey = GetAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageText = string.Format("{0}{1} | Faints: {2}/{3}", GetQuestInformation(), GetAreaName(DataLoader.model.AreaID()),DataLoader.model.CurrentFaints(),DataLoader.model.MaxFaints());
}
else
Expand Down Expand Up @@ -2630,7 +2651,7 @@ private void UpdateDiscordRPC()
break;
}

presenceTemplate.Assets.LargeImageKey = getAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageKey = GetAreaIconFromID(DataLoader.model.AreaID());
presenceTemplate.Assets.LargeImageText = GetAreaName(DataLoader.model.AreaID());
}

Expand Down
9 changes: 9 additions & 0 deletions MHFZ_Overlay/addresses/AddressModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,15 @@ public bool ShowMonsterEHP()
return false;
}

public bool ShowCaravanScore()
{
Settings s = (Settings)Application.Current.TryFindResource("Settings");
if (s.EnableCaravanScore == true)
return true;
else
return false;
}

/// <summary>
/// Gets or sets a value indicating whether this <see cref="AddressModel"/> is configuring.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Fully reinstalling the game or .NET dependencies may fix some bugs.
- Raviente Support Part Info
- Detect UL/HC
- Guild Pugi address
- Performance improvements

[Check more possible future features here](https://github.com/DorielRivalet/MHFZ_Overlay/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)

Expand Down

0 comments on commit 98b3761

Please sign in to comment.