send CompoundDataNotify on Login;fix spelling mistakes. (#1869)

This commit is contained in:
dragon 2022-10-17 18:14:06 +08:00 committed by GitHub
parent 84d02370df
commit b5f356ce4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 13 deletions

View File

@ -14,6 +14,7 @@ import emu.grasscutter.net.proto.PlayerCompoundMaterialReqOuterClass.PlayerCompo
import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode;
import emu.grasscutter.net.proto.TakeCompoundOutputReqOuterClass.TakeCompoundOutputReq;
import emu.grasscutter.server.packet.send.PackageTakeCompoundOutputRsp;
import emu.grasscutter.server.packet.send.PacketCompoundDataNotify;
import emu.grasscutter.server.packet.send.PacketGetCompoundDataRsp;
import emu.grasscutter.server.packet.send.PacketPlayerCompoundMaterialRsp;
import emu.grasscutter.utils.Utils;
@ -129,4 +130,8 @@ public class CookingCompoundManager extends BasePlayerManager {
player.sendPacket(new PackageTakeCompoundOutputRsp(null, Retcode.RET_COMPOUND_NOT_FINISH_VALUE));
}
}
public void onPlayerLogin() {
player.sendPacket(new PacketCompoundDataNotify(unlocked,getCompoundQueueData()));
}
}

View File

@ -12,7 +12,6 @@ import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.player.BasePlayerManager;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.ActionReason;
import emu.grasscutter.game.props.ItemUseOp;
import emu.grasscutter.net.proto.CookRecipeDataOuterClass;
import emu.grasscutter.net.proto.PlayerCookArgsReqOuterClass.PlayerCookArgsReq;
import emu.grasscutter.net.proto.PlayerCookReqOuterClass.PlayerCookReq;
@ -164,16 +163,16 @@ public class CookingManager extends BasePlayerManager {
}
}
public void sendCookDataNofity() {
// Default unlocked recipies to player if they don't have them yet.
public void sendCookDataNotify() {
// Default unlocked recipes to player if they don't have them yet.
this.addDefaultUnlocked();
// Get unlocked recipies.
var unlockedRecipies = this.player.getUnlockedRecipies();
// Get unlocked recipes.
var unlockedRecipes = this.player.getUnlockedRecipies();
// Construct CookRecipeData protos.
List<CookRecipeDataOuterClass.CookRecipeData> data = new ArrayList<>();
for (var recipe : unlockedRecipies.entrySet()) {
for (var recipe : unlockedRecipes.entrySet()) {
int recipeId = recipe.getKey();
int proficiency = recipe.getValue();

View File

@ -1199,7 +1199,8 @@ public class Player {
session.send(new PacketGetChatEmojiCollectionRsp(this.getChatEmojiIdList()));
this.forgingManager.sendForgeDataNotify();
this.resinManager.onPlayerLogin();
this.cookingManager.sendCookDataNofity();
this.cookingManager.sendCookDataNotify();
this.cookingCompoundManager.onPlayerLogin();
this.teamManager.onPlayerLogin();
getTodayMoonCard(); // The timer works at 0:0, some users log in after that, use this method to check if they have received a reward today or not. If not, send the reward.

View File

@ -0,0 +1,21 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.CompoundDataNotifyOuterClass.CompoundDataNotify;
import emu.grasscutter.net.proto.CompoundQueueDataOuterClass.CompoundQueueData;
import java.util.List;
import java.util.Set;
public class PacketCompoundDataNotify extends BasePacket {
public PacketCompoundDataNotify(Set<Integer> unlockedCompounds, List<CompoundQueueData> compoundQueueData) {
super(PacketOpcodes.CompoundDataNotify);
var proto= CompoundDataNotify.newBuilder()
.addAllUnlockCompoundList(unlockedCompounds)
.addAllCompoundQueDataList(compoundQueueData)
.build();
this.setData(proto);
}
}

View File

@ -8,14 +8,14 @@ import emu.grasscutter.net.proto.CookDataNotifyOuterClass.CookDataNotify;
import emu.grasscutter.net.proto.CookRecipeDataOuterClass.CookRecipeData;
public class PacketCookDataNotify extends BasePacket {
public PacketCookDataNotify(List<CookRecipeData> recipies) {
public PacketCookDataNotify(List<CookRecipeData> recipes) {
super(PacketOpcodes.CookDataNotify);
CookDataNotify proto = CookDataNotify.newBuilder()
.addAllRecipeDataList(recipies)
.addAllRecipeDataList(recipes)
.build();
this.setData(proto);
}
}

View File

@ -10,11 +10,11 @@ import java.util.List;
import java.util.Set;
public class PacketGetCompoundDataRsp extends BasePacket {
public PacketGetCompoundDataRsp(Set<Integer> unlockedCompounds, List<CompoundQueueData> compundQueueData) {
public PacketGetCompoundDataRsp(Set<Integer> unlockedCompounds, List<CompoundQueueData> compoundQueueData) {
super(PacketOpcodes.GetCompoundDataRsp);
var proto = GetCompoundDataRsp.newBuilder()
.addAllUnlockCompoundList(unlockedCompounds)
.addAllCompoundQueDataList(compundQueueData)
.addAllCompoundQueDataList(compoundQueueData)
.setRetcode(Retcode.RET_SUCC_VALUE)
.build();
setData(proto);