/// <summary> /// Converts the item attribute to a name in the localized language /// </summary> /// <param name="itemAttribute">Item attribure to be looked up.</param> /// <param name="addVariable">Flag for whether the variable is added to the text string.</param> /// <returns>Returns localized item attribute</returns> public string GetItemAttributeFriendlyText(string itemAttribute, bool addVariable = true) { ItemAttributesData data = ItemAttributeProvider.GetAttributeData(itemAttribute); if (data == null) { this.Log.LogDebug($"Attribute unknown : {itemAttribute}"); return(string.Concat("?", itemAttribute, "?")); } string attributeTextTag = ItemAttributeProvider.GetAttributeTextTag(data); if (string.IsNullOrEmpty(attributeTextTag)) { this.Log.LogDebug($"Attribute unknown : {itemAttribute}"); return(string.Concat("?", itemAttribute, "?")); } string textFromTag = this.GetFriendlyName(attributeTextTag); if (string.IsNullOrEmpty(textFromTag)) { textFromTag = string.Concat("ATTR<", itemAttribute, "> TAG<"); textFromTag = string.Concat(textFromTag, attributeTextTag, ">"); } if (addVariable && data.Variable.Length > 0) { textFromTag = string.Concat(textFromTag, " ", data.Variable); } return(textFromTag); }
public void SetUpFromClothingData(EquippedData equippedData, ItemAttributesData itemAttributes) { spriteDataHandler.Infos = new SpriteData(); spriteDataHandler.Infos.List.Add(StaticSpriteHandler.CompleteSpriteSetup(equippedData.InHandsLeft)); spriteDataHandler.Infos.List.Add(StaticSpriteHandler.CompleteSpriteSetup(equippedData.InHandsRight)); InventoryIcon.Infos = new SpriteData(); InventoryIcon.Infos.List.Add(StaticSpriteHandler.CompleteSpriteSetup(equippedData.ItemIcon)); InventoryIcon.PushTexture(); AttributesFromCD(itemAttributes); }
/// <summary> /// Gets the effect tag string /// </summary> /// <param name="attribute">attribute string</param> /// <returns>effect tag string</returns> public string GetAttributeTextTag(string attribute) { ItemAttributesData data = GetAttributeData(attribute); if (data == null) { return(attribute); } return(GetAttributeTextTag(data)); }
/// <summary> /// Calculates the order of the attribute based on type. /// </summary> /// <param name="variable">variable to be checked</param> /// <returns>order number of the variable</returns> private int CalcOrder(Variable variable) { ItemAttributesData aa = ItemAttributeProvider.GetAttributeData(variable.Name); if (aa == null) { return(3000000); } return(CalcBaseOrder(aa.EffectType, aa.Suborder)); }
/// <summary> /// Gets the attribute group type. /// </summary> /// <param name="attributeList">array of attributes</param> /// <returns>Effect type of the attribute list</returns> public ItemAttributesEffectType AttributeGroupType(Collection <Variable> attributeList) // TODO Not used ? { Variable variable = (Variable)attributeList[0]; ItemAttributesData data = this.GetAttributeData(variable.Name); if (data == null) { return(ItemAttributesEffectType.Other); } return(data.EffectType); }
/// <summary> /// Indicates whether an effect type is part of a particular attribute group /// </summary> /// <param name="attributeList">Array of attributes</param> /// <param name="type">Effect type enumeration</param> /// <returns>true if attribute effect in group == type</returns> public bool AttributeGroupIs(Collection <Variable> attributeList, ItemAttributesEffectType type) { Variable variable = (Variable)attributeList[0]; ItemAttributesData data = this.GetAttributeData(variable.Name); if (data == null) { return(false); } return(data.EffectType == type); }
/// <summary> /// Indicates whether an effect is part of a particular attribute group /// </summary> /// <param name="attributeList">Array of attributes</param> /// <param name="effect">effect string to be tested</param> /// <returns>true if attribute effect in group == effect</returns> public bool AttributeGroupIs(Collection <Variable> attributeList, string effect) { Variable variable = (Variable)attributeList[0]; ItemAttributesData data = this.GetAttributeData(variable.Name); if (data == null) { return(false); } return(data.Effect.ToUpperInvariant().Equals(effect.ToUpperInvariant())); }
/// <summary> /// Calculates the order for an array of attributes /// </summary> /// <param name="attributes">List holding the attributes</param> /// <returns>value of the attribute</returns> private int CalcOrder(List <Variable> attributes) { // Get the first item to use as a reference. Variable v = attributes[0]; ItemAttributesData aa = ItemAttributeProvider.GetAttributeData(v.Name); // put granted skills at the end if (v.Name.Equals("itemSkillName")) { return(4000000); } if (aa == null) { return(3000000); } // This is a good first estimate. int order = this.CalcBaseOrder(aa.EffectType, aa.Suborder); // now some special cases if (aa.FullAttribute.Equals("characterBaseAttackSpeedTag")) { // put it right after the base piercing stat ItemAttributesData piercing = ItemAttributeProvider.GetAttributeData("offensivePierceRatioMin"); order = this.CalcBaseOrder(piercing.EffectType, piercing.Suborder) + 1; } else if (aa.FullAttribute.Equals("retaliationGlobalChance")) { // Put this guy at the beginning of the retaliation global group order = MakeGlobal(this.CalcBaseOrder(ItemAttributesEffectType.Retaliation, 0) - 1); } else if (aa.FullAttribute.Equals("offensiveGlobalChance")) { // put this guy at the beginning of the offensive global group order = MakeGlobal(this.CalcBaseOrder(ItemAttributesEffectType.Offense, 0) - 1); } else if (this.isArmor && aa.FullAttribute.Equals("offensivePhysicalMin")) { // put it right after the block recovery time stat ItemAttributesData blockRecovery = ItemAttributeProvider.GetAttributeData("blockRecoveryTime"); order = this.CalcBaseOrder(blockRecovery.EffectType, blockRecovery.Suborder) + 1; } // Now see if the variable is global and move it to the global group if it is if (ItemAttributeProvider.AttributeGroupHas(new Collection <Variable>(attributes), "Global")) { order = MakeGlobal(order); } return(order); }
/// <summary> /// Indicates whether an attibute has a particular variable name /// </summary> /// <param name="variable">attribute variable</param> /// <param name="variableName">string for variable name</param> /// <returns>true if the variable == variable name</returns> public bool AttributeHas(Variable variable, string variableName) { if (variable == null) { return(false); } ItemAttributesData data = this.GetAttributeData(variable.Name); if (data == null) { return(false); } return(data.Variable.ToUpperInvariant().Equals(variableName.ToUpperInvariant())); }
public void AttributesFromCD(ItemAttributesData ItemAttributes) { itemName = ItemAttributes.itemName; itemDescription = ItemAttributes.itemDescription; itemType = ItemAttributes.itemType; size = ItemAttributes.size; spriteType = ItemAttributes.spriteType; CanConnectToTank = ItemAttributes.CanConnectToTank; hitDamage = ItemAttributes.hitDamage; damageType = ItemAttributes.damageType; throwDamage = ItemAttributes.throwDamage; throwSpeed = ItemAttributes.throwSpeed; throwRange = ItemAttributes.throwRange; hitSound = ItemAttributes.hitSound; attackVerb = ItemAttributes.attackVerb; IsEVACapable = ItemAttributes.IsEVACapable; }
/// <summary> /// Gets data for an attibute string. /// </summary> /// <param name="attribute">attribute string. Internally normalized to UpperInvariant.</param> /// <returns>ItemAttributesData for the attribute</returns> public ItemAttributesData GetAttributeData(string attribute) { ItemAttributesData result = null; if (String.IsNullOrEmpty(attribute)) { return(result); } try { return(attributeDictionary[attribute.ToUpperInvariant()]); } catch (KeyNotFoundException) { return(result); } }
public void AttributesFromCD(ItemAttributesData ItemAttributes) { SyncItemName(ItemAttributes.itemName); SyncItemDescription(ItemAttributes.itemDescription); var trait = TypeToTrait(ItemAttributes.itemType); if (trait != null) { traits.Add(trait); } size = ItemAttributes.size; spriteType = ItemAttributes.spriteType; CanConnectToTank = ItemAttributes.CanConnectToTank; hitDamage = ItemAttributes.hitDamage; damageType = ItemAttributes.damageType; throwDamage = ItemAttributes.throwDamage; throwSpeed = ItemAttributes.throwSpeed; throwRange = ItemAttributes.throwRange; hitSound = ItemAttributes.hitSound; attackVerb = ItemAttributes.attackVerb; IsEVACapable = ItemAttributes.IsEVACapable; }
/// <summary> /// Gets the effect tag string /// </summary> /// <param name="data">attribute data</param> /// <returns>string containing the effect tag</returns> public string GetAttributeTextTag(ItemAttributesData data) { string result = string.Empty; if (data == null) { return(result); } if (string.IsNullOrEmpty(data.Effect)) { return(result); } switch (data.EffectType) { case ItemAttributesEffectType.ShieldEffect: return(GetShieldEffectTextTag(data.Effect)); case ItemAttributesEffectType.Character: return(GetCharacterEffectTextTag(data.Effect)); case ItemAttributesEffectType.Defense: return(GetDefenseEffectTextTag(data.Effect)); case ItemAttributesEffectType.Offense: return(GetOffensiveEffectTextTag(data.Effect)); case ItemAttributesEffectType.OffenseModifier: return(GetOffensiveModifierEffectTextTag(data.Effect)); case ItemAttributesEffectType.OffenseSlow: return(GetOffensiveSlowEffectTextTag(data.Effect)); case ItemAttributesEffectType.OffenseSlowModifier: return(GetOffensiveSlowModifierEffectTextTag(data.Effect)); case ItemAttributesEffectType.Other: return(data.Effect); case ItemAttributesEffectType.Retaliation: return(GetRetaliationEffectTextTag(data.Effect)); case ItemAttributesEffectType.RetaliationModifier: return(GetRetaliationModifierEffectTextTag(data.Effect)); case ItemAttributesEffectType.RetaliationSlow: return(GetRetaliationSlowEffectTextTag(data.Effect)); case ItemAttributesEffectType.RetaliationSlowModifier: return(GetRetaliationSlowModifierEffectTextTag(data.Effect)); case ItemAttributesEffectType.Reagent: return(data.Effect); case ItemAttributesEffectType.SkillEffect: return(GetSkillEffectTextTag(data.Effect)); default: return(data.FullAttribute); } }