| | |
| | | Dictionary<int, List<int>> sharedUseCountItemDict { get; set; } |
| | | bool isUpdatePlayerLv = false; |
| | | |
| | | AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } }
|
| | | ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
| | |
|
| | | public int lsItemID = 150; //可兑换的灵石物品ID
|
| | | int lsItemCnt = int.Parse(FuncConfigConfig.Get("LingshiShowCount").Numerical1);
|
| | |
|
| | | AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } } |
| | | ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } |
| | | |
| | | public int lsItemID = 150; //可兑换的灵石物品ID |
| | | int lsItemCnt = int.Parse(FuncConfigConfig.Get("LingshiShowCount").Numerical1); |
| | | |
| | | UIEffect lingshiEffect; //灵石特效 |
| | | public override void Init() |
| | | { |
| | |
| | | idlist.Add(int.Parse(id.ToString())); |
| | | } |
| | | } |
| | | }
|
| | |
|
| | | ParseItemCount();
|
| | |
|
| | |
|
| | | } |
| | | |
| | | ParseItemCount(); |
| | | |
| | | |
| | | } |
| | | |
| | | public Dictionary<int, string> textCountShow = new Dictionary<int, string>(); |
| | | |
| | | public void ParseItemCount()
|
| | | {
|
| | | var textConfig = FuncConfigConfig.Get("ItemCountShow");
|
| | | var json = JsonMapper.ToObject(textConfig.Numerical1);
|
| | | foreach (var key in json.Keys)
|
| | | {
|
| | | var itemID = int.Parse(key);
|
| | | textCountShow[itemID] = json[key].ToString();
|
| | | }
|
| | | public void ParseItemCount() |
| | | { |
| | | var textConfig = FuncConfigConfig.Get("ItemCountShow"); |
| | | var json = JsonMapper.ToObject(textConfig.Numerical1); |
| | | foreach (var key in json.Keys) |
| | | { |
| | | var itemID = int.Parse(key); |
| | | textCountShow[itemID] = json[key].ToString(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void OnFuncStateChangeEvent(int id)
|
| | | {
|
| | | if (id == (int)FuncOpenEnum.EquipDecompose)
|
| | | {
|
| | | EquipDecomRedCtrl();
|
| | | }
|
| | | }
|
| | | private void OnFuncStateChangeEvent(int id) |
| | | { |
| | | if (id == (int)FuncOpenEnum.EquipDecompose) |
| | | { |
| | | EquipDecomRedCtrl(); |
| | | } |
| | | } |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | GlobalTimeEvent.Instance.secondEvent -= UpdateSecond; |
| | |
| | | PlayerDatas.Instance.playerDataRefreshEvent += UpdatePlayerLv; |
| | | isUpdatePlayerLv = true; |
| | | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; |
| | | }
|
| | |
|
| | | private void RefreshSysInfo(string key, ArrayList infolist)
|
| | | {
|
| | | if (key != "GetMoney") return;
|
| | |
|
| | | var type = 0;
|
| | | int.TryParse(infolist[0].ToString(), out type);
|
| | | if (type != 2) return;
|
| | | Vector3 pos = new Vector3(-100, 0, 0);
|
| | | Vector3 rot = new Vector3(0, 0, 0);
|
| | | if (!WindowCenter.Instance.IsOpen<MainInterfaceWin>())
|
| | | {
|
| | | pos = new Vector3(150, 50, 0);
|
| | | rot = new Vector3(180, 180, 0);
|
| | | }
|
| | | lingshiEffect = EffectMgr.Instance.PlayUIEffect(1158, 2500, WindowCenter.Instance.uiRoot.tipsCanvas, pos, rot, false);
|
| | |
|
| | |
|
| | | } |
| | | |
| | | private void RefreshSysInfo(string key, ArrayList infolist) |
| | | { |
| | | if (key != "GetMoney") return; |
| | | |
| | | var type = 0; |
| | | int.TryParse(infolist[0].ToString(), out type); |
| | | if (type != 2) return; |
| | | Vector3 pos = new Vector3(-100, 0, 0); |
| | | Vector3 rot = new Vector3(0, 0, 0); |
| | | if (!WindowCenter.Instance.IsOpen<MainInterfaceWin>()) |
| | | { |
| | | pos = new Vector3(150, 50, 0); |
| | | rot = new Vector3(180, 180, 0); |
| | | } |
| | | lingshiEffect = EffectMgr.Instance.PlayUIEffect(1158, 2500, WindowCenter.Instance.uiRoot.tipsCanvas, pos, rot, false); |
| | | |
| | | |
| | | } |
| | | public override void UnInit() |
| | | { |
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent; |
| | | SysNotifyMgr.Instance.sysNotifyEvent -= RefreshSysInfo; |
| | | } |
| | | |
| | |
| | | if (!playerPackDict.ContainsKey(type)) |
| | | { |
| | | playerPackDict.Add(type, new SinglePack(type)); |
| | | }
|
| | |
|
| | | var showNewItem = false;
|
| | | if (itemGUIDDict.ContainsKey(serverItem.ItemGUID))
|
| | | {
|
| | | var prePack = itemGUIDDict[serverItem.ItemGUID].packType;
|
| | | var preAuction = itemGUIDDict[serverItem.ItemGUID].isAuction;
|
| | | var nowPackType = type;
|
| | | var nowAcution = serverItem.IsBind == 1;
|
| | | showNewItem = preAuction != nowAcution || prePack != nowPackType;
|
| | | }
|
| | | else
|
| | | {
|
| | | showNewItem = true;
|
| | | }
|
| | | } |
| | | |
| | | var showNewItem = false; |
| | | if (itemGUIDDict.ContainsKey(serverItem.ItemGUID)) |
| | | { |
| | | var prePack = itemGUIDDict[serverItem.ItemGUID].packType; |
| | | var preAuction = itemGUIDDict[serverItem.ItemGUID].isAuction; |
| | | var nowPackType = type; |
| | | var nowAcution = serverItem.IsBind == 1; |
| | | showNewItem = preAuction != nowAcution || prePack != nowPackType; |
| | | } |
| | | else |
| | | { |
| | | showNewItem = true; |
| | | } |
| | | |
| | | var itemInfo = new ItemInfo(serverItem); |
| | | var item = playerPackDict[type].UpdateItem(itemInfo);
|
| | | var item = playerPackDict[type].UpdateItem(itemInfo); |
| | | AddItemGUIDDict(item, showNewItem); |
| | | |
| | | if (refreshItemCountEvent != null) |
| | |
| | | itemCntAddEvent(type, itemInfo.index, itemInfo.itemId); |
| | | } |
| | | |
| | | if (type == PackType.Equip)
|
| | | {
|
| | | if (ItemLogicUtility.Instance.IsRealmEquip(itemInfo.itemId))
|
| | | {
|
| | | ItemOperateUtility.Instance.ShowPutOnNewEquipRemind(itemInfo.itemId);
|
| | | }
|
| | | if (type == PackType.Equip) |
| | | { |
| | | if (ItemLogicUtility.Instance.IsRealmEquip(itemInfo.itemId)) |
| | | { |
| | | ItemOperateUtility.Instance.ShowPutOnNewEquipRemind(itemInfo.itemId); |
| | | } |
| | | } |
| | | |
| | | UpdatePackRedpoint(type); |
| | |
| | | } |
| | | |
| | | void AddItemGUIDDict(ItemModel itemModel, bool showNewItem) |
| | | {
|
| | | itemGUIDDict[itemModel.guid] = itemModel;
|
| | | { |
| | | itemGUIDDict[itemModel.guid] = itemModel; |
| | | GetItemEventCtrl(itemModel, showNewItem); |
| | | } |
| | | |
| | |
| | | refreshItemSumUseCountEvent(itemId); |
| | | } |
| | | } |
| | | }
|
| | |
|
| | | } |
| | | |
| | | #endregion |
| | |
|
| | | |
| | | #region 玩家装备特殊逻辑 |
| | | public Dictionary<int, Dictionary<int, int>> spiritWeaponPathIds { get; private set; } |
| | | public Dictionary<int, int> wingsGetPathIdDict { get; private set; } |
| | | public Dictionary<int, List<int>> dungeonUseDict { get; private set; } |
| | | void ParseConfig() |
| | | { |
| | | FuncConfigConfig funcConfig = FuncConfigConfig.Get("WingYuPeiHQTJ");
|
| | | spiritWeaponPathIds = new Dictionary<int, Dictionary<int, int>>();
|
| | | var splits = funcConfig.Numerical3.Split('|');
|
| | | for (int i = 0; i < splits.Length; i++)
|
| | | {
|
| | | var tempString = splits[i];
|
| | | var matches = Regex.Matches(tempString.Trim(), "\\d+");
|
| | | var equipPlace = int.Parse(matches[0].Value);
|
| | | var job = int.Parse(matches[1].Value);
|
| | | var itemId = int.Parse(matches[2].Value);
|
| | |
|
| | | if (!spiritWeaponPathIds.ContainsKey(equipPlace))
|
| | | {
|
| | | spiritWeaponPathIds[equipPlace] = new Dictionary<int, int>();
|
| | | }
|
| | |
|
| | | spiritWeaponPathIds[equipPlace][job] = itemId;
|
| | | }
|
| | | FuncConfigConfig funcConfig = FuncConfigConfig.Get("WingYuPeiHQTJ"); |
| | | spiritWeaponPathIds = new Dictionary<int, Dictionary<int, int>>(); |
| | | var splits = funcConfig.Numerical3.Split('|'); |
| | | for (int i = 0; i < splits.Length; i++) |
| | | { |
| | | var tempString = splits[i]; |
| | | var matches = Regex.Matches(tempString.Trim(), "\\d+"); |
| | | var equipPlace = int.Parse(matches[0].Value); |
| | | var job = int.Parse(matches[1].Value); |
| | | var itemId = int.Parse(matches[2].Value); |
| | | |
| | | if (!spiritWeaponPathIds.ContainsKey(equipPlace)) |
| | | { |
| | | spiritWeaponPathIds[equipPlace] = new Dictionary<int, int>(); |
| | | } |
| | | |
| | | spiritWeaponPathIds[equipPlace][job] = itemId; |
| | | } |
| | | |
| | | FuncConfigConfig copyItemBulletWindow = FuncConfigConfig.Get("CopyItemBulletWindow"); |
| | | JsonData copyWinData = JsonMapper.ToObject(copyItemBulletWindow.Numerical1); |
| | |
| | | int playerJob = PlayerDatas.Instance.baseData.Job; |
| | | switch ((RoleEquipType)equipPlace) |
| | | { |
| | | case RoleEquipType.Guard:
|
| | | case RoleEquipType.Guard: |
| | | case RoleEquipType.PeerlessWeapon1: |
| | | case RoleEquipType.PeerlessWeapon2: |
| | | case RoleEquipType.Wing:
|
| | | case RoleEquipType.Wing: |
| | | return spiritWeaponPathIds[equipPlace][playerJob]; |
| | | default:
|
| | | return 0;
|
| | | default: |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | |
| | | return itemModel; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取指定背包内 指定ID的所有物品 |
| | | /// </summary> |
| | | /// <param name="type"></param> |
| | | /// <param name="id"></param> |
| | | /// <param name="includeAuction"></param> |
| | | /// <returns></returns> |
| | | public List<ItemModel> GetItemsById(PackType type, int id, bool includeAuction = true) |
| | | { |
| | | if (playerPackDict.ContainsKey(type)) |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取指定背包内指定ID的一个物品 |
| | | /// </summary> |
| | | /// <param name="type"></param> |
| | | /// <param name="id"></param> |
| | | /// <param name="includeAuction"></param> |
| | | /// <returns></returns> |
| | | public ItemModel GetItemByID(PackType type, int id, bool includeAuction = true) |
| | | { |
| | | if (playerPackDict.ContainsKey(type)) |
| | | { |
| | | var singlePack = playerPackDict[type]; |
| | | return singlePack.GetItemByID(id, includeAuction); |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public List<ItemModel> GetItems(PackType packType, SinglePack.FilterParams param) |
| | | { |
| | | if (playerPackDict.ContainsKey(packType)) |
| | |
| | | { |
| | | string guid = string.Empty; |
| | | foreach (var key in itemGUIDDict.Keys) |
| | | {
|
| | | if (!includeAuction && itemGUIDDict[key].isAuction)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | { |
| | | if (!includeAuction && itemGUIDDict[key].isAuction) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | if (itemGUIDDict[key].itemId == itemId) |
| | | { |
| | | guid = key; |
| | |
| | | #region 红点逻辑判断 |
| | | |
| | | const int ITEMPACK_REDKEY = 102011003; |
| | | Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY);
|
| | |
|
| | | Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY); |
| | | |
| | | const int LS_REDKEY = 102011015; |
| | | Redpoint redpointLS = new Redpoint(MainRedDot.RedPoint_BagFuncKey, LS_REDKEY); |
| | | |
| | |
| | | if (itemID != lsItemID) return; |
| | | |
| | | |
| | | if (GetItemCountByID(PackType.Item, lsItemID) < lsItemCnt)
|
| | | {
|
| | | redpointLS.state = RedPointState.None;
|
| | | if (GetItemCountByID(PackType.Item, lsItemID) < lsItemCnt) |
| | | { |
| | | redpointLS.state = RedPointState.None; |
| | | } |
| | | else
|
| | | {
|
| | | redpointLS.state = RedPointState.Simple;
|
| | | else |
| | | { |
| | | redpointLS.state = RedPointState.Simple; |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | redpointItemPack.state = RedPointState.None; |
| | | } |
| | | if (GetItemCountByID(PackType.Item, lsItemID) < lsItemCnt)
|
| | | {
|
| | | redpointLS.state = RedPointState.None;
|
| | | if (GetItemCountByID(PackType.Item, lsItemID) < lsItemCnt) |
| | | { |
| | | redpointLS.state = RedPointState.None; |
| | | } |
| | | else
|
| | | {
|
| | | redpointLS.state = RedPointState.Simple;
|
| | | else |
| | | { |
| | | redpointLS.state = RedPointState.Simple; |
| | | } |
| | | break; |
| | | case PackType.Warehouse: |
| | |
| | | public Redpoint redpointEquipDecom = new Redpoint(MainRedDot.RedPoint_MainPackKey, EquipDecompose_RedKey); |
| | | public void EquipDecomRedCtrl() |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.EquipDecompose))
|
| | | {
|
| | | return;
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.EquipDecompose)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (PlayerDatas.Instance.baseData.LV < devourRedpointLevel)
|
| | | {
|
| | | redpointEquipDecom.state = RedPointState.None;
|
| | | return;
|
| | | if (PlayerDatas.Instance.baseData.LV < devourRedpointLevel) |
| | | { |
| | | redpointEquipDecom.state = RedPointState.None; |
| | | return; |
| | | } |
| | | |
| | | var canDevourItems = GetCanDevourModellist();
|
| | | var canDevourItems = GetCanDevourModellist(); |
| | | if (canDevourItems != null && canDevourItems.Count >= minDevourEquipNum) |
| | | { |
| | | redpointEquipDecom.state = RedPointState.Simple; |
| | |
| | | |
| | | public int GetBetterEquipCount(List<ItemModel> itemModels) |
| | | { |
| | | if (itemModels.IsNullOrEmpty())
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | if (itemModels.IsNullOrEmpty()) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | var count = 0; |
| | | foreach (var item in itemModels)
|
| | | {
|
| | | foreach (var item in itemModels) |
| | | { |
| | | if (ItemLogicUtility.Instance.IsFightUp(item.itemId, item.score) == 1) |
| | | {
|
| | | { |
| | | count += item.count; |
| | | }
|
| | | } |
| | | } |
| | | return count; |
| | | } |
| | |
| | | public void SendEquipdevourQuest(bool auto) |
| | | { |
| | | List<ItemModel> items = null; |
| | | if (auto)
|
| | | {
|
| | | items = GetCanDevourModellist();
|
| | | }
|
| | | else
|
| | | {
|
| | | items = selectDevourlist;
|
| | | if (auto) |
| | | { |
| | | items = GetCanDevourModellist(); |
| | | } |
| | | else |
| | | { |
| | | items = selectDevourlist; |
| | | } |
| | | |
| | | if (items == null || items.Count < minDecomposeNum || !ItemLogicUtility.Instance.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return; |
| | |
| | | return true; |
| | | } |
| | | return false; |
| | | }
|
| | | } |
| | | #endregion |
| | |
|
| | | //获取背包中的一件可拍卖物品 优先其他职业
|
| | | public string GetAuctionEquip()
|
| | | {
|
| | | var itemPackage = GetSinglePack(PackType.Item);
|
| | | var allItems = itemPackage.GetAllItems();
|
| | |
|
| | | var guid = string.Empty;
|
| | | List<string> guidList = new List<string>();
|
| | | foreach (var item in allItems.Values)
|
| | | {
|
| | | var isAuction = item.isAuction;
|
| | | if (isAuction && ItemLogicUtility.Instance.IsRealmEquip(item.itemId))
|
| | | {
|
| | | if (!ItemLogicUtility.Instance.IsJobCompatibleItem(item.itemId))
|
| | | {
|
| | | return item.guid;
|
| | | }
|
| | | else
|
| | | {
|
| | | if (guid != string.Empty)
|
| | | continue;
|
| | | guid = item.guid;
|
| | | }
|
| | | }
|
| | | }
|
| | | return guid;
|
| | | |
| | | //获取背包中的一件可拍卖物品 优先其他职业 |
| | | public string GetAuctionEquip() |
| | | { |
| | | var itemPackage = GetSinglePack(PackType.Item); |
| | | var allItems = itemPackage.GetAllItems(); |
| | | |
| | | var guid = string.Empty; |
| | | List<string> guidList = new List<string>(); |
| | | foreach (var item in allItems.Values) |
| | | { |
| | | var isAuction = item.isAuction; |
| | | if (isAuction && ItemLogicUtility.Instance.IsRealmEquip(item.itemId)) |
| | | { |
| | | if (!ItemLogicUtility.Instance.IsJobCompatibleItem(item.itemId)) |
| | | { |
| | | return item.guid; |
| | | } |
| | | else |
| | | { |
| | | if (guid != string.Empty) |
| | | continue; |
| | | guid = item.guid; |
| | | } |
| | | } |
| | | } |
| | | return guid; |
| | | } |
| | | } |
| | | } |