Exemplo n.º 1
0
    private void MakeUseCreatureData()
    {
        InventoryInfo pInven = UserInfo.Instance.InventoryInfo;

        if (pInven == null)
        {
            return;
        }

        Dictionary <ulong, ItemCreature> pDicValue = pInven.MapInvenCreature;

        if (pDicValue == null)
        {
            return;
        }

        _CreatureList.Clear();

        // 등급순 -> 레벨순으로 정렬.
        foreach (KeyValuePair <ulong, ItemCreature> dicvalue in pDicValue.OrderByDescending((data) => data.Value.Grade).ThenByDescending((data) => data.Value.Level))
        {
            ulong kCreatureKey = dicvalue.Key;

            if (UtilFunc.IsDispatching(kCreatureKey) == true)                                    // 파견중인 크리쳐는 제낌.
            {
                continue;
            }

            ItemCreature         pMy           = UserInfo.Instance.InventoryInfo.GetMyCreature(kCreatureKey);
            DATA_CREATURE_NEWVER pCreatureData = UtilFunc.GetCreatureDataByTID(pMy.Index);

            if (pCreatureData.m_iGrade < (int)m_DispatchTableData.RequireGrade)      // 필요등급 검사
            {
                continue;
            }

            if (pMy.Level < m_DispatchTableData.RequireLevel)                  // 필요레벨 검사
            {
                continue;
            }

            if (UserInfo.Instance.CreatureTeam.HasTempCreatureAll(kCreatureKey))        // 팀에 속해있는지 검사
            {
                continue;
            }

            CreatureItemInfo info = new CreatureItemInfo();
            info.Init(kCreatureKey, pMy, pCreatureData);
            info.SetDispatchSelect(false, string.Empty);

            _CreatureList.Add(info);
        }

        // 전에 보냈던 크리쳐가 있으면 다시 정렬.
        for (int i = 0; i < m_DispatchRecvData.vCreatureKey.Count; i++)
        {
            foreach (CreatureItemInfo info in _CreatureList)
            {
                if (m_DispatchRecvData.vCreatureKey[i] == info.CreatureKey)
                {
                    CreatureItemInfo oldInfo = info;
                    _CreatureList.Remove(info);
                    _CreatureList.Insert(i, oldInfo);       // 전에 보냈던 순서대로 Insert
                    break;
                }
            }
        }
    }