using ServerCommon; using ServerCore; using ServerBase; using static ClientToGameMessage.Types; namespace GameServer { internal static class OwnedBuildingNotifyHelper { public static bool send_S2C_NTF_OWNED_BUILDING_INFOS(this Player player) { var owned_building_agent_action = player.getEntityAction(); ArgumentNullException.ThrowIfNull(owned_building_agent_action, $"building_agent_action is null !!!"); var ntf_packet = new ClientToGame(); ntf_packet.Message = new ClientToGameMessage(); ntf_packet.Message.NtfOwnedBuildingInfos = new GS2C_NTF_OWNED_BUILDING_INFOS(); var owned_buildings = owned_building_agent_action.getOwnedBuildings(); foreach (var owned_building in owned_buildings) { var owned_building_attribute = owned_building.getEntityAttribute(); NullReferenceCheckHelper.throwIfNull(owned_building_attribute, () => $"owned_building_attribute is null !!! - {player.toBasicString()}"); ntf_packet.Message.NtfOwnedBuildingInfos.OwnedBuildingInfos.Add((int)owned_building_attribute.BuildingMetaId); } if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet)) { return false; } return true; } public static bool send_S2C_NTF_OWNED_BUILDING_INFOS(this Player player, OwnedBuilding ownedBuilding) { var owned_building_attribute = ownedBuilding.getEntityAttribute(); NullReferenceCheckHelper.throwIfNull(owned_building_attribute, () => $"owned_building_attribute is null !!! - {player.toBasicString()}"); var ntf_packet = new ClientToGame(); ntf_packet.Message = new ClientToGameMessage(); ntf_packet.Message.NtfOwnedBuildingInfos = new GS2C_NTF_OWNED_BUILDING_INFOS(); ntf_packet.Message.NtfOwnedBuildingInfos.OwnedBuildingInfos.Add((int)owned_building_attribute.BuildingMetaId); if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet)) { return false; } return true; } } }