Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
19ee983c
Commit
19ee983c
authored
May 14, 2022
by
Yazawazi
Committed by
Melledy
May 13, 2022
Browse files
feature(serenitea pot): Implementation of the entry function
It's being perfected, so don't worry. (probably)
parent
83f8bec9
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java
0 → 100644
View file @
19ee983c
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.def.GadgetData
;
import
emu.grasscutter.game.entity.EntityVehicle
;
import
emu.grasscutter.game.entity.GameEntity
;
import
emu.grasscutter.game.props.LifeState
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.*
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify
;
import
emu.grasscutter.server.packet.send.PacketWidgetCoolDownNotify
;
import
emu.grasscutter.server.packet.send.PacketWidgetDoBagRsp
;
import
emu.grasscutter.server.packet.send.PacketWidgetGadgetDataNotify
;
import
emu.grasscutter.utils.Position
;
import
java.util.List
;
@Opcodes
(
PacketOpcodes
.
WidgetDoBagReq
)
public
class
HandlerWidgetDoBagReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
WidgetDoBagReqOuterClass
.
WidgetDoBagReq
req
=
WidgetDoBagReqOuterClass
.
WidgetDoBagReq
.
parseFrom
(
payload
);
switch
(
req
.
getMaterialId
())
{
case
220026
->
{
GadgetData
gadgetData
=
GameData
.
getGadgetDataMap
().
get
(
70500025
);
Position
pos
=
new
Position
(
req
.
getWidgetCreatorInfo
().
getLocationInfo
().
getPos
());
Position
rot
=
new
Position
(
req
.
getWidgetCreatorInfo
().
getLocationInfo
().
getRot
());
GameEntity
entity
=
new
EntityVehicle
(
session
.
getPlayer
().
getScene
(),
session
.
getPlayer
(),
gadgetData
.
getId
(),
0
,
pos
,
rot
);
session
.
getPlayer
().
getScene
().
addEntity
(
entity
);
session
.
send
(
new
PacketWidgetGadgetDataNotify
(
70500025
,
List
.
of
(
entity
.
getId
())));
// ???
session
.
send
(
new
PacketWidgetCoolDownNotify
(
15
,
System
.
currentTimeMillis
()
+
5000L
,
true
));
session
.
send
(
new
PacketWidgetCoolDownNotify
(
15
,
System
.
currentTimeMillis
()
+
5000L
,
true
));
// Send twice, and I don't know why, Ask mhy
session
.
send
(
new
PacketWidgetDoBagRsp
());
}
default
->
{
session
.
send
(
new
PacketWidgetDoBagRsp
());
}
}
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketWidgetCoolDownNotify.java
0 → 100644
View file @
19ee983c
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.WidgetCoolDownDataOuterClass
;
import
emu.grasscutter.net.proto.WidgetCoolDownNotifyOuterClass
;
public
class
PacketWidgetCoolDownNotify
extends
BasePacket
{
public
PacketWidgetCoolDownNotify
(
int
id
,
long
coolDownTime
,
boolean
isSuccess
)
{
super
(
PacketOpcodes
.
WidgetCoolDownNotify
);
WidgetCoolDownNotifyOuterClass
.
WidgetCoolDownNotify
proto
=
WidgetCoolDownNotifyOuterClass
.
WidgetCoolDownNotify
.
newBuilder
()
.
addGroupCoolDownDataList
(
WidgetCoolDownDataOuterClass
.
WidgetCoolDownData
.
newBuilder
()
.
setId
(
id
)
.
setCoolDownTime
(
coolDownTime
)
.
setIsSuccess
(
isSuccess
)
.
build
()
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketWidgetDoBagRsp.java
0 → 100644
View file @
19ee983c
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.WidgetDoBagRspOuterClass
;
public
class
PacketWidgetDoBagRsp
extends
BasePacket
{
public
PacketWidgetDoBagRsp
(
int
materialId
)
{
super
(
PacketOpcodes
.
WidgetDoBagRsp
);
WidgetDoBagRspOuterClass
.
WidgetDoBagRsp
proto
=
WidgetDoBagRspOuterClass
.
WidgetDoBagRsp
.
newBuilder
()
.
setMaterialId
(
materialId
)
.
setRetcode
(
0
)
.
build
();
this
.
setData
(
proto
);
}
public
PacketWidgetDoBagRsp
()
{
super
(
PacketOpcodes
.
WidgetDoBagRsp
);
WidgetDoBagRspOuterClass
.
WidgetDoBagRsp
proto
=
WidgetDoBagRspOuterClass
.
WidgetDoBagRsp
.
newBuilder
()
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketWidgetGadgetDataNotify.java
0 → 100644
View file @
19ee983c
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.WidgetGadgetDataNotifyOuterClass
;
import
emu.grasscutter.net.proto.WidgetGadgetDataOuterClass
;
import
java.io.IOException
;
import
java.util.List
;
public
class
PacketWidgetGadgetDataNotify
extends
BasePacket
{
public
PacketWidgetGadgetDataNotify
(
int
gadgetId
,
List
<
Integer
>
gadgetEntityIdList
)
throws
IOException
{
super
(
PacketOpcodes
.
WidgetGadgetDataNotify
);
WidgetGadgetDataNotifyOuterClass
.
WidgetGadgetDataNotify
proto
=
WidgetGadgetDataNotifyOuterClass
.
WidgetGadgetDataNotify
.
newBuilder
()
.
setWidgetGadgetData
(
WidgetGadgetDataOuterClass
.
WidgetGadgetData
.
newBuilder
()
.
setGadgetId
(
gadgetId
)
.
addAllGadgetEntityIdList
(
gadgetEntityIdList
)
.
build
()
)
.
build
();
this
.
setData
(
proto
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment