Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Shopping List #3281

Open
wants to merge 86 commits into
base: beta
Choose a base branch
from

Conversation

rueblimaster
Copy link
Contributor

@rueblimaster rueblimaster commented Jan 24, 2025

What

Adds a general shopping list, can be added to by other features etc. also can break down items into their recipes

TODO: add technical details, screenshots

Images

Changelog New Features

  • Added shopping list. - rueblimaster
    • TODO: Extra info.

@rueblimaster rueblimaster marked this pull request as draft January 24, 2025 09:38
@github-actions github-actions bot added the Detekt Has detekt problem label Jan 24, 2025
Copy link

One or more Detekt Failures were detected:

Copy link

One or more Detekt Failures were detected:

Copy link

One or more Detekt Failures were detected:

Copy link

One or more Detekt Failures were detected:

@github-actions github-actions bot added the Merge Conflicts There are open merge conflicts with the beta branch. label Jan 25, 2025
Copy link

This pull request has conflicts with the base branch "beta". Please resolve those so we can test out your changes.

@github-actions github-actions bot removed the Merge Conflicts There are open merge conflicts with the beta branch. label Jan 26, 2025
Copy link

Conflicts have been resolved! 🎉

Copy link

One or more Detekt Failures were detected:

Copy link

One or more Detekt Failures were detected:

Copy link

One or more Detekt Failures were detected:

Copy link

One or more Detekt Failures were detected:

@rueblimaster rueblimaster marked this pull request as ready for review February 28, 2025 21:10
@rueblimaster
Copy link
Contributor Author

oh shit, now I gotta do detekt

@hannibal002 hannibal002 added this to the 3.0.0 milestone Mar 1, 2025
@rueblimaster
Copy link
Contributor Author

why doesn't this pass the checks???

Copy link

github-actions bot commented Mar 2, 2025

12 Detekt Failures were detected:

  • ShoppingListCategory.kt#L62: Name shadowed: item
  • Renderable.kt#L285: Name shadowed: onAnyClick
  • Renderable.kt#L300: Name shadowed: implicit lambda parameter 'it'
  • ShoppingList.kt#L437: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L444: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L444: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L447: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L447: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingListCategory.kt#L27: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingListItem.kt#L68: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L223: Variable 'lore' could be val.
  • ShoppingListCategory.kt#L62: Variable 'item' could be val.

Copy link

github-actions bot commented Mar 2, 2025

12 Detekt Failures were detected:

  • ShoppingListCategory.kt#L62: Name shadowed: item
  • Renderable.kt#L267: Name shadowed: onAnyClick
  • Renderable.kt#L282: Name shadowed: implicit lambda parameter 'it'
  • ShoppingList.kt#L437: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L444: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L444: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L447: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L447: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingListCategory.kt#L27: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingListItem.kt#L68: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L223: Variable 'lore' could be val.
  • ShoppingListCategory.kt#L62: Variable 'item' could be val.

Copy link

github-actions bot commented Mar 2, 2025

8 Detekt Failures were detected:

  • ShoppingListCategory.kt#L26: Missing spacing before "?:"
  • ShoppingList.kt#L437: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L444: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L444: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L447: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L447: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingListItem.kt#L68: Calling !! on a nullable type will throw a NullPointerException at runtime in case the value is null. It should be avoided.
  • ShoppingList.kt#L223: Variable 'lore' could be val.

@github-actions github-actions bot removed the Detekt Has detekt problem label Mar 2, 2025
@rueblimaster
Copy link
Contributor Author

yay!

@@ -351,6 +351,7 @@ object SackApi {
sackListNames = uniqueSackItems.map { it.itemNameWithoutColor.removeNonAscii().trim().uppercase() }.toSet()
}

// TODO: also update sacks when items are added/removed from sack, not only on summary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably remove TODOs if you aren't intending on doing it, and commented code that you don't intend on uncommenting


import com.google.gson.annotations.Expose

class CategoryTemplate {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not gonna suggest the change on each of them individually, as there are a lot, but do not define explicit constructor()s for Kotlin classes where it isn't necessary to.

Suggested change
class CategoryTemplate {
class CategoryTemplate(
@Expose val name: String,
@Expose val color: Char = '6',
@Expose val hidden: Boolean = false,
@Expose val items: List<ItemTemplate> = emptyList(),
) {


import com.google.gson.annotations.Expose

class ItemTemplate {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove explicit constructor

import at.hannibal2.skyhanni.utils.PrimitiveRecipe
import com.google.gson.annotations.Expose

class RecipeTemplate {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove explicit constructor

}
}

@HandleEvent(onlyOnSkyblock = true, priority = HandleEvent.HIGH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem this has a purpose to be high priority.


clear()

add("aspect of the end".toInternalName(), 2.0, "Weapons")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?

}

// maybe name it removeCommand ???
fun remove(name: String, amount: Double? = null, categoryName: String? = null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is 3-4 nested if statements - refactor it into some helper functions if necessary, but this ain't it


fun get(item: NeuInternalName) = allItems[item]
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.toSearchable()

val items = items

allItems.clear()
for (category in categories + items) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define some vals here instead of nestedly looping, especially using similar names, it gets unreadable quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants