ace/Source/ACE.Server/Network/Structure/Shortcut.cs
Ty Conner cefc62ae9a
Shortcut Fix Stage 2 (#1748)
* Changes to shortcut bar coding and storage

* Update CharacterExtensions.cs

* Update CharacterExtensions.cs

* Update Player_Character.cs

* Update 2019-04-17-00-Character_Shortcut_Changes.sql

* Add fix-shortcut-bars command as a helper to server admins

* Update DeveloperDatabaseCommands.cs

fix-shortcut-bars func written by @gmriggs

* Update DeveloperDatabaseCommands.cs

.

Co-Authored-By: gmriggs <gmriggs@gmail.com>

* Update DeveloperDatabaseCommands.cs

Co-Authored-By: gmriggs <gmriggs@gmail.com>

* Update DeveloperDatabaseCommands.cs

* Update changelog.md

* Update changelog.md

* Update DeveloperDatabaseCommands.cs

* Add log_audit option

* Update PlayerManager.cs

* Update changelog.md

* Update shutdown commands

* Update AdminShardCommands.cs

* Update changelog.md

* Update changelog.md

* Update PlayerManager.cs

* Update DeveloperDatabaseCommands.cs

* Update ServerManager.cs

* Update ServerManager.cs

* Update changelog.md
2019-04-20 12:57:44 -05:00

58 lines
1.6 KiB
C#

using System.Collections.Generic;
using System.IO;
using ACE.Database.Models.Shard;
namespace ACE.Server.Network.Structure
{
public class Shortcut
{
public uint Index; // position on shortcut bar
public uint ObjectId;
public LayeredSpell Spell; // unused?
public Shortcut() { }
public Shortcut(uint objectId, uint index)
{
Index = index;
ObjectId = objectId;
Spell = new LayeredSpell();
}
public Shortcut(CharacterPropertiesShortcutBar shortcut)
{
Index = shortcut.ShortcutBarIndex - 1;
ObjectId = shortcut.ShortcutObjectId;
Spell = new LayeredSpell();
}
}
public static class ShortcutExtensions
{
public static Shortcut ReadShortcut(this BinaryReader reader)
{
var shortcut = new Shortcut();
shortcut.Index = reader.ReadUInt32();
shortcut.ObjectId = reader.ReadUInt32();
shortcut.Spell = reader.ReadLayeredSpell();
return shortcut;
}
public static void Write(this BinaryWriter writer, Shortcut shortcut)
{
writer.Write(shortcut.Index);
writer.Write(shortcut.ObjectId);
writer.Write(shortcut.Spell);
}
public static void Write(this BinaryWriter writer, ICollection<Shortcut> shortcuts)
{
writer.Write(shortcuts.Count);
foreach (var shortcut in shortcuts)
writer.Write(shortcut);
}
}
}