mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-17 17:34:39 +01:00
Implement gacha history record subsystem
* Frontend is not very beautiful yet * Didn't include too much `some anime game` data in the page to avoid being DMCA'd
This commit is contained in:
@@ -14,6 +14,7 @@ import com.sun.nio.file.SensitivityWatchEventModifier;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.def.ItemData;
|
||||
import emu.grasscutter.database.DatabaseHelper;
|
||||
import emu.grasscutter.game.avatar.Avatar;
|
||||
import emu.grasscutter.game.gacha.GachaBanner.BannerType;
|
||||
import emu.grasscutter.game.inventory.GameItem;
|
||||
@@ -196,6 +197,10 @@ public class GachaManager {
|
||||
if (itemData == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Write gacha record
|
||||
GachaRecord gachaRecord = new GachaRecord(itemId, player.getUid(), gachaType);
|
||||
DatabaseHelper.saveGachaRecord(gachaRecord);
|
||||
|
||||
// Create gacha item
|
||||
GachaItem.Builder gachaItem = GachaItem.newBuilder();
|
||||
@@ -321,6 +326,7 @@ public class GachaManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private synchronized GetGachaInfoRsp createProto() {
|
||||
GetGachaInfoRsp.Builder proto = GetGachaInfoRsp.newBuilder().setGachaRandom(12345);
|
||||
|
||||
@@ -330,12 +336,26 @@ public class GachaManager {
|
||||
|
||||
return proto.build();
|
||||
}
|
||||
|
||||
private synchronized GetGachaInfoRsp createProto(String sessionKey) {
|
||||
GetGachaInfoRsp.Builder proto = GetGachaInfoRsp.newBuilder().setGachaRandom(12345);
|
||||
|
||||
for (GachaBanner banner : getGachaBanners().values()) {
|
||||
proto.addGachaInfoList(banner.toProto(sessionKey));
|
||||
}
|
||||
|
||||
return proto.build();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public GetGachaInfoRsp toProto() {
|
||||
if (this.cachedProto == null) {
|
||||
this.cachedProto = createProto();
|
||||
}
|
||||
|
||||
return this.cachedProto;
|
||||
}
|
||||
|
||||
public GetGachaInfoRsp toProto(String sessionKey) {
|
||||
return createProto(sessionKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user