From 009c6cca93f0b8ee3dbc81a2929867c673d96f4f Mon Sep 17 00:00:00 2001
From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>
Date: Fri, 26 May 2023 14:21:04 +0200
Subject: Graph v2 (#680)
---
.../commands/dev/DevTestCommand.kt | 5 +-
.../miscgui/pricegraph/GraphDataProvider.kt | 27 +
.../miscgui/pricegraph/GuiPriceGraph.kt | 596 +++++++++++++++++++++
.../miscgui/pricegraph/LocalGraphDataProvider.kt | 192 +++++++
.../miscgui/pricegraph/PriceObject.kt | 24 +
.../miscgui/pricegraph/ServerGraphDataProvider.kt | 42 ++
.../notenoughupdates/util/KotlinNumberUtils.kt | 28 +
7 files changed, 912 insertions(+), 2 deletions(-)
create mode 100644 src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/pricegraph/GraphDataProvider.kt
create mode 100644 src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/pricegraph/GuiPriceGraph.kt
create mode 100644 src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/pricegraph/LocalGraphDataProvider.kt
create mode 100644 src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/pricegraph/PriceObject.kt
create mode 100644 src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/pricegraph/ServerGraphDataProvider.kt
create mode 100644 src/main/kotlin/io/github/moulberry/notenoughupdates/util/KotlinNumberUtils.kt
(limited to 'src/main/kotlin/io')
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
index a5ff48d2..93c4ab90 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
@@ -29,8 +29,8 @@ import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent
-import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager
+import io.github.moulberry.notenoughupdates.miscgui.pricegraph.GuiPriceGraph
import io.github.moulberry.notenoughupdates.util.PronounDB
import io.github.moulberry.notenoughupdates.util.SBInfo
import io.github.moulberry.notenoughupdates.util.TabListUtils
@@ -131,7 +131,8 @@ class DevTestCommand {
thenLiteral("pricetest") {
thenArgument("item", StringArgumentType.string()) { item ->
thenExecute {
- NotEnoughUpdates.INSTANCE.openGui = GuiPriceGraph(this[item])
+ NotEnoughUpdates.INSTANCE.openGui =
+ GuiPriceGraph(this[item])
}
}.withHelp("Display the price graph for an item by id")
thenExecute {
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/pricegraph/GraphDataProvider.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/pricegraph/GraphDataProvider.kt
new file mode 100644
index 00000000..575c34b9
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/pricegraph/GraphDataProvider.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see .
+ */
+
+package io.github.moulberry.notenoughupdates.miscgui.pricegraph
+
+import java.time.Instant
+import java.util.concurrent.CompletableFuture
+
+interface GraphDataProvider {
+ fun loadData(itemId: String,): CompletableFuture