fix achievement proto (#507)

* fix achievement proto

TakeAchievementRewardReq tells client the achievements achieved or not and it's progress.

* add import
This commit is contained in:
ShigemoriHakura 2022-05-05 01:06:33 +08:00 committed by GitHub
parent 823040be56
commit 022dcf60ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
message AchievementInfo {
enum AchievementInfoStatus {
ACHIEVEMENT_INVALID = 0;
ACHIEVEMENT_UNFINISHED = 1;
ACHIEVEMENT_FINISHED = 2;
ACHIEVEMENT_POINT_TAKEN = 3;
}
uint32 id = 1;
AchievementInfoStatus status = 2;
uint32 current = 3;
uint32 goal = 4;
uint32 achievedate = 5;
}

View File

@ -0,0 +1,17 @@
syntax = "proto3";
option java_package = "emu.grasscutter.net.proto";
import "AchievementInfo.proto";
message TakeAchievementRewardReq {
enum CmdId {
option allow_alias = true;
ENET_CHANNEL_ID = 0;
NONE = 0;
ENET_IS_RELIABLE = 1;
IS_ALLOW_CLIENT = 1;
CMD_ID = 2677;
}
repeated AchievementInfo a_list = 1;
}

View File

@ -10,6 +10,7 @@ import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.game.GameSession.SessionState;
import emu.grasscutter.server.packet.send.PacketPlayerLoginRsp;
import emu.grasscutter.server.packet.send.PacketTakeAchievementRewardReq;
@Opcodes(PacketOpcodes.PlayerLoginReq) // Sends initial data packets
public class HandlerPlayerLoginReq extends PacketHandler {
@ -47,6 +48,7 @@ public class HandlerPlayerLoginReq extends PacketHandler {
// Final packet to tell client logging in is done
session.send(new PacketPlayerLoginRsp(session));
session.send(new PacketTakeAchievementRewardReq(session));
}
}

View File

@ -0,0 +1,30 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AchievementInfoOuterClass;
import emu.grasscutter.net.proto.AchievementInfoOuterClass.AchievementInfo;
import emu.grasscutter.net.proto.TakeAchievementRewardReqOuterClass.TakeAchievementRewardReq;
import emu.grasscutter.server.game.GameSession;
import java.util.ArrayList;
import java.util.List;
public class PacketTakeAchievementRewardReq extends BasePacket {
public PacketTakeAchievementRewardReq(GameSession session) {
super(PacketOpcodes.TakeAchievementRewardReq);
List<AchievementInfo> a_list = new ArrayList<>();
a_list.add(AchievementInfo.newBuilder().setId(82044).setStatusValue(2).setCurrent(0).setGoal(1).build());
a_list.add(AchievementInfo.newBuilder().setId(81205).setStatusValue(2).setCurrent(0).setGoal(1).build());
TakeAchievementRewardReq proto = TakeAchievementRewardReq.newBuilder()
.addAllAList(a_list)
.build();
this.setData(proto);
}
}