Upload from upload_mods.ps1
This commit is contained in:
77
Harmony/Harmony_XUiM_Quest.cs
Normal file
77
Harmony/Harmony_XUiM_Quest.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
namespace Harmony.XUiM_QuestPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(XUiM_Quest))]
|
||||
[HarmonyPatch("GetQuestRewards")]
|
||||
public class GetQuestRewardsPatch
|
||||
{
|
||||
public static bool Prefix(XUiM_Quest __instance, ref string __result, Quest quest, EntityPlayer player, bool isChosen, string rewardItemFormat, string rewardItemBonusFormat, string rewardNumberFormat, string rewardNumberBonusFormat)
|
||||
{
|
||||
string questRewards = "";
|
||||
if (quest != null)
|
||||
{
|
||||
int num1 = isChosen ? (int)EffectManager.GetValue(PassiveEffects.QuestRewardOptionCount, _originalValue: 1f, _entity: (EntityAlive)player) + 1 : -1;
|
||||
for (int index = 0; index < quest.Rewards.Count; ++index)
|
||||
{
|
||||
if (quest.Rewards[index].isChosenReward == isChosen)
|
||||
{
|
||||
if (!isChosen || num1-- > 0)
|
||||
{
|
||||
if (quest.Rewards[index] is RewardItem)
|
||||
{
|
||||
//Log.Out("XUiM_QuestPatches-GetQuestRewards RewardItem");
|
||||
RewardItem reward = quest.Rewards[index] as RewardItem;
|
||||
int count = reward.Item.count;
|
||||
int num2 = Mathf.FloorToInt(EffectManager.GetValue(PassiveEffects.QuestBonusItemReward, _originalValue: (float)reward.Item.count, _entity: (EntityAlive)player));
|
||||
if (count == num2)
|
||||
{
|
||||
//Log.Out("XUiM_QuestPatches-GetQuestRewards RewardItem 1");
|
||||
questRewards = questRewards + string.Format(rewardItemFormat, (object)num2, (object)reward.Item.itemValue.ItemClass.GetLocalizedItemName()) + ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("XUiM_QuestPatches-GetQuestRewards RewardItem 1");
|
||||
if (RebirthVariables.customInfested == "hidesurprise"
|
||||
)
|
||||
{
|
||||
questRewards = questRewards + reward.Item.itemValue.ItemClass.GetLocalizedItemName() + " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
questRewards = questRewards + string.Format(rewardItemBonusFormat, (object)num2, (object)reward.Item.itemValue.ItemClass.GetLocalizedItemName(), (object)(num2 - count), (object)Localization.Get("bonus")) + ", ";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (quest.Rewards[index] is RewardLootItem)
|
||||
{
|
||||
//Log.Out("XUiM_QuestPatches-GetQuestRewards RewardLootItem");
|
||||
RewardLootItem reward = quest.Rewards[index] as RewardLootItem;
|
||||
int count = reward.Item.count;
|
||||
|
||||
questRewards = questRewards + "test :" + string.Format(rewardItemFormat, (object)reward.Item.count, (object)reward.Item.itemValue.ItemClass.GetLocalizedItemName()) + ", ";
|
||||
}
|
||||
else if (quest.Rewards[index] is RewardExp)
|
||||
{
|
||||
//Log.Out("XUiM_QuestPatches-GetQuestRewards RewardExp");
|
||||
int num3 = 0 + Mathf.FloorToInt(EffectManager.GetValue(PassiveEffects.PlayerExpGain, _originalValue: (float)(Convert.ToInt32((quest.Rewards[index] as RewardExp).Value) * GameStats.GetInt(EnumGameStats.XPMultiplier) / 100), _entity: (EntityAlive)player, tags: XUiM_Quest.QuestTag));
|
||||
questRewards = questRewards + string.Format(rewardNumberFormat, (object)num3, (object)Localization.Get("RewardXP_keyword")) + ", ";
|
||||
}
|
||||
else if (quest.Rewards[index] is RewardSkillPoints)
|
||||
{
|
||||
//Log.Out("XUiM_QuestPatches-GetQuestRewards RewardSkillPoints");
|
||||
int int32 = Convert.ToInt32((quest.Rewards[index] as RewardSkillPoints).Value);
|
||||
questRewards = questRewards + string.Format(rewardNumberFormat, (object)int32, (object)Localization.Get("RewardSkillPoints_keyword")) + ", ";
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (questRewards != "")
|
||||
questRewards = questRewards.Remove(questRewards.Length - 2);
|
||||
}
|
||||
__result = questRewards;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user