Commit a7312ce0 authored by Akka's avatar Akka Committed by GitHub
Browse files

Merge pull request #2 from Grasscutters/development

Development
parents 81998b9c 3ede7523
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.entity.GameEntity; import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.props.LifeState; import emu.grasscutter.game.props.LifeState;
import emu.grasscutter.net.packet.BasePacket; 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;
import java.util.ArrayList;
public class PacketLifeStateChangeNotify extends BasePacket { public class PacketLifeStateChangeNotify extends BasePacket {
public PacketLifeStateChangeNotify(GameEntity attacker, GameEntity target, LifeState lifeState) { public PacketLifeStateChangeNotify(GameEntity attacker, GameEntity target, LifeState lifeState) {
...@@ -26,7 +31,29 @@ public class PacketLifeStateChangeNotify extends BasePacket { ...@@ -26,7 +31,29 @@ public class PacketLifeStateChangeNotify extends BasePacket {
.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());
}
} }
...@@ -15,14 +15,7 @@ public class PacketTakeAchievementRewardReq extends BasePacket { ...@@ -15,14 +15,7 @@ public class PacketTakeAchievementRewardReq extends BasePacket {
public PacketTakeAchievementRewardReq(GameSession session) { public PacketTakeAchievementRewardReq(GameSession session) {
super(PacketOpcodes.TakeAchievementRewardReq); super(PacketOpcodes.TakeAchievementRewardReq);
List<AchievementInfo> a_list = new ArrayList<>(); TakeAchievementRewardReq proto = TakeAchievementRewardReq.newBuilder().build();
a_list.add(AchievementInfo.newBuilder().setId(82044).setStatusValue(2).setCurrent(0).setGoal(1).build());
a_list.add(AchievementInfo.newBuilder().setId(81205).setStatusValue(2).setCurrent(0).setGoal(1).build());
TakeAchievementRewardReq proto = TakeAchievementRewardReq.newBuilder()
.addAllAList(a_list)
.build();
this.setData(proto); this.setData(proto);
} }
......
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.TowerFloorData;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.TowerAllDataRspOuterClass.TowerAllDataRsp; import emu.grasscutter.net.proto.TowerAllDataRspOuterClass.TowerAllDataRsp;
import emu.grasscutter.net.proto.TowerCurLevelRecordOuterClass.TowerCurLevelRecord; import emu.grasscutter.net.proto.TowerCurLevelRecordOuterClass.TowerCurLevelRecord;
import emu.grasscutter.net.proto.TowerFloorRecordOuterClass.TowerFloorRecord; import emu.grasscutter.net.proto.TowerFloorRecordOuterClass.TowerFloorRecord;
import java.util.stream.Collectors;
public class PacketTowerAllDataRsp extends BasePacket { public class PacketTowerAllDataRsp extends BasePacket {
public PacketTowerAllDataRsp() { public PacketTowerAllDataRsp() {
super(PacketOpcodes.TowerAllDataRsp); super(PacketOpcodes.TowerAllDataRsp);
var list = GameData.getTowerFloorDataMap().values().stream()
.map(TowerFloorData::getFloorId)
.map(id -> TowerFloorRecord.newBuilder().setFloorId(id).build())
.collect(Collectors.toList());
TowerAllDataRsp proto = TowerAllDataRsp.newBuilder() TowerAllDataRsp proto = TowerAllDataRsp.newBuilder()
.setTowerScheduleId(29) .setTowerScheduleId(29)
.addTowerFloorRecordList(TowerFloorRecord.newBuilder().setFloorId(1001)) .addAllTowerFloorRecordList(list)
.setCurLevelRecord(TowerCurLevelRecord.newBuilder().setIsEmpty(true)) .setCurLevelRecord(TowerCurLevelRecord.newBuilder().setIsEmpty(true))
.setNextScheduleChangeTime(Integer.MAX_VALUE) .setNextScheduleChangeTime(Integer.MAX_VALUE)
.putFloorOpenTimeMap(1024, 1630486800) .putFloorOpenTimeMap(1024, 1630486800)
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.TowerEnterLevelRspOuterClass.TowerEnterLevelRsp;
public class PacketTowerEnterLevelRsp extends BasePacket {
public PacketTowerEnterLevelRsp(int floorId, int levelIndex) {
super(PacketOpcodes.TowerEnterLevelRsp);
TowerEnterLevelRsp proto = TowerEnterLevelRsp.newBuilder()
.setFloorId(floorId)
.setLevelIndex(levelIndex)
.addTowerBuffIdList(4)
.addTowerBuffIdList(28)
.addTowerBuffIdList(18)
.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.TowerTeamSelectRspOuterClass.TowerTeamSelectRsp;
public class PacketTowerTeamSelectRsp extends BasePacket {
public PacketTowerTeamSelectRsp() {
super(PacketOpcodes.TowerTeamSelectRsp);
TowerTeamSelectRsp proto = TowerTeamSelectRsp.newBuilder()
.build();
this.setData(proto);
}
}
package emu.grasscutter.server.packet.send;
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.WorldPlayerReviveRspOuterClass.WorldPlayerReviveRsp;
public class PacketWorldPlayerReviveRsp extends BasePacket {
public PacketWorldPlayerReviveRsp() {
super(PacketOpcodes.WorldPlayerReviveRsp);
WorldPlayerReviveRsp.Builder proto = WorldPlayerReviveRsp.newBuilder();
this.setData(proto.build());
}
}
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