zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Server/Hotfix/Game/Event/CompleteTaskEvent.cs

30 lines
940 B
C#
Executable File

using Cal.DataTable;
using System;
using System.Collections.Generic;
using System.Text;
namespace ET
{
public class CompleteTaskEvent : AEvent<EventType.CompleteTask>
{
public override async ETTask Run(EventType.CompleteTask args)
{
Unit unit = args.unit;
TaskBase taskBase = args.taskBase;
List<int> indexList = args.indexList;
//!发送奖励信息
for (int i = 0; i < taskBase.RewardArr.Length; i++)
{
if (indexList.Count!=0 && !indexList.Contains(i)) continue;
TaskBase.Reward reward = taskBase.RewardArr[i];
BagHelper.AddItem(unit, reward.Reward_Id, reward.Reward_Count, true, getSource: "任务奖励");
}
//!更新客户端
TaskComponent.Instance.SendTaskState(unit,taskBase.SubmitNPCId);
await ETTask.CompletedTask;
}
}
}