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
977f1ca2
Commit
977f1ca2
authored
Jun 25, 2022
by
Akka
Committed by
Melledy
Jun 29, 2022
Browse files
implement the activity system
parent
5d35cb49
Changes
26
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/send/PacketActivityScheduleInfoNotify.java
0 → 100644
View file @
977f1ca2
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.activity.ActivityConfigItem
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ActivityScheduleInfoNotifyOuterClass
;
import
emu.grasscutter.net.proto.ActivityScheduleInfoOuterClass
;
import
emu.grasscutter.utils.DateHelper
;
import
java.util.Collection
;
public
class
PacketActivityScheduleInfoNotify
extends
BasePacket
{
public
PacketActivityScheduleInfoNotify
(
Collection
<
ActivityConfigItem
>
activityConfigItemList
)
{
super
(
PacketOpcodes
.
ActivityScheduleInfoNotify
);
var
proto
=
ActivityScheduleInfoNotifyOuterClass
.
ActivityScheduleInfoNotify
.
newBuilder
();
activityConfigItemList
.
forEach
(
item
->
{
proto
.
addActivityScheduleList
(
ActivityScheduleInfoOuterClass
.
ActivityScheduleInfo
.
newBuilder
()
.
setActivityId
(
item
.
getActivityId
())
.
setScheduleId
(
item
.
getScheduleId
())
.
setIsOpen
(
true
)
.
setBeginTime
(
DateHelper
.
getUnixTime
(
item
.
getBeginTime
()))
.
setEndTime
(
DateHelper
.
getUnixTime
(
item
.
getEndTime
()))
.
build
());
});
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketActivityUpdateWatcherNotify.java
0 → 100644
View file @
977f1ca2
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.activity.PlayerActivityData
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ActivityUpdateWatcherNotifyOuterClass
;
public
class
PacketActivityUpdateWatcherNotify
extends
BasePacket
{
public
PacketActivityUpdateWatcherNotify
(
int
activityId
,
PlayerActivityData
.
WatcherInfo
watcherInfo
)
{
super
(
PacketOpcodes
.
ActivityUpdateWatcherNotify
);
var
proto
=
ActivityUpdateWatcherNotifyOuterClass
.
ActivityUpdateWatcherNotify
.
newBuilder
();
proto
.
setActivityId
(
activityId
)
.
setWatcherInfo
(
watcherInfo
.
toProto
());
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketGetActivityInfoRsp.java
View file @
977f1ca2
package
emu.grasscutter.server.packet.send
;
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.activity.ActivityManager
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.GetActivityInfoRspOuterClass.GetActivityInfoRsp
;
import
emu.grasscutter.net.proto.GetActivityInfoRspOuterClass.GetActivityInfoRsp
;
import
java.util.Set
;
public
class
PacketGetActivityInfoRsp
extends
BasePacket
{
public
class
PacketGetActivityInfoRsp
extends
BasePacket
{
public
PacketGetActivityInfoRsp
()
{
public
PacketGetActivityInfoRsp
(
Set
<
Integer
>
activityIdList
,
ActivityManager
activityManager
)
{
super
(
PacketOpcodes
.
GetActivityInfoRsp
);
super
(
PacketOpcodes
.
GetActivityInfoRsp
);
GetActivityInfoRsp
proto
=
GetActivityInfoRsp
.
newBuilder
().
build
();
var
proto
=
GetActivityInfoRsp
.
newBuilder
();
activityIdList
.
stream
()
.
map
(
activityManager:
:
getInfoProto
)
.
forEach
(
proto:
:
addActivityInfoList
);
this
.
setData
(
proto
);
this
.
setData
(
proto
);
}
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketMusicGameSettleRsp.java
0 → 100644
View file @
977f1ca2
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.MusicGameSettleRspOuterClass
;
public
class
PacketMusicGameSettleRsp
extends
BasePacket
{
public
PacketMusicGameSettleRsp
(
int
musicBasicId
)
{
super
(
PacketOpcodes
.
MusicGameSettleRsp
);
var
proto
=
MusicGameSettleRspOuterClass
.
MusicGameSettleRsp
.
newBuilder
();
proto
.
setMusicBasicId
(
musicBasicId
)
.
setIsNewRecord
(
true
);
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketMusicGameStartRsp.java
0 → 100644
View file @
977f1ca2
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.MusicGameStartRspOuterClass
;
public
class
PacketMusicGameStartRsp
extends
BasePacket
{
public
PacketMusicGameStartRsp
(
int
musicBasicId
)
{
super
(
PacketOpcodes
.
MusicGameStartRsp
);
var
proto
=
MusicGameStartRspOuterClass
.
MusicGameStartRsp
.
newBuilder
();
proto
.
setMusicBasicId
(
musicBasicId
);
this
.
setData
(
proto
);
}
}
src/main/resources/defaults/data/ActivityConfig.json
0 → 100644
View file @
977f1ca2
[
{
"activityId"
:
5072
,
"activityType"
:
2202
,
"meetCondList"
:
[
5072001
,
5072002
,
5072003
,
5072004
,
5072005
,
5072006
,
5072007
],
"beginTime"
:
"2022-05-01T00:00:00+08:00"
,
"endTime"
:
"2023-05-01T00:00:00+08:00"
}
]
\ No newline at end of file
Prev
1
2
Next
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