forked from IEMod/IEMod.pw
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request IEMod#76 from SiliconMage/master
Updated Code (Note, I have a more up to date version that fixes the version number issue by removing the hardcoding in the mod)
- Loading branch information
Showing
10 changed files
with
244 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
IEMod/Mods/HideAnticlassSpells/mod_UIAbilityBarButtonSet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using IEMod.Helpers; | ||
using IEMod.Mods.Options; | ||
using Patchwork.Attributes; | ||
using UnityEngine; | ||
|
||
namespace IEMod.Mods.HideAntiClassSpells | ||
{ | ||
[ModifiesType] | ||
public class mod_UIAbilityBarButtonSet : UIAbilityBarButtonSet | ||
{ | ||
[ModifiesMember(nameof(SetButtonsAnticlassSpells))] | ||
public void mod_SetButtonsAnticlassSpells(CharacterStats stats) | ||
{ | ||
this.Label = null; | ||
int num = 0; | ||
foreach (GenericAbility current in stats.Abilities) | ||
{ | ||
if (current is GenericSpell) | ||
{ | ||
CharacterStats.Class spellClass = ((GenericSpell)current).SpellClass; | ||
if (spellClass != stats.CharacterClass || !CharacterStats.IsPlayableClass(spellClass)) | ||
{ | ||
|
||
if ((stats.CharacterClass == CharacterStats.Class.Wizard || | ||
stats.CharacterClass == CharacterStats.Class.Priest || | ||
stats.CharacterClass == CharacterStats.Class.Druid || | ||
stats.CharacterClass == CharacterStats.Class.Chanter || | ||
stats.CharacterClass == CharacterStats.Class.Cipher) && IEModOptions.HideAnticlassSpells) | ||
{ | ||
|
||
} | ||
|
||
else | ||
{ | ||
this.SetButton(num, current.gameObject, UIAbilityBarButtonSet.AbilityButtonAction.CAST_SPELL_ABILITY, current.Icon); | ||
num++; | ||
} | ||
} | ||
} | ||
} | ||
this.HideButtons(num); | ||
this.m_DoRefresh = true; | ||
} | ||
|
||
[ModifiesMember(nameof(ShowOnSpellBar))] | ||
public static bool mod_ShowOnSpellBar(GenericAbility ability, CharacterStats stats, int spellLevel) | ||
{ | ||
if (ability.Passive) | ||
{ | ||
return false; | ||
} | ||
GenericSpell genericSpell = ability as GenericSpell; | ||
GenericCipherAbility genericCipherAbility = ability as GenericCipherAbility; | ||
if (!genericSpell) | ||
{ | ||
return genericCipherAbility && (spellLevel <= 0 || genericCipherAbility.SpellLevel == spellLevel); | ||
} | ||
|
||
if (genericSpell.SpellClass != stats.CharacterClass && spellLevel > 0 && genericSpell.SpellLevel == spellLevel && IEModOptions.HideAnticlassSpells) | ||
{ | ||
return true; | ||
} | ||
|
||
if (genericSpell.SpellClass != stats.CharacterClass || (spellLevel > 0 && genericSpell.SpellLevel != spellLevel)) | ||
{ | ||
return false; | ||
} | ||
if (stats.CharacterClass != CharacterStats.Class.Wizard || !genericSpell.NeedsGrimoire) | ||
{ | ||
return true; | ||
} | ||
Equipment component = stats.GetComponent<Equipment>(); | ||
if (component == null || component.CurrentItems == null || component.CurrentItems.Grimoire == null) | ||
{ | ||
return false; | ||
} | ||
Grimoire component2 = component.CurrentItems.Grimoire.GetComponent<Grimoire>(); | ||
return !(component2 == null) && component2.HasSpell(genericSpell); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters