Exemplo n.º 1
0
        public static void GetItemsByType(this ItemCollection items, E_ITEM_TYPE type)
        {
            WowDatabase _wowDatabase = Engine.Instance.WowDatabase;
            uint        itemCount    = _wowDatabase.ItemCount;

            items.Clear();

            for (uint i = 0; i < itemCount; ++i)
            {
                SItem?r = _wowDatabase.GetItem(i);
                if (r != null)
                {
                    if (r.Value.type == (int)type)
                    {
                        if (r.Value.name.IndexOf("deprecated", StringComparison.CurrentCultureIgnoreCase) == -1)
                        {
                            items.Add(new Item()
                            {
                                Name = r.Value.name, Type = (E_ITEM_TYPE)r.Value.type, Id = r.Value.id, ModelId = r.Value.modelId, SubClassName = r.Value.subclassname
                            });
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void GetItemsByType(this M2ItemCollection items, E_ITEM_TYPE type)
        {
            WowDatabase _wowDatabase = Engine.Instance.WowDatabase;
            uint        itemCount    = _wowDatabase.ItemCount;

            items.Clear();

            for (uint i = 0; i < itemCount; ++i)
            {
                SItem?r = _wowDatabase.GetItem(i);
                if (r != null && r.Value.type == (int)type && r.Value.name.IndexOf("deprecated", StringComparison.CurrentCultureIgnoreCase) == -1)
                {
                    int    itemid = r.Value.id;
                    string modelpath;
                    string texturepath;
                    modelpath = _wowDatabase.GetItemPath(itemid, out texturepath);

                    items.Add(new M2Item()
                    {
                        Name         = r.Value.name,
                        Type         = (E_ITEM_TYPE)r.Value.type,
                        Id           = r.Value.id,
                        SubClassName = r.Value.subclassname,
                        ModelPath    = modelpath,
                        TexturePath  = texturepath
                    });
                }
            }
        }
Exemplo n.º 3
0
    public Ingredient AddItem_Ingrdient(E_ITEM_TYPE _type, int _nIndex, int _nListIndex)
    {
        Ingredient addIngredient = new Ingredient();

        switch (_type)
        {
        case E_ITEM_TYPE.E_MATERIAL:
        {
            DBMaterialData materialDB = GameManager.Instance.lDBMaterialData[_nIndex];
            addIngredient.nIndex  = materialDB.nIndex;
            addIngredient.strName = materialDB.sMaterialName;
            addIngredient.sImage  = materialDB.sImagePath;
            addIngredient.nCount  = materialDB.nCount;

            addIngredient.sExplanation = materialDB.sExplanation;
            addIngredient.nSelected    = materialDB.nSelected;
            addIngredient.nSellCost    = materialDB.nSellCost;
            addIngredient.nListIndex   = materialDB.nListIndex;

            addIngredient.strItemType = materialDB.sItemType;
        }
        break;
        }

        addIngredient.nCount = _nListIndex;

        return(addIngredient);
    }
Exemplo n.º 4
0
    E_ITEM_TYPE GetRandomItemType()
    {
        if (eType != E_ITEM_TYPE.NONE)
        {
            return(eType);
        }

        int randPerType = Random.Range(1, 3);

        if (randPerType == 1)
        {
            eType = E_ITEM_TYPE.EQUIP;
        }
        else if (randPerType == 2)
        {
            eType = E_ITEM_TYPE.WEAPON;
        }
        else if (randPerType == 3)
        {
            eType = E_ITEM_TYPE.ESSENCE;
        }
        else if (randPerType == 4)
        {
            eType = E_ITEM_TYPE.BLESS;
        }

        return(eType);
    }
Exemplo n.º 5
0
    public ItemInfo GetItemInfo(E_ITEM_TYPE _eType, int _nIdx)
    {
        ItemInfo result = null;
        //Linq
        var info = from n in listItems
                   where (n.ItemType == _eType && n.TypeIdx == _nIdx)
                   select n;

        result = info.FirstOrDefault();

        return(result);
    }
Exemplo n.º 6
0
    public List <ItemInfo> GetItemsFromTier(E_ITEM_TIER _eTier, E_ITEM_TYPE _eType)
    {
        List <ItemInfo> items;

        var info = from n in listItems
                   where (n.ItemTier == _eTier && n.ItemType == _eType)
                   select n;

        items = info.ToList();

        return(items);
    }
Exemplo n.º 7
0
 public void SetupItem()
 {
     if (UserDataManager.Instance.currStage >= 6)
     {
         int random = UnityEngine.Random.Range(0, 100);
         if (random <= 1)
         {
             eItemType = E_ITEM_TYPE.Lighting;
         }
     }
     if (eItemType != E_ITEM_TYPE.None)
     {
         view.items[((int)eItemType)].SetActive(true);
     }
 }
Exemplo n.º 8
0
        public void FillData(E_ITEM_TYPE type)
        {
            App app = Application.Current as App;

            Items.GetItemsByType(type);
            itemsView = CollectionViewSource.GetDefaultView(Items);

            visibleEntries.Clear();
            foreach (Item v in Items)
            {
                if (!visibleEntries.ContainsKey(v.SubClassName))
                {
                    visibleEntries[v.SubClassName] = true;
                }
            }
            BuildTypeContextMenu();
        }
Exemplo n.º 9
0
    public void Initialize(int _nIdx, E_ITEM_TYPE _eItemType, int _nTypeId, E_ELEMENT_TYPE _eElementType,
                           E_ITEM_TIER _eItemTier, string _strNameKey, string _strInfoKey, string _strIconPath, string _strSpritePath)
    {
        nIdx          = _nIdx;
        eItemType     = _eItemType;
        nTypeIdx      = _nTypeId;
        eElementType  = _eElementType;
        eItemTier     = _eItemTier;
        strNameKey    = _strNameKey;
        strInfoKey    = _strInfoKey;
        strSpritePath = _strSpritePath;
        strIconPath   = _strIconPath;

        strSpritePath = strSpritePath.Replace("Assets/Resources/", "");
        strSpritePath = strSpritePath.Replace(".png", "");

        strIconPath = strIconPath.Replace("Assets/Resources/", "");
        strIconPath = strIconPath.Replace(".png", "");

        sprite = Resources.Load <Sprite>(strSpritePath);
        icon   = Resources.Load <Sprite>(strIconPath);
    }
Exemplo n.º 10
0
    public Equipment AddItem_Equipment(E_ITEM_TYPE _type, int _nIndex, int _nListIndex)
    {
        Equipment addEquipment = new Equipment();


        switch (_type)
        {
        case E_ITEM_TYPE.E_WEAPON:
        {
            DBWeapon weaponDB = GameManager.Instance.lDbWeapon [_nIndex];

            addEquipment.nIndex  = weaponDB.nIndex;
            addEquipment.strName = weaponDB.sName;
            addEquipment.nTier   = weaponDB.nTier;

            addEquipment.strPossibleJob = weaponDB.sJob;
            addEquipment.nEnhance       = weaponDB.nEnhanced;


            addEquipment.strItemType             = weaponDB.sItemType;
            addEquipment.fPhysical_Attack_Rating = RandomAddValue(weaponDB.fPhysical_AttackRating);
            addEquipment.fMagic_Attack_Rating    = RandomAddValue(weaponDB.fMagic_AttackRating);

            addEquipment.nQulity = GetQuality_Weapon(addEquipment.fPhysical_Attack_Rating, addEquipment.fMagic_Attack_Rating,
                                                     weaponDB.fPhysical_AttackRating, weaponDB.fMagic_AttackRating);


            addEquipment.nSellCost           = weaponDB.nSellCost;
            addEquipment.nMakeMaterialIndex  = weaponDB.nMakeMaterial;
            addEquipment.nBreakMaterialIndex = weaponDB.nBreakMaterial;
            addEquipment.sImage = weaponDB.sImage;
            if (addEquipment.nQulity > 0)
            {
                RandomAddOption(addEquipment, weaponDB.nRandomOption);
            }

            addEquipment.nListIndex = _nListIndex;
        }
        break;

        case E_ITEM_TYPE.E_ARMOR:
        {
            DBArmor armorDB = GameManager.Instance.lDBArmor [_nIndex];

            addEquipment.nIndex  = armorDB.nIndex;
            addEquipment.strName = armorDB.sName;
            addEquipment.nTier   = armorDB.nTier;

            addEquipment.strPossibleJob = armorDB.sJob;
            addEquipment.nEnhance       = armorDB.nEnhanced;

            addEquipment.strItemType       = armorDB.sItemType;
            addEquipment.fPhysical_Defense = RandomAddValue(armorDB.fPhysical_Defense);
            addEquipment.fMagic_Defense    = RandomAddValue(armorDB.fMagic_Defense);
            addEquipment.fHp     = RandomAddValue(armorDB.sHp);
            addEquipment.nQulity = GetQuality_Armor(addEquipment.fPhysical_Defense, addEquipment.fMagic_Defense, addEquipment.fHp,
                                                    armorDB.fPhysical_Defense, armorDB.fMagic_Defense, armorDB.sHp);

            addEquipment.nSellCost           = armorDB.nSellCost;
            addEquipment.nMakeMaterialIndex  = armorDB.nMakeMaterial;
            addEquipment.nBreakMaterialIndex = armorDB.nBreakMaterial;
            addEquipment.sImage = armorDB.sImage;
            if (addEquipment.nQulity > 0)
            {
                RandomAddOption(addEquipment, armorDB.nRandomOption);
            }
            addEquipment.nListIndex = _nListIndex;
        }
        break;

        case E_ITEM_TYPE.E_GLOVE:
        {
            DBGlove gloveDB = GameManager.Instance.lDBGlove [_nIndex];

            addEquipment.nIndex  = gloveDB.nIndex;
            addEquipment.strName = gloveDB.sName;
            addEquipment.nTier   = gloveDB.nTier;

            addEquipment.strPossibleJob = gloveDB.sJob;
            addEquipment.nEnhance       = gloveDB.nEnhanced;
            addEquipment.strItemType    = gloveDB.sItemType;

            addEquipment.fPhysical_Defense = RandomAddValue(gloveDB.fPhysical_Defense);
            addEquipment.fMagic_Defense    = RandomAddValue(gloveDB.fMagic_Defense);
            addEquipment.nQulity           = GetQuality_Glove(addEquipment.fPhysical_Defense, addEquipment.fMagic_Defense, gloveDB.fPhysical_Defense, gloveDB.fMagic_Defense);

            addEquipment.nSellCost           = gloveDB.nSellCost;
            addEquipment.nMakeMaterialIndex  = gloveDB.nMakeMaterial;
            addEquipment.nBreakMaterialIndex = gloveDB.nBreakMaterial;
            addEquipment.sImage = gloveDB.sImage;
            if (addEquipment.nQulity > 0)
            {
                RandomAddOption(addEquipment, gloveDB.nRandomOption);
            }
            addEquipment.nListIndex = _nListIndex;
        }
        break;

        case E_ITEM_TYPE.E_ACCESSORY:
        {
            DBAccessory accessoryDB = GameManager.Instance.lDBAccessory [_nIndex];

            addEquipment.nIndex  = accessoryDB.nIndex;
            addEquipment.strName = accessoryDB.sName;
            addEquipment.nTier   = accessoryDB.nTier;

            addEquipment.fHp = RandomAddValue(accessoryDB.sHp);

            addEquipment.nQulity = GetQuality_Accessory(addEquipment.fHp, accessoryDB.sHp);

            addEquipment.strPossibleJob = accessoryDB.sJob;
            addEquipment.nEnhance       = accessoryDB.nEnhanced;
            addEquipment.strItemType    = accessoryDB.sItemType;

            addEquipment.nSellCost           = accessoryDB.nSellCost;
            addEquipment.nMakeMaterialIndex  = accessoryDB.nMakeMaterial;
            addEquipment.nBreakMaterialIndex = accessoryDB.nBreakMaterial;
            addEquipment.sImage = accessoryDB.sImage;
            if (addEquipment.nQulity > 0)
            {
                RandomAddOption(addEquipment, accessoryDB.nRandomOption);
            }
            addEquipment.nListIndex = _nListIndex;
        }
        break;
        }
        //테스트용 (강화)
        if (addEquipment.nTier > 1)
        {
            addEquipment.nEnhance = 5;
        }


        return(addEquipment);
    }