mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-26 15:22:56 +08:00
Added banner start and end time checks
This commit is contained in:
parent
1662278586
commit
e6514f7ad1
@ -21,6 +21,7 @@ import emu.grasscutter.data.common.ItemParamData;
|
|||||||
import emu.grasscutter.data.def.ItemData;
|
import emu.grasscutter.data.def.ItemData;
|
||||||
import emu.grasscutter.database.DatabaseHelper;
|
import emu.grasscutter.database.DatabaseHelper;
|
||||||
import emu.grasscutter.game.avatar.Avatar;
|
import emu.grasscutter.game.avatar.Avatar;
|
||||||
|
import emu.grasscutter.game.gacha.GachaBanner.BannerType;
|
||||||
import emu.grasscutter.game.inventory.GameItem;
|
import emu.grasscutter.game.inventory.GameItem;
|
||||||
import emu.grasscutter.game.inventory.Inventory;
|
import emu.grasscutter.game.inventory.Inventory;
|
||||||
import emu.grasscutter.game.inventory.ItemType;
|
import emu.grasscutter.game.inventory.ItemType;
|
||||||
@ -411,8 +412,13 @@ public class GachaManager {
|
|||||||
private synchronized GetGachaInfoRsp createProto(String sessionKey) {
|
private synchronized GetGachaInfoRsp createProto(String sessionKey) {
|
||||||
GetGachaInfoRsp.Builder proto = GetGachaInfoRsp.newBuilder().setGachaRandom(12345);
|
GetGachaInfoRsp.Builder proto = GetGachaInfoRsp.newBuilder().setGachaRandom(12345);
|
||||||
|
|
||||||
|
long currentTime = System.currentTimeMillis() / 1000L;
|
||||||
|
|
||||||
for (GachaBanner banner : getGachaBanners().values()) {
|
for (GachaBanner banner : getGachaBanners().values()) {
|
||||||
proto.addGachaInfoList(banner.toProto(sessionKey));
|
if ((banner.getEndTime() >= currentTime && banner.getBeginTime() <= currentTime) || (banner.getBannerType() == BannerType.STANDARD))
|
||||||
|
{
|
||||||
|
proto.addGachaInfoList(banner.toProto(sessionKey));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return proto.build();
|
return proto.build();
|
||||||
|
Loading…
Reference in New Issue
Block a user