mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 11:57:35 +00:00
Run formatter on wish event
This commit is contained in:
parent
3436e0a3a8
commit
4f2d3f9b30
@ -258,13 +258,18 @@ public class GachaSystem extends BaseGameSystem {
|
|||||||
// Check against total limit
|
// Check against total limit
|
||||||
PlayerGachaBannerInfo gachaInfo = player.getGachaInfo().getBannerInfo(banner);
|
PlayerGachaBannerInfo gachaInfo = player.getGachaInfo().getBannerInfo(banner);
|
||||||
// Call pre-PlayerWishEvent.
|
// Call pre-PlayerWishEvent.
|
||||||
var event = new PlayerWishEvent(player, banner, times, new PlayerWishEvent.Pity(
|
var event =
|
||||||
gachaInfo.getPity5(), gachaInfo.getPity4(),
|
new PlayerWishEvent(
|
||||||
gachaInfo.getFailedFeaturedItemPulls(4) > 0,
|
player,
|
||||||
banner.hasEpitomized() ?
|
banner,
|
||||||
gachaInfo.getFailedChosenItemPulls() >= 2 :
|
times,
|
||||||
gachaInfo.getFailedFeaturedItemPulls(5) > 0
|
new PlayerWishEvent.Pity(
|
||||||
));
|
gachaInfo.getPity5(),
|
||||||
|
gachaInfo.getPity4(),
|
||||||
|
gachaInfo.getFailedFeaturedItemPulls(4) > 0,
|
||||||
|
banner.hasEpitomized()
|
||||||
|
? gachaInfo.getFailedChosenItemPulls() >= 2
|
||||||
|
: gachaInfo.getFailedFeaturedItemPulls(5) > 0));
|
||||||
if (!event.call()) {
|
if (!event.call()) {
|
||||||
player.sendPacket(new PacketDoGachaRsp(Retcode.RET_SVR_ERROR));
|
player.sendPacket(new PacketDoGachaRsp(Retcode.RET_SVR_ERROR));
|
||||||
return;
|
return;
|
||||||
@ -362,15 +367,13 @@ public class GachaSystem extends BaseGameSystem {
|
|||||||
|
|
||||||
// Create item
|
// Create item
|
||||||
GameItem item = new GameItem(itemData);
|
GameItem item = new GameItem(itemData);
|
||||||
items.add(new PlayerWishEvent.WishCompute(
|
items.add(
|
||||||
item, gachaItem, addStardust, addStarglitter, isTransferItem
|
new PlayerWishEvent.WishCompute(
|
||||||
));
|
item, gachaItem, addStardust, addStarglitter, isTransferItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call post-PlayerWishEvent.
|
// Call post-PlayerWishEvent.
|
||||||
event.finish(items.stream()
|
event.finish(items.stream().map(PlayerWishEvent.WishCompute::getItem).toList());
|
||||||
.map(PlayerWishEvent.WishCompute::getItem)
|
|
||||||
.toList());
|
|
||||||
|
|
||||||
var eventItems = event.getReceivedItems();
|
var eventItems = event.getReceivedItems();
|
||||||
for (var i = 0; i < items.size(); i++) {
|
for (var i = 0; i < items.size(); i++) {
|
||||||
@ -386,11 +389,14 @@ public class GachaSystem extends BaseGameSystem {
|
|||||||
|
|
||||||
if (compute.getAddStardust() > 0) {
|
if (compute.getAddStardust() > 0) {
|
||||||
gachaItem.addTokenItemList(
|
gachaItem.addTokenItemList(
|
||||||
ItemParam.newBuilder().setItemId(stardustId).setCount(compute.getAddStardust()));
|
ItemParam.newBuilder().setItemId(stardustId).setCount(compute.getAddStardust()));
|
||||||
}
|
}
|
||||||
if (compute.getAddStarglitter() > 0) {
|
if (compute.getAddStarglitter() > 0) {
|
||||||
ItemParam starglitterParam =
|
ItemParam starglitterParam =
|
||||||
ItemParam.newBuilder().setItemId(starglitterId).setCount(compute.getAddStarglitter()).build();
|
ItemParam.newBuilder()
|
||||||
|
.setItemId(starglitterId)
|
||||||
|
.setCount(compute.getAddStarglitter())
|
||||||
|
.build();
|
||||||
if (compute.isTransferItem()) {
|
if (compute.isTransferItem()) {
|
||||||
gachaItem.addTransferItems(GachaTransferItem.newBuilder().setItem(starglitterParam));
|
gachaItem.addTransferItems(GachaTransferItem.newBuilder().setItem(starglitterParam));
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,7 @@ public final class PlayerWishEvent extends PlayerEvent implements Cancellable {
|
|||||||
|
|
||||||
private boolean preItems = true;
|
private boolean preItems = true;
|
||||||
|
|
||||||
public PlayerWishEvent(
|
public PlayerWishEvent(Player player, GachaBanner banner, int wishCount, Pity pity) {
|
||||||
Player player, GachaBanner banner,
|
|
||||||
int wishCount, Pity pity
|
|
||||||
) {
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
this.banner = banner;
|
this.banner = banner;
|
||||||
@ -31,8 +28,7 @@ public final class PlayerWishEvent extends PlayerEvent implements Cancellable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be invoked after items have been generated.
|
* Should be invoked after items have been generated. This will recall the event.
|
||||||
* This will recall the event.
|
|
||||||
*
|
*
|
||||||
* @param receivedItems The items received.
|
* @param receivedItems The items received.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user