|
|
@@ -4,6 +4,7 @@ using UnityEngine;
|
|
|
using System.Collections;
|
|
|
using System.Reflection;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Globalization;
|
|
|
|
|
|
namespace RecipeMenuCore.Patches
|
|
|
{
|
|
|
@@ -13,11 +14,19 @@ namespace RecipeMenuCore.Patches
|
|
|
public static class Patch_GameScript_HoverRecipeSelect
|
|
|
{
|
|
|
[HarmonyPrefix]
|
|
|
- public static bool Prefix(GameScript __instance, int id, int ___craftType, ref int ___curRecipePage, GameObject ___itemexpbar, Item[] ___storage, GameObject[] ___aspectObj, TextMesh ___itemName,
|
|
|
+ public static bool Prefix(GameScript __instance, int id, int ___craftType, ref int ___curRecipePage, GameObject ___itemexpbar, GameObject[] ___aspectObj, TextMesh ___itemName,
|
|
|
GameObject ___hoverItem, TextMesh[] ___itemStat, GameObject ___txtStats, TextMesh ___itemDesc, Material ___hoverItemMat2, Material ___hoverItemMat1, GameObject ___hoverDroid,
|
|
|
- TextMesh[] ___txtHoverStat, TextMesh ___txtHoverStatInfo, TextMesh[] ___itemAspect, TextMesh ___itemLevel)
|
|
|
+ TextMesh[] ___txtHoverStat, TextMesh ___txtHoverStatInfo, TextMesh[] ___itemAspect, TextMesh ___itemLevel, GameObject[] ___recipeLock)
|
|
|
{
|
|
|
- var item = new Item(GetItemId(id, ___craftType, ___curRecipePage), 1, 0, 0, 0, new int[3], new int[3]);
|
|
|
+ if (!Core.settingUseDialog)
|
|
|
+ return true;
|
|
|
+
|
|
|
+ if(___craftType == 0 || ___craftType == 1)
|
|
|
+ {
|
|
|
+ if (id >= 12 || ___recipeLock[id].active)
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ var item = new Item(GetItemId(__instance, id, ___craftType, ___curRecipePage), 1, 0, 0, 0, new int[3], new int[3]);
|
|
|
var itemInfo = ItemRegistry.GetItem(item.id);
|
|
|
|
|
|
___txtHoverStat[0].text = string.Empty;
|
|
|
@@ -43,7 +52,7 @@ namespace RecipeMenuCore.Patches
|
|
|
{
|
|
|
___itemName.text = itemInfo.Name;
|
|
|
___itemName.color = Color.white;
|
|
|
- ___itemDesc.text = itemInfo.Desc;
|
|
|
+ ___itemDesc.text = GenerateDescription(itemInfo);
|
|
|
|
|
|
bool hasStats = false;
|
|
|
int[] gearBaseStats = ItemRegistry.GetItem(item.id).Stats.GetStatArray();
|
|
|
@@ -76,21 +85,75 @@ namespace RecipeMenuCore.Patches
|
|
|
mainTexture = GadgetCoreAPI.LoadTexture2D("hoverItem.png")
|
|
|
};
|
|
|
|
|
|
- private static int GetItemId(int index, int craftType, int curRecipePage)
|
|
|
+ private static string GenerateDescription(ItemInfo item)
|
|
|
{
|
|
|
- if (craftType == 0 && curRecipePage >= 6)
|
|
|
+ if ((item.GetID() >= 1000 && item.GetID() < 1000 + 6 )
|
|
|
+ || (item.GetID() >= 1012 && item.GetID() < 1012 + 3 * 6))
|
|
|
+ return "";
|
|
|
+ var desc = item.Desc;
|
|
|
+ if (desc == null || desc.Length <= 0)
|
|
|
{
|
|
|
- return Core.pageGearForgeInfoList[curRecipePage - 6].GetRecipePageEntries()[index].ItemIdBase;
|
|
|
+ float[] ws = item.WeaponScaling;
|
|
|
+ if (ws != null)
|
|
|
+ {
|
|
|
+ string o = "";
|
|
|
+ for (int i = 0; i < ws.Length; i++)
|
|
|
+ {
|
|
|
+ if (ws[i] > 0)
|
|
|
+ {
|
|
|
+ string type = i == 0 ? "VIT" : i == 1 ? "STR" : i == 2 ? "DEX" : i == 3 ? "TEC" : i == 4 ? "MAG" : "FTH";
|
|
|
+ o += "DMG x" + (ws[i] >= 1 ? ws[i].ToString(CultureInfo.InvariantCulture) : "1/" + (1 / ws[i])).ToString(CultureInfo.InvariantCulture) + " " + type + "\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return o;
|
|
|
+ }
|
|
|
}
|
|
|
- else if (craftType == 1 && curRecipePage >= 2)
|
|
|
+ return desc;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static int GetItemId(GameScript __instance, int index, int craftType, int curRecipePage)
|
|
|
+ {
|
|
|
+ if (index >= 12)
|
|
|
{
|
|
|
- return Core.pageAlchemyStationInfoList[curRecipePage - 2].GetRecipePageEntries()[index].ItemIdBase;
|
|
|
+ if (craftType == 2 && curRecipePage >= 6)
|
|
|
+ return Core.pageUltimateForgeInfoList[curRecipePage - 6].GetRecipePageEntries()[(index - 12) / 3].ItemIdExtension[(index - 12) % 3];
|
|
|
+ return CalculateUltimaleWeapon((index - 12) % (3 * 6), (index - 12) / (3 * 6) + curRecipePage * 2);
|
|
|
}
|
|
|
+ if (craftType == 0 && curRecipePage >= 6)
|
|
|
+ return Core.pageGearForgeInfoList[curRecipePage - 6].GetRecipePageEntries()[index].ItemIdBase;
|
|
|
+ else if (craftType == 1 && curRecipePage >= 2)
|
|
|
+ return Core.pageAlchemyStationInfoList[curRecipePage - 2].GetRecipePageEntries()[index].ItemIdBase;
|
|
|
else if (craftType == 2 && curRecipePage >= 6)
|
|
|
- {
|
|
|
return Core.pageUltimateForgeInfoList[curRecipePage - 6].GetRecipePageEntries()[index].ItemIdBase;
|
|
|
- }
|
|
|
- return 1;
|
|
|
+ return __instance.GetRecipeItem(curRecipePage, index).id;
|
|
|
+ }
|
|
|
+ private static int CalculateUltimaleWeapon(int index, int page)
|
|
|
+ {
|
|
|
+ if (page == 0)
|
|
|
+ return 312 + index;
|
|
|
+ if (page == 1)
|
|
|
+ return 362 + index;
|
|
|
+ if (page == 2)
|
|
|
+ return 412 + index;
|
|
|
+ if (page == 3)
|
|
|
+ return 462 + index;
|
|
|
+ if (page == 4)
|
|
|
+ return 512 + index;
|
|
|
+ if (page == 5)
|
|
|
+ return 562 + index;
|
|
|
+ if (page == 6) //shield
|
|
|
+ return 612 + index;
|
|
|
+ if (page == 7) //droid
|
|
|
+ return 1012 + index;
|
|
|
+ if (page == 8) //helmet 1
|
|
|
+ return 750 + index;
|
|
|
+ if (page == 9) //helmet 2
|
|
|
+ return 768 + index;
|
|
|
+ if (page == 10) //armor 1
|
|
|
+ return 850 + index;
|
|
|
+ if (page == 11) //armor 2
|
|
|
+ return 868 + index;
|
|
|
+ return 0;
|
|
|
}
|
|
|
}
|
|
|
}
|