mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 12:05:39 +00:00
Changing how banners work
This commit is contained in:
parent
eb54dcec0e
commit
1662278586
@ -143,7 +143,7 @@ public class GachaBanner {
|
||||
String details = "http" + (HTTP_ENCRYPTION.useInRouting ? "s" : "") + "://"
|
||||
+ lr(HTTP_INFO.accessAddress, HTTP_INFO.bindAddress) + ":"
|
||||
+ lr(HTTP_INFO.accessPort, HTTP_INFO.bindPort)
|
||||
+ "/gacha/details?s=" + sessionKey + "&gachaType=" + gachaType;
|
||||
+ "/gacha/details?s=" + sessionKey + "&scheduleId=" + scheduleId;
|
||||
|
||||
// Grasscutter.getLogger().info("record = " + record);
|
||||
ItemParamData costItem1 = this.getCost(1);
|
||||
|
@ -82,7 +82,7 @@ public class GachaManager {
|
||||
List<GachaBanner> banners = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(Collection.class, GachaBanner.class).getType());
|
||||
if(banners.size() > 0) {
|
||||
for (GachaBanner banner : banners) {
|
||||
getGachaBanners().put(banner.getGachaType(), banner);
|
||||
getGachaBanners().put(banner.getScheduleId(), banner);
|
||||
}
|
||||
Grasscutter.getLogger().info("Banners successfully loaded.");
|
||||
|
||||
@ -236,7 +236,7 @@ public class GachaManager {
|
||||
};
|
||||
}
|
||||
|
||||
public synchronized void doPulls(Player player, int gachaType, int times) {
|
||||
public synchronized void doPulls(Player player, int scheduleId, int times) {
|
||||
// Sanity check
|
||||
if (times != 10 && times != 1) {
|
||||
return;
|
||||
@ -248,7 +248,7 @@ public class GachaManager {
|
||||
}
|
||||
|
||||
// Get banner
|
||||
GachaBanner banner = this.getGachaBanners().get(gachaType);
|
||||
GachaBanner banner = this.getGachaBanners().get(scheduleId);
|
||||
if (banner == null) {
|
||||
player.sendPacket(new PacketDoGachaRsp());
|
||||
return;
|
||||
@ -285,7 +285,7 @@ public class GachaManager {
|
||||
}
|
||||
|
||||
// Write gacha record
|
||||
GachaRecord gachaRecord = new GachaRecord(itemId, player.getUid(), gachaType);
|
||||
GachaRecord gachaRecord = new GachaRecord(itemId, player.getUid(), banner.getGachaType());
|
||||
DatabaseHelper.saveGachaRecord(gachaRecord);
|
||||
|
||||
// Create gacha item
|
||||
|
@ -104,9 +104,9 @@ public final class GachaHandler implements Router {
|
||||
.replace("{{LANGUAGE}}", Utils.getLanguageCode(account.getLocale()));
|
||||
|
||||
// Get the banner info for the banner we want.
|
||||
int gachaType = Integer.parseInt(request.query("gachaType"));
|
||||
int scheduleId = Integer.parseInt(request.query("scheduleId"));
|
||||
GachaManager manager = Grasscutter.getGameServer().getGachaManager();
|
||||
GachaBanner banner = manager.getGachaBanners().get(gachaType);
|
||||
GachaBanner banner = manager.getGachaBanners().get(scheduleId);
|
||||
|
||||
// Add 5-star items.
|
||||
Set<String> fiveStarItems = new LinkedHashSet<>();
|
||||
|
@ -12,6 +12,6 @@ public class HandlerDoGachaReq extends PacketHandler {
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
DoGachaReq req = DoGachaReq.parseFrom(payload);
|
||||
|
||||
session.getServer().getGachaManager().doPulls(session.getPlayer(), req.getGachaType(), req.getGachaTimes());
|
||||
session.getServer().getGachaManager().doPulls(session.getPlayer(), req.getGachaScheduleId(), req.getGachaTimes());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user