2021-04-08 20:09:59 +08:00
|
|
|
|
using Cal.DataTable;
|
|
|
|
|
using ET.EventType;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
2021-04-12 23:38:54 +08:00
|
|
|
|
public class PlayerDataAwakeSystem: AwakeSystem<PlayerData>
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
public override void Awake(PlayerData self)
|
|
|
|
|
{
|
|
|
|
|
self.familyBossKeys = 2;
|
|
|
|
|
self.questAnswerCard = 1;
|
|
|
|
|
self.buyEnergyCount = 0;
|
|
|
|
|
self.currManulEquipMapLayer = 0;
|
|
|
|
|
self.manulEquipMakeCount = 4;
|
|
|
|
|
self.personalScord = 0;
|
|
|
|
|
self.personalPvpCount = 0;
|
|
|
|
|
self.epicManulMakeCount = 0;
|
|
|
|
|
self.bossEnergy = 10;
|
|
|
|
|
self.mapCoinCount = 10;
|
2021-04-12 23:38:54 +08:00
|
|
|
|
self.petEatCount = 10;
|
|
|
|
|
self.petActive = 10;
|
2021-05-01 11:27:41 +08:00
|
|
|
|
self.travelVoucher = 10;
|
2021-04-18 15:54:51 +08:00
|
|
|
|
self.trialCopyMostLayer = 01_01_01;
|
|
|
|
|
self.trialAndBossLayer = 01_01_01_01;
|
2021-04-15 00:12:07 +08:00
|
|
|
|
self.petActionIndexFlag = 00_00_00;
|
2021-04-13 20:39:32 +08:00
|
|
|
|
self.hasReceiveTrialCopyReword = false;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
|
|
|
|
public class PlayerDataDestroySystem: DestroySystem<PlayerData>
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
public override void Destroy(PlayerData self)
|
|
|
|
|
{
|
|
|
|
|
self.BattleExpSpeed = 1f;
|
|
|
|
|
self.IdleExpSpeed = 1f;
|
|
|
|
|
self.buyEnergyCount = 0;
|
|
|
|
|
self.MainStoryRecordId = 0;
|
|
|
|
|
self.epicManulMakeCount = 0;
|
2021-04-15 00:12:07 +08:00
|
|
|
|
self.trialAndBossLayer = 1_01_01_01;
|
|
|
|
|
self.trialCopyMostLayer = 1_01_01;
|
|
|
|
|
self.trialLayer = 1_01_01;
|
|
|
|
|
self.petActionIndexFlag = 00_00_00;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
self.MarketLeastTime = 0L;
|
|
|
|
|
self.MarketDiscount = 0f;
|
|
|
|
|
self.MarketPeriod = 0;
|
|
|
|
|
self.ForbidExp = false;
|
|
|
|
|
self.IsBattleIdle = false;
|
2021-04-13 20:39:32 +08:00
|
|
|
|
self.hasReceiveTrialCopyReword = false;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
self.LastOnlineTime = 0L;
|
|
|
|
|
self.OnlineTime = 0;
|
|
|
|
|
self.OnlineRewardId = 0;
|
2021-04-13 20:39:32 +08:00
|
|
|
|
self.CharacterPointKV = default;
|
|
|
|
|
self.SkillPointKV = default;
|
|
|
|
|
self.hpAutoFullCapatial = default;
|
|
|
|
|
self.mpAutoFullCapatial = default;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
self.mainstoryAITime = 0L;
|
|
|
|
|
self.mainstoryVIPAITime = 0L;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class PlayerDataSystem
|
|
|
|
|
{
|
2021-04-12 23:38:54 +08:00
|
|
|
|
public class UpdatePer1DayOfMonthEvent_UpdateData: AEvent<UpdatePer1DayOfMonth>
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
public override async ETTask Run(UpdatePer1DayOfMonth args)
|
|
|
|
|
{
|
|
|
|
|
Log.Info("刷新PlayerData");
|
|
|
|
|
List<PlayerData> list = await DBComponent.Instance.QueryJson<PlayerData>("{}");
|
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
PlayerData data = list[i];
|
|
|
|
|
Unit unit = MapUnitComponent.Instance.Get(data.Id);
|
2021-04-12 23:38:54 +08:00
|
|
|
|
if ((bool) unit)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
PlayerData _data = unit.GetComponent<PlayerData>();
|
|
|
|
|
if (!_data)
|
|
|
|
|
{
|
|
|
|
|
_data = data;
|
|
|
|
|
unit.RemoveComponent<PlayerData>();
|
|
|
|
|
unit.AddComponent(data);
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
data = _data;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
InitData(data);
|
|
|
|
|
await DBComponent.Instance.Save(data);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-20 00:25:04 +08:00
|
|
|
|
public static void InitData(this PlayerData data)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
data.familyBossKeys = 2;
|
|
|
|
|
data.questAnswerCard = 1;
|
|
|
|
|
data.buyEnergyCount = 0;
|
|
|
|
|
data.manulEquipMakeCount = 4;
|
|
|
|
|
data.bossEnergy = 10;
|
|
|
|
|
data.mapCoinCount = 10;
|
2021-04-15 00:12:07 +08:00
|
|
|
|
data.trialLayer = 1_01_01;
|
|
|
|
|
data.trialAndBossLayer = 1_01_01_01;
|
|
|
|
|
data.petActionIndexFlag = 00_00_00;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
data.OnlineTime = 0;
|
|
|
|
|
data.OnlineRewardId = 0;
|
2021-04-12 23:38:54 +08:00
|
|
|
|
data.petEatCount = 10;
|
|
|
|
|
data.petActive = 10;
|
2021-05-01 11:27:41 +08:00
|
|
|
|
data.travelVoucher = 10;
|
2021-04-13 20:39:32 +08:00
|
|
|
|
data.hasReceiveTrialCopyReword = false;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
|
2021-04-13 20:39:32 +08:00
|
|
|
|
DayOfWeek today = DateTime.Now.DayOfWeek;
|
|
|
|
|
if (today is DayOfWeek.Saturday or DayOfWeek.Sunday)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
data.mainstoryAITime += 4 * 60 * 60 * 1000;
|
|
|
|
|
else
|
|
|
|
|
data.mainstoryAITime += 2 * 60 * 60 * 1000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool HasMainstoryAITime(this PlayerData self)
|
|
|
|
|
{
|
|
|
|
|
return self.mainstoryAITime >= 2000;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
public static bool HasMainstoryVIPAITime(this PlayerData self)
|
|
|
|
|
{
|
|
|
|
|
return self.mainstoryVIPAITime >= 2000;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
public static void UpdateMinstoryRecord(this PlayerData self, int sceneId)
|
|
|
|
|
{
|
|
|
|
|
self.MainStoryRecordId = sceneId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool CanEnterMianStory(this PlayerData self, int sceneId)
|
|
|
|
|
{
|
|
|
|
|
if (sceneId - self.MainStoryRecordId > 1)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetTrialLayer(this PlayerData self, int sceneId, out int mapId)
|
|
|
|
|
{
|
|
|
|
|
mapId = 80;
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
List<TrialCopy> listByLevel = TrialCopyCategory.Instance.GetListByLevel(sceneId);
|
|
|
|
|
if (listByLevel == null)
|
|
|
|
|
{
|
|
|
|
|
return "系统错误";
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
switch (sceneId)
|
|
|
|
|
{
|
|
|
|
|
case Sys_SceneId.Scene_Challenge:
|
2021-04-15 00:12:07 +08:00
|
|
|
|
mapId = IntFlagHelper.GetFlag(self.trialAndBossLayer, 0, 2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case Sys_SceneId.Scene_Challenge_Middle:
|
2021-04-15 00:12:07 +08:00
|
|
|
|
mapId = IntFlagHelper.GetFlag(self.trialAndBossLayer, 1, 2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case Sys_SceneId.Scene_Challenge_Hard:
|
2021-04-15 00:12:07 +08:00
|
|
|
|
mapId = IntFlagHelper.GetFlag(self.trialAndBossLayer, 2, 2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case Sys_SceneId.Scene_PersonalBoss:
|
2021-04-15 00:12:07 +08:00
|
|
|
|
mapId = IntFlagHelper.GetFlag(self.trialAndBossLayer, 3, 2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if (mapId >= listByLevel.Count)
|
|
|
|
|
{
|
|
|
|
|
return "已通关,明日再来";
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
mapId = listByLevel[mapId - 1].MapId;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async ETTask UpdateTrialCopy(this PlayerData self, int sceneId)
|
|
|
|
|
{
|
|
|
|
|
ChangeMap a;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<TrialCopy> list = TrialCopyCategory.Instance.GetListByLevel(sceneId);
|
|
|
|
|
UnitScene unitScene2 = self.Parent.GetComponent<UnitScene>();
|
|
|
|
|
int mapId = 0;
|
2021-04-24 17:39:11 +08:00
|
|
|
|
bool isError = false;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
switch (sceneId)
|
|
|
|
|
{
|
|
|
|
|
case Sys_SceneId.Scene_Challenge:
|
2021-04-15 00:12:07 +08:00
|
|
|
|
mapId = IntFlagHelper.GetFlag(self.trialAndBossLayer, 0, 2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
mapId++;
|
2021-04-24 17:39:11 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if (unitScene2.MapId != list[mapId - 2].MapId)
|
|
|
|
|
{
|
2021-04-24 17:39:11 +08:00
|
|
|
|
isError = true;
|
2021-04-15 00:12:07 +08:00
|
|
|
|
Log.Error($"【严重错误】玩家 Id={self.Id} {mapId} {unitScene2.MapId}通过记录增加数大于1 ");
|
2021-04-08 20:09:59 +08:00
|
|
|
|
mapId = list.Count;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-15 00:12:07 +08:00
|
|
|
|
IntFlagHelper.SetFlagValue(ref self.trialAndBossLayer, 0, mapId, 2);
|
2021-04-24 17:39:11 +08:00
|
|
|
|
if (!isError)
|
|
|
|
|
{
|
|
|
|
|
int willMostLayer = self.trialCopyMostLayer;
|
|
|
|
|
|
|
|
|
|
IntFlagHelper.SetFlagValue(ref willMostLayer, 0, mapId, 2);
|
|
|
|
|
if (willMostLayer > self.trialCopyMostLayer)
|
|
|
|
|
self.trialCopyMostLayer = willMostLayer;
|
|
|
|
|
}
|
2021-04-15 00:12:07 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case Sys_SceneId.Scene_Challenge_Middle:
|
2021-04-15 00:12:07 +08:00
|
|
|
|
mapId = IntFlagHelper.GetFlag(self.trialAndBossLayer, 1, 2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
mapId++;
|
|
|
|
|
if (unitScene2.MapId != list[mapId - 2].MapId)
|
|
|
|
|
{
|
2021-04-24 17:39:11 +08:00
|
|
|
|
isError = true;
|
2021-04-15 00:12:07 +08:00
|
|
|
|
Log.Error($"【严重错误】玩家 Id={self.Id} {mapId} {unitScene2.MapId}通过记录增加数大于1 ");
|
2021-04-08 20:09:59 +08:00
|
|
|
|
mapId = list.Count;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-15 00:12:07 +08:00
|
|
|
|
IntFlagHelper.SetFlagValue(ref self.trialAndBossLayer, 1, mapId, 2);
|
2021-04-24 17:39:11 +08:00
|
|
|
|
if (!isError)
|
|
|
|
|
{
|
|
|
|
|
int willMostLayer = self.trialCopyMostLayer;
|
|
|
|
|
|
|
|
|
|
IntFlagHelper.SetFlagValue(ref willMostLayer, 1, mapId, 2);
|
|
|
|
|
if (willMostLayer > self.trialCopyMostLayer)
|
|
|
|
|
self.trialCopyMostLayer = willMostLayer;
|
|
|
|
|
}
|
2021-04-15 00:12:07 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case Sys_SceneId.Scene_Challenge_Hard:
|
2021-04-15 00:12:07 +08:00
|
|
|
|
mapId = IntFlagHelper.GetFlag(self.trialAndBossLayer, 2, 2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
mapId++;
|
|
|
|
|
if (unitScene2.MapId != list[mapId - 2].MapId)
|
|
|
|
|
{
|
2021-04-24 17:39:11 +08:00
|
|
|
|
isError = true;
|
2021-04-15 00:12:07 +08:00
|
|
|
|
Log.Error($"【严重错误】玩家 Id={self.Id} {mapId} {unitScene2.MapId}通过记录增加数大于1 ");
|
2021-04-08 20:09:59 +08:00
|
|
|
|
mapId = list.Count;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-15 00:12:07 +08:00
|
|
|
|
IntFlagHelper.SetFlagValue(ref self.trialAndBossLayer, 2, mapId, 2);
|
2021-04-24 17:39:11 +08:00
|
|
|
|
if (!isError)
|
|
|
|
|
{
|
|
|
|
|
int willMostLayer = self.trialCopyMostLayer;
|
|
|
|
|
|
|
|
|
|
IntFlagHelper.SetFlagValue(ref willMostLayer, 2, mapId, 2);
|
|
|
|
|
if (willMostLayer > self.trialCopyMostLayer)
|
|
|
|
|
self.trialCopyMostLayer = willMostLayer;
|
|
|
|
|
}
|
2021-04-15 00:12:07 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
case Sys_SceneId.Scene_PersonalBoss:
|
2021-04-15 00:12:07 +08:00
|
|
|
|
mapId = IntFlagHelper.GetFlag(self.trialAndBossLayer, 3, 2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
mapId++;
|
|
|
|
|
if (unitScene2.MapId != list[mapId - 2].MapId)
|
|
|
|
|
{
|
2021-04-24 17:39:11 +08:00
|
|
|
|
isError = true;
|
2021-04-15 00:12:07 +08:00
|
|
|
|
Log.Error($"【严重错误】玩家 Id={self.Id} {mapId} {unitScene2.MapId}通过记录增加数大于1 ");
|
2021-04-08 20:09:59 +08:00
|
|
|
|
mapId = list.Count;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-15 00:12:07 +08:00
|
|
|
|
IntFlagHelper.SetFlagValue(ref self.trialAndBossLayer, 3, mapId, 2);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-05-01 11:27:41 +08:00
|
|
|
|
if (isError || mapId == list.Count)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-12 23:38:54 +08:00
|
|
|
|
await Game.EventSystem.Publish(new BackMainCity { unit = self.GetParent<Unit>(), isForce = true });
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
EventSystem eventSystem = Game.EventSystem;
|
2021-04-12 23:38:54 +08:00
|
|
|
|
a = new ChangeMap { unit = self.GetParent<Unit>(), mapId = unitScene2.MapId + 1 };
|
2021-04-08 20:09:59 +08:00
|
|
|
|
await eventSystem.Publish(a);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
UnitScene unitScene = self.Parent.GetComponent<UnitScene>();
|
|
|
|
|
EventSystem eventSystem2 = Game.EventSystem;
|
2021-04-12 23:38:54 +08:00
|
|
|
|
a = new ChangeMap { unit = self.GetParent<Unit>(), mapId = unitScene.MapId + 1 };
|
2021-04-08 20:09:59 +08:00
|
|
|
|
await eventSystem2.Publish(a);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-13 20:39:32 +08:00
|
|
|
|
public static async ETTask<string> GetAllTrialCopyExp(this PlayerData self)
|
|
|
|
|
{
|
|
|
|
|
if (self.hasReceiveTrialCopyReword) return "今日已经领取过了";
|
2021-04-16 00:06:30 +08:00
|
|
|
|
int trialAndBossLayerTemp = self.trialAndBossLayer;
|
2021-04-13 20:39:32 +08:00
|
|
|
|
self.trialAndBossLayer = self.trialCopyMostLayer * 100 + self.trialAndBossLayer % 100;
|
|
|
|
|
self.hasReceiveTrialCopyReword = true;
|
|
|
|
|
|
2021-04-16 00:06:30 +08:00
|
|
|
|
UnitHelper.SaveComponenet(self).Coroutine();
|
2021-04-13 20:39:32 +08:00
|
|
|
|
Unit unit = self.GetParent<Unit>();
|
|
|
|
|
long now = TimeHelper.ClientNow();
|
2021-04-16 00:06:30 +08:00
|
|
|
|
if (self.BattleExpSpeed > 1 && self.battleExpSpeedLeastTime < now)
|
2021-04-13 20:39:32 +08:00
|
|
|
|
{
|
2021-04-16 00:06:30 +08:00
|
|
|
|
self.BattleExpSpeed = 1;
|
2021-04-13 20:39:32 +08:00
|
|
|
|
UnitHelper.Save<PlayerData>(unit).Coroutine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-04-16 00:06:30 +08:00
|
|
|
|
int oldLayer = IntFlagHelper.GetFlag(trialAndBossLayerTemp, 0, 2);
|
2021-04-15 00:12:07 +08:00
|
|
|
|
int layer = IntFlagHelper.GetFlag(self.trialCopyMostLayer, 0, 2);
|
2021-04-13 20:39:32 +08:00
|
|
|
|
var list = TrialCopyCategory.Instance.GetListByLevel(Sys_SceneId.Scene_Challenge);
|
2021-04-16 00:06:30 +08:00
|
|
|
|
for (int i = oldLayer; i < layer; i++)
|
2021-04-13 20:39:32 +08:00
|
|
|
|
{
|
|
|
|
|
TrialCopy trialCopy = list[i - 1];
|
|
|
|
|
|
|
|
|
|
using UnOrderMultiMapComponent<long, (int, int)> rewordMapComponent = UnOrderMultiMapComponent<long, (int, int)>.Create();
|
2021-05-01 11:27:41 +08:00
|
|
|
|
MonsterBase monsterBase = MonsterBaseCategory.Instance.Get(trialCopy.MonsterId);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} MonsterId = {trialCopy.MonsterId}");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await TrialCopyHelper.GetReword(unit, monsterBase, rewordMapComponent.MultiMap);
|
2021-04-13 20:39:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-04-16 00:06:30 +08:00
|
|
|
|
int oldLayer = IntFlagHelper.GetFlag(trialAndBossLayerTemp, 1, 2);
|
2021-04-15 00:12:07 +08:00
|
|
|
|
int layer = IntFlagHelper.GetFlag(self.trialCopyMostLayer, 1, 2);
|
2021-04-13 20:39:32 +08:00
|
|
|
|
var list = TrialCopyCategory.Instance.GetListByLevel(Sys_SceneId.Scene_Challenge_Middle);
|
2021-04-16 00:06:30 +08:00
|
|
|
|
for (int i = oldLayer; i < layer; i++)
|
2021-04-13 20:39:32 +08:00
|
|
|
|
{
|
|
|
|
|
TrialCopy trialCopy = list[i - 1];
|
|
|
|
|
|
|
|
|
|
using UnOrderMultiMapComponent<long, (int, int)> rewordMapComponent = UnOrderMultiMapComponent<long, (int, int)>.Create();
|
2021-05-01 11:27:41 +08:00
|
|
|
|
MonsterBase monsterBase = MonsterBaseCategory.Instance.Get(trialCopy.MonsterId);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} MonsterId = {trialCopy.MonsterId}");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await TrialCopyHelper.GetReword(unit, monsterBase, rewordMapComponent.MultiMap);
|
2021-04-13 20:39:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-04-16 00:06:30 +08:00
|
|
|
|
int oldLayer = IntFlagHelper.GetFlag(trialAndBossLayerTemp, 2, 2);
|
2021-04-15 00:12:07 +08:00
|
|
|
|
int layer = IntFlagHelper.GetFlag(self.trialCopyMostLayer, 2, 2);
|
2021-04-13 20:39:32 +08:00
|
|
|
|
var list = TrialCopyCategory.Instance.GetListByLevel(Sys_SceneId.Scene_Challenge_Hard);
|
2021-04-16 00:06:30 +08:00
|
|
|
|
for (int i = oldLayer; i < layer; i++)
|
2021-04-13 20:39:32 +08:00
|
|
|
|
{
|
|
|
|
|
TrialCopy trialCopy = list[i - 1];
|
|
|
|
|
|
|
|
|
|
using UnOrderMultiMapComponent<long, (int, int)> rewordMapComponent = UnOrderMultiMapComponent<long, (int, int)>.Create();
|
2021-05-01 11:27:41 +08:00
|
|
|
|
MonsterBase monsterBase = MonsterBaseCategory.Instance.Get(trialCopy.MonsterId);
|
|
|
|
|
if (monsterBase == null)
|
|
|
|
|
{
|
|
|
|
|
Log.ErrorDetail($"{unit.Id.GetPlayerFormatName()} MonsterId = {trialCopy.MonsterId}");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await TrialCopyHelper.GetReword(unit, monsterBase, rewordMapComponent.MultiMap);
|
2021-04-13 20:39:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
public static int UpdateDrop(this PlayerData self, int id)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
if (!self.dropDic.TryGetValue(id, out KeyValuePair<int, int> value))
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
SonAdvancedSet sonAdvancedSet = SonAdvancedSetCategory.Instance.Get(id, canError: false);
|
2021-04-12 23:38:54 +08:00
|
|
|
|
if (sonAdvancedSet == null)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-12 23:38:54 +08:00
|
|
|
|
return id;
|
2021-04-08 20:09:59 +08:00
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
|
|
|
|
int value2 = RandomHelper.RandomNumber(sonAdvancedSet.MinAdCount, sonAdvancedSet.MaxAdCount + 1);
|
|
|
|
|
value = (self.dropDic[id] = KeyValuePair.Create(0, value2));
|
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return id;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-11 19:50:39 +08:00
|
|
|
|
value.Deconstruct(out int key, out int value3);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
key++;
|
|
|
|
|
if (key >= value3)
|
|
|
|
|
{
|
|
|
|
|
self.dropDic.Remove(id);
|
|
|
|
|
SonAdvancedSet sonAdvancedSet2 = SonAdvancedSetCategory.Instance.Get(id, canError: false);
|
|
|
|
|
if (sonAdvancedSet2 != null)
|
|
|
|
|
{
|
|
|
|
|
id = sonAdvancedSet2.Adsubset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
self.dropDic[id] = KeyValuePair.Create(key, value3);
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
UnitHelper.SaveComponenet(self).Coroutine();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return id;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
public static bool UpdateEpicManulCount(this PlayerData self)
|
|
|
|
|
{
|
|
|
|
|
if (self.epicManulMakeCount == 0)
|
|
|
|
|
{
|
|
|
|
|
GenerateEpicManulCount(self);
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
self.epicManulMakeCount--;
|
|
|
|
|
if (self.epicManulMakeCount <= 0)
|
|
|
|
|
{
|
|
|
|
|
GenerateEpicManulCount(self);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
public static void GenerateEpicManulCount(this PlayerData self)
|
|
|
|
|
{
|
|
|
|
|
self.epicManulMakeCount = ConstDefine.EpicMaxManulCountArr.RandomArray_Len2();
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
public static void UpdateOnlineTime(this PlayerData self, long now)
|
|
|
|
|
{
|
|
|
|
|
self.OnlineTime += 60000;
|
|
|
|
|
self.GetOnlineReward(now).Coroutine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static async ETVoid GetOnlineReward(this PlayerData self, long now)
|
|
|
|
|
{
|
|
|
|
|
int id = OnlineRewardComponent.instance.GetRewardTime(TimeSpan.FromMilliseconds(self.OnlineTime));
|
|
|
|
|
if (id == 0)
|
|
|
|
|
{
|
|
|
|
|
Log.Error("id == 0 when get the reward of onlineTime");
|
|
|
|
|
}
|
|
|
|
|
else if (id > self.OnlineRewardId)
|
|
|
|
|
{
|
|
|
|
|
self.OnlineRewardId = id;
|
|
|
|
|
OnlineRewardBase onlineRewardBase = DataTableHelper.Get<OnlineRewardBase>(id);
|
|
|
|
|
Unit unit = self.GetParent<Unit>();
|
|
|
|
|
for (int i = onlineRewardBase.OnlineRewardsArr.Length - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
OnlineRewardBase.OnlineRewards reward = onlineRewardBase.OnlineRewardsArr[i];
|
2021-04-12 23:38:54 +08:00
|
|
|
|
Mail mail = new()
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
|
|
|
|
Id = Game.IdGenerater.GenerateId(),
|
|
|
|
|
Content = "在线拿大奖咯!",
|
2021-04-12 23:38:54 +08:00
|
|
|
|
RemainTime = now + (long) TimeSpan.FromDays(1.0).TotalMilliseconds,
|
2021-04-08 20:09:59 +08:00
|
|
|
|
SenderName = "系统",
|
|
|
|
|
State = MailState.UnReceive,
|
|
|
|
|
Title = "在线奖励"
|
|
|
|
|
};
|
|
|
|
|
mail.RewordArr.Add(new MailItem
|
|
|
|
|
{
|
2021-04-12 23:38:54 +08:00
|
|
|
|
ItemId = reward.OnlineRewards_Id, Count = reward.OnlineRewards_Count, IsHasItem = false, IsLock = true
|
2021-04-08 20:09:59 +08:00
|
|
|
|
});
|
|
|
|
|
await MailComponent.Instance.AddMail(unit.Id, mail);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-12 23:38:54 +08:00
|
|
|
|
}
|