Commit 01b190bc authored by Magix's avatar Magix Committed by GitHub
Browse files

UPGRADE TO 1.1.0 POG

Merge `development` into `stable`
parents 6b81b888 1beddf16
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetPlayerSocialDetailRspOuterClass.GetPlayerSocialDetailRsp; import emu.grasscutter.net.proto.GetPlayerSocialDetailRspOuterClass.GetPlayerSocialDetailRsp;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail; import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail;
public class PacketGetPlayerSocialDetailRsp extends GenshinPacket { public class PacketGetPlayerSocialDetailRsp extends BasePacket {
public PacketGetPlayerSocialDetailRsp(SocialDetail.Builder detail) { public PacketGetPlayerSocialDetailRsp(SocialDetail.Builder detail) {
super(PacketOpcodes.GetPlayerSocialDetailRsp); super(PacketOpcodes.GetPlayerSocialDetailRsp);
...@@ -15,7 +16,7 @@ public class PacketGetPlayerSocialDetailRsp extends GenshinPacket { ...@@ -15,7 +16,7 @@ public class PacketGetPlayerSocialDetailRsp extends GenshinPacket {
if (detail != null) { if (detail != null) {
proto.setDetailData(detail); proto.setDetailData(detail);
} else { } else {
proto.setRetcode(1); proto.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE);
} }
this.setData(proto); this.setData(proto);
......
...@@ -2,13 +2,13 @@ package emu.grasscutter.server.packet.send; ...@@ -2,13 +2,13 @@ package emu.grasscutter.server.packet.send;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetPlayerTokenRspOuterClass.GetPlayerTokenRsp; import emu.grasscutter.net.proto.GetPlayerTokenRspOuterClass.GetPlayerTokenRsp;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.utils.Crypto; import emu.grasscutter.utils.Crypto;
public class PacketGetPlayerTokenRsp extends GenshinPacket { public class PacketGetPlayerTokenRsp extends BasePacket {
public PacketGetPlayerTokenRsp(GameSession session, boolean doesPlayerExist) { public PacketGetPlayerTokenRsp(GameSession session, boolean doesPlayerExist) {
super(PacketOpcodes.GetPlayerTokenRsp, true); super(PacketOpcodes.GetPlayerTokenRsp, true);
...@@ -16,18 +16,18 @@ public class PacketGetPlayerTokenRsp extends GenshinPacket { ...@@ -16,18 +16,18 @@ public class PacketGetPlayerTokenRsp extends GenshinPacket {
this.setUseDispatchKey(true); this.setUseDispatchKey(true);
GetPlayerTokenRsp p = GetPlayerTokenRsp.newBuilder() GetPlayerTokenRsp p = GetPlayerTokenRsp.newBuilder()
.setPlayerUid(session.getAccount().getPlayerUid()) .setUid(session.getAccount().getPlayerUid())
.setAccountToken(session.getAccount().getToken()) .setToken(session.getAccount().getToken())
.setAccountType(1) .setAccountType(1)
.setIsProficientPlayer(doesPlayerExist) // Not sure where this goes .setIsProficientPlayer(doesPlayerExist) // Not sure where this goes
.setSecretKey(Crypto.ENCRYPT_SEED) .setSecretKeySeed(Crypto.ENCRYPT_SEED)
.setSecretKeyBuffer(ByteString.copyFrom(Crypto.ENCRYPT_SEED_BUFFER)) .setSecurityCmdBuffer(ByteString.copyFrom(Crypto.ENCRYPT_SEED_BUFFER))
.setPlatformType(3) .setPlatformType(3)
.setChannelId(1) .setChannelId(1)
.setCountryCode("US") .setCountryCode("US")
.setUnk1("c25-314dd05b0b5f") .setClientVersionRandomKey("c25-314dd05b0b5f")
.setUnk3(3) .setRegPlatform(3)
.setClientIp(session.getAddress().getAddress().getHostAddress()) .setClientIpStr(session.getAddress().getAddress().getHostAddress())
.build(); .build();
this.setData(p.toByteArray()); this.setData(p.toByteArray());
......
...@@ -3,12 +3,12 @@ package emu.grasscutter.server.packet.send; ...@@ -3,12 +3,12 @@ package emu.grasscutter.server.packet.send;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo; import emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo;
import emu.grasscutter.net.proto.GetSceneAreaRspOuterClass.GetSceneAreaRsp; import emu.grasscutter.net.proto.GetSceneAreaRspOuterClass.GetSceneAreaRsp;
public class PacketGetSceneAreaRsp extends GenshinPacket { public class PacketGetSceneAreaRsp extends BasePacket {
public PacketGetSceneAreaRsp(int sceneId) { public PacketGetSceneAreaRsp(int sceneId) {
super(PacketOpcodes.GetSceneAreaRsp); super(PacketOpcodes.GetSceneAreaRsp);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.data.GameData;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetScenePointRspOuterClass.GetScenePointRsp; import emu.grasscutter.net.proto.GetScenePointRspOuterClass.GetScenePointRsp;
public class PacketGetScenePointRsp extends GenshinPacket { public class PacketGetScenePointRsp extends BasePacket {
public PacketGetScenePointRsp(int sceneId) { public PacketGetScenePointRsp(int sceneId) {
super(PacketOpcodes.GetScenePointRsp); super(PacketOpcodes.GetScenePointRsp);
...@@ -12,8 +13,12 @@ public class PacketGetScenePointRsp extends GenshinPacket { ...@@ -12,8 +13,12 @@ public class PacketGetScenePointRsp extends GenshinPacket {
GetScenePointRsp.Builder p = GetScenePointRsp.newBuilder() GetScenePointRsp.Builder p = GetScenePointRsp.newBuilder()
.setSceneId(sceneId); .setSceneId(sceneId);
for (int i = 1; i < 1000; i++) { if (GameData.getScenePointIdList().size() == 0) {
p.addUnlockedPointList(i); for (int i = 1; i < 1000; i++) {
p.addUnlockedPointList(i);
}
} else {
p.addAllUnlockedPointList(GameData.getScenePointIdList());
} }
for (int i = 1; i < 9; i++) { for (int i = 1; i < 9; i++) {
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.shop.ShopInfo;
import emu.grasscutter.game.shop.ShopLimit;
import emu.grasscutter.game.shop.ShopManager;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetShopRspOuterClass.GetShopRsp; import emu.grasscutter.net.proto.GetShopRspOuterClass;
import emu.grasscutter.net.proto.ItemParamOuterClass;
import emu.grasscutter.net.proto.ShopGoodsOuterClass.ShopGoods;
import emu.grasscutter.net.proto.ShopOuterClass.Shop; import emu.grasscutter.net.proto.ShopOuterClass.Shop;
import emu.grasscutter.utils.Utils;
public class PacketGetShopRsp extends GenshinPacket { import java.util.ArrayList;
import java.util.List;
public PacketGetShopRsp(int shopType) { import java.util.stream.Collectors;
public class PacketGetShopRsp extends BasePacket {
public PacketGetShopRsp(Player inv, int shopType) {
super(PacketOpcodes.GetShopRsp); super(PacketOpcodes.GetShopRsp);
GetShopRsp proto = GetShopRsp.newBuilder() // TODO: CityReputationLevel
.setShop(Shop.newBuilder().setShopType(shopType)) Shop.Builder shop = Shop.newBuilder()
.build(); .setShopType(shopType)
.setCityId(1) //mock
this.setData(proto); .setCityReputationLevel(10); //mock
ShopManager manager = Grasscutter.getGameServer().getShopManager();
if (manager.getShopData().get(shopType) != null) {
List<ShopInfo> list = manager.getShopData().get(shopType);
List<ShopGoods> goodsList = new ArrayList<>();
for (ShopInfo info : list) {
ShopGoods.Builder goods = ShopGoods.newBuilder()
.setGoodsId(info.getGoodsId())
.setGoodsItem(ItemParamOuterClass.ItemParam.newBuilder().setItemId(info.getGoodsItem().getId()).setCount(info.getGoodsItem().getCount()).build())
.setScoin(info.getScoin())
.setHcoin(info.getHcoin())
.setBuyLimit(info.getBuyLimit())
.setBeginTime(info.getBeginTime())
.setEndTime(info.getEndTime())
.setMinLevel(info.getMinLevel())
.setMaxLevel(info.getMaxLevel())
.setMcoin(info.getMcoin())
.setDisableType(info.getDisableType())
.setSecondarySheetId(info.getSecondarySheetId());
if (info.getCostItemList() != null) {
goods.addAllCostItemList(info.getCostItemList().stream().map(x -> ItemParamOuterClass.ItemParam.newBuilder().setItemId(x.getId()).setCount(x.getCount()).build()).collect(Collectors.toList()));
}
if (info.getPreGoodsIdList() != null) {
goods.addAllPreGoodsIdList(info.getPreGoodsIdList());
}
int currentTs = Utils.getCurrentSeconds();
ShopLimit currentShopLimit = inv.getGoodsLimit(info.getGoodsId());
int nextRefreshTime = ShopManager.getShopNextRefreshTime(info);
if (currentShopLimit != null) {
if (currentShopLimit.getNextRefreshTime() < currentTs) { // second game day
currentShopLimit.setHasBoughtInPeriod(0);
currentShopLimit.setNextRefreshTime(nextRefreshTime);
}
goods.setBoughtNum(currentShopLimit.getHasBoughtInPeriod());
goods.setNextRefreshTime(currentShopLimit.getNextRefreshTime());
} else {
inv.addShopLimit(goods.getGoodsId(), 0, nextRefreshTime); // save generated refresh time
goods.setNextRefreshTime(nextRefreshTime);
}
goodsList.add(goods.build());
}
shop.addAllGoodsList(goodsList);
}
inv.save();
this.setData(GetShopRspOuterClass.GetShopRsp.newBuilder().setShop(shop).build());
} }
} }
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetShopmallDataRspOuterClass.GetShopmallDataRsp; import emu.grasscutter.net.proto.GetShopmallDataRspOuterClass.GetShopmallDataRsp;
public class PacketGetShopmallDataRsp extends GenshinPacket { import java.util.List;
public class PacketGetShopmallDataRsp extends BasePacket {
public PacketGetShopmallDataRsp() { public PacketGetShopmallDataRsp() {
super(PacketOpcodes.GetShopmallDataRsp); super(PacketOpcodes.GetShopmallDataRsp);
GetShopmallDataRsp proto = GetShopmallDataRsp.newBuilder().build(); List<Integer> shop_malls = List.of(900, 1052, 902, 1001, 903);
GetShopmallDataRsp proto = GetShopmallDataRsp.newBuilder()
.addAllShopTypeList(shop_malls)
.build();
this.setData(proto); this.setData(proto);
} }
} }
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.World; import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetWorldMpInfoRspOuterClass.GetWorldMpInfoRsp; import emu.grasscutter.net.proto.GetWorldMpInfoRspOuterClass.GetWorldMpInfoRsp;
public class PacketGetWorldMpInfoRsp extends GenshinPacket { public class PacketGetWorldMpInfoRsp extends BasePacket {
public PacketGetWorldMpInfoRsp(World world) { public PacketGetWorldMpInfoRsp(World world) {
super(PacketOpcodes.GetWorldMpInfoRsp); super(PacketOpcodes.GetWorldMpInfoRsp);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.H5ActivityIdsNotifyOuterClass.H5ActivityIdsNotify; import emu.grasscutter.net.proto.H5ActivityIdsNotifyOuterClass.H5ActivityIdsNotify;
public class PacketH5ActivityIdsNotify extends GenshinPacket { public class PacketH5ActivityIdsNotify extends BasePacket {
public PacketH5ActivityIdsNotify() { public PacketH5ActivityIdsNotify() {
super(PacketOpcodes.H5ActivityIdsNotify); super(PacketOpcodes.H5ActivityIdsNotify);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.World; import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HostPlayerNotifyOuterClass.HostPlayerNotify; import emu.grasscutter.net.proto.HostPlayerNotifyOuterClass.HostPlayerNotify;
public class PacketHostPlayerNotify extends GenshinPacket { public class PacketHostPlayerNotify extends BasePacket {
public PacketHostPlayerNotify(World world) { public PacketHostPlayerNotify(World world) {
super(PacketOpcodes.HostPlayerNotify); super(PacketOpcodes.HostPlayerNotify);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import java.util.Collection;
import java.util.List; import java.util.List;
import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.game.props.ActionReason;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ItemAddHintNotifyOuterClass.ItemAddHintNotify; import emu.grasscutter.net.proto.ItemAddHintNotifyOuterClass.ItemAddHintNotify;
public class PacketItemAddHintNotify extends GenshinPacket { public class PacketItemAddHintNotify extends BasePacket {
public PacketItemAddHintNotify(GenshinItem item, ActionReason reason) { public PacketItemAddHintNotify(GameItem item, ActionReason reason) {
super(PacketOpcodes.ItemAddHintNotify); super(PacketOpcodes.ItemAddHintNotify);
ItemAddHintNotify proto = ItemAddHintNotify.newBuilder() ItemAddHintNotify proto = ItemAddHintNotify.newBuilder()
...@@ -21,13 +22,13 @@ public class PacketItemAddHintNotify extends GenshinPacket { ...@@ -21,13 +22,13 @@ public class PacketItemAddHintNotify extends GenshinPacket {
this.setData(proto); this.setData(proto);
} }
public PacketItemAddHintNotify(List<GenshinItem> items, ActionReason reason) { public PacketItemAddHintNotify(Collection<GameItem> items, ActionReason reason) {
super(PacketOpcodes.ItemAddHintNotify); super(PacketOpcodes.ItemAddHintNotify);
ItemAddHintNotify.Builder proto = ItemAddHintNotify.newBuilder() ItemAddHintNotify.Builder proto = ItemAddHintNotify.newBuilder()
.setReason(reason.getValue()); .setReason(reason.getValue());
for (GenshinItem item : items) { for (GameItem item : items) {
proto.addItemList(item.toItemHintProto()); proto.addItemList(item.toItemHintProto());
} }
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.entity.GenshinEntity; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.props.LifeState; import emu.grasscutter.game.props.LifeState;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.LifeStateChangeNotifyOuterClass.LifeStateChangeNotify; import emu.grasscutter.net.proto.LifeStateChangeNotifyOuterClass.LifeStateChangeNotify;
import emu.grasscutter.net.proto.PlayerDieTypeOuterClass.PlayerDieType;
import emu.grasscutter.net.proto.ServerBuffOuterClass.ServerBuff;
public class PacketLifeStateChangeNotify extends GenshinPacket { import java.util.ArrayList;
public PacketLifeStateChangeNotify(GenshinEntity attacker, GenshinEntity target, LifeState lifeState) {
public class PacketLifeStateChangeNotify extends BasePacket {
public PacketLifeStateChangeNotify(GameEntity attacker, GameEntity target, LifeState lifeState) {
super(PacketOpcodes.LifeStateChangeNotify); super(PacketOpcodes.LifeStateChangeNotify);
LifeStateChangeNotify proto = LifeStateChangeNotify.newBuilder() LifeStateChangeNotify proto = LifeStateChangeNotify.newBuilder()
...@@ -18,7 +23,7 @@ public class PacketLifeStateChangeNotify extends GenshinPacket { ...@@ -18,7 +23,7 @@ public class PacketLifeStateChangeNotify extends GenshinPacket {
this.setData(proto); this.setData(proto);
} }
public PacketLifeStateChangeNotify(int attackerId, GenshinEntity target, LifeState lifeState) { public PacketLifeStateChangeNotify(int attackerId, GameEntity target, LifeState lifeState) {
super(PacketOpcodes.LifeStateChangeNotify); super(PacketOpcodes.LifeStateChangeNotify);
LifeStateChangeNotify proto = LifeStateChangeNotify.newBuilder() LifeStateChangeNotify proto = LifeStateChangeNotify.newBuilder()
...@@ -26,7 +31,29 @@ public class PacketLifeStateChangeNotify extends GenshinPacket { ...@@ -26,7 +31,29 @@ public class PacketLifeStateChangeNotify extends GenshinPacket {
.setLifeState(lifeState.getValue()) .setLifeState(lifeState.getValue())
.setSourceEntityId(attackerId) .setSourceEntityId(attackerId)
.build(); .build();
this.setData(proto); this.setData(proto);
} }
public PacketLifeStateChangeNotify(GameEntity entity, LifeState lifeState, PlayerDieType dieType) {
this(entity, lifeState, null, "", dieType);
}
public PacketLifeStateChangeNotify(GameEntity entity, LifeState lifeState, GameEntity sourceEntity,
String attackTag, PlayerDieType dieType) {
super(PacketOpcodes.LifeStateChangeNotify);
LifeStateChangeNotify.Builder proto = LifeStateChangeNotify.newBuilder();
proto.setEntityId(entity.getId());
proto.setLifeState(lifeState.getValue());
if (sourceEntity != null) {
proto.setSourceEntityId(sourceEntity.getId());
}
proto.setAttackTag(attackTag);
proto.setDieType(dieType);
this.setData(proto.build());
}
} }
package emu.grasscutter.server.packet.send;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.mail.Mail;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.*;
import java.util.ArrayList;
import java.util.List;
public class PacketMailChangeNotify extends BasePacket {
public PacketMailChangeNotify(Player player, Mail message) {
this (player, new ArrayList<Mail>(){{add(message);}});
}
public PacketMailChangeNotify(Player player, List<Mail> mailList) {
this(player, mailList, null);
}
public PacketMailChangeNotify(Player player, List<Mail> mailList, List<Integer> delMailIdList) {
super(PacketOpcodes.MailChangeNotify);
MailChangeNotifyOuterClass.MailChangeNotify.Builder proto = MailChangeNotifyOuterClass.MailChangeNotify.newBuilder();
if (mailList != null) {
for (Mail message : mailList) {
MailTextContentOuterClass.MailTextContent.Builder mailTextContent = MailTextContentOuterClass.MailTextContent.newBuilder();
mailTextContent.setTitle(message.mailContent.title);
mailTextContent.setContent(message.mailContent.content);
mailTextContent.setSender(message.mailContent.sender);
List<MailItemOuterClass.MailItem> mailItems = new ArrayList<MailItemOuterClass.MailItem>();
for (Mail.MailItem item : message.itemList) {
MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder();
ItemParamOuterClass.ItemParam.Builder itemParam = ItemParamOuterClass.ItemParam.newBuilder();
itemParam.setItemId(item.itemId);
itemParam.setCount(item.itemCount);
mailItem.setItemParam(itemParam.build());
mailItems.add(mailItem.build());
}
MailDataOuterClass.MailData.Builder mailData = MailDataOuterClass.MailData.newBuilder();
mailData.setMailId(player.getMailId(message));
mailData.setMailTextContent(mailTextContent.build());
mailData.addAllItemList(mailItems);
mailData.setSendTime((int) message.sendTime);
mailData.setExpireTime((int) message.expireTime);
mailData.setImportance(message.importance);
mailData.setIsRead(message.isRead);
mailData.setIsAttachmentGot(message.isAttachmentGot);
mailData.setStateValue(message.stateValue);
proto.addMailList(mailData.build());
}
}
if(delMailIdList != null) {
proto.addAllDelMailIdList(delMailIdList);
}
this.setData(proto.build());
}
}
\ No newline at end of file
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.managers.MapMarkManager.MapMark;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.*;
import java.util.*;
public class PacketMarkMapRsp extends BasePacket {
public PacketMarkMapRsp(Player player, HashMap<String, MapMark> mapMarks) {
super(PacketOpcodes.MarkMapRsp);
MarkMapRspOuterClass.MarkMapRsp.Builder proto = MarkMapRspOuterClass.MarkMapRsp.newBuilder();
proto.setRetcode(0);
if (mapMarks != null) {
for (MapMark mapMark: mapMarks.values()) {
MapMarkPointOuterClass.MapMarkPoint.Builder markPoint = MapMarkPointOuterClass.MapMarkPoint.newBuilder();
markPoint.setSceneId(mapMark.getSceneId());
markPoint.setName(mapMark.getName());
VectorOuterClass.Vector.Builder positionVector = VectorOuterClass.Vector.newBuilder();
positionVector.setX(mapMark.getPosition().getX());
positionVector.setY(mapMark.getPosition().getY());
positionVector.setZ(mapMark.getPosition().getZ());
markPoint.setPos(positionVector.build());
markPoint.setPointType(mapMark.getMapMarkPointType());
markPoint.setFromType(mapMark.getMapMarkFromType());
markPoint.setMonsterId(mapMark.getMonsterId());
markPoint.setQuestId(mapMark.getQuestId());
proto.addMarkList(markPoint.build());
}
}
MarkMapRspOuterClass.MarkMapRsp data = proto.build();
this.setData(data);
}
}
\ No newline at end of file
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.*;
import java.util.ArrayList;
import java.util.List;
public class PacketMarkNewNotify extends BasePacket {
public PacketMarkNewNotify(Player player, int markNewType, ArrayList<Integer> idList) {
super(PacketOpcodes.MarkNewNotify);
MarkNewNotifyOuterClass.MarkNewNotify.Builder proto = MarkNewNotifyOuterClass.MarkNewNotify.newBuilder();
proto.setMarkNewType(markNewType);
for (Integer id: idList) {
proto.addIdList(id);
}
MarkNewNotifyOuterClass.MarkNewNotify data = proto.build();
this.setData(data);
}
}
\ No newline at end of file
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.McoinExchangeHcoinRspOuterClass;
public class PacketMcoinExchangeHcoinRsp extends BasePacket {
public PacketMcoinExchangeHcoinRsp(int retCode) {
super(PacketOpcodes.McoinExchangeHcoinRsp);
McoinExchangeHcoinRspOuterClass.McoinExchangeHcoinRsp proto = McoinExchangeHcoinRspOuterClass.McoinExchangeHcoinRsp.newBuilder()
.setRetcode(retCode)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp; import emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp;
public class PacketNpcTalkRsp extends GenshinPacket { public class PacketNpcTalkRsp extends BasePacket {
public PacketNpcTalkRsp(int npcEntityId, int curTalkId, int entityId) { public PacketNpcTalkRsp(int npcEntityId, int curTalkId, int entityId) {
super(PacketOpcodes.NpcTalkRsp); super(PacketOpcodes.NpcTalkRsp);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.props.OpenState; import emu.grasscutter.game.props.OpenState;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.OpenStateUpdateNotifyOuterClass.OpenStateUpdateNotify; import emu.grasscutter.net.proto.OpenStateUpdateNotifyOuterClass.OpenStateUpdateNotify;
public class PacketOpenStateUpdateNotify extends GenshinPacket { public class PacketOpenStateUpdateNotify extends BasePacket {
public PacketOpenStateUpdateNotify() { public PacketOpenStateUpdateNotify() {
super(PacketOpcodes.OpenStateUpdateNotify); super(PacketOpcodes.OpenStateUpdateNotify);
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
public class PacketPathfindingEnterSceneRsp extends GenshinPacket { public class PacketPathfindingEnterSceneRsp extends BasePacket {
public PacketPathfindingEnterSceneRsp(int clientSequence) { public PacketPathfindingEnterSceneRsp(int clientSequence) {
super(PacketOpcodes.PathfindingEnterSceneRsp); super(PacketOpcodes.PathfindingEnterSceneRsp);
this.buildHeader(clientSequence);
} }
} }
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PersonalSceneJumpRspOuterClass.PersonalSceneJumpRsp;
import emu.grasscutter.utils.Position;
public class PacketPersonalSceneJumpRsp extends BasePacket {
public PacketPersonalSceneJumpRsp(int sceneId, Position pos) {
super(PacketOpcodes.PersonalSceneJumpRsp);
PersonalSceneJumpRsp proto = PersonalSceneJumpRsp.newBuilder()
.setDestSceneId(sceneId)
.setDestPos(pos.toProto())
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PingRspOuterClass.PingRsp; import emu.grasscutter.net.proto.PingRspOuterClass.PingRsp;
public class PacketPingRsp extends GenshinPacket { public class PacketPingRsp extends BasePacket {
public PacketPingRsp(int clientSeq, int time) { public PacketPingRsp(int clientSeq, int time) {
super(PacketOpcodes.PingRsp, clientSeq); super(PacketOpcodes.PingRsp, clientSeq);
......
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