Add EVENT_GATHER to GadgetGatherObject (#163)

This commit is contained in:
Nazrin 2024-10-01 07:16:24 -07:00 committed by GitHub
parent 4fd112e3b4
commit 64df742070
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,8 @@ import emu.grasscutter.game.world.Scene;
import emu.grasscutter.server.packet.send.PacketGadgetInteractRsp;
import emu.grasscutter.utils.Utils;
import lombok.val;
import org.anime_game_servers.gi_lua.models.ScriptArgs;
import org.anime_game_servers.gi_lua.models.constants.EventType;
import org.anime_game_servers.multi_proto.gi.messages.gadget.GadgetInteractReq;
import org.anime_game_servers.multi_proto.gi.messages.gadget.InteractType;
import org.anime_game_servers.multi_proto.gi.messages.scene.entity.GatherGadgetInfo;
@ -58,6 +60,10 @@ public class GadgetGatherObject extends GadgetContent {
GameItem item = new GameItem(itemData, 1);
player.getInventory().addItem(item, ActionReason.Gather);
var ScriptArgs = new ScriptArgs(getGadget().getGroupId(), EventType.EVENT_GATHER, getGadget().getConfigId());
ScriptArgs.setEventSource(getGadget().getConfigId());
getGadget().getScene().getScriptManager().callEvent(ScriptArgs);
getGadget().getScene().broadcastPacket(new PacketGadgetInteractRsp(getGadget(), InteractType.INTERACT_GATHER));
return true;