Commit a8293102 authored by Melledy's avatar Melledy Committed by GitHub
Browse files

Merge branch 'development' into stable

parents 304b9cb8 ecf7a81a
...@@ -15,5 +15,14 @@ public class HandlerUnionCmdNotify extends PacketHandler { ...@@ -15,5 +15,14 @@ public class HandlerUnionCmdNotify extends PacketHandler {
for (UnionCmd cmd : req.getCmdListList()) { for (UnionCmd cmd : req.getCmdListList()) {
session.getServer().getPacketHandler().handle(session, cmd.getMessageId(), EMPTY_BYTE_ARRAY, cmd.getBody().toByteArray()); session.getServer().getPacketHandler().handle(session, cmd.getMessageId(), EMPTY_BYTE_ARRAY, cmd.getBody().toByteArray());
} }
// Update
session.getPlayer().getCombatInvokeHandler().update(session.getPlayer());
session.getPlayer().getAbilityInvokeHandler().update(session.getPlayer());
// Handle attack results last
while (!session.getPlayer().getAttackResults().isEmpty()) {
session.getPlayer().getScene().handleAttack(session.getPlayer().getAttackResults().poll());
}
} }
} }
...@@ -14,6 +14,7 @@ public class HandlerVehicleInteractReq extends PacketHandler { ...@@ -14,6 +14,7 @@ public class HandlerVehicleInteractReq 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 {
VehicleInteractReqOuterClass.VehicleInteractReq req = VehicleInteractReqOuterClass.VehicleInteractReq.parseFrom(payload); VehicleInteractReqOuterClass.VehicleInteractReq req = VehicleInteractReqOuterClass.VehicleInteractReq.parseFrom(payload);
session.getPlayer().getStaminaManager().handleVehicleInteractReq(session, req.getEntityId(), req.getInteractType());
session.send(new PacketVehicleInteractRsp(session.getPlayer(), req.getEntityId(), req.getInteractType())); session.send(new PacketVehicleInteractRsp(session.getPlayer(), req.getEntityId(), req.getInteractType()));
} }
} }
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.GadgetData;
import emu.grasscutter.game.entity.EntityVehicle;
import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.props.LifeState;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.*;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
import emu.grasscutter.server.packet.send.PacketWidgetCoolDownNotify;
import emu.grasscutter.server.packet.send.PacketWidgetDoBagRsp;
import emu.grasscutter.server.packet.send.PacketWidgetGadgetDataNotify;
import emu.grasscutter.utils.Position;
import java.util.List;
@Opcodes(PacketOpcodes.WidgetDoBagReq)
public class HandlerWidgetDoBagReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
WidgetDoBagReqOuterClass.WidgetDoBagReq req = WidgetDoBagReqOuterClass.WidgetDoBagReq.parseFrom(payload);
switch (req.getMaterialId()) {
case 220026 -> {
GadgetData gadgetData = GameData.getGadgetDataMap().get(70500025);
Position pos = new Position(req.getWidgetCreatorInfo().getLocationInfo().getPos());
Position rot = new Position(req.getWidgetCreatorInfo().getLocationInfo().getRot());
GameEntity entity = new EntityVehicle(
session.getPlayer().getScene(),
session.getPlayer(),
gadgetData.getId(),
0,
pos,
rot
);
session.getPlayer().getScene().addEntity(entity);
session.send(new PacketWidgetGadgetDataNotify(70500025, List.of(entity.getId()))); // ???
session.send(new PacketWidgetCoolDownNotify(15, System.currentTimeMillis() + 5000L, true));
session.send(new PacketWidgetCoolDownNotify(15, System.currentTimeMillis() + 5000L, true));
// Send twice, and I don't know why, Ask mhy
session.send(new PacketWidgetDoBagRsp());
}
default -> {
session.send(new PacketWidgetDoBagRsp());
}
}
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AllWidgetDataNotifyOuterClass.AllWidgetDataNotify;
import emu.grasscutter.net.proto.LunchBoxDataOuterClass;
import emu.grasscutter.net.proto.WidgetSlotDataOuterClass;
import emu.grasscutter.net.proto.WidgetSlotTagOuterClass;
import java.util.List;
import java.util.Map;
public class PacketAllWidgetDataNotify extends BasePacket {
public PacketAllWidgetDataNotify(Player player) {
super(PacketOpcodes.AllWidgetDataNotify);
// TODO: Implement this
AllWidgetDataNotify.Builder proto = AllWidgetDataNotify.newBuilder()
// If you want to implement this, feel free to do so. :)
.setLunchBoxData(
LunchBoxDataOuterClass.LunchBoxData.newBuilder().build()
)
// Maybe it's a little difficult, or it makes you upset :(
.addAllOneoffGatherPointDetectorDataList(List.of())
// So, goodbye, and hopefully sometime in the future o(* ̄▽ ̄*)ブ
.addAllCoolDownGroupDataList(List.of())
// I'll see your PR with a title that says (・∀・(・∀・(・∀・*)
.addAllAnchorPointList(List.of())
// "Complete implementation of widget functionality" b( ̄▽ ̄)d 
.addAllClientCollectorDataList(List.of())
// Good luck, my boy.
.addAllNormalCoolDownDataList(List.of());
if (player.getWidgetId() == null) {
proto.addAllSlotList(List.of());
} else {
proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setIsActive(true)
.setMaterialId(player.getWidgetId())
.build()
);
proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_TAG_ATTACH_AVATAR)
.build()
);
}
AllWidgetDataNotify protoData = proto.build();
this.setData(protoData);
}
}
...@@ -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;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.CanUseSkillNotifyOuterClass;
public class PacketCanUseSkillNotify extends BasePacket {
public PacketCanUseSkillNotify(boolean canUseSkill) {
super(PacketOpcodes.CanUseSkillNotify);
CanUseSkillNotifyOuterClass.CanUseSkillNotify proto = CanUseSkillNotifyOuterClass.CanUseSkillNotify.newBuilder()
.setIsCanUseSkill(canUseSkill)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import java.util.Collections;
import emu.grasscutter.data.GameData;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.CodexDataFullNotifyOuterClass.CodexDataFullNotify;
import emu.grasscutter.net.proto.CodexTypeDataOuterClass.CodexTypeData;
public class PacketCodexDataFullNotify extends BasePacket {
public PacketCodexDataFullNotify(Player player) {
super(PacketOpcodes.CodexDataFullNotify, true);
//Quests
CodexTypeData.Builder questTypeData = CodexTypeData.newBuilder()
.setTypeValue(1);
//Weapons
CodexTypeData.Builder weaponTypeData = CodexTypeData.newBuilder()
.setTypeValue(2);
//Animals
CodexTypeData.Builder animalTypeData = CodexTypeData.newBuilder()
.setTypeValue(3);
//Materials
CodexTypeData.Builder materialTypeData = CodexTypeData.newBuilder()
.setTypeValue(4);
//Books
CodexTypeData.Builder bookTypeData = CodexTypeData.newBuilder()
.setTypeValue(5);
//Tips
CodexTypeData.Builder pushTipsTypeData = CodexTypeData.newBuilder()
.setTypeValue(6);
//Views
CodexTypeData.Builder viewTypeData = CodexTypeData.newBuilder()
.setTypeValue(7);
//Reliquary
CodexTypeData.Builder reliquaryData = CodexTypeData.newBuilder()
.setTypeValue(8);
player.getQuestManager().forEachMainQuest(mainQuest -> {
if(mainQuest.isFinished()){
var codexQuest = GameData.getCodexQuestDataIdMap().get(mainQuest.getParentQuestId());
if(codexQuest != null){
questTypeData.addCodexIdList(codexQuest.getId()).addAllHaveViewedList(Collections.singleton(true));
}
}
});
player.getCodex().getUnlockedWeapon().forEach(weapon -> {
var codexWeapon = GameData.getCodexWeaponDataIdMap().get(weapon);
if(codexWeapon != null){
weaponTypeData.addCodexIdList(codexWeapon.getId()).addAllHaveViewedList(Collections.singleton(true));
}
});
player.getCodex().getUnlockedAnimal().forEach((animal, amount) -> {
var codexAnimal = GameData.getCodexAnimalDataMap().get(animal);
if(codexAnimal != null){
animalTypeData.addCodexIdList(codexAnimal.getId()).addAllHaveViewedList(Collections.singleton(true));
}
});
player.getCodex().getUnlockedMaterial().forEach(material -> {
var codexMaterial = GameData.getCodexMaterialDataIdMap().get(material);
if(codexMaterial != null){
materialTypeData.addCodexIdList(codexMaterial.getId()).addAllHaveViewedList(Collections.singleton(true));
}
});
player.getCodex().getUnlockedReliquarySuitCodex().forEach(reliquarySuit -> {
reliquaryData.addCodexIdList(reliquarySuit).addAllHaveViewedList(Collections.singleton(true));
});
CodexDataFullNotify.Builder proto = CodexDataFullNotify.newBuilder()
.addTypeDataList(questTypeData.build())
.addTypeDataList(weaponTypeData)
.addTypeDataList(animalTypeData)
.addTypeDataList(materialTypeData)
.addTypeDataList(bookTypeData)
.addTypeDataList(pushTipsTypeData.build())
.addTypeDataList(viewTypeData.build())
.addTypeDataList(reliquaryData);
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.data.GameData;
import emu.grasscutter.game.quest.GameMainQuest;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.CodexDataUpdateNotifyOuterClass.CodexDataUpdateNotify;
public class PacketCodexDataUpdateNotify extends BasePacket {
public PacketCodexDataUpdateNotify(GameMainQuest quest) {
super(PacketOpcodes.CodexDataUpdateNotify, true);
var codexQuest = GameData.getCodexQuestDataIdMap().get(quest.getParentQuestId());
if(codexQuest != null){
CodexDataUpdateNotify proto = CodexDataUpdateNotify.newBuilder()
.setTypeValue(1)
.setId(codexQuest.getId())
.build();
this.setData(proto);
}
}
public PacketCodexDataUpdateNotify(int typeValue, int codexId){
super(PacketOpcodes.CodexDataUpdateNotify, true);
CodexDataUpdateNotify proto = CodexDataUpdateNotify.newBuilder()
.setTypeValue(typeValue)
.setId(codexId)
.build();
this.setData(proto);
}
}
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,21 +8,19 @@ import emu.grasscutter.game.entity.GameEntity; ...@@ -9,21 +8,19 @@ 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.VehicleSpawnRspOuterClass.VehicleSpawnRsp; import emu.grasscutter.net.proto.CreateVehicleRspOuterClass.CreateVehicleRsp;
import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Position;
import java.util.List; import java.util.List;
public class PacketCreateVehicleRsp extends BasePacket {
import static emu.grasscutter.net.proto.VehicleInteractTypeOuterClass.VehicleInteractType.VEHICLE_INTERACT_OUT; public PacketCreateVehicleRsp(Player player, int vehicleId, int pointId, Position pos, Position rot) {
super(PacketOpcodes.CreateVehicleRsp);
public class PacketVehicleSpawnRsp extends BasePacket { CreateVehicleRsp.Builder proto = CreateVehicleRsp.newBuilder();
public PacketVehicleSpawnRsp(Player player, int vehicleId, int pointId, Position pos, Position rot) {
super(PacketOpcodes.VehicleSpawnRsp);
VehicleSpawnRsp.Builder proto = VehicleSpawnRsp.newBuilder();
// Eject vehicle members and Kill previous vehicles if there are any // Eject vehicle members and Kill previous vehicles if there are any
List<GameEntity> previousVehicles = player.getScene().getEntities().values().stream() List<GameEntity> previousVehicles = player.getScene().getEntities().values().stream()
...@@ -36,7 +33,7 @@ public class PacketVehicleSpawnRsp extends BasePacket { ...@@ -36,7 +33,7 @@ public class PacketVehicleSpawnRsp 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);
......
...@@ -2,6 +2,7 @@ package emu.grasscutter.server.packet.send; ...@@ -2,6 +2,7 @@ package emu.grasscutter.server.packet.send;
import java.util.List; import java.util.List;
import emu.grasscutter.data.common.ItemParamData;
import emu.grasscutter.game.gacha.GachaBanner; import emu.grasscutter.game.gacha.GachaBanner;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
...@@ -14,16 +15,18 @@ public class PacketDoGachaRsp extends BasePacket { ...@@ -14,16 +15,18 @@ public class PacketDoGachaRsp extends BasePacket {
public PacketDoGachaRsp(GachaBanner banner, List<GachaItem> list) { public PacketDoGachaRsp(GachaBanner banner, List<GachaItem> list) {
super(PacketOpcodes.DoGachaRsp); super(PacketOpcodes.DoGachaRsp);
ItemParamData costItem = banner.getCost(1);
ItemParamData costItem10 = banner.getCost(10);
DoGachaRsp p = DoGachaRsp.newBuilder() DoGachaRsp p = DoGachaRsp.newBuilder()
.setGachaType(banner.getGachaType()) .setGachaType(banner.getGachaType())
.setGachaScheduleId(banner.getScheduleId()) .setGachaScheduleId(banner.getScheduleId())
.setGachaTimes(list.size()) .setGachaTimes(list.size())
.setNewGachaRandom(12345) .setNewGachaRandom(12345)
.setLeftGachaTimes(Integer.MAX_VALUE) .setLeftGachaTimes(Integer.MAX_VALUE)
.setCostItemId(banner.getCostItem()) .setCostItemId(costItem.getId())
.setCostItemNum(1) .setCostItemNum(costItem.getCount())
.setTenCostItemId(banner.getCostItem()) .setTenCostItemId(costItem10.getId())
.setTenCostItemNum(10) .setTenCostItemNum(costItem10.getCount())
.addAllGachaItemList(list) .addAllGachaItemList(list)
.build(); .build();
......
...@@ -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()
...@@ -46,7 +46,7 @@ public class PacketDungeonSettleNotify extends BasePacket { ...@@ -46,7 +46,7 @@ public class PacketDungeonSettleNotify extends BasePacket {
.setCount(1000) .setCount(1000)
.build()) .build())
; ;
if(nextFloorId > 0){ if(nextFloorId > 0 && canJump){
towerLevelEndNotify.setNextFloorId(nextFloorId); towerLevelEndNotify.setNextFloorId(nextFloorId);
} }
......
...@@ -13,7 +13,7 @@ public class PacketEntityAiSyncNotify extends BasePacket { ...@@ -13,7 +13,7 @@ public class PacketEntityAiSyncNotify extends BasePacket {
EntityAiSyncNotify.Builder proto = EntityAiSyncNotify.newBuilder(); EntityAiSyncNotify.Builder proto = EntityAiSyncNotify.newBuilder();
for (int monsterId : notify.getLocalAvatarAlertedMonsterListList()) { for (int monsterId : notify.getLocalAvatarAlertedMonsterListList()) {
proto.addInfoList(AiSyncInfo.newBuilder().setEntityId(monsterId)); proto.addInfoList(AiSyncInfo.newBuilder().setEntityId(monsterId).setHasPathToTarget(true));
} }
this.setData(proto); this.setData(proto);
......
...@@ -11,21 +11,27 @@ import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason; ...@@ -11,21 +11,27 @@ import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason;
import java.util.List; import java.util.List;
public class PacketEntityFightPropChangeReasonNotify extends BasePacket { public class PacketEntityFightPropChangeReasonNotify extends BasePacket {
public PacketEntityFightPropChangeReasonNotify(GameEntity entity, FightProperty prop, Float value, List<Integer> param, PropChangeReason reason, ChangeHpReason changeHpReason) { public PacketEntityFightPropChangeReasonNotify(GameEntity entity, FightProperty prop, Float value, List<Integer> param, PropChangeReason reason, ChangeHpReason changeHpReason) {
super(PacketOpcodes.EntityFightPropChangeReasonNotify); super(PacketOpcodes.EntityFightPropChangeReasonNotify);
EntityFightPropChangeReasonNotify.Builder proto = EntityFightPropChangeReasonNotify.newBuilder() EntityFightPropChangeReasonNotify.Builder proto = EntityFightPropChangeReasonNotify.newBuilder()
.setEntityId(entity.getId()) .setEntityId(entity.getId())
.setPropType(prop.getId()) .setPropType(prop.getId())
.setPropDelta(value) .setPropDelta(value)
.setReason(reason) .setReason(reason)
.setChangeHpReason(changeHpReason); .setChangeHpReason(changeHpReason);
for(int p: param){
for(int p : param){
proto.addParamList(p); proto.addParamList(p);
} }
this.setData(proto); this.setData(proto);
} }
public PacketEntityFightPropChangeReasonNotify(GameEntity entity, FightProperty prop, Float value, PropChangeReason reason, ChangeHpReason changeHpReason) { public PacketEntityFightPropChangeReasonNotify(GameEntity entity, FightProperty prop, Float value, PropChangeReason reason, ChangeHpReason changeHpReason) {
super(PacketOpcodes.EntityFightPropChangeReasonNotify); super(PacketOpcodes.EntityFightPropChangeReasonNotify);
EntityFightPropChangeReasonNotify proto = EntityFightPropChangeReasonNotify.newBuilder() EntityFightPropChangeReasonNotify proto = EntityFightPropChangeReasonNotify.newBuilder()
.setEntityId(entity.getId()) .setEntityId(entity.getId())
.setPropType(prop.getId()) .setPropType(prop.getId())
...@@ -33,6 +39,20 @@ public class PacketEntityFightPropChangeReasonNotify extends BasePacket { ...@@ -33,6 +39,20 @@ public class PacketEntityFightPropChangeReasonNotify extends BasePacket {
.setReason(reason) .setReason(reason)
.setChangeHpReason(changeHpReason) .setChangeHpReason(changeHpReason)
.build(); .build();
this.setData(proto);
}
public PacketEntityFightPropChangeReasonNotify(GameEntity entity, FightProperty prop, Float value, PropChangeReason reason) {
super(PacketOpcodes.EntityFightPropChangeReasonNotify);
EntityFightPropChangeReasonNotify proto = EntityFightPropChangeReasonNotify.newBuilder()
.setEntityId(entity.getId())
.setPropType(prop.getId())
.setPropDelta(value)
.setReason(reason)
.build();
this.setData(proto); this.setData(proto);
} }
} }
...@@ -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();
......
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);
}
}
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);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ForgeDataNotifyOuterClass.ForgeDataNotify;
public class PacketForgeDataNotify extends BasePacket {
public PacketForgeDataNotify(Player player) {
super(PacketOpcodes.ForgeDataNotify);
int adventureRank = player.getLevel();
int numQueues =
(adventureRank >= 15) ? 4
: (adventureRank >= 10) ? 3
: (adventureRank >= 5) ? 2
: 1;
ForgeDataNotify proto = ForgeDataNotify.newBuilder()
.addAllForgeIdList(player.getUnlockedForgingBlueprints())
.setMaxQueueNum(numQueues)
.build();
// ToDo: Add the information for the actual forging queues
// and ongoing forges.
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ForgeFormulaDataNotifyOuterClass.ForgeFormulaDataNotify;
public class PacketForgeFormulaDataNotify extends BasePacket {
public PacketForgeFormulaDataNotify(int itemId) {
super(PacketOpcodes.ForgeFormulaDataNotify);
ForgeFormulaDataNotify proto = ForgeFormulaDataNotify.newBuilder()
.setForgeId(itemId)
.setIsLocked(false)
.build();
this.setData(proto);
}
}
...@@ -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());
} }
......
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