コード例 #1
0
ファイル: ItemChecks.cs プロジェクト: CarlosX/DarkEmu
 /////////////////////////////////////////////////////////////////////////////////
 // Convert to item
 /////////////////////////////////////////////////////////////////////////////////
 Global.slotItem ConvertToItem(int id, byte slots, short amount, byte index)
 {
     #region Arrow convert info
     Global.slotItem slot = new DarkEmu_GameServer.Global.slotItem();
     slot.ID = id;
     slot.Slot = slots;
     slot.Amount = amount;
     return slot;
     #endregion
 }
コード例 #2
0
ファイル: ItemActions.cs プロジェクト: CarlosX/DarkEmu
        /////////////////////////////////////////////////////////////////////////////////
        // Avatar Equiped
        /////////////////////////////////////////////////////////////////////////////////
        void ItemAvatarEquip(byte fromSlot, byte toSlot)
        {
            #region Avatar equiped
            try
            {
                GetFreeSlot();
                Global.slotItem toItem = new DarkEmu_GameServer.Global.slotItem();
                Global.slotItem fromItem = GetItem((uint)Character.Information.CharacterID, fromSlot, 0);

                MsSQL ms = new MsSQL("SELECT * FROM char_items WHERE itemnumber='avatar" + toSlot + "' AND owner='" + Character.Information.CharacterID + "'");
                using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
                {
                    while (reader.Read())
                    {
                        toItem.ID = reader.GetInt32(2);
                        toItem.dbID = reader.GetInt32(0);
                    }
                }
                ms.Close();

                if (toItem.ID != 0) return;

                if (fromItem.ID == 0) return;
                if (!CheckGender(Character.Information.Model, fromItem.ID))
                {
                    return;
                }

                else
                {
                    string nonquery = "UPDATE char_items SET itemnumber='avatar" + toSlot + "',inAvatar='1',slot='" + toSlot + "' WHERE owner='" + Character.Information.CharacterID + "' AND itemnumber='item" + fromSlot + "' AND id='" + fromItem.dbID + "'";
                    MsSQL.InsertData(nonquery);
                }
                Send(Packet.MoveItemEnquipEffect(Character.Information.UniqueID, toSlot, fromItem.ID, 0));
                client.Send(Packet.MoveItem(36, fromSlot, toSlot, 1, 0, "MOVE_INSIDE_INVENTORY"));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Avatar equiped error {0}", ex);
                Systems.Debugger.Write(ex);
            }
            #endregion
        }