mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-27 12:10:14 +08:00
Little update to item giving handling (#2363)
* Little update to HandlerItemGivingReq.java GIVING_METHOD_GROUP is used in cooking girl's quest * Send the giving packet at the start of relogs, even if encountered before. * Make item checking not exact You can have more items in your inventory than what you are submitting.
This commit is contained in:
committed by
GitHub
Unverified
parent
2b64814534
commit
f955bb1e16
@@ -101,22 +101,17 @@ public final class QuestManager extends BasePlayerManager {
|
||||
* Attempts to add the giving action.
|
||||
*
|
||||
* @param givingId The giving action ID.
|
||||
* @throws IllegalStateException If the giving action is already active.
|
||||
*/
|
||||
public void addGiveItemAction(int givingId) throws IllegalStateException {
|
||||
var progress = this.player.getPlayerProgress();
|
||||
var givings = progress.getItemGivings();
|
||||
|
||||
// Check if the action is already present.
|
||||
if (givings.containsKey(givingId)) {
|
||||
throw new IllegalStateException("Giving action " + givingId + " is already active.");
|
||||
// Check if the action is not present.
|
||||
if (!givings.containsKey(givingId)) {
|
||||
givings.put(givingId, ItemGiveRecord.resolve(givingId));
|
||||
player.save();
|
||||
}
|
||||
|
||||
// Add the action.
|
||||
givings.put(givingId, ItemGiveRecord.resolve(givingId));
|
||||
// Save the givings.
|
||||
player.save();
|
||||
|
||||
this.sendGivingRecords();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user