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.
741 lines
24 KiB
741 lines
24 KiB
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using ProtoCSStruct;
|
|
using Sog;
|
|
|
|
namespace Game
|
|
{
|
|
public static class WingSvc
|
|
{
|
|
private const int MainWingId = 1000;
|
|
|
|
public static void OnSystemUnlock(PlayerOnGame player, int unlockId)
|
|
{
|
|
if (unlockId == (int)SystemUnlockId.Wings)
|
|
{
|
|
Init(player);
|
|
RecWinsProp(player);
|
|
}
|
|
}
|
|
|
|
|
|
public static void OnEnter(PlayerOnGame player)
|
|
{
|
|
Init(player);
|
|
}
|
|
|
|
public static void OnPlayerBorn(PlayerOnGame player)
|
|
{
|
|
Init(player);
|
|
}
|
|
|
|
|
|
private static void Init(PlayerOnGame player)
|
|
{
|
|
if (player.RoleData.WingData.Wing.DescId != 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!SystemUnlockSvc.IsUnlockSys(player, SystemUnlockId.Wings))
|
|
{
|
|
return;
|
|
}
|
|
|
|
ref var wingData = ref player.RoleData.WingData;
|
|
var idv = CommParamDescMgr.Instance.WingsDefaultInit.int_list;
|
|
|
|
ref var wing = ref wingData.Wing;
|
|
var cfgId = MainWingId; //default value
|
|
foreach (var kv in WingsDescMgr.Instance.ItemTable.Where(kv
|
|
=> kv.Value.type == WingsType.MainWings))
|
|
{
|
|
cfgId = kv.Value.id;
|
|
break;
|
|
}
|
|
|
|
var desc = WingsDescMgr.Instance.GetConfig(cfgId);
|
|
wing.DescId = desc.id;
|
|
if (idv.Length == 3)
|
|
{
|
|
if (idv[0] != 0)
|
|
{
|
|
var levelDesc = WingsLevelDescMgr.Instance.GetConfig(idv[0]);
|
|
wing.LevelId = levelDesc?.id ?? 0;
|
|
}
|
|
|
|
if (idv[1] != 0)
|
|
{
|
|
var rankDesc = WingsRankDescMgr.Instance.GetConfig(idv[1]);
|
|
wing.RankId = rankDesc?.id ?? 0;
|
|
}
|
|
|
|
if (idv[2] != 0)
|
|
{
|
|
var starDesc = WingsStarDescMgr.Instance.GetConfig(idv[2]);
|
|
wing.StarId = starDesc?.id ?? 0;
|
|
wing.WearId = starDesc?.id ?? 0;
|
|
}
|
|
}
|
|
|
|
player.MakeDirty();
|
|
SyncData(player);
|
|
}
|
|
|
|
|
|
public static void OnChangeStarWear(PlayerOnGame player, StructPacket packet)
|
|
{
|
|
ref var req = ref packet.GetMessage<OnChangeStarWearReq>();
|
|
var showStar = req.StarId;
|
|
ref var wingData = ref player.RoleData.WingData;
|
|
ref var wing = ref wingData.Wing;
|
|
ref var res = ref OnChangeStarWearRes.Parser.GetMessageClear();
|
|
if (wing.StarId < showStar)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient((int)CSGameMsgID.OnChangeStarWearRes, ref res);
|
|
return;
|
|
}
|
|
|
|
if (player.RoleData.IsInBattle)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient((int)CSGameMsgID.OnChangeStarWearRes, ref res);
|
|
return;
|
|
}
|
|
|
|
wing.WearId = showStar;
|
|
wing.SkinId = 0;
|
|
wing.RefitId = 0;
|
|
RecWinsProp(player);
|
|
SyncData(player);
|
|
player.MakeDirty();
|
|
player.SendToClient((int)CSGameMsgID.OnChangeStarWearRes, ref res);
|
|
|
|
PlayerNotify.NotifyPlayerShowInfoChange(player);
|
|
}
|
|
|
|
public static void OnChangeWingSkin(PlayerOnGame player, StructPacket packet)
|
|
{
|
|
ref var req = ref packet.GetMessage<OnChangeWingSkinReq>();
|
|
var showSkin = req.WingId;
|
|
var showRefitId = req.RefitId;
|
|
|
|
ref var wingData = ref player.RoleData.WingData;
|
|
ref var wing = ref wingData.Wing;
|
|
var index = -1;
|
|
ref var res = ref OnChangeWingSkinRes.Parser.GetMessageClear();
|
|
if (!SystemUnlockSvc.IsUnlockSys(player, SystemUnlockId.Wings))
|
|
{
|
|
res.Ret = CSErrCode.SysUnlocked;
|
|
player.SendToClient((int)CSGameMsgID.OnChangeWingSkinRes, ref res);
|
|
return;
|
|
}
|
|
|
|
if (player.RoleData.IsInBattle)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient((int)CSGameMsgID.OnChangeWingSkinRes, ref res);
|
|
return;
|
|
}
|
|
|
|
for (int i = 0; i < wingData.WingSkinList.Count; i++)
|
|
{
|
|
if (wingData.WingSkinList[i].DescId == showSkin)
|
|
{
|
|
index = i;
|
|
if (wingData.WingSkinList[i].RefitId < showRefitId)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient((int)CSGameMsgID.OnChangeWingSkinRes, ref res);
|
|
return;
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (index < 0)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient((int)CSGameMsgID.OnChangeWingSkinRes, ref res);
|
|
return;
|
|
}
|
|
|
|
if (wing.SkinId == showSkin && wing.RefitId == showRefitId)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient((int)CSGameMsgID.OnChangeWingSkinRes, ref res);
|
|
return;
|
|
}
|
|
|
|
wing.SkinId = showSkin;
|
|
wing.RefitId = showRefitId;
|
|
RecWinsProp(player);
|
|
SyncData(player);
|
|
player.MakeDirty();
|
|
player.SendToClient((int)CSGameMsgID.OnChangeWingSkinRes, ref res);
|
|
PlayerNotify.NotifyPlayerShowInfoChange(player);
|
|
}
|
|
|
|
|
|
public static void MainWingOption(PlayerOnGame player, StructPacket packet)
|
|
{
|
|
ref var req = ref packet.GetMessage<OnUpgradeMainWingReq>();
|
|
ref var res = ref OnUpgradeMainWingRes.Parser.GetMessageClear();
|
|
var cmd = (int)CSGameMsgID.OnUpgradeMainWingRes;
|
|
if (!SystemUnlockSvc.IsUnlockSys(player, SystemUnlockId.Wings))
|
|
{
|
|
res.Ret = CSErrCode.SysUnlocked;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
if (!ChapterSvc.CanChangeTalentOrEquip(player))
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
switch (req.OpType)
|
|
{
|
|
case WingOpType.UpgradeLevel:
|
|
OnUpgradeLevel(player, req.ToMax);
|
|
break;
|
|
case WingOpType.UpgradeRank:
|
|
OnUpgradeRank(player);
|
|
break;
|
|
case WingOpType.UpgradeStar:
|
|
OnUpgradeStar(player);
|
|
break;
|
|
default:
|
|
TraceLog.Trace("WingsSvc.MainWingOption cmd not found value: {0}", req.OpType);
|
|
break;
|
|
}
|
|
}
|
|
|
|
//升级
|
|
private static void OnUpgradeLevel(PlayerOnGame player, bool toMax)
|
|
{
|
|
ref var res = ref OnUpgradeMainWingRes.Parser.GetMessageClear();
|
|
res.OpType = WingOpType.UpgradeLevel;
|
|
var cmd = (int)CSGameMsgID.OnUpgradeMainWingRes;
|
|
if (toMax)
|
|
{
|
|
var dog = 1; //why? 防止业务上出现死循环
|
|
while (dog < 100 && UpgradeLevel(player) == CSErrCode.None)
|
|
{
|
|
TraceLog.Trace("WingsSvc.OnUpgradeLevel toMax,level ={0}", player.RoleData.WingData.Wing.LevelId);
|
|
dog++;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
res.Ret = UpgradeLevel(player);
|
|
}
|
|
|
|
RecWinsProp(player);
|
|
player.MakeDirty();
|
|
SyncData(player);
|
|
GameTALogUtils.Wings(player, 1);
|
|
player.SendToClient(cmd, ref res);
|
|
}
|
|
|
|
private static CSErrCode UpgradeLevel(PlayerOnGame player)
|
|
{
|
|
ref var wingData = ref player.RoleData.WingData;
|
|
ref var wing = ref wingData.Wing;
|
|
var currDesc = WingsLevelDescMgr.Instance.GetConfig(wing.LevelId);
|
|
var rankRequire = currDesc.rankRequire;
|
|
if (wing.RankId < rankRequire)
|
|
{
|
|
return CSErrCode.Fail;
|
|
}
|
|
|
|
if (currDesc.nextLevel == 0)
|
|
{
|
|
return CSErrCode.Fail;
|
|
}
|
|
|
|
if (currDesc.unlockLevel > 0 && player.GetLevel() < currDesc.unlockLevel)
|
|
{
|
|
return CSErrCode.LevelNotEnough;
|
|
}
|
|
|
|
var cost = currDesc.levelUpCost;
|
|
var unify = new UnifyOp(player, BillChangeItemReason.Wings);
|
|
foreach (var co in cost)
|
|
{
|
|
unify.CostGoods(co.Type, co.Id, co.Value);
|
|
}
|
|
|
|
var ret = unify.CheckOp();
|
|
if (ret != CSErrCode.None)
|
|
{
|
|
return CSErrCode.Fail;
|
|
}
|
|
|
|
ret = unify.DoOp();
|
|
if (ret != CSErrCode.None)
|
|
{
|
|
return ret;
|
|
}
|
|
|
|
wing.LevelId = currDesc.nextLevel;
|
|
return CSErrCode.None;
|
|
}
|
|
|
|
|
|
//升阶
|
|
private static void OnUpgradeRank(PlayerOnGame player)
|
|
{
|
|
ref var res = ref OnUpgradeMainWingRes.Parser.GetMessageClear();
|
|
res.OpType = WingOpType.UpgradeRank;
|
|
var cmd = (int)CSGameMsgID.OnUpgradeMainWingRes;
|
|
ref var wingData = ref player.RoleData.WingData;
|
|
ref var wing = ref wingData.Wing;
|
|
var rankId = wing.RankId;
|
|
var levelDesc = WingsLevelDescMgr.Instance.GetConfig(wing.LevelId);
|
|
var rankIdRequire = levelDesc.rankRequire;
|
|
if (rankId == 0)
|
|
{
|
|
rankId = rankIdRequire;
|
|
}
|
|
|
|
if (rankId == 0)
|
|
{
|
|
var desc = WingsRankDescMgr.Instance.ItemTable[0];
|
|
rankId = desc.id;
|
|
}
|
|
|
|
var rankDesc = WingsRankDescMgr.Instance.GetConfig(rankId);
|
|
var starRequire = rankDesc.starRequire;
|
|
|
|
if (wing.StarId < starRequire) //需要星级
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
if (rankDesc.unlockLevel > 0 && player.GetLevel() < rankDesc.unlockLevel)
|
|
{
|
|
res.Ret = CSErrCode.LevelNotEnough;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
var levelId = rankDesc.includeLevel[1]; //需要得等级
|
|
if (levelId != wing.LevelId)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
var cost = rankDesc.rankUpCost;
|
|
var unify = new UnifyOp(player, BillChangeItemReason.Wings);
|
|
foreach (var co in cost)
|
|
{
|
|
unify.CostGoods(co.Type, co.Id, co.Value);
|
|
}
|
|
|
|
var ret = unify.CheckOp();
|
|
if (ret != CSErrCode.None)
|
|
{
|
|
res.Ret = ret;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
ret = unify.DoOp();
|
|
if (ret != CSErrCode.None)
|
|
{
|
|
res.Ret = ret;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
wing.RankId = rankDesc.nextRank;
|
|
RecWinsProp(player);
|
|
player.MakeDirty();
|
|
SyncData(player);
|
|
GameTALogUtils.Wings(player, 2);
|
|
player.SendToClient(cmd, ref res);
|
|
}
|
|
|
|
|
|
//升星
|
|
private static void OnUpgradeStar(PlayerOnGame player)
|
|
{
|
|
ref var res = ref OnUpgradeMainWingRes.Parser.GetMessageClear();
|
|
res.OpType = WingOpType.UpgradeStar;
|
|
var cmd = (int)CSGameMsgID.OnUpgradeMainWingRes;
|
|
ref var wingData = ref player.RoleData.WingData;
|
|
ref var wing = ref wingData.Wing;
|
|
var rankId = wing.RankId;
|
|
var starId = wing.StarId;
|
|
var rankDesc = WingsRankDescMgr.Instance.GetConfig(rankId);
|
|
if (starId == 0)
|
|
{
|
|
starId = rankDesc.starRequire;
|
|
}
|
|
|
|
var starDesc = WingsStarDescMgr.Instance.GetConfig(starId);
|
|
if (rankId != starDesc.includeRank[1]) //需要得品阶
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
if (starDesc.nextStar == 0)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
if (starDesc.unlockLevel > 0 && player.GetLevel() < starDesc.unlockLevel)
|
|
{
|
|
res.Ret = CSErrCode.LevelNotEnough;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
var unify = new UnifyOp(player, BillChangeItemReason.Wings);
|
|
var cost = starDesc.starUpCost;
|
|
foreach (var co in cost)
|
|
{
|
|
unify.CostGoods(co.Type, co.Id, co.Value);
|
|
}
|
|
|
|
var ret = unify.CheckOp();
|
|
if (ret != CSErrCode.None)
|
|
{
|
|
res.Ret = ret;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
ret = unify.DoOp();
|
|
if (ret != CSErrCode.None)
|
|
{
|
|
res.Ret = ret;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
wing.StarId = starDesc.nextStar;
|
|
RecWinsProp(player);
|
|
player.MakeDirty();
|
|
SyncData(player);
|
|
GameTALogUtils.Wings(player, 3);
|
|
player.SendToClient(cmd, ref res);
|
|
}
|
|
|
|
public static int AddWingSkin(PlayerOnGame player, int wingId)
|
|
{
|
|
ref var wingData = ref player.RoleData.WingData;
|
|
ref var skinList = ref wingData.WingSkinList;
|
|
if (skinList.GetCount() == skinList.GetMaxCount())
|
|
{
|
|
TraceLog.Error("WingSkin count is max,player={0}", player.UserID);
|
|
return -1;
|
|
}
|
|
|
|
var desc = WingsDescMgr.Instance.GetConfig(wingId);
|
|
if (desc == null)
|
|
{
|
|
TraceLog.Error("WingSkin desc not found,player={0},wingId={1}", player.UserID, wingId);
|
|
return -1;
|
|
}
|
|
|
|
if (desc.type != WingsType.Wings)
|
|
{
|
|
TraceLog.Error("WingSkin desc type error,player={0},wingId={1}", player.UserID, wingId);
|
|
return -1;
|
|
}
|
|
|
|
var index = -1;
|
|
for (var i = 0; i < skinList.Count; i++)
|
|
{
|
|
if (skinList[i].DescId != wingId) continue;
|
|
index = i;
|
|
break;
|
|
}
|
|
|
|
if (index >= 0)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
var skin = new DbWingsSkin
|
|
{
|
|
DescId = wingId,
|
|
RefitId = desc.refit,
|
|
SerialNum = skinList.Count + 1,
|
|
NewGet = true
|
|
};
|
|
if (skinList.GetCount() >= skinList.GetMaxCount())
|
|
{
|
|
TraceLog.Error("WingSkin count is max,player={0}", player.UserID);
|
|
return -1;
|
|
}
|
|
|
|
skinList.Add(skin);
|
|
RecWinsProp(player);
|
|
SyncData(player);
|
|
player.MakeDirty();
|
|
return skin.SerialNum;
|
|
}
|
|
|
|
public static void OnMarkNewGet(PlayerOnGame player)
|
|
{
|
|
ref var wingData = ref player.RoleData.WingData;
|
|
ref var skinList = ref wingData.WingSkinList;
|
|
for (var i = 0; i < skinList.Count; i++)
|
|
{
|
|
skinList[i].NewGet = false;
|
|
}
|
|
|
|
SyncData(player);
|
|
ref var res = ref OnMarkWingNewGetRes.Parser.GetMessageClear();
|
|
player.SendToClient((int)CSGameMsgID.OnMarkWingNewGetRes, ref res);
|
|
player.MakeDirty();
|
|
}
|
|
|
|
//改造
|
|
public static void UpgradeWingSkin(PlayerOnGame player, StructPacket packet)
|
|
{
|
|
ref var req = ref packet.GetMessage<OnUpgradeWingSkinReq>();
|
|
var wingId = req.WingId;
|
|
var cmd = (int)CSGameMsgID.OnUpgradeWingSkinRes;
|
|
ref var wingData = ref player.RoleData.WingData;
|
|
ref var skinList = ref wingData.WingSkinList;
|
|
var index = -1;
|
|
for (var i = 0; i < skinList.Count; i++)
|
|
{
|
|
if (skinList[i].DescId != wingId) continue;
|
|
index = i;
|
|
break;
|
|
}
|
|
|
|
ref var res = ref OnUpgradeWingSkinRes.Parser.GetMessageClear();
|
|
if (!SystemUnlockSvc.IsUnlockSys(player, SystemUnlockId.Wings))
|
|
{
|
|
res.Ret = CSErrCode.SysUnlocked;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
if (player.RoleData.IsInBattle)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
res.WingId = req.WingId;
|
|
if (index < 0)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
ref var skin = ref skinList[index];
|
|
var desc = WingsDescMgr.Instance.GetConfig(wingId);
|
|
if (desc is not { type: WingsType.Wings })
|
|
{
|
|
res.Ret = CSErrCode.DescNotFound;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
var refitDesc = WingsRefitDescMgr.Instance.GetConfig(skin.RefitId);
|
|
if (refitDesc.nextrefit == 0)
|
|
{
|
|
res.Ret = CSErrCode.Fail;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
var cost = refitDesc.refitUpCost;
|
|
var unify = new UnifyOp(player, BillChangeItemReason.Wings);
|
|
foreach (var co in cost)
|
|
{
|
|
unify.CostGoods(co.Type, co.Id, co.Value);
|
|
}
|
|
|
|
var ret = unify.CheckOp();
|
|
if (ret != CSErrCode.None)
|
|
{
|
|
res.Ret = ret;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
ret = unify.DoOp();
|
|
if (ret != CSErrCode.None)
|
|
{
|
|
res.Ret = ret;
|
|
player.SendToClient(cmd, ref res);
|
|
return;
|
|
}
|
|
|
|
skin.RefitId = refitDesc.nextrefit;
|
|
RecWinsProp(player);
|
|
SyncData(player);
|
|
player.MakeDirty();
|
|
GameTALogUtils.Wings(player, 4);
|
|
player.SendToClient(cmd, ref res);
|
|
PlayerNotify.NotifyPlayerShowInfoChange(player);
|
|
PopPackageSvc.TriggerPopPackage(player,PackPopType.WingsRefit);
|
|
}
|
|
|
|
|
|
//刷新属性
|
|
public static void RecWinsProp(PlayerOnGame player)
|
|
{
|
|
if (!SystemUnlockSvc.IsUnlockSys(player.RoleData.SysUnlockData, SystemUnlockId.Wings))
|
|
{
|
|
return;
|
|
}
|
|
|
|
RolePropUtil.RecalRoleProp(player, true);
|
|
}
|
|
|
|
//收集属性
|
|
public static void CollectWingProp(ref DBRoleData roleData, RoleProp roleProp)
|
|
{
|
|
if (!SystemUnlockSvc.IsUnlockSys(roleData.SysUnlockData, SystemUnlockId.Wings))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var wing = roleData.WingData.Wing;
|
|
var descId = wing.DescId;
|
|
var wingsDesc = WingsDescMgr.Instance.GetConfig(descId);
|
|
if (wingsDesc == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var list = GetWingProp(roleData);
|
|
foreach (var t in list)
|
|
{
|
|
roleProp.AddProp(t.Key, t.Value);
|
|
}
|
|
|
|
TraceLog.Trace("CollectWingProp level= {0},rank={1}", wing.LevelId, wing.RankId);
|
|
}
|
|
|
|
|
|
public static List<KeyValuePair<string, long>> GetWingProp(DBRoleData roleData)
|
|
{
|
|
var result = new List<KeyValuePair<string, long>>();
|
|
var wing = roleData.WingData.Wing;
|
|
var descId = wing.DescId;
|
|
var wingsDesc = WingsDescMgr.Instance.GetConfig(descId);
|
|
if (wingsDesc == null)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
var propType = wingsDesc.propType;
|
|
result.AddRange(propType.Select((t, i) => new KeyValuePair<string, long>(t, wingsDesc.propValue[i])));
|
|
|
|
var levelDesc = WingsLevelDescMgr.Instance.GetConfig(wing.LevelId);
|
|
if (levelDesc != null)
|
|
{
|
|
foreach (var kv in WingsLevelDescMgr.Instance.ItemTable)
|
|
{
|
|
var desc = kv.Value;
|
|
var props = desc.csProp;
|
|
if (desc.id == wing.LevelId)
|
|
{
|
|
break;
|
|
}
|
|
result.AddRange(from pair in props
|
|
where !string.IsNullOrEmpty(pair.Type)
|
|
select new KeyValuePair<string, long>(pair.Type, pair.Value));
|
|
}
|
|
}
|
|
|
|
var rankDesc = WingsRankDescMgr.Instance.GetConfig(wing.RankId);
|
|
if (rankDesc != null)
|
|
{
|
|
foreach (var kv in WingsRankDescMgr.Instance.ItemTable)
|
|
{
|
|
var desc = kv.Value;
|
|
var props = desc.csProp;
|
|
if (desc.id == wing.RankId)
|
|
{
|
|
break;
|
|
}
|
|
result.AddRange(from pair in props
|
|
where !string.IsNullOrEmpty(pair.Type)
|
|
select new KeyValuePair<string, long>(pair.Type, pair.Value));
|
|
|
|
}
|
|
}
|
|
|
|
var starDesc = WingsStarDescMgr.Instance.GetConfig(wing.StarId);
|
|
if (starDesc != null)
|
|
{
|
|
foreach (var kv in WingsStarDescMgr.Instance.ItemTable)
|
|
{
|
|
var desc = kv.Value;
|
|
var props = desc.csProp;
|
|
if (desc.id == wing.RankId)
|
|
{
|
|
break;
|
|
}
|
|
result.AddRange(from pair in props
|
|
where !string.IsNullOrEmpty(pair.Type)
|
|
select new KeyValuePair<string, long>(pair.Type, pair.Value));
|
|
if (desc.id == wing.StarId)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
var list = roleData.WingData.WingSkinList;
|
|
for (var i = 0; i < list.Count; i++)
|
|
{
|
|
var skinId = list[i].DescId;
|
|
var skinDesc = WingsDescMgr.Instance.GetConfig(skinId);
|
|
if (skinDesc == null) continue;
|
|
propType = skinDesc.propType;
|
|
result.AddRange(propType.Select((t, dx) => new KeyValuePair<string, long>(t, skinDesc.propValue[dx])));
|
|
var refitId = list[i].RefitId;
|
|
foreach (var kv in WingsRefitDescMgr.Instance.ItemTable)
|
|
{
|
|
var desc = kv.Value;
|
|
var props = desc.csProp;
|
|
if (desc.id < skinDesc.refit)
|
|
{
|
|
continue;
|
|
}
|
|
if (kv.Value.id == refitId)
|
|
{
|
|
break;
|
|
}
|
|
result.AddRange(from pair in props
|
|
where !string.IsNullOrEmpty(pair.Type)
|
|
select new KeyValuePair<string, long>(pair.Type, pair.Value));
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
public static void SyncData(PlayerOnGame player)
|
|
{
|
|
ref var sync = ref SyncWingsData.Parser.GetMessageClear();
|
|
sync.WingData.CopyFrom(ref player.RoleData.WingData);
|
|
player.SendToClient((int)CSGameMsgID.OnSyncWingData, ref sync);
|
|
}
|
|
}
|
|
}
|