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

Backend: Cleaner visitor rarity handling #2220

Merged
merged 2 commits into from
Jul 15, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ data class GardenJson(
)

data class GardenVisitor(
@Expose val rarity: LorenzRarity,
@Expose @SerializedName("new_rarity") val newRarity: LorenzRarity?,
@Expose @SerializedName("rarity") private val _rarity: LorenzRarity,
@Expose @SerializedName("new_rarity") private val _newRarity: LorenzRarity?,
@Expose val position: LorenzVec?,
@Expose var skinOrType: String?,
@Expose val mode: String,
@Expose @SerializedName("need_items") val needItems: List<String>,
)
) {
val rarity: LorenzRarity
get() = _newRarity ?: _rarity
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ object GardenVisitorColorNames {
visitorColours.clear()
visitorItems.clear()
for ((visitor, visitorData) in data.visitors) {
val rarity = visitorData.newRarity ?: visitorData.rarity
visitorColours[visitor] = rarity.color.getChatColor()
visitorColours[visitor] = visitorData.rarity.color.getChatColor()
visitorItems[visitor] = visitorData.needItems
}
}
Expand Down
Loading