BenBot Rate Limit support + prestige challenge separated

This commit is contained in:
Asval 2019-08-07 18:17:21 +02:00
parent 621a3067fe
commit a00be8e329
7 changed files with 54 additions and 16 deletions

View File

@ -1043,6 +1043,7 @@ namespace FModel
});
}
bool isSeparatorAlreadyAdded = false;
for (int i = 0; i < BundleInfos.BundleData.Count; i++)
{
new UpdateMyConsole(BundleInfos.BundleData[i].questDescr, Color.SteelBlue).AppendToConsole();
@ -1051,6 +1052,12 @@ namespace FModel
BundleDesign.theY += 90;
if (!string.IsNullOrEmpty(BundleInfos.BundleData[i].questUnlockType) && !isSeparatorAlreadyAdded)
{
BundleDesign.drawPrestigeSeparator();
isSeparatorAlreadyAdded = true;
}
//draw quest description
BundleDesign.drawQuestBackground(bmp);
Font goodFont = FontUtilities.FindFont(BundleDesign.toDrawOn, BundleInfos.BundleData[i].questDescr, new Rectangle(57, BundleDesign.theY + 7, bmp.Width - 227, 38).Size, new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 30)); //size in "new Font()" is never check

View File

@ -67,7 +67,10 @@ namespace FModel
{
if (DLLImport.IsInternetAvailable())
{
JToken dynamicPaks = JObject.Parse(Keychain.GetEndpoint("http://benbotfn.tk:8080/api/aes")).FindTokens("additionalKeys").FirstOrDefault();
string data = Keychain.GetEndpoint("http://benbotfn.tk:8080/api/aes");
if (string.IsNullOrEmpty(data)) { new UpdateMyConsole("[BenBot API] API Down or Rate Limit Exceeded", Color.Red, true).AppendToConsole(); return null; }
JToken dynamicPaks = JObject.Parse(data).FindTokens("additionalKeys").FirstOrDefault();
return JToken.Parse(dynamicPaks.ToString()).ToString().TrimStart('[').TrimEnd(']');
}
else

View File

@ -16,10 +16,9 @@ namespace FModel
RestClient EndpointClient = new RestClient(url);
RestRequest EndpointRequest = new RestRequest(Method.GET);
var response = EndpointClient.Execute(EndpointRequest);
string content = JToken.Parse(response.Content).ToString(Newtonsoft.Json.Formatting.Indented);
string response = EndpointClient.Execute(EndpointRequest).Content;
return content;
return response;
}
}
}

View File

@ -354,5 +354,24 @@ namespace FModel
toDrawOn.DrawString(text, new Font(FontUtilities.pfc.Families[0], 15), new SolidBrush(Color.FromArgb(150, 255, 255, 255)), new Point(myBitmap.Width - 10, 210), FontUtilities.rightString);
}
public static void drawPrestigeSeparator()
{
string texture = JohnWick.AssetToTexture2D("T-FNBR-MissionIcon-L");
if (File.Exists(texture))
{
Image itemIcon;
using (var bmpTemp = new Bitmap(texture))
{
itemIcon = new Bitmap(bmpTemp);
}
toDrawOn.FillRectangle(new SolidBrush(Color.FromArgb(100, headerColor.R, headerColor.G, headerColor.B)), new Rectangle(25, theY, 50, 35));
toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 32, 32), new Point(50 - 15, theY + 2));
theY += 40;
}
}
}
}

View File

@ -110,7 +110,7 @@ namespace FModel
if (assetPathName != null)
{
string questName = Path.GetFileName(assetPathName.Value<string>()).Substring(0, Path.GetFileName(assetPathName.Value<string>()).LastIndexOf(".", StringComparison.Ordinal));
getQuestData(questName);
getQuestData(questName, token);
}
}
}
@ -122,7 +122,7 @@ namespace FModel
/// loop if stage exist
/// </summary>
/// <param name="questFile"></param>
private static void getQuestData(string questFile)
private static void getQuestData(string questFile, JToken questInfo)
{
try
{
@ -138,6 +138,14 @@ namespace FModel
{
new UpdateMyState("Parsing " + questFile + "...", "Waiting").ChangeProcessState();
//prestige challenge check
JToken questUnlockType = questInfo["QuestUnlockType"];
string unlockType = string.Empty;
if (questUnlockType != null && questUnlockType.Value<string>().Equals("EChallengeBundleQuestUnlockType::BundleLevelup"))
{
unlockType = questUnlockType.Value<string>();
}
dynamic AssetData = JsonConvert.DeserializeObject(JohnWick.MyAsset.GetSerialized());
JArray AssetArray = JArray.FromObject(AssetData);
@ -214,7 +222,7 @@ namespace FModel
string rewardId = rewardsArray.Where(item => !item["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value<string>().Equals("Quest") && !item["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value<string>().Equals("Token")).FirstOrDefault()["ItemPrimaryAssetId"]["PrimaryAssetName"].Value<string>();
string rewardQuantity = rewardsArray.Where(item => !item["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value<string>().Equals("Quest") && !item["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value<string>().Equals("Token")).FirstOrDefault()["Quantity"].Value<string>();
BundleInfoEntry currentData = new BundleInfoEntry(questDescription, questCount, rewardId, rewardQuantity);
BundleInfoEntry currentData = new BundleInfoEntry(questDescription, questCount, rewardId, rewardQuantity, unlockType);
bool isAlreadyAdded = BundleData.Any(item => item.questDescr.Equals(currentData.questDescr, StringComparison.InvariantCultureIgnoreCase) && item.questCount == currentData.questCount);
if (!isAlreadyAdded) { BundleData.Add(currentData); }
}
@ -226,7 +234,7 @@ namespace FModel
string rewardId = hiddenRewards[0]["TemplateId"].Value<string>();
string rewardQuantity = hiddenRewards[0]["Quantity"].Value<string>();
BundleInfoEntry currentData = new BundleInfoEntry(questDescription, questCount, rewardId, rewardQuantity);
BundleInfoEntry currentData = new BundleInfoEntry(questDescription, questCount, rewardId, rewardQuantity, unlockType);
bool isAlreadyAdded = BundleData.Any(item => item.questDescr.Equals(currentData.questDescr, StringComparison.InvariantCultureIgnoreCase) && item.questCount == currentData.questCount);
if (!isAlreadyAdded) { BundleData.Add(currentData); }
}
@ -240,7 +248,7 @@ namespace FModel
if (qAssetType == "Quest")
{
getQuestData(qAssetName);
getQuestData(qAssetName, questInfo);
}
}
}
@ -254,13 +262,13 @@ namespace FModel
weightToUse = weight;
}
BundleInfoEntry currentData = new BundleInfoEntry(questDescription, questCount, assetTypeToken["ItemPrimaryAssetId"]["PrimaryAssetName"].Value<string>(), weightToUse == null ? "01" : weightToUse.Value<string>());
BundleInfoEntry currentData = new BundleInfoEntry(questDescription, questCount, assetTypeToken["ItemPrimaryAssetId"]["PrimaryAssetName"].Value<string>(), weightToUse == null ? "01" : weightToUse.Value<string>(), unlockType);
bool isAlreadyAdded = BundleData.Any(item => item.questDescr.Equals(currentData.questDescr, StringComparison.InvariantCultureIgnoreCase) && item.questCount == currentData.questCount);
if (!isAlreadyAdded) { BundleData.Add(currentData); }
}
else
{
BundleInfoEntry currentData = new BundleInfoEntry(questDescription, questCount, "", "");
BundleInfoEntry currentData = new BundleInfoEntry(questDescription, questCount, "", "", unlockType);
bool isAlreadyAdded = BundleData.Any(item => item.questDescr.Equals(currentData.questDescr, StringComparison.InvariantCultureIgnoreCase) && item.questCount == currentData.questCount);
if (!isAlreadyAdded) { BundleData.Add(currentData); }
}

View File

@ -4,17 +4,19 @@ namespace FModel
{
public struct BundleInfoEntry : IEquatable<BundleInfoEntry>
{
internal BundleInfoEntry(string QuestDescription, long QuestCount, string RewardId, string RewardQuantity)
internal BundleInfoEntry(string QuestDescription, long QuestCount, string RewardId, string RewardQuantity, string UnlockType)
{
questDescr = QuestDescription;
questCount = QuestCount;
rewardItemId = RewardId;
rewardItemQuantity = RewardQuantity;
questUnlockType = UnlockType;
}
public string questDescr { get; set; }
public long questCount { get; set; }
public string rewardItemId { get; set; }
public string rewardItemQuantity { get; set; }
public string questUnlockType { get; set; }
bool IEquatable<BundleInfoEntry>.Equals(BundleInfoEntry other)
{

View File

@ -70,7 +70,7 @@ namespace FModel
ItemIcon.SearchAthIteDefIcon(AssetArray[0]);
drawIcon(item);
drawIcon();
}
}
catch (JsonSerializationException)
@ -117,7 +117,7 @@ namespace FModel
{
string textureFile = Path.GetFileName(assetPathName.Value<string>()).Substring(0, Path.GetFileName(assetPathName.Value<string>()).LastIndexOf('.'));
ItemIcon.ItemIconPath = JohnWick.AssetToTexture2D(textureFile);
drawIcon(bannerName);
drawIcon();
}
}
else if (smallImage != null)
@ -127,7 +127,7 @@ namespace FModel
{
string textureFile = Path.GetFileName(assetPathName.Value<string>()).Substring(0, Path.GetFileName(assetPathName.Value<string>()).LastIndexOf('.'));
ItemIcon.ItemIconPath = JohnWick.AssetToTexture2D(textureFile);
drawIcon(bannerName);
drawIcon();
}
}
}
@ -141,7 +141,7 @@ namespace FModel
}
}
private static void drawIcon(string itemId)
private static void drawIcon()
{
Image itemIcon = null;
if (File.Exists(ItemIcon.ItemIconPath))