Merge pull request #20 from MaikyM/fortbytes

Added support for Fortbytes Challenges.
This commit is contained in:
Asval 2019-06-18 09:20:00 +02:00 committed by GitHub
commit d960570ed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 7 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
@ -1295,10 +1295,11 @@ namespace FModel
ChallengeBundleIdParser bundleParser = ChallengeBundleIdParser.FromJson(theParsedJson).FirstOrDefault();
BundleInfos.getBundleData(bundleParser);
Bitmap bmp = null;
bool isFortbyte = false;
if (Settings.Default.createIconForChallenges)
{
bmp = new Bitmap(2500, 5000);
bmp = new Bitmap(2500, 15000);
BundleDesign.BundlePath = extractedBundlePath;
BundleDesign.theY = 275;
BundleDesign.toDrawOn = Graphics.FromImage(bmp);
@ -1309,6 +1310,18 @@ namespace FModel
BundleDesign.drawBackground(bmp, bundleParser);
}
if (BundleInfos.BundleData[0].rewardItemId != null && string.Equals(BundleInfos.BundleData[0].rewardItemId, "AthenaFortbyte", StringComparison.CurrentCultureIgnoreCase))
isFortbyte = true;
// Fortbytes: Sort by number
if (isFortbyte)
{
BundleInfos.BundleData.Sort(delegate (BundleInfoEntry a, BundleInfoEntry b)
{
return Int32.Parse(a.rewardItemQuantity).CompareTo(Int32.Parse(b.rewardItemQuantity));
});
}
for (int i = 0; i < BundleInfos.BundleData.Count; i++)
{
AppendText(BundleInfos.BundleData[i].questDescr, Color.SteelBlue);
@ -1320,7 +1333,7 @@ namespace FModel
BundleDesign.theY += 140;
//draw quest description
BundleDesign.toDrawOn.DrawString(BundleInfos.BundleData[i].questDescr, new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, BundleDesign.theY));
BundleDesign.toDrawOn.DrawString(BundleInfos.BundleData[i].questDescr, new Font(FontUtilities.pfc.Families[1], isFortbyte ? 40 : 50), new SolidBrush(Color.White), new Point(100, BundleDesign.theY));
//draw slider + quest count
Image slider = Resources.Challenges_Slider;

View File

@ -100,6 +100,7 @@ namespace FModel
{
string oldQuest = string.Empty;
long oldCount = 0;
for (int p = 0; p < questParser[x].Objectives.Length; p++)
{
string newQuest;
@ -117,7 +118,7 @@ namespace FModel
if (newQuest != oldQuest && newCount != oldCount)
{
if (questParser[x].Rewards != null)
if (questParser[x].Rewards != null && !questFilePath.Contains("Fortbyte_"))
{
try
{
@ -149,10 +150,10 @@ namespace FModel
}
}
}
else if (questFilePath.Contains("Fortbyte_"))
BundleData.Add(new BundleInfoEntry(newQuest, newCount, "AthenaFortbyte", questParser[x].Weight > 0 ? questParser[x].Weight.ToString() : "01"));
else
{
BundleData.Add(new BundleInfoEntry(newQuest, newCount, "", ""));
}
oldQuest = newQuest;
oldCount = newCount;

View File

@ -1,4 +1,4 @@
using csharp_wick;
using csharp_wick;
using FModel.Parser.Items;
using FModel.Properties;
using Newtonsoft.Json;
@ -32,6 +32,7 @@ namespace FModel
else if (string.Equals(itemToExtract, "athenabattlestar", StringComparison.CurrentCultureIgnoreCase)) { drawBattleStar(itemQuantity); }
else if (string.Equals(itemToExtract, "AthenaSeasonalXP", StringComparison.CurrentCultureIgnoreCase)) { drawSeasonalXp(itemQuantity); }
else if (string.Equals(itemToExtract, "MtxGiveaway", StringComparison.CurrentCultureIgnoreCase)) { drawMtxGiveaway(itemQuantity); }
else if (string.Equals(itemToExtract, "AthenaFortbyte", StringComparison.CurrentCultureIgnoreCase)) { drawFortbyte(itemQuantity); }
else { DrawRewardIcon(itemToExtract); }
}
}
@ -148,6 +149,7 @@ namespace FModel
BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, BundleDesign.theY + 6));
}
}
private static void drawBattleStar(string quantity)
{
Image rewardIcon = Resources.T_FNBR_BattlePoints_L;
@ -156,6 +158,7 @@ namespace FModel
GraphicsPath p = new GraphicsPath();
drawPathAndFill(p, quantity, Color.FromArgb(255, 143, 74, 32), Color.FromArgb(255, 255, 219, 103));
}
private static void drawSeasonalXp(string quantity)
{
Image rewardIcon = Resources.T_FNBR_SeasonalXP_L;
@ -164,6 +167,7 @@ namespace FModel
GraphicsPath p = new GraphicsPath();
drawPathAndFill(p, quantity, Color.FromArgb(255, 81, 131, 15), Color.FromArgb(255, 230, 253, 177));
}
private static void drawMtxGiveaway(string quantity)
{
Image rewardIcon = Resources.T_Items_MTX_L;
@ -173,6 +177,11 @@ namespace FModel
drawPathAndFill(p, quantity, Color.FromArgb(255, 100, 160, 175), Color.FromArgb(255, 220, 230, 255));
}
private static void drawFortbyte(string quantity)
{
BundleDesign.toDrawOn.DrawString("#" + Int32.Parse(quantity).ToString("D2"), new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(2325, BundleDesign.theY + 22));
}
/// <summary>
/// define a pen to draw the outlines of a string with a color and fill with another color
/// </summary>

View File

@ -30,6 +30,9 @@ namespace FModel.Parser.Quests
[JsonProperty("Objectives")]
public Objective[] Objectives { get; set; }
[JsonProperty("Weight")]
public double Weight { get; set; }
[JsonProperty("CompletionText")]
public FTextInfos CompletionText { get; set; }