using System.Collections.Generic; using Cal.DataTable; namespace ET; public class OpenMainStoryBossChestGoodsEffect: GoodsEffect { public override string Init(Unit unit, GoodsBase goodsBase, bool isLock = false) { base.unit = unit; this.GoodsBase = goodsBase; IsLock = isLock; Execute().Coroutine(); return string.Empty; } public override async ETVoid Execute() { int parentSetId = this.GoodsBase.CommonIncrease; if (parentSetId == 0) return; PlayerData data = unit.GetComponent(); if (!data) { Log.Error($"玩家Id=【{unit.Parent.Id}】 Name=【{UserComponent.Instance.Get(unit.Parent.Id).NickName}】 playerData is invalid!"); return; } using (UnOrderMultiMapComponent rewordMapComponent = UnOrderMultiMapComponent.Create()) { DropHelper.Drop(unit, data, BattleType.None, parentSetId, rewordMapComponent.MultiMap, dropProperbility: 1, "领主宝箱", isLock: false); using ListComponent listComponent = ListComponent.Create(); foreach (KeyValuePair> kp in rewordMapComponent.MultiMap.GetDictionary()) { foreach ((int id, int count) in kp.Value) { listComponent.List.Add($"[color=#ffff00][/color]获得了[color=#226655]{BagHelper.GetName(id)}x{count}[/color]"); } } Chat.Instance.SendSystemCahtNoBrocast(unit, listComponent.List); } await ETTask.CompletedTask; } }