Add PlayerLevelItemEvent

This commit is contained in:
KingRainbow44 2023-08-27 23:26:51 -04:00
parent 314b90e936
commit 76b27df622
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
2 changed files with 29 additions and 0 deletions

View File

@ -441,6 +441,9 @@ public class InventorySystem extends BaseGameSystem {
// Packets // Packets
player.sendPacket(new PacketStoreItemChangeNotify(weapon)); player.sendPacket(new PacketStoreItemChangeNotify(weapon));
player.sendPacket(new PacketWeaponUpgradeRsp(weapon, oldLevel, leftovers)); player.sendPacket(new PacketWeaponUpgradeRsp(weapon, oldLevel, leftovers));
// Call PlayerLevelItemEvent.
new PlayerLevelItemEvent(player, oldLevel, weapon);
} }
private List<ItemParam> getLeftoverOres(int leftover) { private List<ItemParam> getLeftoverOres(int leftover) {

View File

@ -0,0 +1,26 @@
package emu.grasscutter.server.event.player;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.server.event.types.PlayerEvent;
import lombok.Getter;
@Getter
public final class PlayerLevelItemEvent extends PlayerEvent {
private final int oldLevel;
private final GameItem item;
public PlayerLevelItemEvent(Player player, int oldLevel, GameItem item) {
super(player);
this.oldLevel = oldLevel;
this.item = item;
}
/**
* @return The item's new level.
*/
public int getNewLevel() {
return this.getItem().getLevel();
}
}