public static void HandleShortcutBarAdd(ShortcutBarAddRequestMessage message, WorldClient client)
        {
            switch ((ShortcutBarEnum)message.barType)
            {
            case ShortcutBarEnum.GENERAL_SHORTCUT_BAR:
                if (message.shortcut is ShortcutObjectItem)
                {
                    ShortcutObjectItem shortcutObj = (ShortcutObjectItem)message.shortcut;
                    GeneralShortcutRecord.AddShortcut(client.Character.Id, shortcutObj.slot, ShortcutObjectItem.Id, shortcutObj.itemUID, shortcutObj.itemGID);
                }
                if (message.shortcut is ShortcutSmiley)
                {
                    ShortcutSmiley shortcutSmiley = (ShortcutSmiley)message.shortcut;
                    GeneralShortcutRecord.AddShortcut(client.Character.Id, shortcutSmiley.slot, ShortcutSmiley.Id, shortcutSmiley.smileyId, 0);
                }
                if (message.shortcut is ShortcutEmote)
                {
                    ShortcutEmote shortcutEmote = (ShortcutEmote)message.shortcut;
                    GeneralShortcutRecord.AddShortcut(client.Character.Id, shortcutEmote.slot, ShortcutEmote.Id, shortcutEmote.emoteId, 0);
                }
                break;

            case ShortcutBarEnum.SPELL_SHORTCUT_BAR:
                ShortcutSpell shortcut = (ShortcutSpell)message.shortcut;
                SpellShortcutRecord.AddShortcut(client.Character.Id, shortcut.slot, shortcut.spellId);
                break;
            }
            client.Character.RefreshShortcuts();
        }
        public static void HandleShortcutBarRemove(ShortcutBarRemoveRequestMessage message, WorldClient client)
        {
            switch ((ShortcutBarEnum)message.barType)
            {
            case ShortcutBarEnum.GENERAL_SHORTCUT_BAR:
                GeneralShortcutRecord.RemoveShortcut(client.Character.Id, message.slot);
                break;

            case ShortcutBarEnum.SPELL_SHORTCUT_BAR:
                SpellShortcutRecord.RemoveShortcut(client.Character.Id, message.slot);
                break;
            }
            client.Send(new ShortcutBarRemovedMessage(message.barType, message.slot));
        }
        public static void HandleShortcutBarSwap(ShortcutBarSwapRequestMessage message, WorldClient client)
        {
            switch ((ShortcutBarEnum)message.barType)
            {
            case ShortcutBarEnum.SPELL_SHORTCUT_BAR:
                SpellShortcutRecord.SwapSortcut(client.Character.Id, message.firstSlot, message.secondSlot);
                break;

            case ShortcutBarEnum.GENERAL_SHORTCUT_BAR:
                GeneralShortcutRecord.SwapSortcut(client.Character.Id, message.firstSlot, message.secondSlot);
                break;
            }
            client.Character.RefreshShortcuts();
        }
Пример #4
0
 public void UpdateBreedSpells(bool sendpackets = true)
 {
     foreach (var spell in BreedSpellRecord.GetBreedSpellsForLevel(Record.Level, Record.Breed, Spells.ConvertAll <short>(x => (short)x.spellId)))
     {
         SaveTask.AddElement(new CharacterSpellRecord(CharacterSpellRecord.CharactersSpells.PopNextId <CharacterSpellRecord>(x => x.Id), Id, spell.spellId, 1));
         SaveTask.AddElement(new SpellShortcutRecord(SpellShortcutRecord.SpellsShortcuts.PopNextId <SpellShortcutRecord>(x => x.Id), Id, (ushort)spell.spellId, SpellShortcutRecord.GetFreeSlotId(Id)));
     }
     if (sendpackets)
     {
         RefreshShortcuts();
         RefreshSpells();
     }
 }
Пример #5
0
 public bool LearnSpell(ushort spellid)
 {
     if (Spells.Contains <SpellItem>(x => x.spellId == spellid))
     {
         Client.Character.Reply("Vous connaissez déja ce sort.");
         return(false);
     }
     new CharacterSpellRecord(CharacterSpellRecord.CharactersSpells.PopNextId <CharacterSpellRecord>(x => x.Id), Id, spellid, 1).AddElement();
     new SpellShortcutRecord(SpellShortcutRecord.SpellsShortcuts.PopNextId <SpellShortcutRecord>(x => x.Id), Id, spellid, SpellShortcutRecord.GetFreeSlotId(Id)).AddElement();
     RefreshShortcuts();
     RefreshSpells();
     Client.Character.Reply("Vous avez appris un nouveau sort!");
     return(true);
 }