Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
21 changes: 3 additions & 18 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
#
# Copyright 2026 Lambda
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
38 changes: 18 additions & 20 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 14 additions & 24 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/main/kotlin/com/lambda/Lambda.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ import tools.jackson.module.kotlin.jsonMapper
import tools.jackson.module.kotlin.kotlinModule

object Lambda : ClientModInitializer {
const val MOD_NAME = "Lambda"
const val MOD_ID = "lambda"
const val SYMBOL = "λ"
const val MOD_NAME = "Comet"
const val MOD_ID = "comet"
const val SYMBOL = ""
const val APP_ID = "1221289599427416127"
const val REPO_URL = "https://github.com/lambda-client/lambda"
val VERSION: String =
Expand Down
104 changes: 92 additions & 12 deletions src/main/kotlin/com/lambda/module/hud/ModuleList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,118 @@
package com.lambda.module.hud

import com.lambda.gui.dsl.ImGuiBuilder
import com.lambda.imgui.ImColor
import com.lambda.imgui.ImGui
import com.lambda.imgui.flag.ImGuiCol
import com.lambda.module.HudModule
import com.lambda.module.ModuleRegistry
import com.lambda.module.tag.ModuleTag
import com.lambda.util.NamedEnum
import java.awt.Color

@Suppress("unused")
object ModuleList : HudModule(
name = "ModuleList",
tag = ModuleTag.HUD,
) {
val onlyBound by setting("Only Bound", false, "Only displays modules with a keybind")
val showKeybind by setting("Show Keybind", true, "Display keybind next to a module")
private val onlyBound by setting("Only Bound", false, "Only displays modules with a keybind")
private val showKeybind by setting("Show Keybind", true, "Display keybind next to a module")
private val textColor by setting(
"Text Color",
Color(80, 210, 255),
"Module name color"
)
private val alignment by setting("Alignment", Alignment.Left, "Align shorter names to the left or right")
private val sortOrder by setting("Sort Order", SortOrder.LengthLongToShort, "Order the module list")
private val boundKeybindColor by setting(
"Bound Keybind Color",
Color(90, 255, 120),
"Color for modules with a keybind",
visibility = { showKeybind }
)
private val unboundKeybindColor by setting(
"Unbound Keybind Color",
Color(255, 80, 80),
"Color for modules without a keybind",
visibility = { showKeybind && !onlyBound }
)

init {
drawSetting.value = false
}

override fun ImGuiBuilder.buildLayout() {
val enabled = ModuleRegistry.modules.filter { it.isEnabled && it.draw }
val rows = ModuleRegistry.modules
.asSequence()
.filter { it.isEnabled && it.draw }
.mapNotNull {
val bound = it.keybind.key != 0 || it.keybind.mouse != -1
if (onlyBound && !bound) return@mapNotNull null

enabled.forEach {
val bound = it.keybind.key != 0 || it.keybind.mouse != -1
if (onlyBound && !bound) return@forEach
text(it.name)
val keybindText = if (showKeybind) " [${it.keybind.name}]" else ""
val fullText = it.name + keybindText

if (showKeybind) {
val color = if (!bound) Color.RED else Color.GREEN
ModuleRow(
name = it.name,
keybindText = keybindText,
bound = bound,
width = ImGui.calcTextSize(fullText).x
)
}
.toList()
.sorted()

sameLine()
withStyleColor(ImGuiCol.Text, color) { text(" [${it.keybind.name}]") }
}
val maxWidth = rows.maxOfOrNull { it.width } ?: return
val lineStartX = cursorPosX

rows.forEach { row ->
cursorPosX = when (alignment) {
Alignment.Left -> lineStartX
Alignment.Right -> lineStartX + maxWidth - row.width
}

withStyleColor(ImGuiCol.Text, textColor.toImColor()) {
text(row.name)
}

if (row.keybindText.isNotEmpty()) {
val keybindColor = if (row.bound) boundKeybindColor else unboundKeybindColor
sameLine(0f, 0f)
withStyleColor(ImGuiCol.Text, keybindColor.toImColor()) {
text(row.keybindText)
}
}
}
}

private fun List<ModuleRow>.sorted() =
when (sortOrder) {
SortOrder.Default -> this
SortOrder.LengthLongToShort -> sortedByDescending { it.width }
SortOrder.LengthShortToLong -> sortedBy { it.width }
SortOrder.NameAToZ -> sortedBy { it.name.lowercase() }
SortOrder.NameZToA -> sortedByDescending { it.name.lowercase() }
}

private fun Color.toImColor() = ImColor.rgba(red, green, blue, alpha)

private data class ModuleRow(
val name: String,
val keybindText: String,
val bound: Boolean,
val width: Float,
)

private enum class Alignment(override val displayName: String) : NamedEnum {
Left("Left"),
Right("Right")
}

private enum class SortOrder(override val displayName: String) : NamedEnum {
Default("Default"),
LengthLongToShort("Length: Long to Short"),
LengthShortToLong("Length: Short to Long"),
NameAToZ("Name: A to Z"),
NameZToA("Name: Z to A")
}
}
Loading