Exemplo n.º 1
0
        public static ToolbarItemSetRequest Read(PacketHeader header, BinaryReader br)
        {
            uint       id    = br.ReadUInt32();
            byte       extra = br.ReadByte();
            TargetType t     = TargetType.Unknown;

            switch (extra & 0x3)
            {
            case 2:
                t = TargetType.Item;
                break;

            case 3:
                t   = TargetType.Skill;
                id &= 0xFFFF;
                break;
            }

            ToolbarItemSetRequest tbr = new ToolbarItemSetRequest();

            tbr.TargetID = id;
            tbr.Type     = t;
            tbr.Slot     = extra >> 2;

            return(tbr);
        }
Exemplo n.º 2
0
        void ToolbarItemSet_Handler(Task t)
        {
            ToolbarItemSetRequest tbr = (ToolbarItemSetRequest)t.Args;

            string sql = t.Client.Character.Toolbar.SetItem(t.Client, tbr);

            AddDBQuery(sql, null, false);
        }
Exemplo n.º 3
0
 private void Client_OnToolbar(object sender, ToolbarItemSetRequest e)
 {
     TaskProcessor.AddTask(new Task(Task.TaskType.ToolbarItemSet, (Connection)sender, e));
 }
Exemplo n.º 4
0
        public static ToolbarItemSetRequest Read(PacketHeader header, BinaryReader br)
        {
            uint id = br.ReadUInt32();
            byte extra = br.ReadByte();
            TargetType t = TargetType.Unknown;
            switch (extra & 0x3)
            {
                case 2:
                    t = TargetType.Item;
                    break;
                case 3:
                    t = TargetType.Skill;
                    id &= 0xFFFF;
                    break;
            }

            ToolbarItemSetRequest tbr = new ToolbarItemSetRequest();
            tbr.TargetID = id;
            tbr.Type = t;
            tbr.Slot = extra >> 2;

            return tbr;
        }
Exemplo n.º 5
0
 public SetToolbarLink(uint id, ToolbarItemSetRequest.TargetType type, int slot, Item.ItemError err = Item.ItemError.None)
 {
     _id = id;
     int t = (type == ToolbarItemSetRequest.TargetType.Skill ? 3 : 2);
     int typeByte = (slot << 2) | t;
     _type = (byte)typeByte;
     _err = (byte)err;
 }
Exemplo n.º 6
0
        public string SetItem(Connection client, ToolbarItemSetRequest tbr)
        {
            // Change the data in memory
            _slots[tbr.Slot] = tbr.TargetID | (tbr.Type == ToolbarItemSetRequest.TargetType.Skill ? 0x80000000 : 0);

            // Tell the client we accept
            client.SendPacket(new SetToolbarLink(tbr.TargetID, tbr.Type, tbr.Slot));

            // Save it in the database
            string sql = string.Format("UPDATE characters_toolbar SET slot_{0}={1} WHERE character_id={2};", tbr.Slot, _slots[tbr.Slot], client.Character.ID);

            return sql;
        }
Exemplo n.º 7
0
 void Toolbar_Item_Set_Handler(PacketHeader header, BinaryReader br)
 {
     OnToolbarItemSet(this, ToolbarItemSetRequest.Read(header, br));
 }
Exemplo n.º 8
0
 private void Client_OnToolbar(object sender, ToolbarItemSetRequest e)
 {
     TaskProcessor.AddTask(new Task(Task.TaskType.ToolbarItemSet, (Connection)sender, e));
 }