public override void SetValue(EquipItem recv_data) { ulong.TryParse(recv_data.uniqId, out ulong result); base.uniqueID = result; base.tableID = (uint)recv_data.equipItemId; level = recv_data.level; exceed = recv_data.exceed; sellPrice = recv_data.price; isFavorite = (recv_data.is_locked != 0); UpdateTableData(); if (tableData == null) { Log.Error(LOG.RESOURCE, "table = null"); } else { exceedParam = tableData.GetExceedParam((uint)recv_data.exceed); if (exceedParam == null) { exceedParam = new EquipItemExceedParamTable.EquipItemExceedParamAll(); } int cnt = 0; int num = 0; if (exceedParam != null && exceedParam.ability.Length > 0) { num += exceedParam.ability.Length; } ability = new EquipItemAbility[recv_data.ability.Count + GetFixedAbilityCount() + num]; for (int i = 0; i < tableData.fixedAbility.Length; i++) { if (!tableData.fixedAbility[i].vr) { ability[++cnt] = new EquipItemAbility((uint)tableData.fixedAbility[i].id, tableData.fixedAbility[i].pt); } } recv_data.ability.ForEach(delegate(EquipItem.Ability a) { ability[++cnt] = new EquipItemAbility((uint)a.id, a.pt); }); if (num > 0) { for (int j = 0; j < num; j++) { ability[++cnt] = new EquipItemAbility((uint)exceedParam.ability[j].id, exceedParam.ability[j].pt); } } abilityItem = recv_data.abilityItem; } }
public void Parse(CharaInfo.EquipItem item, EquipItemTable.EquipItemData data) { _Reset(); type = data.type; spAttackType = data.spAttackType; GrowEquipItemTable.GrowEquipItemData growEquipItemData = Singleton <GrowEquipItemTable> .I.GetGrowEquipItemData(data.growID, (uint)item.lv); if (object.ReferenceEquals(growEquipItemData, null)) { baseStatus.hp = data.baseHp; baseStatus.attacks[0] = data.baseAtk; baseStatus.defences[0] = data.baseDef; for (int i = 0; i < 6; i++) { baseStatus.attacks[i + 1] = data.atkElement[i]; baseStatus.tolerances[i] = data.defElement[i]; } } else { baseStatus.hp = growEquipItemData.GetGrowParamHp(data.baseHp); baseStatus.attacks[0] = growEquipItemData.GetGrowParamAtk(data.baseAtk); baseStatus.defences[0] = growEquipItemData.GetGrowParamDef(data.baseDef); int[] growParamElemAtk = growEquipItemData.GetGrowParamElemAtk(data.atkElement); int[] growParamElemDef = growEquipItemData.GetGrowParamElemDef(data.defElement); for (int j = 0; j < 6; j++) { baseStatus.attacks[j + 1] = growParamElemAtk[j]; baseStatus.tolerances[j] = growParamElemDef[j]; } } EquipItemExceedParamTable.EquipItemExceedParamAll exceedParam = data.GetExceedParam((uint)item.exceed); if (!object.ReferenceEquals(exceedParam, null)) { baseStatus.hp += exceedParam.hp; baseStatus.attacks[0] += exceedParam.atk; baseStatus.defences[0] += exceedParam.def; for (int k = 0; k < 6; k++) { baseStatus.attacks[k + 1] += exceedParam.atkElement[k]; baseStatus.tolerances[k] += exceedParam.defElement[k]; } } int l = 0; for (int count = item.sIds.Count; l < count; l++) { SkillItemTable.SkillItemData skillItemData = Singleton <SkillItemTable> .I.GetSkillItemData((uint)item.sIds[l]); GrowSkillItemTable.GrowSkillItemData growSkillItemData = Singleton <GrowSkillItemTable> .I.GetGrowSkillItemData(skillItemData.growID, item.sLvs[l]); constHp += growSkillItemData.GetGrowParamHp(skillItemData.baseHp); constAtks[0] += growSkillItemData.GetGrowParamAtk(skillItemData.baseAtk); constDefs[0] += growSkillItemData.GetGrowParamDef(skillItemData.baseDef); int[] growParamElemAtk2 = growSkillItemData.GetGrowParamElemAtk(skillItemData.atkElement); int[] growParamElemDef2 = growSkillItemData.GetGrowParamElemDef(skillItemData.defElement); for (int m = 0; m < 6; m++) { constAtks[m + 1] += growParamElemAtk2[m]; constTols[m] += growParamElemDef2[m]; } if (skillItemData.IsPassive()) { int n = 0; for (int num = skillItemData.supportType.Length; n < num; n++) { if (skillItemData.supportType[n] != BuffParam.BUFFTYPE.NONE) { skillSupport.Add(new SkillSupport(skillItemData.supportPassiveEqType[n], skillItemData.supportType[n], growSkillItemData.GetGrowParamSupprtValue(skillItemData.supportValue, n), skillItemData.supportPassiveSpAttackType)); } } } } int num2 = 0; for (int count2 = item.aIds.Count; num2 < count2; num2++) { int num3 = item.aIds[num2]; int num4 = item.aPts[num2]; if (this.ability.ContainsKey(num3)) { Dictionary <int, int> dictionary; Dictionary <int, int> dictionary2 = dictionary = this.ability; int key; int key2 = key = num3; key = dictionary[key]; dictionary2[key2] = key + num4; } else { this.ability.Add(num3, num4); } } int num5 = 0; for (int num6 = data.fixedAbility.Length; num5 < num6; num5++) { EquipItem.Ability ability = data.fixedAbility[num5]; if (this.ability.ContainsKey(ability.id)) { Dictionary <int, int> dictionary3; Dictionary <int, int> dictionary4 = dictionary3 = this.ability; int key; int key3 = key = ability.id; key = dictionary3[key]; dictionary4[key3] = key + ability.pt; } else { this.ability.Add(ability.id, ability.pt); } } if (!object.ReferenceEquals(exceedParam, null)) { int num7 = 0; for (int num8 = exceedParam.ability.Length; num7 < num8; num7++) { EquipItem.Ability ability2 = exceedParam.ability[num7]; if (this.ability.ContainsKey(ability2.id)) { Dictionary <int, int> dictionary5; Dictionary <int, int> dictionary6 = dictionary5 = this.ability; int key; int key4 = key = ability2.id; key = dictionary5[key]; dictionary6[key4] = key + ability2.pt; } else { this.ability.Add(ability2.id, ability2.pt); } } } }
protected override void EquipTableParam() { int exceed = 0; EquipItemInfo equipData = GetEquipData(); if (equipData != null) { exceed = equipData.exceed; } EquipItemTable.EquipItemData table_data = GetEquipTableData(); if (table_data != null) { EquipItemExceedParamTable.EquipItemExceedParamAll equipItemExceedParamAll = table_data.GetExceedParam((uint)exceed); if (equipItemExceedParamAll == null) { equipItemExceedParamAll = new EquipItemExceedParamTable.EquipItemExceedParamAll(); } SetLabelText((Enum)UI.LBL_NAME, table_data.name); SetLabelText((Enum)UI.LBL_LV_NOW, "1"); SetLabelText((Enum)UI.LBL_LV_MAX, table_data.maxLv.ToString()); int num = (int)table_data.baseAtk + (int)equipItemExceedParamAll.atk; int elemAtk = equipItemExceedParamAll.GetElemAtk(table_data.atkElement); SetElementSprite((Enum)UI.SPR_ELEM, equipItemExceedParamAll.GetElemAtkType(table_data.atkElement)); SetLabelText((Enum)UI.LBL_ATK, num.ToString()); SetLabelText((Enum)UI.LBL_ELEM, elemAtk.ToString()); int num2 = (int)table_data.baseDef + (int)equipItemExceedParamAll.def; SetLabelText((Enum)UI.LBL_DEF, num2.ToString()); int elemDef = equipItemExceedParamAll.GetElemDef(table_data.defElement); SetDefElementSprite((Enum)UI.SPR_ELEM_DEF, equipItemExceedParamAll.GetElemDefType(table_data.defElement)); SetLabelText((Enum)UI.LBL_ELEM_DEF, elemDef.ToString()); int num3 = (int)table_data.baseHp + (int)equipItemExceedParamAll.hp; SetLabelText((Enum)UI.LBL_HP, num3.ToString()); SetActive((Enum)UI.SPR_IS_EVOLVE, table_data.IsEvolve()); SetEquipmentTypeIcon((Enum)UI.SPR_TYPE_ICON, (Enum)UI.SPR_TYPE_ICON_BG, (Enum)UI.SPR_TYPE_ICON_RARITY, table_data); SetLabelText((Enum)UI.LBL_SELL, table_data.sale.ToString()); if (smithType != SmithType.EVOLVE) { SetSkillIconButton(UI.OBJ_SKILL_BUTTON_ROOT, "SkillIconButton", table_data, GetSkillSlotData(table_data, 0), null, 0); if (table_data.fixedAbility.Length > 0) { string allAbilityName = string.Empty; string allAp = string.Empty; string allAbilityDesc = string.Empty; SetTable(UI.TBL_ABILITY, "ItemDetailEquipAbilityItem", table_data.fixedAbility.Length, false, delegate(int i, Transform t, bool is_recycle) { EquipItemAbility equipItemAbility = new EquipItemAbility((uint)table_data.fixedAbility[i].id, table_data.fixedAbility[i].pt); SetActive(t, true); SetActive(t, UI.OBJ_FIXEDABILITY, true); SetActive(t, UI.OBJ_ABILITY, false); SetLabelText(t, UI.LBL_FIXEDABILITY, equipItemAbility.GetName()); SetLabelText(t, UI.LBL_FIXEDABILITY_NUM, equipItemAbility.GetAP()); SetAbilityItemEvent(t, i, touchAndReleaseButtons); allAbilityName += equipItemAbility.GetName(); allAp += equipItemAbility.GetAP(); allAbilityDesc += equipItemAbility.GetDescription(); }); SetActive((Enum)UI.STR_NON_ABILITY, false); PreCacheAbilityDetail(allAbilityName, allAp, allAbilityDesc); } else { SetActive((Enum)UI.STR_NON_ABILITY, true); } } } }
private void SetWeaponData(WeaponIcons icon, int weaponId, int exceed = 0, bool is_top = false) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (weaponId == -1) { if (icon.weaponName != null) { icon.weaponName.text = StringTable.Get(STRING_CATEGORY.IN_GAME, 3000u); } if (icon.weaponIcon != null) { icon.weaponIcon.get_gameObject().SetActive(false); } if (icon.elementIconBase != null) { icon.elementIconBase.SetActive(false); } icon.isEnable = false; } else if (Singleton <EquipItemTable> .IsValid()) { EquipItemTable.EquipItemData equipItemData = Singleton <EquipItemTable> .I.GetEquipItemData((uint)weaponId); if (equipItemData != null) { icon.isEnable = true; if (icon.weaponName != null) { icon.weaponName.text = equipItemData.name; } if (icon.weaponIcon != null) { if (!is_top) { icon.weaponIcon.get_gameObject().SetActive(true); } icon.weaponIcon.spriteName = WEAPONICON_PATH[(int)equipItemData.type]; } EquipItemExceedParamTable.EquipItemExceedParamAll exceedParam = equipItemData.GetExceedParam((uint)exceed); bool active = false; if (icon.elementIcon != null) { int i = 0; for (int num = equipItemData.atkElement.Length; i < num; i++) { if (equipItemData.atkElement[i] > 0) { icon.elementIcon.spriteName = ELEMENT_PATH[i]; active = true; break; } if (exceedParam != null && exceedParam.atkElement[i] > 0) { icon.elementIcon.spriteName = ELEMENT_PATH[i]; active = true; break; } } } if (icon.elementIconBase != null) { icon.elementIconBase.SetActive(active); } } } }
private EquipItemInfo GetEquipMaxDef(EquipItemInfo[] items, bool validElement, bool validAbilityWeaponType, bool checkOnlyFixAbility) { EquipItemInfo equipItemInfo = null; int num = -1; int num2 = -1; for (int i = 0; i < items.Length; i++) { if (!validAbilityWeaponType || weaponIndex == 0 || HasFixAbilityWithWeaponType(items[i], weaponIndex, checkOnlyFixAbility)) { if (validElement && elementIndex != 0) { ELEMENT_TYPE eLEMENT_TYPE = ChangeElementToMasterDefineElement(elementIndex, ELEMENT_CONDITION.EFFECTIVE_DEF); if (eLEMENT_TYPE != (ELEMENT_TYPE)items[i].GetElemDefType()) { continue; } } int num3 = 0; int num4 = 0; if (isCurrent) { num3 = items[i].def + items[i].elemDef; num4 = items[i].hp; } else { EquipItemTable.EquipItemData tableData = items[i].tableData; GrowEquipItemTable.GrowEquipItemData growEquipItemData = Singleton <GrowEquipItemTable> .I.GetGrowEquipItemData(tableData.growID, (uint)tableData.maxLv); if (growEquipItemData != null) { EquipItemExceedParamTable.EquipItemExceedParamAll equipItemExceedParamAll = tableData.GetExceedParam(4u); if (equipItemExceedParamAll == null) { equipItemExceedParamAll = new EquipItemExceedParamTable.EquipItemExceedParamAll(); } int num5 = growEquipItemData.GetGrowParamDef(tableData.baseDef) + (int)equipItemExceedParamAll.def; int[] growParamElemDef = growEquipItemData.GetGrowParamElemDef(tableData.defElement); int j = 0; for (int num6 = growParamElemDef.Length; j < num6; j++) { growParamElemDef[j] += equipItemExceedParamAll.defElement[j]; } int num7 = Mathf.Max(growParamElemDef); num3 = num5 + num7; num4 = growEquipItemData.GetGrowParamHp(tableData.baseHp) + (int)equipItemExceedParamAll.hp; } } if (num3 > num || (num3 == num && num4 > num2)) { equipItemInfo = items[i]; num = num3; num2 = num4; } } } if (equipItemInfo == null && validElement && validAbilityWeaponType && checkOnlyFixAbility) { equipItemInfo = GetEquipMaxDef(items, true, true, false); } else if (equipItemInfo == null && validElement && validAbilityWeaponType && !checkOnlyFixAbility) { equipItemInfo = GetEquipMaxDef(items, false, true, true); } else if (equipItemInfo == null && !validElement && validAbilityWeaponType && checkOnlyFixAbility) { equipItemInfo = GetEquipMaxDef(items, false, true, false); } else if (equipItemInfo == null && !validElement && validAbilityWeaponType && !checkOnlyFixAbility) { equipItemInfo = GetEquipMaxDef(items, true, false, false); } else if (equipItemInfo == null) { equipItemInfo = GetEquipMaxDef(items, false, false, false); } return(equipItemInfo); }
private EquipItemInfo GetWeaponMaxAtk(bool validElement, ELEMENT_CONDITION condition = ELEMENT_CONDITION.EQUAL) { EquipItemInfo equipItemInfo = null; int num = -1; for (int i = 0; i < weaponItemInfoList.Length; i++) { if (validElement && elementIndex != 0) { ELEMENT_TYPE eLEMENT_TYPE = ChangeElementToMasterDefineElement(elementIndex, condition); int elemAtkType = weaponItemInfoList[i].GetElemAtkType(); if ((eLEMENT_TYPE != (ELEMENT_TYPE)elemAtkType && condition == ELEMENT_CONDITION.EQUAL) || ((eLEMENT_TYPE == (ELEMENT_TYPE)elemAtkType || elemAtkType == 6) && condition == ELEMENT_CONDITION.DISADVANTAGEOUS)) { continue; } } int num2 = 0; if (isCurrent) { num2 = weaponItemInfoList[i].atk + weaponItemInfoList[i].elemAtk; } else { EquipItemTable.EquipItemData tableData = weaponItemInfoList[i].tableData; GrowEquipItemTable.GrowEquipItemData growEquipItemData = Singleton <GrowEquipItemTable> .I.GetGrowEquipItemData(tableData.growID, (uint)tableData.maxLv); if (growEquipItemData != null) { EquipItemExceedParamTable.EquipItemExceedParamAll equipItemExceedParamAll = tableData.GetExceedParam((uint)weaponItemInfoList[i].exceed); if (equipItemExceedParamAll == null) { equipItemExceedParamAll = new EquipItemExceedParamTable.EquipItemExceedParamAll(); } int num3 = growEquipItemData.GetGrowParamAtk(tableData.baseAtk) + (int)equipItemExceedParamAll.atk; int[] growParamElemAtk = growEquipItemData.GetGrowParamElemAtk(tableData.atkElement); int j = 0; for (int num4 = growParamElemAtk.Length; j < num4; j++) { growParamElemAtk[j] += equipItemExceedParamAll.atkElement[j]; } int num5 = Mathf.Max(growParamElemAtk); num2 = num3 + num5; } } if (num2 != 0) { int num6 = (int)weaponItemInfoList[i].tableData.type; if (num6 >= 4) { num6--; } if (num6 < MonoBehaviourSingleton <GlobalSettingsManager> .I.playerWeaponAttackRate.Length) { num2 = (int)((float)num2 / MonoBehaviourSingleton <GlobalSettingsManager> .I.playerWeaponAttackRate[num6]); } } if (num2 > num && !selectedWeaponIds.Contains(weaponItemInfoList[i].uniqueID)) { equipItemInfo = weaponItemInfoList[i]; num = num2; } } if (equipItemInfo != null) { selectedWeaponIds.Add(equipItemInfo.uniqueID); } if (equipItemInfo == null && validElement && condition == ELEMENT_CONDITION.EQUAL) { equipItemInfo = GetWeaponMaxAtk(true, ELEMENT_CONDITION.DISADVANTAGEOUS); } else if (equipItemInfo == null && validElement && condition == ELEMENT_CONDITION.DISADVANTAGEOUS) { equipItemInfo = GetWeaponMaxAtk(false, ELEMENT_CONDITION.EQUAL); } return(equipItemInfo); }