2100 lines
89 KiB
C#
2100 lines
89 KiB
C#
//**********************************************//
|
||
//作者:#何健#
|
||
//日期:#2016.10.12#
|
||
//简述:#装备逻辑系统,主要用于装备协议接入
|
||
// #及公共接口提供#
|
||
//*********************************************//
|
||
using Thousandto.Cfg.Data;
|
||
using Thousandto.Code.Center;
|
||
using Thousandto.Code.Global;
|
||
using Thousandto.Core.Asset;
|
||
using Thousandto.Core.Base;
|
||
using Thousandto.Plugins.Common;
|
||
using MSG_backpack;
|
||
using MSG_Equip;
|
||
using MSG_ImmortalEquip;
|
||
using MSG_Recycle;
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
using UnityEngine;
|
||
|
||
namespace Thousandto.Code.Logic
|
||
{
|
||
public class EquipmentSystem : BaseSystem
|
||
{
|
||
#region 私有成员
|
||
private bool _equipIsChange = false;
|
||
private bool _needChargeSmelt = false;
|
||
private bool _needChangeXianjia = false;
|
||
private Dictionary<int, List<int>> _immortalSuitPartDic = new Dictionary<int, List<int>>();
|
||
private Dictionary<int, int> _immortalSuitLvDic = new Dictionary<int, int>();
|
||
private Dictionary<int, int> _immortalSuitDefaultLvDic = new Dictionary<int, int>();
|
||
private Dictionary<int, int> _defaultEquipIconDic = null;
|
||
private Dictionary<int, int> _xianjiaExchangeDic1 = null;
|
||
private Dictionary<int, int> _xianjiaExchangeDic2 = null;
|
||
private Dictionary<int, int> _xianjiaExchangeDic3 = null;
|
||
private Dictionary<int, int> _xianjiaExchangeDic4 = null;
|
||
private Dictionary<int, int> _baguaExchangeDic1 = null;
|
||
private Dictionary<int, int> _baguaExchangeDic2 = null;
|
||
private Dictionary<int, int> _baguaExchangeDic3 = null;
|
||
private Dictionary<int, int> _baguaExchangeDic4 = null;
|
||
private bool _isInitExchangeCfg = false;
|
||
#endregion
|
||
|
||
#region 公有成员
|
||
public bool IsAutoSmelt { set; get; }
|
||
public bool IsSynConfirm { get; set; }
|
||
public bool IsSmeltSelectConfirm { get; set; }
|
||
public Dictionary<int, int> DefaultEquipIconDic
|
||
{ get {
|
||
if (_defaultEquipIconDic == null)
|
||
{
|
||
_defaultEquipIconDic = new Dictionary<int, int>();
|
||
var glItem = DeclareGlobal.Get(124);
|
||
if (glItem != null)
|
||
{
|
||
string[] iconArr = glItem.Params.Split(';');
|
||
for (int i = 0; i < iconArr.Length; i++)
|
||
{
|
||
var singleIcon = iconArr[i].Split('_');
|
||
if (singleIcon.Length >= 2)
|
||
{
|
||
if (!string.IsNullOrEmpty(singleIcon[0]) && !string.IsNullOrEmpty(singleIcon[1]))
|
||
{
|
||
_defaultEquipIconDic.Add(int.Parse(singleIcon[0]), int.Parse(singleIcon[1]));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return _defaultEquipIconDic;
|
||
} }
|
||
public Dictionary<int, int> XianjiaExchangeDic1
|
||
{
|
||
get
|
||
{
|
||
if (_xianjiaExchangeDic1 == null)
|
||
{
|
||
_xianjiaExchangeDic1 = new Dictionary<int, int>();
|
||
}
|
||
if (!_isInitExchangeCfg)
|
||
InitExchangeCfgData();
|
||
return _xianjiaExchangeDic1;
|
||
}
|
||
}
|
||
public Dictionary<int, int> XianjiaExchangeDic2
|
||
{
|
||
get
|
||
{
|
||
if (_xianjiaExchangeDic2 == null)
|
||
{
|
||
_xianjiaExchangeDic2 = new Dictionary<int, int>();
|
||
}
|
||
if (!_isInitExchangeCfg)
|
||
InitExchangeCfgData();
|
||
return _xianjiaExchangeDic2;
|
||
}
|
||
}
|
||
public Dictionary<int, int> XianjiaExchangeDic3
|
||
{
|
||
get
|
||
{
|
||
if (_xianjiaExchangeDic3 == null)
|
||
{
|
||
_xianjiaExchangeDic3 = new Dictionary<int, int>();
|
||
}
|
||
if (!_isInitExchangeCfg)
|
||
InitExchangeCfgData();
|
||
return _xianjiaExchangeDic3;
|
||
}
|
||
}
|
||
public Dictionary<int, int> XianjiaExchangeDic4
|
||
{
|
||
get
|
||
{
|
||
if (_xianjiaExchangeDic4 == null)
|
||
{
|
||
_xianjiaExchangeDic4 = new Dictionary<int, int>();
|
||
}
|
||
if (!_isInitExchangeCfg)
|
||
InitExchangeCfgData();
|
||
return _xianjiaExchangeDic4;
|
||
}
|
||
}
|
||
public Dictionary<int, int> BaGuaExchangeDic1
|
||
{
|
||
get
|
||
{
|
||
if (_baguaExchangeDic1 == null)
|
||
{
|
||
_baguaExchangeDic1 = new Dictionary<int, int>();
|
||
}
|
||
if (!_isInitExchangeCfg)
|
||
InitExchangeCfgData();
|
||
return _baguaExchangeDic1;
|
||
}
|
||
}
|
||
public Dictionary<int, int> BaGuaExchangeDic2
|
||
{
|
||
get
|
||
{
|
||
if (_baguaExchangeDic2 == null)
|
||
{
|
||
_baguaExchangeDic2 = new Dictionary<int, int>();
|
||
}
|
||
if (!_isInitExchangeCfg)
|
||
InitExchangeCfgData();
|
||
return _baguaExchangeDic2;
|
||
}
|
||
}
|
||
public Dictionary<int, int> BaGuaExchangeDic3
|
||
{
|
||
get
|
||
{
|
||
if (_baguaExchangeDic3 == null)
|
||
{
|
||
_baguaExchangeDic3 = new Dictionary<int, int>();
|
||
}
|
||
if (!_isInitExchangeCfg)
|
||
InitExchangeCfgData();
|
||
return _baguaExchangeDic3;
|
||
}
|
||
}
|
||
public Dictionary<int, int> BaGuaExchangeDic4
|
||
{
|
||
get
|
||
{
|
||
if (_baguaExchangeDic4 == null)
|
||
{
|
||
_baguaExchangeDic4 = new Dictionary<int, int>();
|
||
}
|
||
if (!_isInitExchangeCfg)
|
||
InitExchangeCfgData();
|
||
return _baguaExchangeDic4;
|
||
}
|
||
}
|
||
public int XianjiaPower { get; set; }
|
||
public int XianjiaBaGuaPower { get; set; }
|
||
#endregion
|
||
public EquipmentSystem()
|
||
{
|
||
}
|
||
|
||
public void Initialize()
|
||
{
|
||
//设置更新频率
|
||
_updateFrameRate = 5;
|
||
GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_PLAYER_BASE_ATTR_CHANGED, OnRoleInfoChange);
|
||
GameCenter.RegFixEventHandle(LogicEventDefine.EVENT_ITEM_CHANGE_UPDATE, OnItemChange);
|
||
GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_ITEM_DELETELIST_UPDATE, OnDeleteEquipList);
|
||
GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_ONLINE_ITEMINFO, OnOnLineItemEvent);
|
||
GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_FUNCTION_UPDATE, OnFuncUpdate);
|
||
IsAutoSmelt = false;
|
||
IsSynConfirm = true;
|
||
IsSmeltSelectConfirm = true;
|
||
_isInitExchangeCfg = false;
|
||
_immortalSuitPartDic = new Dictionary<int, List<int>>();
|
||
var e = DeclareEquipXianjiaSuit.CacheData.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var k = e.Current.Value.Type + (e.Current.Value.Oder - 1) * 10;
|
||
if (!_immortalSuitPartDic.ContainsKey(k))
|
||
{
|
||
var list = new List<int>();
|
||
var arr = e.Current.Value.Part.Split('_');
|
||
for(int i = 0; i < arr.Length; i++)
|
||
{
|
||
int part = int.Parse(arr[i]);
|
||
if (part > 0)
|
||
list.Add(part);
|
||
}
|
||
if (list.Count > 0)
|
||
_immortalSuitPartDic.Add(k, list);
|
||
}
|
||
if (!_immortalSuitDefaultLvDic.ContainsKey(k))
|
||
{
|
||
_immortalSuitDefaultLvDic.Add(k, e.Current.Value.Level);
|
||
}
|
||
else
|
||
{
|
||
if (e.Current.Value.Level < _immortalSuitDefaultLvDic[k])
|
||
_immortalSuitDefaultLvDic[k] = e.Current.Value.Level;
|
||
}
|
||
}
|
||
}
|
||
public void UnInitialize()
|
||
{
|
||
ItemContianerModel bpModel = GameCenter.ItemContianerSystem.GetBackpackModelByType( ContainerType.ITEM_LOCATION_EQUIP );
|
||
if ( bpModel != null ) {
|
||
bpModel.Clear();
|
||
}
|
||
GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_PLAYER_BASE_ATTR_CHANGED, OnRoleInfoChange);
|
||
GameCenter.UnRegFixEventHandle(LogicEventDefine.EVENT_ITEM_CHANGE_UPDATE, OnItemChange);
|
||
GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_ITEM_DELETELIST_UPDATE, OnDeleteEquipList);
|
||
GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_FUNCTION_UPDATE, OnFuncUpdate);
|
||
GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_ONLINE_ITEMINFO, OnOnLineItemEvent);
|
||
}
|
||
|
||
private void InitExchangeCfgData()
|
||
{
|
||
_isInitExchangeCfg = true;
|
||
var _lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
||
if (_lp != null)
|
||
{
|
||
var _occ = _lp.Occ;
|
||
var e1 = DeclareEquipXianjiaExchange.CacheData.GetEnumerator();
|
||
while (e1.MoveNext())
|
||
{
|
||
if (e1.Current.Value.Type == 1 && e1.Current.Value.IfHide == 0 && (int)_occ == e1.Current.Value.Occ && e1.Current.Value.MainType == 0)
|
||
{
|
||
var _ar = e1.Current.Value.Needitem.Split('_');
|
||
if (_ar.Length == 2)
|
||
{
|
||
int id = 0;
|
||
int num = 0;
|
||
int.TryParse(_ar[0], out id);
|
||
int.TryParse(_ar[1], out num);
|
||
if (XianjiaExchangeDic1.ContainsKey(id) && XianjiaExchangeDic1[id] > num)
|
||
XianjiaExchangeDic1[id] = num;
|
||
else if (!XianjiaExchangeDic1.ContainsKey(id))
|
||
XianjiaExchangeDic1.Add(id, num);
|
||
}
|
||
}
|
||
if (e1.Current.Value.Type == 2 && e1.Current.Value.IfHide == 0 && (int)_occ == e1.Current.Value.Occ && e1.Current.Value.MainType == 0)
|
||
{
|
||
var _ar = e1.Current.Value.Needitem.Split('_');
|
||
if (_ar.Length == 2)
|
||
{
|
||
int id = 0;
|
||
int num = 0;
|
||
int.TryParse(_ar[0], out id);
|
||
int.TryParse(_ar[1], out num);
|
||
if (XianjiaExchangeDic2.ContainsKey(id) && XianjiaExchangeDic2[id] > num)
|
||
XianjiaExchangeDic2[id] = num;
|
||
else if (!XianjiaExchangeDic2.ContainsKey(id))
|
||
XianjiaExchangeDic2.Add(id, num);
|
||
}
|
||
}
|
||
if (e1.Current.Value.Type == 3 && e1.Current.Value.IfHide == 0 && (int)_occ == e1.Current.Value.Occ && e1.Current.Value.MainType == 0)
|
||
{
|
||
var _ar = e1.Current.Value.Needitem.Split('_');
|
||
if (_ar.Length == 2)
|
||
{
|
||
int id = 0;
|
||
int num = 0;
|
||
int.TryParse(_ar[0], out id);
|
||
int.TryParse(_ar[1], out num);
|
||
if (XianjiaExchangeDic3.ContainsKey(id) && XianjiaExchangeDic3[id] > num)
|
||
XianjiaExchangeDic3[id] = num;
|
||
else if (!XianjiaExchangeDic3.ContainsKey(id))
|
||
XianjiaExchangeDic3.Add(id, num);
|
||
}
|
||
}
|
||
if (e1.Current.Value.Type == 4 && e1.Current.Value.IfHide == 0 && (int)_occ == e1.Current.Value.Occ && e1.Current.Value.MainType == 0)
|
||
{
|
||
var _ar = e1.Current.Value.Needitem.Split('_');
|
||
if (_ar.Length == 2)
|
||
{
|
||
int id = 0;
|
||
int num = 0;
|
||
int.TryParse(_ar[0], out id);
|
||
int.TryParse(_ar[1], out num);
|
||
if (XianjiaExchangeDic4.ContainsKey(id) && XianjiaExchangeDic4[id] > num)
|
||
XianjiaExchangeDic4[id] = num;
|
||
else if (!XianjiaExchangeDic4.ContainsKey(id))
|
||
XianjiaExchangeDic4.Add(id, num);
|
||
}
|
||
}
|
||
if (e1.Current.Value.Type == 1 && e1.Current.Value.IfHide == 0 && (int)_occ == e1.Current.Value.Occ && e1.Current.Value.MainType == 1)
|
||
{
|
||
var _ar = e1.Current.Value.Needitem.Split('_');
|
||
if (_ar.Length == 2)
|
||
{
|
||
int id = 0;
|
||
int num = 0;
|
||
int.TryParse(_ar[0], out id);
|
||
int.TryParse(_ar[1], out num);
|
||
if (BaGuaExchangeDic1.ContainsKey(id) && BaGuaExchangeDic1[id] > num)
|
||
BaGuaExchangeDic1[id] = num;
|
||
else if (!BaGuaExchangeDic1.ContainsKey(id))
|
||
BaGuaExchangeDic1.Add(id, num);
|
||
}
|
||
}
|
||
if (e1.Current.Value.Type == 2 && e1.Current.Value.IfHide == 0 && (int)_occ == e1.Current.Value.Occ && e1.Current.Value.MainType == 1)
|
||
{
|
||
var _ar = e1.Current.Value.Needitem.Split('_');
|
||
if (_ar.Length == 2)
|
||
{
|
||
int id = 0;
|
||
int num = 0;
|
||
int.TryParse(_ar[0], out id);
|
||
int.TryParse(_ar[1], out num);
|
||
if (BaGuaExchangeDic2.ContainsKey(id) && BaGuaExchangeDic2[id] > num)
|
||
BaGuaExchangeDic2[id] = num;
|
||
else if (!BaGuaExchangeDic2.ContainsKey(id))
|
||
BaGuaExchangeDic2.Add(id, num);
|
||
}
|
||
}
|
||
if (e1.Current.Value.Type == 3 && e1.Current.Value.IfHide == 0 && (int)_occ == e1.Current.Value.Occ && e1.Current.Value.MainType == 1)
|
||
{
|
||
var _ar = e1.Current.Value.Needitem.Split('_');
|
||
if (_ar.Length == 2)
|
||
{
|
||
int id = 0;
|
||
int num = 0;
|
||
int.TryParse(_ar[0], out id);
|
||
int.TryParse(_ar[1], out num);
|
||
if (BaGuaExchangeDic3.ContainsKey(id) && BaGuaExchangeDic3[id] > num)
|
||
BaGuaExchangeDic3[id] = num;
|
||
else if (!BaGuaExchangeDic3.ContainsKey(id))
|
||
BaGuaExchangeDic3.Add(id, num);
|
||
}
|
||
}
|
||
if (e1.Current.Value.Type == 4 && e1.Current.Value.IfHide == 0 && (int)_occ == e1.Current.Value.Occ && e1.Current.Value.MainType == 1)
|
||
{
|
||
var _ar = e1.Current.Value.Needitem.Split('_');
|
||
if (_ar.Length == 2)
|
||
{
|
||
int id = 0;
|
||
int num = 0;
|
||
int.TryParse(_ar[0], out id);
|
||
int.TryParse(_ar[1], out num);
|
||
if (BaGuaExchangeDic4.ContainsKey(id) && BaGuaExchangeDic4[id] > num)
|
||
BaGuaExchangeDic4[id] = num;
|
||
else if (!BaGuaExchangeDic4.ContainsKey(id))
|
||
BaGuaExchangeDic4.Add(id, num);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
#region//继承基类
|
||
protected override bool OnUpdate(float deltaTime)
|
||
{
|
||
if (_equipIsChange)
|
||
{
|
||
_equipIsChange = false;
|
||
OnSetImmSynthCondition();
|
||
}
|
||
if (_needChargeSmelt)
|
||
{
|
||
_needChargeSmelt = false;
|
||
OnChargeSmeltRed();
|
||
}
|
||
if (_needChangeXianjia)
|
||
{
|
||
_needChangeXianjia = false;
|
||
SetXianjiaExchangeRed();
|
||
}
|
||
return base.OnUpdate(deltaTime);
|
||
}
|
||
#endregion
|
||
|
||
#region 私有接口
|
||
|
||
//监听主角信息改变
|
||
private void OnRoleInfoChange(object obj,object sender=null)
|
||
{
|
||
BaseProperty pro = obj as BaseProperty;
|
||
switch (pro.CurrentChangeBasePropType)
|
||
{
|
||
case RoleBaseAttribute.Level:
|
||
break;
|
||
case RoleBaseAttribute.VipLevel:
|
||
var _cfg = DeclareGlobal.Get((int)GlobalName.Smelt_equip_auto_level);
|
||
var lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
||
if (lp != null && _cfg != null)
|
||
{
|
||
var _needVipLevel = int.Parse(_cfg.Params);
|
||
if( lp.VipLevel == _needVipLevel)
|
||
{
|
||
var _msg = new ReqSetAuto();
|
||
_msg.isOpen = true;
|
||
_msg.Send();
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 监听物品信息改变
|
||
/// </summary>
|
||
/// <param name="obj"></param>
|
||
private void OnItemChange(object obj,object sender=null)
|
||
{
|
||
if (obj == null)
|
||
return;
|
||
_needChargeSmelt = true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 监听装备删除
|
||
/// </summary>
|
||
/// <param name="obj"></param>
|
||
/// <param name="sendeer"></param>
|
||
private void OnDeleteEquipList(object obj, object sendeer = null)
|
||
{
|
||
_needChargeSmelt = true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 上线背包物品下发
|
||
/// </summary>
|
||
/// <param name="obj"></param>
|
||
/// <param name="sender"></param>
|
||
private void OnOnLineItemEvent(object obj, object sender = null)
|
||
{
|
||
_needChargeSmelt = true;
|
||
_needChangeXianjia = true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 上线背包物品下发
|
||
/// </summary>
|
||
/// <param name="obj"></param>
|
||
/// <param name="sender"></param>
|
||
private void OnFuncUpdate(object obj, object sender = null)
|
||
{
|
||
var funcInfo = obj as MainFunctionInfo;
|
||
if((funcInfo.ID == FunctionStartIdCode.Xianjia1 && funcInfo.CurUpdateType == MainFuncUpdateType.Visible)
|
||
|| (funcInfo.ID == FunctionStartIdCode.Xianjia2 && funcInfo.CurUpdateType == MainFuncUpdateType.Visible)
|
||
|| (funcInfo.ID == FunctionStartIdCode.Xianjia3 && funcInfo.CurUpdateType == MainFuncUpdateType.Visible)
|
||
|| (funcInfo.ID == FunctionStartIdCode.Xianjia4 && funcInfo.CurUpdateType == MainFuncUpdateType.Visible)
|
||
|| (funcInfo.ID == FunctionStartIdCode.XianjiaBagua1 && funcInfo.CurUpdateType == MainFuncUpdateType.Visible)
|
||
|| (funcInfo.ID == FunctionStartIdCode.XianjiaBagua2 && funcInfo.CurUpdateType == MainFuncUpdateType.Visible)
|
||
|| (funcInfo.ID == FunctionStartIdCode.XianjiaBagua3 && funcInfo.CurUpdateType == MainFuncUpdateType.Visible)
|
||
|| (funcInfo.ID == FunctionStartIdCode.XianjiaBagua4 && funcInfo.CurUpdateType == MainFuncUpdateType.Visible))
|
||
{
|
||
_needChangeXianjia = true;
|
||
}
|
||
}
|
||
#endregion
|
||
#region 公共接口
|
||
|
||
/// <summary>
|
||
/// 获取玩家身上某个部位的装备
|
||
/// </summary>
|
||
/// <param name="code">穿戴部位</param>
|
||
/// <returns>装备信息</returns>
|
||
public Equipment GetPlayerDressEquip(int code)
|
||
{
|
||
Equipment equipItem = GameCenter.ItemContianerSystem.GetItemByIndex<Equipment>(ContainerType.ITEM_LOCATION_EQUIP, code);
|
||
return equipItem;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取玩家身上备用装备栏某个部位的装备
|
||
/// </summary>
|
||
/// <param name="code">穿戴部位</param>
|
||
/// <returns>装备信息</returns>
|
||
public ImmortalEquip GetPlayerDressBackEquip(int code)
|
||
{
|
||
var equipItem = GameCenter.ItemContianerSystem.GetItemByIndex<ImmortalEquip>(ContainerType.ITEM_LOCATION_BACKEQUIP, code);
|
||
return equipItem;
|
||
}
|
||
public List<ImmortalEquip> GetPlayerBackEquipList()
|
||
{
|
||
List<ImmortalEquip> ddressList = new List<ImmortalEquip>();
|
||
ItemContianerModel bpModel = GameCenter.ItemContianerSystem.GetBackpackModelByType(ContainerType.ITEM_LOCATION_BACKEQUIP);
|
||
if (null != bpModel)
|
||
{
|
||
ddressList = bpModel.GetItemList<ImmortalEquip>();
|
||
}
|
||
return ddressList;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取仙甲背包中的所有仙甲
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<ImmortalEquip> GetAllImmortal()
|
||
{
|
||
List<ImmortalEquip> ddressList = GameCenter.ItemContianerSystem.GetItemList<ImmortalEquip>(ContainerType.ITEM_LOCATION_IMMORTAL);
|
||
return ddressList;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取仙甲背包中的所有可分解仙甲
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<ImmortalEquip> GetAllCanSplitImmortal()
|
||
{
|
||
Dictionary<int, uint> _dressDic = new Dictionary<int, uint>();
|
||
List<ImmortalEquip> _result = new List<ImmortalEquip>();
|
||
List<ImmortalEquip> allList = GameCenter.ItemContianerSystem.GetItemList<ImmortalEquip>(ContainerType.ITEM_LOCATION_IMMORTAL);
|
||
for (int i = 0; i < allList.Count; i++)
|
||
{
|
||
if (!_dressDic.ContainsKey(allList[i].Part)) {
|
||
var equip = GetPlayerDressBackEquip(allList[i].Part);
|
||
if (equip != null)
|
||
_dressDic.Add(allList[i].Part, equip.Power);
|
||
else
|
||
_dressDic.Add(allList[i].Part, 0);
|
||
}
|
||
if (_dressDic.ContainsKey(allList[i].Part))
|
||
{
|
||
if (allList[i].Power <= _dressDic[allList[i].Part] && !string.IsNullOrEmpty(allList[i].ItemInfo.Price1) && allList[i].Part < XianJiaType.YangBaGua)
|
||
_result.Add(allList[i]);
|
||
}
|
||
}
|
||
return _result;
|
||
}
|
||
/// <summary>
|
||
/// 获取仙甲背包中的所有可分解仙甲
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<ImmortalEquip> GetAllBaguaImmortal()
|
||
{
|
||
List<ImmortalEquip> _result = new List<ImmortalEquip>();
|
||
List<ImmortalEquip> allList = GameCenter.ItemContianerSystem.GetItemList<ImmortalEquip>(ContainerType.ITEM_LOCATION_IMMORTAL);
|
||
for (int i = 0; i < allList.Count; i++)
|
||
{
|
||
if (allList[i].Part >= XianJiaType.BaguaStart && allList[i].Part <= XianJiaType.BaguaEnd)
|
||
{
|
||
_result.Add(allList[i]);
|
||
}
|
||
}
|
||
return _result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取仙甲背包中的所有可分解仙甲
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<ImmortalEquip> GetAllCanSplitBagua()
|
||
{
|
||
Dictionary<int, uint> _dressDic = new Dictionary<int, uint>();
|
||
List<ImmortalEquip> _result = new List<ImmortalEquip>();
|
||
List<ImmortalEquip> allList = GetAllBaguaImmortal();
|
||
for (int i = 0; i < allList.Count; i++)
|
||
{
|
||
if (!_dressDic.ContainsKey(allList[i].Part))
|
||
{
|
||
var equip = GetPlayerDressBackEquip(allList[i].Part);
|
||
if (equip != null)
|
||
_dressDic.Add(allList[i].Part, equip.Power);
|
||
else
|
||
_dressDic.Add(allList[i].Part, 0);
|
||
}
|
||
if (_dressDic.ContainsKey(allList[i].Part))
|
||
{
|
||
if (allList[i].Power <= _dressDic[allList[i].Part] && !string.IsNullOrEmpty(allList[i].ItemInfo.Price1))
|
||
_result.Add(allList[i]);
|
||
}
|
||
}
|
||
return _result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取某个容器里面所有的仙佩
|
||
/// </summary>
|
||
/// <param name="container"></param>
|
||
/// <returns></returns>
|
||
public List<ImmortalEquip> GetXianPerList(ContainerType container)
|
||
{
|
||
var AllEquipList = GameCenter.ItemContianerSystem.GetItemList<ImmortalEquip>(ContainerType.ITEM_LOCATION_BACKEQUIP);
|
||
List<ImmortalEquip> equips = new List<ImmortalEquip>();
|
||
for(int i = 0; i < AllEquipList.Count; i++)
|
||
{
|
||
if (AllEquipList[i].Part == (int)XianJiaType.XianJiaLeftP || AllEquipList[i].Part == (int)XianJiaType.XianJiaRightP)
|
||
equips.Add(AllEquipList[i]);
|
||
}
|
||
return equips;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取玩家身上及背包所有的装备
|
||
/// </summary>
|
||
/// <returns>装备信息</returns>
|
||
public List<Equipment> GetAllEquip()
|
||
{
|
||
List<Equipment> equipList = GameCenter.ItemContianerSystem.GetItemList<Equipment>(ContainerType.ITEM_LOCATION_BAG, ItemBigType.Equip);
|
||
List<Equipment> ddressList = GameCenter.ItemContianerSystem.GetItemList<Equipment>(ContainerType.ITEM_LOCATION_EQUIP, ItemBigType.Equip);
|
||
List<Equipment> allList = ddressList;
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
allList.Add(equipList[i]);
|
||
}
|
||
return allList;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取玩家身上穿载装备
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<Equipment> GetCurDressEquip()
|
||
{
|
||
List<Equipment> ddressList = GameCenter.ItemContianerSystem.GetItemList<Equipment>(ContainerType.ITEM_LOCATION_EQUIP, ItemBigType.Equip);
|
||
|
||
return ddressList;
|
||
}
|
||
/// <summary>
|
||
/// 获取玩家身上穿载普通装备
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<Equipment> GetCurDressNormalEquip()
|
||
{
|
||
List<Equipment> ddressList = new List<Equipment>();
|
||
for(int i = 0; i <= EquipmentType.FingerRing; i++)
|
||
{
|
||
var _equip = GetPlayerDressEquip(i);
|
||
if (_equip != null)
|
||
{
|
||
ddressList.Add(_equip);
|
||
}
|
||
}
|
||
|
||
return ddressList;
|
||
}
|
||
/// <summary>
|
||
/// 获取玩家背包所有的装备
|
||
/// </summary>
|
||
/// <returns>装备信息</returns>
|
||
private static List<Equipment> _cacheList = new List<Equipment>();
|
||
public List<Equipment> GetAllEquipByBag()
|
||
{
|
||
_cacheList.Clear();
|
||
List<ItemBase> equipList = GameCenter.ItemContianerSystem.GetItemListNOGC<Equipment>(ContainerType.ITEM_LOCATION_BAG);
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
var equip = equipList[i] as Equipment;
|
||
_cacheList.Add(equip);
|
||
}
|
||
return _cacheList;
|
||
}
|
||
public List<Equipment> GetSelfAllEquipByBag()
|
||
{
|
||
_cacheList.Clear();
|
||
var lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
||
if (lp != null)
|
||
{
|
||
var occ = (int)lp.Occ;
|
||
List<ItemBase> equipList = GameCenter.ItemContianerSystem.GetItemListNOGC<Equipment>(ContainerType.ITEM_LOCATION_BAG);
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
var equip = equipList[i] as Equipment;
|
||
if (equip.Occ.IndexOf("9") >= 0 || equip.Occ.IndexOf(occ.ToString()) >= 0)
|
||
{
|
||
_cacheList.Add(equip);
|
||
}
|
||
}
|
||
}
|
||
return _cacheList;
|
||
}
|
||
/// <summary>
|
||
/// 获取玩家背包对应部位的装备
|
||
/// </summary>
|
||
/// <returns>装备信息</returns>
|
||
public List<Equipment> GetEquipByPart(int part)
|
||
{
|
||
_cacheList.Clear();
|
||
List<ItemBase> equipList = GameCenter.ItemContianerSystem.GetItemListNOGC<Equipment>(ContainerType.ITEM_LOCATION_BAG);
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
var equip = equipList[i] as Equipment;
|
||
if (equip.ItemInfo.Part == part)
|
||
_cacheList.Add(equip);
|
||
}
|
||
_cacheList.Sort((x, y) =>
|
||
{
|
||
return -x.Power.CompareTo(y.Power);
|
||
});
|
||
return _cacheList;
|
||
}
|
||
/// <summary>
|
||
/// 获取玩家本职业的装备
|
||
/// </summary>
|
||
/// <returns>装备信息</returns>
|
||
public List<Equipment> GetSelfEquipByPart(int part)
|
||
{
|
||
_cacheList.Clear();
|
||
var lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
||
if(lp != null)
|
||
{
|
||
var occ = (int)lp.Occ;
|
||
List<ItemBase> equipList = GameCenter.ItemContianerSystem.GetItemListNOGC<Equipment>(ContainerType.ITEM_LOCATION_BAG);
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
var equip = equipList[i] as Equipment;
|
||
if (equip.ItemInfo.Part == part && (equip.Occ.IndexOf("9") >= 0 || equip.Occ.IndexOf(occ.ToString()) >= 0))
|
||
{
|
||
_cacheList.Add(equip);
|
||
}
|
||
}
|
||
}
|
||
return _cacheList;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取某个部位的装备战斗力
|
||
/// </summary>
|
||
/// <returns>战斗力</returns>
|
||
public uint GetEquipFightPowerByPart(int part)
|
||
{
|
||
List<Equipment> equipList = GameCenter.ItemContianerSystem.GetItemList<Equipment>(ContainerType.ITEM_LOCATION_EQUIP, ItemBigType.Equip);
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
if (equipList[i].Part == part)
|
||
{
|
||
return equipList[i].Power;
|
||
}
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取玩家背包所有的装备
|
||
/// </summary>
|
||
/// <returns>装备信息</returns>
|
||
public List<Equipment> GetEquipByPartAndLv(int part, int level)
|
||
{
|
||
List<Equipment> equipList = GameCenter.ItemContianerSystem.GetItemList<Equipment>(ContainerType.ITEM_LOCATION_BAG, ItemBigType.Equip);
|
||
|
||
List<Equipment> allList = new List<Equipment>();
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
if (equipList[i].ItemInfo.Part == part && equipList[i].ItemInfo.Level == level)
|
||
allList.Add(equipList[i]);
|
||
}
|
||
return allList;
|
||
}
|
||
|
||
#region 装备熔炼查找装备
|
||
/// <summary>
|
||
/// 查找全部装备,剔除战力高的
|
||
/// </summary>
|
||
/// <param name="quality"></param>
|
||
/// <returns></returns>
|
||
public List<Equipment> GetEquipListWithOutBetter()
|
||
{
|
||
int occ = 0;
|
||
var lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
||
if (lp != null)
|
||
{
|
||
occ = (int)lp.Occ;
|
||
}
|
||
|
||
List<Equipment> equipList = GameCenter.ItemContianerSystem.GetItemList<Equipment>(ContainerType.ITEM_LOCATION_BAG, ItemBigType.Equip);
|
||
Dictionary<int, Equipment> dressEqipDic = new Dictionary<int, Equipment>();
|
||
List<Equipment> allList = new List<Equipment>();
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
Equipment _dressEquip = null;
|
||
if (dressEqipDic.ContainsKey(equipList[i].Part))
|
||
_dressEquip = dressEqipDic[equipList[i].Part];
|
||
else
|
||
{
|
||
_dressEquip = GetPlayerDressEquip(equipList[i].Part);
|
||
dressEqipDic.Add(equipList[i].Part, _dressEquip);
|
||
}
|
||
uint dressPower = 0;
|
||
if (_dressEquip != null)
|
||
dressPower = _dressEquip.Power;
|
||
if ((equipList[i].Power <= dressPower && equipList[i].CheackOcc(occ)) || !equipList[i].CheackOcc(occ))
|
||
allList.Add(equipList[i]);
|
||
}
|
||
allList.Sort((x, y) =>
|
||
{
|
||
if (x.ItemInfo.Level > y.ItemInfo.Level)
|
||
return -1;
|
||
else if (x.ItemInfo.Level < y.ItemInfo.Level)
|
||
return 1;
|
||
else
|
||
{
|
||
return 0;
|
||
}
|
||
});
|
||
return allList;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 取熔炼装备列表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<Equipment> GetSmeltEquipList()
|
||
{
|
||
var list = GetEquipListWithOutBetter();
|
||
List<Equipment> targetList = new List<Equipment>();
|
||
for(int i = 0; i < list.Count; i++)
|
||
{
|
||
if(list[i].StarNum < 1 || list[i].Quality < 6)
|
||
{
|
||
targetList.Insert(0, list[i]);
|
||
}
|
||
else
|
||
{
|
||
targetList.Add(list[i]);
|
||
}
|
||
}
|
||
return targetList;
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 查找可吞噬装备
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<ItemBase> GetEquipCanEat()
|
||
{
|
||
List<ItemBase> list = new List<ItemBase>();
|
||
List<Equipment> allEquip = GameCenter.ItemContianerSystem.GetItemList<Equipment>(ContainerType.ITEM_LOCATION_BAG, ItemBigType.Equip);
|
||
|
||
allEquip.Sort((x, y) =>
|
||
{
|
||
if (x.ItemInfo.Quality < y.ItemInfo.Quality)
|
||
return 1;
|
||
else if (x.ItemInfo.Quality > y.ItemInfo.Quality)
|
||
return -1;
|
||
else
|
||
{
|
||
if (x.ItemInfo.DiamondNumber < y.ItemInfo.DiamondNumber)
|
||
return 1;
|
||
else if (x.ItemInfo.DiamondNumber > y.ItemInfo.DiamondNumber)
|
||
return -1;
|
||
else
|
||
{
|
||
return 0;
|
||
}
|
||
}
|
||
});
|
||
for (int i = 0; i < allEquip.Count; i++)
|
||
{
|
||
if (allEquip[i].ItemInfo.Quality >= (int)QualityCode.Violet)
|
||
{
|
||
if (allEquip[i].Occ.IndexOf(GameCenter.GameSceneSystem.GetLocalPlayer().Occ.ToString()) >= 0
|
||
|| allEquip[i].Occ.IndexOf("9") >= 0)
|
||
{
|
||
uint itemFight = FightPowerHelper.GetPropetryPower(allEquip[i].GetBaseAttribute());
|
||
uint itemFightBody = 0;
|
||
Equipment BodyEquip = GameCenter.EquipmentSystem.GetPlayerDressEquip(allEquip[i].ItemInfo.Part);
|
||
if (BodyEquip != null)
|
||
{
|
||
itemFightBody = FightPowerHelper.GetPropetryPower(BodyEquip.GetBaseAttribute());
|
||
if (itemFight <= itemFightBody && allEquip[i].ItemInfo.Gender == BodyEquip.ItemInfo.Gender)
|
||
{
|
||
list.Add(allEquip[i]);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
list.Add(allEquip[i]);
|
||
}
|
||
}
|
||
}
|
||
return list;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查找可以进行合成的装备
|
||
/// </summary>
|
||
/// <param name="quality"></param>
|
||
/// <param name="grade"></param>
|
||
/// <param name="diaNum"></param>
|
||
/// <returns></returns>
|
||
public List<ItemBase> GetEquipCanSyn(List<Equipment> allEquip, int occ, int grade, List<int> quaList, List<int> starList, List<int> partList = null)
|
||
{
|
||
List<ItemBase> list = new List<ItemBase>();
|
||
for (int i = 0; i < allEquip.Count; i++)
|
||
{
|
||
if (quaList.Contains(allEquip[i].Quality) && starList.Contains(allEquip[i].StarNum) && allEquip[i].CheackOcc(occ) && allEquip[i].Grade >= grade - 2)
|
||
{
|
||
if (partList != null && partList.Count > 0)
|
||
{
|
||
if (partList.Contains(allEquip[i].Part))
|
||
{
|
||
list.Add(allEquip[i]);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
list.Add(allEquip[i]);
|
||
}
|
||
}
|
||
}
|
||
list.Sort((x, y) =>
|
||
{
|
||
return -x.Power.CompareTo(y.Power);
|
||
});
|
||
return list;
|
||
}
|
||
|
||
public List<ItemBase> GetBaseEquipListCanSyn(List<Equipment> allEquip, int occ, int equipGrade, List<int> partList = null)
|
||
{
|
||
List<ItemBase> list = new List<ItemBase>();
|
||
if(equipGrade > 0)
|
||
{
|
||
for (int i = 0; i < allEquip.Count; i++)
|
||
{
|
||
if (allEquip[i].Quality == (int)QualityCode.Golden && allEquip[i].StarNum == 1 && allEquip[i].CheackOcc(occ) && allEquip[i].Grade == equipGrade)
|
||
{
|
||
if (partList != null && partList.Count > 0)
|
||
{
|
||
if (partList.Contains(allEquip[i].Part))
|
||
{
|
||
list.Add(allEquip[i]);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
list.Add(allEquip[i]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return list;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查找可以进行合成的装备
|
||
/// </summary>
|
||
/// <param name="quality"></param>
|
||
/// <param name="grade"></param>
|
||
/// <param name="diaNum"></param>
|
||
/// <returns></returns>
|
||
public List<Equipment> GetEquipCanSynByIDList(List<Equipment> allEquip, List<int> cfgIdList, List<Equipment> haveList = null)
|
||
{
|
||
if (haveList == null)
|
||
haveList = new List<Equipment>();
|
||
List<Equipment> list = new List<Equipment>();
|
||
for (int i = 0; i < allEquip.Count; i++)
|
||
{
|
||
if (cfgIdList.Contains(allEquip[i].CfgID) && !haveList.Contains(allEquip[i]))
|
||
{
|
||
list.Add(allEquip[i]);
|
||
}
|
||
}
|
||
return list;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取玩家背包所有的装备
|
||
/// </summary>
|
||
/// <returns>装备信息</returns>
|
||
public List<Equipment> GetEquipByPartAndLvQuality(int part, int level, int quality)
|
||
{
|
||
List<Equipment> equipList = GameCenter.ItemContianerSystem.GetItemList<Equipment>(ContainerType.ITEM_LOCATION_BAG, ItemBigType.Equip);
|
||
|
||
List<Equipment> allList = new List<Equipment>();
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
if (equipList[i].ItemInfo.Part == part && equipList[i].ItemInfo.Level == level
|
||
&& equipList[i].ItemInfo.Quality == quality)
|
||
allList.Add(equipList[i]);
|
||
}
|
||
return allList;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取玩家背包所有的装备
|
||
/// </summary>
|
||
/// <returns>装备信息</returns>
|
||
public List<Equipment> GetEquipByPartAndLvGent(int part, int level, int gent,int quality)
|
||
{
|
||
List<Equipment> equipList = GameCenter.ItemContianerSystem.GetItemList<Equipment>(ContainerType.ITEM_LOCATION_BAG, ItemBigType.Equip);
|
||
|
||
List<Equipment> allList = new List<Equipment>();
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
if (equipList[i].ItemInfo.Part == part
|
||
&& equipList[i].Occ.IndexOf(gent.ToString()) != -1 && equipList[i].ItemInfo.Level == level
|
||
&& equipList[i].ItemInfo.Quality == quality)
|
||
allList.Add(equipList[i]);
|
||
}
|
||
return allList;
|
||
}
|
||
|
||
public bool OnCheckCanEquip(Equipment equipment)
|
||
{
|
||
if (equipment != null)
|
||
{
|
||
var localPlayer = GameCenter.GameSceneSystem.GetLocalPlayer();
|
||
if (localPlayer == null)
|
||
{
|
||
return false;
|
||
}
|
||
if (!equipment.CheckLevel(localPlayer.Level))
|
||
{
|
||
return false;
|
||
}
|
||
if (!equipment.CheackOcc((int)localPlayer.Occ))
|
||
{
|
||
return false;
|
||
}
|
||
if (equipment.isTimeOut())
|
||
{
|
||
return false;
|
||
}
|
||
if(!equipment.CheckClass())
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
private void OnSendWearEquipMsg(Equipment equipid, Equipment dressEquip)
|
||
{
|
||
if (dressEquip != null&&dressEquip.Quality == (int)QualityCode.Golden && equipid.Quality == (int)QualityCode.Red
|
||
&& dressEquip.StarNum > equipid.StarNum && dressEquip.Grade == equipid.Grade)
|
||
{
|
||
GameCenter.MsgPromptSystem.ShowMsgBox(Thousandto.Cfg.Data.DeclareMessageString.Get(Thousandto.Cfg.Data.DeclareMessageString.C_TIPS_EQUIPJICHEN),
|
||
DeclareMessageString.Get(DeclareMessageString.C_MSGBOX_NO), DeclareMessageString.Get(DeclareMessageString.C_MSGBOX_YES), x => {
|
||
if(x == MsgBoxResultCode.Button2)
|
||
{
|
||
MSG_Equip.ReqEquipWear msg = new MSG_Equip.ReqEquipWear();
|
||
msg.Inherit = true;
|
||
msg.equipId = equipid.DBID;
|
||
msg.Send();
|
||
}
|
||
else
|
||
{
|
||
MSG_Equip.ReqEquipWear msg = new MSG_Equip.ReqEquipWear();
|
||
msg.Inherit = false;
|
||
msg.equipId = equipid.DBID;
|
||
msg.Send();
|
||
}
|
||
});
|
||
}
|
||
else
|
||
{
|
||
MSG_Equip.ReqEquipWear msg = new MSG_Equip.ReqEquipWear();
|
||
msg.Inherit = false;
|
||
msg.equipId = equipid.DBID;
|
||
msg.Send();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置仙甲合成条件
|
||
/// </summary>
|
||
private void OnSetImmSynthCondition()
|
||
{
|
||
GameCenter.RedPointSystem.CleraFuncCondition(FunctionStartIdCode.BaGuaSyn);
|
||
GameCenter.RedPointSystem.CleraFuncCondition(FunctionStartIdCode.Xianji);
|
||
var dressImmortalEquipList = GetPlayerBackEquipList();
|
||
if (dressImmortalEquipList.Count > 0)
|
||
{
|
||
for (int i = 0; i < dressImmortalEquipList.Count; i++)
|
||
{
|
||
OnChargeSynthRedByType(dressImmortalEquipList[i]);
|
||
}
|
||
}
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_EQUIPSYNTH_RED_UPDATE);
|
||
}
|
||
private void SetEquipSynCondition()
|
||
{
|
||
var dressEquipList = GetCurDressEquip();
|
||
GameCenter.RedPointSystem.CleraFuncCondition(FunctionStartIdCode.EquipSynthSub);
|
||
if (dressEquipList.Count > 0)
|
||
{
|
||
for (int i = 0; i < dressEquipList.Count; i++)
|
||
{
|
||
OnChargeSynthRedByType(dressEquipList[i]);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置神品装备升星升阶的红点
|
||
/// </summary>
|
||
private void SetGodEquipRedCondition()
|
||
{
|
||
GameCenter.RedPointSystem.CleraFuncCondition(FunctionStartIdCode.GodEquipStar);
|
||
GameCenter.RedPointSystem.CleraFuncCondition(FunctionStartIdCode.GodEquipUplv);
|
||
for (int i = EquipmentType.Bracelet; i <= EquipmentType.Badge; i++)
|
||
{
|
||
var equip = GetPlayerDressEquip(i);
|
||
if (equip != null)
|
||
{
|
||
var _cfg = DeclareEquipShenpinSynthesis.Get(10000000 + equip.CfgID);
|
||
if(_cfg != null)
|
||
{
|
||
var _ar = _cfg.JoinItem.Split('_');
|
||
if (_ar.Length >= 2)
|
||
{
|
||
List<RedPointConditionBase> _list = new List<RedPointConditionBase>();
|
||
var itemID = int.Parse(_ar[0]);
|
||
var itemCount = int.Parse(_ar[1]);
|
||
_list.Add(new RedPointItemCondition(itemID, itemCount));
|
||
_list.Add(new RedPointLevelCondition(_cfg.SynthesisLevel));
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.GodEquipStar, equip.Part, _list.ToArray());
|
||
}
|
||
}
|
||
_cfg = DeclareEquipShenpinSynthesis.Get(20000000 + equip.CfgID);
|
||
if (_cfg != null)
|
||
{
|
||
var _ar = _cfg.JoinItem.Split('_');
|
||
if (_ar.Length >= 2)
|
||
{
|
||
List<RedPointConditionBase> _list = new List<RedPointConditionBase>();
|
||
var itemID = int.Parse(_ar[0]);
|
||
var itemCount = int.Parse(_ar[1]);
|
||
_list.Add(new RedPointItemCondition(itemID, itemCount));
|
||
_list.Add(new RedPointLevelCondition(_cfg.SynthesisLevel));
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.GodEquipUplv, equip.Part, _list.ToArray());
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 增加对应部位的仙甲红点条件
|
||
/// </summary>
|
||
/// <param name="allEquipList"></param>
|
||
/// <param name="equip"></param>
|
||
private void OnChargeSynthRedByType(ImmortalEquip equip)
|
||
{
|
||
if(equip != null)
|
||
{
|
||
if (equip.Part >= XianJiaType.XianJiaWeapon && equip.Part <= XianJiaType.XianJiaShoe && !GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia1))
|
||
return;
|
||
if (equip.Part >= XianJiaType.XianJiaWeapon + 14 && equip.Part <= XianJiaType.XianJiaShoe + 14 && !GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia2))
|
||
return;
|
||
if (equip.Part >= XianJiaType.XianJiaWeapon + 28 && equip.Part <= XianJiaType.XianJiaShoe + 28 && !GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia3))
|
||
return;
|
||
if (equip.Part >= XianJiaType.XianJiaWeapon + 42 && equip.Part <= XianJiaType.XianJiaShoe + 42 && !GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia4))
|
||
return;
|
||
if (equip.Part >= XianJiaType.YangBaGua && equip.Part <= XianJiaType.BaGua8 && !GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua1))
|
||
return;
|
||
if (equip.Part >= XianJiaType.YangBaGua + 10 && equip.Part <= XianJiaType.BaGua8 + 10 && !GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua2))
|
||
return;
|
||
if (equip.Part >= XianJiaType.YangBaGua + 20 && equip.Part <= XianJiaType.BaGua8 + 20 && !GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua3))
|
||
return;
|
||
if (equip.Part >= XianJiaType.YangBaGua + 30 && equip.Part <= XianJiaType.BaGua8 + 30 && !GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua4))
|
||
return;
|
||
var cfg = DeclareEquipXianjiaSynthesis.Get(equip.CfgID);
|
||
if (cfg != null)
|
||
{
|
||
var single = cfg.JoinItem.Split('_');
|
||
if(single.Length >= 2)
|
||
{
|
||
List<RedPointConditionBase> _list = new List<RedPointConditionBase>();
|
||
int id = int.Parse(single[0]);
|
||
int num = int.Parse(single[1]);
|
||
_list.Add(new RedPointItemCondition(id, num));
|
||
_list.Add(new RedPointLevelCondition(cfg.LimitLevel));
|
||
if (_list.Count > 0)
|
||
{
|
||
if (equip.Part >= XianJiaType.BaguaStart && equip.Part <= XianJiaType.BaguaEnd)
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.BaGuaSyn, equip.Part, _list.ToArray());
|
||
else
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.Xianji, equip.Part, _list.ToArray());
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置仙甲合成的红点
|
||
/// </summary>
|
||
public bool OnGetImmSynRedByIndex(int index)
|
||
{
|
||
for(int i = (int)XianJiaType.XianJiaWeapon + 14 * (index - 1); i <= (int)XianJiaType.XianJiaShoe + 14 * (index - 1); i++)
|
||
{
|
||
if (GameCenter.RedPointSystem.OneConditionsIsReach(FunctionStartIdCode.Xianji, i))
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取八卦合成红点
|
||
/// </summary>
|
||
public bool OnGetBaguaSynRedByIndex(int index)
|
||
{
|
||
for (int i = (int)XianJiaType.YangBaGua + 10 * (index - 1); i <= (int)XianJiaType.BaGua8 + 10 * (index - 1); i++)
|
||
{
|
||
if (GameCenter.RedPointSystem.OneConditionsIsReach(FunctionStartIdCode.BaGuaSyn, i))
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 判断装备融炼红点
|
||
/// </summary>
|
||
private void OnChargeSmeltRed()
|
||
{
|
||
GameCenter.MainFunctionSystem.SetAlertFlag(FunctionStartIdCode.EquipSmelt, false);
|
||
if (GameCenter.ItemContianerSystem.GetRemainCount() > 10)
|
||
return;
|
||
List<ItemBase> equipList = GameCenter.ItemContianerSystem.GetItemListNOGC<Equipment>(ContainerType.ITEM_LOCATION_BAG);
|
||
Dictionary<int, Equipment> dressEquipDic = new Dictionary<int, Equipment>();
|
||
List<Equipment> allList = new List<Equipment>(equipList.Count);
|
||
var lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
||
if(lp != null)
|
||
{
|
||
for (int i = 0; i < equipList.Count; i++)
|
||
{
|
||
var equip = equipList[i] as Equipment;
|
||
if (!dressEquipDic.ContainsKey(equip.Part))
|
||
{
|
||
dressEquipDic.Add(equip.Part, GetPlayerDressEquip(equip.Part));
|
||
}
|
||
if ((equip.Quality < 6 || equip.StarNum < 1) && !equip.IsJewelry())
|
||
{
|
||
if(equip.CheackOcc(lp.Occ))
|
||
{
|
||
uint power = 0;
|
||
if (dressEquipDic.ContainsKey(equip.Part))
|
||
{
|
||
if (dressEquipDic[equip.Part] != null)
|
||
power = dressEquipDic[equip.Part].Power;
|
||
}
|
||
if (equip.Power <= power)
|
||
{
|
||
allList.Add(equip);
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
allList.Add(equip);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
GameCenter.MainFunctionSystem.SetAlertFlag(FunctionStartIdCode.EquipSmelt, allList.Count > 0);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 判断某一装备是否可合成
|
||
/// </summary>
|
||
/// <param name="type"></param>
|
||
/// <param name="level"></param>
|
||
/// <returns></returns>
|
||
private void OnChargeSynthRedByType(Equipment equip)
|
||
{
|
||
var cfg = DeclareEquipSynthesis.Get(equip.CfgID);
|
||
if (cfg != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(cfg.JoinNumProbability))
|
||
{
|
||
string partList = null;
|
||
if (!string.IsNullOrEmpty(cfg.JoinPart))
|
||
{
|
||
var parAr = cfg.JoinPart.Split('_');
|
||
for(int i = 0; i < parAr.Length; i++)
|
||
{
|
||
if (!string.IsNullOrEmpty(parAr[i]))
|
||
{
|
||
if (string.IsNullOrEmpty(partList))
|
||
partList = parAr[i];
|
||
else
|
||
partList = partList + ";" + parAr[i];
|
||
}
|
||
}
|
||
}
|
||
int basePer = 0;
|
||
int needEquipCount = 1;
|
||
var perAr = cfg.JoinNumProbability.Split('_');
|
||
if(perAr.Length > 0)
|
||
{
|
||
basePer = int.Parse(perAr[0]);
|
||
needEquipCount = (int)Math.Ceiling(10000.0f / basePer);
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(cfg.JoinItem))
|
||
{
|
||
RedPointConditionBase[] cons = new RedPointConditionBase[2];
|
||
var itemArr = cfg.JoinItem.Split('_');
|
||
if (itemArr.Length >= 2)
|
||
{
|
||
int itemID = int.Parse(itemArr[0]);
|
||
int needNum = int.Parse(itemArr[1]);
|
||
int coinID = 0;
|
||
int price = 0;
|
||
if (!string.IsNullOrEmpty(cfg.ItemPrice))
|
||
{
|
||
var coinArr = cfg.ItemPrice.Split('_');
|
||
if(coinArr.Length >= 2)
|
||
{
|
||
coinID = int.Parse(coinArr[0]);
|
||
price = int.Parse(coinArr[1]);
|
||
}
|
||
}
|
||
cons[0] = new RedPointItemCondition(itemID, needNum, coinID, price);
|
||
cons[1] = new RedPointEquipCondition(0, needEquipCount, 1, 6, 5, equip.Grade, 5, cfg.Professional, 5, 1, 5, partList);
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.EquipSynthSub, equip.Part, cons);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
RedPointConditionBase[] cons = new RedPointConditionBase[1];
|
||
cons[0] = new RedPointEquipCondition(0, needEquipCount, 1, 6, 5, equip.Grade, 5, cfg.Professional, 5, 1, 5, partList);
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.EquipSynthSub, equip.Part, cons);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
List<RedPointConditionBase> _list = new List<RedPointConditionBase>();
|
||
if (!string.IsNullOrEmpty(cfg.JoinItem))
|
||
{
|
||
var itemArr = cfg.JoinItem.Split('_');
|
||
if (itemArr.Length >= 2)
|
||
{
|
||
int itemID = int.Parse(itemArr[0]);
|
||
int needNum = int.Parse(itemArr[1]);
|
||
int coinID = 0;
|
||
int price = 0;
|
||
if (!string.IsNullOrEmpty(cfg.ItemPrice))
|
||
{
|
||
var coinArr = cfg.ItemPrice.Split('_');
|
||
if (coinArr.Length >= 2)
|
||
{
|
||
coinID = int.Parse(coinArr[0]);
|
||
price = int.Parse(coinArr[1]);
|
||
}
|
||
}
|
||
_list.Add(new RedPointItemCondition(itemID, needNum, coinID, price));
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(cfg.JoinEquipID1) && !string.IsNullOrEmpty(cfg.JoinNum1))
|
||
{
|
||
var numArr = cfg.JoinNum1.Split('_');
|
||
if (numArr.Length == 2)
|
||
{
|
||
int needEquipNum = int.Parse(numArr[1]);
|
||
var equipIdArr = cfg.JoinEquipID1.Split('_');
|
||
for (int i = 0; i < equipIdArr.Length; i++)
|
||
{
|
||
_list.Add(new RedPointItemCondition(int.Parse(equipIdArr[i]), needEquipNum));
|
||
}
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(cfg.JoinEquipID2) && !string.IsNullOrEmpty(cfg.JoinNum2))
|
||
{
|
||
var numArr = cfg.JoinNum2.Split('_');
|
||
if (numArr.Length == 2)
|
||
{
|
||
int needEquipNum = int.Parse(numArr[1]);
|
||
var equipIdArr = cfg.JoinEquipID2.Split('_');
|
||
for (int i = 0; i < equipIdArr.Length; i++)
|
||
{
|
||
_list.Add(new RedPointItemCondition(int.Parse(equipIdArr[i]), needEquipNum));
|
||
}
|
||
}
|
||
}
|
||
if (_list.Count > 0)
|
||
{
|
||
var cons = _list.ToArray();
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.EquipSynthSub, equip.Part, cons);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 计算仙甲装备套装的等级,如果未激活,则为0
|
||
/// </summary>
|
||
private void OnSetImmortalSuitLv()
|
||
{
|
||
_immortalSuitLvDic.Clear();
|
||
var e = _immortalSuitPartDic.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
bool flag = true;
|
||
int lv = 10;
|
||
for (int i = 0; i < e.Current.Value.Count; i++)
|
||
{
|
||
var equip = GetPlayerDressBackEquip(e.Current.Value[i]);
|
||
if(equip == null)
|
||
{
|
||
flag = false;
|
||
break;
|
||
}
|
||
else {
|
||
if (lv > equip.StarNum)
|
||
lv = equip.StarNum;
|
||
}
|
||
}
|
||
if (flag)
|
||
_immortalSuitLvDic.Add(e.Current.Key, lv);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取仙甲套装配置表
|
||
/// </summary>
|
||
/// <param name="part"></param>
|
||
/// <returns></returns>
|
||
public int GetSuitID(int part)
|
||
{
|
||
int result = 0;
|
||
var e = _immortalSuitPartDic.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
if (e.Current.Value.Contains(part) && _immortalSuitLvDic.ContainsKey(e.Current.Key))
|
||
result = _immortalSuitLvDic[e.Current.Key] + (e.Current.Key + 1) * 10000;
|
||
}
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取仙甲套装配置表
|
||
/// </summary>
|
||
/// <param name="part"></param>
|
||
/// <returns></returns>
|
||
public int GetViewSuitID(int part)
|
||
{
|
||
int result = 0;
|
||
int Lv = 1;
|
||
var e = _immortalSuitPartDic.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
if (e.Current.Value.Contains(part))
|
||
{
|
||
if (_immortalSuitDefaultLvDic.ContainsKey(e.Current.Key))
|
||
{
|
||
Lv = _immortalSuitDefaultLvDic[e.Current.Key];
|
||
}
|
||
if (_immortalSuitLvDic.ContainsKey(e.Current.Key))
|
||
{
|
||
Lv = _immortalSuitLvDic[e.Current.Key];
|
||
}
|
||
result = Lv + (e.Current.Key + 1) * 10000;
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
public void SetXianjiaExchangeRed()
|
||
{
|
||
GameCenter.RedPointSystem.CleraFuncCondition(FunctionStartIdCode.XianJiaExchange);
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia1))
|
||
{
|
||
var _index = 100;
|
||
var e = XianjiaExchangeDic1.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.XianJiaExchange, _index, new RedPointItemCondition(e.Current.Key, e.Current.Value));
|
||
_index = _index + 1;
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia2))
|
||
{
|
||
var _index = 200;
|
||
var e = XianjiaExchangeDic2.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.XianJiaExchange, _index, new RedPointItemCondition(e.Current.Key, e.Current.Value));
|
||
_index = _index + 1;
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia3))
|
||
{
|
||
var _index = 300;
|
||
var e = XianjiaExchangeDic3.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.XianJiaExchange, _index, new RedPointItemCondition(e.Current.Key, e.Current.Value));
|
||
_index = _index + 1;
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia4))
|
||
{
|
||
var _index = 400;
|
||
var e = XianjiaExchangeDic4.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.XianJiaExchange, _index, new RedPointItemCondition(e.Current.Key, e.Current.Value));
|
||
_index = _index + 1;
|
||
}
|
||
}
|
||
|
||
GameCenter.RedPointSystem.CleraFuncCondition(FunctionStartIdCode.BaGuaExchange);
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua1))
|
||
{
|
||
var _index = 100;
|
||
var e = BaGuaExchangeDic1.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.BaGuaExchange, _index, new RedPointItemCondition(e.Current.Key, e.Current.Value));
|
||
_index = _index + 1;
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua2))
|
||
{
|
||
var _index = 200;
|
||
var e = BaGuaExchangeDic2.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.BaGuaExchange, _index, new RedPointItemCondition(e.Current.Key, e.Current.Value));
|
||
_index = _index + 1;
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua3))
|
||
{
|
||
var _index = 300;
|
||
var e = BaGuaExchangeDic3.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.BaGuaExchange, _index, new RedPointItemCondition(e.Current.Key, e.Current.Value));
|
||
_index = _index + 1;
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua4))
|
||
{
|
||
var _index = 400;
|
||
var e = BaGuaExchangeDic4.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.BaGuaExchange, _index, new RedPointItemCondition(e.Current.Key, e.Current.Value));
|
||
_index = _index + 1;
|
||
}
|
||
}
|
||
}
|
||
|
||
public bool GetXianjiaExchngeRedByIndex(int index)
|
||
{
|
||
if (index == 1)
|
||
{
|
||
var e = XianjiaExchangeDic1.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var num = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(e.Current.Key);
|
||
if (num >= e.Current.Value)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
else if (index == 2)
|
||
{
|
||
var e = XianjiaExchangeDic2.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var num = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(e.Current.Key);
|
||
if (num >= e.Current.Value)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
else if (index == 3)
|
||
{
|
||
var e = XianjiaExchangeDic3.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var num = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(e.Current.Key);
|
||
if (num >= e.Current.Value)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
else if (index == 4)
|
||
{
|
||
var e = XianjiaExchangeDic4.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var num = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(e.Current.Key);
|
||
if (num >= e.Current.Value)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
public bool GetBaGuaExchngeRedByIndex(int index)
|
||
{
|
||
if (index == 1 && GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua1))
|
||
{
|
||
var e = BaGuaExchangeDic1.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var num = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(e.Current.Key);
|
||
if (num >= e.Current.Value)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
else if (index == 2 && GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua2))
|
||
{
|
||
var e = BaGuaExchangeDic2.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var num = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(e.Current.Key);
|
||
if (num >= e.Current.Value)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
else if (index == 3 && GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua3))
|
||
{
|
||
var e = BaGuaExchangeDic3.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var num = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(e.Current.Key);
|
||
if (num >= e.Current.Value)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
else if (index == 4 && GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.XianjiaBagua4))
|
||
{
|
||
var e = BaGuaExchangeDic4.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var num = GameCenter.ItemContianerSystem.GetItemCountFromCfgId(e.Current.Key);
|
||
if (num >= e.Current.Value)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
public uint GetXianjiaTotalPower()
|
||
{
|
||
uint _power = 0;
|
||
var e = _immortalSuitLvDic.GetEnumerator();
|
||
while (e.MoveNext())
|
||
{
|
||
var cfg = DeclareEquipXianjiaSuit.Get((e.Current.Key + 1) * 10000 + e.Current.Value);
|
||
if (cfg != null)
|
||
{
|
||
var dic = new Dictionary<int, int>();
|
||
var _arr = cfg.Attribute.Split(';');
|
||
for (int i = 0; i < _arr.Length; i++)
|
||
{
|
||
var _sing = _arr[i].Split('_');
|
||
if (_sing.Length >= 2)
|
||
{
|
||
dic.Add(int.Parse(_sing[0]), int.Parse(_sing[1]));
|
||
}
|
||
}
|
||
_power += FightPowerHelper.GetPropetryPower(dic);
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia1))
|
||
{
|
||
for (int i = (int)XianJiaType.XianJiaWeapon; i <= (int)XianJiaType.XianJiaShoe; i++)
|
||
{
|
||
var equip = GetPlayerDressBackEquip(i);
|
||
if (equip != null) {
|
||
_power += equip.Power;
|
||
}
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia2))
|
||
{
|
||
for (int i = (int)XianJiaType.XianJiaWeapon + 14; i <= (int)XianJiaType.XianJiaShoe + 14; i++)
|
||
{
|
||
var equip = GetPlayerDressBackEquip(i);
|
||
if (equip != null)
|
||
{
|
||
_power += equip.Power;
|
||
}
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia3))
|
||
{
|
||
for (int i = (int)XianJiaType.XianJiaWeapon + 28; i <= (int)XianJiaType.XianJiaShoe + 28; i++)
|
||
{
|
||
var equip = GetPlayerDressBackEquip(i);
|
||
if (equip != null)
|
||
{
|
||
_power += equip.Power;
|
||
}
|
||
}
|
||
}
|
||
if (GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Xianjia4))
|
||
{
|
||
for (int i = (int)XianJiaType.XianJiaWeapon + 42; i <= (int)XianJiaType.XianJiaShoe + 42; i++)
|
||
{
|
||
var equip = GetPlayerDressBackEquip(i);
|
||
if (equip != null)
|
||
{
|
||
_power += equip.Power;
|
||
}
|
||
}
|
||
}
|
||
return _power;
|
||
}
|
||
#endregion
|
||
|
||
#region //装备网络消息
|
||
//玩家装备信息
|
||
public void GS2U_ResEquipedInfos(ResEquipPartInfo result)
|
||
{
|
||
//_curPage = result.currentPage;
|
||
List<ItemInfo> equipList = new List<ItemInfo>();
|
||
for (int i = 0; i < result.infos.Count; ++i ) {
|
||
if ( result.infos[ i ].equip != null ) {
|
||
equipList.Add( result.infos[ i ].equip );
|
||
}
|
||
}
|
||
|
||
//身上穿戴装备
|
||
ItemContianerModel bpModel = GameCenter.ItemContianerSystem.GetBackpackModelByType(ContainerType.ITEM_LOCATION_EQUIP);
|
||
List<ItemInfo> iList = equipList;
|
||
if (null == bpModel)
|
||
{
|
||
bpModel = new ItemContianerModel();
|
||
bpModel.ContainerType = ContainerType.ITEM_LOCATION_EQUIP;
|
||
GameCenter.ItemContianerSystem.SetBackpackModelByType(ContainerType.ITEM_LOCATION_EQUIP, bpModel);
|
||
}
|
||
|
||
//bpModel.Clear();
|
||
bpModel.OpenedCount = 10;
|
||
for (int i = 0; i < iList.Count; i++)
|
||
{
|
||
GameCenter.ItemContianerSystem.UpdateItemFromContainer(ContainerType.ITEM_LOCATION_EQUIP, iList[i], false);
|
||
}
|
||
GameCenter.ItemContianerSystem.UpdateContainerForm(ContainerType.ITEM_LOCATION_EQUIP);
|
||
|
||
// 更新背包装备
|
||
List<ItemBase> info = GameCenter.ItemContianerSystem.GetItemList<ItemBase>(ContainerType.ITEM_LOCATION_BAG, ItemBigType.Equip);
|
||
for (int i = 0; i < info.Count; i++)
|
||
{
|
||
if (info[i] == null)
|
||
{
|
||
continue;
|
||
}
|
||
GameCenter.ItemContianerSystem.UpdateContianerItems(ContainerType.ITEM_LOCATION_BAG, info[i]);
|
||
}
|
||
SetEquipSynCondition();
|
||
SetGodEquipRedCondition();
|
||
}
|
||
|
||
//穿戴装备成功
|
||
public void GS2U_ResEquipWearSuccess(ResEquipWearSuccess result)
|
||
{
|
||
ItemContianerModel bpModel = GameCenter.ItemContianerSystem.GetBackpackModelByType(ContainerType.ITEM_LOCATION_EQUIP);
|
||
if (null == bpModel)
|
||
{
|
||
bpModel = new ItemContianerModel();
|
||
bpModel.ContainerType = ContainerType.ITEM_LOCATION_EQUIP;
|
||
GameCenter.ItemContianerSystem.SetBackpackModelByType(ContainerType.ITEM_LOCATION_EQUIP, bpModel);
|
||
}
|
||
ItemInfo equip = result.equiped;
|
||
GameCenter.ItemContianerSystem.UpdateItemFromContainer(ContainerType.ITEM_LOCATION_EQUIP, equip);
|
||
GameCenter.LuaSystem.Adaptor.CloseItemTips();
|
||
|
||
var item = DeclareEquip.Get(equip.itemModelId);
|
||
if (item != null)
|
||
{
|
||
string str = DeclareMessageString.Format(DeclareMessageString.C_EQUIP_WEARSUCESS,
|
||
ItemBase.GetQualityStrColor(item.Quality), item.Name);
|
||
GameCenter.MsgPromptSystem.ShowPrompt(str);
|
||
}
|
||
// 更新背包装备
|
||
List<ItemBase> info = GameCenter.ItemContianerSystem.GetItemList<ItemBase>(ContainerType.ITEM_LOCATION_BAG, ItemBigType.Equip);
|
||
for (int i = 0; i < info.Count; i++)
|
||
{
|
||
if (info[i] == null)
|
||
{
|
||
continue;
|
||
}
|
||
//bool isShowTips = NeedTipsToEquip(info[i]);
|
||
//if (isShowTips)
|
||
//{
|
||
// GameCenter.GetNewItemSystem.AddShowTips(info[i]);
|
||
//}
|
||
GameCenter.ItemContianerSystem.UpdateContianerItems(ContainerType.ITEM_LOCATION_BAG, info[i]);
|
||
}
|
||
|
||
SetEquipSynCondition();
|
||
SetGodEquipRedCondition();
|
||
//GameCenter.EquipmentSystem.OnChargeTrainPoint();
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_UI_EQUIPSKILLCOM_SUC, false);
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_WEAREQUIPSUC);
|
||
|
||
//播放装备切换特效
|
||
//LocalPlayer p = GameCenter.GameSceneSystem.GetLocalPlayer();
|
||
//if (p == null)
|
||
// return;
|
||
//p.Skin.PlayVFX(ModelTypeCode.OtherVFX, 30, SlotUtils.GetSlotName(Slot.Hit), FSkinPartCode.Body, true, 1, true, true);
|
||
}
|
||
|
||
public void GS2U_ResEquipWearFailed(ResEquipWearFailed result)
|
||
{
|
||
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_EQUIP_WEAR_FIALD));
|
||
}
|
||
|
||
public void GS2U_ResEquipUnWearSuccess(ResEquipUnWearSuccess result)
|
||
{
|
||
ulong equipUID = (ulong)result.equipId;
|
||
GameCenter.ItemContianerSystem.DeleteItemFromContainer(ContainerType.ITEM_LOCATION_EQUIP, equipUID);
|
||
GameCenter.LuaSystem.Adaptor.CloseItemTips();
|
||
|
||
// 更新背包装备
|
||
List<ItemBase> info = GameCenter.ItemContianerSystem.GetItemList<ItemBase>(ContainerType.ITEM_LOCATION_BAG, ItemBigType.Equip);
|
||
for (int i = 0; i < info.Count; i++)
|
||
{
|
||
if (info[i] == null)
|
||
{
|
||
continue;
|
||
}
|
||
GameCenter.ItemContianerSystem.UpdateContianerItems(ContainerType.ITEM_LOCATION_BAG, info[i]);
|
||
}
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_UNWEAREQUIPSUC);
|
||
|
||
//GameCenter.EquipmentSystem.OnChargeTrainPoint();
|
||
}
|
||
|
||
public void GS2U_ResEquipUnWearFailed(ResEquipUnWearFailed result)
|
||
{
|
||
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_EQUIP_UPWEAR_FIALD));
|
||
}
|
||
|
||
//装备回收结果
|
||
public void GS2U_ResEquipSell(ResEquipSell result)
|
||
{
|
||
if(result.result != 0)
|
||
{
|
||
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_EQUIPSELL_FAILED));
|
||
}
|
||
else
|
||
{
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_CLEARBAG_UPDATE);
|
||
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_EQUIPSELL_SUCESS));
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 装备合成返回
|
||
/// </summary>
|
||
/// <param name="result"></param>
|
||
public void ResEquipSyn(ResEquipSyn result)
|
||
{
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_UI_EQUIPSYNRESULT_UPDATE, result.state);
|
||
if (result.state == 1)
|
||
GameCenter.MsgPromptSystem.ShowPrompt(Thousandto.Cfg.Data.DeclareMessageString.Get(Thousandto.Cfg.Data.DeclareMessageString.C_MSG_EQUIPSYN_FAILED));
|
||
else if (result.state == 2)
|
||
GameCenter.MsgPromptSystem.ShowPrompt(Thousandto.Cfg.Data.DeclareMessageString.Get(Thousandto.Cfg.Data.DeclareMessageString.C_EQUIPSYNTH_TIPS_AUCTION));
|
||
else if (result.state == 3)
|
||
{
|
||
GameCenter.LuaSystem.Adaptor.OpenItemQuickGetForm(ItemTypeCode.Lingshi);
|
||
}
|
||
else
|
||
{
|
||
//Debug.Log("服务器合成返回原因码" + result.state);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 上线初始化 仙甲数据
|
||
/// </summary>
|
||
/// <param name="result"></param>
|
||
public void ResOnlineInitImmortalEquip(ResOnlineInitImmortalEquip result)
|
||
{
|
||
List<ItemInfo> equipList = new List<ItemInfo>();
|
||
for (int i = 0; i < result.immortalPartList.Count; ++i)
|
||
{
|
||
if (result.immortalPartList[i].equip != null)
|
||
{
|
||
equipList.Add(result.immortalPartList[i].equip);
|
||
}
|
||
}
|
||
//身上穿戴装备
|
||
ItemContianerModel bpModel = GameCenter.ItemContianerSystem.GetBackpackModelByType(ContainerType.ITEM_LOCATION_BACKEQUIP);
|
||
List<ItemInfo> iList = equipList;
|
||
if (null == bpModel)
|
||
{
|
||
bpModel = new ItemContianerModel();
|
||
bpModel.ContainerType = ContainerType.ITEM_LOCATION_BACKEQUIP;
|
||
GameCenter.ItemContianerSystem.SetBackpackModelByType(ContainerType.ITEM_LOCATION_BACKEQUIP, bpModel);
|
||
}
|
||
bpModel.OpenedCount = 200;
|
||
for (int i = 0; i < iList.Count; i++)
|
||
{
|
||
GameCenter.ItemContianerSystem.UpdateItemFromContainer(ContainerType.ITEM_LOCATION_BACKEQUIP, iList[i], false);
|
||
}
|
||
GameCenter.ItemContianerSystem.UpdateContainerForm(ContainerType.ITEM_LOCATION_BACKEQUIP);
|
||
|
||
if(result.immBagEquip != null)
|
||
{
|
||
ItemContianerModel imModel = GameCenter.ItemContianerSystem.GetBackpackModelByType(ContainerType.ITEM_LOCATION_IMMORTAL);
|
||
if (null == imModel)
|
||
{
|
||
imModel = new ItemContianerModel();
|
||
imModel.ContainerType = ContainerType.ITEM_LOCATION_IMMORTAL;
|
||
GameCenter.ItemContianerSystem.SetBackpackModelByType(ContainerType.ITEM_LOCATION_IMMORTAL, imModel);
|
||
}
|
||
|
||
imModel.Clear();
|
||
imModel.AllCount = 200;
|
||
imModel.OpenedCount = 200;
|
||
for (int i = 0; i < result.immBagEquip.Count; i++)
|
||
{
|
||
GameCenter.ItemContianerSystem.UpdateItemFromContainer(ContainerType.ITEM_LOCATION_IMMORTAL, result.immBagEquip[i], false, 0, false);
|
||
}
|
||
GameCenter.ItemContianerSystem.UpdateContainerForm(ContainerType.ITEM_LOCATION_IMMORTAL);
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_ONLINE_ITEMINFO);
|
||
}
|
||
OnSetImmortalSuitLv();
|
||
_equipIsChange = true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 仙甲穿戴结果
|
||
/// </summary>
|
||
/// <param name="result"></param>
|
||
public void ResInlayImmortalReuslt(ResInlayImmortalReuslt result)
|
||
{
|
||
if(result.immortalPart != null && result.immortalPart.equip != null)
|
||
{
|
||
ItemContianerModel bpModel = GameCenter.ItemContianerSystem.GetBackpackModelByType(ContainerType.ITEM_LOCATION_BACKEQUIP);
|
||
if (null == bpModel)
|
||
{
|
||
bpModel = new ItemContianerModel();
|
||
bpModel.ContainerType = ContainerType.ITEM_LOCATION_BACKEQUIP;
|
||
GameCenter.ItemContianerSystem.SetBackpackModelByType(ContainerType.ITEM_LOCATION_BACKEQUIP, bpModel);
|
||
}
|
||
ItemInfo equip = result.immortalPart.equip;
|
||
GameCenter.ItemContianerSystem.UpdateItemFromContainer(ContainerType.ITEM_LOCATION_BACKEQUIP, equip);
|
||
GameCenter.LuaSystem.Adaptor.CloseItemTips();
|
||
|
||
var item = DeclareEquip.Get(equip.itemModelId);
|
||
if (item != null)
|
||
{
|
||
string str = DeclareMessageString.Format(DeclareMessageString.C_EQUIP_WEARSUCESS,
|
||
ItemBase.GetQualityStrColor(item.Quality), item.Name);
|
||
GameCenter.MsgPromptSystem.ShowPrompt(str);
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_IMMORTALEQUIP_WEAR_SUC);
|
||
}
|
||
}
|
||
GameCenter.ItemContianerSystem.UpdateContainerForm(ContainerType.ITEM_LOCATION_BACKEQUIP);
|
||
OnSetImmortalSuitLv();
|
||
_equipIsChange = true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 仙甲合成结果
|
||
/// </summary>
|
||
/// <param name="result"></param>
|
||
public void ResCompoundImmortalReuslt(ResCompoundImmortalReuslt result)
|
||
{
|
||
if (result.immortalPart != null && result.immortalPart.equip != null)
|
||
{
|
||
ItemContianerModel bpModel = GameCenter.ItemContianerSystem.GetBackpackModelByType(ContainerType.ITEM_LOCATION_BACKEQUIP);
|
||
if (null == bpModel)
|
||
{
|
||
bpModel = new ItemContianerModel();
|
||
bpModel.ContainerType = ContainerType.ITEM_LOCATION_BACKEQUIP;
|
||
GameCenter.ItemContianerSystem.SetBackpackModelByType(ContainerType.ITEM_LOCATION_BACKEQUIP, bpModel);
|
||
}
|
||
ItemInfo equip = result.immortalPart.equip;
|
||
GameCenter.ItemContianerSystem.UpdateItemFromContainer(ContainerType.ITEM_LOCATION_BACKEQUIP, equip);
|
||
GameCenter.LuaSystem.Adaptor.CloseItemTips();
|
||
}
|
||
GameCenter.ItemContianerSystem.UpdateContainerForm(ContainerType.ITEM_LOCATION_BACKEQUIP);
|
||
OnSetImmortalSuitLv();
|
||
_equipIsChange = true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 仙甲背包新增物品
|
||
/// </summary>
|
||
/// <param name="result"></param>
|
||
public void ResAddImmortalEquip(ResAddImmortalEquip result)
|
||
{
|
||
if(result.addEquips != null)
|
||
{
|
||
for (int i = 0; i < result.addEquips.Count; i++)
|
||
{
|
||
GameCenter.ItemContianerSystem.UpdateItemFromContainer(ContainerType.ITEM_LOCATION_IMMORTAL, result.addEquips[i], true, result.reason, true);
|
||
|
||
//发送新物品消息
|
||
ItemBase itemBase = GameCenter.ItemContianerSystem.GetItemByUID<ItemBase>(ContainerType.ITEM_LOCATION_IMMORTAL, result.addEquips[i].itemId);
|
||
if (itemBase == null)
|
||
{
|
||
return;
|
||
}
|
||
|
||
GameCenter.PushFixEvent(LogicEventDefine.EVENT_BACKFORM_NEW_ITEM, itemBase);
|
||
GameCenter.PushFixEvent(LogicEventDefine.EVENT_ITEM_CHANGE_UPDATE, result.addEquips[i].itemModelId);
|
||
|
||
//展示物品获取效果
|
||
GameCenter.LuaSystem.Adaptor.AddShowNewItem(result.reason, itemBase, itemBase.Count);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 仙甲背包删除物品
|
||
/// </summary>
|
||
/// <param name="result"></param>
|
||
public void ResDeleteImmortalEquip(ResDeleteImmortalEquip result)
|
||
{
|
||
if (result.deleteEquipIds != null) {
|
||
for (int i = 0; i < result.deleteEquipIds.Count; i++)
|
||
{
|
||
int itemModelId = GameCenter.ItemContianerSystem.GetItemCfgIdWithUID(ContainerType.ITEM_LOCATION_IMMORTAL, (ulong)result.deleteEquipIds[i]);
|
||
GameCenter.ItemContianerSystem.DeleteItemFromContainer(ContainerType.ITEM_LOCATION_IMMORTAL, (ulong)result.deleteEquipIds[i]);
|
||
GameCenter.PushFixEvent(LogicEventDefine.EVENT_ITEM_CHANGE_UPDATE, itemModelId);
|
||
}
|
||
}
|
||
}
|
||
#region //请求消息
|
||
|
||
//穿戴
|
||
public void RequestEquipWear(Equipment equip)
|
||
{
|
||
if (equip == null)
|
||
return;
|
||
var localPlayer = GameCenter.GameSceneSystem.GetLocalPlayer();
|
||
var level = GameCenter.GameSceneSystem.GetLocalPlayerLevel();
|
||
if (!equip.CheackOcc((int)localPlayer.Occ))
|
||
{
|
||
GameCenter.MsgPromptSystem.ShowPrompt(Thousandto.Cfg.Data.DeclareMessageString.Get(Thousandto.Cfg.Data.DeclareMessageString.C_EQUIP_OCC_ERROR));
|
||
}
|
||
else if(!equip.CheckClass())
|
||
{
|
||
var cfg = DeclareChangejob.Get(equip.ItemInfo.Classlevel);
|
||
if (cfg != null)
|
||
{
|
||
string str = DeclareMessageString.Format(DeclareMessageString.C_EQUIP_WARFIALECLASEE, cfg.ChangejobName);
|
||
GameCenter.MsgPromptSystem.ShowMsgBox(str, DeclareMessageString.Get(DeclareMessageString.C_MSGBOX_OK));
|
||
}
|
||
}
|
||
else if(!equip.CheckLevel(level))
|
||
{
|
||
GameCenter.MsgPromptSystem.ShowPrompt(string.Format(Thousandto.Cfg.Data.DeclareMessageString.Get(Thousandto.Cfg.Data.DeclareMessageString.C_TIPS_EQUIPCLASSLESS), equip.ItemInfo.Level, equip.ItemInfo.Level - level));
|
||
}
|
||
else
|
||
{
|
||
if (OnCheckCanEquip(equip) == false)
|
||
{
|
||
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_EQUIP_WEAR_FIALD));
|
||
return;
|
||
}
|
||
var dressEquip = GetPlayerDressEquip(equip.Part);
|
||
if (dressEquip != null && dressEquip.SuitCfg != null)
|
||
{
|
||
GameCenter.MsgPromptSystem.ShowMsgBox(Thousandto.Cfg.Data.DeclareMessageString.Get(Thousandto.Cfg.Data.DeclareMessageString.C_EQUIP_TIPS_SUIT), (x) =>
|
||
{
|
||
if (x == MsgBoxResultCode.Button2)
|
||
OnSendWearEquipMsg(equip, dressEquip);
|
||
});
|
||
}
|
||
else
|
||
{
|
||
OnSendWearEquipMsg(equip, dressEquip);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
#endregion
|
||
|
||
#region //静态公用接口
|
||
#endregion
|
||
}
|
||
}
|