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
91000821
Commit
91000821
authored
Jul 05, 2022
by
Akka
Committed by
Luke H-W
Jul 10, 2022
Browse files
quest fix & personal line impl
parent
7bae35f5
Changes
51
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerPersonalLineAllDataReq.java
0 → 100644
View file @
91000821
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPersonalLineAllDataRsp
;
@Opcodes
(
PacketOpcodes
.
PersonalLineAllDataReq
)
public
class
HandlerPersonalLineAllDataReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketPersonalLineAllDataRsp
(
session
.
getPlayer
().
getQuestManager
().
getQuests
().
values
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPostEnterSceneReq.java
View file @
91000821
package
emu.grasscutter.server.packet.recv
;
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.props.SceneType
;
import
emu.grasscutter.game.quest.enums.QuestTrigger
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketHandler
;
...
@@ -11,6 +13,10 @@ public class HandlerPostEnterSceneReq extends PacketHandler {
...
@@ -11,6 +13,10 @@ public class HandlerPostEnterSceneReq extends PacketHandler {
@Override
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
if
(
session
.
getPlayer
().
getScene
().
getSceneType
()
==
SceneType
.
SCENE_ROOM
){
session
.
getPlayer
().
getQuestManager
().
triggerEvent
(
QuestTrigger
.
QUEST_CONTENT_ENTER_ROOM
,
session
.
getPlayer
().
getSceneId
());
}
session
.
send
(
new
PacketPostEnterSceneRsp
(
session
.
getPlayer
()));
session
.
send
(
new
PacketPostEnterSceneRsp
(
session
.
getPlayer
()));
}
}
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerQueryPathReq.java
View file @
91000821
...
@@ -3,14 +3,21 @@ package emu.grasscutter.server.packet.recv;
...
@@ -3,14 +3,21 @@ package emu.grasscutter.server.packet.recv;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.proto.QueryPathReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketQueryPathRsp
;
@Opcodes
(
PacketOpcodes
.
QueryPathReq
)
@Opcodes
(
PacketOpcodes
.
QueryPathReq
)
public
class
HandlerQueryPathReq
extends
PacketHandler
{
public
class
HandlerQueryPathReq
extends
PacketHandler
{
@Override
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
var
req
=
QueryPathReqOuterClass
.
QueryPathReq
.
parseFrom
(
payload
);
/**
* It is not the actual work
*/
session
.
send
(
new
PacketQueryPathRsp
(
req
));
}
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerUnlockPersonalLineReq.java
0 → 100644
View file @
91000821
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.UnlockPersonalLineReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketUnlockPersonalLineRsp
;
@Opcodes
(
PacketOpcodes
.
UnlockPersonalLineReq
)
public
class
HandlerUnlockPersonalLineReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
var
req
=
UnlockPersonalLineReqOuterClass
.
UnlockPersonalLineReq
.
parseFrom
(
payload
);
var
data
=
GameData
.
getPersonalLineDataMap
().
get
(
req
.
getPersonalLineId
());
if
(
data
==
null
){
return
;
}
session
.
getPlayer
().
getQuestManager
().
addQuest
(
data
.
getStartQuestId
());
session
.
getPlayer
().
useLegendaryKey
(
1
);
session
.
send
(
new
PacketUnlockPersonalLineRsp
(
data
.
getId
(),
1
,
data
.
getChapterId
()));
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketAddQuestContentProgressRsp.java
0 → 100644
View file @
91000821
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.AddQuestContentProgressRspOuterClass
;
public
class
PacketAddQuestContentProgressRsp
extends
BasePacket
{
public
PacketAddQuestContentProgressRsp
(
int
contentType
)
{
super
(
PacketOpcodes
.
AddQuestContentProgressRsp
);
var
proto
=
AddQuestContentProgressRspOuterClass
.
AddQuestContentProgressRsp
.
newBuilder
();
proto
.
setContentType
(
contentType
);
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketChapterStateNotify.java
0 → 100644
View file @
91000821
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ChapterStateNotifyOuterClass
;
import
emu.grasscutter.net.proto.ChapterStateOuterClass
;
public
class
PacketChapterStateNotify
extends
BasePacket
{
public
PacketChapterStateNotify
(
int
id
,
ChapterStateOuterClass
.
ChapterState
state
)
{
super
(
PacketOpcodes
.
ChapterStateNotify
);
var
proto
=
ChapterStateNotifyOuterClass
.
ChapterStateNotify
.
newBuilder
();
proto
.
setChapterId
(
id
)
.
setChapterState
(
state
);
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketEvtEntityRenderersChangedNotify.java
0 → 100644
View file @
91000821
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EvtEntityRenderersChangedNotifyOuterClass
;
public
class
PacketEvtEntityRenderersChangedNotify
extends
BasePacket
{
public
PacketEvtEntityRenderersChangedNotify
(
EvtEntityRenderersChangedNotifyOuterClass
.
EvtEntityRenderersChangedNotify
req
)
{
super
(
PacketOpcodes
.
EvtEntityRenderersChangedNotify
,
true
);
this
.
setData
(
req
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketGroupSuiteNotify.java
View file @
91000821
package
emu.grasscutter.server.packet.send
;
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.data.binout.SceneNpcBornEntry
;
import
emu.grasscutter.data.binout.SceneNpcBornEntry
;
import
emu.grasscutter.game.quest.QuestGroupSuite
;
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.GroupSuiteNotifyOuterClass
;
import
emu.grasscutter.net.proto.GroupSuiteNotifyOuterClass
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
public
class
PacketGroupSuiteNotify
extends
BasePacket
{
public
class
PacketGroupSuiteNotify
extends
BasePacket
{
...
@@ -27,4 +29,24 @@ public class PacketGroupSuiteNotify extends BasePacket {
...
@@ -27,4 +29,24 @@ public class PacketGroupSuiteNotify extends BasePacket {
this
.
setData
(
proto
);
this
.
setData
(
proto
);
}
}
public
PacketGroupSuiteNotify
(
int
groupId
,
int
suiteId
)
{
super
(
PacketOpcodes
.
GroupSuiteNotify
);
var
proto
=
GroupSuiteNotifyOuterClass
.
GroupSuiteNotify
.
newBuilder
();
proto
.
putGroupMap
(
groupId
,
suiteId
);
this
.
setData
(
proto
);
}
public
PacketGroupSuiteNotify
(
Collection
<
QuestGroupSuite
>
questGroupSuites
)
{
super
(
PacketOpcodes
.
GroupSuiteNotify
);
var
proto
=
GroupSuiteNotifyOuterClass
.
GroupSuiteNotify
.
newBuilder
();
questGroupSuites
.
forEach
(
i
->
proto
.
putGroupMap
(
i
.
getGroup
(),
i
.
getSuite
()));
this
.
setData
(
proto
);
}
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPersonalLineAllDataRsp.java
0 → 100644
View file @
91000821
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.game.quest.GameQuest
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PersonalLineAllDataRspOuterClass
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
public
class
PacketPersonalLineAllDataRsp
extends
BasePacket
{
public
PacketPersonalLineAllDataRsp
(
Collection
<
GameMainQuest
>
gameMainQuestList
)
{
super
(
PacketOpcodes
.
PersonalLineAllDataRsp
);
var
proto
=
PersonalLineAllDataRspOuterClass
.
PersonalLineAllDataRsp
.
newBuilder
();
var
questList
=
gameMainQuestList
.
stream
()
.
map
(
GameMainQuest:
:
getChildQuests
)
.
map
(
Map:
:
values
)
.
flatMap
(
Collection:
:
stream
)
.
map
(
GameQuest:
:
getQuestId
)
.
collect
(
Collectors
.
toSet
());
GameData
.
getPersonalLineDataMap
().
values
().
stream
()
.
filter
(
i
->
!
questList
.
contains
(
i
.
getStartQuestId
()))
.
forEach
(
i
->
proto
.
addCanBeUnlockedPersonalLineList
(
i
.
getId
()));
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketQueryPathRsp.java
0 → 100644
View file @
91000821
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.QueryPathReqOuterClass
;
import
emu.grasscutter.net.proto.QueryPathRspOuterClass
;
public
class
PacketQueryPathRsp
extends
BasePacket
{
public
PacketQueryPathRsp
(
QueryPathReqOuterClass
.
QueryPathReq
req
)
{
super
(
PacketOpcodes
.
QueryPathRsp
);
var
proto
=
QueryPathRspOuterClass
.
QueryPathRsp
.
newBuilder
();
proto
.
addCorners
(
req
.
getSourcePos
())
.
addCorners
(
req
.
getDestinationPos
(
0
))
.
setQueryId
(
req
.
getQueryId
())
.
setQueryStatus
(
QueryPathRspOuterClass
.
QueryPathRsp
.
PathStatusType
.
PATH_STATUS_TYPE_SUCC
);
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketUnlockPersonalLineRsp.java
0 → 100644
View file @
91000821
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.UnlockPersonalLineRspOuterClass
;
public
class
PacketUnlockPersonalLineRsp
extends
BasePacket
{
public
PacketUnlockPersonalLineRsp
(
int
id
,
int
level
,
int
chapterId
)
{
super
(
PacketOpcodes
.
UnlockPersonalLineRsp
);
var
proto
=
UnlockPersonalLineRspOuterClass
.
UnlockPersonalLineRsp
.
newBuilder
();
proto
.
setPersonalLineId
(
id
)
.
setLevel
(
level
)
.
setChapterId
(
chapterId
);
this
.
setData
(
proto
);
}
}
Prev
1
2
3
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