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
e9d7d5d5
Commit
e9d7d5d5
authored
May 11, 2022
by
Melledy
Browse files
Implement quests
parent
54cf45a7
Changes
27
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/send/PacketFinishedParentQuestNotify.java
0 → 100644
View file @
e9d7d5d5
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.FinishedParentQuestNotifyOuterClass.FinishedParentQuestNotify
;
public
class
PacketFinishedParentQuestNotify
extends
BasePacket
{
public
PacketFinishedParentQuestNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
FinishedParentQuestNotify
,
true
);
FinishedParentQuestNotify
.
Builder
proto
=
FinishedParentQuestNotify
.
newBuilder
();
for
(
GameMainQuest
mainQuest
:
player
.
getQuestManager
().
getQuests
().
values
())
{
proto
.
addParentQuestList
(
mainQuest
.
toProto
());
}
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketFinishedParentQuestUpdateNotify.java
0 → 100644
View file @
e9d7d5d5
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.FinishedParentQuestUpdateNotifyOuterClass.FinishedParentQuestUpdateNotify
;
public
class
PacketFinishedParentQuestUpdateNotify
extends
BasePacket
{
public
PacketFinishedParentQuestUpdateNotify
(
GameMainQuest
quest
)
{
super
(
PacketOpcodes
.
FinishedParentQuestUpdateNotify
);
FinishedParentQuestUpdateNotify
proto
=
FinishedParentQuestUpdateNotify
.
newBuilder
()
.
addParentQuestList
(
quest
.
toProto
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketQuestListNotify.java
0 → 100644
View file @
e9d7d5d5
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.game.quest.QuestManager
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.QuestListNotifyOuterClass.QuestListNotify
;
public
class
PacketQuestListNotify
extends
BasePacket
{
public
PacketQuestListNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
QuestListNotify
,
true
);
QuestListNotify
.
Builder
proto
=
QuestListNotify
.
newBuilder
();
player
.
getQuestManager
().
forEachQuest
(
quest
->
{
proto
.
addQuestList
(
quest
.
toProto
());
});
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketQuestListUpdateNotify.java
0 → 100644
View file @
e9d7d5d5
package
emu.grasscutter.server.packet.send
;
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.QuestListUpdateNotifyOuterClass.QuestListUpdateNotify
;
public
class
PacketQuestListUpdateNotify
extends
BasePacket
{
public
PacketQuestListUpdateNotify
(
GameQuest
quest
)
{
super
(
PacketOpcodes
.
QuestListUpdateNotify
);
QuestListUpdateNotify
proto
=
QuestListUpdateNotify
.
newBuilder
()
.
addQuestList
(
quest
.
toProto
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketQuestProgressUpdateNotify.java
0 → 100644
View file @
e9d7d5d5
package
emu.grasscutter.server.packet.send
;
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.QuestProgressUpdateNotifyOuterClass.QuestProgressUpdateNotify
;
public
class
PacketQuestProgressUpdateNotify
extends
BasePacket
{
public
PacketQuestProgressUpdateNotify
(
GameQuest
quest
)
{
super
(
PacketOpcodes
.
QuestProgressUpdateNotify
);
QuestProgressUpdateNotify
.
Builder
proto
=
QuestProgressUpdateNotify
.
newBuilder
().
setQuestId
(
quest
.
getQuestId
());
if
(
quest
.
getFinishProgressList
()
!=
null
)
{
for
(
int
i
:
quest
.
getFinishProgressList
())
{
proto
.
addFinishProgressList
(
i
);
}
}
if
(
quest
.
getFailProgressList
()
!=
null
)
{
for
(
int
i
:
quest
.
getFailProgressList
())
{
proto
.
addFailProgressList
(
i
);
}
}
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketServerCondMeetQuestListUpdateNotify.java
0 → 100644
View file @
e9d7d5d5
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.custom.QuestConfig
;
import
emu.grasscutter.game.player.Player
;
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.ServerCondMeetQuestListUpdateNotifyOuterClass.ServerCondMeetQuestListUpdateNotify
;
public
class
PacketServerCondMeetQuestListUpdateNotify
extends
BasePacket
{
public
PacketServerCondMeetQuestListUpdateNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
ServerCondMeetQuestListUpdateNotify
);
ServerCondMeetQuestListUpdateNotify
.
Builder
proto
=
ServerCondMeetQuestListUpdateNotify
.
newBuilder
();
player
.
getQuestManager
().
forEachQuest
(
quest
->
{
if
(
quest
.
getState
().
getValue
()
<=
2
)
{
proto
.
addAddQuestIdList
(
quest
.
getQuestId
());
}
});
this
.
setData
(
proto
);
}
public
PacketServerCondMeetQuestListUpdateNotify
(
GameQuest
quest
)
{
super
(
PacketOpcodes
.
ServerCondMeetQuestListUpdateNotify
);
ServerCondMeetQuestListUpdateNotify
proto
=
ServerCondMeetQuestListUpdateNotify
.
newBuilder
()
.
addAddQuestIdList
(
quest
.
getQuestId
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/resources/languages/en-US.json
View file @
e9d7d5d5
...
...
@@ -210,6 +210,14 @@
"success"
:
"Coordinates: %s, %s, %s
\n
Scene id: %s"
,
"description"
:
"Get coordinates."
},
"quest"
:
{
"description"
:
"Add or finish quests"
,
"usage"
:
"quest <add|finish> [quest id]"
,
"added"
:
"Quest %s added"
,
"finished"
:
"Finished quest %s"
,
"not_found"
:
"Quest not found"
,
"invalid_id"
:
"Invalid quest id"
},
"reload"
:
{
"reload_start"
:
"Reloading config."
,
"reload_done"
:
"Reload complete."
,
...
...
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