-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #206 from ethanmoffat/partygroup
Implement party/group
- Loading branch information
Showing
52 changed files
with
1,195 additions
and
834 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Domain.Party; | ||
|
||
namespace EOLib.Domain.Notifiers | ||
{ | ||
public interface IPartyEventNotifier | ||
{ | ||
void NotifyPartyRequest(PartyRequestType type, short playerId, string name); | ||
|
||
void NotifyPartyJoined(); | ||
|
||
void NotifyPartyMemberAdd(string name); | ||
|
||
void NotifyPartyMemberRemove(string name); | ||
} | ||
|
||
[AutoMappedType] | ||
public class NoOpPartyEventNotifier : IPartyEventNotifier | ||
{ | ||
public void NotifyPartyRequest(PartyRequestType type, short playerId, string name) { } | ||
|
||
public void NotifyPartyJoined() { } | ||
|
||
public void NotifyPartyMemberAdd(string name) { } | ||
|
||
public void NotifyPartyMemberRemove(string name) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Net; | ||
using EOLib.Net.Communication; | ||
|
||
namespace EOLib.Domain.Party | ||
{ | ||
[AutoMappedType] | ||
public class PartyActions : IPartyActions | ||
{ | ||
private readonly IPacketSendService _packetSendService; | ||
|
||
public PartyActions(IPacketSendService packetSendService) | ||
{ | ||
_packetSendService = packetSendService; | ||
} | ||
|
||
public void RequestParty(PartyRequestType type, short targetCharacterId) | ||
{ | ||
var packet = new PacketBuilder(PacketFamily.Party, PacketAction.Request) | ||
.AddChar((byte)type) | ||
.AddShort(targetCharacterId) | ||
.Build(); | ||
|
||
_packetSendService.SendPacket(packet); | ||
} | ||
|
||
public void AcceptParty(PartyRequestType type, short targetCharacterId) | ||
{ | ||
var packet = new PacketBuilder(PacketFamily.Party, PacketAction.Accept) | ||
.AddChar((byte)type) | ||
.AddShort(targetCharacterId) | ||
.Build(); | ||
|
||
_packetSendService.SendPacket(packet); | ||
} | ||
|
||
public void ListParty() | ||
{ | ||
var packet = new PacketBuilder(PacketFamily.Party, PacketAction.Take) | ||
.Build(); | ||
|
||
_packetSendService.SendPacket(packet); | ||
} | ||
|
||
public void RemovePartyMember(short targetCharacterId) | ||
{ | ||
var packet = new PacketBuilder(PacketFamily.Party, PacketAction.Remove) | ||
.AddShort(targetCharacterId) | ||
.Build(); | ||
|
||
_packetSendService.SendPacket(packet); | ||
} | ||
} | ||
|
||
public interface IPartyActions | ||
{ | ||
void RequestParty(PartyRequestType type, short targetCharacterId); | ||
|
||
void AcceptParty(PartyRequestType type, short targetCharacterId); | ||
|
||
void ListParty(); | ||
|
||
void RemovePartyMember(short targetCharacterId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Amadevus.RecordGenerator; | ||
|
||
namespace EOLib.Domain.Party | ||
{ | ||
[Record(Features.ObjectEquals | Features.Withers | Features.Builder | Features.Constructor | Features.ToString)] | ||
public sealed partial class PartyMember | ||
{ | ||
public short CharacterID { get; } | ||
|
||
public bool IsLeader { get; } | ||
|
||
public byte Level { get; } | ||
|
||
public byte PercentHealth { get; } | ||
|
||
public string Name { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using AutomaticTypeMapper; | ||
using System.Collections.Generic; | ||
|
||
namespace EOLib.Domain.Party | ||
{ | ||
public interface IPartyDataRepository | ||
{ | ||
List<PartyMember> Members { get; } | ||
} | ||
|
||
public interface IPartyDataProvider | ||
{ | ||
IReadOnlyList<PartyMember> Members { get; } | ||
} | ||
|
||
[AutoMappedType(IsSingleton = true)] | ||
public class PartyDataRepository : IPartyDataRepository, IPartyDataProvider | ||
{ | ||
public List<PartyMember> Members { get; set; } | ||
|
||
IReadOnlyList<PartyMember> IPartyDataProvider.Members => Members; | ||
|
||
public PartyDataRepository() | ||
{ | ||
Members = new List<PartyMember>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace EOLib.Domain.Party | ||
{ | ||
public enum PartyRequestType | ||
{ | ||
Join, | ||
Invite | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Amadevus.RecordGenerator; | ||
|
||
namespace EOLib.Domain.Spells | ||
{ | ||
[Record] | ||
public sealed partial class GroupSpellTarget | ||
{ | ||
public short TargetId { get; } | ||
|
||
public byte PercentHealth { get; } | ||
|
||
public short TargetHp { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.