public bool IsValidHappenQuest(uint questId) { if (questToItemTable == null) { return(false); } UIntKeyTable <QuestToFieldData> uIntKeyTable = questToItemTable.Get(questId); if (uIntKeyTable == null) { return(false); } Version applicationVersion = NetworkNative.getNativeVersionFromName(); int field_count = 0; uIntKeyTable.ForEach(delegate(QuestToFieldData data) { if (data.mapId != 0 && (data.eventId == 0 || MonoBehaviourSingleton <QuestManager> .I.IsEventPlayableWith((int)data.eventId, applicationVersion))) { FieldMapTable.FieldMapTableData fieldMapData = Singleton <FieldMapTable> .I.GetFieldMapData(data.mapId); if (fieldMapData != null && (!fieldMapData.IsEventData || MonoBehaviourSingleton <QuestManager> .I.IsEventPlayableWith(fieldMapData.eventId, applicationVersion))) { field_count++; } } }); return(field_count > 0); }
public EquipItemExceedData GetEquipItemExceedData(RARITY_TYPE rarity, GET_TYPE getType, int eventId = 0) { if (tableData == null) { return(null); } if (getType != GET_TYPE.EVENT) { eventId = 0; } UIntKeyTable <EquipItemExceedData> uIntKeyTable = tableData.Get((uint)rarity); if (uIntKeyTable == null) { Log.Error("EquipItemExceedTable is NULL :: rarity = {0}( {1} )", rarity, (uint)rarity); return(null); } EquipItemExceedData equipItemExceedData = uIntKeyTable.Find((EquipItemExceedData data) => data.getType == getType && data.eventId == eventId); if (equipItemExceedData == null) { if (getType == GET_TYPE.EVENT) { equipItemExceedData = uIntKeyTable.Find((EquipItemExceedData data) => data.getType == GET_TYPE.FREE && data.eventId == 0); } else { Log.Warning("EquipItemExceedTable is NULL :: getType = {0}, eventId = {1}", getType, eventId); } } return(equipItemExceedData); }
public void AddTableFromAPI(uint itemId, List <int> questIds) { if (itemToQuestTable == null) { itemToQuestTable = new DoubleUIntKeyTable <ItemToQuestData>(); } itemToQuestTable.Get(itemId)?.Clear(); for (int i = 0; i < questIds.Count; i++) { ItemToQuestData itemToQuestData = new ItemToQuestData(); itemToQuestData.LoadFromAPI(itemId, (uint)questIds[i], (uint)i); itemToQuestTable.Add(itemId, (uint)i, itemToQuestData); } InitDependencyData(); }
public DeliveryRewardData[] GetDeliveryRewardTableData(uint id) { if (tableData == null) { return(null); } UIntKeyTable <DeliveryRewardData> uIntKeyTable = tableData.Get(id); if (uIntKeyTable == null) { return(null); } List <DeliveryRewardData> list = new List <DeliveryRewardData>(); uIntKeyTable.ForEach(delegate(DeliveryRewardData data) { list.Add(data); }); if (list.Count == 0) { return(null); } list.Sort((DeliveryRewardData l, DeliveryRewardData r) => (int)(l.rewardIndex - r.rewardIndex)); return(list.ToArray()); }
public override bool Equals(object obj) { if (obj == null) { return(false); } DoubleUIntKeyTable <T> rhs = obj as DoubleUIntKeyTable <T>; if (rhs == null) { return(false); } if (GetCount() != rhs.GetCount()) { return(false); } bool isEqual = true; ForEachDoubleKeyValue(delegate(uint key1, uint key2, T value1) { T val = rhs.Get(key1, key2); isEqual = (isEqual && value1.Equals(val)); }); return(isEqual); }
public GrowEnemyData GetGrowEnemyData(uint growId, int level) { if (growTableData == null) { Log.Warning("GetGrowEnemyData: growTableDate is null!"); return(_defaultData); } UIntKeyTable <GrowEnemyData> uIntKeyTable = growTableData.Get(growId); if (uIntKeyTable == null) { Log.Warning("GetGrowEnemyData: growId {0} is not found!", growId); return(_defaultData); } GrowEnemyData growEnemyData = uIntKeyTable.Get((uint)level); if (growEnemyData != null) { return(growEnemyData); } GrowEnemyData prev = null; GrowEnemyData next = null; uIntKeyTable.ForEach(delegate(GrowEnemyData grow) { if ((int)grow.level < level && (prev == null || (int)grow.level > (int)prev.level)) { prev = grow; } if ((int)grow.level > level && (next == null || (int)grow.level < (int)next.level)) { next = grow; } }); if (next == null || prev == null) { if (next != null) { return(next); } if (prev != null) { return(prev); } Log.Warning("GetGrowEnemyData: growId {0}, Lv {1} Lerp error", growId, level); return(_defaultData); } float num = (float)(level - (int)prev.level) / (float)((int)next.level - (int)prev.level); growEnemyData = new GrowEnemyData(); growEnemyData.growId = growId; growEnemyData.level = level; growEnemyData.hp = Mathf.FloorToInt(Mathf.Lerp((float)(int)prev.hp, (float)(int)next.hp, num)); growEnemyData.atk = Mathf.FloorToInt(Mathf.Lerp((float)(int)prev.atk, (float)(int)next.atk, num)); return(growEnemyData); }
public EquipItemExceedParam GetEquipItemExceedParam(uint exceedId, uint exceedCnt) { if (tableData == null) { return(null); } UIntKeyTable <EquipItemExceedParam> uIntKeyTable = tableData.Get(exceedId); if (uIntKeyTable == null) { return(null); } EquipItemExceedParam equipItemExceedParam = uIntKeyTable.Get(exceedCnt); if (equipItemExceedParam == null) { Log.Warning("EquipItemExceedParamTable is NULL :: exceedID = {0}, exceedCount = {1}", exceedId, exceedCnt); } return(equipItemExceedParam); }
public GrowEquipItemNeedItemData GetGrowEquipItemNeedUniqueItemData(uint needUniqueId, uint lv) { if (needUniqueId == 0) { return(null); } if (needUniqueTableData == null) { return(null); } return(needUniqueTableData.Get(needUniqueId)?.Get(lv)); }
public AbilityData GetAbilityData(uint ability_id, int AP) { if (abilityDataTable == null) { return(null); } UIntKeyTable <AbilityData> uIntKeyTable = abilityDataTable.Get(ability_id); if (uIntKeyTable == null) { Log.Error("AbilityDataTable is NULL :: ability id = " + ability_id + " AP = " + AP); return(null); } AbilityData under = null; AbilityData linearBaseData = null; uIntKeyTable.ForEach(delegate(AbilityData data) { if (AP >= 0) { if ((int)data.needAP <= AP && (int)data.needAP >= 0 && (under == null || (int)data.needAP > (int)under.needAP)) { under = data; } if (data.minNeedAP > 0 && data.minNeedAP <= AP && (int)data.needAP >= AP) { linearBaseData = data; } } else if ((int)data.needAP >= AP && (int)data.needAP < 0 && (under == null || (int)data.needAP < (int)under.needAP)) { under = data; } }); if (linearBaseData != null) { return(CreateLinearInterpolationData(linearBaseData, AP)); } return(under); }
public static DoubleUIntKeyTable <AbilityData> CreateTableBinary(byte[] bytes) { DoubleUIntKeyTable <AbilityData> doubleUIntKeyTable = new DoubleUIntKeyTable <AbilityData>(); BinaryTableReader binaryTableReader = new BinaryTableReader(bytes); while (binaryTableReader.MoveNext()) { uint key = binaryTableReader.ReadUInt32(0u); uint key2 = 0u; UIntKeyTable <AbilityData> uIntKeyTable = doubleUIntKeyTable.Get(key); if (uIntKeyTable != null) { key2 = (uint)uIntKeyTable.GetCount(); } AbilityData abilityData = new AbilityData(); abilityData.LoadFromBinary(binaryTableReader, ref key, ref key2); doubleUIntKeyTable.Add(key, key2, abilityData); } return(doubleUIntKeyTable); }
private bool ReceivePromisePacketOverAgainCheck(CoopPacket packet) { if (packet.fromClientId <= 0) { return(false); } List <int> list = recvPromisePacketSequenceNoTable.Get((uint)packet.fromClientId, (uint)packet.packetType); if (list != null && list.Find((int x) => x == packet.sequenceNo) > 0) { Logd("Receive promise packet over again!!. fromId={0}, packet={1}, no={2}", packet.fromClientId, packet.packetType, packet.sequenceNo); return(true); } Logd("Receive promise packet over again add sequenceNo. fromId={0}, packet={1}, no={2}", packet.fromClientId, packet.packetType, packet.sequenceNo); if (list == null) { list = new List <int>(); recvPromisePacketSequenceNoTable.Add((uint)packet.fromClientId, (uint)packet.packetType, list); } list.Add(packet.sequenceNo); return(false); }
public GrowSkillItemData GetGrowSkillItemData(uint skill_grow_id, int level) { if (growSkillItemTable == null) { return(null); } UIntKeyTable <GrowSkillItemData> uIntKeyTable = growSkillItemTable.Get(skill_grow_id); if (uIntKeyTable == null) { Log.Error("GrowSkillTable is NULL :: grow id = " + skill_grow_id + " Lv = " + level); return(null); } GrowSkillItemData growSkillItemData = uIntKeyTable.Get((uint)level); if (growSkillItemData != null) { return(growSkillItemData); } GrowSkillItemData under = null; GrowSkillItemData over = null; uIntKeyTable.ForEach(delegate(GrowSkillItemData data) { if (data.lv > level && (over == null || data.lv < over.lv)) { over = data; } if (data.lv <= level && (under == null || data.lv > under.lv)) { under = data; } }); if (under != null && over == null) { return(under); } if (under == null) { return(null); } float num = (float)(level - under.lv) / (float)(over.lv - under.lv); GrowSkillItemData growSkillItemData2 = new GrowSkillItemData(); growSkillItemData2.id = skill_grow_id; growSkillItemData2.lv = level; growSkillItemData2.exceedCnt = Mathf.FloorToInt(Mathf.Lerp((float)under.exceedCnt, (float)over.exceedCnt, num)); growSkillItemData2.needExp = new GrowRate(); growSkillItemData2.needExp.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.needExp.rate, (float)(int)over.needExp.rate, num)); growSkillItemData2.needExp.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.needExp.add, (float)(int)over.needExp.add, num)); growSkillItemData2.giveExp = new GrowRate(); growSkillItemData2.giveExp.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.giveExp.rate, (float)(int)over.giveExp.rate, num)); growSkillItemData2.giveExp.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.giveExp.add, (float)(int)over.giveExp.add, num)); growSkillItemData2.atk = new GrowRate(); growSkillItemData2.atk.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.atk.rate, (float)(int)over.atk.rate, num)); growSkillItemData2.atk.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.atk.add, (float)(int)over.atk.add, num)); growSkillItemData2.def = new GrowRate(); growSkillItemData2.def.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.def.rate, (float)(int)over.def.rate, num)); growSkillItemData2.def.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.def.add, (float)(int)over.def.add, num)); growSkillItemData2.hp = new GrowRate(); growSkillItemData2.hp.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.hp.rate, (float)(int)over.hp.rate, num)); growSkillItemData2.hp.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.hp.add, (float)(int)over.hp.add, num)); growSkillItemData2.elemAtk = new GrowRate[6]; for (int i = 0; i < 6; i++) { growSkillItemData2.elemAtk[i] = new GrowRate(); growSkillItemData2.elemAtk[i].rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.elemAtk[i].rate, (float)(int)over.elemAtk[i].rate, num)); growSkillItemData2.elemAtk[i].add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.elemAtk[i].add, (float)(int)over.elemAtk[i].add, num)); } growSkillItemData2.elemDef = new GrowRate[6]; for (int j = 0; j < 6; j++) { growSkillItemData2.elemDef[j] = new GrowRate(); growSkillItemData2.elemDef[j].rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.elemDef[j].rate, (float)(int)over.elemDef[j].rate, num)); growSkillItemData2.elemDef[j].add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.elemDef[j].add, (float)(int)over.elemDef[j].add, num)); } growSkillItemData2.skillAtk = new GrowRate(); growSkillItemData2.skillAtk.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.skillAtk.rate, (float)(int)over.skillAtk.rate, num)); growSkillItemData2.skillAtk.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.skillAtk.add, (float)(int)over.skillAtk.add, num)); growSkillItemData2.skillAtkRate = new GrowRate(); growSkillItemData2.skillAtkRate.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.skillAtkRate.rate, (float)(int)over.skillAtkRate.rate, num)); growSkillItemData2.skillAtkRate.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.skillAtkRate.add, (float)(int)over.skillAtkRate.add, num)); growSkillItemData2.heal = new GrowRate(); growSkillItemData2.heal.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.heal.rate, (float)(int)over.heal.rate, num)); growSkillItemData2.heal.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.heal.add, (float)(int)over.heal.add, num)); growSkillItemData2.supprtValue = new GrowRate[3]; growSkillItemData2.supprtTime = new GrowRateFloat[3]; for (int k = 0; k < 3; k++) { growSkillItemData2.supprtValue[k] = new GrowRate(); growSkillItemData2.supprtValue[k].rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.supprtValue[k].rate, (float)(int)over.supprtValue[k].rate, num)); growSkillItemData2.supprtValue[k].add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.supprtValue[k].add, (float)(int)over.supprtValue[k].add, num)); growSkillItemData2.supprtTime[k] = new GrowRateFloat(); growSkillItemData2.supprtTime[k].rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.supprtTime[k].rate, (float)(int)over.supprtTime[k].rate, num)); growSkillItemData2.supprtTime[k].add = (float)Mathf.FloorToInt(Mathf.Lerp((float)under.supprtTime[k].add, (float)over.supprtTime[k].add, num)); } growSkillItemData2.castTime = new GrowRate(); growSkillItemData2.castTime.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.castTime.rate, (float)(int)over.castTime.rate, num)); growSkillItemData2.castTime.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.castTime.add, (float)(int)over.castTime.add, num)); growSkillItemData2.useGauge = new GrowRate(); growSkillItemData2.useGauge.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.useGauge.rate, (float)(int)over.useGauge.rate, num)); growSkillItemData2.useGauge.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.useGauge.add, (float)(int)over.useGauge.add, num)); return(growSkillItemData2); }
public GrowEquipItemNeedItemData GetGrowEquipItemNeedItemData(uint id, uint lv) { if (needTableData == null) { return(null); } UIntKeyTable <GrowEquipItemNeedItemData> uIntKeyTable = needTableData.Get(id); if (uIntKeyTable == null) { Log.Error("GetGrowEquipItemNeedItemData is NULL :: need id = " + id + " Lv = " + lv); return(null); } GrowEquipItemNeedItemData growEquipItemNeedItemData = uIntKeyTable.Get(lv); if (growEquipItemNeedItemData != null) { return(growEquipItemNeedItemData); } GrowEquipItemNeedItemData under = null; GrowEquipItemNeedItemData over = null; uIntKeyTable.ForEach(delegate(GrowEquipItemNeedItemData table) { if (table.lv > lv && (over == null || table.lv < over.lv)) { over = table; } if (table.lv <= lv && (under == null || table.lv > under.lv)) { under = table; } }); if (under != null && over == null) { return(under); } if (under == null) { return(null); } GrowEquipItemNeedItemData growEquipItemNeedItemData2 = new GrowEquipItemNeedItemData(); float lerp_value = (float)(double)(lv - under.lv) / (float)(double)(over.lv - under.lv); growEquipItemNeedItemData2.id = id; growEquipItemNeedItemData2.lv = lv; List <NeedMaterial> material_list = new List <NeedMaterial>(); Array.ForEach(under.needMaterial, delegate(NeedMaterial material_data) { Array.ForEach(over.needMaterial, delegate(NeedMaterial over_need_material) { if (over_need_material.itemID == material_data.itemID) { material_list.Add(new NeedMaterial(over_need_material.itemID, Mathf.FloorToInt(Mathf.Lerp((float)material_data.num, (float)over_need_material.num, lerp_value)))); } }); }); growEquipItemNeedItemData2.needMaterial = material_list.ToArray(); growEquipItemNeedItemData2.needMoney = Mathf.FloorToInt(Mathf.Lerp((float)under.needMoney, (float)over.needMoney, lerp_value)); return(growEquipItemNeedItemData2); }
public GrowEquipItemData GetGrowEquipItemData(uint id, uint lv) { if (growTableData == null) { return(null); } UIntKeyTable <GrowEquipItemData> uIntKeyTable = growTableData.Get(id); if (uIntKeyTable == null) { Log.Error("GrowEquipItemTable is NULL :: grow id = " + id + " Lv = " + lv); return(null); } GrowEquipItemData growEquipItemData = uIntKeyTable.Get(lv); if (growEquipItemData != null && lv > 1) { return(growEquipItemData); } GrowEquipItemData under = null; GrowEquipItemData over = null; uIntKeyTable.ForEach(delegate(GrowEquipItemData table) { if ((uint)table.lv > lv && (over == null || (uint)table.lv < (uint)over.lv)) { over = table; } if ((uint)table.lv <= lv && (under == null || (uint)table.lv > (uint)under.lv)) { under = table; } }); if (under != null && over == null) { return(under); } if (under == null) { under = new GrowEquipItemData(); under.lv = 1u; under.id = id; under.atk = new GrowRate(); under.atk.rate = 100; under.atk.add = 0; under.def = new GrowRate(); under.def.rate = 100; under.def.add = 0; under.hp = new GrowRate(); under.hp.rate = 100; under.hp.add = 0; under.elemAtk = new GrowRate[6]; for (int i = 0; i < 6; i++) { under.elemAtk[i] = new GrowRate(); under.elemAtk[i].rate = 100; under.elemAtk[i].add = 0; } under.elemDef = new GrowRate[6]; for (int j = 0; j < 6; j++) { under.elemDef[j] = new GrowRate(); under.elemDef[j].rate = 100; under.elemDef[j].add = 0; } } GrowEquipItemData growEquipItemData2 = new GrowEquipItemData(); float num = (float)(double)(lv - (uint)under.lv) / (float)(double)((uint)over.lv - (uint)under.lv); growEquipItemData2.id = id; growEquipItemData2.lv = lv; growEquipItemData2.atk = new GrowRate(); growEquipItemData2.atk.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.atk.rate, (float)(int)over.atk.rate, num)); growEquipItemData2.atk.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.atk.add, (float)(int)over.atk.add, num)); growEquipItemData2.def = new GrowRate(); growEquipItemData2.def.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.def.rate, (float)(int)over.def.rate, num)); growEquipItemData2.def.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.def.add, (float)(int)over.def.add, num)); growEquipItemData2.hp = new GrowRate(); growEquipItemData2.hp.rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.hp.rate, (float)(int)over.hp.rate, num)); growEquipItemData2.hp.add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.hp.add, (float)(int)over.hp.add, num)); growEquipItemData2.elemAtk = new GrowRate[6]; for (int k = 0; k < 6; k++) { growEquipItemData2.elemAtk[k] = new GrowRate(); growEquipItemData2.elemAtk[k].rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.elemAtk[k].rate, (float)(int)over.elemAtk[k].rate, num)); growEquipItemData2.elemAtk[k].add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.elemAtk[k].add, (float)(int)over.elemAtk[k].add, num)); } growEquipItemData2.elemDef = new GrowRate[6]; for (int l = 0; l < 6; l++) { growEquipItemData2.elemDef[l] = new GrowRate(); growEquipItemData2.elemDef[l].rate = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.elemDef[l].rate, (float)(int)over.elemDef[l].rate, num)); growEquipItemData2.elemDef[l].add = Mathf.FloorToInt(Mathf.Lerp((float)(int)under.elemDef[l].add, (float)(int)over.elemDef[l].add, num)); } return(growEquipItemData2); }
public ItemDetailToFieldData[] GetFieldTableFromItemID(uint item_id, out bool find_unknown_field, bool isExcludeNotPlayable = false) { find_unknown_field = false; if (itemToFieldTable == null) { return(null); } UIntKeyTable <ItemToFieldData> uIntKeyTable = itemToFieldTable.Get(item_id); if (uIntKeyTable == null) { return(null); } bool temp_find_unknown = false; List <ItemDetailToFieldData> list = new List <ItemDetailToFieldData>(); List <uint> icon_id_list = new List <uint>(); uIntKeyTable.ForEach(delegate(ItemToFieldData data) { if (data.enemyId != null && data.enemyId.Length != 0) { FieldMapTable.FieldMapTableData fieldMapData = Singleton <FieldMapTable> .I.GetFieldMapData(data.fieldId); if (fieldMapData != null) { if (IsOpenMap(fieldMapData)) { if (data.enemyId[0] != 0) { list.Add(new ItemDetailToFieldEnemyData(fieldMapData, data.enemyId)); } int i = 0; for (int num = data.pointId.Length; i < num; i++) { if (data.pointId[i] != 0) { FieldMapTable.GatherPointTableData gatherPointData = Singleton <FieldMapTable> .I.GetGatherPointData(data.pointId[i]); if (gatherPointData != null) { FieldMapTable.GatherPointViewTableData gatherPointViewData = Singleton <FieldMapTable> .I.GetGatherPointViewData(gatherPointData.viewID); if (gatherPointViewData != null && gatherPointViewData.iconID != 0 && icon_id_list.IndexOf(gatherPointViewData.iconID) < 0 && (!isExcludeNotPlayable || IsPlayableField(fieldMapData))) { icon_id_list.Add(gatherPointViewData.iconID); list.Add(new ItemDetailToFieldPointData(fieldMapData, data.pointId[i], gatherPointData, gatherPointViewData)); } } } } } else { temp_find_unknown = true; } } } }); find_unknown_field = temp_find_unknown; if (list.Count == 0) { return(null); } return(list.ToArray()); }