| | |
| | | LocalSave.SetString(key, time.ToString()); |
| | | } |
| | | |
| | | public bool TryGetBossKillTime(int npcId, out DateTime time) |
| | | public bool IsBossKilledRecently(int npcId) |
| | | { |
| | | if (bossKillTimes.ContainsKey(npcId)) |
| | | FindPreciousModel.BossInfo bossInfo; |
| | | var totalCd = 0; |
| | | if (findPreciousModel.TryGetBossInfo(npcId, out bossInfo)) |
| | | { |
| | | time = bossKillTimes[npcId]; |
| | | return true; |
| | | totalCd = bossInfo.rebornTotalCd; |
| | | } |
| | | |
| | | var key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "_", npcId); |
| | | var timeString = LocalSave.GetString(key); |
| | | var tempTime = DateTime.Now; |
| | | if (DateTime.TryParse(timeString, out tempTime)) |
| | | if (bossKillTimes.ContainsKey(npcId)) |
| | | { |
| | | FindPreciousModel.BossInfo bossInfo; |
| | | var totalCd = 0; |
| | | if (findPreciousModel.TryGetBossInfo(npcId, out bossInfo)) |
| | | var killTime = bossKillTimes[npcId]; |
| | | if ((int)((DateTime.Now - killTime).TotalSeconds) < totalCd) |
| | | { |
| | | totalCd = bossInfo.rebornTotalCd; |
| | | } |
| | | |
| | | if ((int)((DateTime.Now - tempTime).TotalSeconds) < totalCd) |
| | | { |
| | | time = tempTime; |
| | | bossKillTimes[npcId] = tempTime; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | time = DateTime.Now; |
| | | var key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "_", npcId); |
| | | var timeString = LocalSave.GetString(key); |
| | | if (string.IsNullOrEmpty(timeString)) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | var tempTime = DateTime.Now; |
| | | if (DateTime.TryParse(timeString, out tempTime)) |
| | | { |
| | | if ((int)((DateTime.Now - tempTime).TotalSeconds) < totalCd) |
| | | { |
| | | bossKillTimes[npcId] = tempTime; |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |