Skip to content

Commit

Permalink
Guild information UI (#371)
Browse files Browse the repository at this point in the history
* Guild Information Lookup Menu

- Implemented guild information lookup feature
- Added UI elements for viewing guild members
- Created window pop-up for guild interactions
- Integrated new dialog factory methods for guild UI
- Updated resource IDs for localization

* Add EOResources and warning for short guild tag

* Apply PR suggestions

* Guild dialog code structure cleanup

* Wire up information item to state transitions

* Handle packet data for Guild Lookup and Member List menu actions

---------

Co-authored-by: Ethan Moffat <[email protected]>
  • Loading branch information
sjbmcg and ethanmoffat authored Oct 20, 2024
1 parent 3e09fb0 commit 985c8e4
Show file tree
Hide file tree
Showing 9 changed files with 368 additions and 38 deletions.
3 changes: 2 additions & 1 deletion EOLib.Localization/DialogResourceID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public enum DialogResourceID
TRADE_OTHER_PLAYER_TRICK_YOU = 126,
GUILD_CREATE_TAG_FIELD_EMPTY = 128,
GUILD_CREATE_NAME_FIELD_EMPTY = 130,
GUILD_CREATE_TAG_TOO_SHORT = 132,
GUILD_WRONG_INPUT = 132,
GUILD_CREATE_TAG_TOO_SHORT = 133,
GUILD_CREATE_NAME_TOO_SHORT = 134,
GUILD_CREATE_NAME_NOT_APPROVED = 136,
GUILD_CREATE_NO_CANDIDATES = 138,
Expand Down
18 changes: 18 additions & 0 deletions EOLib.Localization/EOResourceID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,39 @@ public enum EOResourceID
GUILD_WITHDRAW_FUNDS_FROM_GUILD = 201,
GUILD_REMOVE_MEMBER = 202,
GUILD_REMOVE_A_MEMBER_FROM_GUILD = 203,

GUILD_JOINING_A_GUILD_IS_FREE = 205,

GUILD_PLEASE_CONSIDER_CAREFULLY = 207,
GUILD_DESCRIPTION = 219,

GUILD_DO_YOU_ACCEPT = 223,

GUILD_YOUR_ACCOUNT_WILL_BE_CHARGED = 225,
GUILD_PLEASE_CONSIDER_CAREFULLY_RECRUIT = 226,
GUILD_TO_VIEW_INFORMATION_ABOUT_A_GUILD_ENTER_ITS_TAG = 227,

GUILD_SIGNUP_DATE = 228,

GUILD_RANKING_SYSTEM = 230,
GUILD_LEADERS = 231,

GUILD_ASSIGN_RANK_TO_MEMBER = 233,
GUILD_CURRENT_DESCRIPTION = 234,
GUILD_CLICK_HERE_TO_CHANGE_THE_DESCRIPTION = 235,

GUILD_BANK_STATUS = 244,

SETTING_KEYBOARD_ENGLISH = 253,
SETTING_KEYBOARD_DUTCH = 254,
SETTING_KEYBOARD_SWEDISH = 255,
SETTING_KEYBOARD_AZERTY = 256,

GUILD_LOOK_UP = 267,
GUILD_VIEW_DETAILS = 268,
GUILD_MEMBERLIST = 269,
GUILD_VIEW_MEMBERS = 270,

BOARD_TOWN_BOARD = 271,
BOARD_TOWN_BOARD_NOW_VIEWED = 272,
BOARD_LOADING_MESSAGE = 273,
Expand Down
40 changes: 40 additions & 0 deletions EOLib/Domain/Interact/Guild/GuildInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using Amadevus.RecordGenerator;
using Moffat.EndlessOnline.SDK.Protocol.Net.Server;

namespace EOLib.Domain.Interact.Guild
{
[Record(Features.Default | Features.ObjectEquals | Features.EquatableEquals)]
public sealed partial class GuildInfo
{
public string Name { get; }

public string Tag { get; }

public DateTime CreateDate { get; }

public string Description { get; }

public string Wealth { get; }

public IReadOnlyList<string> Ranks { get; }

public IReadOnlyList<GuildStaff> Staff { get; }

public static GuildInfo FromPacket(GuildReportServerPacket packet)
{
return new Builder
{
Name = packet.Name,
Tag = packet.Tag,
CreateDate = DateTime.TryParse(packet.CreateDate, out var created) ? created : new DateTime(0, DateTimeKind.Utc),
Description = packet.Description,
Wealth = packet.Wealth,
Ranks = packet.Ranks,
Staff = packet.Staff
}.ToImmutable();
}

}
}
22 changes: 21 additions & 1 deletion EOLib/Domain/Interact/Guild/GuildSessionRepository.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using AutomaticTypeMapper;
using System.Collections.Generic;
using AutomaticTypeMapper;
using Moffat.EndlessOnline.SDK.Protocol.Net.Server;
using Optional;

namespace EOLib.Domain.Interact.Guild
{
Expand All @@ -7,25 +10,42 @@ public interface IGuildSessionProvider
int SessionID { get; }

string GuildDescription { get; }

Option<GuildInfo> GuildInfo { get; }

IReadOnlyList<GuildMember> GuildMembers { get; }
}

public interface IGuildSessionRepository
{
int SessionID { get; set; }

string GuildDescription { get; set; }

Option<GuildInfo >GuildInfo { get; set; }

List<GuildMember> GuildMembers { get; set; }
}

[AutoMappedType(IsSingleton = true)]
public class GuildSessionRepository : IGuildSessionRepository, IGuildSessionProvider
{
public int SessionID { get; set; }

public string GuildDescription { get; set; }

public Option<GuildInfo> GuildInfo { get; set; }

public List<GuildMember> GuildMembers { get; set; }

IReadOnlyList<GuildMember> IGuildSessionProvider.GuildMembers => GuildMembers;

public GuildSessionRepository()
{
SessionID = 0;
GuildDescription = "";
GuildInfo = Option.None<GuildInfo>();
GuildMembers = new List<GuildMember>();
}
}
}
34 changes: 34 additions & 0 deletions EOLib/PacketHandlers/Guild/GuildReportHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using AutomaticTypeMapper;
using EOLib.Domain.Interact.Guild;
using EOLib.Domain.Login;
using EOLib.Net.Handlers;
using Moffat.EndlessOnline.SDK.Protocol.Net;
using Moffat.EndlessOnline.SDK.Protocol.Net.Server;
using Optional;

