Esempio n. 1
0
    public static bool GetItemCodeToIndex(out int Result, RESULTTYPE type, Item.ITEMCODE code)
    {
        int typelength = type == RESULTTYPE.POTION ? POTIONLENGTH : ITEMLENGTH;

        Result = -1;
        int Tier  = (int)code / TIERLENGTH;
        int index = (int)code % TIERLENGTH;

        switch (type)
        {
        case RESULTTYPE.POTION:
            if (index >= typelength)
            {
                return(false);
            }
            break;

        case RESULTTYPE.EQULPMENT:
            index -= POTIONLENGTH;
            if (index < 0)
            {
                return(false);
            }
            break;
        }
        Result = index + Tier * typelength;
        return(true);
        //21번 2티어 완드 , 인덱스는 11번나와야함.
        //인덱스 = 6번
    }
Esempio n. 2
0
    public static bool GetItemIndexToCode(out Item.ITEMCODE Result, RESULTTYPE type, int index)
    {
        Result = Item.ITEMCODE.NONE;
        int typelength = type == RESULTTYPE.POTION ? POTIONLENGTH : ITEMLENGTH;

        if (index >= typelength * 3)
        {
            return(false);
        }
        int Tier = index / typelength;

        switch (type)
        {
        case RESULTTYPE.POTION:
            Result = (Item.ITEMCODE)(index + Tier * ITEMLENGTH);
            break;

        case RESULTTYPE.EQULPMENT:
            Result = (Item.ITEMCODE)(index + (Tier + 1) * POTIONLENGTH);
            break;
        }
        return(true);
    }