All Downloads are FREE. Search and download functionalities are using the official Maven repository.

emu.grasscutter.server.packet.send.PacketWeaponAwakenRsp Maven / Gradle / Ivy

The newest version!
package emu.grasscutter.server.packet.send;

import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WeaponAwakenRspOuterClass.WeaponAwakenRsp;

public class PacketWeaponAwakenRsp extends BasePacket {
	
	public PacketWeaponAwakenRsp(Avatar avatar, GameItem item, GameItem 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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy