Skip to content

Commit

Permalink
Merge pull request #3 from Andoryuuta/login-server-patches-2
Browse files Browse the repository at this point in the history
Implement L2C_GET_LOGIN_SETTINGS_RES serializer & char creation fix
  • Loading branch information
sebastian-heinz authored Jan 10, 2022
2 parents c4ede5e + d0a596f commit d8339cb
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 3 deletions.
12 changes: 11 additions & 1 deletion Arrowgene.Ddon.LoginServer/Handler/CreateCharacterHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@ public override void Handle(LoginClient client, Packet packet)
IBuffer buffer = new StreamBuffer();
buffer.WriteInt32(0, Endianness.Big); // error
buffer.WriteInt32(0, Endianness.Big); // result
buffer.WriteInt32(0, Endianness.Big); // WaitNum
buffer.WriteInt32(0, Endianness.Big); // WaitNum -- How many people you are waiting for until your character registers
client.Send(new Packet(PacketId.L2C_CREATE_CHARACTER_DATA_RES, buffer.GetAllBytes(), PacketSource.Server));


// Sent to client once the player queue "WaitNum" above is 0,
// send immediately in our case.
IBuffer buffer2 = new StreamBuffer();
buffer2.WriteInt32(0, Endianness.Big); // error
buffer2.WriteInt32(0, Endianness.Big); // result
Packet response2 = new Packet(PacketId.L2C_CREATE_CHARACTER_DATA_NTC, buffer2.GetAllBytes(), PacketSource.Server);
client.Send(response2);

}
}
}
51 changes: 49 additions & 2 deletions Arrowgene.Ddon.LoginServer/Handler/GetLoginSettingHandler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
using Arrowgene.Ddon.LoginServer.Dump;
using Arrowgene.Buffers;
using Arrowgene.Ddon.LoginServer.Dump;
using Arrowgene.Ddon.Server.Logging;
using Arrowgene.Ddon.Server.Network;
using Arrowgene.Ddon.Shared.Entity;
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Entity.Structure;
using Arrowgene.Logging;
using System.Collections.Generic;

namespace Arrowgene.Ddon.LoginServer.Handler
{
Expand All @@ -18,7 +23,49 @@ public GetLoginSettingHandler(DdonLoginServer server) : base(server)

public override void Handle(LoginClient client, Packet packet)
{
client.Send(LoginDump.Dump_20);
IBuffer buffer = new StreamBuffer();
buffer.WriteInt32(0, Endianness.Big); // error
buffer.WriteInt32(0, Endianness.Big); // result

L2CGetLoginSettingsRes entity = new L2CGetLoginSettingsRes
{
LoginSetting = {
JobLevelMax = 65,
ClanMemberMax = 100,
CharacterNumMax = 4,
EnableVisualEquip = true,
FriendListMax = 200,
URLInfoList = new List<CDataURLInfo>()
{
new CDataURLInfo {Type = 1, URL = "https://members.dd-on.jp/manual_nfb/"},
new CDataURLInfo {Type = 2, URL = "https://members.dd-on.jp/shop/ingame/stone/detail"},
new CDataURLInfo {Type = 3, URL = "https://members.dd-on.jp/shop/ingame/counter?"},
new CDataURLInfo {Type = 4, URL = "https://members.dd-on.jp/shop/ingame/attention?"},
new CDataURLInfo {Type = 5, URL = "https://members.dd-on.jp/shop/ingame/stone/limit"},
new CDataURLInfo {Type = 6, URL = "https://members.dd-on.jp/shop/ingame/counter?"},
new CDataURLInfo {Type = 7, URL = "https://startup-server.dd-on.jp/opening/entry/ddo/cog_callback/capcharge"},
new CDataURLInfo {Type = 8, URL = "https://members.dd-on.jp/sp_ingame/capcharge/"},
new CDataURLInfo {Type = 9, URL = "http://sample09.html"},
new CDataURLInfo {Type = 10, URL = "http://sample10.html"},
new CDataURLInfo {Type = 11, URL = "http://members.dd-on.jp/sp_ingame/campaign/bnr/bnr01.html?"},
new CDataURLInfo {Type = 12, URL = "https://members.dd-on.jp/sp_ingame/support/index.html"},
new CDataURLInfo {Type = 13, URL = "https://members.dd-on.jp/api/photoup/authorize"},
new CDataURLInfo {Type = 14, URL = "http://frontapi.caplink.jp"},
new CDataURLInfo {Type = 15, URL = "https://frontapi.caplink.jp"},
new CDataURLInfo {Type = 16, URL = "https://members.dd-on.jp/sp_ingame/caplink/index.html"},
new CDataURLInfo {Type = 17, URL = "https://members.dd-on.jp/sp_ingame/campaign/bnr/slide.html"},
new CDataURLInfo {Type = 19, URL = "https://members.dd-on.jp/sp_ingame/capcharge/"},
new CDataURLInfo {Type = 20, URL = "https://companion-img.dd-on.jp/"},
},
NoOperationTimeOutTime = 14400,
},
};
EntitySerializer.Get<L2CGetLoginSettingsRes>().Write(buffer, entity);

Packet response = new Packet(PacketId.L2C_GET_LOGIN_SETTING_RES, buffer.GetAllBytes(), PacketSource.Server);
client.Send(response);

//client.Send(LoginDump.Dump_20);
}
}
}
1 change: 1 addition & 0 deletions Arrowgene.Ddon.Server/Network/PacketId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public override int GetHashCode()
public static readonly PacketId L2C_GET_CHARACTER_LIST_RES = new PacketId(5, 0, 2, "L2C_GET_CHARACTER_LIST_RES");
public static readonly PacketId C2L_CREATE_CHARACTER_DATA_REQ = new PacketId(5, 3, 1, "C2L_CREATE_CHARACTER_DATA_REQ");
public static readonly PacketId L2C_CREATE_CHARACTER_DATA_RES = new PacketId(5, 3, 2, "L2C_CREATE_CHARACTER_DATA_RES");
public static readonly PacketId L2C_CREATE_CHARACTER_DATA_NTC = new PacketId(5, 3, 16, "L2C_CREATE_CHARACTER_DATA_NTC");

