Commit 7925d1cd authored by Melledy's avatar Melledy
Browse files

Initial commit

parents
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AvatarSkillChangeNotifyOuterClass.AvatarSkillChangeNotify;
public class PacketAvatarSkillChangeNotify extends GenshinPacket {
public PacketAvatarSkillChangeNotify(GenshinAvatar avatar, int skillId, int oldLevel, int curLevel) {
super(PacketOpcodes.AvatarSkillChangeNotify);
AvatarSkillChangeNotify proto = AvatarSkillChangeNotify.newBuilder()
.setAvatarGuid(avatar.getGuid())
.setEntityId(avatar.getEntityId())
.setSkillDepotId(avatar.getSkillDepotId())
.setAvatarSkillId(skillId)
.setOldLevel(oldLevel)
.setCurLevel(curLevel)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AvatarSkillUpgradeRspOuterClass.AvatarSkillUpgradeRsp;
public class PacketAvatarSkillUpgradeRsp extends GenshinPacket {
public PacketAvatarSkillUpgradeRsp(GenshinAvatar avatar, int skillId, int oldLevel, int newLevel) {
super(PacketOpcodes.AvatarSkillUpgradeRsp);
AvatarSkillUpgradeRsp proto = AvatarSkillUpgradeRsp.newBuilder()
.setAvatarGuid(avatar.getGuid())
.setAvatarSkillId(skillId)
.setOldLevel(oldLevel)
.setCurLevel(newLevel)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import java.util.Map.Entry;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.TeamInfo;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam;
import emu.grasscutter.net.proto.AvatarTeamUpdateNotifyOuterClass.AvatarTeamUpdateNotify;
public class PacketAvatarTeamUpdateNotify extends GenshinPacket {
public PacketAvatarTeamUpdateNotify(GenshinPlayer player) {
super(PacketOpcodes.AvatarTeamUpdateNotify);
AvatarTeamUpdateNotify.Builder proto = AvatarTeamUpdateNotify.newBuilder();
for (Entry<Integer, TeamInfo> entry : player.getTeamManager().getTeams().entrySet()) {
TeamInfo teamInfo = entry.getValue();
AvatarTeam.Builder avatarTeam = AvatarTeam.newBuilder()
.setTeamName(teamInfo.getName());
for (int i = 0; i < teamInfo.getAvatars().size(); i++) {
GenshinAvatar avatar = player.getAvatars().getAvatarById(teamInfo.getAvatars().get(i));
avatarTeam.addAvatarGuidList(avatar.getGuid());
}
proto.putAvatarTeamMap(entry.getKey(), avatarTeam.build());
}
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AvatarUnlockTalentNotifyOuterClass.AvatarUnlockTalentNotify;
public class PacketAvatarUnlockTalentNotify extends GenshinPacket {
public PacketAvatarUnlockTalentNotify(GenshinAvatar avatar, int talentId) {
super(PacketOpcodes.AvatarUnlockTalentNotify);
AvatarUnlockTalentNotify proto = AvatarUnlockTalentNotify.newBuilder()
.setAvatarGuid(avatar.getGuid())
.setEntityId(avatar.getEntityId())
.setTalentId(talentId)
.setSkillDepotId(avatar.getSkillDepotId())
.build();
this.setData(proto);
}
}
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.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AvatarUpgradeRspOuterClass.AvatarUpgradeRsp;
public class PacketAvatarUpgradeRsp extends GenshinPacket {
public PacketAvatarUpgradeRsp(GenshinAvatar avatar, int oldLevel, Map<Integer, Float> oldFightPropMap) {
super(PacketOpcodes.AvatarUpgradeRsp);
this.buildHeader(0);
AvatarUpgradeRsp proto = AvatarUpgradeRsp.newBuilder()
.setAvatarGuid(avatar.getGuid())
.setOldLevel(oldLevel)
.setCurLevel(avatar.getLevel())
.putAllOldFightPropMap(oldFightPropMap)
.putAllCurFightPropMap(avatar.getFightProperties())
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AvatarWearFlycloakRspOuterClass.AvatarWearFlycloakRsp;
public class PacketAvatarWearFlycloakRsp extends GenshinPacket {
public PacketAvatarWearFlycloakRsp(long avatarGuid, int costumeId) {
super(PacketOpcodes.AvatarWearFlycloakRsp);
AvatarWearFlycloakRsp proto = AvatarWearFlycloakRsp.newBuilder()
.setAvatarGuid(avatarGuid)
.setFlycloakId(costumeId)
.build();
this.setData(proto);
}
public PacketAvatarWearFlycloakRsp() {
super(PacketOpcodes.AvatarWearFlycloakRsp);
AvatarWearFlycloakRsp proto = AvatarWearFlycloakRsp.newBuilder()
.setRetcode(1)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.net.packet.GenshinPacket;
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;
public class PacketCalcWeaponUpgradeReturnItemsRsp extends GenshinPacket {
public PacketCalcWeaponUpgradeReturnItemsRsp(long itemGuid, List<ItemParam> returnItems) {
super(PacketOpcodes.CalcWeaponUpgradeReturnItemsRsp);
CalcWeaponUpgradeReturnItemsRsp proto = CalcWeaponUpgradeReturnItemsRsp.newBuilder()
.setTargetWeaponGuid(itemGuid)
.addAllItemParamList(returnItems)
.build();
this.setData(proto);
}
public PacketCalcWeaponUpgradeReturnItemsRsp() {
super(PacketOpcodes.CalcWeaponUpgradeReturnItemsRsp);
CalcWeaponUpgradeReturnItemsRsp proto = CalcWeaponUpgradeReturnItemsRsp.newBuilder()
.setRetcode(Retcode.FAIL)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ChangeAvatarRspOuterClass.ChangeAvatarRsp;
public class PacketChangeAvatarRsp extends GenshinPacket {
public PacketChangeAvatarRsp(long guid) {
super(PacketOpcodes.ChangeAvatarRsp);
ChangeAvatarRsp p = ChangeAvatarRsp.newBuilder()
.setRetcode(0)
.setCurrGuid(guid)
.build();
this.setData(p);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.World;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ChangeGameTimeRspOuterClass.ChangeGameTimeRsp;
public class PacketChangeGameTimeRsp extends GenshinPacket {
public PacketChangeGameTimeRsp(World world) {
super(PacketOpcodes.ChangeGameTimeRsp);
ChangeGameTimeRsp proto = ChangeGameTimeRsp.newBuilder()
.setCurGameTime(world.getTime())
.build();
this.setData(proto);
}
}
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.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ChangeMpTeamAvatarRspOuterClass.ChangeMpTeamAvatarRsp;
public class PacketChangeMpTeamAvatarRsp extends GenshinPacket {
public PacketChangeMpTeamAvatarRsp(GenshinPlayer player, TeamInfo teamInfo) {
super(PacketOpcodes.ChangeMpTeamAvatarRsp);
ChangeMpTeamAvatarRsp.Builder proto = ChangeMpTeamAvatarRsp.newBuilder()
.setCurAvatarGuid(player.getTeamManager().getCurrentCharacterGuid());
for (int avatarId : teamInfo.getAvatars()) {
proto.addAvatarGuidList(player.getAvatars().getAvatarById(avatarId).getGuid());
}
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ChangeTeamNameRspOuterClass.ChangeTeamNameRsp;
public class PacketChangeTeamNameRsp extends GenshinPacket {
public PacketChangeTeamNameRsp(int teamId, String teamName) {
super(PacketOpcodes.ChangeTeamNameRsp);
ChangeTeamNameRsp proto = ChangeTeamNameRsp.newBuilder()
.setTeamId(teamId)
.setTeamName(teamName)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ChooseCurAvatarTeamRspOuterClass.ChooseCurAvatarTeamRsp;
public class PacketChooseCurAvatarTeamRsp extends GenshinPacket {
public PacketChooseCurAvatarTeamRsp(int teamId) {
super(PacketOpcodes.ChooseCurAvatarTeamRsp);
ChooseCurAvatarTeamRsp proto = ChooseCurAvatarTeamRsp.newBuilder()
.setCurTeamId(teamId)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.net.packet.GenshinPacket;
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 PacketCombatInvocationsNotify(CombatInvokeEntry entry) {
super(PacketOpcodes.CombatInvocationsNotify, true);
CombatInvocationsNotify proto = CombatInvocationsNotify.newBuilder()
.addInvokeList(entry)
.build();
this.setData(proto);
}
public PacketCombatInvocationsNotify(List<CombatInvokeEntry> entries) {
super(PacketOpcodes.CombatInvocationsNotify, true);
CombatInvocationsNotify proto = CombatInvocationsNotify.newBuilder()
.addAllInvokeList(entries)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
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 PacketDealAddFriendRsp(int targetUid, DealAddFriendResultType result) {
super(PacketOpcodes.DealAddFriendRsp);
DealAddFriendRsp proto = DealAddFriendRsp.newBuilder()
.setTargetUid(targetUid)
.setDealAddFriendResult(result)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.DelTeamEntityNotifyOuterClass.DelTeamEntityNotify;
public class PacketDelTeamEntityNotify extends GenshinPacket {
public PacketDelTeamEntityNotify(int sceneId, int teamEntityId) {
super(PacketOpcodes.DelTeamEntityNotify);
DelTeamEntityNotify proto = DelTeamEntityNotify.newBuilder()
.setSceneId(sceneId)
.addDelEntityIdList(teamEntityId)
.build();
this.setData(proto);
}
public PacketDelTeamEntityNotify(int sceneId, List<Integer> list) {
super(PacketOpcodes.DelTeamEntityNotify);
DelTeamEntityNotify proto = DelTeamEntityNotify.newBuilder()
.setSceneId(sceneId)
.addAllDelEntityIdList(list)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.DeleteFriendNotifyOuterClass.DeleteFriendNotify;
public class PacketDeleteFriendNotify extends GenshinPacket {
public PacketDeleteFriendNotify(int targetUid) {
super(PacketOpcodes.DeleteFriendNotify);
DeleteFriendNotify proto = DeleteFriendNotify.newBuilder()
.setTargetUid(targetUid)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.DeleteFriendRspOuterClass.DeleteFriendRsp;
public class PacketDeleteFriendRsp extends GenshinPacket {
public PacketDeleteFriendRsp(int targetUid) {
super(PacketOpcodes.DeleteFriendRsp);
DeleteFriendRsp proto = DeleteFriendRsp.newBuilder()
.setTargetUid(targetUid)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
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 PacketDestroyMaterialRsp(Int2IntOpenHashMap returnMaterialMap) {
super(PacketOpcodes.DestroyMaterialRsp);
DestroyMaterialRsp.Builder proto = DestroyMaterialRsp.newBuilder();
for (Int2IntMap.Entry e : returnMaterialMap.int2IntEntrySet()) {
proto.addItemIdList(e.getIntKey());
proto.addItemCountList(e.getIntValue());
}
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.game.gacha.GachaBanner;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.DoGachaRspOuterClass.DoGachaRsp;
import emu.grasscutter.net.proto.GachaItemOuterClass.GachaItem;
public class PacketDoGachaRsp extends GenshinPacket {
public PacketDoGachaRsp(GachaBanner banner, List<GachaItem> list) {
super(PacketOpcodes.DoGachaRsp);
DoGachaRsp p = DoGachaRsp.newBuilder()
.setGachaType(banner.getGachaType())
.setGachaScheduleId(banner.getScheduleId())
.setGachaTimes(list.size())
.setNewGachaRandom(12345)
.setLeftGachaTimes(Integer.MAX_VALUE)
.setCostItemId(banner.getCostItem())
.setCostItemNum(1)
.setTenCostItemId(banner.getCostItem())
.setTenCostItemNum(10)
.addAllGachaItemList(list)
.build();
this.setData(p);
}
public PacketDoGachaRsp() {
super(PacketOpcodes.DoGachaRsp);
DoGachaRsp p = DoGachaRsp.newBuilder()
.setRetcode(1)
.build();
this.setData(p);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.EnterSceneDoneRspOuterClass.EnterSceneDoneRsp;
public class PacketEnterSceneDoneRsp extends GenshinPacket {
public PacketEnterSceneDoneRsp(GenshinPlayer player) {
super(PacketOpcodes.EnterSceneDoneRsp);
EnterSceneDoneRsp p = EnterSceneDoneRsp.newBuilder()
.setEnterSceneToken(player.getEnterSceneToken())
.build();
this.setData(p);
}
}
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