namespace EOLib.PacketHandlers.Guild
{
[AutoMappedType]

public class GuildReportHandler : InGameOnlyPacketHandler<GuildReportServerPacket>
{
private readonly IGuildSessionRepository _guildSessionRepository;

public override PacketFamily Family => PacketFamily.Guild;

public override PacketAction Action => PacketAction.Report;

public GuildReportHandler(IPlayerInfoProvider playerInfoProvider,
IGuildSessionRepository guildSessionRepository)
: base(playerInfoProvider)
{
_guildSessionRepository = guildSessionRepository;
}

public override bool HandlePacket(GuildReportServerPacket packet)
{
_guildSessionRepository.GuildInfo = Option.Some(GuildInfo.FromPacket(packet));
return true;
}
}
}
4 changes: 0 additions & 4 deletions EOLib/PacketHandlers/Guild/GuildTakeHandler.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using AutomaticTypeMapper;
using EOLib.Domain.Interact;
using EOLib.Domain.Interact.Guild;
using EOLib.Domain.Login;
using EOLib.Domain.Map;
using EOLib.Net.Handlers;
using Moffat.EndlessOnline.SDK.Protocol.Net;
using Moffat.EndlessOnline.SDK.Protocol.Net.Server;
using Optional;
using System.Collections.Generic;

namespace EOLib.PacketHandlers.Guild
{
Expand Down
34 changes: 34 additions & 0 deletions EOLib/PacketHandlers/Guild/GuildTellHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using AutomaticTypeMapper;
using EOLib.Domain.Interact.Guild;
using EOLib.Domain.Login;
using EOLib.Net.Handlers;
using Moffat.EndlessOnline.SDK.Protocol.Net;
using Moffat.EndlessOnline.SDK.Protocol.Net.Server;

namespace EOLib.PacketHandlers.Guild
{
[AutoMappedType]

public class GuildTellHandler : InGameOnlyPacketHandler<GuildTellServerPacket>
{
private readonly IGuildSessionRepository _guildSessionRepository;

public override PacketFamily Family => PacketFamily.Guild;

public override PacketAction Action => PacketAction.Tell;

public GuildTellHandler(IPlayerInfoProvider playerInfoProvider,
IGuildSessionRepository guildSessionRepository)
: base(playerInfoProvider)
{
_guildSessionRepository = guildSessionRepository;
}

public override bool HandlePacket(GuildTellServerPacket packet)
{
_guildSessionRepository.GuildMembers = new List<GuildMember>(packet.Members);
return true;
}
}
}
Loading

0 comments on commit 985c8e4

Please sign in to comment.