Commit d32f706c authored by KingRainbow44's avatar KingRainbow44
Browse files

Merge branch 'development' into api

# Conflicts:
#	src/main/java/emu/grasscutter/plugin/api/ServerHook.java
parents 47d8fd3c f0d728b4
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AvatarUnlockTalentNotifyOuterClass.AvatarUnlockTalentNotify;
public class PacketAvatarUnlockTalentNotify extends GenshinPacket {
public class PacketAvatarUnlockTalentNotify extends BasePacket {
public PacketAvatarUnlockTalentNotify(GenshinAvatar avatar, int talentId) {
public PacketAvatarUnlockTalentNotify(Avatar avatar, int talentId) {
super(PacketOpcodes.AvatarUnlockTalentNotify);
AvatarUnlockTalentNotify proto = AvatarUnlockTalentNotify.newBuilder()
......
......@@ -2,14 +2,14 @@ package emu.grasscutter.server.packet.send;
import java.util.Map;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AvatarUpgradeRspOuterClass.AvatarUpgradeRsp;
public class PacketAvatarUpgradeRsp extends GenshinPacket {
public class PacketAvatarUpgradeRsp extends BasePacket {
public PacketAvatarUpgradeRsp(GenshinAvatar avatar, int oldLevel, Map<Integer, Float> oldFightPropMap) {
public PacketAvatarUpgradeRsp(Avatar avatar, int oldLevel, Map<Integer, Float> oldFightPropMap) {
super(PacketOpcodes.AvatarUpgradeRsp);
this.buildHeader(0);
......
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.proto.AvatarWearFlycloakRspOuterClass.AvatarWearFlycloakRsp;
import emu.grasscutter.net.proto.RetcodeOuterClass;
public class PacketAvatarWearFlycloakRsp extends GenshinPacket {
public class PacketAvatarWearFlycloakRsp extends BasePacket {
public PacketAvatarWearFlycloakRsp(long avatarGuid, int costumeId) {
super(PacketOpcodes.AvatarWearFlycloakRsp);
......@@ -20,7 +21,7 @@ public class PacketAvatarWearFlycloakRsp extends GenshinPacket {
super(PacketOpcodes.AvatarWearFlycloakRsp);
AvatarWearFlycloakRsp proto = AvatarWearFlycloakRsp.newBuilder()
.setRetcode(1)
.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE)
.build();
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.BuyGoodsRspOuterClass;
import emu.grasscutter.net.proto.ShopGoodsOuterClass;
public class PacketBuyGoodsRsp extends BasePacket {
public PacketBuyGoodsRsp(int shopType, int boughtNum, ShopGoodsOuterClass.ShopGoods sg) {
super(PacketOpcodes.BuyGoodsRsp);
BuyGoodsRspOuterClass.BuyGoodsRsp buyGoodsRsp = BuyGoodsRspOuterClass.BuyGoodsRsp.newBuilder()
.setShopType(shopType)
.setBoughtNum(boughtNum)
.addGoodsList(ShopGoodsOuterClass.ShopGoods.newBuilder()
.mergeFrom(sg)
.setBoughtNum(boughtNum)
).build();
this.setData(buyGoodsRsp);
}
}
......@@ -2,13 +2,13 @@ package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.packet.Retcode;
import emu.grasscutter.net.proto.CalcWeaponUpgradeReturnItemsRspOuterClass.CalcWeaponUpgradeReturnItemsRsp;
import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam;
import emu.grasscutter.net.proto.RetcodeOuterClass;
public class PacketCalcWeaponUpgradeReturnItemsRsp extends GenshinPacket {
public class PacketCalcWeaponUpgradeReturnItemsRsp extends BasePacket {
public PacketCalcWeaponUpgradeReturnItemsRsp(long itemGuid, List<ItemParam> returnItems) {
super(PacketOpcodes.CalcWeaponUpgradeReturnItemsRsp);
......@@ -25,7 +25,7 @@ public class PacketCalcWeaponUpgradeReturnItemsRsp extends GenshinPacket {
super(PacketOpcodes.CalcWeaponUpgradeReturnItemsRsp);
CalcWeaponUpgradeReturnItemsRsp proto = CalcWeaponUpgradeReturnItemsRsp.newBuilder()
.setRetcode(Retcode.FAIL)
.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE)
.build();
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.CardProductRewardNotifyOuterClass.CardProductRewardNotify;
public class PacketCardProductRewardNotify extends BasePacket {
public PacketCardProductRewardNotify(int remainsDay) {
super(PacketOpcodes.CardProductRewardNotify);
CardProductRewardNotify proto = CardProductRewardNotify.newBuilder()
.setProductId("ys_chn_blessofmoon_tier5")
.setHcoin(90)
.setRemainDays(remainsDay)
.build();
// Hard code Product id keep cool 😎
this.setData(proto);
}
}
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.proto.ChangeAvatarRspOuterClass.ChangeAvatarRsp;
import emu.grasscutter.net.proto.RetcodeOuterClass;
public class PacketChangeAvatarRsp extends GenshinPacket {
public class PacketChangeAvatarRsp extends BasePacket {
public PacketChangeAvatarRsp(long guid) {
super(PacketOpcodes.ChangeAvatarRsp);
ChangeAvatarRsp p = ChangeAvatarRsp.newBuilder()
.setRetcode(0)
.setCurrGuid(guid)
.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE)
.setCurGuid(guid)
.build();
this.setData(p);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.World;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ChangeGameTimeRspOuterClass.ChangeGameTimeRsp;
public class PacketChangeGameTimeRsp extends GenshinPacket {
public class PacketChangeGameTimeRsp extends BasePacket {
public PacketChangeGameTimeRsp(GenshinPlayer player) {
public PacketChangeGameTimeRsp(Player player) {
super(PacketOpcodes.ChangeGameTimeRsp);
ChangeGameTimeRsp proto = ChangeGameTimeRsp.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.TeamInfo;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.player.TeamInfo;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ChangeMpTeamAvatarRspOuterClass.ChangeMpTeamAvatarRsp;
public class PacketChangeMpTeamAvatarRsp extends GenshinPacket {
public class PacketChangeMpTeamAvatarRsp extends BasePacket {
public PacketChangeMpTeamAvatarRsp(GenshinPlayer player, TeamInfo teamInfo) {
public PacketChangeMpTeamAvatarRsp(Player player, TeamInfo teamInfo) {
super(PacketOpcodes.ChangeMpTeamAvatarRsp);
ChangeMpTeamAvatarRsp.Builder proto = ChangeMpTeamAvatarRsp.newBuilder()
......
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.proto.ChangeTeamNameRspOuterClass.ChangeTeamNameRsp;
public class PacketChangeTeamNameRsp extends GenshinPacket {
public class PacketChangeTeamNameRsp extends BasePacket {
public PacketChangeTeamNameRsp(int teamId, String teamName) {
super(PacketOpcodes.ChangeTeamNameRsp);
......
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.proto.ChooseCurAvatarTeamRspOuterClass.ChooseCurAvatarTeamRsp;
public class PacketChooseCurAvatarTeamRsp extends GenshinPacket {
public class PacketChooseCurAvatarTeamRsp extends BasePacket {
public PacketChooseCurAvatarTeamRsp(int teamId) {
super(PacketOpcodes.ChooseCurAvatarTeamRsp);
......
......@@ -2,12 +2,12 @@ package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry;
import emu.grasscutter.net.proto.ClientAbilityInitFinishNotifyOuterClass.ClientAbilityInitFinishNotify;
public class PacketClientAbilityInitFinishNotify extends GenshinPacket {
public class PacketClientAbilityInitFinishNotify extends BasePacket {
public PacketClientAbilityInitFinishNotify(List<AbilityInvokeEntry> entries) {
super(PacketOpcodes.ClientAbilityInitFinishNotify, true);
......
......@@ -2,12 +2,12 @@ package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.CombatInvocationsNotifyOuterClass.CombatInvocationsNotify;
import emu.grasscutter.net.proto.CombatInvokeEntryOuterClass.CombatInvokeEntry;
public class PacketCombatInvocationsNotify extends GenshinPacket {
public class PacketCombatInvocationsNotify extends BasePacket {
public PacketCombatInvocationsNotify(CombatInvokeEntry entry) {
super(PacketOpcodes.CombatInvocationsNotify, true);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.CombineReqOuterClass;
import emu.grasscutter.net.proto.CombineRspOuterClass;
import emu.grasscutter.net.proto.ItemParamOuterClass;
import emu.grasscutter.net.proto.RetcodeOuterClass;
public class PacketCombineRsp extends BasePacket {
public PacketCombineRsp() {
super(PacketOpcodes.CombineRsp);
CombineRspOuterClass.CombineRsp proto = CombineRspOuterClass.CombineRsp.newBuilder()
.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE).build();
this.setData(proto);
}
public PacketCombineRsp(int retcode) {
super(PacketOpcodes.CombineRsp);
CombineRspOuterClass.CombineRsp proto = CombineRspOuterClass.CombineRsp.newBuilder()
.setRetcode(retcode).build();
this.setData(proto);
}
public PacketCombineRsp(CombineReqOuterClass.CombineReq combineReq,
Iterable<ItemParamOuterClass.ItemParam> costItemList,
Iterable<ItemParamOuterClass.ItemParam> resultItemList,
Iterable<ItemParamOuterClass.ItemParam> totalRandomItemList,
Iterable<ItemParamOuterClass.ItemParam> totalReturnItemList,
Iterable<ItemParamOuterClass.ItemParam> totalExtraItemList) {
super(PacketOpcodes.CombineRsp);
CombineRspOuterClass.CombineRsp proto = CombineRspOuterClass.CombineRsp.newBuilder()
.setRetcode(RetcodeOuterClass.Retcode.RET_SUCC_VALUE)
.setCombineId(combineReq.getCombineId())
.setCombineCount(combineReq.getCombineCount())
.setAvatarGuid(combineReq.getAvatarGuid())
.addAllCostItemList(costItemList)
.addAllResultItemList(resultItemList)
.addAllTotalRandomItemList(totalRandomItemList)
.addAllTotalReturnItemList(totalReturnItemList)
.addAllTotalExtraItemList(totalExtraItemList)
.build();
this.setData(proto);
}
}
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.proto.DealAddFriendResultTypeOuterClass.DealAddFriendResultType;
import emu.grasscutter.net.proto.DealAddFriendRspOuterClass.DealAddFriendRsp;
public class PacketDealAddFriendRsp extends GenshinPacket {
public class PacketDealAddFriendRsp extends BasePacket {
public PacketDealAddFriendRsp(int targetUid, DealAddFriendResultType result) {
super(PacketOpcodes.DealAddFriendRsp);
......
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.DelMailRspOuterClass.DelMailRsp;
import java.util.ArrayList;
import java.util.List;
public class PacketDelMailRsp extends BasePacket {
public PacketDelMailRsp(Player player, List<Integer> toDeleteIds) {
super(PacketOpcodes.DelMailRsp);
DelMailRsp.Builder proto = DelMailRsp.newBuilder();
List<Integer> deletedIds = new ArrayList<>();
for(int mailId : toDeleteIds) {
if(player.deleteMail(mailId)) {
deletedIds.add(mailId);
}
}
this.setData(proto.build());
player.getSession().send(new PacketMailChangeNotify(player, null, deletedIds));
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@ package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.DelTeamEntityNotifyOuterClass.DelTeamEntityNotify;
public class PacketDelTeamEntityNotify extends GenshinPacket {
public class PacketDelTeamEntityNotify extends BasePacket {
public PacketDelTeamEntityNotify(int sceneId, int teamEntityId) {
super(PacketOpcodes.DelTeamEntityNotify);
......
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.proto.DeleteFriendNotifyOuterClass.DeleteFriendNotify;
public class PacketDeleteFriendNotify extends GenshinPacket {
public class PacketDeleteFriendNotify extends BasePacket {
public PacketDeleteFriendNotify(int targetUid) {
super(PacketOpcodes.DeleteFriendNotify);
......
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.proto.DeleteFriendRspOuterClass.DeleteFriendRsp;
public class PacketDeleteFriendRsp extends GenshinPacket {
public class PacketDeleteFriendRsp extends BasePacket {
public PacketDeleteFriendRsp(int targetUid) {
super(PacketOpcodes.DeleteFriendRsp);
......
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.proto.DestroyMaterialRspOuterClass.DestroyMaterialRsp;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
public class PacketDestroyMaterialRsp extends GenshinPacket {
public class PacketDestroyMaterialRsp extends BasePacket {
public PacketDestroyMaterialRsp(Int2IntOpenHashMap returnMaterialMap) {
super(PacketOpcodes.DestroyMaterialRsp);
......
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