Commit f1398182 authored by Yazawazi's avatar Yazawazi Committed by Melledy
Browse files

[Anime Game Version update] Support 2.7 (#1072)

* feature(2.7 version): support 2.7 version & upload new protos

1. Support GC in GI 2.7.0;
2. Upload new protos;
3. Fix some bugs cuz by new protos.

BREAKING CHANGE: all

* fix(database helper): fix player uid issues

* fix(ability embryo): uint32 to fixed32

* fix(proto): map mark

rename MAP_MARK_FROM_TYPE_NOE to MAP_MARK_FROM_TYPE_NONE

* fix(game version): change game version to 2.7.0

* perf(proto): remove unused protos

1. Remove unused protos;
2. Temporarily commented out some of the proto fields.

* fix(proto): uint32 to fixed32
parent a95002fd
...@@ -284,7 +284,7 @@ public class Scene { ...@@ -284,7 +284,7 @@ public class Scene {
private void removePlayerAvatars(Player player) { private void removePlayerAvatars(Player player) {
Iterator<EntityAvatar> it = player.getTeamManager().getActiveTeam().iterator(); Iterator<EntityAvatar> it = player.getTeamManager().getActiveTeam().iterator();
while (it.hasNext()) { while (it.hasNext()) {
this.removeEntity(it.next(), VisionType.VISION_REMOVE); this.removeEntity(it.next(), VisionType.VISION_TYPE_REMOVE);
it.remove(); it.remove();
} }
} }
...@@ -327,7 +327,7 @@ public class Scene { ...@@ -327,7 +327,7 @@ public class Scene {
this.addEntityDirectly(entity); this.addEntityDirectly(entity);
} }
this.broadcastPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_BORN)); this.broadcastPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_TYPE_BORN));
} }
private GameEntity removeEntityDirectly(GameEntity entity) { private GameEntity removeEntityDirectly(GameEntity entity) {
...@@ -335,7 +335,7 @@ public class Scene { ...@@ -335,7 +335,7 @@ public class Scene {
} }
public void removeEntity(GameEntity entity) { public void removeEntity(GameEntity entity) {
this.removeEntity(entity, VisionType.VISION_DIE); this.removeEntity(entity, VisionType.VISION_TYPE_DIE);
} }
public synchronized void removeEntity(GameEntity entity, VisionType visionType) { public synchronized void removeEntity(GameEntity entity, VisionType visionType) {
...@@ -348,8 +348,8 @@ public class Scene { ...@@ -348,8 +348,8 @@ public class Scene {
public synchronized void replaceEntity(EntityAvatar oldEntity, EntityAvatar newEntity) { public synchronized void replaceEntity(EntityAvatar oldEntity, EntityAvatar newEntity) {
this.removeEntityDirectly(oldEntity); this.removeEntityDirectly(oldEntity);
this.addEntityDirectly(newEntity); this.addEntityDirectly(newEntity);
this.broadcastPacket(new PacketSceneEntityDisappearNotify(oldEntity, VisionType.VISION_REPLACE)); this.broadcastPacket(new PacketSceneEntityDisappearNotify(oldEntity, VisionType.VISION_TYPE_REPLACE));
this.broadcastPacket(new PacketSceneEntityAppearNotify(newEntity, VisionType.VISION_REPLACE, oldEntity.getId())); this.broadcastPacket(new PacketSceneEntityAppearNotify(newEntity, VisionType.VISION_TYPE_REPLACE, oldEntity.getId()));
} }
public void showOtherEntities(Player player) { public void showOtherEntities(Player player) {
...@@ -363,7 +363,7 @@ public class Scene { ...@@ -363,7 +363,7 @@ public class Scene {
entities.add(entity); entities.add(entity);
} }
player.sendPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_MEET)); player.sendPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_TYPE_MEET));
} }
public void handleAttack(AttackResult result) { public void handleAttack(AttackResult result) {
...@@ -487,11 +487,11 @@ public class Scene { ...@@ -487,11 +487,11 @@ public class Scene {
if (toAdd.size() > 0) { if (toAdd.size() > 0) {
toAdd.stream().forEach(this::addEntityDirectly); toAdd.stream().forEach(this::addEntityDirectly);
this.broadcastPacket(new PacketSceneEntityAppearNotify(toAdd, VisionType.VISION_BORN)); this.broadcastPacket(new PacketSceneEntityAppearNotify(toAdd, VisionType.VISION_TYPE_BORN));
} }
if (toRemove.size() > 0) { if (toRemove.size() > 0) {
toRemove.stream().forEach(this::removeEntityDirectly); toRemove.stream().forEach(this::removeEntityDirectly);
this.broadcastPacket(new PacketSceneEntityDisappearNotify(toRemove, VisionType.VISION_REMOVE)); this.broadcastPacket(new PacketSceneEntityDisappearNotify(toRemove, VisionType.VISION_TYPE_REMOVE));
} }
} }
...@@ -564,7 +564,7 @@ public class Scene { ...@@ -564,7 +564,7 @@ public class Scene {
if (toRemove.size() > 0) { if (toRemove.size() > 0) {
toRemove.stream().forEach(this::removeEntityDirectly); toRemove.stream().forEach(this::removeEntityDirectly);
this.broadcastPacket(new PacketSceneEntityDisappearNotify(toRemove, VisionType.VISION_REMOVE)); this.broadcastPacket(new PacketSceneEntityDisappearNotify(toRemove, VisionType.VISION_TYPE_REMOVE));
} }
for (SceneGroup group : block.groups) { for (SceneGroup group : block.groups) {
...@@ -609,7 +609,7 @@ public class Scene { ...@@ -609,7 +609,7 @@ public class Scene {
return; return;
} }
this.broadcastPacketToOthers(gadget.getOwner(), new PacketSceneEntityDisappearNotify(gadget, VisionType.VISION_DIE)); this.broadcastPacketToOthers(gadget.getOwner(), new PacketSceneEntityDisappearNotify(gadget, VisionType.VISION_TYPE_DIE));
} }
// Broadcasting // Broadcasting
......
...@@ -193,7 +193,7 @@ public class World implements Iterable<Player> { ...@@ -193,7 +193,7 @@ public class World implements Iterable<Player> {
World world = new World(victim); World world = new World(victim);
world.addPlayer(victim); world.addPlayer(victim);
victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.ENTER_SELF, EnterReason.TeamKick, victim.getSceneId(), victim.getPos())); victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.ENTER_TYPE_SELF, EnterReason.TeamKick, victim.getSceneId(), victim.getPos()));
} }
} }
} }
...@@ -260,17 +260,17 @@ public class World implements Iterable<Player> { ...@@ -260,17 +260,17 @@ public class World implements Iterable<Player> {
} }
// Get enter types // Get enter types
EnterType enterType = EnterType.ENTER_JUMP; EnterType enterType = EnterType.ENTER_TYPE_JUMP;
EnterReason enterReason = EnterReason.TransPoint; EnterReason enterReason = EnterReason.TransPoint;
if (dungeonData != null) { if (dungeonData != null) {
enterType = EnterType.ENTER_DUNGEON; enterType = EnterType.ENTER_TYPE_DUNGEON;
enterReason = EnterReason.DungeonEnter; enterReason = EnterReason.DungeonEnter;
} else if (oldScene == newScene) { } else if (oldScene == newScene) {
enterType = EnterType.ENTER_GOTO; enterType = EnterType.ENTER_TYPE_GOTO;
} else if (newScene.getSceneType() == SceneType.SCENE_HOME_WORLD) { } else if (newScene.getSceneType() == SceneType.SCENE_HOME_WORLD) {
// Home // Home
enterType = EnterType.ENTER_SELF_HOME; enterType = EnterType.ENTER_TYPE_SELF_HOME;
} }
// Teleport packet // Teleport packet
......
...@@ -83,7 +83,7 @@ public final class PlayerHook { ...@@ -83,7 +83,7 @@ public final class PlayerHook {
public void teleport(Position position) { public void teleport(Position position) {
this.player.getPos().set(position); this.player.getPos().set(position);
this.player.sendPacket(new PacketPlayerEnterSceneNotify(this.player, this.player.sendPacket(new PacketPlayerEnterSceneNotify(this.player,
EnterType.ENTER_JUMP, EnterReason.TransPoint, EnterType.ENTER_TYPE_JUMP, EnterReason.TransPoint,
this.player.getSceneId(), position this.player.getSceneId(), position
)); ));
} }
......
...@@ -71,7 +71,7 @@ public class LuaSerializer implements Serializer { ...@@ -71,7 +71,7 @@ public class LuaSerializer implements Serializer {
try { try {
//noinspection ConfusingArgumentToVarargsMethod //noinspection ConfusingArgumentToVarargsMethod
object = type.getDeclaredConstructor().newInstance(null); object = type.getDeclaredConstructor().newInstance();
LuaValue[] keys = table.keys(); LuaValue[] keys = table.keys();
for (LuaValue k : keys) { for (LuaValue k : keys) {
......
...@@ -21,6 +21,7 @@ import emu.grasscutter.utils.Utils; ...@@ -21,6 +21,7 @@ import emu.grasscutter.utils.Utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Stream;
@Opcodes(PacketOpcodes.BuyGoodsReq) @Opcodes(PacketOpcodes.BuyGoodsReq)
public class HandlerBuyGoodsReq extends PacketHandler { public class HandlerBuyGoodsReq extends PacketHandler {
...@@ -33,7 +34,7 @@ public class HandlerBuyGoodsReq extends PacketHandler { ...@@ -33,7 +34,7 @@ public class HandlerBuyGoodsReq extends PacketHandler {
return; return;
// Don't trust your users' input // Don't trust your users' input
List<Integer> targetShopGoodsId = buyGoodsReq.getGoodsListList().stream().map(ShopGoodsOuterClass.ShopGoods::getGoodsId).toList(); List<Integer> targetShopGoodsId = List.of(buyGoodsReq.getGoods().getGoodsId());
for (int goodsId : targetShopGoodsId) { for (int goodsId : targetShopGoodsId) {
Optional<ShopInfo> sg2 = configShop.stream().filter(x -> x.getGoodsId() == goodsId).findFirst(); Optional<ShopInfo> sg2 = configShop.stream().filter(x -> x.getGoodsId() == goodsId).findFirst();
if (sg2.isEmpty()) if (sg2.isEmpty())
...@@ -52,7 +53,7 @@ public class HandlerBuyGoodsReq extends PacketHandler { ...@@ -52,7 +53,7 @@ public class HandlerBuyGoodsReq extends PacketHandler {
session.getPlayer().save(); session.getPlayer().save();
} }
if ((bought + buyGoodsReq.getBoughtNum() > sg.getBuyLimit()) && sg.getBuyLimit() != 0) { if ((bought + buyGoodsReq.getBuyCount() > sg.getBuyLimit()) && sg.getBuyLimit() != 0) {
return; return;
} }
...@@ -60,15 +61,15 @@ public class HandlerBuyGoodsReq extends PacketHandler { ...@@ -60,15 +61,15 @@ public class HandlerBuyGoodsReq extends PacketHandler {
costs.add(new ItemParamData(202, sg.getScoin())); costs.add(new ItemParamData(202, sg.getScoin()));
costs.add(new ItemParamData(201, sg.getHcoin())); costs.add(new ItemParamData(201, sg.getHcoin()));
costs.add(new ItemParamData(203, sg.getMcoin())); costs.add(new ItemParamData(203, sg.getMcoin()));
if (!session.getPlayer().getInventory().payItems(costs.toArray(new ItemParamData[0]), buyGoodsReq.getBoughtNum())) { if (!session.getPlayer().getInventory().payItems(costs.toArray(new ItemParamData[0]), buyGoodsReq.getBuyCount())) {
return; return;
} }
session.getPlayer().addShopLimit(sg.getGoodsId(), buyGoodsReq.getBoughtNum(), ShopManager.getShopNextRefreshTime(sg)); session.getPlayer().addShopLimit(sg.getGoodsId(), buyGoodsReq.getBuyCount(), ShopManager.getShopNextRefreshTime(sg));
GameItem item = new GameItem(GameData.getItemDataMap().get(sg.getGoodsItem().getId())); GameItem item = new GameItem(GameData.getItemDataMap().get(sg.getGoodsItem().getId()));
item.setCount(buyGoodsReq.getBoughtNum() * sg.getGoodsItem().getCount()); item.setCount(buyGoodsReq.getBuyCount() * sg.getGoodsItem().getCount());
session.getPlayer().getInventory().addItem(item, ActionReason.Shop, true); // fix: not notify when got virtual item from shop session.getPlayer().getInventory().addItem(item, ActionReason.Shop, true); // fix: not notify when got virtual item from shop
session.send(new PacketBuyGoodsRsp(buyGoodsReq.getShopType(), session.getPlayer().getGoodsLimit(sg.getGoodsId()).getHasBoughtInPeriod(), buyGoodsReq.getGoodsListList().stream().filter(x -> x.getGoodsId() == goodsId).findFirst().get())); session.send(new PacketBuyGoodsRsp(buyGoodsReq.getShopType(), session.getPlayer().getGoodsLimit(sg.getGoodsId()).getHasBoughtInPeriod(), Stream.of(buyGoodsReq.getGoods()).filter(x -> x.getGoodsId() == goodsId).findFirst().get()));
} }
session.getPlayer().save(); session.getPlayer().save();
......
...@@ -28,12 +28,12 @@ public class HandlerCombatInvocationsNotify extends PacketHandler { ...@@ -28,12 +28,12 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
CombatInvocationsNotify notif = CombatInvocationsNotify.parseFrom(payload); CombatInvocationsNotify notif = CombatInvocationsNotify.parseFrom(payload);
for (CombatInvokeEntry entry : notif.getInvokeListList()) { for (CombatInvokeEntry entry : notif.getInvokeListList()) {
switch (entry.getArgumentType()) { switch (entry.getArgumentType()) {
case COMBAT_EVT_BEING_HIT: case COMBAT_TYPE_ARGUMENT_EVT_BEING_HIT:
// Handle damage // Handle damage
EvtBeingHitInfo hitInfo = EvtBeingHitInfo.parseFrom(entry.getCombatData()); EvtBeingHitInfo hitInfo = EvtBeingHitInfo.parseFrom(entry.getCombatData());
session.getPlayer().getAttackResults().add(hitInfo.getAttackResult()); session.getPlayer().getAttackResults().add(hitInfo.getAttackResult());
break; break;
case ENTITY_MOVE: case COMBAT_TYPE_ARGUMENT_ENTITY_MOVE:
// Handle movement // Handle movement
EntityMoveInfo moveInfo = EntityMoveInfo.parseFrom(entry.getCombatData()); EntityMoveInfo moveInfo = EntityMoveInfo.parseFrom(entry.getCombatData());
GameEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId()); GameEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId());
...@@ -55,13 +55,13 @@ public class HandlerCombatInvocationsNotify extends PacketHandler { ...@@ -55,13 +55,13 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
// MOTION_LAND_SPEED and MOTION_FALL_ON_GROUND arrive in different packets. // MOTION_LAND_SPEED and MOTION_FALL_ON_GROUND arrive in different packets.
// Cache land speed for later use. // Cache land speed for later use.
if (motionState == MotionState.MOTION_LAND_SPEED) { if (motionState == MotionState.MOTION_STATE_LAND_SPEED) {
cachedLandingSpeed = motionInfo.getSpeed().getY(); cachedLandingSpeed = motionInfo.getSpeed().getY();
cachedLandingTimeMillisecond = System.currentTimeMillis(); cachedLandingTimeMillisecond = System.currentTimeMillis();
monitorLandingEvent = true; monitorLandingEvent = true;
} }
if (monitorLandingEvent) { if (monitorLandingEvent) {
if (motionState == MotionState.MOTION_FALL_ON_GROUND) { if (motionState == MotionState.MOTION_STATE_FALL_ON_GROUND) {
monitorLandingEvent = false; monitorLandingEvent = false;
handleFallOnGround(session, entity, motionState); handleFallOnGround(session, entity, motionState);
} }
...@@ -119,7 +119,7 @@ public class HandlerCombatInvocationsNotify extends PacketHandler { ...@@ -119,7 +119,7 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, newHP); entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, newHP);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP)); entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP));
if (newHP == 0) { if (newHP == 0) {
session.getPlayer().getStaminaManager().killAvatar(session, entity, PlayerDieTypeOuterClass.PlayerDieType.PLAYER_DIE_FALL); session.getPlayer().getStaminaManager().killAvatar(session, entity, PlayerDieTypeOuterClass.PlayerDieType.PLAYER_DIE_TYPE_FALL);
} }
cachedLandingSpeed = 0; cachedLandingSpeed = 0;
} }
......
...@@ -16,6 +16,6 @@ public class HandlerCreateVehicleReq extends PacketHandler { ...@@ -16,6 +16,6 @@ public class HandlerCreateVehicleReq 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 {
CreateVehicleReqOuterClass.CreateVehicleReq req = CreateVehicleReqOuterClass.CreateVehicleReq.parseFrom(payload); CreateVehicleReqOuterClass.CreateVehicleReq req = CreateVehicleReqOuterClass.CreateVehicleReq.parseFrom(payload);
session.send(new PacketCreateVehicleRsp(session.getPlayer(), req.getVehicleId(), req.getPointId(), new Position(req.getPos()), new Position(req.getRot()))); session.send(new PacketCreateVehicleRsp(session.getPlayer(), req.getVehicleId(), req.getScenePointId(), new Position(req.getPos()), new Position(req.getRot())));
} }
} }
...@@ -16,6 +16,6 @@ public class HandlerGetAllMailReq extends PacketHandler { ...@@ -16,6 +16,6 @@ public class HandlerGetAllMailReq 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 {
GetAllMailReqOuterClass.GetAllMailReq req = GetAllMailReqOuterClass.GetAllMailReq.parseFrom(payload); GetAllMailReqOuterClass.GetAllMailReq req = GetAllMailReqOuterClass.GetAllMailReq.parseFrom(payload);
session.send(new PacketGetAllMailRsp(session.getPlayer(), req.getIsGiftMail())); session.send(new PacketGetAllMailRsp(session.getPlayer(), req.getANKKGPJCINB()));
} }
} }
...@@ -15,13 +15,13 @@ public class HandlerMcoinExchangeHcoinReq extends PacketHandler { ...@@ -15,13 +15,13 @@ public class HandlerMcoinExchangeHcoinReq extends PacketHandler {
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
McoinExchangeHcoinReqOuterClass.McoinExchangeHcoinReq exchangeReq = McoinExchangeHcoinReqOuterClass.McoinExchangeHcoinReq.parseFrom(payload); McoinExchangeHcoinReqOuterClass.McoinExchangeHcoinReq exchangeReq = McoinExchangeHcoinReqOuterClass.McoinExchangeHcoinReq.parseFrom(payload);
if (session.getPlayer().getCrystals() < exchangeReq.getMCoinNum() && exchangeReq.getMCoinNum() == exchangeReq.getHCoinNum()) { if (session.getPlayer().getCrystals() < exchangeReq.getMcoinCost() && exchangeReq.getMcoinCost() == exchangeReq.getHcoin()) {
session.send(new PacketMcoinExchangeHcoinRsp(RetcodeOuterClass.Retcode.RET_UNKNOWN_ERROR_VALUE)); session.send(new PacketMcoinExchangeHcoinRsp(RetcodeOuterClass.Retcode.RET_UNKNOWN_ERROR_VALUE));
return; return;
} }
session.getPlayer().setCrystals(session.getPlayer().getCrystals() - exchangeReq.getMCoinNum()); session.getPlayer().setCrystals(session.getPlayer().getCrystals() - exchangeReq.getMcoinCost());
session.getPlayer().setPrimogems(session.getPlayer().getPrimogems() + exchangeReq.getHCoinNum()); session.getPlayer().setPrimogems(session.getPlayer().getPrimogems() + exchangeReq.getHcoin());
session.getPlayer().save(); session.getPlayer().save();
session.send(new PacketMcoinExchangeHcoinRsp(RetcodeOuterClass.Retcode.RET_SUCC_VALUE)); session.send(new PacketMcoinExchangeHcoinRsp(RetcodeOuterClass.Retcode.RET_SUCC_VALUE));
} }
......
...@@ -21,7 +21,7 @@ public class HandlerSetWidgetSlotReq extends PacketHandler { ...@@ -21,7 +21,7 @@ public class HandlerSetWidgetSlotReq extends PacketHandler {
player.setWidgetId(req.getMaterialId()); player.setWidgetId(req.getMaterialId());
// WidgetSlotChangeNotify op & slot key // WidgetSlotChangeNotify op & slot key
session.send(new PacketWidgetSlotChangeNotify(WidgetSlotOpOuterClass.WidgetSlotOp.DETACH)); session.send(new PacketWidgetSlotChangeNotify(WidgetSlotOpOuterClass.WidgetSlotOp.WIDGET_SLOT_OP_DETACH));
// WidgetSlotChangeNotify slot // WidgetSlotChangeNotify slot
session.send(new PacketWidgetSlotChangeNotify(req.getMaterialId())); session.send(new PacketWidgetSlotChangeNotify(req.getMaterialId()));
......
...@@ -46,7 +46,7 @@ public class PacketAllWidgetDataNotify extends BasePacket { ...@@ -46,7 +46,7 @@ public class PacketAllWidgetDataNotify extends BasePacket {
proto.addSlotList( proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder() WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_ATTACH_AVATAR) .setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_TAG_ATTACH_AVATAR)
.build() .build()
); );
} }
......
...@@ -11,7 +11,7 @@ public class PacketBuyGoodsRsp extends BasePacket { ...@@ -11,7 +11,7 @@ public class PacketBuyGoodsRsp extends BasePacket {
BuyGoodsRspOuterClass.BuyGoodsRsp buyGoodsRsp = BuyGoodsRspOuterClass.BuyGoodsRsp.newBuilder() BuyGoodsRspOuterClass.BuyGoodsRsp buyGoodsRsp = BuyGoodsRspOuterClass.BuyGoodsRsp.newBuilder()
.setShopType(shopType) .setShopType(shopType)
.setBoughtNum(boughtNum) .setBuyCount(boughtNum)
.addGoodsList(ShopGoodsOuterClass.ShopGoods.newBuilder() .addGoodsList(ShopGoodsOuterClass.ShopGoods.newBuilder()
.mergeFrom(sg) .mergeFrom(sg)
.setBoughtNum(boughtNum) .setBoughtNum(boughtNum)
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.entity.EntityVehicle; import emu.grasscutter.game.entity.EntityVehicle;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
...@@ -9,6 +8,7 @@ import emu.grasscutter.game.entity.GameEntity; ...@@ -9,6 +8,7 @@ import emu.grasscutter.game.entity.GameEntity;
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.VehicleInteractTypeOuterClass;
import emu.grasscutter.net.proto.VehicleMemberOuterClass.VehicleMember; import emu.grasscutter.net.proto.VehicleMemberOuterClass.VehicleMember;
import emu.grasscutter.net.proto.CreateVehicleRspOuterClass.CreateVehicleRsp; import emu.grasscutter.net.proto.CreateVehicleRspOuterClass.CreateVehicleRsp;
...@@ -16,9 +16,6 @@ import emu.grasscutter.utils.Position; ...@@ -16,9 +16,6 @@ import emu.grasscutter.utils.Position;
import java.util.List; import java.util.List;
import static emu.grasscutter.net.proto.VehicleInteractTypeOuterClass.VehicleInteractType.VEHICLE_INTERACT_OUT;
public class PacketCreateVehicleRsp extends BasePacket { public class PacketCreateVehicleRsp extends BasePacket {
public PacketCreateVehicleRsp(Player player, int vehicleId, int pointId, Position pos, Position rot) { public PacketCreateVehicleRsp(Player player, int vehicleId, int pointId, Position pos, Position rot) {
...@@ -36,7 +33,7 @@ public class PacketCreateVehicleRsp extends BasePacket { ...@@ -36,7 +33,7 @@ public class PacketCreateVehicleRsp extends BasePacket {
List<VehicleMember> vehicleMembers = ((EntityVehicle) entity).getVehicleMembers().stream().toList(); List<VehicleMember> vehicleMembers = ((EntityVehicle) entity).getVehicleMembers().stream().toList();
vehicleMembers.stream().forEach(vehicleMember -> { vehicleMembers.stream().forEach(vehicleMember -> {
player.getScene().broadcastPacket(new PacketVehicleInteractRsp(((EntityVehicle) entity), vehicleMember, VEHICLE_INTERACT_OUT)); player.getScene().broadcastPacket(new PacketVehicleInteractRsp(((EntityVehicle) entity), vehicleMember, VehicleInteractTypeOuterClass.VehicleInteractType.VEHICLE_INTERACT_TYPE_OUT));
}); });
player.getScene().killEntity(entity, 0); player.getScene().killEntity(entity, 0);
......
...@@ -13,7 +13,7 @@ public class PacketDungeonChallengeFinishNotify extends BasePacket { ...@@ -13,7 +13,7 @@ public class PacketDungeonChallengeFinishNotify extends BasePacket {
DungeonChallengeFinishNotify proto = DungeonChallengeFinishNotify.newBuilder() DungeonChallengeFinishNotify proto = DungeonChallengeFinishNotify.newBuilder()
.setChallengeIndex(challenge.getChallengeIndex()) .setChallengeIndex(challenge.getChallengeIndex())
.setIsSuccess(challenge.isSuccess()) .setIsSuccess(challenge.isSuccess())
.setUnk1(2) .setChallengeRecordType(2)
.build(); .build();
this.setData(proto); this.setData(proto);
......
...@@ -29,10 +29,10 @@ public class PacketDungeonSettleNotify extends BasePacket { ...@@ -29,10 +29,10 @@ public class PacketDungeonSettleNotify extends BasePacket {
) { ) {
super(PacketOpcodes.DungeonSettleNotify); super(PacketOpcodes.DungeonSettleNotify);
var continueStatus = TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_CAN_NOT_CONTINUE_VALUE; var continueStatus = TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_TYPE_CAN_NOT_CONTINUE_VALUE;
if(challenge.isSuccess() && canJump){ if(challenge.isSuccess() && canJump){
continueStatus = hasNextLevel ? TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_CAN_ENTER_NEXT_LEVEL_VALUE continueStatus = hasNextLevel ? TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_TYPE_CAN_ENTER_NEXT_LEVEL_VALUE
: TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_CAN_ENTER_NEXT_FLOOR_VALUE; : TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_TYPE_CAN_ENTER_NEXT_FLOOR_VALUE;
} }
var towerLevelEndNotify = TowerLevelEndNotify.newBuilder() var towerLevelEndNotify = TowerLevelEndNotify.newBuilder()
......
...@@ -12,7 +12,7 @@ public class PacketEvtAvatarStandUpNotify extends BasePacket { ...@@ -12,7 +12,7 @@ public class PacketEvtAvatarStandUpNotify extends BasePacket {
EvtAvatarStandUpNotify proto = EvtAvatarStandUpNotify.newBuilder() EvtAvatarStandUpNotify proto = EvtAvatarStandUpNotify.newBuilder()
.setEntityId(notify.getEntityId()) .setEntityId(notify.getEntityId())
.setDirection(notify.getDirection()) .setDirection(notify.getDirection())
.setPerformID(notify.getPerformID()) .setPerformId(notify.getPerformId())
.setChairId(notify.getChairId()) .setChairId(notify.getChairId())
.build(); .build();
......
...@@ -5,6 +5,7 @@ import emu.grasscutter.game.mail.Mail; ...@@ -5,6 +5,7 @@ import emu.grasscutter.game.mail.Mail;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
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.EquipParamOuterClass;
import emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp; import emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp;
import emu.grasscutter.net.proto.ItemParamOuterClass; import emu.grasscutter.net.proto.ItemParamOuterClass;
import emu.grasscutter.net.proto.MailDataOuterClass; import emu.grasscutter.net.proto.MailDataOuterClass;
...@@ -23,9 +24,9 @@ public class PacketGetAllMailRsp extends BasePacket { ...@@ -23,9 +24,9 @@ public class PacketGetAllMailRsp extends BasePacket {
GetAllMailRsp.Builder proto = GetAllMailRsp.newBuilder(); GetAllMailRsp.Builder proto = GetAllMailRsp.newBuilder();
if (isGiftMail) { if (isGiftMail) {
proto.setIsGiftMail(true); proto.setANKKGPJCINB(true);
} else { } else {
proto.setIsGiftMail(false); proto.setANKKGPJCINB(false);
if (player.getAllMail().size() != 0) { // Make sure the player has mail if (player.getAllMail().size() != 0) { // Make sure the player has mail
List<MailData> mailDataList = new ArrayList<MailData>(); List<MailData> mailDataList = new ArrayList<MailData>();
...@@ -43,10 +44,10 @@ public class PacketGetAllMailRsp extends BasePacket { ...@@ -43,10 +44,10 @@ public class PacketGetAllMailRsp extends BasePacket {
for (Mail.MailItem item : message.itemList) { for (Mail.MailItem item : message.itemList) {
MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder(); MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder();
ItemParamOuterClass.ItemParam.Builder itemParam = ItemParamOuterClass.ItemParam.newBuilder(); EquipParamOuterClass.EquipParam.Builder itemParam = EquipParamOuterClass.EquipParam.newBuilder();
itemParam.setItemId(item.itemId); itemParam.setItemId(item.itemId);
itemParam.setCount(item.itemCount); itemParam.setItemNum(item.itemCount);
mailItem.setItemParam(itemParam.build()); mailItem.setEquipParam(itemParam.build());
mailItems.add(mailItem.build()); mailItems.add(mailItem.build());
} }
...@@ -60,7 +61,7 @@ public class PacketGetAllMailRsp extends BasePacket { ...@@ -60,7 +61,7 @@ public class PacketGetAllMailRsp extends BasePacket {
mailData.setImportance(message.importance); mailData.setImportance(message.importance);
mailData.setIsRead(message.isRead); mailData.setIsRead(message.isRead);
mailData.setIsAttachmentGot(message.isAttachmentGot); mailData.setIsAttachmentGot(message.isAttachmentGot);
mailData.setStateValue(1); mailData.setBHCAHLJIKFFValue(1);
mailDataList.add(mailData.build()); mailDataList.add(mailData.build());
} }
......
...@@ -28,10 +28,10 @@ public class PacketGetPlayerFriendListRsp extends BasePacket { ...@@ -28,10 +28,10 @@ public class PacketGetPlayerFriendListRsp extends BasePacket {
.setSignature(serverAccount.signature) .setSignature(serverAccount.signature)
.setLastActiveTime((int) (System.currentTimeMillis() / 1000f)) .setLastActiveTime((int) (System.currentTimeMillis() / 1000f))
.setNameCardId(serverAccount.nameCardId) .setNameCardId(serverAccount.nameCardId)
.setOnlineState(FriendOnlineState.FRIEND_ONLINE) .setOnlineState(FriendOnlineState.FRIEND_ONLINE_STATE_ONLINE)
.setParam(1) .setParam(1)
.setIsGameSource(true) .setIsGameSource(true)
.setPlatformType(PlatformTypeOuterClass.PlatformType.PC) .setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC)
.build(); .build();
GetPlayerFriendListRsp.Builder proto = GetPlayerFriendListRsp.newBuilder().addFriendList(serverFriend); GetPlayerFriendListRsp.Builder proto = GetPlayerFriendListRsp.newBuilder().addFriendList(serverFriend);
......
...@@ -29,7 +29,7 @@ public class PacketGetWidgetSlotRsp extends BasePacket { ...@@ -29,7 +29,7 @@ public class PacketGetWidgetSlotRsp extends BasePacket {
proto.addSlotList( proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder() WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_ATTACH_AVATAR) .setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_TAG_ATTACH_AVATAR)
.build() .build()
); );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment