package client.item;

/**
 * Created by Hong on 2014-06-22.'
 */
public class Inventory {
    int[] Inventory = new int[24];//6*4
    int[] ItemNumber = new int[24];
    private static client.item.Inventory instance = new client.item.Inventory();

    Inventory() { //처음 인벤 생성시 모든 칸, 칸당 갯수 0(null) 값을 준다.
        for (int x = 0; x < 24; x++) {
            Inventory[x] = 0;
            ItemNumber[x] = 0;
        }
    }

    public static client.item.Inventory getInstance() {
        return instance;
    }

    public void getItem(int GrahpicCode) { //아이템 얻을때
        for (int x = 0; x < 24; x++) {
            if (Inventory[x] == GrahpicCode) {
                ItemNumber[x]++;
                return;
            } else if (Inventory[x] == 0) {
                Inventory[x] = GrahpicCode;
                ItemNumber[x]++;
                return;
            }
        }
    }

    public void useItem(int GrahpicCode) { //아이템 사용, 파기에도 응용
        for (int x = 23; x == 0; x--) {
            if (Inventory[x] == GrahpicCode && ItemNumber[x] > 0) {
                ItemNumber[x]--;
                if (ItemNumber[x] == 0) {
                    Inventory[x] = 0;
                }
                return;
            }
        }
    }

}

@@ -549,18 +549,8 @@
 e) %7B
- //%EC%95%84%EC%9D%B4%ED%85%9C %EC%96%BB%EC%9D%84%EB%95%8C
 %0A   
@@ -911,26 +911,8 @@
 e) %7B
- //%EC%95%84%EC%9D%B4%ED%85%9C %EC%82%AC%EC%9A%A9, %ED%8C%8C%EA%B8%B0%EC%97%90%EB%8F%84 %EC%9D%91%EC%9A%A9
 %0A   
@@ -1201,11 +1201,10 @@
 %7D%0A    %7D%0A
-%0A
 %7D%0A

Revert "Item Class화 제거"