public virtual int GetValue(ActorAttributeType type) { switch (type) { case ActorAttributeType.Hp: return(Hp); case ActorAttributeType.MaxHp: return(MaxHp); case ActorAttributeType.HpRecover: return(HpRecover); case ActorAttributeType.Mp: return(Mp); case ActorAttributeType.MaxMp: return(MaxMp); case ActorAttributeType.MpRecover: return(MpRecover); case ActorAttributeType.Attack: return(Attack); case ActorAttributeType.Defense: return(Defense); case ActorAttributeType.Speed: return(Speed); case ActorAttributeType.Crit: return(Crit); case ActorAttributeType.CritDamage: return(CritDamage); case ActorAttributeType.SuckBlood: return(SuckBlood); case ActorAttributeType.Dodge: return(Dodge); case ActorAttributeType.Hit: return(Hit); case ActorAttributeType.Absorb: return(Absorb); case ActorAttributeType.Reflex: return(Reflex); default: Log.Error($"Can no find {type} in this attribute."); return(0); } }
private int FetchCurveValue(AnimationCurve curve, int actorLevel, ActorAttributeType attr) { var level = FetchAttributeData(ActorAttributeType.Level); float normalizedValue = Mathf.InverseLerp(level.start, level.end, actorLevel); float targetCurveValue = curve.Evaluate(normalizedValue); var attrData = FetchAttributeData(attr); return(attrData.FetchAtCurvePoint(targetCurveValue)); }
/// <summary> /// Fetch the amount a given attribute will have in a given level /// </summary> /// <param name="actorId">The actor ID</param> /// <param name="actorLevel">What level the character is</param> /// <param name="attr">The attribute</param> /// <returns></returns> public int FetchAmount(int actorId, int actorLevel, ActorAttributeType attr) { int amount = 0; var actorData = FetchEntry <ActorDataList>().entries.First(l => l.Id == actorId); var classData = FetchEntry <ActorClassDataList>().entries.First(l => l.Id == actorData.classId); amount = FetchCurveValue(classData.FetchCurve(attr), actorLevel, attr); return(amount); }
private static double GetAttribute(DiaObject o, ActorAttributeType aType) { try { return(o.CommonData.GetAttribute <double>(aType)); } catch { return((double)(-1)); } }
private static T GetAttribute <T>(DiaObject o, ActorAttributeType a) where T : struct { try { return(o.CommonData.GetAttribute <T>(a)); } catch (Exception ex) { throw ex; } }
private static double GetAttribute(DiaObject o, ActorAttributeType aType) { try { return o.CommonData.GetAttribute<double>(aType); } catch { return (double)(-1); } }
/// <summary> /// Get an attribute, exceptions get swallowed and default returned /// </summary> /// <typeparam name="T"></typeparam> /// <param name="actorACD">The actor acd.</param> /// <param name="type">The type.</param> /// <returns>T.</returns> public static T GetAttributeOrDefault <T>(this ACD actorACD, ActorAttributeType type) where T : struct { try { actorACD.GetAttribute <T>(type); } catch (Exception ex) { Logger.LogDebug(LogCategory.CacheManagement, "Exception on {0} accessing {1} attribute: {2}", actorACD.Name, type, ex); } return(default(T)); }
/// <summary> /// Get an attribute, exceptions get swallowed and default returned /// </summary> /// <typeparam name="T"></typeparam> /// <param name="actor">The actor.</param> /// <param name="type">The type.</param> /// <returns>T.</returns> public static T GetAttributeOrDefault <T>(this TrinityCacheObject actor, ActorAttributeType type) where T : struct { try { actor.CommonData.GetAttribute <T>(type); } catch (Exception ex) { Logger.LogDebug(LogCategory.CacheManagement, "Exception on {0} accessing {1} attribute: {2}", actor.InternalName, type, ex); } return(default(T)); }
private static double GetAttribute(double iType, DiaObject o, ActorAttributeType aType) { try { iType = (double)o.CommonData.GetAttribute <ActorAttributeType>(aType); } catch { iType = -1; } return(iType); }
private static double GetAttribute(double iType, DiaObject o, ActorAttributeType aType) { try { iType = (double)o.CommonData.GetAttribute<ActorAttributeType>(aType); } catch { iType = -1; } return iType; }
private static int GetAttribute(int iType, DiaObject o, ActorAttributeType aType) { try { iType = (int)o.CommonData.GetAttribute <ActorAttributeType>(aType); } catch { iType = -1; } return(iType); }
public void SetAttribute(ActorAttributeType attributeType, float value) { switch (attributeType) { case ActorAttributeType.MoveSpeed: m_moveSpeed = value; break; case ActorAttributeType.AttackSpeed: m_attackSpeed = value; break; case ActorAttributeType.RotationSpeed: m_rotationSpeed = value; break; case ActorAttributeType.Range: m_range = value; break; case ActorAttributeType.Attack: m_attack = value; break; case ActorAttributeType.MagicAttack: m_magicAttack = value; break; case ActorAttributeType.Defense: m_defense = value; break; case ActorAttributeType.MagicDefense: m_magicDefense = value; break; case ActorAttributeType.Hp: m_hp = value; break; case ActorAttributeType.HpMax: m_hpMax = value; break; } }
public AnimationCurve FetchCurve(ActorAttributeType type) { if (type == ActorAttributeType.HP) { return(hpCurve); } else if (type == ActorAttributeType.MP) { return(mpCurve); } else if (type == ActorAttributeType.Strength) { return(strCurve); } else if (type == ActorAttributeType.Intelligence) { return(intCurve); } else if (type == ActorAttributeType.Dextery) { return(dexCurve); } else if (type == ActorAttributeType.Agility) { return(agiCurve); } else if (type == ActorAttributeType.Luck) { return(lckCurve); } else if (type == ActorAttributeType.Defense) { return(defCurve); } else if (type == ActorAttributeType.Resistance) { return(resCurve); } return(expCurve); }
public AnimationCurve FetchCurve(ActorAttributeType type) { switch (type) { case ActorAttributeType.Vitality: return(vitCurve); case ActorAttributeType.Power: return(pwrCurve); case ActorAttributeType.Speed: return(spdCurve); case ActorAttributeType.Defence: return(defCurve); default: return(resCurve); } }
public float GetAttribute(ActorAttributeType attributeType) { switch (attributeType) { case ActorAttributeType.MoveSpeed: return(m_moveSpeed); case ActorAttributeType.AttackSpeed: return(m_attackSpeed); case ActorAttributeType.RotationSpeed: return(m_rotationSpeed); case ActorAttributeType.Range: return(m_range); case ActorAttributeType.Attack: return(m_attack); case ActorAttributeType.MagicAttack: return(m_magicAttack); case ActorAttributeType.Defense: return(m_defense); case ActorAttributeType.MagicDefense: return(m_magicDefense); case ActorAttributeType.Hp: return(m_hp); case ActorAttributeType.HpMax: return(m_hpMax); default: return(0); } }
private AttributeSpecData FetchAttributeData(ActorAttributeType type) { var list = FetchEntry <AttributeSpecDataList>(); if (type == ActorAttributeType.Level) { return(list.entries.First(x => x.name == Constants.Attributes.LEVEL)); } else if (type == ActorAttributeType.EXP) { return(list.entries.First(x => x.name == Constants.Attributes.EXP)); } else if (type == ActorAttributeType.HP) { return(list.entries.First(x => x.name == Constants.Attributes.HP)); } else if (type == ActorAttributeType.MP) { return(list.entries.First(x => x.name == Constants.Attributes.MP)); } //Else return(list.entries.First(x => x.name == Constants.Attributes.COMMON)); }
public virtual void UpdateValue(ActorAttributeType type, int value) { switch (type) { case ActorAttributeType.Hp: Hp = value; break; case ActorAttributeType.MaxHp: MaxHp = value; break; case ActorAttributeType.HpRecover: HpRecover = value; break; case ActorAttributeType.Mp: Mp = value; break; case ActorAttributeType.MaxMp: MaxMp = value; break; case ActorAttributeType.MpRecover: MpRecover = value; break; case ActorAttributeType.Attack: Attack = value; break; case ActorAttributeType.Defense: Defense = value; break; case ActorAttributeType.Speed: Speed = value; break; case ActorAttributeType.Crit: Crit = value; break; case ActorAttributeType.CritDamage: CritDamage = value; break; case ActorAttributeType.SuckBlood: SuckBlood = value; break; case ActorAttributeType.Dodge: Dodge = value; break; case ActorAttributeType.Hit: Hit = value; break; case ActorAttributeType.Absorb: Absorb = value; break; case ActorAttributeType.Reflex: Reflex = value; break; default: Log.Error($"Can no find {type} in this attribute."); return; } }
private static CooldownData UpdateCooldownData(int snoId, int storageKey, int startTime, ActorAttributeType startAttr, int endTime, ActorAttributeType endAttr) { // Attribute time returned (game time) is not the same as ZetaDia.Globals.GameTick and the difference between the two vary over time. // When the buff starts a comparison to CurrentTime is recorded. This can then be used to work out know how much time has elapsed. // Offset will count down until it reaches EndOffset, then it has ended. Action <CooldownData> updateBuffDataObject = d => { d.SnoId = snoId; d.StartGameTime = startTime; d.StartAttribute = startAttr; d.EndGameTime = endTime; d.EndAttribute = endAttr; d.StorageKey = storageKey; d.DurationGameTime = endTime - startTime; d.EndCurrentTime = ZetaDia.Globals.GameTick + d.DurationGameTime; d.EndOffset = (startTime - ZetaDia.Globals.GameTick) - d.DurationGameTime; }; CooldownGroup group; CooldownData data; if (!CooldownStore.ContainsKey(snoId)) { group = new CooldownGroup(); CooldownStore.Add(snoId, group); } else { group = CooldownStore[snoId]; } var cooldowns = group.Cooldowns; if (!cooldowns.ContainsKey(storageKey)) { data = new CooldownData(); updateBuffDataObject(data); cooldowns.Add(storageKey, data); } else { data = cooldowns[storageKey]; if (data.StartGameTime != startTime) { updateBuffDataObject(data); } } data.Offset = startTime - ZetaDia.Globals.GameTick; //data.IsFinished = data.Offset <= data.EndOffset; return(data); }
public static T IsPlayerWithAttrihbute <T>(IPartyMember specificPlayer, ActorAttributeType attribute, int argument) where T : struct { var player = FindLocalPlayer(specificPlayer); return(player?.Attributes.GetAttribute <T>(ActorAttributeType.Skill, argument) ?? default(T)); }
private static int GetAttribute(int iType, DiaObject o, ActorAttributeType aType) { try { iType = (int)o.CommonData.GetAttribute<ActorAttributeType>(aType); } catch { iType = -1; } return iType; }