Esempio n. 1
0
        // 드랍아이템을 획득합니다.
        public void gainDropItem(UserCharacter u, int index)
        {
            DropItem item = DropItems[index];

            item.gain(u);
            deleteDropItem(index);
        }
Esempio n. 2
0
        public static void gainItem(UserCharacter u, DropItem dropitem)
        {
            Item item;
            Item obj;

            if (dropitem.trash && dropitem.dropData.item_type == 0)
            {
                item = Item.Equipments[dropitem.dropData.item_no];
            }
            else
            {
                item = Item.Items[dropitem.dropData.item_no];
            }
            if (item.type == 0)
            {
                if (!dropitem.trash)
                {
                    DataTable rs;
                    Mysql.Query($"INSERT INTO storage_equipment ({dropitem.field}) VALUES ({dropitem.values})");

                    // 아이템 재 로드하여 no 번호 추출 및 캐릭터, 변수 업데이트
                    rs = Mysql.Query($"SELECT * FROM storage_equipment WHERE `character` = '{u.name}'");
                    Mysql.Query($"UPDATE storage_equipment SET `character` = '' WHERE no = '{rs.Rows[0]["no"]}'");

                    obj = new Item(rs.Rows[0], item);
                    Item.Equipments.Add(obj.no, obj);

                    // 실제 인벤토리에 추가
                    u.gainItem(obj, 0);
                }
                else
                {
                    obj = Item.Equipments[dropitem.dropData.item_no];
                    u.gainItem(obj, 0);
                }
            }
            else
            {
                if (!dropitem.trash)
                {
                    u.gainItem(item, 1);
                }
                else
                {
                    obj = Item.Items[dropitem.dropData.item_no];
                    u.gainItem(obj, dropitem.number);
                }
            }
        }
Esempio n. 3
0
        public static Hashtable DropItemCreate(DropItem c)
        {
            Hashtable msg = new Hashtable();

            msg.Add("part", NETEVENT_CREATE);
            msg.Add("type", 1);
            msg.Add("no", c.no);
            msg.Add("name", c.name);
            msg.Add("x", c.x);
            msg.Add("y", c.y);
            msg.Add("dir", c.direction);
            msg.Add("image", c.image);
            msg.Add("pattern", c.pattern);
            return(msg);
        }
Esempio n. 4
0
        public void addDropItem(int x, int y, Item item, int number = 1)
        {
            int index = 0;

            for (int i = 0; i < 10000; i++)
            {
                if (!DropItems.ContainsKey(i))
                {
                    index = i; break;
                }
            }

            DropItem obj = new DropItem(index, x, y, item, number);

            DropItems.Add(index, obj);

            // 모든유저 패킷
            AllSendPacket(Packet.DropItemCreate(obj));
        }