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

Initial commit

parents
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SetEquipLockStateRspOuterClass.SetEquipLockStateRsp;
public class PacketSetEquipLockStateRsp extends GenshinPacket {
public PacketSetEquipLockStateRsp(GenshinItem equip) {
super(PacketOpcodes.SetEquipLockStateRsp);
this.buildHeader(0);
SetEquipLockStateRsp proto = SetEquipLockStateRsp.newBuilder()
.setTargetEquipGuid(equip.getGuid())
.setIsLocked(equip.isLocked())
.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.SetNameCardRspOuterClass.SetNameCardRsp;
public class PacketSetNameCardRsp extends GenshinPacket {
public PacketSetNameCardRsp(int nameCardId) {
super(PacketOpcodes.SetNameCardRsp);
SetNameCardRsp proto = SetNameCardRsp.newBuilder()
.setNameCardId(nameCardId)
.build();
this.setData(proto);
}
}
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.HeadImageOuterClass.HeadImage;
import emu.grasscutter.net.proto.SetPlayerHeadImageRspOuterClass.SetPlayerHeadImageRsp;
public class PacketSetPlayerHeadImageRsp extends GenshinPacket {
public PacketSetPlayerHeadImageRsp(GenshinPlayer player) {
super(PacketOpcodes.SetPlayerHeadImageRsp);
SetPlayerHeadImageRsp proto = SetPlayerHeadImageRsp.newBuilder()
.setAvatar(HeadImage.newBuilder().setAvatarId(player.getHeadImage()))
.build();
this.setData(proto);
}
}
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.SetPlayerNameRspOuterClass.SetPlayerNameRsp;
public class PacketSetPlayerNameRsp extends GenshinPacket {
public PacketSetPlayerNameRsp(GenshinPlayer player) {
super(PacketOpcodes.SetPlayerNameRsp);
SetPlayerNameRsp proto = SetPlayerNameRsp.newBuilder()
.setNickName(player.getNickname())
.build();
this.setData(proto);
}
}
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.SetPlayerSignatureRspOuterClass.SetPlayerSignatureRsp;
public class PacketSetPlayerSignatureRsp extends GenshinPacket {
public PacketSetPlayerSignatureRsp(GenshinPlayer player) {
super(PacketOpcodes.SetPlayerSignatureRsp);
SetPlayerSignatureRsp proto = SetPlayerSignatureRsp.newBuilder()
.setSignature(player.getSignature())
.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.SetUpAvatarTeamRspOuterClass.SetUpAvatarTeamRsp;
public class PacketSetUpAvatarTeamRsp extends GenshinPacket {
public PacketSetUpAvatarTeamRsp(GenshinPlayer player, int teamId, TeamInfo teamInfo) {
super(PacketOpcodes.SetUpAvatarTeamRsp);
SetUpAvatarTeamRsp.Builder proto = SetUpAvatarTeamRsp.newBuilder()
.setTeamId(teamId)
.setCurAvatarGuid(player.getTeamManager().getCurrentCharacterGuid());
for (int avatarId : teamInfo.getAvatars()) {
proto.addAvatarTeamGuidList(player.getAvatars().getAvatarById(avatarId).getGuid());
}
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import java.util.Collection;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.StoreItemChangeNotifyOuterClass.StoreItemChangeNotify;
import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType;
public class PacketStoreItemChangeNotify extends GenshinPacket {
private PacketStoreItemChangeNotify() {
super(PacketOpcodes.StoreItemChangeNotify);
}
public PacketStoreItemChangeNotify(GenshinItem item) {
this();
StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder()
.setStoreType(StoreType.StorePack)
.addItemList(item.toProto());
this.setData(proto);
}
public PacketStoreItemChangeNotify(Collection<GenshinItem> items) {
this();
StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder()
.setStoreType(StoreType.StorePack);
items.stream().forEach(item -> proto.addItemList(item.toProto()));
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import java.util.Collection;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.StoreItemDelNotifyOuterClass.StoreItemDelNotify;
import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType;
public class PacketStoreItemDelNotify extends GenshinPacket {
private PacketStoreItemDelNotify() {
super(PacketOpcodes.StoreItemDelNotify);
}
public PacketStoreItemDelNotify(GenshinItem item) {
this();
StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder()
.setStoreType(StoreType.StorePack)
.addGuidList(item.getGuid());
this.setData(proto);
}
public PacketStoreItemDelNotify(Collection<GenshinItem> items) {
this();
StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder()
.setStoreType(StoreType.StorePack);
items.stream().forEach(item -> proto.addGuidList(item.getGuid()));
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.GenshinConstants;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType;
import emu.grasscutter.net.proto.StoreWeightLimitNotifyOuterClass.StoreWeightLimitNotify;
public class PacketStoreWeightLimitNotify extends GenshinPacket {
public PacketStoreWeightLimitNotify() {
super(PacketOpcodes.StoreWeightLimitNotify);
StoreWeightLimitNotify p = StoreWeightLimitNotify.newBuilder()
.setStoreType(StoreType.StorePack)
.setWeightLimit(GenshinConstants.LIMIT_ALL)
.setWeaponCountLimit(GenshinConstants.LIMIT_WEAPON)
.setReliquaryCountLimit(GenshinConstants.LIMIT_RELIC)
.setMaterialCountLimit(GenshinConstants.LIMIT_MATERIAL)
.setFurnitureCountLimit(GenshinConstants.LIMIT_FURNITURE)
.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.SyncScenePlayTeamEntityNotifyOuterClass.SyncScenePlayTeamEntityNotify;
public class PacketSyncScenePlayTeamEntityNotify extends GenshinPacket {
public PacketSyncScenePlayTeamEntityNotify(GenshinPlayer player) {
super(PacketOpcodes.SyncScenePlayTeamEntityNotify);
SyncScenePlayTeamEntityNotify proto = SyncScenePlayTeamEntityNotify.newBuilder()
.setSceneId(player.getSceneId())
.build();
this.setData(proto);
}
}
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.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
import emu.grasscutter.net.proto.SyncTeamEntityNotifyOuterClass.SyncTeamEntityNotify;
import emu.grasscutter.net.proto.TeamEntityInfoOuterClass.TeamEntityInfo;
public class PacketSyncTeamEntityNotify extends GenshinPacket {
public PacketSyncTeamEntityNotify(GenshinPlayer player) {
super(PacketOpcodes.SyncTeamEntityNotify);
SyncTeamEntityNotify.Builder proto = SyncTeamEntityNotify.newBuilder()
.setSceneId(player.getSceneId());
if (player.getWorld().isMultiplayer()) {
for (GenshinPlayer p : player.getWorld().getPlayers()) {
// Skip if same player
if (player == p) {
continue;
}
// Set info
TeamEntityInfo info = TeamEntityInfo.newBuilder()
.setTeamEntityId(p.getTeamManager().getEntityId())
.setAuthorityPeerId(p.getPeerId())
.setTeamAbilityInfo(AbilitySyncStateInfo.newBuilder())
.build();
proto.addTeamEntityInfoList(info);
}
}
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.TakeoffEquipRspOuterClass.TakeoffEquipRsp;
public class PacketTakeoffEquipRsp extends GenshinPacket {
public PacketTakeoffEquipRsp(long avatarGuid, int slot) {
super(PacketOpcodes.TakeoffEquipRsp);
TakeoffEquipRsp proto = TakeoffEquipRsp.newBuilder()
.setAvatarGuid(avatarGuid)
.setSlot(slot)
.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.TowerAllDataRspOuterClass.TowerAllDataRsp;
import emu.grasscutter.net.proto.TowerCurLevelRecordOuterClass.TowerCurLevelRecord;
import emu.grasscutter.net.proto.TowerFloorRecordOuterClass.TowerFloorRecord;
public class PacketTowerAllDataRsp extends GenshinPacket {
public PacketTowerAllDataRsp() {
super(PacketOpcodes.TowerAllDataRsp);
TowerAllDataRsp proto = TowerAllDataRsp.newBuilder()
.setTowerScheduleId(29)
.addTowerFloorRecordList(TowerFloorRecord.newBuilder().setFloorId(1001))
.setCurLevelRecord(TowerCurLevelRecord.newBuilder().setIsEmpty(true))
.setNextScheduleChangeTime(Integer.MAX_VALUE)
.putFloorOpenTimeMap(1024, 1630486800)
.putFloorOpenTimeMap(1025, 1630486800)
.putFloorOpenTimeMap(1026, 1630486800)
.putFloorOpenTimeMap(1027, 1630486800)
.setScheduleStartTime(1630486800)
.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.UnlockAvatarTalentRspOuterClass.UnlockAvatarTalentRsp;
public class PacketUnlockAvatarTalentRsp extends GenshinPacket {
public PacketUnlockAvatarTalentRsp(GenshinAvatar avatar, int talentId) {
super(PacketOpcodes.UnlockAvatarTalentRsp);
UnlockAvatarTalentRsp proto = UnlockAvatarTalentRsp.newBuilder()
.setAvatarGuid(avatar.getGuid())
.setTalentId(talentId)
.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.UnlockNameCardNotifyOuterClass.UnlockNameCardNotify;
public class PacketUnlockNameCardNotify extends GenshinPacket {
public PacketUnlockNameCardNotify(int nameCard) {
super(PacketOpcodes.UnlockNameCardNotify);
UnlockNameCardNotify proto = UnlockNameCardNotify.newBuilder()
.setNameCardId(nameCard)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.UseItemRspOuterClass.UseItemRsp;
public class PacketUseItemRsp extends GenshinPacket {
public PacketUseItemRsp(long targetGuid, GenshinItem useItem) {
super(PacketOpcodes.UseItemRsp);
UseItemRsp proto = UseItemRsp.newBuilder()
.setTargetGuid(targetGuid)
.setItemId(useItem.getItemId())
.setGuid(useItem.getGuid())
.build();
this.setData(proto);
}
public PacketUseItemRsp() {
super(PacketOpcodes.UseItemRsp);
UseItemRsp proto = UseItemRsp.newBuilder().setRetcode(1).build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WeaponAwakenRspOuterClass.WeaponAwakenRsp;
public class PacketWeaponAwakenRsp extends GenshinPacket {
public PacketWeaponAwakenRsp(GenshinAvatar avatar, GenshinItem item, GenshinItem feedWeapon, int oldRefineLevel) {
super(PacketOpcodes.WeaponAwakenRsp);
WeaponAwakenRsp.Builder proto = WeaponAwakenRsp.newBuilder()
.setTargetWeaponGuid(item.getGuid())
.setTargetWeaponAwakenLevel(item.getRefinement());
for (int affixId : item.getAffixes()) {
proto.putOldAffixLevelMap(affixId, oldRefineLevel);
proto.putCurAffixLevelMap(affixId, item.getRefinement());
}
if (avatar != null) {
proto.setAvatarGuid(avatar.getGuid());
}
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WeaponPromoteRspOuterClass.WeaponPromoteRsp;
public class PacketWeaponPromoteRsp extends GenshinPacket {
public PacketWeaponPromoteRsp(GenshinItem item, int oldPromoteLevel) {
super(PacketOpcodes.WeaponPromoteRsp);
WeaponPromoteRsp proto = WeaponPromoteRsp.newBuilder()
.setTargetWeaponGuid(item.getGuid())
.setCurPromoteLevel(item.getPromoteLevel())
.setOldPromoteLevel(oldPromoteLevel)
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam;
import emu.grasscutter.net.proto.WeaponUpgradeRspOuterClass.WeaponUpgradeRsp;
public class PacketWeaponUpgradeRsp extends GenshinPacket {
public PacketWeaponUpgradeRsp(GenshinItem item, int oldLevel, List<ItemParam> leftoverOres) {
super(PacketOpcodes.WeaponUpgradeRsp);
WeaponUpgradeRsp proto = WeaponUpgradeRsp.newBuilder()
.setTargetWeaponGuid(item.getGuid())
.setCurLevel(item.getLevel())
.setOldLevel(oldLevel)
.addAllItemParamList(leftoverOres)
.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.WearEquipRspOuterClass.WearEquipRsp;
public class PacketWearEquipRsp extends GenshinPacket {
public PacketWearEquipRsp(long avatarGuid, long equipGuid) {
super(PacketOpcodes.WearEquipRsp);
WearEquipRsp proto = WearEquipRsp.newBuilder()
.setAvatarGuid(avatarGuid)
.setEquipGuid(equipGuid)
.build();
this.setData(proto);
}
}
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