Пример #1
0
        public void AddShortcut(ShortcutBarEnum barType, DofusProtocol.Types.Shortcut shortcut)
        {
            // do not ask me why i use a sbyte, they are f*****g idiots
            if (shortcut is ShortcutSpell && barType == ShortcutBarEnum.SPELL_SHORTCUT_BAR)
            {
                AddSpellShortcut(shortcut.slot, ((ShortcutSpell)shortcut).spellId);
            }
            else if (shortcut is ShortcutObjectItem && barType == ShortcutBarEnum.GENERAL_SHORTCUT_BAR)
            {
                var item = Owner.Inventory.TryGetItem(((ShortcutObjectItem)shortcut).itemUID);

                if (item != null)
                {
                    AddItemShortcut(shortcut.slot, item);
                }
                else
                {
                    ShortcutHandler.SendShortcutBarAddErrorMessage(Owner.Client);
                }
            }
            else if (shortcut is ShortcutObjectPreset && barType == ShortcutBarEnum.GENERAL_SHORTCUT_BAR)
            {
                AddPresetShortcut(shortcut.slot, ((ShortcutObjectPreset)shortcut).presetId);
            }
            else
            {
                ShortcutHandler.SendShortcutBarAddErrorMessage(Owner.Client);
            }
        }
Пример #2
0
 public void AddShortcut(ShortcutBarEnum barType, Stump.DofusProtocol.Types.Shortcut shortcut)
 {
     if (shortcut is ShortcutSpell && barType == ShortcutBarEnum.SPELL_SHORTCUT_BAR)
     {
         this.AddSpellShortcut(shortcut.slot, (short)(shortcut as ShortcutSpell).spellId);
     }
     else
     {
         if (shortcut is ShortcutObjectItem && barType == ShortcutBarEnum.GENERAL_SHORTCUT_BAR)
         {
             this.AddItemShortcut(shortcut.slot, this.Owner.Inventory.TryGetItem((shortcut as ShortcutObjectItem).itemUID));
         }
         else
         {
             ShortcutHandler.SendShortcutBarAddErrorMessage(this.Owner.Client);
         }
     }
 }