public static readonly PacketId C2L_DELETE_CHARACTER_INFO_REQ = new PacketId(5, 4, 1, "C2L_DELETE_CHARACTER_INFO_REQ");
public static readonly PacketId L2C_DELETE_CHARACTER_INFO_RES = new PacketId(5, 4, 2, "L2C_DELETE_CHARACTER_INFO_RES");
Expand Down
3 changes: 3 additions & 0 deletions Arrowgene.Ddon.Shared/Entity/EntitySerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,21 @@ public abstract class EntitySerializer
Create(new CDataEquipJobItemSerializer()),
Create(new CDataGPCourseValidSerializer()),
Create(new CDataJobPlayPointSerializer()),
Create(new CDataLoginSettingSerializer()),
Create(new CDataMatchingProfileSerializer()),
Create(new CDataOrbCategoryStatusSerializer()),
Create(new CDataOrbPageStatusSerializer()),
Create(new CDataPlayPointDataSerializer()),
Create(new CDataShortCutSerializer()),
Create(new CDataStatusInfoSerializer()),
Create(new CDataURLInfoSerializer()),
Create(new DoubleByteThingSerializer()),
Create(new UnkownCharacterData0Serializer()),
Create(new UnkownCharacterData1Serializer()),

// Packet structure serializers
Create(new C2LCreateCharacterDataReqSerializer()),
Create(new L2CGetLoginSettingsResSerializer()),
}
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Arrowgene.Buffers;
using Arrowgene.Ddon.Shared.Entity.Structure;
using System.Collections.Generic;

namespace Arrowgene.Ddon.Shared.Entity.PacketStructure
{
public class L2CGetLoginSettingsRes
{
public L2CGetLoginSettingsRes()
{
LoginSetting = new CDataLoginSetting();
}

public CDataLoginSetting LoginSetting;
}

public class L2CGetLoginSettingsResSerializer : EntitySerializer<L2CGetLoginSettingsRes>
{
public override void Write(IBuffer buffer, L2CGetLoginSettingsRes obj)
{
WriteEntity(buffer, obj.LoginSetting);
}

public override L2CGetLoginSettingsRes Read(IBuffer buffer)
{
L2CGetLoginSettingsRes obj = new L2CGetLoginSettingsRes();
obj.LoginSetting = ReadEntity<CDataLoginSetting>(buffer);
return obj;
}
}
}
55 changes: 55 additions & 0 deletions Arrowgene.Ddon.Shared/Entity/Structure/CDataLoginSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Arrowgene.Buffers;
using System.Collections.Generic;

namespace Arrowgene.Ddon.Shared.Entity.Structure
{
public class CDataLoginSetting
{
public CDataLoginSetting()
{
JobLevelMax = 0;
ClanMemberMax = 0;
EnableVisualEquip = false;
FriendListMax = 0;
URLInfoList = new List<CDataURLInfo>();
NoOperationTimeOutTime = 0;
}

public uint JobLevelMax;
public uint ClanMemberMax;
public byte CharacterNumMax;
public bool EnableVisualEquip;
public uint FriendListMax;
public List<CDataURLInfo> URLInfoList;
public uint NoOperationTimeOutTime;
}

public class CDataLoginSettingSerializer : EntitySerializer<CDataLoginSetting>
{
public override void Write(IBuffer buffer, CDataLoginSetting obj)
{
WriteUInt32(buffer, obj.JobLevelMax);
WriteUInt32(buffer, obj.ClanMemberMax);
WriteByte(buffer, obj.CharacterNumMax);
WriteBool(buffer, obj.EnableVisualEquip);
WriteUInt32(buffer, obj.FriendListMax);
WriteEntityList(buffer, obj.URLInfoList);
WriteUInt32(buffer, obj.NoOperationTimeOutTime);
}

public override CDataLoginSetting Read(IBuffer buffer)
{
CDataLoginSetting obj = new CDataLoginSetting();
obj.JobLevelMax = ReadUInt32(buffer);
obj.ClanMemberMax = ReadUInt32(buffer);
obj.CharacterNumMax = ReadByte(buffer);
obj.EnableVisualEquip = ReadBool(buffer);
obj.FriendListMax = ReadUInt32(buffer);
obj.URLInfoList = ReadEntityList<CDataURLInfo>(buffer);
obj.NoOperationTimeOutTime = ReadUInt32(buffer);
return obj;
}
}
}


33 changes: 33 additions & 0 deletions Arrowgene.Ddon.Shared/Entity/Structure/CDataURLInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Arrowgene.Buffers;

namespace Arrowgene.Ddon.Shared.Entity.Structure
{
public class CDataURLInfo
{
public CDataURLInfo()
{
Type = 0;
URL = "";
}

public uint Type;
public string URL;
}

public class CDataURLInfoSerializer : EntitySerializer<CDataURLInfo>
{
public override void Write(IBuffer buffer, CDataURLInfo obj)
{
WriteUInt32(buffer, obj.Type);
WriteMtString(buffer, obj.URL);
}

public override CDataURLInfo Read(IBuffer buffer)
{
CDataURLInfo obj = new CDataURLInfo();
obj.Type = ReadUInt32(buffer);
obj.URL = ReadMtString(buffer);
return obj;
}
}
}

0 comments on commit d8339cb

Please sign in to comment.