Skip to content

Commit

Permalink
Merge pull request IEMod#73 from tjayharvey/master
Browse files Browse the repository at this point in the history
Initial Update to Version 5.0.2 for PoE 3.01
  • Loading branch information
tjayharvey committed Feb 27, 2016
2 parents 99b65ac + f5037a4 commit 108299a
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 309 deletions.
227 changes: 120 additions & 107 deletions IEMod/Mods/CombatLooting/mod_UIInventoryGridItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,121 +70,134 @@ public static bool ItemTransferValidNew(InventoryItem invitem, UIInventoryGridIt
[ModifiesMember("ItemTransferValid")]
public static bool ItemTransferValidNew(InventoryItem invitem, UIInventoryGridItem from, UIInventoryGridItem to,
out string error, bool alreadyHeld = false) {
UIInventoryItemZone owner;
error = string.Empty;
if (invitem == null || invitem.baseItem == null) {
return true;
}
if (from == to && UIGlobalInventory.Instance.DragOwnerIsSame()) {
return true;
}
InventoryItem inventoryItem = invitem;
UIInventoryGridItem uIInventoryGridItem = from;
if (!to) {
owner = null;
} else {
owner = to.Owner;
}
if (!UIInventoryGridItem.ItemTransferValid(inventoryItem, uIInventoryGridItem, owner, out error, alreadyHeld)) {
return false;
}
if (!UIInventoryGridItem.ItemTakeValid(to, out error)) {
return false;
}
UIInventoryItemZone owner;
error = string.Empty;
if (invitem == null || invitem.baseItem == null)
{
return true;
}
if (from == to && UIGlobalInventory.Instance.DragOwnerIsSame())
{
return true;
}
InventoryItem inventoryItem = invitem;
UIInventoryGridItem uIInventoryGridItem = from;
if (!to)
{
owner = null;
}
else
{
owner = to.Owner;
}
if (!UIInventoryGridItem.ItemTransferValid(inventoryItem, uIInventoryGridItem, owner, out error, alreadyHeld))
{
return false;
}
if (!UIInventoryGridItem.ItemTakeValid(to, out error))
{
return false;
}

//!+ ADDED CODE
// this is to disallow items TO
if (IEModOptions.UnlockCombatInv && GameState.InCombat
//!+ ADDED CODE
// this is to disallow items TO
if (IEModOptions.UnlockCombatInv && GameState.InCombat
&& (to.EquipmentSlot == Equippable.EquipmentSlot.Armor || ForbiddenToMoveItems.Contains(invitem.BaseItem.Name)))
{
// doesn't allow equipping/unequipping armor during combat, as well as summoned magical items such as druid cat claws
error = GUIUtils.GetText(0xd7);
return false;
}
//!+ END ADD
//!+ END ADD

if (to && (to.Locked || to.Blocked || !to.EquipmentModifyValid())) {
return false;
}
if (to && to.EquipmentSlot != Equippable.EquipmentSlot.None) {
error = GUIUtils.GetText(217);
Equippable equippable = invitem.baseItem as Equippable;
EquipmentSoulbind component = invitem.baseItem.GetComponent<EquipmentSoulbind>();
if (!equippable) {
return false;
}
if (!equippable.CanUseSlot(to.EquipmentSlot)) {
return false;
}
if (to.WeaponSetBuddy != null && !to.WeaponSetBuddy.Empty) {
if (equippable.BothPrimaryAndSecondarySlot) {
error = GUIUtils.GetText(1737);
return false;
}
Equippable invItem = to.WeaponSetBuddy.InvItem.baseItem as Equippable;
if (invItem && invItem.BothPrimaryAndSecondarySlot) {
error = GUIUtils.GetText(1737);
return false;
}
}
Equipment selectedEquipment = UIInventoryManager.Instance.Equipment.SelectedEquipment;
if (selectedEquipment && selectedEquipment.IsSlotLocked(to.EquipmentSlot)) {
return false;
}
Equippable.CantEquipReason cantEquipReason =
equippable.WhyCantEquip(UIInventoryManager.Instance.SelectedCharacter.gameObject);
if (cantEquipReason != Equippable.CantEquipReason.None) {
CharacterStats selectedCharacter = UIInventoryManager.Instance.SelectedCharacter;
switch (cantEquipReason) {
case Equippable.CantEquipReason.EquipmentLocked: {
object[] name = new object[] {
invitem.baseItem.Name,
CharacterStats.Name(selectedCharacter)
};
error = GUIUtils.Format(1003, name);
break;
}
case Equippable.CantEquipReason.ClassMismatch: {
error = GUIUtils.Format(1003, new object[] {
invitem.baseItem.Name,
GUIUtils.GetClassString(selectedCharacter.CharacterClass, selectedCharacter.Gender)
});
break;
}
case Equippable.CantEquipReason.SoulboundToOther: {
error = GUIUtils.Format(2038, new object[] {
equippable.Name,
CharacterStats.Name(component.BoundGuid)
});
break;
}
default: {
goto case Equippable.CantEquipReason.EquipmentLocked;
}
}
return false;
}
}
if (from.EquipmentSlot != Equippable.EquipmentSlot.None) {
Equipment equipment = UIInventoryManager.Instance.Equipment.SelectedEquipment;
if (equipment && to && equipment.IsSlotLocked(to.EquipmentSlot)) {
return false;
}
}
if (to && to.EquipmentSlot == Equippable.EquipmentSlot.Grimoire
&& UIInventoryManager.Instance.SelectedCharacter.SpellCastingDisabled > 0) {
error = GUIUtils.GetText(1738);
return false;
}
if (to && to.RestrictByFilter != UIInventoryFilter.ItemFilterType.NONE
&& (invitem.baseItem.FilterType & to.RestrictByFilter) == UIInventoryFilter.ItemFilterType.NONE) {
if (to.OrAllowEquipment == Equippable.EquipmentSlot.None || !(invitem.baseItem is Equippable)
|| !(invitem.baseItem as Equippable).CanUseSlot(to.OrAllowEquipment)) {
return false;
}
}
return true;
}
if (to && (to.Locked || to.Blocked || !to.EquipmentModifyValid()))
{
return false;
}
if (to && to.EquipmentSlot != Equippable.EquipmentSlot.None)
{
error = GUIUtils.GetText(217);
Equippable equippable = invitem.baseItem as Equippable;
EquipmentSoulbind component = invitem.baseItem.GetComponent<EquipmentSoulbind>();
if (!equippable)
{
return false;
}
if (!equippable.CanUseSlot(to.EquipmentSlot))
{
return false;
}
if (to.WeaponSetBuddy != null && !to.WeaponSetBuddy.Empty)
{
if (equippable.BothPrimaryAndSecondarySlot)
{
error = GUIUtils.GetText(1737);
return false;
}
Equippable invItem = to.WeaponSetBuddy.InvItem.baseItem as Equippable;
if (invItem && invItem.BothPrimaryAndSecondarySlot)
{
error = GUIUtils.GetText(1737);
return false;
}
}
Equipment selectedEquipment = UIInventoryManager.Instance.Equipment.SelectedEquipment;
if (selectedEquipment && selectedEquipment.IsSlotLocked(to.EquipmentSlot))
{
return false;
}
Equippable.CantEquipReason cantEquipReason = equippable.WhyCantEquip(UIInventoryManager.Instance.SelectedCharacter.gameObject);
if (cantEquipReason != Equippable.CantEquipReason.None)
{
CharacterStats selectedCharacter = UIInventoryManager.Instance.SelectedCharacter;
switch (cantEquipReason)
{
case Equippable.CantEquipReason.EquipmentLocked:
{
object[] name = new object[] { invitem.baseItem.Name, CharacterStats.Name(selectedCharacter) };
error = GUIUtils.Format(1003, name);
break;
}
case Equippable.CantEquipReason.ClassMismatch:
{
error = GUIUtils.Format(1003, new object[] { invitem.baseItem.Name, GUIUtils.GetClassString(selectedCharacter.CharacterClass, selectedCharacter.Gender) });
break;
}
case Equippable.CantEquipReason.SoulboundToOther:
{
error = GUIUtils.Format(2038, new object[] { equippable.Name, CharacterStats.Name(component.BoundGuid) });
break;
}
default:
{
goto case Equippable.CantEquipReason.EquipmentLocked;
}
}
return false;
}
}
if (from.EquipmentSlot != Equippable.EquipmentSlot.None)
{
Equipment equipment = UIInventoryManager.Instance.Equipment.SelectedEquipment;
if (equipment && to && equipment.IsSlotLocked(to.EquipmentSlot))
{
return false;
}
}
if (to && to.EquipmentSlot == Equippable.EquipmentSlot.Grimoire && UIInventoryManager.Instance.SelectedCharacter.EffectDisablesSpellcasting)
{
error = GUIUtils.GetText(1738);
return false;
}
if (to && to.RestrictByFilter != UIInventoryFilter.ItemFilterType.NONE && (invitem.baseItem.FilterType & to.RestrictByFilter) == UIInventoryFilter.ItemFilterType.NONE)
{
if (to.OrAllowEquipment == Equippable.EquipmentSlot.None || !(invitem.baseItem is Equippable) || !(invitem.baseItem as Equippable).CanUseSlot(to.OrAllowEquipment))
{
return false;
}
}
return true;
}
}

}
7 changes: 3 additions & 4 deletions IEMod/Mods/FastSneak/mod_PartyMemberAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public void UpdateNew()
}
if (this.m_instructions != null)
{
foreach (SpellCastData mInstruction in this.m_instructions)
for (int i = 0; i < this.m_instructions.Count; i++)
{
mInstruction.Update();
this.m_instructions[i].Update();
}
}
if (GameState.s_playerCharacter != null && base.gameObject == GameState.s_playerCharacter.gameObject && PartyMemberAI.DebugParty)
Expand Down Expand Up @@ -78,7 +78,6 @@ public void UpdateNew()
{
this.m_ai.Update();
}
base.DrawDebugText();
return;
}
if (this.m_ai == null)
Expand All @@ -93,7 +92,7 @@ public void UpdateNew()
{
AIState currentState = this.m_ai.CurrentState;
Consumable component = this.QueuedAbility.GetComponent<Consumable>();
if (!(component != null) || !component.IsIngestibleOrPotion)
if (!(component != null) || !component.IsFoodDrugOrPotion)
{
Attack attack = currentState as Attack;
TargetedAttack targetedAttack = currentState as TargetedAttack;
Expand Down
110 changes: 54 additions & 56 deletions IEMod/Mods/NoEngagement/Mod_NoEngagement_AIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,67 +11,65 @@ public abstract class Mod_NoEngagement_AIController : AIController
{
[ModifiesMember("EngageEnemy")]
public void EngageEnemyNew(GameObject enemy)
{
AIController component = enemy.GetComponent<AIController>();
if (!component || component == this)
{
return;
}
if (!this.EngagedEnemies.Contains(enemy))
{
this.EngagedEnemies.Add(enemy);
}
GameObject owner = this.StateManager.CurrentState.Owner;
CharacterStats component2 = owner.GetComponent<CharacterStats>();
if (component2 != null)
{
component2.NotifyEngagement(enemy);
}
GameEventArgs gameEventArgs = new GameEventArgs();
gameEventArgs.Type = GameEventType.MeleeEngaged;
gameEventArgs.GameObjectData = new GameObject[1];
gameEventArgs.GameObjectData[0] = owner;
component.OnEvent(gameEventArgs);
if (FogOfWar.Instance.PointVisible(owner.transform.position) && (!IEModOptions.DisableEngagement)) // added && ((Mod_GameOptions_GameMode)GameState.Mode).DisableEngagement == 0
{
Console.AddMessage(Console.Format(GUIUtils.GetTextWithLinks(100), new object[]
{
CharacterStats.NameColored(owner),
CharacterStats.NameColored(enemy)
}));
}
GameState.AutoPause(AutoPauseOptions.PauseEvent.CharacterAttacked, enemy, owner, null);
component.AddEngagedBy(owner);
{
AIController component = enemy.GetComponent<AIController>();
if (!component || component == this)
{
return;
}
if (!this.EngagedEnemies.Contains(enemy))
{
this.EngagedEnemies.Add(enemy);
}
GameObject owner = this.StateManager.CurrentState.Owner;
CharacterStats characterStat = owner.GetComponent<CharacterStats>();
if (characterStat != null)
{
characterStat.NotifyEngagement(enemy);
}
GameEventArgs gameEventArg = new GameEventArgs()
{
Type = GameEventType.MeleeEngaged,
GameObjectData = new GameObject[] { owner }
};
component.OnEvent(gameEventArg);
if (FogOfWar.Instance.PointVisible(owner.transform.position) && (!IEModOptions.DisableEngagement)) // added && ((Mod_GameOptions_GameMode)GameState.Mode).DisableEngagement == 0
{
Console.AddMessage(Console.Format(GUIUtils.GetTextWithLinks(100), new object[] { CharacterStats.NameColored(owner), CharacterStats.NameColored(enemy) }));
}
component.AddEngagedBy(owner);

}

[ModifiesMember("DisengageEnemy")]
public void DisengageEnemyNew(GameObject enemy, AttackBase attack)
{
CharacterStats component = enemy.GetComponent<CharacterStats>();
if ((component != null) && !component.IsImmuneToEngagement && !IEModOptions.DisableEngagement) // added && (Mod_GameOptions_GameMode)GameState.Mode).DisableEngagement == 0
{
attack.IsDisengagementAttack = true;
attack.Launch(enemy, -1);
}
GameObject owner = this.StateManager.CurrentState.Owner;
this.m_disengagementTrackers.Add(new DisengagementTracker(enemy, false));
this.StopEnagagement(enemy);
if (this.m_stats != null)
{
this.m_stats.NotifyEngagementBreak(enemy);
}
this.EnemyBreaksEngagement(enemy);
AIController controller = enemy.GetComponent<AIController>();
if (controller != null)
{
GameEventArgs args = new GameEventArgs
{
Type = GameEventType.MeleeEngageBroken,
GameObjectData = new GameObject[] { owner }
};
controller.OnEvent(args);
controller.EnemyBreaksEngagement(owner);
}
CharacterStats component = enemy.GetComponent<CharacterStats>();
if ((component != null) && !component.IsImmuneToEngagement && !IEModOptions.DisableEngagement) // added && (Mod_GameOptions_GameMode)GameState.Mode).DisableEngagement == 0
{
attack.IsDisengagementAttack = true;
attack.Launch(enemy, -1);
UIHealthstringManager.Instance.ShowNotice(GUIUtils.GetText(2150), enemy, 2.5f);
}
GameObject owner = this.StateManager.CurrentState.Owner;
this.m_disengagementTrackers.Add(new AIController.DisengagementTracker(enemy, false));
this.StopEngagement(enemy);
if (this.m_stats != null)
{
this.m_stats.NotifyEngagementBreak(enemy);
}
this.EnemyBreaksEngagement(enemy);
AIController aIController = enemy.GetComponent<AIController>();
if (aIController)
{
GameEventArgs gameEventArg = new GameEventArgs()
{
Type = GameEventType.MeleeEngageBroken,
GameObjectData = new GameObject[] { owner }
};
aIController.OnEvent(gameEventArg);
aIController.EnemyBreaksEngagement(owner);
}
}
}

Expand Down
Loading

0 comments on commit 108299a

Please sign in to comment.