public static double getConventionTicksLeft(A_Enums.DamageType CurrentElement, ActorCommonData acd) { acd.TakeSnapshot(); int currentIndex = Array.FindIndex(A_Collection.Presets.ConventionElements.Convention_ElementRotation, x => x == CurrentElement); if (currentIndex < 0) return 0; int AttribId_BuffEndTick = A_Collection.Presets.ConventionElements.Convention_BuffEndtickAttribIdRotation[currentIndex]; double ticksleft = getBuffCount(A_Enums.Powers.Convention_PowerSno, AttribId_BuffEndTick, acd) - A_Collection.Environment.Scene.GameTick; acd.FreeSnapshot(); return ticksleft; }
public static A_Enums.DamageType getConventionElement(ActorCommonData acd) { acd.TakeSnapshot(); int index = Array.FindIndex(A_Collection.Presets.ConventionElements.Convention_BuffcountAttribIdRotation, a => a == A_Collection.Presets.ConventionElements.Convention_BuffcountAttribIdRotation.FirstOrDefault( x => isBuff(A_Enums.Powers.Convention_PowerSno, x, acd))); if(index < 0) return DamageType.none; A_Enums.DamageType element = A_Collection.Presets.ConventionElements.Convention_ElementRotation[index]; acd.FreeSnapshot(); return element; }
public static List<ActivePower> get_PlayerActivePowers(ActorCommonData acd) { try { acd.TakeSnapshot(); var attributes = acd.EnumerateAttributes().ToList(); List<ActivePower> Buffer = new List<ActivePower>(); for (int i = 0; i < attributes.Count; i++) { uint attribId = (uint)(attributes[i].x04_Key & 0xFFF); uint modifier = (uint)(attributes[i].x04_Key >> 12); int value = attributes[i].x08_Value.Int32; Buffer.Add(new ActivePower((int)attribId, (int)modifier, value)); } acd.FreeSnapshot(); return Buffer; } catch { return new List<ActivePower>(); } }
public static int getBuffCount(int SnoPowerID, int AttribId, ActorCommonData acd) { try { acd.TakeSnapshot(); if (acd.x000_Id != -1) { return (int) acd.GetAttributeValue((AttributeId) AttribId, SnoPowerID); } acd.FreeSnapshot(); return 0; } catch { return 0; } }
public static bool isBuff(List<int> SnoPowerIDs, ActorCommonData acd) { try { acd.TakeSnapshot(); if (acd.x000_Id != -1) { var attributes = acd.EnumerateAttributes(); foreach (var attrib in attributes) { uint attribId = (uint)(attrib.x04_Key & 0xFFF); uint modifier = (uint)(attrib.x04_Key >> 12); int value = attrib.x08_Value.Int32; if (SnoPowerIDs.Contains((int)modifier) && value > 0) { acd.FreeSnapshot(); return true; } } } acd.FreeSnapshot(); return false; } catch { return false; } }
public static bool isBuff(int SnoPowerID, int AttribId, ActorCommonData acd) { try { acd.TakeSnapshot(); if (acd.x000_Id != -1) { return (int)acd.GetAttributeValue((AttributeId)AttribId, SnoPowerID) > 0; } acd.FreeSnapshot(); return false; } catch { return false; } }