auto add girl to room & favor to lvl 500

This commit is contained in:
Naruse
2026-05-11 19:16:19 +08:00
parent e4397f10ee
commit 0cf633a0e1
3 changed files with 29 additions and 0 deletions

View File

@@ -12,9 +12,15 @@ public class GirlRegister : IHouseFuncHandler
if (root == null) return;
var girlId = HouseJson.NumField(root, "GirlId");
var floorId = HouseJson.NumField(root, "FloorId");
var sync = new NtfSyncPlayer();
if (girlId > 0)
{
var bedroomSid = HouseAttr.GetNextBedroomSid(connection.Player!, (uint)floorId);
await HouseAttr.SetAsync(connection, HouseAttr.GirlRoomNumSid(girlId), HouseAttr.BedroomRegisteredNoRoom, sync);
if (bedroomSid != 0) await HouseAttr.SetAsync(connection, bedroomSid, (uint)girlId, sync);
}
await CallGSRouter.SendScript(connection, "House_Request", HouseRequestScript.Synthesize(root), sync);
}

View File

@@ -105,6 +105,7 @@ internal static class HouseAttr
internal const uint BedroomStartSid = 2550;
internal const uint BedroomRegisteredNoRoom = 100;
internal const uint PlayerRingInfoSidBase = 3174;
internal const uint BedroomPerFloor = 8;
internal static uint Read(PlayerInstance player, uint sid)
{
@@ -175,6 +176,25 @@ internal static class HouseAttr
}
}
internal static uint GetNextBedroomSid(PlayerInstance player, uint floorId)
{
var floorStartSid = BedroomStartSid + ((floorId - 2) * BedroomPerFloor) + 1;
for (uint i = 0; i < BedroomPerFloor; i++)
{
var sid = floorStartSid + i;
var exists = player.Data.Attrs.Any(x =>
x.Gid == Gid &&
x.Sid == sid);
if (!exists)
return sid;
}
return 0;
}
internal static uint PackArcadePropUse(int type, int id, ushort count) =>
(((uint)count & 0xffffu) << 16) | (((uint)id & 0xffu) << 8) | ((uint)type & 0xffu);
}