forked from Grasscutters/Grasscutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: ShigemoriHakura <62388797+ShigemoriHakura@users.noreply.github.com> Co-Authored-By: KanyeWestc <104547412+KanyeWestc@users.noreply.github.com> Co-Authored-By: QAQ 天小络 <72185326+XTL676@users.noreply.github.com> Co-Authored-By: nkxingxh <25559053+nkxingxh@users.noreply.github.com> Co-Authored-By: Yazawazi <47273265+Yazawazi@users.noreply.github.com> Co-Authored-By: wuwuwu223 <81224214+wuwuwu223@users.noreply.github.com> Co-Authored-By: omg-xtao <100690902+omg-xtao@users.noreply.github.com> Co-Authored-By: Sakura <104815797+Sakura@users.noreply.github.com> Co-Authored-By: NewNeko-2022 <104819344+NewNeko-2022@users.noreply.github.com> Co-Authored-By: JimWails <30657653+JimWails@users.noreply.github.com> Co-Authored-By: buttercookies <19878609+ButterCookies@users.noreply.github.com>
- Loading branch information
1 parent
63a37ac
commit 19a2c9b
Showing
17 changed files
with
564 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
[ | ||
{ | ||
"expId": 301, | ||
"expeditionRewardDataList": [ | ||
{ | ||
"hourTime": 4, | ||
"expeditionRewardData": [ | ||
{ | ||
"itemId": 202, | ||
"minCount": 625, | ||
"maxCount": 625 | ||
} | ||
] | ||
}, | ||
{ | ||
"hourTime": 8, | ||
"expeditionRewardData": [ | ||
{ | ||
"itemId": 202, | ||
"minCount": 1575, | ||
"maxCount": 1575 | ||
} | ||
] | ||
}, | ||
{ | ||
"hourTime": 12, | ||
"expeditionRewardData": [ | ||
{ | ||
"itemId": 202, | ||
"minCount": 2500, | ||
"maxCount": 2500 | ||
} | ||
] | ||
}, | ||
{ | ||
"hourTime": 20, | ||
"expeditionRewardData": [ | ||
{ | ||
"itemId": 202, | ||
"minCount": 5000, | ||
"maxCount": 5000 | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"expId": 305, | ||
"expeditionRewardDataList": [ | ||
{ | ||
"hourTime": 4, | ||
"rewardMora": 0, | ||
"expeditionRewardData": [ | ||
{ | ||
"itemId": 100064, | ||
"minCount": 1, | ||
"maxCount": 1 | ||
}, { | ||
"itemId": 101210, | ||
"minCount": 1, | ||
"maxCount": 1 | ||
} | ||
] | ||
}, | ||
{ | ||
"hourTime": 8, | ||
"rewardMora": 0, | ||
"expeditionRewardData": [ | ||
{ | ||
"itemId": 100064, | ||
"minCount": 2, | ||
"maxCount": 4 | ||
}, { | ||
"itemId": 101210, | ||
"minCount": 2, | ||
"maxCount": 4 | ||
} | ||
] | ||
}, | ||
{ | ||
"hourTime": 12, | ||
"rewardMora": 0, | ||
"expeditionRewardData": [ | ||
{ | ||
"itemId": 100064, | ||
"minCount": 4, | ||
"maxCount": 6 | ||
}, { | ||
"itemId": 101210, | ||
"minCount": 4, | ||
"maxCount": 6 | ||
} | ||
] | ||
}, | ||
{ | ||
"hourTime": 20, | ||
"rewardMora": 0, | ||
"expeditionRewardData": [ | ||
{ | ||
"itemId": 100064, | ||
"minCount": 8, | ||
"maxCount": 12 | ||
}, { | ||
"itemId": 101210, | ||
"minCount": 8, | ||
"maxCount": 12 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] |
44 changes: 44 additions & 0 deletions
44
src/main/java/emu/grasscutter/game/expedition/ExpeditionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package emu.grasscutter.game.expedition; | ||
|
||
import dev.morphia.annotations.Entity; | ||
|
||
@Entity | ||
public class ExpeditionInfo { | ||
|
||
public int getState() { | ||
return state; | ||
} | ||
|
||
public void setState(int state) { | ||
this.state = state; | ||
} | ||
|
||
public int getExpId() { | ||
return expId; | ||
} | ||
|
||
public void setExpId(int expId) { | ||
this.expId = expId; | ||
} | ||
|
||
public int getHourTime() { | ||
return hourTime; | ||
} | ||
|
||
public void setHourTime(int hourTime) { | ||
this.hourTime = hourTime; | ||
} | ||
|
||
public int getStartTime() { | ||
return startTime; | ||
} | ||
|
||
public void setStartTime(int startTime) { | ||
this.startTime = startTime; | ||
} | ||
|
||
private int state; | ||
private int expId; | ||
private int hourTime; | ||
private int startTime; | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/emu/grasscutter/game/expedition/ExpeditionManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package emu.grasscutter.game.expedition; | ||
|
||
import com.google.gson.reflect.TypeToken; | ||
import emu.grasscutter.Grasscutter; | ||
import emu.grasscutter.server.game.GameServer; | ||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; | ||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; | ||
|
||
import java.io.FileReader; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
public class ExpeditionManager { | ||
public GameServer getGameServer() { | ||
return gameServer; | ||
} | ||
|
||
private final GameServer gameServer; | ||
|
||
public Int2ObjectMap<List<ExpeditionRewardDataList>> getExpeditionRewardDataList() { return expeditionRewardData; } | ||
|
||
private final Int2ObjectMap<List<ExpeditionRewardDataList>> expeditionRewardData; | ||
|
||
public ExpeditionManager(GameServer gameServer) { | ||
this.gameServer = gameServer; | ||
this.expeditionRewardData = new Int2ObjectOpenHashMap<>(); | ||
this.load(); | ||
} | ||
|
||
public synchronized void load() { | ||
try (FileReader fileReader = new FileReader(Grasscutter.getConfig().DATA_FOLDER + "ExpeditionReward.json")) { | ||
getExpeditionRewardDataList().clear(); | ||
List<ExpeditionRewardInfo> banners = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(Collection.class, ExpeditionRewardInfo.class).getType()); | ||
if(banners.size() > 0) { | ||
for (ExpeditionRewardInfo di : banners) { | ||
getExpeditionRewardDataList().put(di.getExpId(), di.getExpeditionRewardDataList()); | ||
} | ||
Grasscutter.getLogger().info("Expedition reward successfully loaded."); | ||
} else { | ||
Grasscutter.getLogger().error("Unable to load expedition reward. Expedition reward size is 0."); | ||
} | ||
} catch (Exception e) { | ||
Grasscutter.getLogger().error("Unable to load expedition reward.", e); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package emu.grasscutter.game.expedition; | ||
|
||
public class ExpeditionRewardData { | ||
private int itemId; | ||
private int minCount; | ||
private int maxCount; | ||
|
||
public int getItemId() { | ||
return itemId; | ||
} | ||
|
||
public int getMinCount() { return minCount; } | ||
|
||
public int getMaxCount() { | ||
return maxCount; | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardDataList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package emu.grasscutter.game.expedition; | ||
|
||
import java.util.List; | ||
|
||
public class ExpeditionRewardDataList { | ||
public int getHourTime() { | ||
return hourTime; | ||
} | ||
public List<ExpeditionRewardData> getExpeditionRewardData() { | ||
return expeditionRewardData; | ||
} | ||
|
||
private int hourTime; | ||
private List<ExpeditionRewardData> expeditionRewardData; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/emu/grasscutter/game/expedition/ExpeditionRewardInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package emu.grasscutter.game.expedition; | ||
|
||
import java.util.List; | ||
|
||
public class ExpeditionRewardInfo { | ||
public int getExpId() { | ||
return expId; | ||
} | ||
|
||
public List<ExpeditionRewardDataList> getExpeditionRewardDataList() { | ||
return expeditionRewardDataList; | ||
} | ||
|
||
private int expId; | ||
private List<ExpeditionRewardDataList> expeditionRewardDataList; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.