Skip to content

Commit

Permalink
Merge pull request #108 from alborrajo/feature/equiphide
Browse files Browse the repository at this point in the history
Hide equipped lantern/head armor
  • Loading branch information
alborrajo authored Oct 11, 2022
2 parents 53c3fd7 + fd473a9 commit f934eeb
Show file tree
Hide file tree
Showing 22 changed files with 1,005 additions and 62 deletions.
5 changes: 5 additions & 0 deletions Arrowgene.Ddon.GameServer/DdonGameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ private void LoadPacketHandler()
AddHandler(new ContextGetSetContextHandler(this));
AddHandler(new ContextSetContextHandler(this));
AddHandler(new DailyMissionListGetHandler(this));

AddHandler(new EquipGetCharacterEquipListHandler(this));
AddHandler(new EquipUpdateHideCharacterHeadArmorHandler(this));
AddHandler(new EquipUpdateHideCharacterLanternHandler(this));
AddHandler(new EquipUpdateHidePawnHeadArmorHandler(this));
AddHandler(new EquipUpdateHidePawnLanternHandler(this));

AddHandler(new FriendGetFriendListHandler(this));
AddHandler(new FriendGetRecentCharacterListHandler(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ public CharacterDecideCharacterIdHandler(DdonGameServer server) : base(server)
public override PacketId Id => PacketId.C2S_CHARACTER_DECIDE_CHARACTER_ID_REQ;

public override void Handle(GameClient client, IPacket packet)
{
S2CCharacterDecideCharacterIdRes res = EntitySerializer.Get<S2CCharacterDecideCharacterIdRes>().Read(GameDump.data_Dump_13);
{
S2CCharacterDecideCharacterIdRes pcap = EntitySerializer.Get<S2CCharacterDecideCharacterIdRes>().Read(GameDump.data_Dump_13);
S2CCharacterDecideCharacterIdRes res = new S2CCharacterDecideCharacterIdRes();
res.CharacterId = client.Character.Id;
res.CharacterInfo = new CDataCharacterInfo(client.Character);
res.CharacterInfo.UnkCharData1 = new List<UnknownCharacterData1>()
res.CharacterInfo.CharacterItemSlotInfoList = new List<CDataCharacterItemSlotInfo>()
{
new CDataCharacterItemSlotInfo()
{
StorageType = 1, // Item Bag (Consumable) STORAGE_TYPE_BAG_USE
SlotMax = 20
}
};
res.CharacterInfo.WalletPointList = new List<CDataWalletPoint>()
{
// TODO: Figure out what other currencies there are.
// Pcap currencies:
Expand All @@ -44,12 +53,14 @@ public override void Handle(GameClient client, IPacket packet)
// 14 2
// 15 115
// 16 105
new UnknownCharacterData1()
new CDataWalletPoint()
{
u0 = 2, // RP
u1 = 42069
Type = 2, // RP
Value = 42069
}
};
res.Unk0 = pcap.Unk0; // Commenting this makes tons of tutorials pop up

client.Send(res);

// Unlocks menu options such as inventory, warping, etc.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Arrowgene.Ddon.Server;
using Arrowgene.Ddon.Server.Network;
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Network;
using Arrowgene.Logging;

namespace Arrowgene.Ddon.GameServer.Handler
{
public class EquipUpdateHideCharacterHeadArmorHandler : StructurePacketHandler<GameClient, C2SEquipUpdateHideCharacterHeadArmorReq>
{
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(EquipUpdateHideCharacterHeadArmorHandler));

public EquipUpdateHideCharacterHeadArmorHandler(DdonGameServer server) : base(server)
{
}

public override void Handle(GameClient client, StructurePacket<C2SEquipUpdateHideCharacterHeadArmorReq> packet)
{
client.Character.HideEquipHead = packet.Structure.Hide;
Database.UpdateCharacterBaseInfo(client.Character);
client.Send(new S2CEquipUpdateHideCharacterHeadArmorRes()
{
Hide = packet.Structure.Hide
});

S2CEquipUpdateEquipHideNtc ntc = new S2CEquipUpdateEquipHideNtc()
{
CharacterId = client.Character.Id,
HideHead = client.Character.HideEquipHead,
HideLantern = client.Character.HideEquipLantern,
HidePawnHead = client.Character.HideEquipHeadPawn,
HidePawnLantern = client.Character.HideEquipLanternPawn
};
foreach(Client otherClient in Server.ClientLookup.GetAll())
{
otherClient.Send(ntc);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Arrowgene.Ddon.Server;
using Arrowgene.Ddon.Server.Network;
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Network;
using Arrowgene.Logging;

namespace Arrowgene.Ddon.GameServer.Handler
{
public class EquipUpdateHideCharacterLanternHandler : StructurePacketHandler<GameClient, C2SEquipUpdateHideCharacterLanternReq>
{
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(EquipUpdateHideCharacterLanternHandler));

public EquipUpdateHideCharacterLanternHandler(DdonGameServer server) : base(server)
{
}

public override void Handle(GameClient client, StructurePacket<C2SEquipUpdateHideCharacterLanternReq> packet)
{
client.Character.HideEquipLantern = packet.Structure.Hide;
Database.UpdateCharacterBaseInfo(client.Character);
client.Send(new S2CEquipUpdateHideCharacterLanternRes()
{
Hide = packet.Structure.Hide
});

S2CEquipUpdateEquipHideNtc ntc = new S2CEquipUpdateEquipHideNtc()
{
CharacterId = client.Character.Id,
HideHead = client.Character.HideEquipHead,
HideLantern = client.Character.HideEquipLantern,
HidePawnHead = client.Character.HideEquipHeadPawn,
HidePawnLantern = client.Character.HideEquipLanternPawn
};
foreach(Client otherClient in Server.ClientLookup.GetAll())
{
otherClient.Send(ntc);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Arrowgene.Ddon.Server;
using Arrowgene.Ddon.Server.Network;
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Network;
using Arrowgene.Logging;

namespace Arrowgene.Ddon.GameServer.Handler
{
public class EquipUpdateHidePawnHeadArmorHandler : StructurePacketHandler<GameClient, C2SEquipUpdateHidePawnHeadArmorReq>
{
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(EquipUpdateHidePawnHeadArmorHandler));

public EquipUpdateHidePawnHeadArmorHandler(DdonGameServer server) : base(server)
{
}

public override void Handle(GameClient client, StructurePacket<C2SEquipUpdateHidePawnHeadArmorReq> packet)
{
client.Character.HideEquipHeadPawn = packet.Structure.Hide;
Database.UpdateCharacterBaseInfo(client.Character);
client.Send(new S2CEquipUpdateHidePawnHeadArmorRes()
{
Hide = packet.Structure.Hide
});

S2CEquipUpdateEquipHideNtc ntc = new S2CEquipUpdateEquipHideNtc()
{
CharacterId = client.Character.Id,
HideHead = client.Character.HideEquipHead,
HideLantern = client.Character.HideEquipLantern,
HidePawnHead = client.Character.HideEquipHeadPawn,
HidePawnLantern = client.Character.HideEquipLanternPawn
};
foreach(Client otherClient in Server.ClientLookup.GetAll())
{
otherClient.Send(ntc);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Arrowgene.Ddon.Server;
using Arrowgene.Ddon.Server.Network;
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Network;
using Arrowgene.Logging;

namespace Arrowgene.Ddon.GameServer.Handler
{
public class EquipUpdateHidePawnLanternHandler : StructurePacketHandler<GameClient, C2SEquipUpdateHidePawnLanternReq>
{
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(EquipUpdateHidePawnLanternHandler));

public EquipUpdateHidePawnLanternHandler(DdonGameServer server) : base(server)
{
}

public override void Handle(GameClient client, StructurePacket<C2SEquipUpdateHidePawnLanternReq> packet)
{
client.Character.HideEquipLanternPawn= packet.Structure.Hide;
Database.UpdateCharacterBaseInfo(client.Character);
client.Send(new S2CEquipUpdateHidePawnLanternRes()
{
Hide = packet.Structure.Hide
});

S2CEquipUpdateEquipHideNtc ntc = new S2CEquipUpdateEquipHideNtc()
{
CharacterId = client.Character.Id,
HideHead = client.Character.HideEquipHead,
HideLantern = client.Character.HideEquipLantern,
HidePawnHead = client.Character.HideEquipHeadPawn,
HidePawnLantern = client.Character.HideEquipLanternPawn
};
foreach(Client otherClient in Server.ClientLookup.GetAll())
{
otherClient.Send(ntc);
}
}
}
}
Loading

0 comments on commit f934eeb

Please sign in to comment.