You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

7540 lines
255 KiB

using IVDataFormat;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using UnityEngine;
using Random = UnityEngine.Random;
public static class DataHandler
{
#region System data
public static dConst Const { get; private set; } = null;
private static dAttend[] sysAttend;
public static Dictionary<int, dAwakenReward> SysAwakenRewards = new Dictionary<int, dAwakenReward>();
public static Dictionary<int, dBox> SysBoxes = new Dictionary<int, dBox>();
private static dAdBuff[] sysBuff;
private static Dictionary<int, dCostumeSet> dicCosClothSet = new Dictionary<int, dCostumeSet>();
private static Dictionary<int, dCostumeSet> dicCosWeaponSet = new Dictionary<int, dCostumeSet>();
public static dAwaken[] sysGearAwakens = null;
public static dTotalLvValue[] sysGearLvEffects = null;
private static int[] gearTreasureLvUpLvBounds = null;
private static int[] gearTreasureLvUpSuccRates = null;
private static dDungeonInfo sysDgAwaken = null;
private static dDungeonInfo sysDgAwakenStone = null;
private static dDungeonInfo sysDgGold = null;
private static dDungeonInfo[] sysDgGuardian = null;
private static dDungeonInfo sysDgPet = null;
private static dDungeonInfo sysDgReinStone = null;
private static dDungeonInfo sysDgRelic = null;
private static int[] extraRarityRates;
private static Dictionary<int, dExtraAbility> extraAbilities;
private static Dictionary<eEffectType, int>[] extraAbilityIds;
private static Dictionary<int, dQuest> sysQuestDaily = new Dictionary<int, dQuest>();
private static Dictionary<int, dQuest> sysQuestRepeat = new Dictionary<int, dQuest>();
private static Dictionary<int, dMission> sysQuestMission = new Dictionary<int, dMission>();
#endregion System data
#region Play data
public static cPlayData PlayData { get; private set; } = null;
public static cGoodsData Goods { get; private set; } = null;
private static cAttend[] playAttend;
public static cAwakenData PlayAwaken = null;
private static cBoxData PlayBoxes { get; set; } = null;
public static cAdBuffLevel PlayBuff { get; set; } = null;
public static cPlayCostume PlayEquipCostume { get; private set; } = null;
public static cPlayerDungeonInfo PlayDgAwaken = null;
public static cPlayerDungeonInfo PlayDgAwakenStone = null;
public static cPlayerDungeonInfo PlayDgGold = null;
public static Dictionary<int, cPlayerDungeonInfo> PlayDgGuardian = null;
public static cPlayerDungeonInfo PlayDgPet = null;
public static cPlayerDungeonInfo PlayDgReinStone = null;
public static cPlayerDungeonInfo PlayDgRelic = null;
private static cQuestDaily[] playQuestDaily;
private static cQuestRepeat[] playQuestRepeat;
#endregion
#region Union data (System data + Play data)
private static Dictionary<int, dCharStat> dicCharStatEnhanceGold = new Dictionary<int, dCharStat>();
private static Dictionary<int, dCharStat> dicCharStatEnhancePoint = new Dictionary<int, dCharStat>();
private static Dictionary<int, dSkillActive> dicSkillActive = new Dictionary<int, dSkillActive>();
private static Dictionary<int, dSkillPassive> dicSkillPassive = new Dictionary<int, dSkillPassive>();
private static Dictionary<int, dCostume> dicCosCloth = new Dictionary<int, dCostume>();
private static Dictionary<int, dCostume> dicCosWeapon = new Dictionary<int, dCostume>();
private static Dictionary<int, Dictionary<int, dGear>> dicGearEquipment = new Dictionary<int, Dictionary<int, dGear>>(7)
{
[cGoods.TBagWeapon] = new Dictionary<int, dGear>(28),
[cGoods.TBagArmorCape] = new Dictionary<int, dGear>(28),
[cGoods.TBagArmorHat] = new Dictionary<int, dGear>(28),
[cGoods.TBagArmorShoes] = new Dictionary<int, dGear>(28),
[cGoods.TBagAcceEar] = new Dictionary<int, dGear>(28),
[cGoods.TBagAcceNeck] = new Dictionary<int, dGear>(28),
[cGoods.TBagAcceRing] = new Dictionary<int, dGear>(28)
};
private static Dictionary<int, dTreasure> dicGearTreasure = new Dictionary<int, dTreasure>();
#endregion
#region ETC
public static bool bLoadLocalData = false;
public static bool IsNeedDataSave { get; private set; } = false;
private static HashSet<int> boxNew = new HashSet<int>();
private static HashSet<int> cosClothNew = new HashSet<int>();
private static HashSet<int> cosWeaponNew = new HashSet<int>();
private static Dictionary<int, int> dicGearLast = new Dictionary<int, int>(7)
{
[cGoods.TBagWeapon] = 1,
[cGoods.TBagArmorCape] = 1,
[cGoods.TBagArmorHat] = 1,
[cGoods.TBagArmorShoes] = 1,
[cGoods.TBagAcceEar] = 1,
[cGoods.TBagAcceNeck] = 1,
[cGoods.TBagAcceRing] = 1,
};
private static Dictionary<int, int> dicGearLastHave = new Dictionary<int, int>(7)
{
[cGoods.TBagWeapon] = -1,
[cGoods.TBagArmorCape] = -1,
[cGoods.TBagArmorHat] = -1,
[cGoods.TBagArmorShoes] = -1,
[cGoods.TBagAcceEar] = -1,
[cGoods.TBagAcceNeck] = -1,
[cGoods.TBagAcceRing] = -1,
};
private static Dictionary<int, int> dicGearLv = new Dictionary<int, int>(7)
{
[cGoods.TBagWeapon] = 0,
[cGoods.TBagArmorCape] = 0,
[cGoods.TBagArmorHat] = 0,
[cGoods.TBagArmorShoes] = 0,
[cGoods.TBagAcceEar] = 0,
[cGoods.TBagAcceNeck] = 0,
[cGoods.TBagAcceRing] = 0,
};
private static Dictionary<int, HashSet<int>> dicGearNew = new Dictionary<int, HashSet<int>>(7)
{
[cGoods.TBagWeapon] = new HashSet<int>(),
[cGoods.TBagArmorCape] = new HashSet<int>(),
[cGoods.TBagArmorHat] = new HashSet<int>(),
[cGoods.TBagArmorShoes] = new HashSet<int>(),
[cGoods.TBagAcceEar] = new HashSet<int>(),
[cGoods.TBagAcceNeck] = new HashSet<int>(),
[cGoods.TBagAcceRing] = new HashSet<int>()
};
private static int[] arrHaveWeapon = null;
private static int[,] arrHaveArmor = null;
private static int[,] arrHaveAcc = null;
#endregion
#region Data - Costume
private static Dictionary<int, dColor> dicColor = new Dictionary<int, dColor>();
private static Dictionary<int, int>[] dicColorHave = new Dictionary<int, int>[3] { new Dictionary<int, int>(), new Dictionary<int, int>(), new Dictionary<int, int>() };
private static HashSet<int>[] colorNew = new HashSet<int>[3] { new HashSet<int>(), new HashSet<int>(), new HashSet<int>() };
#endregion Data - Costume
#region Data - Stage, Monster, Bg, Bgm
public static dArea[] Areas = null;
private static Dictionary<int, dMonster> dicMonster = new Dictionary<int, dMonster>();
private static Dictionary<int, dBg> dicBg = new Dictionary<int, dBg>();
private static Dictionary<int, dBgm> dicBgm = new Dictionary<int, dBgm>();
#endregion Data - Stage, Monster, Bg, Bgm
#region Data - Dungeon
private static Dictionary<int, dSysGuardian> sysGuardian = null;
private static Dictionary<int, dSysRelic[]> sysRelic = null;
private static int[] sysRelicEnhancePropLvs = null;
private static int[] sysRelicEnhanceProp = null;
public static Dictionary<int, cPlayGuardian> PlayGuardian = null;
public static Dictionary<int, cPlayRelic> PlayRelic = null;
public static cDungeonPreset PlayDgPreset = null;
#endregion Data - Dungeon
#region Data - Enhance, Skill
private static dPlayerLv[] PlayerLevels = null;
public static cPlayGuardian GuardianSlot = null;
public static dAwaken[] skillAwakens = null;
public static dTotalLvValue[] skillLvEffects = null;
private static int currentTotalSkillLv = 0;
#endregion Data - Enhance, Skill
#region Data - Pet
public static dAwaken[] petAwakens = null;
public static dTotalLvValue[] petLvEffects = null;
private static Dictionary<int, dPet> dicPet = new Dictionary<int, dPet>();
private static HashSet<int> petNew = new HashSet<int>();
private static int petLv = 0;
#endregion Data - Pet
#region Data - Gacha
private static dGachaLevel[] gachaWeaponLvs;
private static int[] gachaWeaponGrades;
private static dGachaLevel[] gachaArmorLvs;
private static int[] gachaArmorGrades;
private static dGachaLevel[] gachaAcceLvs;
private static int[] gachaAcceGrades;
#endregion Data - Gacha
#region Data - Title & Icon
private static Dictionary<int, dTitle> sysProfileTitle = new Dictionary<int, dTitle>();
private static Dictionary<int, dIcon> sysProfileIcon = new Dictionary<int, dIcon>();
#endregion
#region Data - Shop, Pass, Mail, Notice
private static Dictionary<int, dShop> dicShop = new Dictionary<int, dShop>();
private static List<int>[] shopIdList = new List<int>[8]
{
new List<int>(),
new List<int>(),
new List<int>(),
new List<int>(),
new List<int>(),
new List<int>(),
new List<int>(),
new List<int>()
};
private static Dictionary<eCondition, dPass> dicPass = new Dictionary<eCondition, dPass>();
private static dPass passEvent = null;
private static dPass passEventNext = null;
public static DateTime MailRefreshTime { get; private set; }
public static int MailCount { get; private set; }
private static dMail[] Mails = null;
public static DateTime MailReadRefreshTime { get; private set; }
private static dMail[] MailReads = null;
private static dNotice[] noticeDatas;
private static dChatNotice[] chatNoticeDatas;
#endregion Data - Shop, Pass, Mail, Notice
#region Data - Event
private static Dictionary<int, dEvent> dicEvent = new Dictionary<int, dEvent>();
private static Dictionary<int, dQuest> sysQuestEvent = new Dictionary<int, dQuest>();
private static Dictionary<int, cQuestEvent> playQuestEvent = new Dictionary<int, cQuestEvent>();
private static cQuestAttend playQuestEventAttend;
private static dEventInfo sysEventTrade;
private static cEventItem playEventTrade;
private static dEventInfo sysEventRoulette;
private static cEventItem playEventRoulette;
private static dEventInfo sysEventRaise;
private static cEventItem playEventRaise;
private static dRewardEvent sysRewardEvent;
private static cRewardEvent playEventReward;
#endregion
#region Data - Diary
//private static dTrip[][] dicTrip = null;
//private static dLife[][] dicLife = null;
//private static int[,] dicLifePiece = null;
#endregion Data - Diary
#region Data - PlayRecord
private static cTotalRecord PlayerTotalRecord = null;
private static cDailyRecord PlayerDailyRecord = null;
private static List<nAchivement> listBattleType = new List<nAchivement>(), listEquipmentType = new List<nAchivement>(),
listSummonType = new List<nAchivement>(), listDungeonType = new List<nAchivement>(), listEtcType = new List<nAchivement>();
#endregion
#region Data - Pvp
public static dPvp pvpSys = null;
private static dPvpRew[] pvpRewards = null;
private static dPvpTier[] pvpTiers = null;
public static cPvpPlay pvpPlay = null;
public static dPvpRank pvpMyRank = null;
private static dPvpRank[] pvpRanks = null;
public static DateTime PvpRankRefreshTime { get; private set; }
#endregion Data - Pvp
#region Base
public static IEnumerator InitSystemData(nSystemData systemData)
{
{
// load const data
Const = systemData.constData;
// load box datas
for (int i = 0; i < systemData.sysBox.Length; ++i)
{
dBox box = systemData.sysBox[i];
SysBoxes.Add(box.id, box);
}
}
yield return null;
{
// load dungeon datas
sysDgAwaken = systemData.sysDgAwaken;
sysDgAwakenStone = systemData.sysDgAwakenStone;
sysDgGold = systemData.sysDgGold;
sysDgGuardian = systemData.sysDgGuardian;
sysDgPet = systemData.sysDgPet;
sysDgReinStone = systemData.sysDgReinStone;
sysDgRelic = systemData.sysDgRelic;
}
yield return null;
{
for(int i = 0; i < systemData.sysQuestDaily.Length; ++i)
{
dQuest quest = systemData.sysQuestDaily[i];
sysQuestDaily.SafeInsert(quest.id, quest);
}
for (int i = 0; i < systemData.sysQuestRepeat.Length; ++i)
{
dQuest quest = systemData.sysQuestRepeat[i];
sysQuestRepeat.SafeInsert(quest.id, quest);
}
for (int i = 0; i < systemData.sysQuestMission.Length; ++i)
{
dMission mission = systemData.sysQuestMission[i];
sysQuestMission.SafeInsert(mission.id, mission);
}
}
yield return null;
{
// load attend data
sysAttend = systemData.sysAttend;
// load char stat enhance with gold
for (int i = 0; i < systemData.sysCharEnhanceGold.Length; ++i)
{
dCharStat stat = systemData.sysCharEnhanceGold[i];
dicCharStatEnhanceGold.SafeInsert(new KeyValuePair<int, dCharStat>(stat.id, stat));
}
// load awaken reward data
for (int i = 0; i < systemData.sysAwaken.Length; ++i)
{
dAwakenReward reward = systemData.sysAwaken[i];
SysAwakenRewards.Add(i + 1, reward);
}
// load cloth costume data
for (int i = 0; i < systemData.sysCostumeOutfit.Length; ++i)
{
dCostume costume = systemData.sysCostumeOutfit[i];
dicCosCloth.SafeInsert(new KeyValuePair<int, dCostume>(costume.id, costume));
}
// load cloth costume set data
for (int i = 0; i < systemData.sysCostumeOutfitSet.Length; ++i)
{
dCostumeSet cosSet = systemData.sysCostumeOutfitSet[i];
for (int j = 0; j < cosSet.set.Length; ++j)
{
// id가 음수이거나, 해당 코스튬이 없는 경우 -1로 설정.
if (cosSet.set[j] >= 0 && !dicCosCloth.ContainsKey(cosSet.set[j]))
cosSet.set[j] = -1;
}
dicCosClothSet.SafeInsert(new KeyValuePair<int, dCostumeSet>(cosSet.id, cosSet));
}
// load weapon costume data
for (int i = 0; i < systemData.sysCostumeWeapon.Length; ++i)
{
dCostume costume = systemData.sysCostumeWeapon[i];
dicCosWeapon.SafeInsert(new KeyValuePair<int, dCostume>(costume.id, costume));
}
// load weapon costume set data
for (int i = 0; i < systemData.sysCostumeWeaponSet.Length; i++)
{
dCostumeSet cosSet = systemData.sysCostumeWeaponSet[i];
for (int j = 0; j < cosSet.set.Length; ++j)
{
// id가 음수이거나, 해당 코스튬이 없는 경우 -1로 설정.
if (cosSet.set[j] >= 0 && !dicCosWeapon.ContainsKey(cosSet.set[j]))
cosSet.set[j] = -1;
}
dicCosWeaponSet.SafeInsert(new KeyValuePair<int, dCostumeSet>(cosSet.id, cosSet));
}
}
yield return null;
{
sysGearAwakens = systemData.sysGearAwaken;
sysGearLvEffects = systemData.sysGearEnhance;
// load gear equipment datas
LoadSysGearEquipment(cGoods.TBagWeapon, systemData.sysGearWeapon);
LoadSysGearEquipment(cGoods.TBagArmorCape, systemData.sysGearCape);
LoadSysGearEquipment(cGoods.TBagArmorHat, systemData.sysGearHat);
LoadSysGearEquipment(cGoods.TBagArmorShoes, systemData.sysGearShoes);
LoadSysGearEquipment(cGoods.TBagAcceEar, systemData.sysGearEarring);
LoadSysGearEquipment(cGoods.TBagAcceNeck, systemData.sysGearNecklace);
LoadSysGearEquipment(cGoods.TBagAcceRing, systemData.sysGearRing);
// load gear treasure data
for (int i = 0; i < systemData.sysGearTreasure.Length; ++i)
{
dTreasure treasure = systemData.sysGearTreasure[i];
dicGearTreasure.SafeInsert(treasure.id, treasure);
}
gearTreasureLvUpLvBounds = systemData.sysGearTreasureEnhance.lv;
gearTreasureLvUpSuccRates = systemData.sysGearTreasureEnhance.props;
}
yield return null;
{
// load ad buff data
sysBuff = systemData.sysBuff;
LoadExtraAbility(systemData.sysExtraRarity, systemData.sysExtra);
// load character passive skill data
for (int i = 0; i < systemData.sysCharSkillPassive.Length; ++i)
{
dSkillPassive skill = systemData.sysCharSkillPassive[i];
dicSkillPassive.SafeInsert(new KeyValuePair<int, dSkillPassive>(skill.id, skill));
}
// load character active skill data
for (int i = 0; i < systemData.sysCharSkillActive.Length; ++i)
{
dSkillActive skill = systemData.sysCharSkillActive[i];
dicSkillActive.SafeInsert(new KeyValuePair<int, dSkillActive>(skill.id, skill));
}
}
}
public static IEnumerator InitPlayData(nPlayData playData)
{
LoadGoodsData(playData.playCurrency);
LoadCostumeEquipStatusData(playData.playCostumeInfo);
LoadPlayBox(playData.playBox);
yield return null;
LoadAdBuffData(playData.playBuff);
LoadCharStatsEnhanceGoldData(playData.playCharEnhanceGold);
LoadAwakenData(playData.playAwaken);
LoadCostumeData(playData.playCostumeOutfit, playData.playCostumeWeapon);
yield return null;
LoadPlayGearEquipment(cGoods.TBagWeapon, playData.playGearWeapon);
LoadPlayGearEquipment(cGoods.TBagArmorCape, playData.playGearCape);
LoadPlayGearEquipment(cGoods.TBagArmorHat, playData.playGearHat);
LoadPlayGearEquipment(cGoods.TBagArmorShoes, playData.playGearShoes);
LoadPlayGearEquipment(cGoods.TBagAcceEar, playData.playGearEarring);
LoadPlayGearEquipment(cGoods.TBagAcceNeck, playData.playGearNecklace);
LoadPlayGearEquipment(cGoods.TBagAcceRing, playData.playGearRing);
LoadPlayGearTreasures(playData.playGearTreasure);
yield return null;
LoadSkillsPlay(playData.playCharSkillPassive, playData.playCharSkillActive);
yield return null;
LoadAwakenDungeonData(playData.playDgAwaken);
PlayDgAwakenStone = playData.playDgAwakenStone;
PlayDgGold = playData.playDgGold;
LoadGuardianDungeonData(playData.playDgGuardian);
PlayDgPet = playData.playDgPet;
PlayDgReinStone = playData.playDgReinStone;
PlayDgRelic = playData.playDgRelic;
yield return null;
playQuestDaily = playData.playQuestDaily;
playQuestRepeat = playData.playQuestRepeat;
}
// 실행 중에 사용한 모든 데이터 초기화. 디바이스에 저장된 데이터를 지우는게 아님. 게임 재시작 등에서 사용.
public static void ResetAll()
{
Const = null;
PlayData = null;
//AwakenData = null;
PlayEquipCostume = null;
PlayBuff = null;
Goods = null;
SysBoxes.Clear();
boxNew.Clear();
PlayBoxes = null;
dicCosClothSet.Clear();
dicCosCloth.Clear();
cosClothNew.Clear();
dicCosWeaponSet.Clear();
dicCosWeapon.Clear();
cosWeaponNew.Clear();
dicColor.Clear();
dicColorHave[0].Clear();
dicColorHave[1].Clear();
dicColorHave[2].Clear();
colorNew[0].Clear();
colorNew[1].Clear();
colorNew[2].Clear();
Areas = null;
dicMonster.Clear();
dicBg.Clear();
dicBgm.Clear();
PlayerLevels = null;
dicCharStatEnhanceGold.Clear();
dicCharStatEnhancePoint.Clear();
PlayAwaken = null;
skillAwakens = null;
skillLvEffects = null;
dicSkillPassive.Clear();
dicSkillActive.Clear();
currentTotalSkillLv = 0;
petAwakens = null;
petLvEffects = null;
dicPet.Clear();
petNew.Clear();
petLv = 0;
extraRarityRates = null;
extraAbilities = null;
extraAbilityIds = null;
sysGearAwakens = null;
sysGearLvEffects = null;
foreach (var gears in dicGearEquipment.Values)
{
gears.Clear();
}
foreach (var key in dicGearLast.Keys)
{
dicGearLast[key] = 1;
}
foreach (var key in dicGearLastHave.Keys)
{
dicGearLastHave[key] = -1;
}
foreach (var key in dicGearLv.Keys)
{
dicGearLv[key] = 0;
}
foreach (var gears in dicGearNew.Values)
{
gears.Clear();
}
gearTreasureLvUpLvBounds = null;
gearTreasureLvUpSuccRates = null;
arrHaveWeapon = null;
arrHaveArmor = null;
arrHaveAcc = null;
dicGearTreasure.Clear();
sysProfileTitle.Clear();
sysProfileIcon.Clear();
sysQuestDaily.Clear();
sysQuestRepeat.Clear();
playQuestDaily = null;
playQuestRepeat = null;
sysQuestMission.Clear();
sysDgGold = null;
sysDgReinStone = null;
sysDgPet = null;
sysDgAwakenStone = null;
sysDgAwaken = null;
sysDgGuardian = null;
sysGuardian = null;
PlayGuardian = null;
PlayDgGold = null;
PlayDgReinStone = null;
PlayDgPet = null;
PlayDgAwakenStone = null;
PlayDgAwaken = null;
PlayDgPreset = null;
gachaWeaponLvs = null;
gachaWeaponGrades = null;
gachaArmorLvs = null;
gachaArmorGrades = null;
gachaAcceLvs = null;
gachaAcceGrades = null;
sysBuff = null;
sysAttend = null;
playAttend = null;
dicShop.Clear();
for (int i = 0; i < shopIdList.Length; i++)
shopIdList[i].Clear();
dicPass.Clear();
//dicPassRepeat.Clear();
pvpSys = null;
pvpRewards = null;
pvpTiers = null;
pvpPlay = null;
pvpMyRank = null;
pvpRanks = null;
PvpRankRefreshTime = TimeUtils.Now();
passEvent = null;
passEventNext = null;
sysRewardEvent = null;
playEventReward = null;
dicEvent.Clear();
sysEventTrade = null;
MailRefreshTime = TimeUtils.Now();
MailReadRefreshTime = TimeUtils.Now();
MailCount = 0;
Mails = null;
MailReads = null;
noticeDatas = null;
chatNoticeDatas = null;
BuffMgr.ResetAll();
}
// 전부 삭제. 로그아웃 등에서 호출.
public static void DeleteAll()
{
ES3.DeleteFile(FormatString.StringFormat(Global.ES3_Server, "1"));
ES3.DeleteFile(FormatString.StringFormat(Global.ES3_Server, "2"));
ES3.DeleteFile(Global.ES3_PlayDatas);
ES3.DeleteFile(Global.ES3_PlayGoods);
ES3.DeleteFile(Global.ES3_PlayBox);
ES3.DeleteFile(Global.ES3_Pass);
ES3.DeleteFile(Global.ES3_Notice);
ES3.DeleteFile(Global.ES3_CharAwaken);
ES3.DeleteFile(Global.ES3_AdBuff);
ES3.DeleteFile(Global.ES3_DgPreset);
ES3.DeleteFile(Global.ES3_StartMain);
}
// 서버에서 데이터 받아오지 않고 실행했을때(에디터 게임씬에서 바로 실행) 임시 데이터 생성.
public static void InitLocalData()
{
if (PlayData == null)
LoadPlayData(cPlayData.Load(1));
if (Areas == null)
LoadAreas(dArea.LocalDatas());
if (sysGuardian == null)
LoadSysGuardian(dSysGuardian.LocalDatas());
if (dicMonster.Count == 0)
LoadMonsters(dMonster.LocalDatas());
if (dicBg.Count == 0)
LoadBgs(dBg.LocalBg());
if (dicBgm.Count == 0)
LoadBgms(dBgm.LocalBgm());
if (PlayerLevels == null)
LoadPlayerLevels(dPlayerLv.LocalDatas());
if (dicCharStatEnhancePoint.Count == 0)
{
LoadCharLvPoints(dCharStat.LocalLvPoints());
LoadCharLvPointsPlay(nIdLv.LocalCharLvPoints());
}
if (dicGearEquipment[cGoods.TBagWeapon].Count == 0)
{
//LoadGearGeneral(dAwaken.LocalDatas(), dTotalLvValue.LocalDatas());
//LoadGearTreasureProps(nProps.LocalData());
//LoadGearTreasuresPlay(nIdLvInfo.LocalDatas(dicGearTreasure.Count));
}
if (arrHaveWeapon == null)
{
LoadCurGearHave();
}
if (dicSkillActive.Count == 0)
{
LoadSkillGeneral(dAwaken.LocalDatas(), dTotalLvValue.LocalDatas());
//LoadSkills(dSkillPassive.LocalDatas(), dSkillActive.LocalDatas());
//LoadSkillsPlay(nIdLvInfo.LocalSkills(dicSkillPassive.Count), nIdLvInfo.LocalSkills(dicSkillActive.Count));
}
if (dicPet.Count == 0)
{
LoadPetGeneral(dAwaken.LocalDatas(), dTotalLvValue.LocalDatas());
LoadPets(dPet.LocalDatas());
LoadPetsPlay(nIdLvInfo.LocalDatas(dicPet.Count));
}
if (gachaWeaponLvs == null)
{
LoadGacha(dGachaLevel.LocalDatas(), tLocalDatas.LocalGachaGrades(), dGachaLevel.LocalDatas(), tLocalDatas.LocalGachaGrades(), dGachaLevel.LocalDatas(), tLocalDatas.LocalGachaGrades());
}
if (dicEvent.Count == 0)
{
LoadSysEvent(dEvent.LocalDatas());
}
if (sysEventTrade == null)
{
LoadSysEventTrade(dEventInfo.LocalDatas());
}
if (sysEventRaise == null)
{
LoadSysEventRaise(dEventInfo.LocalDatas());
}
if (sysEventRoulette == null)
{
LoadSysEventRoulette(dEventInfo.LocalDatas());
}
if (playEventTrade == null)
{
LoadPlayEventTrade(cEventItem.LocalDatas());
}
if (playEventRaise == null)
{
LoadPlayEventRaise(cEventItem.LocalDatas());
}
if (playEventRaise == null)
{
LoadPlayEventRoulette(cEventItem.LocalDatas());
}
if (playQuestEvent == null)
{
LoadPlayEventQuestPlay(cQuestEvent.LocalDatas());
}
if (playQuestEventAttend == null)
{
LoadPlayEventQuestAttendPlay(cQuestAttend.Localdatas());
}
if (playAttend == null)
{
LoadPlayAttend(cAttend.Localdatas());
}
if (sysProfileTitle.Count == 0)
{
LoadPlayerTitle(dTitle.localDatas());
}
if (sysProfileIcon.Count == 0)
{
LoadPlayerIcon(dIcon.localDatas());
}
if (PlayerTotalRecord == null)
{
LoadPlayerTotalRecord(cTotalRecord.LocalData());
}
if (PlayerDailyRecord == null)
{
LoadPlayerDailyRecord(cDailyRecord.LocalData());
}
if (dicPass.Count == 0)
{
LoadPass(dPass.LocalDatas());
LoadPassPlay(sPassPlay.LocalDatas());
}
if (dicShop.Count == 0)
{
LoadShop(dShop.LocalDatas());
LoadShopPlay(sShopPlay.LocalDatas());
}
if (Mails == null)
{
LoadMail(null, false, false);
LoadMailRead(null, false);
}
if (pvpSys == null)
LoadPvp(dPvp.LocalData());
if (pvpPlay == null)
{
LoadPvpPlay(new cPvpPlay(), new dPvpRank());
}
if (noticeDatas == null)
{
LoadNotice(dNotice.LocalDatas());
LoadChatNotice(dChatNotice.LocalDatas());
}
if (PlayDgPreset == null)
{
LoadDungeonPreset(cDungeonPreset.LocalData());
}
BuffMgr.Instance.CalcAllStat();
}
// 데이터 저장.
public static void SaveData()
{
PlayData.Save();
Goods.Save(PlayData.server);
PlayBoxes.Save(PlayData.server);
SavePass();
}
// 데이터 서버 저장시 처리.
public static void OnSaveDataServer()
{
IsNeedDataSave = false;
}
#endregion Base
#region Play Data
// 플레이 데이터 불러오기.
public static void LoadPlayData(cPlayData playdata)
{
if (playdata == null && PlayData != null)
return;
if (playdata != null)
{
cPlayData localdata = cPlayData.Load(playdata.server);
bLoadLocalData = !playdata.forceOverwrite && playdata.lastTime < localdata.lastTime;
if (bLoadLocalData && localdata.lastTime > DateTime.MinValue)
{
playdata.playerLv = localdata.playerLv;
playdata.playerExp = localdata.playerExp;
playdata.playerIcon = localdata.playerIcon;
playdata.curStage = localdata.curStage;
playdata.usePreset = localdata.usePreset;
playdata.skillPresets = localdata.skillPresets;
playdata.usePetPreset = localdata.usePetPreset;
playdata.petPresets = localdata.petPresets;
playdata.lastTime = localdata.lastTime;
}
PlayData = playdata;
PlayData.stageRepeat = localdata.stageRepeat;
}
else
{
PlayData = cPlayData.Load(1);
}
}
// 플레이 광고버프레벨 데이터 불러오기.
private static void LoadAdBuffData(cAdBuffLevel adbuffdata)
{
if (adbuffdata != null)
{
cAdBuffLevel localdata = cAdBuffLevel.Load(adbuffdata, PlayData.server);
PlayBuff = adbuffdata;
PlayBuff.atkExp = localdata.atkExp;
PlayBuff.expExp = localdata.expExp;
PlayBuff.goldExp = localdata.goldExp;
PlayBuff.adTimer[0] = localdata.adTimer[0];
PlayBuff.adTimer[1] = localdata.adTimer[1];
PlayBuff.adTimer[2] = localdata.adTimer[2];
}
else
{
PlayBuff = new cAdBuffLevel();
}
}
// 획득한 아이콘 불러오기
public static void LoadPlayerIconPlay(int[] icons)
{
for (int i = 0; i < icons.Length; i++)
{
int key = icons[i];
if (sysProfileIcon.ContainsKey(key))
{
sysProfileIcon[key].have = true;
}
}
dIcon icon = new dIcon();
for (int i = 0; i < sysProfileIcon.Count; i++)
{
icon = GetPlayerIcon(i + 1);
if (!icon.have)
listEtcType.Add(new nAchivement(icon));
}
}
// 획득한 칭호 불러오기
public static void LoadPlayerTitlesPlay(int[] titles)
{
for (int i = 0; i < titles.Length; i++)
{
int key = titles[i];
if (sysProfileTitle.ContainsKey(key))
{
sysProfileTitle[key].have = true;
BuffMgr.Instance.AddTitleEfc(sysProfileTitle[key].abilityType, sysProfileTitle[key].abilityValue, false);
}
}
dTitle title = new dTitle();
for (int i = 0; i < sysProfileTitle.Count; i++)
{
title = GetPlayerTitle(i + 1);
if (!title.have)
{
switch (title.category)
{
case eContent.Battle:
listBattleType.Add(new nAchivement(title));
break;
case eContent.Equipment:
listEquipmentType.Add(new nAchivement(title));
break;
case eContent.Summon:
listSummonType.Add(new nAchivement(title));
break;
case eContent.Dungeon:
listDungeonType.Add(new nAchivement(title));
break;
case eContent.Etc:
listEtcType.Add(new nAchivement(title));
break;
}
}
}
}
// 기록 불러오기
public static void LoadPlayerTotalRecordPlay(cTotalRecord record)
{
PlayerTotalRecord = record;
}
public static void LoadPlayerDailyRecordPlay(cDailyRecord record)
{
PlayerDailyRecord = record;
}
public static void LoadRewardEvnetPlay(cRewardEvent rewardEvent)
{
playEventReward = rewardEvent;
}
public static void SetPlayRewardEvent(cRewardEvent rewardEvent)
{
playEventReward.sid = rewardEvent.sid;
}
public static cRewardEvent GetPlayRewardEvent()
{
return playEventReward;
}
#endregion Play Data
#region Goods 1 (SetGoods, AddGoods)
// 플레이 재화 불러오기.
public static void LoadGoodsData(cGoodsData goodsdata)
{
if (goodsdata == null && Goods != null) return;
if (goodsdata != null)
{
cGoodsData localdata = cGoodsData.Load(PlayData.server);
bLoadLocalData = PlayData.lastTime < localdata.lastTime;
if (bLoadLocalData && localdata.lastTime > DateTime.MinValue)
{
goodsdata.gold = localdata.gold;
goodsdata.goldUsed = localdata.gold;
}
Goods = goodsdata;
}
else
{
Goods = cGoodsData.Load(PlayData.server);
}
}
// 재화 세팅.
public static void SetGoods(cGoodsData playcurrency, bool localexclude)
{
if (localexclude)
{
playcurrency.gold = Goods.gold;
playcurrency.goldUsed = Goods.goldUsed;
}
Goods = playcurrency;
GameUIMgr.SSetGoods();
Goods.Save(PlayData.server);
}
// 재화 증가. baddgoods : 서버 관리 재화 증가. / blocalexclude : 로컬 관리 재화(골드) 증가 안 함.
public static void AddGoods(nGoods[] result, cGoodsData playcurrency, bool blocalexclude)
{
#region result
if (result != null)
{
// 스탯 재계산 필요. 보유효과, 통합 레벨 효과가 있는 아이템을 처음 획득했을 때 다시 계산.
bool brecalcstat = false;
for (int i = 0; i < result.Length; ++i)
{
int itype = result[i].propertyType;
int icode = result[i].propertyId;
BigInteger icount = result[i].propertyCount;
switch (itype)
{
// 광고 제거.
case cGoods.TAdsRemove:
PlayData.adRemove = true;
break;
// 재화.
case cGoods.TCurrency:
{
switch (icode)
{
case cGoods.CGold:
if (blocalexclude)
AddGold(eGoodsGetUse.None, icount);
break;
//case cGoods.CGoldRate:
// break;
}
}
break;
// 장비 획득.
case cGoods.TBagWeapon:
case cGoods.TBagArmorCape:
case cGoods.TBagArmorHat:
case cGoods.TBagArmorShoes:
case cGoods.TBagAcceEar:
case cGoods.TBagAcceNeck:
case cGoods.TBagAcceRing:
brecalcstat |= AddGearEquip(itype, icode, (int)icount);
break;
// 보물 획득.
case cGoods.TBagTreasure:
brecalcstat |= AddGearTreasure(icode, (int)icount);
break;
// 펫 획득.
case cGoods.TPet:
brecalcstat |= AddPet(icode);
break;
// 펫 스피릿 획득.
case cGoods.TPetSpirit:
AddPetSpirit(icode, (int)icount);
break;
//던전 티켓 획득
case cGoods.TDgTicketGold:
PlayDgGold.ticket += (int)icount;
break;
case cGoods.TDgTicketPet:
PlayDgPet.ticket += (int)icount;
break;
case cGoods.TDgTicketEnhance:
PlayDgReinStone.ticket += (int)icount;
break;
case cGoods.TDgTicketAwaken:
PlayDgAwakenStone.ticket += (int)icount;
break;
case cGoods.TDgTicketRelic:
PlayDgRelic.ticket += (int)icount;
break;
// 결투장 티켓 획득.
case cGoods.TPvpTicket:
if (pvpPlay != null)
pvpPlay.ticket += (int)icount;
break;
// 코스튬.
case cGoods.TCosCloth:
brecalcstat |= AddCosCloth(icode);
break;
case cGoods.TCosWeapon:
brecalcstat |= AddCosWeapon(icode);
break;
// 염색 색상 획득.
case cGoods.TCosClrEye:
AddColor(2, icode, (int)icount);
break;
case cGoods.TCosClrHair:
AddColor(0, icode, (int)icount);
break;
case cGoods.TCosClrTop:
AddColor(1, icode, (int)icount);
break;
// 상자 획득.
case cGoods.TBox:
AddBox(icode, (int)icount);
break;
// 아이콘 획득.
case cGoods.TProfileIcon:
ProfileMgr.SGetIcon(icode);
break;
// 칭호 획득.
case cGoods.TProfileTitle:
ProfileMgr.SGetTitle(icode);
break;
}
}
}
#endregion result
// 재화 획득 처리. 동료 영혼석 자동 변환 등 때문에 아래에 위치.
if (playcurrency != null)
SetGoods(playcurrency, blocalexclude);
}
#endregion Goods 1 (SetGoods, AddGoods)
#region Goods 2 (Add/Sub Local)
// 골드 세팅.
public static void SetGold(BigInteger curvalue, BigInteger usedvalue)
{
Goods.gold = curvalue;
Goods.goldUsed = usedvalue;
GameUIMgr.SSetGold(Goods.gold);
Goods.Save(PlayData.server);
}
// 골드 증가.
public static void AddGold(eGoodsGetUse type, BigInteger addvalue)
{
//switch (type)
//{
//}
Goods.gold += addvalue;
GameUIMgr.SSetGold(Goods.gold);
Goods.Save(PlayData.server);
}
// 골드 감소.
public static void SubGold(BigInteger subvalue)
{
Goods.gold -= subvalue;
Goods.goldUsed += subvalue;
GameUIMgr.SSetGold(Goods.gold);
Goods.Save(PlayData.server);
}
// 보석 세팅.
public static void SetDia(int curvaluep, int curvaluef)
{
Goods.diaPaid = curvaluep;
Goods.diaFree = curvaluef;
GameUIMgr.SSetDia(Goods.Dia);
Goods.Save(PlayData.server);
}
// 보석 획득.
public static void AddDia(int addvalue, int curvaluep, int curvaluef)
{
Goods.diaPaid = curvaluep;
Goods.diaFree = curvaluef;
GameUIMgr.SSetDia(Goods.Dia);
Goods.Save(PlayData.server);
}
// 보석 사용.
public static void SubDia(int subvalue)
{
if (subvalue <= Goods.diaFree)
{
Goods.diaFree -= subvalue;
}
else
{
int subdia = subvalue - Goods.diaFree;
Goods.diaFree = 0;
Goods.diaPaid -= subdia;
}
GameUIMgr.SSetDia(Goods.Dia);
Goods.Save(PlayData.server);
}
// 보석 사용.
public static void SubDia(int subvalue, int curvaluep, int curvaluef)
{
Goods.diaPaid = curvaluep;
Goods.diaFree = curvaluef;
GameUIMgr.SSetDia(Goods.Dia);
Goods.Save(PlayData.server);
}
// 레벨 포인트 세팅.
public static void SetLvPoint(int curvalue)
{
Goods.point = curvalue;
GameUIMgr.SSetLvPoint(Goods.point);
Goods.Save(PlayData.server);
}
// 레벨 포인트 획득.
public static void AddLvPoint(int addvalue)
{
IsNeedDataSave = true;
Goods.point += addvalue;
GameUIMgr.SSetLvPoint(Goods.point);
Goods.Save(PlayData.server);
}
// 레벨 포인트 사용.
public static void SubLvPoint(int subvalue)
{
Goods.point -= subvalue;
GameUIMgr.SSetLvPoint(Goods.point);
Goods.Save(PlayData.server);
}
// 강화석 세팅.
public static void SetEnhanceStone(int curvalue)
{
Goods.gearReinStone = curvalue;
GameUIMgr.SSetEnhanceStone(Goods.gearReinStone);
Goods.Save(PlayData.server);
}
// 강화석 획득.
public static void AddEnhanceStone(int addvalue)
{
Goods.gearReinStone += addvalue;
GameUIMgr.SSetEnhanceStone(Goods.gearReinStone);
Goods.Save(PlayData.server);
}
// 강화석 사용.
public static void SubEnhanceStone(int subvalue)
{
Goods.gearReinStone -= subvalue;
GameUIMgr.SSetEnhanceStone(Goods.gearReinStone);
Goods.Save(PlayData.server);
}
// 스킬 강화석 세팅
public static void SetSkillStone(int curvalue)
{
Goods.skillReinStone = curvalue;
GameUIMgr.SSetSkillStone(Goods.skillReinStone);
Goods.Save(PlayData.server);
}
// 스킬 강화석 획득
public static void AddSkillStone(int addvalue)
{
Goods.skillReinStone += addvalue;
GameUIMgr.SSetSkillStone(Goods.skillReinStone);
Goods.Save(PlayData.server);
}
// 스킬 강화석 사용
public static void SubSkillStone(int subvalue)
{
Goods.skillReinStone -= subvalue;
GameUIMgr.SSetSkillStone(Goods.skillReinStone);
Goods.Save(PlayData.server);
}
// 각성석 세팅.
public static void SetAwakenStone(int curvalue)
{
Goods.gearAwakenStone = curvalue;
GameUIMgr.SSetAwakenStone(Goods.gearAwakenStone);
Goods.Save(PlayData.server);
}
// 각성석 획득.
public static void AddAwakenStone(int addvalue)
{
Goods.gearAwakenStone += addvalue;
GameUIMgr.SSetAwakenStone(Goods.gearAwakenStone);
Goods.Save(PlayData.server);
}
// 각성석 사용.
public static void SubAwakenStone(int subvalue)
{
Goods.gearAwakenStone -= subvalue;
GameUIMgr.SSetAwakenStone(Goods.gearAwakenStone);
Goods.Save(PlayData.server);
}
public static void SetAwakenSkillStone(int curvalue)
{
Goods.skillAwakenStone = curvalue;
GameUIMgr.SSetAwakenSkillStone(Goods.skillAwakenStone);
Goods.Save(PlayData.server);
}
public static void AddAwakenSkillStone(int addvalue)
{
Goods.skillAwakenStone += addvalue;
GameUIMgr.SSetAwakenSkillStone(Goods.skillAwakenStone);
Goods.Save(PlayData.server);
}
public static void SubAwakenSkillStone(int subvalue)
{
Goods.skillAwakenStone -= subvalue;
GameUIMgr.SSetAwakenSkillStone(Goods.skillAwakenStone);
Goods.Save(PlayData.server);
}
// 변경석 세팅.
public static void SetChangeStone(int curvalue)
{
Goods.changeStone = curvalue;
GameUIMgr.SSetChangeStone(Goods.changeStone);
Goods.Save(PlayData.server);
}
// 변경석 획득.
public static void AddChangeStone(int addvalue)
{
Goods.changeStone += addvalue;
GameUIMgr.SSetChangeStone(Goods.changeStone);
Goods.Save(PlayData.server);
}
// 변경석 사용.
public static void SubChangeStone(int subvalue)
{
Goods.changeStone -= subvalue;
GameUIMgr.SSetChangeStone(Goods.changeStone);
Goods.Save(PlayData.server);
}
// 푸딩 세팅.
public static void SetPudding(int curvalue)
{
Goods.pudding = curvalue;
GameUIMgr.SSetPudding(Goods.pudding);
Goods.Save(PlayData.server);
}
// 푸딩 획득.
public static void AddPudding(int addvalue)
{
Goods.pudding += addvalue;
GameUIMgr.SSetPudding(Goods.pudding);
Goods.Save(PlayData.server);
}
// 푸딩 사용.
public static void SubPudding(int subvalue)
{
Goods.pudding -= subvalue;
GameUIMgr.SSetPudding(Goods.pudding);
Goods.Save(PlayData.server);
}
#endregion Goods 2 (Add/Sub Local)
#region Goods 3 (Box)
// 플레이 상자 불러오기.
private static void LoadPlayBox(nIdCnt[] boxdatas)
{
if (boxdatas == null && PlayBoxes != null) return;
if (boxdatas != null)
{
if (bLoadLocalData)
PlayBoxes = cBoxData.Load(PlayData.server);
else
PlayBoxes = new cBoxData(boxdatas);
}
else
{
PlayBoxes = cBoxData.Load(PlayData.server);
}
foreach (var box in SysBoxes)
{
if (!PlayBoxes.dicBoxCount.ContainsKey(box.Key))
{
PlayBoxes.dicBoxCount.Add(box.Key, 0);
}
}
PlayBoxes.Save(PlayData.server);
}
// 모든 상자 수.
public static nIdCnt[] GetBoxPlayDatas()
{
if (PlayBoxes == null)
return null;
return PlayBoxes.GetPlayData();
}
// 상자 수.
public static Dictionary<int, int> GetBoxCounts()
{
return PlayBoxes.dicBoxCount;
}
// 현재 상자 소지수.
public static int GetBoxCount(int key)
{
if (PlayBoxes.dicBoxCount.ContainsKey(key))
return PlayBoxes.dicBoxCount[key];
return 0;
}
// 상자 소지수 증가.
public static void AddBox(int key, int addvalue)
{
PlayBoxes.dicBoxCount[key] += addvalue;
IsNeedDataSave = true;
if (!boxNew.Contains(key))
boxNew.Add(key);
// 0개에서 증가하였으면.
if (PlayBoxes.dicBoxCount[key] == addvalue)
BagMgr.SSetUpdateConsume();
PlayBoxes.Save(PlayData.server);
}
// 상자 소지수 감소.
public static void SubBox(int key, int subvalue)
{
if (PlayBoxes.dicBoxCount.ContainsKey(key))
{
PlayBoxes.dicBoxCount[key] -= subvalue;
// 0개로 감소하였으면.
if (PlayBoxes.dicBoxCount[key] <= 0)
{
boxNew.Remove(key);
BagMgr.SSetUpdateConsume();
}
}
PlayBoxes.Save(PlayData.server);
}
public static bool IsBoxNewHave()
{
return boxNew.Count > 0;
}
public static bool IsBoxNew(int key)
{
return boxNew.Contains(key);
}
public static bool RemoveBoxNew(int key)
{
return boxNew.Remove(key);
}
#endregion Goods 3 (Box)
#region Costume
// 플레이 코스튬 데이터 불러오기.
public static void LoadCostumeEquipStatusData(cPlayCostume costumedata)
{
if (PlayEquipCostume != null) return;
if (costumedata != null)
{
PlayEquipCostume = costumedata;
}
else
{
PlayEquipCostume = new cPlayCostume();
}
}
// 코스튬 소지 상태.
public static void LoadCostumeData(int[] clplaydatas, int[] wpplaydatas)
{
// 의상 소지 상태 적용.
for (int i = 0; i < clplaydatas.Length; ++i)
{
if (dicCosCloth.TryGetValue(clplaydatas[i], out dCostume costume))
{
costume.have = true;
BuffMgr.Instance.AddCostumeEfc(costume.abilityType1, costume.abilityValue1, false);
BuffMgr.Instance.AddCostumeEfc(costume.abilityType2, costume.abilityValue2, false);
}
}
// 의상 세트 효과 적용.
foreach (var set in dicCosClothSet.Values)
{
if (IsActiveClothCosSetEffect(set.id))
BuffMgr.Instance.AddCostumeEfc(set.abilityType, set.abilityValue, false);
}
// 무기 소지 상태 적용.
for (int i = 0; i < wpplaydatas.Length; ++i)
{
if (dicCosWeapon.TryGetValue(wpplaydatas[i], out dCostume costume))
{
costume.have = true;
BuffMgr.Instance.AddCostumeEfc(costume.abilityType1, costume.abilityValue1, false);
BuffMgr.Instance.AddCostumeEfc(costume.abilityType2, costume.abilityValue2, false);
}
}
// 무기 세트 효과 적용.
foreach (var set in dicCosWeaponSet.Values)
{
if (IsActiveWeaponCosSetEffect(set.id))
BuffMgr.Instance.AddCostumeEfc(set.abilityType, set.abilityValue, false);
}
}
public static Dictionary<int, dCostumeSet> GetCosClothSets() => dicCosClothSet;
public static Dictionary<int, dCostumeSet> GetCosWeaponSets() => dicCosWeaponSet;
public static dCostumeSet GetCosClothSet(int setkey)
{
if (dicCosClothSet.ContainsKey(setkey))
return dicCosClothSet[setkey];
return dicCosClothSet[cGoods.CCosClothSetBase];
}
public static dCostumeSet GetCosWeaponSet(int setkey)
{
if (dicCosWeaponSet.ContainsKey(setkey))
return dicCosWeaponSet[setkey];
return dicCosWeaponSet[cGoods.CCosWeaponSetBase];
}
public static dCostumeSet GetCosClothSetByItem(int key)
{
foreach (var item in dicCosClothSet)
{
int[] keys = item.Value.set;
for (int i = 0; i < keys.Length; i++)
{
if (keys[i] == key)
return item.Value;
}
}
return dicCosClothSet[cGoods.CCosClothSetBase];
}
public static dCostumeSet GetCosWeaponSetByItem(int key)
{
foreach (var item in dicCosWeaponSet)
{
int[] keys = item.Value.set;
for (int i = 0; i < keys.Length; i++)
{
if (keys[i] == key)
return item.Value;
}
}
return dicCosWeaponSet[cGoods.CCosWeaponSetBase];
}
public static int GetCosClothId(int key, int ichildindex)
{
if (dicCosClothSet.ContainsKey(key))
return dicCosClothSet[key].set[ichildindex];
return dicCosClothSet[cGoods.CCosClothSetBase].set[ichildindex];
}
public static int GetCosWeaponId(int key, int ichildindex)
{
if (dicCosWeapon.ContainsKey(key))
return dicCosWeaponSet[key].set[ichildindex];
return dicCosWeaponSet[cGoods.CCosWeaponSetBase].set[ichildindex];
}
public static dCostume GetCosCloth(int key)
{
if (dicCosCloth.ContainsKey(key))
return dicCosCloth[key];
return dicCosCloth[cGoods.CCosClothBase];
}
public static dCostume GetCosWeapon(int key)
{
if (dicCosWeapon.ContainsKey(key))
return dicCosWeapon[key];
return dicCosWeapon[cGoods.CCosWeaponBase];
}
public static string GetCosClothPath(int key)
{
if (dicCosCloth.ContainsKey(key))
return FormatString.CombineAllString(AddressableMgr.PCosCloth, key.ToString());
return AddressableMgr.PCosClothBase;
}
public static string GetCosWeaponPath(int key)
{
if (dicCosWeapon.ContainsKey(key))
return FormatString.CombineAllString(AddressableMgr.PCosWeapon, key.ToString());
return AddressableMgr.PCosWeaponBase;
}
public static bool IsCosClothHave(int key)
{
if (dicCosCloth.ContainsKey(key))
return dicCosCloth[key].have;
return false;
}
public static bool IsCosWeaponHave(int key)
{
if (dicCosWeapon.ContainsKey(key))
return dicCosWeapon[key].have;
return false;
}
// 의상 세트 이펙트 활성화 상태 체크.
public static bool IsActiveClothCosSetEffect(int setkey)
{
if (!dicCosClothSet.ContainsKey(setkey))
return false;
int[] costumes = dicCosClothSet[setkey].set;
for (int i = 0; i < costumes.Length; i++)
{
if (costumes[i] < 0) continue;
if (!dicCosCloth[costumes[i]].have)
{
return false;
}
}
return true;
}
// 무기 세트 이펙트 활성화 상태 체크.
public static bool IsActiveWeaponCosSetEffect(int setkey)
{
if (!dicCosWeaponSet.ContainsKey(setkey))
return false;
int[] costumes = dicCosWeaponSet[setkey].set;
for (int k = 0; k < costumes.Length; k++)
{
if (costumes[k] < 0)
continue;
if (!dicCosWeapon[costumes[k]].have)
{
return false;
}
}
return true;
}
// 의상 획득.
public static bool AddCosCloth(int key)
{
if (!dicCosCloth.ContainsKey(key))
return false;
if (dicCosCloth[key].have)
return false;
dCostume data = dicCosCloth[key];
data.have = true;
cosClothNew.Add(key);
BuffMgr.Instance.AddCostumeEfc(data.abilityType1, data.abilityValue1, false);
BuffMgr.Instance.AddCostumeEfc(data.abilityType2, data.abilityValue2, false);
dCostumeSet costumeset = GetCosClothSetByItem(key);
if (IsActiveClothCosSetEffect(costumeset.id))
BuffMgr.Instance.AddCostumeEfc(costumeset.abilityType, costumeset.abilityValue, false);
return true;
}
// 무기 획득.
public static bool AddCosWeapon(int key)
{
if (!dicCosWeapon.ContainsKey(key))
return false;
if (dicCosWeapon[key].have)
return false;
dCostume data = dicCosWeapon[key];
data.have = true;
cosWeaponNew.Add(key);
BuffMgr.Instance.AddCostumeEfc(data.abilityType1, data.abilityValue1, false);
BuffMgr.Instance.AddCostumeEfc(data.abilityType2, data.abilityValue2, false);
dCostumeSet costumeset = GetCosWeaponSetByItem(key);
if (IsActiveWeaponCosSetEffect(costumeset.id))
BuffMgr.Instance.AddCostumeEfc(costumeset.abilityType, costumeset.abilityValue, false);
return true;
}
#endregion Costume
#region Color
public static void LoadColors(dColor[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
int key = datas[i].id;
if (dicColor.ContainsKey(key))
{
dicColor[key] = datas[i];
}
else
{
dicColor.Add(key, datas[i]);
dicColorHave[0].Add(key, 0);
dicColorHave[1].Add(key, 0);
dicColorHave[2].Add(key, 0);
}
}
}
public static void LoadColorPlay(nIdCnt[] hairplaydatas, nIdCnt[] topplaydatas, nIdCnt[] eyeplaydatas)
{
for (int i = 0; i < hairplaydatas.Length; i++)
{
int key = hairplaydatas[i].sid;
if (dicColorHave[0].ContainsKey(key))
dicColorHave[0][key] = hairplaydatas[i].cnt;
}
for (int i = 0; i < topplaydatas.Length; i++)
{
int key = topplaydatas[i].sid;
if (dicColorHave[1].ContainsKey(key))
dicColorHave[1][key] = topplaydatas[i].cnt;
}
for (int i = 0; i < eyeplaydatas.Length; i++)
{
int key = eyeplaydatas[i].sid;
if (dicColorHave[2].ContainsKey(key))
dicColorHave[2][key] = eyeplaydatas[i].cnt;
}
}
public static Dictionary<int, int>[] GetColorCounts()
{
return dicColorHave;
}
public static Dictionary<int, dColor> GetColors()
{
return dicColor;
}
public static dColor GetColorData(int key)
{
if (dicColor.ContainsKey(key))
return dicColor[key];
return dicColor[cGoods.CClrHairBase];
}
public static Color GetColor(int key)
{
if (dicColor.ContainsKey(key))
return dicColor[key].realColor;
return dicColor[cGoods.CClrHairBase].realColor;
}
public static int GetColorCount(int iclrtype, int key)
{
if (dicColorHave[iclrtype].ContainsKey(key))
return dicColorHave[iclrtype][key];
return 0;
}
// 슬롯에 있는 색상인지.
public static bool IsColorInSlot(int iclrtype, int key)
{
int ilen = PlayEquipCostume.paletteOpens[iclrtype];
for (int i = 0; i < ilen; i++)
{
if (PlayEquipCostume.paletteSlots[iclrtype][i] == key)
return true;
}
return false;
}
// 슬롯 열기.
public static int OpenSlotColor(int iclrtype)
{
if (iclrtype < 0 || iclrtype >= PlayEquipCostume.paletteOpens.Length)
return -1;
if (PlayEquipCostume.paletteOpens[iclrtype] < Const.colorSlotMax)
PlayEquipCostume.paletteOpens[iclrtype]++;
return PlayEquipCostume.paletteOpens[iclrtype] - 1;
}
// 슬롯 변경.
public static bool ChangeSlotColor(int iclrtype, int index, int key)
{
// 색상 보유수량 감소.
if (!dicColorHave[iclrtype].ContainsKey(key) || dicColorHave[iclrtype][key] <= 0)
return false;
SubColor(iclrtype, key, 1);
PlayEquipCostume.paletteSlots[iclrtype][index] = key;
return true;
}
// 색상 획득.
public static void AddColor(int iclrtype, int key, int icount)
{
if (!dicColorHave[iclrtype].ContainsKey(key))
return;
dicColorHave[iclrtype][key] += icount;
if (dicColorHave[iclrtype][key] == icount)
{
colorNew[iclrtype].Add(key);
CustomizeMgr.SSetUpdateColor(iclrtype);
}
}
// 색상 감소.
public static void SubColor(int iclrtype, int key, int icount)
{
if (!dicColorHave[iclrtype].ContainsKey(key))
return;
dicColorHave[iclrtype][key] -= icount;
if (dicColorHave[iclrtype][key] <= 0)
CustomizeMgr.SSetUpdateColor(iclrtype);
}
// 코스튬 변경.
public static void ChangeCustomize(int icloth, int iweapon, int iclrhair, int iclrtop, int iclreye)
{
PlayEquipCostume.outfitId = icloth;
PlayEquipCostume.weaponId = iweapon;
PlayEquipCostume.hairColor = iclrhair;
PlayEquipCostume.topColor = iclrtop;
PlayEquipCostume.eyeColor = iclreye;
}
#endregion Color
#region Area & Monster
public static void LoadAreas(dArea[] datas)
{
Areas = datas;
}
public static void LoadMonsters(dMonster[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
int key = datas[i].id;
if (dicMonster.ContainsKey(key))
dicMonster[key] = datas[i];
else
dicMonster.Add(key, datas[i]);
}
}
public static void LoadBgs(dBg[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
int key = datas[i].id;
if (dicBg.ContainsKey(key))
dicBg[key] = datas[i];
else
dicBg.Add(key, datas[i]);
}
}
public static void LoadBgms(dBgm[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
int key = datas[i].id;
if (dicBgm.ContainsKey(key))
dicBgm[key] = datas[i];
else
dicBgm.Add(key, datas[i]);
}
}
public static dArea GetArea(int iareastage)
{
if (iareastage <= 100)
return Areas[0];
int iarea = (iareastage / 100) - 1;
if (iareastage >= Areas.Length)
return Areas[Areas.Length - 1];
return Areas[(iarea * 50 + iareastage % 100) - 1];
}
public static string GetMonsterPath(int idx)
{
if (dicMonster.ContainsKey(idx))
return dicMonster[idx].path;
return "null";
}
public static int GetMonsterSpeed(int idx)
{
if (dicMonster.ContainsKey(idx))
return dicMonster[idx].speed;
return 0;
}
public static int GetMonsterGroup(int idx)
{
if (dicMonster.ContainsKey(idx))
return dicMonster[idx].group;
return 0;
}
public static dBg GetBg(int idx)
{
if (dicBg.ContainsKey(idx))
return dicBg[idx];
return dicBg[1];
}
public static bool IsAvailBgm(int idx)
{
if (dicBgm.ContainsKey(idx))
return true;
return false;
}
public static string GetBgmPath(int idx)
{
if (dicBgm.ContainsKey(idx))
{
return dicBgm[idx].path;
}
return "intro";//없을때 디폴트
}
#endregion Area & Monster
#region Stage
public static bool ClearStage(bool bgonext)
{
bool stageClear = false;
bool bareachange = false;
if (PlayData.curStage > PlayData.clearStage)
{
PlayData.clearStage = PlayData.curStage;
stageClear = true;
SetPassProgress(eCondition.StageClear, PlayData.clearStage);
}
if (bgonext)
{
// 플레이 데이터의 스테이지 값은 (지역번호 * 100) + 스테이지 번호.
int iarea = PlayData.curStage / 100;
int istage = PlayData.curStage % 100;
if (istage < Const.stageMax)
{
PlayData.curStage++;
}
else if (iarea < Areas.Length)
{
bareachange = true;
iarea++;
PlayData.curStage = iarea * 100 + 1;
}
}
BattleMgr.SStageMoveSave(stageClear);
PlayData.Save();
return bareachange;
}
public static void FailStage()
{
// 플레이 데이터의 스테이지 값은 (지역번호 * 100) + 스테이지 번호.
int iarea = PlayData.curStage / 100;
int istage = PlayData.curStage % 100;
if (istage > 1)
{
PlayData.curStage--;
}
else if (iarea > 1)
{
iarea--;
PlayData.curStage = iarea * 100 + Const.stageMax;
}
PlayData.Save();
}
public static void GoToStage(int iarea, int istage)
{
if (iarea > Areas.Length)
iarea = Areas.Length;
if (istage > Const.stageMax)
istage = Const.stageMax;
int iareastage = iarea * 100 + istage;
int imaxareastage = SettingMgr.SGetTest() ? iareastage : GetMaxStage();
if (iareastage <= imaxareastage)
PlayData.curStage = iareastage;
else
PlayData.curStage = imaxareastage;
PlayData.Save();
}
// 플레이 가능한 스테이지인지.
public static bool IsAvailStage(int iareastage)
{
return iareastage <= GetMaxStage();
}
// 클리어한 스테이지인지.
public static bool IsClearStage(int iareastage)
{
return iareastage <= PlayData.clearStage;
}
// 플레이 가능한 최고 스테이지.
public static int GetMaxStage()
{
// 플레이 데이터의 스테이지 값은 (지역번호 * 100) + 스테이지 번호.
int iarea = PlayData.clearStage / 100;
int istage = PlayData.clearStage % 100;
if (istage < Const.stageMax)
return PlayData.clearStage + 1;
if (iarea < Areas.Length)
return (iarea + 1) * 100 + 1;
return PlayData.clearStage;
}
#endregion Stage
#region Player Level
public static void LoadPlayerLevels(dPlayerLv[] datas)
{
PlayerLevels = datas;
}
public static BigInteger CalcCharLvUpPriceAccum1(int curlevel, int addlevel, double buyingCntInc, BigInteger buyingCnt)
{
if (/*curlevel < 1 ||*/ addlevel < 1)
return buyingCnt;
double ftargetlv = curlevel + addlevel - 1d;
ftargetlv = System.Math.Pow(buyingCntInc, ftargetlv) - 1d;
double fcurlv = curlevel - 1d;
fcurlv = System.Math.Pow(buyingCntInc, fcurlv) - 1d;
ftargetlv -= fcurlv;
ftargetlv *= buyingCntInc;
ftargetlv /= (buyingCntInc - 1d);
return buyingCnt * (BigInteger)(ftargetlv * 100) / 100;
}
public static float GetPlayerExpRate()
{
if (PlayData == null)
return 0f;
int imaxlv = Const.playerMaxLv;
int iplayerLv = PlayData.playerLv;
//igInteger calcmultiply = BigInteger.Pow(Const.playerLvExpInc, iplayerLv);
//igInteger calcdivide = BigInteger.Pow(dConst.RateMaxBi, iplayerLv);
//BigInteger bimaxExp = Const.playerLvExp * calcmultiply / calcdivide;
//BigInteger bimaxExp = Const.playerLvExp * BigInteger.Pow(Const.playerLvExpInc, iplayerLv) / BigInteger.Pow(dConst.RateMaxBi, iplayerLv);
BigInteger bimaxExp = CalcCharLvUpPriceAccum1(PlayData.playerLv % 1000, 1, (double)Const.playerLvExpInc / dConst.RateMax, DataHandler.PlayerLevelInterval(PlayData.playerLv));
if ((iplayerLv == imaxlv && PlayData.playerExp >= bimaxExp) || iplayerLv > imaxlv)
return 1f;
BigInteger birate = PlayData.playerExp * dConst.RateMax / bimaxExp;
return (float)birate / dConst.RateMaxFloat;
}
public static bool AddPlayerExp(BigInteger iaddexp)
{
if (PlayData == null)
return false;
// 최대 레벨이며 경험치 가득 찼을 경우.
int imaxlv = Const.playerMaxLv;
int iplayerLv = PlayData.playerLv;
BigInteger bimaxExp = CalcCharLvUpPriceAccum1(PlayData.playerLv % 1000, 1, (double)Const.playerLvExpInc / dConst.RateMax, DataHandler.PlayerLevelInterval(PlayData.playerLv));
if ((iplayerLv == imaxlv && PlayData.playerExp >= bimaxExp) || iplayerLv > imaxlv)
{
return false;
}
// 현재 레벨부터 최대 레벨 직전 레벨까지.
int ilvpointadd = 0;
BigInteger ibefexp = PlayData.playerExp;
for (int i = iplayerLv - 1; i <= imaxlv; i++)
{
BigInteger isubexp = bimaxExp - ibefexp - iaddexp;
// 레벨업을 못할 경우.
if (isubexp > 0)
{
PlayData.playerExp = ibefexp + iaddexp;
if (ilvpointadd > 0)
{
AddLvPoint(ilvpointadd);
PlayData.Save();
}
EnhanceMgr.RefreshPlayerExpInfo();
return ilvpointadd > 0;
}
// 최대 레벨일 경우.
if (i == imaxlv)
{
PlayData.playerExp = bimaxExp;
if (ilvpointadd > 0)
{
AddLvPoint(ilvpointadd);
PlayData.Save();
}
EnhanceMgr.RefreshPlayerExpInfo();
return ilvpointadd > 0;
}
// 레벨업 할 경우.
PlayData.playerLv++;
// 포인트는 현재 상수로 1씩
ilvpointadd += 1;
iaddexp = iaddexp - (bimaxExp - ibefexp);
ibefexp = 0;
SetPassProgress(eCondition.PlayerLv, PlayData.playerLv);
EnhanceMgr.RefreshPlayerExpInfo();
BattleMgr.LevelUpEffectOn();
EnhanceMgr.levelUpScrolRefresh();
bimaxExp = CalcCharLvUpPriceAccum1(PlayData.playerLv % 1000, 1, (double)Const.playerLvExpInc / dConst.RateMax, DataHandler.PlayerLevelInterval(PlayData.playerLv));
CheckSkillsOpen();
}
if (ilvpointadd > 0)
{
AddLvPoint(ilvpointadd);
PlayData.Save();
}
return ilvpointadd > 0;
}
#endregion Player Level
#region Char Stats
public static void LoadCharStatsEnhanceGoldData(nIdLv[] playdatas)
{
for (int i = 0; i < playdatas.Length; ++i)
{
if (dicCharStatEnhanceGold.TryGetValue(playdatas[i].sid, out dCharStat charStat))
{
charStat.level = playdatas[i].lv;
// 해금 조건이 없거나, 있는데 해금 조건을 만족했을 경우.
if (charStat.condType == 0 || GetCharStatLevel(charStat.condType) >= charStat.condValue)
{
BuffMgr.Instance.ChangeCharStat(charStat.abilityType, charStat.abilityValue + (charStat.abilityValueInc * charStat.level), false);
}
}
}
}
public static Dictionary<int, dCharStat> GetCharStats()
{
return dicCharStatEnhanceGold;
}
public static dCharStat GetCharStat(int key)
{
if (dicCharStatEnhanceGold.ContainsKey(key))
return dicCharStatEnhanceGold[key];
return null;
}
public static int GetCharStatLevel(int key)
{
if (dicCharStatEnhanceGold.ContainsKey(key))
return dicCharStatEnhanceGold[key].level;
return 0;
}
public static int GetCharStatUnlockID(eEffectType unlockType)
{
int condKey = 1;
switch (unlockType)
{
case eEffectType.None:
condKey = 1;
break;
case eEffectType.AtkBase:
condKey = 1;
break;
case eEffectType.HpBase:
condKey = 2;
break;
case eEffectType.CrtRate:
condKey = 3;
break;
default:
break;
}
return condKey;
}
public static bool LvUpCharStatMulti(int key, int ilevel, int cost, int nextStat)
{
if (!dicCharStatEnhanceGold.ContainsKey(key))
return false;
int iprice = cost;
if (iprice > Goods.gold)
return false;
SubGold(cost);
dicCharStatEnhanceGold[key].level = ilevel;
//BuffMgr.Instance.ChangeCharStat(dicCharStat[key].abilityType, dicCharStat[key].abilityValue + (dicCharStat[key].abilityValueInc * ilevel));
BuffMgr.Instance.ChangeCharStat(dicCharStatEnhanceGold[key].abilityType, nextStat, true);
return true;
}
public static void LvUpCharStatServer(int key, int ilevel, BigInteger biprice, int nextStat)
{
if (!dicCharStatEnhanceGold.ContainsKey(key))
return;
SubGold(biprice);
dicCharStatEnhanceGold[key].level = ilevel;
BuffMgr.Instance.ChangeCharStat(dicCharStatEnhanceGold[key].abilityType, nextStat, true);
}
#endregion Char Stats
#region Char LvPoints
public static void LoadCharLvPoints(dCharStat[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
int key = datas[i].id;
if (dicCharStatEnhancePoint.ContainsKey(key))
dicCharStatEnhancePoint[key] = datas[i];
else
dicCharStatEnhancePoint.Add(key, datas[i]);
}
}
public static void LoadCharLvPointsPlay(nIdLv[] playdatas)
{
for (int i = 0; i < playdatas.Length; i++)
{
int key = playdatas[i].sid;
if (dicCharStatEnhancePoint.ContainsKey(key))
{
dicCharStatEnhancePoint[key].level = playdatas[i].lv;
if (PlayData.playerLv >= dicCharStatEnhancePoint[key].condValue)
{
BuffMgr.Instance.ChangeCharLvPoint(dicCharStatEnhancePoint[key].abilityType, dicCharStatEnhancePoint[key].abilityValue + (dicCharStatEnhancePoint[key].abilityValueInc * dicCharStatEnhancePoint[key].level), false);
}
else
{
continue;
}
//BuffMgr.Instance.ChangeCharLvPoint(dicCharLvPoint[key].abilityType, abilityValue + (abilityValueInc * (dicCharLvPoint[key].level - minusLv)), false);
}
}
}
public static Dictionary<int, dCharStat> GetCharLvPoints()
{
return dicCharStatEnhancePoint;
}
public static dCharStat GetCharLvPoint(int key)
{
if (dicCharStatEnhancePoint.ContainsKey(key))
return dicCharStatEnhancePoint[key];
return null;
}
public static int GetCharLvPointLevel(int key)
{
if (dicCharStatEnhancePoint.ContainsKey(key))
return dicCharStatEnhancePoint[key].level;
return 0;
}
public static bool LvUpCharLvPointMulti(int key, int ilevel, int cost, int nextStat)
{
if (!dicCharStatEnhancePoint.ContainsKey(key))
return false;
int iprice = cost;
if (iprice > Goods.point)
return false;
SubLvPoint(iprice);
dicCharStatEnhancePoint[key].level = ilevel;
//BuffMgr.Instance.ChangeCharLvPoint(dicCharLvPoint[key].abilityType, dicCharLvPoint[key].abilityValue + (dicCharLvPoint[key].abilityValueInc * ilevel));
BuffMgr.Instance.ChangeCharLvPoint(dicCharStatEnhancePoint[key].abilityType, nextStat, true);
return true;
}
public static void LvUpCharPointServer(int key, int ilevel, int iprice, int nextStat)
{
if (!dicCharStatEnhancePoint.ContainsKey(key))
return;
//SubLvPoint(iprice);
dicCharStatEnhancePoint[key].level = ilevel;
BuffMgr.Instance.ChangeCharLvPoint(dicCharStatEnhancePoint[key].abilityType, nextStat, true);
}
public static void AllResetLvPoint()
{
foreach (var item in dicCharStatEnhancePoint)
{
dicCharStatEnhancePoint[item.Key].level = 1;
}
}
#endregion Char LvPoints
#region DungeonInfo
public static void LoadSysGuardian(dSysGuardian[] datas)
{
sysGuardian = new Dictionary<int, dSysGuardian>();
for (int i = 0; i < datas.Length; i++)
{
if (sysGuardian.ContainsKey(datas[i].guardianType))
{
sysGuardian[datas[i].guardianType] = datas[i];
}
else
{
sysGuardian.Add(datas[i].guardianType, datas[i]);
}
}
}
public static Dictionary<int, dSysGuardian> GetSysGuardians()
{
return sysGuardian;
}
public static dSysGuardian GetSysGuardian(int type)
{
return sysGuardian[type];
}
public static dDungeonInfo GetDungeonTypeInfo(DungeonMgr.DungeonKind type)
{
switch (type)
{
case DungeonMgr.DungeonKind.GoldDG:
return sysDgGold;
case DungeonMgr.DungeonKind.EnhanceStoneDG:
return sysDgReinStone;
case DungeonMgr.DungeonKind.PetDG:
return sysDgPet;
case DungeonMgr.DungeonKind.AwakenStoneDG:
return sysDgAwakenStone;
case DungeonMgr.DungeonKind.AwakenDG:
return sysDgAwaken;
case DungeonMgr.DungeonKind.GuardianDG:
int guardian = (DungeonMgr.GetDungeonKind() == DungeonMgr.DungeonKind.GuardianDG) ? GuardianMgr.GetGuardianId() : 0;
return sysDgGuardian[guardian - 1];
case DungeonMgr.DungeonKind.relicDG:
return sysDgRelic;
default:
return null;
}
}
public static int GetDungeonTicketCount(DungeonMgr.DungeonKind type)
{
switch (type)
{
case DungeonMgr.DungeonKind.GoldDG:
return PlayDgGold.ticket;
case DungeonMgr.DungeonKind.EnhanceStoneDG:
return PlayDgReinStone.ticket;
case DungeonMgr.DungeonKind.PetDG:
return PlayDgPet.ticket;
case DungeonMgr.DungeonKind.AwakenStoneDG:
return PlayDgAwakenStone.ticket;
case DungeonMgr.DungeonKind.AwakenDG:
return PlayDgAwaken.ticket;
case DungeonMgr.DungeonKind.relicDG:
return PlayDgRelic.ticket;
default:
return 0;
}
}
#endregion
#region DungeonClear
public static void LoadAwakenDungeonData(cPlayerDungeonInfo data)
{
PlayDgAwaken = data;
if (data.lv != 1)
BuffMgr.Instance.ChangeAwakenDungeonStat(data.lv - 1);
}
public static void LoadGuardianDungeonData(cPlayerDungeonInfo[] data)
{
if (PlayDgGuardian == null)
{
PlayDgGuardian = new Dictionary<int, cPlayerDungeonInfo>();
}
for (int i = 0; i < data.Length; ++i)
{
PlayDgGuardian.SafeInsert(data[i].sid, data[i]);
}
}
public static cPlayerDungeonInfo GetPlayerDungeonInfo(int i)
{
return PlayDgGuardian[i];
}
public static cPlayerDungeonInfo GetPlayerDungeonInfoKind(DungeonMgr.DungeonKind kind, int guardian = 0)
{
switch (kind)
{
case DungeonMgr.DungeonKind.GoldDG:
return PlayDgGold;
case DungeonMgr.DungeonKind.EnhanceStoneDG:
return PlayDgReinStone;
case DungeonMgr.DungeonKind.PetDG:
return PlayDgPet;
case DungeonMgr.DungeonKind.AwakenStoneDG:
return PlayDgAwakenStone;
case DungeonMgr.DungeonKind.AwakenDG:
return PlayDgAwaken;
case DungeonMgr.DungeonKind.GuardianDG:
return PlayDgGuardian[guardian];
case DungeonMgr.DungeonKind.relicDG:
return PlayDgRelic;
default:
return null;
}
}
public static Dictionary<int, cPlayerDungeonInfo> GetPlayDungeonGuardians()
{
return PlayDgGuardian;
}
public static int GetDungeonClearLevel(DungeonMgr.DungeonKind i)
{
switch (i)
{
case DungeonMgr.DungeonKind.GoldDG:
return PlayDgGold.lv - 1;
case DungeonMgr.DungeonKind.EnhanceStoneDG:
return PlayDgReinStone.lv - 1;
case DungeonMgr.DungeonKind.PetDG:
return PlayDgPet.lv - 1;
case DungeonMgr.DungeonKind.AwakenStoneDG:
return PlayDgAwakenStone.lv - 1;
case DungeonMgr.DungeonKind.AwakenDG:
return PlayDgAwaken.lv - 1;
case DungeonMgr.DungeonKind.relicDG:
return PlayDgRelic.lv - 1;
default:
return 0;
}
}
public static void LoadDungeonPreset(cDungeonPreset data)
{
cDungeonPreset localData = cDungeonPreset.Load(data);
PlayDgPreset = data;
data = localData;
}
#endregion
#region Awaken
public static void LoadAwakenData(cAwakenData data)
{
cAwakenData localdata = cAwakenData.Load(data);
PlayAwaken = data;
data.OnAfterDeserialize();
PlayAwaken.usePreset = localdata.usePreset;
PlayAwaken.awakenUnlock = localdata.awakenUnlock;
EnhanceMgr.StartSetAwakenPreset();
}
public static void SaveAwakenPreset()
{
PlayAwaken.Save();
}
public static cAwakenData GetServerAwakenSlots()
{
return PlayAwaken;
}
public static void SetServerAwakenSlot(cAwakenData data, int preset)
{
PlayAwaken = data;
PlayAwaken.usePreset = preset;
}
public static void AwakenSlotUnlock(int key)
{
//enhanceAwakenSlot.awaken++;
EnhanceMgr.SetSelected(key);
EnhanceMgr.UnlockSlot(key);
}
public static void btnAwakenPresetSet(int preset, bool isSave)
{
PlayAwaken.usePreset = preset;
if (isSave)
{
PlayAwaken.Save();
}
}
public static void LoadPlayGuardian(cPlayGuardian[] data)
{
if (PlayGuardian == null)
{
PlayGuardian = new Dictionary<int, cPlayGuardian>();
}
for (int i = 0; i < data.Length; i++)
{
if (PlayGuardian.ContainsKey(data[i].guardianType))
{
PlayGuardian[data[i].guardianType] = data[i];
}
else
{
PlayGuardian.Add(data[i].guardianType, data[i]);
}
}
}
public static Dictionary<int, cPlayGuardian> GetPlayGuardians()
{
return PlayGuardian;
}
public static cPlayGuardian GetPlayGuardian(int i)
{
if (!PlayGuardian.ContainsKey(i))
{
return null;
}
return PlayGuardian[i];
}
public static void SetPlayGuardian(int type, cPlayGuardian data)
{
PlayGuardian[type] = data;
}
public static void SetPlayGuardianExtra(int type, int[] extra)
{
PlayGuardian[type].extras = extra;
}
#endregion
#region MaskRelic
public static void LoadSysRelic(dSysRelic[] datas)
{
sysRelic = new Dictionary<int, dSysRelic[]>();
for (int i = 0; i < datas.Length; i++)
{
if (sysRelic.ContainsKey(datas[i].relicType))
{
sysRelic[datas[i].relicType] = datas;
}
else
{
sysRelic.Add(datas[i].relicType, datas);
}
}
}
public static void LoadSysRelicProps(dSysRelicEnhanceProp datas)
{
sysRelicEnhancePropLvs = datas.lv;
sysRelicEnhanceProp = datas.props;
}
public static Dictionary<int, dSysRelic[]> GetSysRelics()
{
return sysRelic;
}
public static dSysRelic[] GetSysRelic(int relicType)
{
return sysRelic[relicType];
}
public static int GetSysRelicPropLvs(int index)
{
return sysRelicEnhancePropLvs[index];
}
public static int GetSysRelicProp(int index)
{
return sysRelicEnhanceProp[index];
}
public static void LoadPlayRelic(cPlayRelic[] data)
{
if (PlayRelic == null)
{
PlayRelic = new Dictionary<int, cPlayRelic>();
}
for (int i = 0; i < data.Length; i++)
{
if (PlayRelic.ContainsKey(data[i].relicType))
{
PlayRelic[data[i].relicType] = data[i];
}
else
{
PlayRelic.Add(data[i].relicType, data[i]);
}
}
}
public static cPlayRelic GetPlayRelic(int relicType)
{
return PlayRelic[relicType];
}
public static void SetPlayRelic(int tab, cPlayRelic saveRelic)
{
PlayRelic[tab] = saveRelic;
}
public static bool LvUpRelicEnhance(int key)
{
if (!PlayRelic.ContainsKey(key))
return false;
int iprop = GetRelicEnhanceProp(PlayRelic[key].ancientLv);
if (Random.Range(0, dConst.RateMax) >= iprop)
return false;
return true;
}
// 보물 레벨업 확률.
public static int GetRelicEnhanceProp(int ilevel)
{
int imaxindex = sysRelicEnhancePropLvs.Length - 1;
if (ilevel >= sysRelicEnhancePropLvs[imaxindex])
return sysRelicEnhanceProp[imaxindex];
for (int i = 1; i <= imaxindex; i++)
{
if (ilevel < sysRelicEnhancePropLvs[i])
return sysRelicEnhanceProp[i - 1];
}
return 0;
}
#endregion
#region Extra Ability
public static void LoadExtraAbility(dExtraRarity[] rates, dExtraAbility[] abilities)
{
extraRarityRates = new int[rates.Length];
extraAbilityIds = new Dictionary<eEffectType, int>[rates.Length];
extraAbilities = new Dictionary<int, dExtraAbility>();
for (int i = 0; i < rates.Length; i++)
{
extraAbilityIds[i] = new Dictionary<eEffectType, int>();
extraRarityRates[i] = rates[i].prop;
}
for (int i = 0; i < abilities.Length; i++)
{
int key = abilities[i].id;
extraAbilities.SafeInsert(new KeyValuePair<int, dExtraAbility>(key, abilities[i]));
eEffectType type = abilities[i].abilityType;
if (extraAbilityIds[0].ContainsKey(type))
{
extraAbilityIds[abilities[i].rarity - 1][type] = key;
}
else
{
for (int j = 0; j < rates.Length; j++)
{
extraAbilityIds[j].Add(type, key);
}
}
}
BuffMgr.Instance.InitExtra();
}
// 희귀도별 확률.
public static int GetExtraRarityRate(int irarity)
{
if (irarity <= 0 || irarity > cGoods.RMyth)
return 0;
return extraRarityRates[irarity - 1];
}
// 전체 희귀도 효과 값.
public static Dictionary<eEffectType, int>[] GetExtraAbilityIds()
{
return extraAbilityIds;
}
// 희귀도별 효과 정보.
public static dExtraAbility GetExtraAbility(int key)
{
if (extraAbilities.ContainsKey(key))
return extraAbilities[key];
return null;
}
// 희귀도별 효과 정보.
public static dExtraAbility GetExtraAbilityByType(int irarity, eEffectType type)
{
if (irarity <= 0 || irarity > cGoods.RMyth)
return null;
if (!extraAbilityIds[irarity - 1].ContainsKey(type))
return null;
int key = extraAbilityIds[irarity - 1][type];
return extraAbilities[key];
}
// 희귀도별 효과 값.
public static int GetExtraAbilityValue(int key)
{
if (extraAbilities.ContainsKey(key))
return extraAbilities[key].abilityValue;
return 0;
}
// 희귀도별 효과 값.
public static int GetExtraAbilityValueByType(int irarity, eEffectType type)
{
if (irarity <= 0 || irarity > cGoods.RMyth)
return 0;
if (!extraAbilityIds[irarity - 1].ContainsKey(type))
return 0;
int key = extraAbilityIds[irarity - 1][type];
return extraAbilities[key].abilityValue;
}
#endregion Extra Ability
#region Bag - Equip
static void LoadSysGearEquipment(int equipmentType, dGear[] datas)
{
if (!dicGearEquipment.TryGetValue(equipmentType, out Dictionary<int, dGear> targetDic)) return;
int ilastid = 1;
int irarity = cGoods.RMyth;
int igrade = 0;
for (int i = 0; i < datas.Length; ++i)
{
dGear gear = datas[i];
targetDic.SafeInsert(gear.id, gear);
if ((irarity < gear.rarity) || (irarity == gear.rarity && igrade < gear.grade))
{
ilastid = gear.id;
irarity = gear.rarity;
igrade = gear.grade;
}
}
if(dicGearLast.ContainsKey(equipmentType))
{
dicGearLast[equipmentType] = ilastid;
}
}
static void LoadPlayGearEquipment(int equipmentType, nIdLvInfo[] datas)
{
if (!dicGearEquipment.TryGetValue(equipmentType, out Dictionary<int, dGear> targetDic)) return;
int totalLevelOfPossession = 0;
int ilastid = -1;
int irarity = cGoods.RNone;
int igrade = 0;
for (int i = 0; i < datas.Length; i++)
{
nIdLvInfo lvInfo = datas[i];
if (!targetDic.TryGetValue(lvInfo.sid, out dGear targetGear)) continue;
targetGear.have = lvInfo.have;
targetGear.count = lvInfo.cnt;
targetGear.awaken = lvInfo.awaken;
targetGear.level = lvInfo.lv;
targetGear.extraEffects = targetGear.maxAwaken > 1 ? lvInfo.extras : null;
if (targetGear.have)
{
totalLevelOfPossession += targetGear.level;
if ((irarity < targetGear.rarity) || (irarity == targetGear.rarity && igrade < targetGear.grade))
{
ilastid = targetGear.id;
irarity = targetGear.rarity;
igrade = targetGear.grade;
}
}
}
if (dicGearLastHave.ContainsKey(equipmentType))
{
dicGearLastHave[equipmentType] = ilastid;
}
CalcGearLevelEffect(equipmentType, totalLevelOfPossession, false);
CalcGearEquipEffect(equipmentType);
CalcGearEquipExtra(equipmentType);
}
// 현재 장착중인 장비.
public static int GetEquipedGear(int itype)
{
switch (itype)
{
case cGoods.TBagWeapon:
return PlayData.weapon;
case cGoods.TBagArmorCape:
return PlayData.cape;
case cGoods.TBagArmorHat:
return PlayData.hat;
case cGoods.TBagArmorShoes:
return PlayData.shoes;
case cGoods.TBagAcceEar:
return PlayData.earring;
case cGoods.TBagAcceNeck:
return PlayData.necklace;
case cGoods.TBagAcceRing:
return PlayData.ring;
default:
return 0;
}
}
// 장비 장착.
public static bool EquipGear(int itype, int key)
{
if (!dicGearEquipment.TryGetValue(itype, out Dictionary<int, dGear> gears) ||
!gears.TryGetValue(key, out dGear targetGear) ||
!targetGear.have)
return false;
switch (itype)
{
case cGoods.TBagWeapon:
PlayData.weapon = key;
break;
case cGoods.TBagArmorCape:
PlayData.cape = key;
break;
case cGoods.TBagArmorHat:
PlayData.hat = key;
break;
case cGoods.TBagArmorShoes:
PlayData.shoes = key;
break;
case cGoods.TBagAcceEar:
PlayData.earring = key;
break;
case cGoods.TBagAcceNeck:
PlayData.necklace = key;
break;
case cGoods.TBagAcceRing:
PlayData.ring = key;
break;
}
PlayData.Save();
CalcGearEquipEffect(itype);
CalcGearEquipExtra(itype);
return true;
}
// 장비 플레이 정보 업데이트(합성 후 호출).
public static void UpdateGearEquipsPlay(int itype, nIdLvInfo[] datas)
{
int ilvadd = 0;
int ilastid = dicGearLastHave[itype];
int irarity = cGoods.RNone;
int igrade = 0;
if (ilastid >= 0)
{
irarity = dicGearEquipment[itype][ilastid].rarity;
igrade = dicGearEquipment[itype][ilastid].grade;
}
for (int i = 0; i < datas.Length; i++)
{
int key = datas[i].sid;
if (!dicGearEquipment[itype].ContainsKey(key))
continue;
if (!datas[i].have)
continue;
dGear data = dicGearEquipment[itype][key];
if (!data.have)
{
data.have = true;
ilvadd += datas[i].lv;
if ((irarity < data.rarity) || (irarity == data.rarity && igrade < data.grade))
{
ilastid = key;
irarity = data.rarity;
igrade = data.grade;
}
}
data.count = datas[i].cnt;
data.awaken = datas[i].awaken;
data.level = datas[i].lv;
if (data.maxAwaken > 1)
data.extraEffects = datas[i].extras;
}
dicGearLastHave[itype] = ilastid;
LoadCurGearHave();
// 레벨 효과 계산.
CalcGearLevelEffect(itype, ilvadd, false);
}
// 장비 최고 레벨.
public static int GetGearMaxLv(int itype, int key)
{
int index = dicGearEquipment[itype][key].awaken - 1;
if (index >= sysGearAwakens.Length)
index = sysGearAwakens.Length - 1;
else if (index < 0)
index = 0;
return sysGearAwakens[index].maxLv;
}
// 장비 각성 단계 정보.
public static dAwaken GetGearAwakenNext(int itype, int key)
{
int index = dicGearEquipment[itype][key].awaken;
if (index >= sysGearAwakens.Length)
index = sysGearAwakens.Length - 1;
else if (index < 0)
index = 0;
return sysGearAwakens[index];
}
// 장비 각성 필요 재료.
public static int[] GetGearAwakenNeeds(int itype, int key)
{
int[] ineeds = new int[3] { key, -1, -1 };
dGear gear = dicGearEquipment[itype][key];
int irarity1 = gear.rarity;
int igrade1 = gear.grade - 1;
if (igrade1 <= 0)
{
irarity1--;
igrade1 += cGoods.GMax;
}
int irarity2 = gear.rarity;
int igrade2 = gear.grade - 2;
if (igrade2 <= 0)
{
irarity2--;
igrade2 += cGoods.GMax;
}
foreach (var item in dicGearEquipment[itype])
{
if (item.Value.rarity == irarity1 && item.Value.grade == igrade1)
{
ineeds[1] = item.Key;
if (ineeds[2] >= 0)
break;
}
if (item.Value.rarity == irarity2 && item.Value.grade == igrade2)
{
ineeds[2] = item.Key;
if (ineeds[1] >= 0)
break;
}
}
return ineeds;
}
// 장비 통합 레벨 효과 계산 및 적용.
private static bool CalcGearLevelEffect(int itype, int iaddlv, bool brecalc)
{
int prevlv = dicGearLv[itype];
dicGearLv[itype] += iaddlv;
int nextlv = dicGearLv[itype];
int prevefc = -1;
int nextefc = -1;
for (int i = sysGearLvEffects.Length - 1; i >= 0; i--)
{
if (nextefc < 0 && nextlv >= sysGearLvEffects[i].totalLv)
{
nextefc = i;
}
if (prevefc < 0 && prevlv >= sysGearLvEffects[i].totalLv)
{
prevefc = i;
break;
}
}
// 이전 효과와 다르고 적용 효과가 있을 경우.
if (nextefc != prevefc && nextefc >= 0)
{
BuffMgr.Instance.SetGearLv(itype, sysGearLvEffects[nextefc].value, true);
return true;
}
return false;
}
/// <summary>
/// 장비 통합 레벨 정보.
/// </summary>
/// <param name="itype">장비 타입. cGoods.TBagX</param>
/// <returns>0:현재 통합 레벨, 1:현재 단계, 2:현재 단계 효과 값, 3:다음 단계 통합 레벨.</returns>
public static int[] GetGearTotalLevels(int itype)
{
int[] ilvs = new int[4];
ilvs[0] = dicGearLv[itype];
for (int i = sysGearLvEffects.Length - 1; i >= 0; i--)
{
if (ilvs[0] >= sysGearLvEffects[i].totalLv)
{
ilvs[1] = i + 1;
ilvs[2] = sysGearLvEffects[i].value;
if (i < (sysGearLvEffects.Length - 1))
ilvs[3] = sysGearLvEffects[i + 1].totalLv;
else
ilvs[3] = sysGearLvEffects[i].totalLv;
break;
}
}
return ilvs;
}
// 장비 장착 효과 계산 및 적용.
private static void CalcGearEquipEffect(int itype)
{
int key;
switch (itype)
{
case cGoods.TBagWeapon:
key = PlayData.weapon;
break;
case cGoods.TBagArmorCape:
key = PlayData.cape;
break;
case cGoods.TBagArmorHat:
key = PlayData.hat;
break;
case cGoods.TBagArmorShoes:
key = PlayData.shoes;
break;
case cGoods.TBagAcceEar:
key = PlayData.earring;
break;
case cGoods.TBagAcceNeck:
key = PlayData.necklace;
break;
case cGoods.TBagAcceRing:
key = PlayData.ring;
break;
default:
return;
}
if (key < 0)
return;
dGear gear = dicGearEquipment[itype][key];
if (gear.abilityType3 != eEffectType.None)
{
long ivalue = gear.abilityValue3 + ((gear.abilityValue3 * gear.abilityValueInc3 / dConst.RateDivideLong) * (gear.level - 1));//// (long)MathF.Pow(dConst.RateDivideInt2, gear.level); // (gear.level - 1) * gear.abilityValueInc3 + gear.abilityValue3;
BuffMgr.Instance.SetGearEquip(itype, gear.abilityType3, ivalue, false);
}
if (gear.abilityType2 != eEffectType.None)
{
long ivalue = gear.abilityValue2 + ((gear.abilityValue2 * gear.abilityValueInc2 / dConst.RateDivideLong) * (gear.level - 1));// (long)MathF.Pow(dConst.RateDivideInt2, gear.level);
BuffMgr.Instance.SetGearEquip(itype, gear.abilityType2, ivalue, false);
}
if (gear.abilityType1 != eEffectType.None)
{
long ivalue = gear.abilityValue1 + ((gear.abilityValue1 * gear.abilityValueInc1 / dConst.RateDivideLong) * (gear.level - 1));// (long)MathF.Pow(dConst.RateDivideInt2, gear.level);
BuffMgr.Instance.SetGearEquip(itype, gear.abilityType1, ivalue, true);
}
}
// 장비 추가 효과 계산 및 적용.
public static void CalcGearEquipExtra(int itype)
{
int key;
switch (itype)
{
case cGoods.TBagWeapon:
key = PlayData.weapon;
break;
case cGoods.TBagArmorCape:
key = PlayData.cape;
break;
case cGoods.TBagArmorHat:
key = PlayData.hat;
break;
case cGoods.TBagArmorShoes:
key = PlayData.shoes;
break;
case cGoods.TBagAcceEar:
key = PlayData.earring;
break;
case cGoods.TBagAcceNeck:
key = PlayData.necklace;
break;
case cGoods.TBagAcceRing:
key = PlayData.ring;
break;
default:
return;
}
if (key < 0)
return;
dGear gear = dicGearEquipment[itype][key];
if (gear.awaken <= 1 || gear.extraEffects == null)
{
BuffMgr.Instance.SetGearExtra(itype, 2, eEffectType.None, 0L, false);
BuffMgr.Instance.SetGearExtra(itype, 1, eEffectType.None, 0L, false);
BuffMgr.Instance.SetGearExtra(itype, 0, eEffectType.None, 0L, true);
return;
}
int[] extras = gear.extraEffects;
for (int i = extras.Length - 1; i >= 0; i--)
{
if (extras[i] < 0)
{
BuffMgr.Instance.SetGearExtra(itype, i, eEffectType.None, 0L, i == 0);
}
else
{
dExtraAbility ability = GetExtraAbility(extras[i]);
BuffMgr.Instance.SetGearExtra(itype, i, ability.abilityType, ability.abilityValue, i == 0);
}
}
}
public static Dictionary<int, dGear> GetGearEquips(int itype)
{
return dicGearEquipment[itype];
}
public static dGear GetGearEquip(int itype, int key)
{
if (dicGearEquipment[itype].ContainsKey(key))
return dicGearEquipment[itype][key];
return null;
}
public static int GetGearEquipByGrade(int itype, int irarity, int igrade)
{
Dictionary<int, dGear> datas = dicGearEquipment[itype];
foreach (var item in datas)
{
if (item.Value.rarity == irarity && item.Value.grade == igrade)
return item.Key;
}
return -1;
}
public static int GetGearEquipLast(int itype)
{
return dicGearLast[itype];
}
public static int GetGearEquipRarity(int itype, int key)
{
if (dicGearEquipment[itype].ContainsKey(key))
return dicGearEquipment[itype][key].rarity;
return 0;
}
public static bool AddGearEquip(int itype, int key, int icount)
{
if (!dicGearEquipment[itype].ContainsKey(key))
return false;
if (dicGearEquipment[itype][key].have)
{
dicGearEquipment[itype][key].count += icount;
return false;
}
dGear data = dicGearEquipment[itype][key];
data.have = true;
data.level = 1;
data.awaken = 1;
data.count = icount - 1;
addHaveGear(itype, data.rarity);
if (data.maxAwaken > 1)
data.extraEffects = new int[3] { -1, -1, -1 };
dicGearNew[itype].Add(key);
if (dicGearLastHave[itype] < 0)
{
dicGearLastHave[itype] = data.id;
}
else
{
dGear datalasthave = dicGearEquipment[itype][dicGearLastHave[itype]];
if ((datalasthave.rarity < data.rarity) || (datalasthave.rarity == data.rarity && datalasthave.grade < data.grade))
dicGearLastHave[itype] = data.id;
}
CalcGearLevelEffect(itype, 1, false);
return true;
}
public static bool SubGearEquip(int itype, int key, int icount)
{
if (!dicGearEquipment[itype].ContainsKey(key))
return false;
if (dicGearEquipment[itype][key].count < icount)
return false;
dGear data = dicGearEquipment[itype][key];
data.count -= icount;
return true;
}
public static int GetGearLastHaveId(int itype)
{
return dicGearLastHave[itype];
}
public static bool IsGearComposable(int itype)
{
foreach (var item in dicGearEquipment[itype])
{
if (item.Value.count >= Const.gearComposePrice)
return true;
}
return false;
}
public static bool IsGearNewHave(int itype)
{
return dicGearNew[itype].Count > 0;
}
public static bool IsGearNew(int itype, int key)
{
//addHaveGear(itype, GetGearEquip(itype,key).rarity);
return dicGearNew[itype].Contains(key);
}
public static bool RemoveGearNew(int itype, int key)
{
return dicGearNew[itype].Remove(key);
}
public static void LvUpGearEquip(int itype, int key, int ilevel, bool bcalcstat)
{
dGear data = dicGearEquipment[itype][key];
int iaddlevel = ilevel - data.level;
data.level = ilevel;
CalcGearLevelEffect(itype, iaddlevel, bcalcstat);
if (bcalcstat && key == GetEquipedGear(itype))
CalcGearEquipEffect(itype);
}
public static void ChangeGearExtras(int itype, int key, int[] extras)
{
dicGearEquipment[itype][key].extraEffects = extras;
}
public static void LoadCurGearHave()
{
arrHaveWeapon = new int[7];
arrHaveArmor = new int[3, 7];
arrHaveAcc = new int[3, 7];
for (int i = 0; i < GetGearEquips(cGoods.TBagWeapon).Count; i++)
{
if (GetGearEquip(cGoods.TBagWeapon, i + 1).have)
addHaveGear(cGoods.TBagWeapon, GetGearEquip(cGoods.TBagWeapon, i + 1).rarity);
}
for (int i = 0; i < GetGearEquips(cGoods.TBagArmorCape).Count; i++)
{
if (GetGearEquip(cGoods.TBagArmorCape, i + 1).have)
addHaveGear(cGoods.TBagArmorCape, GetGearEquip(cGoods.TBagArmorCape, i + 1).rarity);
}
for (int i = 0; i < GetGearEquips(cGoods.TBagArmorHat).Count; i++)
{
if (GetGearEquip(cGoods.TBagArmorHat, i + 1).have)
addHaveGear(cGoods.TBagArmorHat, GetGearEquip(cGoods.TBagArmorHat, i + 1).rarity);
}
for (int i = 0; i < GetGearEquips(cGoods.TBagArmorShoes).Count; i++)
{
if (GetGearEquip(cGoods.TBagArmorShoes, i + 1).have)
addHaveGear(cGoods.TBagArmorShoes, GetGearEquip(cGoods.TBagArmorShoes, i + 1).rarity);
}
for (int i = 0; i < GetGearEquips(cGoods.TBagAcceEar).Count; i++)
{
if (GetGearEquip(cGoods.TBagAcceEar, i + 1).have)
addHaveGear(cGoods.TBagAcceEar, GetGearEquip(cGoods.TBagAcceEar, i + 1).rarity);
}
for (int i = 0; i < GetGearEquips(cGoods.TBagAcceNeck).Count; i++)
{
if (GetGearEquip(cGoods.TBagAcceNeck, i + 1).have)
addHaveGear(cGoods.TBagAcceNeck, GetGearEquip(cGoods.TBagAcceNeck, i + 1).rarity);
}
for (int i = 0; i < GetGearEquips(cGoods.TBagAcceRing).Count; i++)
{
if (GetGearEquip(cGoods.TBagAcceRing, i + 1).have)
addHaveGear(cGoods.TBagAcceRing, GetGearEquip(cGoods.TBagAcceRing, i + 1).rarity);
}
}
public static void addHaveGear(int type, int rarity)
{
switch (type)
{
case cGoods.TBagWeapon:
arrHaveWeapon[rarity - 1]++;
break;
case cGoods.TBagArmorCape:
arrHaveArmor[0, rarity - 1]++;
break;
case cGoods.TBagArmorHat:
arrHaveArmor[1, rarity - 1]++;
break;
case cGoods.TBagArmorShoes:
arrHaveArmor[2, rarity - 1]++;
break;
case cGoods.TBagAcceEar:
arrHaveAcc[0, rarity - 1]++;
break;
case cGoods.TBagAcceNeck:
arrHaveAcc[1, rarity - 1]++;
break;
case cGoods.TBagAcceRing:
arrHaveAcc[2, rarity - 1]++;
break;
}
}
#endregion Bag - Equip
#region Bag - Treasure
public static void LoadPlayGearTreasures(nIdLvInfo[] playdatas)
{
for (int i = 0; i < playdatas.Length; i++)
{
var lvInfo = playdatas[i];
if (!dicGearTreasure.TryGetValue(lvInfo.sid, out dTreasure treasure)) continue;
treasure.have = lvInfo.have;
treasure.count = lvInfo.cnt;
treasure.level = 0;
if (treasure.have)
{
treasure.level = lvInfo.lv;
BuffMgr.Instance.SetGearTreasure(treasure.abilityType, GetGearTreasureEffect(treasure.abilityValue, treasure.abilityValueInc, treasure.level), true);
}
}
}
public static void UpdateGearTreasurePlay(nIdLvInfo trsdata)
{
dTreasure data = dicGearTreasure[trsdata.sid];
data.have = trsdata.have;
data.level = trsdata.lv;
data.count = trsdata.cnt;
BuffMgr.Instance.SetGearTreasure(data.abilityType, GetGearTreasureEffect(data.abilityValue, data.abilityValueInc, data.level), true);
}
public static void UpdateGearTreasure(int key, int ilevel, int icount)
{
dTreasure data = dicGearTreasure[key];
data.level = ilevel;
data.count = icount;
BuffMgr.Instance.SetGearTreasure(data.abilityType, GetGearTreasureEffect(data.abilityValue, data.abilityValueInc, data.level), true);
}
public static Dictionary<int, dTreasure> GetGearTreasures()
{
return dicGearTreasure;
}
public static dTreasure GetGearTreasure(int key)
{
if (dicGearTreasure.ContainsKey(key))
return dicGearTreasure[key];
return null;
}
public static bool AddGearTreasure(int key, int icount)
{
if (!dicGearTreasure.ContainsKey(key))
return false;
if (dicGearTreasure[key].have)
{
dicGearTreasure[key].count += icount;
return false;
}
dTreasure data = dicGearTreasure[key];
data.have = true;
data.level = 1;
data.count = icount - 1;
BuffMgr.Instance.SetGearTreasure(data.abilityType, GetGearTreasureEffect(data.abilityValue, data.abilityValueInc, data.level), true);
return true;
}
public static bool allTreasureMax()
{
dTreasure curTreasure = new dTreasure();
for (int i = 0; i < GetGearTreasures().Count; i++)
{
curTreasure = GetGearTreasure(i+1);
if (curTreasure.level != curTreasure.maxLv)
return false;
}
return true;
}
public static bool LvUpGearTreasure(int key)
{
if (!dicGearTreasure.ContainsKey(key))
return false;
if (dicGearTreasure[key].count <= 0)
return false;
dicGearTreasure[key].count--;
int iprop = GetGearTreasureProp(dicGearTreasure[key].level);
if (Random.Range(0, dConst.RateMax) >= iprop)
return false;
dicGearTreasure[key].level++;
return true;
}
// 보물 효과.
public static long GetGearTreasureEffect(long ibase, long iinc, int ilevel)
{
if (ilevel <= 0)
return 0;
ilevel--;
return (ilevel * iinc) + ibase;
}
// 보물 레벨업 확률.
public static int GetGearTreasureProp(int ilevel)
{
int result = 0;
for (int i = gearTreasureLvUpLvBounds.Length - 1; i >= 0; --i)
{
if (ilevel >= gearTreasureLvUpLvBounds[i])
{
result = gearTreasureLvUpSuccRates[i];
break;
}
}
return result;
}
#endregion Bag - Treasure
#region Skill
public static void LoadSkillGeneral(dAwaken[] awakendatas, dTotalLvValue[] lveffects)
{
skillAwakens = awakendatas;
skillLvEffects = lveffects;
}
public static void LoadSkillsPlay(nIdLvInfo[] playpassives, nIdLvInfo[] playactives)
{
int iaddlv = 0;
for (int i = 0; i < playpassives.Length; ++i)
{
// 스킬 id가 존재하고 플레이어 레벨이 오픈 레벨 이상일 경우.
if (dicSkillPassive.TryGetValue(playactives[i].sid, out var skill) && PlayData.playerLv >= skill.openLv)
{
skill.level = playactives[i].lv;
iaddlv += skill.level;
long totalStat = skill.abilityValue + (skill.abilityValueInc * (skill.level - 1));
BuffMgr.Instance.ChangePassiveStat(skill.abilityType, totalStat, false);
}
}
for (int i = 0; i < playactives.Length; ++i)
{
// 스킬 id가 존재하고 플레이어 레벨이 오픈 레벨 이상일 경우.
if (dicSkillActive.TryGetValue(playactives[i].sid, out var skill) && PlayData.playerLv >= skill.openLv)
{
skill.level = playactives[i].lv;
skill.awaken = playactives[i].awaken;
iaddlv += skill.level;
}
}
CalcSkillLevelEffect(iaddlv);
}
private static void CheckSkillsOpen()
{
foreach (var item in dicSkillPassive)
{
if (item.Value.level > 0)
continue;
if (PlayData.playerLv < item.Value.openLv)
continue;
item.Value.level = 1;
}
foreach (var item in dicSkillActive)
{
if (item.Value.level > 0)
continue;
if (PlayData.playerLv < item.Value.openLv)
continue;
item.Value.level = 1;
item.Value.awaken = 1;
}
}
// 스킬 각성 단계 정보.
public static dAwaken[] GetSkillAwakens()
{
return skillAwakens;
}
// 스킬 최고 레벨.
public static int GetSkillMaxLv(int itype, int key)
{
if (itype == cGoods.TSkillPassive)
{
return dicSkillPassive[key].maxLv;
}
int index = dicSkillActive[key].awaken - 1;
if (index >= skillAwakens.Length)
index = skillAwakens.Length - 1;
else if (index < 0)
index = 0;
return skillAwakens[index].maxLv;
}
// 스킬 각성 단계 정보.
public static dAwaken GetSkillAwakenNext(int itype, int key)
{
if (itype != cGoods.TSkillActive)
return null;
int index = dicSkillActive[key].awaken;
if (index >= skillAwakens.Length)
index = skillAwakens.Length - 1;
else if (index < 0)
index = 0;
return skillAwakens[index];
}
// 스킬 각성 필요 재료. 같은 희귀도의 모자, 망토, 신발.
public static int[] GetSkillAwakenNeeds(int itype, int key)
{
if (itype != cGoods.TSkillActive)
return null;
int[] ineeds = new int[3];
int irarity = dicSkillActive[key].rarity;
int igrade = dicSkillActive[key].awaken + 1;
ineeds[0] = GetGearEquipByGrade(cGoods.TBagArmorHat, irarity, igrade);
ineeds[1] = GetGearEquipByGrade(cGoods.TBagArmorCape, irarity, igrade);
ineeds[2] = GetGearEquipByGrade(cGoods.TBagArmorShoes, irarity, igrade);
return ineeds;
}
// 스킬 통합 레벨 효과 계산 및 적용.
private static bool CalcSkillLevelEffect(int iaddlv)
{
int iprevlv = currentTotalSkillLv;
currentTotalSkillLv += iaddlv;
int inextlv = currentTotalSkillLv;
int iprevefc = -1;
int inextefc = -1;
for (int i = skillLvEffects.Length - 1; i >= 0; i--)
{
if (inextefc < 0 && inextlv >= skillLvEffects[i].totalLv)
{
inextefc = i;
}
if (iprevefc < 0 && iprevlv >= skillLvEffects[i].totalLv)
{
iprevefc = i;
break;
}
}
BuffMgr.Instance.SetSkillLv(skillLvEffects[inextefc].value);
// 이전 효과와 다르고 적용 효과가 있을 경우.
if (inextefc != iprevefc && inextefc >= 0)
{
return true;
}
return false;
}
/// <summary>
/// 스킬 통합 레벨 정보.
/// </summary>
/// <returns>0:현재 통합 레벨, 1:현재 단계, 2:현재 단계 효과 값, 3:다음 단계 통합 레벨.</returns>
public static int[] GetSkillTotalLevels()
{
int[] ilvs = new int[4];
ilvs[0] = currentTotalSkillLv;
for (int i = skillLvEffects.Length - 1; i >= 0; i--)
{
if (ilvs[0] >= skillLvEffects[i].totalLv)
{
ilvs[1] = i + 1;
ilvs[2] = skillLvEffects[i].value;
if (i < (skillLvEffects.Length - 1))
ilvs[3] = skillLvEffects[i + 1].totalLv;
else
ilvs[3] = skillLvEffects[i].totalLv;
break;
}
}
return ilvs;
}
public static Dictionary<int, dSkillPassive> GetSkillPassives() => dicSkillPassive;
public static Dictionary<int, dSkillActive> GetSkillActives() => dicSkillActive;
public static dSkillPassive GetSkillPassive(int key) => dicSkillPassive.SafeGet(key);
public static dSkillActive GetSkillActive(int key) => dicSkillActive.SafeGet(key);
public static int GetSkillRarity(int itype, int key)
{
if (itype == cGoods.TSkillActive && dicSkillActive.ContainsKey(key))
return dicSkillActive[key].rarity;
if (itype == cGoods.TSkillPassive && dicSkillPassive.ContainsKey(key))
return dicSkillPassive[key].rarity;
return 0;
}
public static float GetSkillCool(int key)
{
if (!dicSkillActive.ContainsKey(key))
return 99f;
float fawaken = 0f;
int iawaken = dicSkillActive[key].awaken;
for (int i = 1; i < iawaken; i++)
{
fawaken += skillAwakens[i].coolTimeDec / dConst.RateMaxFloat;
}
float ftime = 1f - fawaken;
if (ftime <= 0f)
ftime = 0.1f;
ftime *= dicSkillActive[key].coolTime;
return ftime;
}
public static float GetSkillCool(int key, int iawaken)
{
if (!dicSkillActive.ContainsKey(key))
return 99f;
float fawaken = 0f;
for (int i = 1; i < iawaken; i++)
{
fawaken += skillAwakens[i].coolTimeDec / dConst.RateMaxFloat;
}
float ftime = 1f - fawaken;
if (ftime <= 0f)
ftime = 0.1f;
ftime *= dicSkillActive[key].coolTime;
return ftime;
}
public static void LvUpSkill(int itype, int key, int ilevel)
{
// 액티브.
if (itype == cGoods.TSkillActive)
{
if (!dicSkillActive.ContainsKey(key))
return;
CalcSkillLevelEffect(ilevel - dicSkillActive[key].level);
dicSkillActive[key].level = ilevel;
return;
}
// 패시브.
if (!dicSkillPassive.ContainsKey(key))
return;
CalcSkillLevelEffect(ilevel - dicSkillPassive[key].level);
dicSkillPassive[key].level = ilevel;
long totalStat = dicSkillPassive[key].abilityValue + (dicSkillPassive[key].abilityValueInc * (dicSkillPassive[key].level - 1));
BuffMgr.Instance.ChangePassiveStat(dicSkillPassive[key].abilityType, totalStat, true);
}
public static void AwakenSkill(int itype, int key, int iawaken)
{
if (itype != cGoods.TSkillActive)
return;
// 액티브.
if (!dicSkillActive.ContainsKey(key))
return;
dicSkillActive[key].awaken = iawaken;
}
// 사용중인 프리셋 변경. 플레이 데이터 저장은 별도로 호출 필요.
public static void ChangeSkillPreset(int presetindex)
{
PlayData.usePreset = presetindex;
}
// 프리셋 변경. 플레이 데이터 저장은 별도로 호출 필요.
public static void EditSkillPreset(int presetindex, int islotindex, int iskillid)
{
PlayData.skillPresets[presetindex][islotindex] = iskillid;
}
#endregion Skill
#region Pet
public static void LoadPetGeneral(dAwaken[] awakendatas, dTotalLvValue[] lveffects)
{
petAwakens = awakendatas;
petLvEffects = lveffects;
}
public static void LoadPets(dPet[] pets)
{
for (int i = 0; i < pets.Length; i++)
{
int key = pets[i].id;
if (!dicPet.ContainsKey(key))
dicPet.Add(key, pets[i]);
}
}
public static void LoadPetsPlay(nIdLvInfo[] playpets)
{
int iaddlv = 0;
for (int i = 0; i < playpets.Length; i++)
{
int key = playpets[i].sid;
if (!dicPet.ContainsKey(key))
continue;
dPet data = dicPet[key];
data.have = playpets[i].have;
data.awaken = playpets[i].awaken;
data.level = playpets[i].lv;
data.count = playpets[i].cnt;
if (data.have)
iaddlv += data.level;
if (data.maxAwaken > 1)
data.extraEffects = playpets[i].extras;
}
// 레벨 효과 계산.
CalcPetLevelEffect(iaddlv, false);
// 장착 & 추가 효과 계산.
CalcPetEquipExtra(PlayData.usePetPreset);
}
// 펫 플레이 정보 업데이트(스피릿 합성 후 호출).
public static void UpdatePetsPlay(nIdLvInfo[] datas)
{
int ilvadd = 0;
for (int i = 0; i < datas.Length; i++)
{
int key = datas[i].sid;
if (!dicPet.ContainsKey(key))
continue;
dPet data = dicPet[key];
data.count = datas[i].cnt;
if (datas[i].have)
{
if (!data.have)
{
data.have = true;
ilvadd += datas[i].lv;
}
data.awaken = datas[i].awaken;
data.level = datas[i].lv;
if (data.maxAwaken > 1)
data.extraEffects = datas[i].extras;
}
}
// 레벨 효과 계산.
CalcPetLevelEffect(ilvadd, false);
}
// 펫 각성 단계 정보.
public static dAwaken[] GetPetAwakens()
{
return petAwakens;
}
// 펫 최고 레벨.
public static int GetPetMaxLv(int key)
{
int index = dicPet[key].awaken - 1;
if (index >= petAwakens.Length)
index = petAwakens.Length - 1;
else if (index < 0)
index = 0;
return petAwakens[index].maxLv;
}
// 펫 각성 단계 정보.
public static dAwaken GetPetAwakenNext(int key)
{
int index = dicPet[key].awaken;
if (index >= petAwakens.Length)
index = petAwakens.Length - 1;
else if (index < 0)
index = 0;
return petAwakens[index];
}
// 펫 통합 레벨 효과 계산 및 적용.
private static bool CalcPetLevelEffect(int iaddlv, bool brecalc)
{
int iprevlv = petLv;
petLv += iaddlv;
int inextlv = petLv;
int iprevefc = -1;
int inextefc = -1;
for (int i = petLvEffects.Length - 1; i >= 0; i--)
{
if (inextefc < 0 && inextlv >= petLvEffects[i].totalLv)
{
inextefc = i;
}
if (iprevefc < 0 && iprevlv >= petLvEffects[i].totalLv)
{
iprevefc = i;
break;
}
}
// 이전 효과와 다르고 적용 효과가 있을 경우.
if (inextefc != iprevefc && inextefc >= 0)
{
BuffMgr.Instance.SetPetLv(petLvEffects[inextefc].value, brecalc);
return true;
}
return false;
}
/// <summary>
/// 펫 통합 레벨 정보.
/// </summary>
/// <returns>0:현재 통합 레벨, 1:현재 단계, 2:현재 단계 효과 값, 3:다음 단계 통합 레벨.</returns>
public static int[] GetPetTotalLevels()
{
int[] ilvs = new int[4];
ilvs[0] = petLv;
for (int i = petLvEffects.Length - 1; i >= 0; i--)
{
if (ilvs[0] >= petLvEffects[i].totalLv)
{
ilvs[1] = i + 1;
ilvs[2] = petLvEffects[i].value;
if (i < (petLvEffects.Length - 1))
ilvs[3] = petLvEffects[i + 1].totalLv;
else
ilvs[3] = petLvEffects[i].totalLv;
break;
}
}
return ilvs;
}
// 펫 장착 효과 계산 및 적용.
private static void CalcPetEffect(int presetindex, int slotindex, bool brecalc)
{
int key = PlayData.petPresets[presetindex][slotindex];
if (key < 0)
{
BuffMgr.Instance.SetPetEquip(slotindex, eEffectType.None, 0L, eEffectType.None, 0L, eEffectType.None, 0L, brecalc);
return;
}
dPet pet = dicPet[key];
int ilevel = pet.level - 1;
BuffMgr.Instance.SetPetEquip(slotindex, pet.abilityType1, ilevel * pet.abilityValueInc1 + pet.abilityValue1,
pet.abilityType2, ilevel * pet.abilityValueInc2 + pet.abilityValue2, pet.abilityType3, ilevel * pet.abilityValueInc3 + pet.abilityValue3, brecalc);
}
// 펫 추가 효과 계산 및 적용.
public static void CalcPetExtra(int presetindex, int slotindex, bool brecalc)
{
int key = PlayData.petPresets[presetindex][slotindex];
if (key < 0)
{
BuffMgr.Instance.SetPetExtra(slotindex, 2, eEffectType.None, 0L, false);
BuffMgr.Instance.SetPetExtra(slotindex, 1, eEffectType.None, 0L, false);
BuffMgr.Instance.SetPetExtra(slotindex, 0, eEffectType.None, 0L, false);
BuffMgr.Instance.SetPetExtra(slotindex, 3, eEffectType.None, 0L, brecalc);
return;
}
dPet pet = dicPet[key];
if (pet.awaken <= 1 || pet.extraEffects == null)
{
BuffMgr.Instance.SetPetExtra(slotindex, 2, eEffectType.None, 0L, false);
BuffMgr.Instance.SetPetExtra(slotindex, 1, eEffectType.None, 0L, false);
BuffMgr.Instance.SetPetExtra(slotindex, 0, eEffectType.None, 0L, false);
BuffMgr.Instance.SetPetExtra(slotindex, 3, eEffectType.None, 0L, brecalc);
return;
}
bool bopenoption = true;
int[] extras = pet.extraEffects;
for (int i = extras.Length - 1; i >= 0; i--)
{
if (extras[i] < 0)
{
BuffMgr.Instance.SetPetExtra(slotindex, i, eEffectType.None, 0L, false);
bopenoption = false;
}
else
{
dExtraAbility ability = GetExtraAbility(extras[i]);
BuffMgr.Instance.SetPetExtra(slotindex, i, ability.abilityType, ability.abilityValue, false);
if (ability.rarity < cGoods.RLegend)
bopenoption = false;
}
}
// 옵션 보유 효과.
if (bopenoption)
BuffMgr.Instance.SetPetExtra(slotindex, extras.Length, pet.abilityTypeOption, pet.abilityValueOption, brecalc);
else
BuffMgr.Instance.SetPetExtra(slotindex, extras.Length, eEffectType.None, 0L, brecalc);
}
// 펫 장착 & 추가 효과 계산 및 적용.
public static void CalcPetEquipExtra(int presetindex)
{
// 장착 효과 계산.
CalcPetEffect(presetindex, 0, false);
CalcPetEffect(presetindex, 1, false);
CalcPetEffect(presetindex, 2, true);
// 추가 효과 계산.
CalcPetExtra(presetindex, 0, false);
CalcPetExtra(presetindex, 1, false);
CalcPetExtra(presetindex, 2, true);
}
public static Dictionary<int, dPet> GetPets()
{
return dicPet;
}
public static dPet GetPet(int key)
{
if (dicPet.ContainsKey(key))
return dicPet[key];
return null;
}
public static int GetPetSpiritCount(int key)
{
if (dicPet.ContainsKey(key))
return dicPet[key].count;
return 0;
}
public static int GetPetRarity(int key)
{
if (dicPet.ContainsKey(key))
return dicPet[key].rarity;
return 0;
}
public static bool AddPet(int key)
{
if (!dicPet.ContainsKey(key))
return false;
if (dicPet[key].have)
{
return false;
}
dPet data = dicPet[key];
data.have = true;
data.level = 1;
data.awaken = 1;
if (data.maxAwaken > 1)
data.extraEffects = new int[3] { -1, -1, -1 };
petNew.Add(key);
CalcPetLevelEffect(1, false);
PetMgr.SSetBadge();
return true;
}
public static bool AddPetSpirit(int key, int icount)
{
if (!dicPet.ContainsKey(key))
return false;
dicPet[key].count += icount;
return true;
}
public static bool SubPetSpirit(int key, int icount)
{
if (!dicPet.ContainsKey(key))
return false;
if (dicPet[key].count < icount)
return false;
dicPet[key].count -= icount;
return true;
}
// 선택한 희귀도가 합성 가능한지.
public static bool IsPetSpiritComposable(fRangeRarity rarities)
{
if (rarities == fRangeRarity.None)
return false;
bool[] brarities = new bool[cGoods.RMyth + 1]
{
false,
rarities.HasFlag(fRangeRarity.Normal),
rarities.HasFlag(fRangeRarity.Rare),
rarities.HasFlag(fRangeRarity.Epic),
rarities.HasFlag(fRangeRarity.Unique),
rarities.HasFlag(fRangeRarity.Hero),
rarities.HasFlag(fRangeRarity.Legend),
rarities.HasFlag(fRangeRarity.Myth)
};
foreach (var item in dicPet)
{
if (!brarities[item.Value.rarity])
continue;
if (item.Value.count >= Const.petSpiritComposePrice)
return true;
}
return false;
}
public static int GetPetSlot(int key)
{
int[] presets = PlayData.petPresets[PlayData.usePetPreset];
for (int i = 0; i < presets.Length; i++)
{
if (key == presets[i])
return i;
}
return -1;
}
public static bool IsPetNewHave()
{
return petNew.Count > 0;
}
public static bool IsPetNew(int key)
{
return petNew.Contains(key);
}
public static bool RemovePetNew(int key)
{
return petNew.Remove(key);
}
public static void LvUpPet(int key, int ilevel, bool bcalcstat)
{
dPet data = dicPet[key];
int iaddlevel = ilevel - data.level;
data.level = ilevel;
int slotindex = GetEquipedPetIndex(key);
CalcPetLevelEffect(iaddlevel, bcalcstat);
if (bcalcstat && slotindex >= 0)
CalcPetEffect(PlayData.usePetPreset, slotindex, true);
}
public static void AwakenPet(int key, int iawaken, int ispritcnt)
{
if (!dicPet.ContainsKey(key))
return;
dicPet[key].awaken = iawaken;
dicPet[key].count = ispritcnt;
}
public static void ChangePetExtras(int key, int[] extras)
{
dicPet[key].extraEffects = extras;
}
public static int GetEquipedPetIndex(int key)
{
int[] presets = PlayData.petPresets[PlayData.usePetPreset];
for (int i = 0; i < presets.Length; i++)
{
if (key == presets[i])
return i;
}
return -1;
}
// 사용중인 프리셋 변경. 플레이 데이터 저장은 별도로 호출 필요.
public static void ChangePetPreset(int presetindex)
{
PlayData.usePetPreset = presetindex;
}
// 프리셋 변경. 플레이 데이터 저장은 별도로 호출 필요.
public static void EditPetPreset(int presetindex, int islotindex, int ipetid)
{
PlayData.petPresets[presetindex][islotindex] = ipetid;
}
#endregion Pet
#region Gacha
public static void LoadGacha(dGachaLevel[] weaponlvs, int[] weapongrades, dGachaLevel[] armorlvs, int[] armorgrades, dGachaLevel[] accelvs, int[] accegrades)
{
gachaWeaponLvs = weaponlvs;
gachaWeaponGrades = weapongrades;
gachaArmorLvs = armorlvs;
gachaArmorGrades = armorgrades;
gachaAcceLvs = accelvs;
gachaAcceGrades = accegrades;
}
// 최대 소환 레벨.
public static int GetGachaMaxLv(int itype)
{
// 무기.
if (itype == 0)
return gachaWeaponLvs.Length;
// 방어구.
if (itype == 1)
return gachaArmorLvs.Length;
// 악세.
if (itype == 2)
return gachaAcceLvs.Length;
return 1;
}
// 소환 레벨별 데이터 가져오기.
public static dGachaLevel GetGachaLv(int itype, int ilv)
{
// 무기.
if (itype == 0)
{
if (ilv >= gachaWeaponLvs.Length)
return gachaWeaponLvs[gachaWeaponLvs.Length - 1];
return gachaWeaponLvs[ilv - 1];
}
// 방어구.
if (itype == 1)
{
if (ilv >= gachaArmorLvs.Length)
return gachaArmorLvs[gachaArmorLvs.Length - 1];
return gachaArmorLvs[ilv - 1];
}
// 악세.
if (itype == 2)
{
if (ilv >= gachaAcceLvs.Length)
return gachaAcceLvs[gachaAcceLvs.Length - 1];
return gachaAcceLvs[ilv - 1];
}
return null;
}
// 소환 등급별 확률 데이터 가져오기.
public static int[] GetGachaGrades(int itype)
{
// 무기.
if (itype == 0)
return gachaWeaponGrades;
// 방어구.
if (itype == 1)
return gachaArmorGrades;
// 악세.
if (itype == 2)
return gachaAcceGrades;
return null;
}
// 가챠 레벨, 경험치 세팅.
public static void SetGachaLvExp(int itype, int ilv, int iexp)
{
// 무기.
if (itype == 0)
{
PlayData.gachaWeaponLv = ilv;
PlayData.gachaWeaponExp = iexp;
}
// 방어구.
if (itype == 1)
{
PlayData.gachaArmorLv = ilv;
PlayData.gachaArmorExp = iexp;
}
// 악세.
if (itype == 2)
{
PlayData.gachaAccLv = ilv;
PlayData.gachaAccExp = iexp;
}
}
// 가챠 보상 레벨 증가.
public static bool GachaRewardLvUp(int itype)
{
// 무기.
if (itype == 0)
{
PlayData.gachaWeaponReward++;
return PlayData.gachaWeaponReward < PlayData.gachaWeaponLv;
}
// 방어구.
if (itype == 1)
{
PlayData.gachaArmorReward++;
return PlayData.gachaArmorReward < PlayData.gachaArmorLv;
}
// 악세.
if (itype == 2)
{
PlayData.gachaAccReward++;
return PlayData.gachaAccReward < PlayData.gachaAccLv;
}
return false;
}
#endregion Gacha
#region Diary Trip & Life
//public static void initTrip()
//{
// //int iclearChapter = PlayData.clearTripPiece / (Const.TripMaxsize * Const.TripPieceMaxsize);
// //int iclearTrip = (PlayData.clearTripPiece % (Const.TripMaxsize * Const.TripPieceMaxsize)) / Const.TripPieceMaxsize;
// //int iclearTripPiece = (PlayData.clearTripPiece % (Const.TripMaxsize * Const.TripPieceMaxsize)) % Const.TripPieceMaxsize;
// int icurMaxStage = DataHandler.GetMaxStage();
// int ichapter = Const.TripMaxsize * Const.TripPieceMaxsize;
// int itrip = Const.TripPieceMaxsize;
// int iclear = (icurMaxStage - 100) / 100;
// for (int i = 0; i<Const.TripChapterMaxsize; i++)
// {
// for(int j = 0; j<Const.TripMaxsize; j++)
// {
// for(int k = 0; k<Const.TripPieceMaxsize; k++)
// {
// if ((i*ichapter)+(j*itrip)+(k) < iclear)
// dicTrip[i][j].islock[k] = true;
// else
// dicTrip[i][j].islock[k] = false;
// }
// }
// }
//}
//// 여정 1~n 장 모두 가져오기
//public static void LoadTrip(dTrip[][] datas)
//{
// dicTrip = datas;
//}
//public static dTrip[][] GetTripStep()
//{
// return dicTrip;
//}
//// 여정 가져오기
//public static dTrip[] GetTrips(int id)
//{
// if (dicTrip[id] != null)
// return dicTrip[id];
// return null;
//}
//public static dTrip GetTrip(int id, int idx)
//{
// if (dicTrip[id][idx] != null)
// return dicTrip[id][idx];
// return null;
//}
//// 다음 여정조각을 해금 할 수 있는지 체크
//public static bool nextTripPieceIslock(int id, int idx)
//{
// for (int i = 0; i < DataHandler.Const.TripPieceMaxsize; i++)
// {
// if (!dicTrip[id][idx].islock[i] && IsClearStage(GetTripStage(id, idx)) && PlayData.tripPiece > 0) // 해금이 잠겨있고, 클리어해야할 스테이지를 넘었을 경우
// {
// return true;
// }
// }
// return false;
//}
//public static int GetTripStage(int id, int idx)
//{
// int istageNum;
// istageNum = ((idx) * (100) * Const.TripPieceMaxsize * Const.TripMaxsize) + (dicTrip[id][idx].tripPieceCount + 1) * 100 + Const.stageMax;
// return istageNum;
//}
//// 다음 여정 조각 해금
//public static void tripPieceUnlock(int id, int idx)
//{
// if (dicTrip[id][idx] != null)
// {
// if (dicTrip[id][idx].tripPieceCount < DataHandler.Const.TripPieceMaxsize && PlayData.tripPiece > 0)
// {
// SubTripPiece();
// dicTrip[id][idx].islock[dicTrip[id][idx].tripPieceCount] = true;
// DiaryMgr.AllCheckCircle();
// dicTrip[id][idx].tripPieceCount++;
// }
// }
//}
//// 챕터를 어디까지 열수 있나 체크 bool [] 로 반환 ex) true true false false false 면 1~6장까지 있을때 2,3장 가능 4, 5, 6장 불가능
//public static bool[] tripChapterIslock()
//{
// bool[] barr = new bool[Const.TripChapterMaxsize - 1];
// for (int i = 0; i < Const.TripChapterMaxsize - 1; i++)
// {
// if (dicTrip[i][Const.TripMaxsize - 1].tripPieceCount == Const.TripPieceMaxsize)
// barr[i] = true;
// else
// barr[i] = false;
// }
// return barr;
//}
//// 여정 조각이 어디까지 해금되어있나 체크
//public static int GetTripPieceIslock(int id, int idx)
//{
// return dicTrip[id][idx].tripPieceCount;
//}
//// id idx 번째 여정의 여정 조각이 어디까지 해금 가능한가 체크
//public static int GetTripPieceIslockCount(int id, int idx)
//{
// int icurMaxStage = DataHandler.GetMaxStage();
// //[id][idx] 의 최대 스테이지
// int iStageMax = id * 3000 + (idx + 1) * Const.TripPieceMaxsize * 100 + Const.stageMax;
// //[id][idx] 의 최소 스테이지
// int iStageMin = id * 3000 + (idx + 1) * 100 + Const.stageMax;
// // 현재 클리어한 스테이지가 [id][idx] 의 최대 스테이지 보다 크면
// if (icurMaxStage > iStageMax)
// return Const.TripPieceMaxsize <= PlayData.tripPiece ? Const.TripPieceMaxsize : PlayData.tripPiece;
// // 현재 클리어한 스테이지가 [id][idx] 의 최소 스테이지 보다 크면
// if (icurMaxStage > iStageMin && icurMaxStage < iStageMax)
// return (icurMaxStage - iStageMin + Const.stageMax)/100;
// else
// return 0;
//}
//public static void AddTripPiece()
//{
// if(PlayData.curStage == GetMaxStage()) //+여기서 마지막 스테이지인거 체크
// {
// if(PlayData.curStage % 100 == Const.stageMax)
// {
// PlayData.tripPiece += 1;
// DiaryMgr.AllCheckCircle();
// return;
// }
// }
//}
//public static void SubTripPiece()
//{
// PlayData.tripPiece -= 1;
// PlayData.Save();
//}
//public static void LoadLife(dLife[][] datas)
//{
// dicLife = datas;
//}
//public static dLife[][] GetLifeStep()
//{
// return dicLife;
//}
//// 일 가져오기
//public static dLife[] GetLives(int id)
//{
// if (dicLife[id] != null)
// return dicLife[id];
// return null;
//}
//public static dLife GetLife(int id, int idx)
//{
// return dicLife[id][idx];
//}
//public static bool nextLifePieceIslock(int id, int idx)
//{
// for (int i = 0; i < DataHandler.Const.LifePieceMaxsize; i++)
// {
// if (!dicLife[id][idx].islock[i] && dicLifePiece[id, idx] > 0) // 해금이 잠겨있고 조각이 하나 이상 있으면
// {
// return true;
// }
// }
// return false;
//}
//public static void AddLifePiece(int id, int idx, int inum)
//{
// if(dicLife[id][idx].lifePieceCount >= Const.LifePieceMaxsize)
// {
// // 다이아 주는 코드AddDia()
// }
// else
// dicLifePiece[id,idx] += inum;
//}
//// 여정조각 해금
//public static void LifePieceUnlock(int id, int idx)
//{
// if (dicLife[id][idx] != null)
// {
// if (dicLifePiece[id,idx] > 0)
// {
// dicLife[id][idx].islock[dicLife[id][idx].lifePieceCount] = true;
// if (dicLife[id][idx].lifePieceCount < DataHandler.Const.LifePieceMaxsize)
// {
// dicLifePiece[id, idx]--;
// dicLife[id][idx].lifePieceCount++;
// }
// }
// }
//}
//// 플레이가능한 챕터는 어디까지 인가?
//public static bool[] lifeChapterIslock()
//{
// bool[] barr = new bool[Const.LifeChapterMaxsize - 1];
// for (int i = 0; i < Const.LifeChapterMaxsize - 1; i++)
// {
// if (dicLife[i][Const.LifeMaxsize - 1].lifePieceCount == Const.LifePieceMaxsize)
// barr[i] = true;
// else
// barr[i] = false;
// }
// return barr;
//}
//// 일상 조각이 어디까지 해금 가능한가 체크
//public static int GetLifePieceIslockCount(int id, int idx)
//{
// int icount = dicLifePiece[id, idx] + dicLife[id][idx].lifePieceCount;
// return icount;
//}
#endregion
#region Title & Icon
public static void LoadPlayerTitle(dTitle[] titles)
{
for (int i = 0; i < titles.Length; i++)
{
int key = titles[i].id;
if (!sysProfileTitle.ContainsKey(key))
{
sysProfileTitle.Add(key, titles[i]);
//BuffMgr.Instance.AddTitleEfc(sysProfileTitle[key].abilityType, sysProfileTitle[key].abilityValue, false);
}
else
{
sysProfileTitle[key] = titles[i];
}
}
}
public static Dictionary<int,dTitle> GetAllPlayerTitle()
{
return sysProfileTitle;
}
public static dTitle[] GetAllPlayerTitleArr()
{
dTitle[] datas = new dTitle[sysProfileTitle.Count];
for(int i = 0; i<sysProfileTitle.Count; i++)
{
datas[i] = sysProfileTitle[i+1];
}
return datas;
}
public static dTitle GetPlayerTitle(int key)
{
if (sysProfileTitle.ContainsKey(key))
return sysProfileTitle[key];
return null;
}
public static void EquipPlayerTitle(int key)
{
PlayData.playerTitle = key;
}
public static bool AddPlayerTitle(int key)
{
if (!sysProfileTitle.ContainsKey(key))
return false;
if(sysProfileTitle[key].have)
return false;
dTitle data = sysProfileTitle[key];
data.have = true;
return true;
}
public static void AddTitleBadge()
{
nAchivement achive;
int[] arrSum = new int[5];
for(int i = 0; i < sysProfileTitle.Count; i++)
{
achive = new nAchivement(sysProfileTitle[i + 1]);
if (!sysProfileTitle[i + 1].have && isClearAchievements(achive) > 0)
arrSum[(int)(sysProfileTitle[i + 1].category) - 1]++;
}
ProfileMgr.addTitleBadge(eContent.Battle, arrSum[0]);
ProfileMgr.addTitleBadge(eContent.Equipment, arrSum[1]);
ProfileMgr.addTitleBadge(eContent.Summon, arrSum[2]);
ProfileMgr.addTitleBadge(eContent.Dungeon, arrSum[3]);
ProfileMgr.addTitleBadge(eContent.Etc, arrSum[4]);
}
public static void AddIconBadge()
{
nAchivement achive;
int isum = 0;
for (int i = 0; i < sysProfileIcon.Count; i++)
{
achive = new nAchivement(sysProfileIcon[i + 1]);
if (!sysProfileIcon[i + 1].have && isClearAchievements(achive) > 0)
{
isum++;
}
}
ProfileMgr.addIconBadge(isum);
}
public static void UnlockTitle(int key)
{
dTitle data = GetPlayerTitle(key);
if (data.have)
{
dTitle.Save(GetAllPlayerTitleArr());
BuffMgr.Instance.AddTitleEfc(sysProfileTitle[key].abilityType, sysProfileTitle[key].abilityValue, false);
}
}
public static void EquipPlayerIcon(int key)
{
PlayData.playerIcon = key;
PlayData.Save();
}
public static void LoadPlayerIcon(dIcon[] icons)
{
for(int i = 0; i<icons.Length; i++)
{
int key = (int)icons[i].id;
if (sysProfileIcon.ContainsKey(key))
sysProfileIcon[i] = icons[i];
else
sysProfileIcon.Add(key, icons[i]);
}
}
public static Dictionary<int,dIcon> GetAllplayerIcon()
{
return sysProfileIcon;
}
public static dIcon[] GetAllPlayerIconArr()
{
dIcon[] datas = new dIcon[sysProfileIcon.Count];
for(int i = 0; i<datas.Length; i++)
{
datas[i] = sysProfileIcon[i+1];
}
return datas;
}
public static dIcon GetPlayerIcon(int key)
{
if (sysProfileIcon.ContainsKey(key))
return sysProfileIcon[key];
return null;
}
public static bool AddPlayerIcon(int key)
{
if (!sysProfileIcon.ContainsKey(key))
return false;
if (sysProfileIcon[key].have)
return false;
dIcon data = sysProfileIcon[key];
data.have = true;
return true;
}
#endregion
#region Record
public static void LoadPlayerTotalRecord(cTotalRecord record)
{
PlayerTotalRecord = cTotalRecord.Load(PlayerTotalRecord);
if(PlayerTotalRecord == null)
PlayerTotalRecord = record;
}
public static cTotalRecord GetTotalRecord()
{
return PlayerTotalRecord;
}
public static void LoadPlayerDailyRecord(cDailyRecord record)
{
PlayerDailyRecord = cDailyRecord.Load(PlayerDailyRecord);
if (PlayerDailyRecord == null)
PlayerDailyRecord = record;
}
public static cDailyRecord GetDailyRecord()
{
return PlayerDailyRecord;
}
public static void CheckAllAchivement()
{
CheckAchivement(eContent.Battle);
CheckAchivement(eContent.Equipment);
CheckAchivement(eContent.Summon);
CheckAchivement(eContent.Dungeon);
CheckAchivement(eContent.Etc);
}
// 나중에 구조 개선 필요
public static void CheckAchivement(eContent content)
{
List<nAchivement> removeList = new List<nAchivement>();
// inum이 1이상이면 클리어
int iCnt = 0;
switch (content)
{
case eContent.Battle:
foreach (var item in listBattleType)
{
iCnt = isClearAchievements(item);
if (iCnt > 0)
{
removeList.Add(item);
}
}
removeList.ForEach(item => { listBattleType.Remove(item); });
break;
case eContent.Equipment:
foreach (var item in listEquipmentType)
{
iCnt = isClearAchievements(item);
if (iCnt > 0)
{
removeList.Add(item);
}
}
removeList.ForEach(item => { listEquipmentType.Remove(item); });
break;
case eContent.Summon:
foreach (var item in listSummonType)
{
iCnt = isClearAchievements(item);
if (iCnt > 0)
{
removeList.Add(item);
}
}
removeList.ForEach(item => { listSummonType.Remove(item); });
break;
case eContent.Dungeon:
foreach (var item in listDungeonType)
{
iCnt = isClearAchievements(item);
if (iCnt > 0)
{
removeList.Add(item);
}
}
removeList.ForEach(item => { listDungeonType.Remove(item); });
break;
case eContent.Etc:
foreach (var item in listEtcType)
{
iCnt = isClearAchievements(item);
if (iCnt > 0)
{
removeList.Add(item);
}
}
removeList.ForEach(item => { listEtcType.Remove(item); });
break;
}
}
// 현재 안쓰는 코드
public static void AchiveProcess(nAchivement achive, int iCnt=0)
{
switch (achive.contentType)
{
case eContentType.DailyQuest:
//QuestMgr.SClearDailyQuest(achive.id);
break;
case eContentType.RepeatQuest:
//QuestMgr.SClearRepeatQuest(achive.id, iCnt);
break;
case eContentType.Icon:
//ProfileMgr.SGetIcon(achive.id);
//AddPlayerIcon(achive.id);
break;
case eContentType.Title:
//ProfileMgr.SGetTitle(achive.id);
//AddPlayerTitle(achive.id);
break;
}
}
public static void AddRecord(eCondition condition, int icount = 1)
{
switch (condition)
{
case eCondition.PlayAtttend:
PlayerDailyRecord.attendCnt += icount;
break;
case eCondition.MonsterCnt:
PlayerDailyRecord.monsterKill += icount;
PlayerTotalRecord.monsterKill += icount;
if(GetQuestMission(PlayerTotalRecord.missionLv) != null && GetQuestMission(PlayerTotalRecord.missionLv).condType == eCondition.MonsterCnt)
{
MissionMgr.SSetMissionMonCnt();
MissionMgr.checkCurMission();
}
break;
case eCondition.PlayTimeM:
PlayerDailyRecord.playTime += icount;
PlayerTotalRecord.playTime += icount;
break;
case eCondition.EnhanceGoldAtk:
PlayerDailyRecord.enhanceGoldAtk += icount;
break;
case eCondition.EnhanceGoldHp:
PlayerDailyRecord.enhanceGoldHp += icount;
break;
case eCondition.GachaWeapon:
PlayerDailyRecord.gachaWeaponCnt += icount;
PlayerTotalRecord.gachaWeaponCnt += icount;
break;
case eCondition.GachaArmor:
PlayerDailyRecord.gachaArmorCnt += icount;
PlayerTotalRecord.gachaArmorCnt += icount;
break;
case eCondition.GachaAcc:
PlayerDailyRecord.gachaAccCnt += icount;
PlayerTotalRecord.gachaAccCnt += icount;
break;
case eCondition.GachaTreasure:
PlayerDailyRecord.gachaTreasureCnt += icount;
PlayerTotalRecord.gachaTreasureCnt += icount;
break;
case eCondition.EquipComposeWeapon:
PlayerDailyRecord.composeWeaponCnt += icount;
PlayerTotalRecord.composeWeaponCnt += icount;
break;
case eCondition.EquipComposeArmor:
PlayerDailyRecord.composeArmorCnt += icount;
PlayerTotalRecord.composeArmorCnt += icount;
break;
case eCondition.EquipComposeAcc:
PlayerDailyRecord.composeAccCnt += icount;
PlayerTotalRecord.composeAccCnt += icount;
break;
//case eCondition.ComposeIris:
// PlayerTotalRecord.composeIris += icount;
// break;
case eCondition.DailyQuestClear:
PlayerDailyRecord.clearDailyQuest += icount;
break;
case eCondition.DailyQuestClearTotal:
PlayerTotalRecord.clearDailyQuest += icount;
break;
case eCondition.MissionClearLv:
PlayerTotalRecord.missionLv += icount;
break;
case eCondition.PetspiritCompose:
PlayerTotalRecord.composePetSpirit += icount;
break;
default:
break;
}
}
// 타입과 값을 받고 클리어 유무를 1이상의 int값으로 반환 1 = 1번클리어 2 = 2번클리어
public static int isClearAchievements(nAchivement achive, int clearAllDay = 0)//eCondition type, long ivalue=0
{
int bClear = 0;
int cnt = 0;
int sum = 0;
switch (achive.condition)
{
// 스테이지, 레벨, 각성, 플레이 시간(분), 플레이 시간, 출석
case eCondition.StageClear:
return GetMaxStage() > achive.condValue ? 1 : 0;
case eCondition.PlayerLv:
return PlayData.playerLv >= achive.condValue ? 1 : 0;
case eCondition.PlayerAwaken:
return PlayDgAwaken.lv > achive.condValue ? 1 : 0;
case eCondition.PlayTimeM:
if (achive.contentType == eContentType.DailyQuest)
return achive.condValue <= PlayerDailyRecord.playTime ? 1 : 0;
else
return PlayerTotalRecord.playTime >= achive.condValue ? 1 : 0;
case eCondition.PlayTimeH:
return bClear = PlayerTotalRecord.playTime / 60 >= achive.condValue ? 1 : 0;
case eCondition.PlayAtttend:
if(achive.contentType == eContentType.DailyQuest || achive.contentType == eContentType.QuestMission)
return bClear = achive.condValue <= PlayerDailyRecord.attendCnt ? 1 : 0;
else
return bClear = achive.condValue <= PlayerTotalRecord.attendCnt ? 1 : 0;
// 몬스터 처치 횟수
case eCondition.MonsterCnt:
if (achive.contentType == eContentType.DailyQuest)
return bClear = achive.condValue <= PlayerDailyRecord.monsterKill ? 1 : 0;
else if (achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = PlayerTotalRecord.monsterKill >= sum ? ((PlayerTotalRecord.monsterKill - sum) / achive.condValue) : 0;
}
else
return bClear = PlayerTotalRecord.monsterKill >= achive.condValue ? 1 : 0;
case eCondition.EliteCnt:
case eCondition.BossCnt:
return bClear;
// 소환 횟수
case eCondition.GachaAll:
if (achive.contentType == eContentType.DailyQuest)
return bClear = achive.condValue <= PlayerDailyRecord.gachaWeaponCnt + PlayerDailyRecord.gachaArmorCnt + PlayerDailyRecord.gachaAccCnt + PlayerDailyRecord.gachaTreasureCnt? 1 : 0;
else
return bClear = PlayerTotalRecord.gachaWeaponCnt + PlayerTotalRecord.gachaArmorCnt + PlayerTotalRecord.gachaAccCnt + PlayerTotalRecord.gachaTreasureCnt> achive.condValue ? 1 : 0;
case eCondition.GachaWeapon:
if (achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = PlayerTotalRecord.gachaWeaponCnt >= sum ? ((PlayerTotalRecord.gachaWeaponCnt - sum) / achive.condValue) : 0;
}
else
return bClear = PlayerTotalRecord.gachaWeaponCnt >= achive.condValue ? 1 : 0;
case eCondition.GachaArmor:
if (achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = PlayerTotalRecord.gachaArmorCnt >= sum ? ((PlayerTotalRecord.gachaArmorCnt - sum) / achive.condValue) : 0;
}
else
return bClear = PlayerTotalRecord.gachaArmorCnt >= achive.condValue ? 1 : 0;
case eCondition.GachaAcc:
if (achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = PlayerTotalRecord.gachaAccCnt >= sum ? ((PlayerTotalRecord.gachaAccCnt - sum) / achive.condValue) : 0;
}
else
return bClear = PlayerTotalRecord.gachaAccCnt >= achive.condValue ? 1 : 0;
case eCondition.GachaTreasure:
if (achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = PlayerTotalRecord.gachaTreasureCnt >= sum ? ((PlayerTotalRecord.gachaTreasureCnt - sum) / achive.condValue) : 0;
}
else
return bClear = PlayerTotalRecord.gachaTreasureCnt >= achive.condValue ? 1 : 0;
case eCondition.GachaWeaponLv:
return bClear = PlayData.gachaWeaponLv >= achive.condValue ? 1 : 0;
case eCondition.GachaArmorLv:
return bClear = PlayData.gachaArmorLv >= achive.condValue ? 1 : 0;
case eCondition.GachaAccLv:
return bClear = PlayData.gachaAccLv >= achive.condValue ? 1 : 0;
// 장비 강화 레벨
case eCondition.EquipLvAll:
return bClear = GetGearTotalLevels(cGoods.TBagWeapon)[0] +
GetGearTotalLevels(cGoods.TBagArmorCape)[0] + GetGearTotalLevels(cGoods.TBagArmorHat)[0] + GetGearTotalLevels(cGoods.TBagArmorShoes)[0] +
GetGearTotalLevels(cGoods.TBagAcceEar)[0] + GetGearTotalLevels(cGoods.TBagAcceNeck)[0] + GetGearTotalLevels(cGoods.TBagAcceRing)[0]
>= achive.condValue ? 1 : 0;
case eCondition.EquipLvWeapon:
return bClear = GetGearTotalLevels(cGoods.TBagWeapon)[0] >= achive.condValue ? 1 : 0;
case eCondition.EquipLvArmor:
return bClear = GetGearTotalLevels(cGoods.TBagArmorCape)[0] + GetGearTotalLevels(cGoods.TBagArmorHat)[0] + GetGearTotalLevels(cGoods.TBagArmorShoes)[0]
>= achive.condValue ? 1 : 0;
case eCondition.EquipLvAcc:
return bClear = GetGearTotalLevels(cGoods.TBagAcceEar)[0] + GetGearTotalLevels(cGoods.TBagAcceNeck)[0] + GetGearTotalLevels(cGoods.TBagAcceRing)[0]
>= achive.condValue ? 1 : 0;
case eCondition.EquipLvTreasure:
return bClear;
// 골드 강화 레벨
case eCondition.EnhanceGoldAll:
return bClear = GetCharStat(1).level + GetCharStat(2).level + GetCharStat(3).level >= achive.condValue ? 1 : 0;
case eCondition.EnhanceGoldAtk:
if (achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id -1].totalCnt;
return bClear = GetCharStat(1).level >= sum ? ((GetCharStat(1).level - sum) / achive.condValue) : 0;
}
else
return bClear = GetCharStat(1).level >= achive.condValue ? 1 : 0;
case eCondition.EnhanceGoldHp:
if (achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id -1].totalCnt;
return bClear = GetCharStat(2).level >= sum ? ((GetCharStat(2).level - sum) / achive.condValue) : 0;
}
else
return bClear = GetCharStat(2).level >= achive.condValue ? 1 : 0;
case eCondition.EnhanceGoldAtkCount:
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = GetCharStat(1).level >= sum ? ((GetCharStat(1).level - sum) / achive.condValue) : 0;
case eCondition.EnhanceGoldHpCount:
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = GetCharStat(2).level >= sum ? ((GetCharStat(2).level - sum) / achive.condValue) : 0;
// 포인트 강화 레벨
case eCondition.EnhancePointAll:
Dictionary<int, dCharStat> lvpoints = GetCharLvPoints();
for(int i = 1; i< lvpoints.Count; i++)
{
sum += (lvpoints[i].level - 1);
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhancePointAtk:
return bClear = GetCharLvPoint(1).level >= achive.condValue ? 1 : 0;
case eCondition.EnhancePointHp:
return bClear = GetCharLvPoint(2).level >= achive.condValue ? 1 : 0;
// 스킬 강화 레벨
case eCondition.SkillEquip:
for(int i = 0; i < 4; i++)
{
if (PlayData.skillPresets[PlayData.usePreset][i] != -1)
return 1;
}
return 0;
case eCondition.SkillLvAll:
return bClear = GetSkillTotalLevels()[0] >= achive.condValue ? 1 : 0;
case eCondition.SkillLvActive:
for (int i = 0; i < dicSkillActive.Count; i++)
{
if (dicSkillActive[i + 1].openLv <= PlayData.playerLv)
sum += dicSkillActive[i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.SkillLvPassive:
for (int i = 0; i < dicSkillPassive.Count; i++)
{
sum += dicSkillPassive[i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
// 잠재 능력
case eCondition.ChangeAbility:
for(int i = 0; i < 6; i++)
{
if (PlayAwaken.extras[PlayAwaken.usePreset][i] != -1)
return bClear = 1;
}
return bClear = 0;
// 특정 코스튬 획득
case eCondition.CosHave:
return GetCosCloth(achive.condValue).have ? 1 : 0;
case eCondition.CosCnt:
cnt = 0;
for (int i = 1; i < dicCosCloth.Count + 1; i++)
{
int key = dicCosCloth[i].id;
if (GetCosCloth(key).have)
cnt++;
}
return cnt >= achive.condValue ? 1 : 0;
case eCondition.CosSetHave:
return IsActiveClothCosSetEffect(achive.condValue) ? 1 : 0;
case eCondition.CosSetCnt:
cnt = 0;
for (int i = 1; i < dicCosClothSet.Count + 1; i++)
{
int key = dicCosClothSet[i].id;
if (IsActiveClothCosSetEffect(key))
cnt++;
}
return cnt >= achive.condValue ? 1 : 0;
// 모든 장비 획득
case eCondition.EquipHaveAll:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponAll, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorAll, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccAll, 1, 1)) <= 0)
return 0;
return bClear = 1;
case eCondition.EquipHaveD:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponD, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorD, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccD, 1, 1)) <= 0)
return 0;
return bClear = 1;
case eCondition.EquipHaveC:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponC, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorC, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccC, 1, 1)) <= 0)
return 0;
return bClear = 1;
case eCondition.EquipHaveB:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponB, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorB, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccB, 1, 1)) <= 0)
return 0;
return bClear = 1;
case eCondition.EquipHaveA:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponA, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorA, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccA, 1, 1)) <= 0)
return 0;
return bClear = 1;
case eCondition.EquipHaveS:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponS, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorS, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccS, 1, 1)) <= 0)
return 0;
return bClear = 1;
case eCondition.EquipHaveSS:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponSS, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorSS, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccSS, 1, 1)) <= 0)
return 0;
return bClear = 1;
case eCondition.EquipHaveSR:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponSR, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorSR, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccSR, 1, 1)) <= 0)
return 0;
return bClear = 1;
// 모든 무기 획득
case eCondition.EquipHaveWeaponAll:
sum = 0;
for (int i = 0; i < arrHaveWeapon.Length; i++)
{
sum += arrHaveWeapon[i];
}
return bClear = sum >= 28 ? 1 : 0;
case eCondition.EquipHaveWeaponD:
return bClear = arrHaveWeapon[0] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponC:
return bClear = arrHaveWeapon[1] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponB:
return bClear = arrHaveWeapon[2] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponA:
return bClear = arrHaveWeapon[3] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponS:
return bClear = arrHaveWeapon[4] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponSS:
return bClear = arrHaveWeapon[5] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponSR:
return bClear = arrHaveWeapon[6] >= 4 ? 1 : 0;
// 모든 방어구 획득
case eCondition.EquipHaveArmorAll:
sum = 0;
foreach (var item in arrHaveArmor)
{
sum += item;
}
return bClear = sum >= 84 ? 1 : 0;
case eCondition.EquipHaveArmorD:
return bClear = arrHaveArmor[0, 0] >= 4 && arrHaveArmor[1, 0] >= 4 && arrHaveArmor[2, 0] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorC:
return bClear = arrHaveArmor[0, 1] >= 4 && arrHaveArmor[1, 1] >= 4 && arrHaveArmor[2, 1] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorB:
return bClear = arrHaveArmor[0, 2] >= 4 && arrHaveArmor[1, 2] >= 4 && arrHaveArmor[2, 2] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorA:
return bClear = arrHaveArmor[0, 3] >= 4 && arrHaveArmor[1, 3] >= 4 && arrHaveArmor[2, 3] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorS:
return bClear = arrHaveArmor[0, 4] >= 4 && arrHaveArmor[1, 4] >= 4 && arrHaveArmor[2, 4] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorSS:
return bClear = arrHaveArmor[0, 5] >= 4 && arrHaveArmor[1, 5] >= 4 && arrHaveArmor[2, 5] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorSR:
return bClear = arrHaveArmor[0, 6] >= 4 && arrHaveArmor[1, 6] >= 4 && arrHaveArmor[2, 6] >= 4 ? 1 : 0;
// 모든 장신구 획득
case eCondition.EquipHaveAccAll:
sum = 0;
foreach (var item in arrHaveAcc)
{
sum += item;
}
return bClear = sum >= 84 ? 1 : 0;
case eCondition.EquipHaveAccD:
return bClear = arrHaveAcc[0, 0] >= 4 && arrHaveAcc[1, 0] >= 4 && arrHaveAcc[2, 0] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccC:
return bClear = arrHaveAcc[0, 1] >= 4 && arrHaveAcc[1, 1] >= 4 && arrHaveAcc[2, 1] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccB:
return bClear = arrHaveAcc[0, 2] >= 4 && arrHaveAcc[1, 2] >= 4 && arrHaveAcc[2, 2] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccA:
return bClear = arrHaveAcc[0, 3] >= 4 && arrHaveAcc[1, 3] >= 4 && arrHaveAcc[2, 3] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccS:
return bClear = arrHaveAcc[0, 4] >= 4 && arrHaveAcc[1, 4] >= 4 && arrHaveAcc[2, 4] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccSS:
return bClear = arrHaveAcc[0, 5] >= 4 && arrHaveAcc[1, 5] >= 4 && arrHaveAcc[2, 5] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccSR:
return bClear = arrHaveAcc[0, 6] >= 4 && arrHaveAcc[1, 6] >= 4 && arrHaveAcc[2, 6] >= 4 ? 1 : 0;
// 특정 등급의 무기 1개 이상
case eCondition.EquipHaveWeaponNOne:
return bClear = arrHaveWeapon[0] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponROne:
return bClear = arrHaveWeapon[1] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponEOne:
return bClear = arrHaveWeapon[2] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponUOne:
return bClear = arrHaveWeapon[3] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponLOne:
return bClear = arrHaveWeapon[4] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponHOne:
return bClear = arrHaveWeapon[5] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponMOne:
return bClear = arrHaveWeapon[6] >= 1 ? 1 : 0;
//특정 등급 귀걸이 1개 이상
case eCondition.EquipHaveEarNOne:
return bClear = arrHaveAcc[0, 0] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarROne:
return bClear = arrHaveAcc[0, 1] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarEOne:
return bClear = arrHaveAcc[0, 2] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarUOne:
return bClear = arrHaveAcc[0, 3] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarLOne:
return bClear = arrHaveAcc[0, 4] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarHOne:
return bClear = arrHaveAcc[0, 5] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarMOne:
return bClear = arrHaveAcc[0, 6] >= 1 ? 1 : 0;
//던전 도전 횟수
case eCondition.DgTryAll:
return bClear=PlayDgGold.totalTry + +PlayDgReinStone.totalTry + PlayDgAwakenStone.totalTry + PlayDgPet.totalTry >= achive.condValue ? 1 : 0;
case eCondition.DgTryGold:
return bClear = PlayDgGold.totalTry >= achive.condValue ? 1 : 0;
case eCondition.DgTryEnhance:
return bClear = PlayDgReinStone.totalTry >= achive.condValue ? 1 : 0;
case eCondition.DgTryAwaken:
return bClear = PlayDgAwakenStone.totalTry >= achive.condValue ? 1 : 0;
case eCondition.DgTryPet:
return bClear = PlayDgPet.totalTry >= achive.condValue ? 1 : 0;
// 던전 스테이지 클리어
case eCondition.DgClearAll:
return bClear = PlayDgGold.totalClear + PlayDgReinStone.totalClear + PlayDgAwakenStone.totalClear + PlayDgPet.totalClear >= achive.condValue ? 1 : 0;
case eCondition.DgClearGold:
return bClear = PlayDgGold.totalClear >= achive.condValue ? 1 : 0;
case eCondition.DgClearEnhance:
return bClear = PlayDgReinStone.totalClear >= achive.condValue ? 1 : 0;
case eCondition.DgClearAwaken:
return bClear = PlayDgAwakenStone.totalClear >= achive.condValue ? 1 : 0;
case eCondition.DgClearPet:
return bClear = PlayDgPet.totalClear >= achive.condValue ? 1 : 0;
case eCondition.DgStageGold:
return bClear = PlayDgGold.lv > achive.condValue ? 1 : 0;
case eCondition.DgStageEnhance:
return bClear = PlayDgReinStone.lv > achive.condValue ? 1 : 0;
case eCondition.DgStageAwaken:
return bClear = PlayDgAwakenStone.lv > achive.condValue ? 1 : 0;
case eCondition.DgStagePet:
return bClear = PlayDgPet.lv >
(achive.condValue/100 - 1) * 10 + achive.condValue % 100 ? 1 : 0;
// 장비 합성
case eCondition.EquipComposeAll:
if (achive.contentType == eContentType.DailyQuest)
return achive.condValue <= PlayerDailyRecord.composeWeaponCnt + PlayerDailyRecord.composeArmorCnt + PlayerDailyRecord.composeAccCnt ? 1 : 0;
else
return bClear;
case eCondition.EquipComposeWeapon:
if(achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = PlayerTotalRecord.composeWeaponCnt >= sum ? (PlayerTotalRecord.composeWeaponCnt - sum)/ achive.condValue : 0;
}
else
return bClear = PlayerTotalRecord.composeWeaponCnt >= achive.condValue ? 1 : 0;
case eCondition.EquipComposeArmor:
if (achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = PlayerTotalRecord.composeArmorCnt >= sum ? (PlayerTotalRecord.composeArmorCnt - sum) / achive.condValue : 0;
}
else
return bClear = PlayerTotalRecord.composeArmorCnt >= achive.condValue ? 1 : 0;
case eCondition.EquipComposeAcc:
if (achive.contentType == eContentType.RepeatQuest)
{
sum = achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return bClear = PlayerTotalRecord.composeAccCnt >= sum ? (PlayerTotalRecord.composeAccCnt - sum) / achive.condValue : 0;
}
else
return bClear = PlayerTotalRecord.composeAccCnt >= achive.condValue ? 1 : 0;
// 장비 장착
case eCondition.EquipWeapon:
return bClear = PlayData.weapon != -1 ? 1 : 0;
case eCondition.EquipArmorCape:
return bClear = PlayData.cape != -1 ? 1 : 0;
case eCondition.EquipArmorHat:
return bClear = PlayData.hat != -1 ? 1 : 0;
case eCondition.EquipArmorShoes:
return bClear = PlayData.shoes != -1 ? 1 : 0;
case eCondition.EquipAccEar:
return bClear = PlayData.earring != -1 ? 1 : 0;
case eCondition.EquipAccNeck:
return bClear = PlayData.necklace != -1 ? 1 : 0;
case eCondition.EquipAccRing:
return bClear = PlayData.ring != -1 ? 1 : 0;
// 장비 강화
case eCondition.EnhanceGear:
return bClear;
case eCondition.EnhanceWeapon:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagWeapon].Count; i++)
{
if (dicGearEquipment[cGoods.TBagWeapon][i + 1].have)
sum += dicGearEquipment[cGoods.TBagWeapon][i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhanceArmor:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorCape].Count; i++)
{
if (dicGearEquipment[cGoods.TBagArmorCape][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorCape][i + 1].level - 1;
}
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorHat].Count; i++)
{
if (dicGearEquipment[cGoods.TBagArmorHat][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorHat][i + 1].level - 1;
}
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorShoes].Count; i++)
{
if (dicGearEquipment[cGoods.TBagArmorShoes][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorHat][i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhanceArmorCape:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorCape].Count; i++)
{
if (dicGearEquipment[cGoods.TBagArmorCape][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorCape][i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhanceArmorHat:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorHat].Count; i++)
{
if (dicGearEquipment[cGoods.TBagArmorHat][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorHat][i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhanceArmorShoes:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorShoes].Count; i++)
{
if (dicGearEquipment[cGoods.TBagArmorShoes][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorShoes][i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhanceAcc:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceEar].Count; i++)
{
if (dicGearEquipment[cGoods.TBagAcceEar][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceEar][i + 1].level - 1;
}
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceNeck].Count; i++)
{
if (dicGearEquipment[cGoods.TBagAcceNeck][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceNeck][i + 1].level - 1;
}
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceRing].Count; i++)
{
if (dicGearEquipment[cGoods.TBagAcceRing][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceRing][i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhanceAccEar:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceEar].Count; i++)
{
if (dicGearEquipment[cGoods.TBagAcceEar][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceEar][i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhanceAccNeck:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceNeck].Count; i++)
{
if (dicGearEquipment[cGoods.TBagAcceNeck][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceNeck][i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhanceAccRing:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceRing].Count; i++)
{
if (dicGearEquipment[cGoods.TBagAcceRing][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceRing][i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.EnhanceTreasure:
sum = 0;
for(int i =0; i< dicGearTreasure.Count; i++)
{
if(dicGearTreasure[i + 1].have)
sum += dicGearTreasure[i + 1].level - 1;
}
return bClear = sum >= achive.condValue ? 1 : 0;
// 펫
case eCondition.PetEnhance:
for(int i = 0; i<dicPet.Count; i++)
{
if (dicPet[i + 1].have)
{
sum += dicPet[i + 1].level - 1;
}
}
return bClear = sum >= achive.condValue ? 1 : 0;
case eCondition.PetHave:
return bClear = dicPet[achive.condValue].have ? 1 : 0;
case eCondition.PetspiritCompose:
return bClear = PlayerTotalRecord.composePetSpirit >= achive.condValue ? 1 : 0;
// 일일 퀘스트
case eCondition.DailyQuestClear:
return bClear = PlayerDailyRecord.clearDailyQuest >= achive.condValue ? 1 : 0;
case eCondition.DailyQuestClearTotal:
return bClear;
// 아이콘, 칭호 장착
case eCondition.EquipIcon:
return bClear = PlayData.playerIcon == achive.condValue ? 1 : 0;
case eCondition.EquipTitle:
return bClear = PlayData.playerTitle == achive.condValue ? 1 : 0;
// 보석, 색상석 사용
case eCondition.UseDia:
return bClear;
// 자동 전투 활성화
case eCondition.AutoBattle:
return bClear = BattleMgr.GetAuto() ? 1 : 0;
// 닉네임 변경
case eCondition.RenameCnt:
return bClear = PlayerTotalRecord.renameCnt >= achive.condValue ? 1 : 0;
// 광고 버프
case eCondition.ActivateADbuff:
return bClear = PlayBuff.adTimer[0] > 0 || PlayBuff.adTimer[1] > 0 || PlayBuff.adTimer[2] > 0 ? 1 : 0;
case eCondition.ActivateADbuffAtk:
return bClear = PlayBuff.adTimer[0] > 0 ? 1 : 0;
case eCondition.ActivateADbuffExp:
return bClear = PlayBuff.adTimer[1] > 0 ? 1 : 0;
case eCondition.ActivateADbuffGold:
return bClear = PlayBuff.adTimer[2] > 0 ? 1 : 0;
case eCondition.ADbuffAtkLv:
return bClear = PlayBuff.atkLv >= achive.condValue ? 1 : 0;
case eCondition.ADbuffExpLv:
return bClear = PlayBuff.expLv >= achive.condValue ? 1 : 0;
case eCondition.ADbuffGoldLv:
return bClear = PlayBuff.goldLv >= achive.condValue ? 1 : 0;
case eCondition.EventQuestDayClear:
return bClear = GetPlayEventQuestDayClearCount(clearAllDay) >= achive.condValue ? 1 : 0;
case eCondition.Etc:
return bClear;
default:
return 0;
}
}
public static int GetAchievementValue(nAchivement achive)
{
int ivalue = 0;
int cnt = 0;
int sum = 0;
switch (achive.condition)
{
// 스테이지, 레벨, 각성, 플레이 시간(분), 플레이 시간, 출석
case eCondition.StageClear:
ivalue = GetMaxStage();
return ivalue;
case eCondition.PlayerLv:
ivalue = PlayData.playerLv;
return ivalue;
case eCondition.PlayerAwaken:
ivalue = PlayDgAwaken.lv - 1;
return ivalue;
case eCondition.PlayTimeM:
if (achive.contentType == eContentType.DailyQuest)
return PlayerDailyRecord.playTime;
else
return PlayerTotalRecord.playTime;
case eCondition.PlayTimeH:
return PlayerTotalRecord.playTime / 60;
case eCondition.PlayAtttend:
if (achive.contentType == eContentType.DailyQuest)
return PlayerDailyRecord.attendCnt;
else if (achive.contentType == eContentType.QuestMission)
return PlayerDailyRecord.attendCnt;
else
return PlayerTotalRecord.attendCnt;
// 몬스터 처치 횟수
case eCondition.MonsterCnt:
if (achive.contentType == eContentType.DailyQuest)
return PlayerDailyRecord.monsterKill;
else if (achive.contentType == eContentType.RepeatQuest)
return PlayerTotalRecord.monsterKill - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
else
return PlayerTotalRecord.monsterKill;
case eCondition.EliteCnt:
return ivalue;
case eCondition.BossCnt:
return ivalue;
// 소환 횟수
case eCondition.GachaAll:
if (achive.contentType == eContentType.DailyQuest)
return PlayerDailyRecord.gachaWeaponCnt + PlayerDailyRecord.gachaArmorCnt + PlayerDailyRecord.gachaAccCnt + PlayerDailyRecord.gachaTreasureCnt;
else if (achive.contentType == eContentType.RepeatQuest)
return (PlayerTotalRecord.gachaWeaponCnt + PlayerTotalRecord.gachaArmorCnt + PlayerTotalRecord.gachaAccCnt) - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
else
return PlayerTotalRecord.gachaWeaponCnt + PlayerTotalRecord.gachaArmorCnt + PlayerTotalRecord.gachaAccCnt;
case eCondition.GachaWeapon:
if(achive.contentType == eContentType.RepeatQuest)
return PlayerTotalRecord.gachaWeaponCnt - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return PlayerTotalRecord.gachaWeaponCnt;
case eCondition.GachaArmor:
if (achive.contentType == eContentType.RepeatQuest)
return PlayerTotalRecord.gachaArmorCnt - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return PlayerTotalRecord.gachaArmorCnt;
case eCondition.GachaAcc:
if (achive.contentType == eContentType.RepeatQuest)
return PlayerTotalRecord.gachaAccCnt - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return PlayerTotalRecord.gachaAccCnt;
case eCondition.GachaTreasure:
return PlayerTotalRecord.gachaTreasureCnt;
case eCondition.GachaWeaponLv:
return PlayData.gachaWeaponLv;
case eCondition.GachaArmorLv:
return PlayData.gachaArmorLv;
case eCondition.GachaAccLv:
return PlayData.gachaAccLv;
// 골드 강화 레벨
case eCondition.EnhanceGoldAll:
return ivalue = GetCharStat(1).level + GetCharStat(2).level + GetCharStat(3).level;
case eCondition.EnhanceGoldAtk:
if (achive.contentType == eContentType.RepeatQuest)
return ivalue = GetCharStat(1).level - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return ivalue = GetCharStat(1).level;
case eCondition.EnhanceGoldHp:
if (achive.contentType == eContentType.RepeatQuest)
return ivalue = GetCharStat(2).level - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return ivalue = GetCharStat(2).level;
case eCondition.EnhanceGoldAtkCount:
return ivalue = GetCharStat(1).level - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
case eCondition.EnhanceGoldHpCount:
return ivalue = GetCharStat(2).level - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
// 포인트 강화 레벨
case eCondition.EnhancePointAll:
Dictionary<int, dCharStat> lvpoints = GetCharLvPoints();
for (int i = 1; i < lvpoints.Count; i++)
{
sum += (lvpoints[i].level - 1);
}
return sum;
case eCondition.EnhancePointAtk:
return ivalue = GetCharLvPoint(1).level;
case eCondition.EnhancePointHp:
return ivalue = GetCharLvPoint(2).level;
// 스킬
case eCondition.SkillEquip:
return ivalue = isClearAchievements(achive);
case eCondition.SkillLvAll:
return ivalue = GetSkillTotalLevels()[0];
case eCondition.SkillLvActive:
for (int i = 0; i < dicSkillActive.Count; i++)
{
if (dicSkillActive[i+1].openLv <= PlayData.playerLv)
sum += dicSkillActive[i + 1].level - 1;
}
return ivalue = sum;
case eCondition.SkillLvPassive:
for (int i = 0; i < dicSkillPassive.Count; i++)
{
sum += dicSkillPassive[i + 1].level - 1;
}
return ivalue = sum;
// 잠재 능력
case eCondition.ChangeAbility:
return ivalue = isClearAchievements(achive) > 0 ? 1 : 0;
// 특정 코스튬 획득
case eCondition.CosHave:
return ivalue = GetCosCloth(achive.condValue).have ? 1 : 0;
case eCondition.CosCnt:
cnt = 0;
for (int i = 1; i < dicCosCloth.Count + 1; i++)
{
int key = dicCosCloth[i].id;
if (GetCosCloth(key).have)
cnt++;
}
return cnt;
case eCondition.CosSetHave:
return 0;
case eCondition.CosSetCnt:
for (int i = 1; i < dicCosClothSet.Count + 1; i++)
{
int key = dicCosClothSet[i].id;
if (IsActiveClothCosSetEffect(key))
cnt++;
}
return cnt;
// 모든 장비 획득
case eCondition.EquipHaveAll:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponAll, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorAll, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccAll, 1, 1)) <= 0)
return 0;
return 1;
case eCondition.EquipHaveD:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponD, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorD, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccD, 1, 1)) <= 0)
return 0;
return 1;
case eCondition.EquipHaveC:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponC, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorC, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccC, 1, 1)) <= 0)
return 0;
return 1;
case eCondition.EquipHaveB:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponB, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorB, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccB, 1, 1)) <= 0)
return 0;
return 1;
case eCondition.EquipHaveA:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponA, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorA, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccA, 1, 1)) <= 0)
return 0;
return 1;
case eCondition.EquipHaveS:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponS, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorS, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccS, 1, 1)) <= 0)
return 0;
return 1;
case eCondition.EquipHaveSS:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponSS, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorSS, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccSS, 1, 1)) <= 0)
return 0;
return 1;
case eCondition.EquipHaveSR:
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveWeaponSR, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveArmorSR, 1, 1)) <= 0)
return 0;
if (isClearAchievements(new nAchivement(eContentType.Title, eCondition.EquipHaveAccSR, 1, 1)) <= 0)
return 0;
return 1;
// 모든 무기 획득
case eCondition.EquipHaveWeaponAll:
sum = 0;
for (int i = 0; i < arrHaveWeapon.Length; i++)
{
sum += arrHaveWeapon[i];
}
return ivalue = sum >= 28 ? 1 : 0;
case eCondition.EquipHaveWeaponD:
return ivalue = arrHaveWeapon[0] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponC:
return ivalue = arrHaveWeapon[1] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponB:
return ivalue = arrHaveWeapon[2] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponA:
return ivalue = arrHaveWeapon[3] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponS:
return ivalue = arrHaveWeapon[4] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponSS:
return ivalue = arrHaveWeapon[5] >= 4 ? 1 : 0;
case eCondition.EquipHaveWeaponSR:
return ivalue = arrHaveWeapon[6] >= 4 ? 1 : 0;
// 모든 방어구 획득
case eCondition.EquipHaveArmorAll:
sum = 0;
foreach (var item in arrHaveArmor)
{
sum += item;
}
return ivalue = sum >= 84 ? 1 : 0;
case eCondition.EquipHaveArmorD:
return ivalue = arrHaveArmor[0, 0] >= 4 && arrHaveArmor[1, 0] >= 4 && arrHaveArmor[2, 0] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorC:
return ivalue = arrHaveArmor[0, 1] >= 4 && arrHaveArmor[1, 1] >= 4 && arrHaveArmor[2, 1] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorB:
return ivalue = arrHaveArmor[0, 2] >= 4 && arrHaveArmor[1, 2] >= 4 && arrHaveArmor[2, 2] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorA:
return ivalue = arrHaveArmor[0, 3] >= 4 && arrHaveArmor[1, 3] >= 4 && arrHaveArmor[2, 3] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorS:
return ivalue = arrHaveArmor[0, 4] >= 4 && arrHaveArmor[1, 4] >= 4 && arrHaveArmor[2, 4] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorSS:
return ivalue = arrHaveArmor[0, 5] >= 4 && arrHaveArmor[1, 5] >= 4 && arrHaveArmor[2, 5] >= 4 ? 1 : 0;
case eCondition.EquipHaveArmorSR:
return ivalue = arrHaveArmor[0, 6] >= 4 && arrHaveArmor[1, 6] >= 4 && arrHaveArmor[2, 6] >= 4 ? 1 : 0;
// 모든 장신구 획득
case eCondition.EquipHaveAccAll:
sum = 0;
foreach (var item in arrHaveAcc)
{
sum += item;
}
return ivalue = sum >= 84 ? 1 : 0;
case eCondition.EquipHaveAccD:
return ivalue = arrHaveAcc[0, 0] >= 4 && arrHaveAcc[1, 0] >= 4 && arrHaveAcc[2, 0] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccC:
return ivalue = arrHaveAcc[0, 1] >= 4 && arrHaveAcc[1, 1] >= 4 && arrHaveAcc[2, 1] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccB:
return ivalue = arrHaveAcc[0, 2] >= 4 && arrHaveAcc[1, 2] >= 4 && arrHaveAcc[2, 2] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccA:
return ivalue = arrHaveAcc[0, 3] >= 4 && arrHaveAcc[1, 3] >= 4 && arrHaveAcc[2, 3] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccS:
return ivalue = arrHaveAcc[0, 4] >= 4 && arrHaveAcc[1, 4] >= 4 && arrHaveAcc[2, 4] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccSS:
return ivalue = arrHaveAcc[0, 5] >= 4 && arrHaveAcc[1, 5] >= 4 && arrHaveAcc[2, 5] >= 4 ? 1 : 0;
case eCondition.EquipHaveAccSR:
return ivalue = arrHaveAcc[0, 6] >= 4 && arrHaveAcc[1, 6] >= 4 && arrHaveAcc[2, 6] >= 4 ? 1 : 0;
// 특정 등급의 무기 1개 이상
case eCondition.EquipHaveWeaponNOne:
return ivalue = arrHaveWeapon[0] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponROne:
return ivalue = arrHaveWeapon[1] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponEOne:
return ivalue = arrHaveWeapon[2] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponUOne:
return ivalue = arrHaveWeapon[3] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponLOne:
return ivalue = arrHaveWeapon[4] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponHOne:
return ivalue = arrHaveWeapon[5] >= 1 ? 1 : 0;
case eCondition.EquipHaveWeaponMOne:
return ivalue = arrHaveWeapon[6] >= 1 ? 1 : 0;
//특정 등급 귀걸이 1개 이상
case eCondition.EquipHaveEarNOne:
return ivalue = arrHaveAcc[0, 0] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarROne:
return ivalue = arrHaveAcc[0, 1] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarEOne:
return ivalue = arrHaveAcc[0, 2] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarUOne:
return ivalue = arrHaveAcc[0, 3] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarLOne:
return ivalue = arrHaveAcc[0, 4] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarHOne:
return ivalue = arrHaveAcc[0, 5] >= 1 ? 1 : 0;
case eCondition.EquipHaveEarMOne:
return ivalue = arrHaveAcc[0, 6] >= 1 ? 1 : 0;
//던전 도전 횟수
case eCondition.DgTryAll:
return ivalue = PlayDgGold.totalTry + +PlayDgReinStone.totalTry + PlayDgAwakenStone.totalTry + PlayDgPet.totalTry;
case eCondition.DgTryGold:
return ivalue = PlayDgGold.totalTry;
case eCondition.DgTryEnhance:
return ivalue = PlayDgReinStone.totalTry;
case eCondition.DgTryAwaken:
return ivalue = PlayDgAwakenStone.totalTry;
case eCondition.DgTryPet:
return ivalue = PlayDgPet.totalTry;
// 던전 스테이지 클리어
case eCondition.DgClearAll:
return ivalue = PlayDgGold.totalClear + PlayDgReinStone.totalClear + PlayDgAwakenStone.totalClear + PlayDgPet.totalClear;
case eCondition.DgClearGold:
return ivalue = PlayDgGold.totalClear;
case eCondition.DgClearEnhance:
return ivalue = PlayDgReinStone.totalClear;
case eCondition.DgClearAwaken:
return ivalue = PlayDgAwakenStone.totalClear;
case eCondition.DgClearPet:
return ivalue = PlayDgPet.totalClear;
case eCondition.DgStageGold:
return ivalue = PlayDgGold.lv;
case eCondition.DgStageEnhance:
return ivalue = PlayDgReinStone.lv;
case eCondition.DgStageAwaken:
return ivalue = PlayDgAwakenStone.lv;
case eCondition.DgStagePet:
return ivalue = PlayDgPet.lv;
// 장비 합성
case eCondition.EquipComposeAll:
if (achive.contentType == eContentType.DailyQuest)
return PlayerDailyRecord.composeWeaponCnt + PlayerDailyRecord.composeArmorCnt + PlayerDailyRecord.composeAccCnt;
else
return PlayerTotalRecord.composeWeaponCnt + PlayerTotalRecord.composeArmorCnt + PlayerTotalRecord.composeAccCnt;
case eCondition.EquipComposeWeapon:
if (achive.contentType == eContentType.RepeatQuest)
return ivalue = PlayerTotalRecord.composeWeaponCnt - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return ivalue = PlayerTotalRecord.composeWeaponCnt;
case eCondition.EquipComposeArmor:
if (achive.contentType == eContentType.RepeatQuest)
return ivalue = PlayerTotalRecord.composeArmorCnt - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return ivalue = PlayerTotalRecord.composeArmorCnt;
case eCondition.EquipComposeAcc:
if (achive.contentType == eContentType.RepeatQuest)
return ivalue = PlayerTotalRecord.composeAccCnt - achive.condValue * playQuestRepeat[achive.id - 1].totalCnt;
return ivalue = PlayerTotalRecord.composeAccCnt;
// 장비 강화 레벨
case eCondition.EquipLvAll:
return ivalue = GetGearTotalLevels(cGoods.TBagWeapon)[0] +
GetGearTotalLevels(cGoods.TBagArmorCape)[0] + GetGearTotalLevels(cGoods.TBagArmorHat)[0] + GetGearTotalLevels(cGoods.TBagArmorShoes)[0] +
GetGearTotalLevels(cGoods.TBagAcceEar)[0] + GetGearTotalLevels(cGoods.TBagAcceNeck)[0] + GetGearTotalLevels(cGoods.TBagAcceRing)[0];
case eCondition.EquipLvWeapon:
return ivalue = GetGearTotalLevels(cGoods.TBagWeapon)[0];
case eCondition.EquipLvArmor:
return ivalue = GetGearTotalLevels(cGoods.TBagArmorCape)[0] + GetGearTotalLevels(cGoods.TBagArmorHat)[0] + GetGearTotalLevels(cGoods.TBagArmorShoes)[0];
case eCondition.EquipLvAcc:
return ivalue = GetGearTotalLevels(cGoods.TBagAcceEar)[0] + GetGearTotalLevels(cGoods.TBagAcceNeck)[0] + GetGearTotalLevels(cGoods.TBagAcceRing)[0];
case eCondition.EquipLvTreasure:
return ivalue;
// 장비 장착
case eCondition.EquipWeapon:
case eCondition.EquipArmorCape:
case eCondition.EquipArmorHat:
case eCondition.EquipArmorShoes:
case eCondition.EquipAccEar:
case eCondition.EquipAccNeck:
case eCondition.EquipAccRing:
return ivalue = isClearAchievements(achive) > 0 ? 1 : 0;
// 장비 강화
case eCondition.EnhanceGear:
return ivalue;
case eCondition.EnhanceWeapon:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagWeapon].Count; i++)
{
if(dicGearEquipment[cGoods.TBagWeapon][i + 1].have)
sum += dicGearEquipment[cGoods.TBagWeapon][i + 1].level - 1;
}
return ivalue = sum;
case eCondition.EnhanceArmor:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorCape].Count; i++)
{
if (dicGearEquipment[cGoods.TBagArmorCape][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorCape][i + 1].level - 1;
}
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorHat].Count; i++)
{
if (dicGearEquipment[cGoods.TBagArmorHat][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorHat][i + 1].level - 1;
}
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorShoes].Count; i++)
{
if (dicGearEquipment[cGoods.TBagArmorShoes][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorShoes][i + 1].level - 1;
}
return ivalue = sum;
case eCondition.EnhanceArmorCape:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorCape].Count; i++)
{
if(dicGearEquipment[cGoods.TBagWeapon][i + 1].have)
sum += dicGearEquipment[cGoods.TBagWeapon][i + 1].level - 1;
}
return ivalue = sum;
case eCondition.EnhanceArmorHat:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorHat].Count; i++)
{
if(dicGearEquipment[cGoods.TBagArmorHat][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorHat][i + 1].level - 1;
}
return ivalue = sum;
case eCondition.EnhanceArmorShoes:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagArmorShoes].Count; i++)
{
if(dicGearEquipment[cGoods.TBagArmorShoes][i + 1].have)
sum += dicGearEquipment[cGoods.TBagArmorShoes][i + 1].level - 1;
}
return ivalue = sum;
case eCondition.EnhanceAcc:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceEar].Count; i++)
{
if(dicGearEquipment[cGoods.TBagAcceEar][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceEar][i + 1].level - 1;
}
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceNeck].Count; i++)
{
if(dicGearEquipment[cGoods.TBagAcceNeck][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceNeck][i + 1].level - 1;
}
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceRing].Count; i++)
{
if(dicGearEquipment[cGoods.TBagAcceRing][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceRing][i + 1].level - 1;
}
return ivalue = sum;
case eCondition.EnhanceAccEar:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceEar].Count; i++)
{
if(dicGearEquipment[cGoods.TBagAcceEar][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceEar][i + 1].level - 1;
}
return ivalue = sum;
case eCondition.EnhanceAccNeck:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceNeck].Count; i++)
{
if (dicGearEquipment[cGoods.TBagAcceNeck][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceNeck][i + 1].level - 1;
}
return ivalue = sum;
case eCondition.EnhanceAccRing:
sum = 0;
for (int i = 0; i < dicGearEquipment[cGoods.TBagAcceRing].Count; i++)
{
if (dicGearEquipment[cGoods.TBagAcceRing][i + 1].have)
sum += dicGearEquipment[cGoods.TBagAcceRing][i + 1].level - 1;
}
return ivalue = sum;
case eCondition.EnhanceTreasure:
sum = 0;
for (int i = 0; i < dicGearTreasure.Count; i++)
{
if(dicGearTreasure[i + 1].have)
sum += dicGearTreasure[i + 1].level - 1;
}
return ivalue = sum;
// 펫
case eCondition.PetEnhance:
for (int i = 0; i < dicPet.Count; i++)
{
if (dicPet[i + 1].have)
{
sum += dicPet[i + 1].level - 1;
}
}
return ivalue = sum;
case eCondition.PetHave:
return ivalue = dicPet[achive.condValue].have ? 1 : 0;
case eCondition.PetspiritCompose:
return ivalue = PlayerTotalRecord.composePetSpirit;
// 일일 퀘스트
case eCondition.DailyQuestClear:
return ivalue = PlayerDailyRecord.clearDailyQuest;
// 아이콘, 칭호 장착
case eCondition.EquipIcon:
return ivalue = PlayData.playerIcon == achive.condValue ? 1 : 0;
case eCondition.EquipTitle:
return ivalue = PlayData.playerTitle == achive.condValue ? 1 : 0;
// 보석, 색상석 사용
case eCondition.UseDia:
return ivalue;
// 자동 전투 활성화
case eCondition.AutoBattle:
return ivalue = BattleMgr.GetAuto() ? 1 : 0;
// 닉네임 변경
case eCondition.RenameCnt:
return ivalue = PlayerTotalRecord.renameCnt;
// 광고 버프
case eCondition.ActivateADbuff:
return ivalue = PlayBuff.adTimer[0] > 0 || PlayBuff.adTimer[1] > 0 || PlayBuff.adTimer[2] > 0 ? 1 : 0;
case eCondition.ActivateADbuffAtk:
return ivalue = PlayBuff.adTimer[0] > 0 ? 1 : 0;
case eCondition.ActivateADbuffExp:
return ivalue = PlayBuff.adTimer[1] > 0 ? 1 : 0;
case eCondition.ActivateADbuffGold:
return ivalue = PlayBuff.adTimer[2] > 0 ? 1 : 0;
case eCondition.ADbuffAtkLv:
return ivalue = PlayBuff.atkLv;
case eCondition.ADbuffExpLv:
return ivalue = PlayBuff.expLv;
case eCondition.ADbuffGoldLv:
return ivalue = PlayBuff.goldLv;
case eCondition.Etc:
if (achive.contentType == eContentType.Title)
ivalue = sysProfileTitle[achive.id].have ? 1 : 0;
else if (achive.contentType == eContentType.Icon)
ivalue = sysProfileIcon[achive.id].have ? 1 : 0;
else
ivalue = 0;
return ivalue;
default:
return -1;
}
}
public static int GetAchievementValueWithDay(nAchivement achive, int day)
{
switch (achive.condition)
{
case eCondition.EventQuestDayClear:
return GetPlayEventQuestDayClearCount(day);
default:
return -1;
}
}
#endregion
#region Quest
public static dQuest GetDailyQuest(int id)
{
return sysQuestDaily[id];
}
public static Dictionary<int, dQuest> GetDailyQuests()
{
return sysQuestDaily;
}
public static dQuest GetRepeatQuest(int id)
{
return sysQuestRepeat[id];
}
public static Dictionary<int, dQuest> GetRepeatQuests()
{
return sysQuestRepeat;
}
public static void SetDailyQuestPlay(cQuestDaily data)
{
playQuestDaily[data.sid - 1] = data;
}
public static void SetDailyQuestAllPlay(cQuestDaily[] datas)
{
playQuestDaily = datas;
}
public static cQuestDaily GetDailyQuestPlay(int id)
{
return playQuestDaily[id - 1];
}
public static cQuestRepeat GetRepeatQuestPlay(int id)
{
return playQuestRepeat[id - 1];
}
public static void SetRepeatQuestPlay(cQuestRepeat data)
{
playQuestRepeat[data.sid - 1] = data;
}
public static void SetRepeatQuestAllPlay(cQuestRepeat[] datas)
{
playQuestRepeat = datas;
}
public static void LoadPlayEventQuestPlay(cQuestEvent[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
if (playQuestEvent.ContainsKey(datas[i].sid))
playQuestEvent[datas[i].sid] = datas[i];
else
playQuestEvent.Add(datas[i].sid, datas[i]);
}
}
public static Dictionary<int,cQuestEvent> GetPlayEventQuestPlay()
{
return playQuestEvent;
}
public static cQuestEvent GetPlayEventQuestPlay(int sid)
{
return playQuestEvent[sid];
}
public static void SetPlayEventQuestPlay(cQuestEvent eventQuest)
{
playQuestEvent[eventQuest.sid] = eventQuest;
}
public static int GetPlayEventQuestDayClearCount(int day)
{
int count = 0;
foreach (var item in sysQuestEvent)
{
if (item.Value.day == day)
{
if (playQuestEvent[item.Value.id].cond > 0)
{
count++;
}
}
}
return count;
}
public static void LoadPlayEventQuestAttendPlay(cQuestAttend datas)
{
playQuestEventAttend = datas;
}
public static cQuestAttend GetPlayEventQuestAttendPlay()
{
return playQuestEventAttend;
}
#endregion
#region Mission
public static dMission[] GetAllQuestMission()
{
return sysQuestMission.Values.ToArray();
}
public static dMission GetQuestMission(int key)
{
if (!sysQuestMission.ContainsKey(key))
return null;
return sysQuestMission[key];
}
#endregion
#region AdBuff
public static dAdBuff[] GetSysAdBuffs()
{
return sysBuff;
}
public static dAdBuff GetSysAdBuffLevel(int ilv)
{
if (ilv >= sysBuff.Length)
{
return sysBuff[sysBuff.Length - 1];
}
return sysBuff[ilv - 1];
}
public static int GetSysAdBuffMaxLevel()
{
return sysBuff.Length;
}
#endregion
#region Attend
public static dAttend[] GetSysAttend()
{
return sysAttend;
}
public static void LoadPlayAttend(cAttend[] playattend)
{
playAttend = playattend;
}
public static cAttend[] GetPlayAttend()
{
return playAttend;
}
#endregion
#region Event
public static void LoadSysEvent(dEvent[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
if (dicEvent.ContainsKey(datas[i].id))
dicEvent[datas[i].id] = datas[i];
else
dicEvent.Add(datas[i].id, datas[i]);
}
}
public static Dictionary<int, dEvent> GetEvents()
{
return dicEvent;
}
public static dEvent GetEvent(int key)
{
if (!dicEvent.ContainsKey(key))
return null;
return dicEvent[key];
}
public static dEvent GetEventByKind(eEventMoveType eventkind)
{
foreach (var item in dicEvent)
{
if (eventkind == item.Value.moveType)
return item.Value;
}
return null;
}
public static void LoadSysEventQuest(dQuest[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
if (sysQuestEvent.ContainsKey(datas[i].id))
sysQuestEvent[datas[i].id] = datas[i];
else
sysQuestEvent.Add(datas[i].id, datas[i]);
}
}
public static Dictionary<int, dQuest> GetSysEventQuest()
{
return sysQuestEvent;
}
public static dQuest GetSysEventGetCompleteAllQuest(int day)//어느 퀘스트가 모두 완료 형식의 퀘스트인지 분간하는 용도. 모두 완료 형식은 날짜 첫번째 퀘스트가 되어야 한다.
{
for (int i = 0; i < sysQuestEvent.Count; i++)
{
if (day == (int)sysQuestEvent[i + 1].day)
{
return sysQuestEvent[i + 1];
}
}
return sysQuestEvent[1];
}
public static dQuest GetSysEventQuest(int key)
{
if (!sysQuestEvent.ContainsKey(key))
return null;
return sysQuestEvent[key];
}
public static void LoadSysEventTrade(dEventInfo eventinfo)
{
sysEventTrade = eventinfo;
}
public static dEventInfo GetSysEventTrade()
{
return sysEventTrade;
}
public static void LoadPlayEventTrade(cEventItem playereventtrade)
{
playEventRoulette = new cEventItem();
playEventTrade = playereventtrade;
}
public static void LoadSysEventRaise(dEventInfo eventinfo)
{
sysEventRaise = eventinfo;
}
public static dEventInfo GetSysEventRaise()
{
return sysEventRaise;
}
public static void LoadSysEventRoulette(dEventInfo eventinfo)
{
sysEventRoulette = eventinfo;
}
public static dEventInfo GetSysEventRoulette()
{
return sysEventRoulette;
}
public static cEventItem GetPlayEventTrade()
{
return playEventTrade;
}
public static void LoadPlayEventRaise(cEventItem playereventraise)
{
playEventRaise = playereventraise;
}
public static cEventItem GetPlayEventRaise()
{
return playEventRaise;
}
public static void LoadPlayEventRoulette(cEventItem playereventroulette)
{
playEventRoulette = playereventroulette;
}
public static cEventItem GetPlayEventRoulette()
{
return playEventRoulette;
}
public static void SetPlayEventTrade(cEventItem trade)
{
playEventTrade = trade;
}
public static void LoadSysRewardEvent(dRewardEvent datas)
{
sysRewardEvent = datas;
}
public static dRewardEvent GetRewardEvent()
{
return sysRewardEvent;
}
#endregion
#region Shop
// 상점 시스템 데이터.
public static void LoadShop(dShop[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
if (datas[i].rewards.Length == 0)
continue;
int key = datas[i].id;
datas[i].refreshAt = DateTime.MaxValue;
if (dicShop.ContainsKey(key))
{
dicShop[key] = datas[i];
}
else
{
dicShop.Add(key, datas[i]);
int igroup = (int)datas[i].shopType;
if (igroup >= 0 && igroup < shopIdList.Length)
shopIdList[igroup].Add(key);
}
// 패스 상품일 경우 패스에 상품 ID 정보 추가.
//Debug.Log(datas[i].shopType + " : " + datas[i].rewards[0].rewardType);
if (datas[i].shopType == eShopType.Pass)
{
dPass pass = GetPassById(datas[i].rewards[0].rewardId);
if (pass != null)
{
int ipage = (int)datas[i].rewards[0].rewardCount;
if (ipage >= 0 && ipage < pass.shopIds.Length)
pass.shopIds[ipage] = key;
}
}
}
}
// 상점 플레이 데이터.
public static void LoadShopPlay(sShopPlay[] playdatas)
{
for (int i = 0; i < playdatas.Length; i++)
{
int key = playdatas[i].sid;
if (!dicShop.ContainsKey(key))
continue;
if (playdatas[i].refreshAt <= TimeUtils.Now())
{
playdatas[i].buyCnt = 0;
playdatas[i].refreshAt = DateTime.MaxValue;
}
dicShop[key].buyCnt = playdatas[i].buyCnt;
dicShop[key].totalCnt = playdatas[i].totalCnt;
dicShop[key].refreshAt = playdatas[i].refreshAt;
}
// 보석/의상/무기/일반/마일리지 정렬.
SortShopIdsOrder(eShopType.Dia);
SortShopIdsOrder(eShopType.CostumeCloth);
SortShopIdsOrder(eShopType.CostumeWeapon);
SortShopIdsOrder(eShopType.General);
SortShopIdsOrder(eShopType.Mileage);
// 이벤트/특별패키지/코스튬패키지만 정렬함.
SortShopIdsOrderLimit(eShopType.Event);
SortShopIdsOrderLimit(eShopType.SpecialPack);
SortShopIdsOrderLimit(eShopType.CostumePack);
}
// 상점 아이템 sortOrder 따라 정렬. 플레이 데이터 로딩 후, 구매 제한 횟수 충족 후 호출. 보석/의상/무기/일반/마일리지 정렬.
private static void SortShopIdsOrder(eShopType shoptype)
{
int igroup = (int)shoptype;
if (shopIdList[igroup].Count == 0)
return;
int ilen = shopIdList[igroup].Count;
// 뒤에서부터 앞으로 비교.
for (int i = ilen - 2; i >= 0; i--)
{
int key = shopIdList[igroup][i];
dShop data = dicShop[key];
int iorder = data.sortOrder;
int igoto = i;
// 현재 항목 바로 다음 항목부터 뒤쪽으로 비교.
for (int j = i + 1; j < ilen; j++)
{
int key2 = shopIdList[igroup][j];
dShop data2 = dicShop[key2];
int iorder2 = data2.sortOrder;
// 더 이상의 순서 변동 없음.
if (iorder <= iorder2)
break;
igoto = j;
}
// 순서 변동 있음.
if (i != igoto)
{
// 기존 위치 제거 후 변경할 위치에 삽입.
shopIdList[igroup].RemoveAt(i);
shopIdList[igroup].Insert(igoto, key);
}
}
}
// 상점 아이템 sortOrder, 구매 완료에 따라 정렬. 플레이 데이터 로딩 후, 구매 제한 횟수 충족 후 호출. 이벤트/특별패키지/코스튬패키지만 정렬함.
private static void SortShopIdsOrderLimit(eShopType shoptype)
{
int igroup = (int)shoptype;
if (shopIdList[igroup].Count == 0)
return;
int ilen = shopIdList[igroup].Count;
// 뒤에서부터 앞으로 비교.
for (int i = ilen - 2; i >= 0; i--)
{
int key = shopIdList[igroup][i];
dShop data = dicShop[key];
int iorder = data.sortOrder + (data.buyCnt >= data.limitCnt ? 100000 : 0);
int igoto = i;
// 현재 항목 바로 다음 항목부터 뒤쪽으로 비교.
for (int j = i + 1; j < ilen; j++)
{
int key2 = shopIdList[igroup][j];
dShop data2 = dicShop[key2];
int iorder2 = data2.sortOrder + (data2.buyCnt >= data2.limitCnt ? 100000 : 0);
// 더 이상의 순서 변동 없음.
if (iorder <= iorder2)
break;
igoto = j;
}
// 순서 변동 있음.
if (i != igoto)
{
// 기존 위치 제거 후 변경할 위치에 삽입.
shopIdList[igroup].RemoveAt(i);
shopIdList[igroup].Insert(igoto, key);
}
}
}
// 상점 정렬된 ID 목록 가져오기.
public static List<int> GetShopIds(eShopType shoptype)
{
return shopIdList[(int)shoptype];
}
// 상점 데이터 가져오기.
public static dShop GetShop(int key)
{
return dicShop[key];
}
// 인덱스로 상점 데이터 가져오기.
public static dShop GetShopByIndex(eShopType shoptype, int index)
{
int igroup = (int)shoptype;
if (index < 0 || index >= shopIdList[igroup].Count)
return null;
int key = shopIdList[igroup][index];
return dicShop[key];
}
// 상점 구매 초기화 처리.
public static void ResetShop()
{
foreach (var item in dicShop)
{
if (item.Value.refreshAt <= TimeUtils.Now())
{
item.Value.buyCnt = 0;
item.Value.refreshAt = DateTime.MaxValue;
}
}
}
// 가격 텍스트 가져오기.
public static string GetShopPrice(int key, int icount)
{
if (key < 0 || !dicShop.ContainsKey(key))
return FormatString.TextPriceCash(9999);
dShop data = dicShop[key];
if (data.buyingType == cGoods.TAds)
return LocalizationText.GetText("adbuff_playad");
if (data.buyingType == cGoods.TCash)
{
if (string.IsNullOrEmpty(data.productId))
return FormatString.TextPriceCash(data.buyingCnt * icount);
string strprice = IapMgr.SGetPrice(data.productId);
if (!string.IsNullOrEmpty(strprice))
return strprice;
return FormatString.TextPriceCash(data.buyingCnt * icount);
}
return FormatString.TextInt(data.buyingCnt * icount);
}
// 구매 후 처리.
public static void BuyShop(int key, int ibuycnt, int itotalcnt, DateTime refreshtime)
{
if (key < 0 || !dicShop.ContainsKey(key))
return;
dShop data = dicShop[key];
data.buyCnt = ibuycnt;
data.totalCnt = itotalcnt;
if (data.refreshType == eRefreshType.None || data.refreshType == eRefreshType.Account)
data.refreshAt = DateTime.MaxValue;
else
data.refreshAt = refreshtime;
// 이벤트/특별패키지/코스튬패키지만 정렬함.
if (data.buyCnt >= data.limitCnt && data.shopType == eShopType.Event || data.shopType == eShopType.SpecialPack || data.shopType == eShopType.CostumePack)
SortShopIdsOrderLimit(data.shopType);
}
#endregion Shop
#region Pass
// 패스 시스템 데이터. 패스ID가 아닌 조건을 키로 사용.
public static void LoadPass(dPass[] datas)
{
for (int i = 0; i < datas.Length; i++)
{
eCondition key = datas[i].condType;
int ilen = (datas[i].levels.Length - 1) / datas[i].passUnit + 1;
datas[i].isPaid = new bool[ilen];
datas[i].haveLvFrees = new int[ilen];
datas[i].haveLvPaids = new int[ilen];
datas[i].refreshAt = datas[i].endAt;
datas[i].shopIds = new int[ilen];
for (int k = 0; k < ilen; k++)
datas[i].shopIds[k] = -1;
// 일회성 패스.
if (datas[i].passType == 1)
{
if (dicPass.ContainsKey(key))
dicPass[key] = datas[i];
else
dicPass.Add(key, datas[i]);
}
// 이벤트 패스.
else if (datas[i].passType == 2)
{
if (datas[i].startAt <= TimeUtils.Now())
passEvent = datas[i];
else
passEventNext = datas[i];
}
}
}
// 패스 플레이 데이터.
public static void LoadPassPlay(sPassPlay[] playdatas)
{
for (int i = 0; i < playdatas.Length; i++)
{
dPass passdata = null;
if (passEvent != null && playdatas[i].sid == passEvent.id)
{
passdata = passEvent;
}
else if (passEventNext != null && playdatas[i].sid == passEventNext.id)
{
passdata = passEventNext;
}
else
{
foreach (var item in dicPass)
{
if (playdatas[i].sid == item.Value.id)
{
passdata = item.Value;
break;
}
}
}
if (passdata == null)
continue;
if (playdatas[i].refreshAt < passdata.endAt)
passdata.refreshAt = playdatas[i].refreshAt;
// 달성도 세팅.
switch (passdata.condType)
{
case eCondition.StageClear:
passdata.progress = PlayData.clearStage;
break;
case eCondition.PlayerLv:
passdata.progress = PlayData.playerLv;
break;
default:
if (bLoadLocalData)
passdata.progress = ES3.Load<int>(playdatas[i].sid.ToString(), Global.ES3_Pass, 0);
else
passdata.progress = playdatas[i].progress;
break;
}
// 유료 구매, 보상 수령 상태.
int ilen = passdata.isPaid.Length;
for (int p = 0; p < ilen; p++)
{
if (playdatas[i].isPaid != null && p < playdatas[i].isPaid.Length)
passdata.isPaid[p] = playdatas[i].isPaid[p];
if (playdatas[i].haveLvFrees != null && p < playdatas[i].haveLvFrees.Length)
passdata.haveLvFrees[p] = playdatas[i].haveLvFrees[p];
if (playdatas[i].haveLvPaids != null && p < playdatas[i].haveLvPaids.Length)
passdata.haveLvPaids[p] = playdatas[i].haveLvPaids[p];
}
// 달성도 레벨 계산.
dPassLevel[] levels = passdata.levels;
int k = 0;
while (passdata.progress >= levels[k].condValue)
{
k++;
if (k >= levels.Length)
break;
}
passdata.availLevel = k;
}
}
// 패스 목록 가져오기.
public static Dictionary<eCondition, dPass> GetPasses()
{
return dicPass;
}
// 아이디로 패스 가져오기.
public static dPass GetPassById(int id)
{
if (passEvent != null)
{
if (id == passEvent.id)
return passEvent;
}
if (passEventNext != null)
{
if (id == passEventNext.id)
return passEventNext;
}
foreach (var item in dicPass)
{
if (id == item.Value.id)
return item.Value;
}
return null;
}
// 패스 정보 가져오기.
public static dPass GetPass(int passtype, eCondition condtype)
{
// 일회성 패스.
if (passtype == 1)
{
if (dicPass.ContainsKey(condtype))
return dicPass[condtype];
}
// 이벤트 패스.
else if (passtype == 2)
{
return passEvent;
}
return null;
}
// 패스 갱신 시간 가져오기.
public static DateTime GetPassResetTime()
{
//if (dicPassRepeat.Count == 0)
// return dicPassRepeat[cGoods.PMonster].resetAt;
return DateTime.MaxValue;
}
// 이벤트/반복 패스 갱신(초기화).
public static bool ResetPass()
{
bool breset = false;
// 이벤트 패스 갱신.
// 현재 이벤트 패스가 존재함.
if (passEvent != null)
{
// 이벤트 패스가 종료되었을 때.
if (passEvent.endAt <= TimeUtils.Now())
{
breset = true;
// 다음 이벤트 패스가 없음.
if (passEventNext == null)
{
passEvent = null;
}
// 다음 이벤트 패스가 존재하고, 시작 시간이 되었을 때. 이벤트 패스 교체.
else if (passEventNext != null && passEventNext.startAt >= TimeUtils.Now())
{
passEvent = passEventNext;
passEventNext = null;
}
// 다음 이벤트 패스가 존재하지만, 아직 시작 시간이 아닐 때.
else
{
passEvent = null;
}
}
}
// 현재 이벤트 패스가 없으며, 다음 이벤트 패스가 존재하고, 시작 시간이 되었을 때. 이벤트 패스 교체.
else if (passEventNext != null && passEventNext.startAt >= TimeUtils.Now())
{
breset = true;
passEvent = passEventNext;
passEventNext = null;
}
// 다음 이벤트 패스가 존재하지만, 아직 시작 시간이 아닐 때.
else
{
breset = true;
passEvent = null;
}
// 반복 패스 초기화.
//DateTime resetat = TimeUtils.NextMonthUtc();
//foreach (var item in dicPassRepeat)
//{
// item.Value.resetAt = resetat;
// item.Value.isPaid = false;
// item.Value.progress = 0;
// item.Value.haveLevelFree = 0;
// item.Value.haveLevelPaid = 0;
// item.Value.availLevel = 0;
// ES3.Save<int>(item.Value.id.ToString(), item.Value.progress, Global.ES3_Pass);
//}
return breset;
}
// 패스 레벨 정보 가져오기.
public static dPassLevel GetPassLevel(int passtype, eCondition condtype, int ilevel)
{
// 일회성 패스.
if (passtype == 1)
{
if (dicPass.ContainsKey(condtype))
return dicPass[condtype].levels[ilevel - 1];
}
// 이벤트 패스.
else if (passtype == 2)
{
if (passEvent != null)
return passEvent.levels[ilevel - 1];
}
return null;
}
// 패스 저장.
private static void SavePass()
{
// 일회성 패스.
foreach (var item in dicPass)
{
ES3.Save<int>(item.Value.id.ToString(), item.Value.progress, Global.ES3_Pass);
}
// 이벤트 패스.
if (passEvent != null)
ES3.Save<int>(passEvent.id.ToString(), passEvent.progress, Global.ES3_Pass);
}
// 패스 진행도. 일반 몬스터 처치 등 자주 처리되는 것이 있을 수 있으므로 여기서 바로 저장하지는 않음.
public static void SetPassProgress(eCondition condtype, int ivalue)
{
// 일회성 패스.
if (dicPass.ContainsKey(condtype))
dicPass[condtype].progress = ivalue;
// 이벤트 패스.
if (passEvent != null && passEvent.condType == condtype)
passEvent.progress = ivalue;
}
// 패스 진행도. 일반 몬스터 처치 등 자주 처리되는 것이 있을 수 있으므로 여기서 바로 저장하지는 않음.
public static void AddPassProgress(eCondition condtype, int ivalue)
{
// 일회성 패스.
if (dicPass.ContainsKey(condtype))
dicPass[condtype].progress += ivalue;
// 이벤트 패스.
if (passEvent != null && passEvent.condType == condtype)
passEvent.progress += ivalue;
}
// 패스 진행도 계산. 보상 획득 시점, 뱃지 갱신할때 호출.
public static void CalcPassProgress(int passtype, eCondition condtype)
{
dPass passdata = null;
// 일회성 패스.
if (passtype == 1)
{
if (!dicPass.ContainsKey(condtype))
return;
passdata = dicPass[condtype];
}
// 이벤트 패스.
else if (passtype == 2)
{
if (passEvent == null)
return;
passdata = passEvent;
}
else
{
return;
}
// 이미 최고 단계까지 달성했을 경우.
if (passdata.availLevel >= passdata.levels.Length)
return;
dPassLevel[] levels = passdata.levels;
// 달성 단계 다시 계산.
int k = passdata.availLevel;
while (passdata.progress >= levels[k].condValue)
{
k++;
if (k >= levels.Length)
break;
}
passdata.availLevel = k;
}
// 패스 수령 가능한 보상이 있는지.
public static bool IsPassRewAvail(int passtype, eCondition condtype)
{
dPass passdata = null;
// 일회성 패스.
if (passtype == 1)
{
if (!dicPass.ContainsKey(condtype))
return false;
passdata = dicPass[condtype];
}
// 이벤트 패스.
else if (passtype == 2)
{
if (passEvent == null)
return false;
passdata = passEvent;
}
else
{
return false;
}
int imaxpage = passdata.isPaid.Length;
for (int k = 0; k < imaxpage; k++)
{
int iminindexinc = k * passdata.passUnit;
// 수령 가능한 최대 항목이 페이지 처음 항목 이전일 경우.
if (passdata.availLevel <= iminindexinc)
return false;
int imaxindexexc = (k + 1) * passdata.passUnit;
// 유료패스 활성화 상태.
if (passdata.isPaid[k])
{
// 페이지에서 수령한 항목이 페이지의 마지막 항목 이전일 경우.
if (passdata.haveLvPaids[k] < imaxindexexc)
{
// 수령 가능한 항목이 있을 경우.
if (passdata.haveLvPaids[k] < passdata.availLevel)
return true;
}
}
else
{
// 페이지에서 수령한 항목이 페이지의 마지막 항목 이전일 경우.
if (passdata.haveLvFrees[k] < imaxindexexc)
{
// 수령 가능한 항목이 있을 경우.
if (passdata.haveLvFrees[k] < passdata.availLevel)
return true;
}
}
}
return false;
}
// 패스 현재 페이지에 수령 가능한 보상이 있는지.
public static bool IsPassRewAvail(int passtype, eCondition condtype, int pageindex)
{
dPass passdata = null;
// 일회성 패스.
if (passtype == 1)
{
if (!dicPass.ContainsKey(condtype))
return false;
passdata = dicPass[condtype];
}
// 이벤트 패스.
else if (passtype == 2)
{
if (passEvent == null)
return false;
passdata = passEvent;
}
else
{
return false;
}
int imaxpage = passdata.isPaid.Length;
if (pageindex >= imaxpage)
return false;
int iminindexinc = pageindex * passdata.passUnit;
// 수령 가능한 최대 항목이 페이지 처음 항목 이전일 경우.
if (passdata.availLevel <= iminindexinc)
return false;
int imaxindexexc = (pageindex + 1) * passdata.passUnit;
// 유료패스 활성화 상태.
if (passdata.isPaid[pageindex])
{
// 페이지에서 수령한 항목이 페이지의 마지막 항목 이전일 경우.
if (passdata.haveLvPaids[pageindex] < imaxindexexc)
{
// 수령 가능한 항목이 있을 경우.
if (passdata.haveLvPaids[pageindex] < passdata.availLevel)
return true;
}
}
else
{
// 페이지에서 수령한 항목이 페이지의 마지막 항목 이전일 경우.
if (passdata.haveLvFrees[pageindex] < imaxindexexc)
{
// 수령 가능한 항목이 있을 경우.
if (passdata.haveLvFrees[pageindex] < passdata.availLevel)
return true;
}
}
return false;
}
// 패스 보상 목록 획득.
public static List<nGoods> GetPassRewards(int passtype, eCondition condtype, int pageindex)
{
dPass passdata = null;
// 일회성 패스.
if (passtype == 1)
{
if (!dicPass.ContainsKey(condtype))
return null;
passdata = dicPass[condtype];
}
// 이벤트 패스.
else if (passtype == 2)
{
if (passEvent == null)
return null;
passdata = passEvent;
}
else
{
return null;
}
CalcPassProgress(passtype, condtype);
int iminindexinc = pageindex * passdata.passUnit;
int imaxindexexc = (pageindex + 1) * passdata.passUnit;
if (imaxindexexc > passdata.availLevel)
imaxindexexc = passdata.availLevel;
if (passdata.isPaid[pageindex])
{
if (passdata.haveLvFrees[pageindex] >= passdata.haveLvPaids[pageindex])
{
if (iminindexinc < passdata.haveLvPaids[pageindex])
iminindexinc = passdata.haveLvPaids[pageindex];
}
else
{
if (iminindexinc < passdata.haveLvFrees[pageindex])
iminindexinc = passdata.haveLvFrees[pageindex];
}
}
else
{
if (iminindexinc < passdata.haveLvFrees[pageindex])
iminindexinc = passdata.haveLvFrees[pageindex];
}
// 받을 수 있는 보상이 없음.
if (iminindexinc >= imaxindexexc)
return null;
// 전체 보상 계산.
List<nGoods> getgoods = new List<nGoods>();
for (int k = iminindexinc; k < imaxindexexc; k++)
{
// 무료 보상.
if (k >= passdata.haveLvFrees[pageindex])
{
bool baddnew = true;
for (int i = 0; i < getgoods.Count; i++)
{
if (getgoods[i].propertyType == passdata.levels[k].freeRewardType && getgoods[i].propertyId == passdata.levels[k].freeRewardId)
{
baddnew = false;
getgoods[i].propertyCount += passdata.levels[k].freeReward;
break;
}
}
if (baddnew)
{
getgoods.Add(new nGoods(passdata.levels[k].freeRewardType, passdata.levels[k].freeRewardId, passdata.levels[k].freeReward));
}
}
if (!passdata.isPaid[pageindex])
continue;
// 유료 보상.
if (k >= passdata.haveLvPaids[pageindex])
{
bool baddnew = true;
for (int i = 0; i < getgoods.Count; i++)
{
if (getgoods[i].propertyType == passdata.levels[k].paidRewardType && getgoods[i].propertyId == passdata.levels[k].paidRewardId)
{
baddnew = false;
getgoods[i].propertyCount += passdata.levels[k].paidReward;
break;
}
}
if (baddnew)
{
getgoods.Add(new nGoods(passdata.levels[k].paidRewardType, passdata.levels[k].paidRewardId, passdata.levels[k].paidReward));
}
}
}
return getgoods;
}
// 패스 보상 획득시 처리.
public static void RecvPassReward(int passtype, eCondition condtype, int pageindex, int level)
{
// 일회성 패스.
if (passtype == 1)
{
if (dicPass.ContainsKey(condtype))
{
dicPass[condtype].haveLvFrees[pageindex] = level;
if (dicPass[condtype].isPaid[pageindex])
dicPass[condtype].haveLvPaids[pageindex] = level;
}
}
// 이벤트 패스.
else if (passtype == 2)
{
if (passEvent != null)
{
passEvent.haveLvFrees[pageindex] = level;
if (passEvent.isPaid[pageindex])
passEvent.haveLvPaids[pageindex] = level;
}
}
}
// 패스 구매.
public static void BuyPass(int passtype, eCondition condtype, int pageindex)
{
// 일회성 패스.
if (passtype == 1)
{
if (dicPass.ContainsKey(condtype))
dicPass[condtype].isPaid[pageindex] = true;
}
// 이벤트 패스.
else if (passtype == 2)
{
if (passEvent != null)
passEvent.isPaid[pageindex] = true;
}
}
#endregion Pass
#region Mail
// 우편 데이터 로드.
public static void LoadMail(dMail[] mails, bool bupdatecount, bool bserver)
{
if (mails == null)
mails = new dMail[0];
Mails = mails;
if (bupdatecount)
MailCount = Mails.Length;
if (bserver)
MailRefreshTime = TimeUtils.Now().AddMinutes(5d);
}
// 읽은 우편 데이터 로드.
public static void LoadMailRead(dMail[] reads, bool bserver)
{
if (reads == null)
reads = new dMail[0];
MailReads = reads;
if (bserver)
MailReadRefreshTime = TimeUtils.Now().AddMinutes(5d);
}
// 우편 수.
public static void SetMailCount(int icnt)
{
MailCount = icnt;
if (Mails != null && MailCount != Mails.Length)
MailRefreshTime = TimeUtils.Now();
}
// 우편 내역 갱신 시간 수정.
public static void UpdateMailReadTime()
{
if (MailReads != null)
MailReadRefreshTime = TimeUtils.Now();
}
// 우편 목록.
public static dMail[] GetMails()
{
return Mails;
}
// 읽은 우편 목록.
public static dMail[] GetMailReads()
{
return MailReads;
}
// 우편(인덱스).
public static dMail GetMailByIndex(int itype, int index)
{
if (Mails == null)
return null;
// 읽지 않은 우편.
if (itype == 0)
{
if (index >= Mails.Length)
return null;
return Mails[index];
}
// 읽은 우편.
if (index >= MailReads.Length)
return null;
return MailReads[index];
}
// 우편(인덱스).
public static dMail GetMailByIndex(int index)
{
if (Mails == null || index >= Mails.Length)
return null;
return Mails[index];
}
// 읽은 우편(인덱스).
public static dMail GetMailReadByIndex(int index)
{
if (MailReads == null || index >= MailReads.Length)
return null;
return MailReads[index];
}
#endregion Mail
#region Pvp
// 결투장 데이터.
public static void LoadPvp(dPvp pvpsys)
{
if (pvpsys == null)
return;
pvpSys = pvpsys;
pvpRewards = pvpSys.missions;
pvpTiers = pvpSys.tier;
pvpSys.missions = null;
pvpSys.tier = null;
}
// 결투장 데이터.
public static void LoadPvpPlay(cPvpPlay pvpplay, dPvpRank pvpmyrank)
{
if (pvpplay == null)
return;
pvpPlay = pvpplay;
pvpMyRank = pvpmyrank;
pvpPlay.availWeeklyIndex = -1;
for (int i = pvpRewards.Length - 1; i >= 0; i--)
{
if (pvpPlay.weeklyTry >= pvpRewards[i].condValue)
{
pvpPlay.availWeeklyIndex = i;
break;
}
}
dPvpTier tier = GetPvpTier(pvpMyRank.tier - 1);
BuffMgr.Instance.SetPvpTier(tier.abilityValue1, tier.abilityValue2, tier.abilityValue3, tier.abilityValue4);
}
// 결투장 플레이 데이터 업데이트.
public static void UpdatePvpPlay(cPvpPlay pvpplay)
{
pvpPlay = pvpplay;
pvpPlay.availWeeklyIndex = -1;
for (int i = pvpRewards.Length - 1; i >= 0; i--)
{
if (pvpPlay.weeklyTry >= pvpRewards[i].condValue)
{
pvpPlay.availWeeklyIndex = i;
break;
}
}
}
// 결투장 프리셋 변경.
public static void UpdatePvpPreset(int iskillpreset, int ipetpreset, int iawakenpreset)
{
pvpPlay.usePreset = iskillpreset;
pvpPlay.usePetPreset = ipetpreset;
pvpPlay.useExtraPreset = iawakenpreset;
}
// 결투장 플레이 랭킹 업데이트.
public static void UpdatePvpMyRank(dPvpRank pvpmyrank)
{
int itierprev = pvpMyRank.tier;
pvpMyRank = pvpmyrank;
// 티어 변경 시 능력치 변경.
if (itierprev != pvpMyRank.tier)
{
dPvpTier tier = GetPvpTier(pvpMyRank.tier - 1);
BuffMgr.Instance.SetPvpTier(tier.abilityValue1, tier.abilityValue2, tier.abilityValue3, tier.abilityValue4);
}
}
// 결투장 랭킹 업데이트.
public static void UpdatePvpRank(dPvpRank[] pvpranks)
{
pvpRanks = pvpranks;
PvpRankRefreshTime = TimeUtils.Now().AddMinutes(5d);
}
// 결투장 보상 데이터 목록 가져오기.
public static dPvpRew[] GetPvpRewards()
{
return pvpRewards;
}
// 결투장 보상 데이터 가져오기.
public static dPvpRew GetPvpReward(int index)
{
if (index < 0 || index >= pvpRewards.Length)
return pvpRewards[0];
return pvpRewards[index];
}
// 결투장 티어 목록 가져오기.
public static dPvpTier[] GetPvpTiers()
{
return pvpTiers;
}
// 결투장 티어 가져오기.
public static dPvpTier GetPvpTier(int index)
{
if (index < 0 || index >= pvpTiers.Length)
return pvpTiers[0];
return pvpTiers[index];
}
// 결투장 랭킹 목록 가져오기.
public static dPvpRank[] GetPvpRanks()
{
return pvpRanks;
}
// 결투장 티어 가져오기.
public static dPvpRank GetPvpRank(int irank)
{
int index = irank - 1;
if (index < 0 || index >= pvpRanks.Length)
return null;
return pvpRanks[index];
}
#endregion Pvp
#region Notice
public static void LoadNotice(dNotice[] datas)
{
if (datas == null)
datas = new dNotice[0];
noticeDatas = datas;
}
public static dNotice[] GetNotices()
{
return noticeDatas;
}
public static dNotice GetNotice(int index)
{
if (index < 0 || index >= noticeDatas.Length)
return null;
return noticeDatas[index];
}
public static void LoadChatNotice(dChatNotice[] datas)
{
if (datas == null)
datas = new dChatNotice[0];
chatNoticeDatas = datas;
}
public static dChatNotice[] GetChatNotices()
{
return chatNoticeDatas;
}
#endregion Notice
#region LevelUpInterval
static List<BigInteger> goldAtkLevel1000Interval = new List<BigInteger>();
static List<BigInteger> goldHPLevel1000Interval = new List<BigInteger>();
static List<BigInteger> exp1000Interval = new List<BigInteger>();
public static BigInteger GetGoldLevelInterval(int Level)
{
if (Level / 1000<goldAtkLevel1000Interval.Count)
{
return goldAtkLevel1000Interval[Level / 1000];
}
return 0;
}
public static BigInteger GetHpLevelInterval(int Level)
{
if (Level / 1000 < goldHPLevel1000Interval.Count)
{
return goldHPLevel1000Interval[Level / 1000];
}
return 0;
}
public static BigInteger PlayerLevelInterval(int Level)
{
if (Level / 1000 < exp1000Interval.Count)
{
return exp1000Interval[Level / 1000];
}
return 0;
}
public static void PutGoldInterval1000()
{
dCharStat atkEnhance = GetCharStat(1);
dCharStat hpEnhance = GetCharStat(2);
for (int i = 0; i < atkEnhance.maxLv / 1000; i++)
{
double eja = (dConst.RateMaxFloat + (double)(atkEnhance.buyingCntInc - dConst.RateMax)) / dConst.RateMax;
eja = Math.Pow(eja, 1000 * i);
BigInteger iprice = atkEnhance.buyingCount * (BigInteger)(eja * dConst.RateMax) / dConst.RateMax;
goldAtkLevel1000Interval.Add(iprice);
}
for (int i = 0; i < hpEnhance.maxLv / 1000; i++)
{
double eja = (dConst.RateMaxFloat + (double)(hpEnhance.buyingCntInc - dConst.RateMax)) / dConst.RateMax;
eja = Math.Pow(eja, 1000 * i);
BigInteger iprice = hpEnhance.buyingCount * (BigInteger)(eja * dConst.RateMax) / dConst.RateMax;
goldHPLevel1000Interval.Add(iprice);
}
for(int i = 0; i < Const.playerMaxLv / 1000; i++)
{
double eja = (dConst.RateMaxFloat + (double)(Const.playerLvExpInc - dConst.RateMax)) / dConst.RateMax;
eja = Math.Pow(eja, 1000 * i);
BigInteger iprice = Const.playerLvExp * (BigInteger)(eja * dConst.RateMax) / dConst.RateMax;
exp1000Interval.Add(iprice);
}
//float eja = (dConst.RateMaxFloat + (float)(atkEnhance.buyingCntInc - dConst.RateMax)) / dConst.RateMax;
//eja = Mathf.Pow(eja, 1000/*iupgradeMulti*/);
//BigInteger iprice = atkEnhance.buyingCount * (BigInteger)(eja * dConst.RateMax) / dConst.RateMax;
}
//static BigInteger CalcCharLvUpPriceAccumInterval(int curlevel, int addlevel, double buyingCntInc, BigInteger buyingCnt)
//{
// if (curlevel < 1 || addlevel < 1)
// return 0L;
// double ftargetlv = curlevel + addlevel - 1d;
// ftargetlv = System.Math.Pow(buyingCntInc, ftargetlv) - 1d;
// double fcurlv = curlevel - 1d;
// fcurlv = System.Math.Pow(buyingCntInc, fcurlv) - 1d;
// ftargetlv -= fcurlv;
// ftargetlv *= buyingCntInc;
// ftargetlv /= (buyingCntInc - 1d);
// return buyingCnt * (BigInteger)ftargetlv + buyingCnt;
//}
#endregion
public static BigInteger CalcBattlePower(BigInteger atk, BigInteger hp)
{
return (atk * 5) + (hp * 1);
}
static bool isNotice = false;
static DateTime startSvCheck;
static string updateMsg;
public static void SetUpdateNoticeInfo(bool infoNotice, DateTime infoSvCheck, string msg)
{
isNotice = infoNotice;
startSvCheck = infoSvCheck;
updateMsg = msg;
}
public static void isUpdateNotice()
{
if (isNotice)
{
SingleMgr.ChangeAlartTrue();
GameUIMgr.SOpenToastNotice(FormatString.StringFormat(LocalizationText.GetText(updateMsg), FormatString.TextDateTimeUtc9Clock1(startSvCheck)));
}
else
{
SingleMgr.ChangeAlartFalse();
GameUIMgr.CloseToastNotine();
}
}
}