Exemplo n.º 1
0
        public void SwapShortcuts(ShortcutBarEnum barType, int slot, int newSlot)
        {
            if (IsSlotFree(slot, barType))
            {
                return;
            }

            var shortcutToSwitch    = GetShortcut(barType, slot);
            var shortcutDestination = GetShortcut(barType, newSlot);

            RemoveInternal(shortcutToSwitch);
            RemoveInternal(shortcutDestination);

            if (shortcutDestination != null)
            {
                shortcutDestination.Slot = slot;
                AddInternal(shortcutDestination);
                ShortcutHandler.SendShortcutBarRefreshMessage(Owner.Client, barType, shortcutDestination);
            }
            else
            {
                ShortcutHandler.SendShortcutBarRemovedMessage(Owner.Client, barType, slot);
            }

            shortcutToSwitch.Slot = newSlot;
            AddInternal(shortcutToSwitch);
            ShortcutHandler.SendShortcutBarRefreshMessage(Owner.Client, barType, shortcutToSwitch);
        }
Exemplo n.º 2
0
        public void AddItemShortcut(int slot, BasePlayerItem item)
        {
            if (!this.IsSlotFree(slot, ShortcutBarEnum.GENERAL_SHORTCUT_BAR))
            {
                this.RemoveShortcut(ShortcutBarEnum.GENERAL_SHORTCUT_BAR, slot);
            }
            ItemShortcut itemShortcut = new ItemShortcut(this.Owner.Record, slot, item.Template.Id, item.Guid);

            this.m_itemShortcuts.Add(slot, itemShortcut);
            ShortcutHandler.SendShortcutBarRefreshMessage(this.Owner.Client, ShortcutBarEnum.GENERAL_SHORTCUT_BAR, itemShortcut);
        }
Exemplo n.º 3
0
        public void AddSpellShortcut(int slot, short spellId)
        {
            if (!this.IsSlotFree(slot, ShortcutBarEnum.SPELL_SHORTCUT_BAR))
            {
                this.RemoveShortcut(ShortcutBarEnum.SPELL_SHORTCUT_BAR, slot);
            }
            SpellShortcut spellShortcut = new SpellShortcut(this.Owner.Record, slot, spellId);

            this.m_spellShortcuts.Add(slot, spellShortcut);
            ShortcutHandler.SendShortcutBarRefreshMessage(this.Owner.Client, ShortcutBarEnum.SPELL_SHORTCUT_BAR, spellShortcut);
        }
Exemplo n.º 4
0
        public void AddPresetShortcut(int slot, int presetId)
        {
            if (!IsSlotFree(slot, ShortcutBarEnum.GENERAL_SHORTCUT_BAR))
            {
                RemoveShortcut(ShortcutBarEnum.GENERAL_SHORTCUT_BAR, slot);
            }

            var shortcut = new PresetShortcut(Owner.Record, slot, presetId);

            m_presetShortcuts.Add(slot, shortcut);
            ShortcutHandler.SendShortcutBarRefreshMessage(Owner.Client, ShortcutBarEnum.GENERAL_SHORTCUT_BAR, shortcut);
        }
Exemplo n.º 5
0
 public void SwapShortcuts(ShortcutBarEnum barType, int slot, int newSlot)
 {
     if (!this.IsSlotFree(slot, barType))
     {
         Stump.Server.WorldServer.Database.Shortcuts.Shortcut shortcut  = this.GetShortcut(barType, slot);
         Stump.Server.WorldServer.Database.Shortcuts.Shortcut shortcut2 = this.GetShortcut(barType, newSlot);
         this.RemoveInternal(shortcut);
         this.RemoveInternal(shortcut2);
         if (shortcut2 != null)
         {
             shortcut2.Slot = slot;
             this.AddInternal(shortcut2);
             ShortcutHandler.SendShortcutBarRefreshMessage(this.Owner.Client, barType, shortcut2);
         }
         else
         {
             ShortcutHandler.SendShortcutBarRemovedMessage(this.Owner.Client, barType, slot);
         }
         shortcut.Slot = newSlot;
         this.AddInternal(shortcut);
         ShortcutHandler.SendShortcutBarRefreshMessage(this.Owner.Client, barType, shortcut);
     }
 }