Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for GP course effects #262

Merged
merged 3 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override void Handle(LoginClient client, IPacket packet)
Id = c.CharacterId,
CourseId = ValidCourse.Value.Id,
NameA = _AssetRepo.GPCourseInfoAsset.Courses[ValidCourse.Value.Id].Name, // Course Name
NameB = "https://members.dd-on.jp/sp_ingame/img/icon/bouken.jpg", // Link to a JPEG
NameB = _AssetRepo.GPCourseInfoAsset.Courses[ValidCourse.Value.Id].IconPath, // Link to a icon
StartTime = ValidCourse.Value.StartTime,
EndTime = ValidCourse.Value.EndTime,
};
Expand Down
13 changes: 6 additions & 7 deletions Arrowgene.Ddon.LoginServer/Handler/GpCourseGetInfoHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@

namespace Arrowgene.Ddon.LoginServer.Handler
{
public class GpCourseGetInfoHandler : StructurePacketHandler<LoginClient, C2LGpCourseGetInfoReq>
public class GpCourseGetInfoHandler : PacketHandler<LoginClient>
{
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(GpCourseGetInfoHandler));

private AssetRepository _AssetRepo;

private L2CGpCourseGetInfoRes _Response;

public GpCourseGetInfoHandler(DdonLoginServer server) : base(server)
{
_AssetRepo = server.AssetRepository;
_Response = new L2CGpCourseGetInfoRes();

foreach (var Course in _AssetRepo.GPCourseInfoAsset.Courses)
foreach (var Course in server.AssetRepository.GPCourseInfoAsset.Courses)
pacampbell marked this conversation as resolved.
Show resolved Hide resolved
{
CDataGPCourseInfo cDataGPCourseInfo = new CDataGPCourseInfo()
{
Expand All @@ -40,7 +37,7 @@ public GpCourseGetInfoHandler(DdonLoginServer server) : base(server)
_Response.CourseInfo.Add(cDataGPCourseInfo);
}

foreach (var Effect in _AssetRepo.GPCourseInfoAsset.Effects)
foreach (var Effect in server.AssetRepository.GPCourseInfoAsset.Effects)
{
CDataGPCourseEffectParam cDataGPCourseEffectParam = new CDataGPCourseEffectParam()
{
Expand All @@ -54,7 +51,9 @@ public GpCourseGetInfoHandler(DdonLoginServer server) : base(server)
}
}

public override void Handle(LoginClient client, StructurePacket<C2LGpCourseGetInfoReq> packet)
public override PacketId Id => PacketId.C2L_GP_COURSE_GET_INFO_REQ;

public override void Handle(LoginClient client, IPacket packet)
{
// client.Send(LoginDump.Dump_22);
client.Send(_Response);
Expand Down
3 changes: 3 additions & 0 deletions Arrowgene.Ddon.Shared/AssetReader/GPCourseInfoDeserializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public GPCourseInfoAsset ReadPath(string path)
obj.PrioritySameTime = Course.GetProperty("priority_same_time").GetUInt32();
obj.AnnounceType = Course.GetProperty("announce_type").GetUInt32();
obj.Comment = Course.GetProperty("comment").GetString();
obj.Url = Course.GetProperty("url").GetString();
obj.IconPath = Course.GetProperty("icon_path").GetString();
obj.Description = Course.GetProperty("description").GetString();

var EffectUIDs = Course.GetProperty("effects").EnumerateArray().ToList();
foreach (var EffectUID in EffectUIDs)
Expand Down

This file was deleted.

75 changes: 63 additions & 12 deletions Arrowgene.Ddon.Shared/Files/Assets/GpCourseInfo.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"comment" : [
"You can find official course effects described at https://web.archive.org/web/20170711035052/https://members.dd-on.jp/shop/payment/course/1",
"",
"It is possible to modify this file to change the course which is available to be used.",
"The 'valid_courses' key, contains a list of all valid courses for every character on the server.",
"The 'course_id' field corresponds to the 'id' field of the objects in the 'courses' key.",
"The 'start_time' and 'end_time' values are in unix timestamp format."
"comment": [
"You can find official course effects described at https://web.archive.org/web/20170711054053/https://members.dd-on.jp/shop/payment/stone/top",
"",
"It is possible to modify this file to change the course which is available to be used.",
"The 'valid_courses' key, contains a list of all valid courses for every character on the server.",
"The 'course_id' field corresponds to the 'id' field of the objects in the 'courses' key.",
"The 'start_time' and 'end_time' values are in unix timestamp format."
],
"valid_courses": [
{
{
"course_id": 17,
"start_time": 1440993600,
"end_time": 4103413199,
Expand All @@ -20,6 +20,9 @@
"id": 1,
"name": "冒険パスポート",
"comment": "Adventure Passport",
"icon_path": "",
"description": "Resurrection power is restored as many times as you like! A set of basic services that make playing DDON useful, such as expanding storage boxes.",
"url": "https://web.archive.org/web/20170711035052/https://members.dd-on.jp/shop/payment/course/1",
"target": 0,
"priority_grp": 100,
"priority_same_time": 70,
Expand All @@ -30,6 +33,9 @@
"id": 2,
"name": "報酬サポートコース",
"comment": "Reward Support Course",
"icon_path": "",
"description": "Rarely small items are available! Acquisition amount of rims and blood orbs, acquisition number of collection/mining/treasure boxes, etc.",
"url": "https://web.archive.org/web/20170711035052/https://members.dd-on.jp/shop/payment/course/2",
"target": 1,
"priority_grp": 100,
"priority_same_time": 40,
Expand All @@ -40,6 +46,9 @@
"id": 3,
"name": "成長サポートコース",
"comment": "Growth Support Course",
"icon_path": "",
"description": "Experience of learners and pawns, a course to help grow learners and pawns that also raise area points!",
"url": "https://web.archive.org/web/20170711035052/https://members.dd-on.jp/shop/payment/course/3",
"target": 1,
"priority_grp": 100,
"priority_same_time": 30,
Expand All @@ -50,6 +59,9 @@
"id": 4,
"name": "安心アシストコース",
"comment": "Reliable Assist Course",
"icon_path": "",
"description": "Reduces damage to learners and pawns, as well as accumulation of abnormal conditions! It reduces the danger of adventure and provides a reassuring life.",
"url": "https://web.archive.org/web/20170711035052/https://members.dd-on.jp/shop/payment/course/4",
"target": 1,
"priority_grp": 100,
"priority_same_time": 50,
Expand All @@ -60,6 +72,9 @@
"id": 5,
"name": "ダブル発動特典",
"comment": "Double Activation Benefit",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 90,
"priority_same_time": 20,
Expand All @@ -70,6 +85,9 @@
"id": 6,
"name": "トリプル発動特典",
"comment": "Triple Activation Benefit",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 80,
"priority_same_time": 10,
Expand All @@ -80,6 +98,9 @@
"id": 7,
"name": "グランドミッションコース",
"comment": "Grand Mission Course",
"icon_path": "",
"description": "Grand Mission Earnings Score and Job Points Up!Cumulative score rewards make it easier to aim for high rank rewards!",
"url": "https://web.archive.org/web/20170711035052/https://members.dd-on.jp/shop/payment/course/7",
"target": 0,
"priority_grp": 200,
"priority_same_time": 100,
Expand All @@ -90,6 +111,9 @@
"id": 8,
"name": "ネットカフェ特典コース",
"comment": "Internet Cafe Special Course",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 50,
"priority_same_time": 0,
Expand All @@ -100,6 +124,9 @@
"id": 9,
"name": "格納チェストパスポート1",
"comment": "Storage Chest Passport 1",
"icon_path": "",
"description": "Store 400 additional items!A passport that makes playing DDON even more convenient!",
"url": "https://web.archive.org/web/20170711035052/https://members.dd-on.jp/shop/payment/course/9",
"target": 0,
"priority_grp": 100,
"priority_same_time": 80,
Expand All @@ -110,6 +137,9 @@
"id": 10,
"name": "討伐経験値5倍コース",
"comment": "Subjugation Experience Value 5x Course",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 100,
"priority_same_time": 25,
Expand All @@ -120,6 +150,9 @@
"id": 11,
"name": "格納チェストパスポート2",
"comment": "Storage Chest Passport 2",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 100,
"priority_same_time": 85,
Expand All @@ -130,6 +163,9 @@
"id": 12,
"name": "格納チェストパスポート3",
"comment": "Storage Chest Passport 3",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 100,
"priority_same_time": 90,
Expand All @@ -140,6 +176,9 @@
"id": 13,
"name": "PP獲得量3倍コース",
"comment": "3x PP Acquisition Course",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 100,
"priority_same_time": 24,
Expand All @@ -150,6 +189,9 @@
"id": 14,
"name": "PP獲得量5倍コース",
"comment": "5x PP Acquisition Course",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 100,
"priority_same_time": 23,
Expand All @@ -160,6 +202,9 @@
"id": 15,
"name": "全コース無料開放",
"comment": "All courses free of charge",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 20,
"priority_same_time": 0,
Expand All @@ -170,21 +215,27 @@
"id": 16,
"name": "PP獲得量5倍コースⅡ",
"comment": "5x PP Acquisition Course II",
"icon_path": "",
"description": "",
"url": "",
"target": 0,
"priority_grp": 100,
"priority_same_time": 22,
"announce_type": 3,
"effects": [ 261, 262 ]
},
{
{
"id": 17,
"name": "Arrowgene QOL Course",
"comment": "Example of custom made course effect. Allows item boxes to be used outside the main city, enable expanded storage tabs and allows craft items to be consumed from the storage box.",
"comment": "Example of custom made course effect.",
"icon_path": "",
"description": "Allows item boxes to be used outside the main city, enable expanded storage tabs and allows craft items to be consumed from the storage box.",
"url": "",
"target": 0,
"priority_grp": 100,
"priority_same_time": 70,
"announce_type": 2,
"effects": [ 2, 3, 69, 216, 217, 128]
"effects": [ 2, 3, 69, 216, 217, 128 ]
}
],
"effects": [
Expand Down Expand Up @@ -487,7 +538,7 @@
"id": 50,
"param0": 0,
"param1": 0,
"comment": ""
"comment": "Materials stored in storage chests can be used for crafting!"
},
{
"uid": 149,
Expand Down
6 changes: 4 additions & 2 deletions Arrowgene.Ddon.Shared/Model/GPCourse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ public GPCourse()

public uint Id { get; set; }
public string Name { get; set; }
public string Comment { get; set; }
public string Description { get; set; }
public string Url { get; set; }
public string IconPath { get; set; }
public bool Target { get; set; }
public uint PriorityGroup { get; set; }
public uint PrioritySameTime { get; set; }
public uint AnnounceType { get; set; }
public List<uint> Effects { get; set; }

public string Comment { get; set; }
}
}
Loading