Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Maple2.Database/Model/Item/ItemSubType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ internal record ItemPet(string Name, long Exp, int EvolvePoints, short Level, sh

internal record ItemCustomMusicScore(
int Length,
int Instrument,
Instrument Instrument,
string Title,
string Author,
long AuthorId,
Expand Down
44 changes: 44 additions & 0 deletions Maple2.Model/Enum/Instrument.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
namespace Maple2.Model.Enum;

public enum Instrument {
Piano = 1,
Misc = 2,
Clarinet = 3,
Harp = 4,
Timapni = 5,
ElectricGuitar = 6,
Bass = 7,
Tomtam = 8,
Violin = 9,
Cello = 10,
PanFlute = 11,
Saxophone = 12,
Trombone = 13,
Trumpet = 14,
Ocarina = 15,
AcousticBass = 16,
Vibraphone = 17,
ElectricPiano = 18,
SteelDrum = 19,
PickBassGuitar = 20,
Oboe = 21,
Pizzicato = 22,
Harpsichord = 23,
Harmonica = 24,
Xylophone = 25,
Recorder = 26,
Celesta = 27,
Cymbal = 28,
BassDrum = 29,
SnareDrum = 30,
Shamisen = 31,
Koto = 32,
Shakuhachi = 33,
TaikoDrum = 34,
FretlessBass = 35,
Marimba = 36,
Flute = 37,
HonkyTonkPiano = 38,
FrenchHorn = 39,
PipeOrgan = 40,
}
9 changes: 5 additions & 4 deletions Maple2.Model/Game/Item/ItemCustomMusicScore.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using Maple2.PacketLib.Tools;
using Maple2.Model.Enum;
using Maple2.PacketLib.Tools;
using Maple2.Tools;

namespace Maple2.Model.Game;

public sealed class ItemCustomMusicScore : IByteSerializable, IByteDeserializable {
public int Length;
public int Instrument;
public Instrument Instrument;
public string Title;
public string Author;
public long AuthorId; // AccountId
Expand All @@ -24,7 +25,7 @@ public ItemCustomMusicScore Clone() {

public void WriteTo(IByteWriter writer) {
writer.WriteInt(Length);
writer.WriteInt(Instrument);
writer.Write<Instrument>(Instrument);
writer.WriteUnicodeString(Title);
writer.WriteUnicodeString(Author);
writer.WriteInt(1);
Expand All @@ -36,7 +37,7 @@ public void WriteTo(IByteWriter writer) {

public void ReadFrom(IByteReader reader) {
Length = reader.ReadInt();
Instrument = reader.ReadInt();
Instrument = reader.Read<Instrument>();
Title = reader.ReadUnicodeString();
Author = reader.ReadUnicodeString();
reader.ReadInt();
Expand Down
4 changes: 2 additions & 2 deletions Maple2.Server.Game/PacketHandlers/InstrumentHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,15 @@ private void HandleComposeScore(GameSession session, IByteReader packet) {
}

int length = packet.ReadInt();
int instrument = packet.ReadInt();
var instrument = packet.Read<Instrument>();
string title = packet.ReadUnicodeString();
string mml = packet.ReadString();

score.Music.Length = length;
score.Music.Instrument = instrument;
score.Music.Title = title;
score.Music.Author = session.PlayerName;
score.Music.AuthorId = session.CharacterId;
score.Music.AuthorId = session.AccountId;
score.Music.Mml = mml;

session.Send(InstrumentPacket.ComposeScore(score));
Expand Down