|
@@ -11,22 +11,27 @@ namespace CardCollector.Commands.CallbackQuery
|
|
|
protected override string CommandText => Command.combine;
|
|
|
public override async Task Execute()
|
|
|
{
|
|
|
+ var selectedSticker = User.Session.SelectedSticker;
|
|
|
var combineCount = User.Session.GetCombineCount();
|
|
|
if (combineCount == Constants.COMBINE_COUNT)
|
|
|
await MessageController.AnswerCallbackQuery(User, CallbackQueryId, Messages.cant_combine, true);
|
|
|
else
|
|
|
{
|
|
|
- if (combineCount + User.Session.SelectedSticker.Count > Constants.COMBINE_COUNT)
|
|
|
+ if (combineCount + selectedSticker.Count > Constants.COMBINE_COUNT)
|
|
|
{
|
|
|
- User.Session.SelectedSticker.Count = Constants.COMBINE_COUNT - combineCount;
|
|
|
+ selectedSticker.Count = Constants.COMBINE_COUNT - combineCount;
|
|
|
await MessageController.AnswerCallbackQuery(User, CallbackQueryId, $"{Messages.combine_added_only} " +
|
|
|
- $"{User.Session.SelectedSticker.Count}{Text.items}", true);
|
|
|
+ $"{selectedSticker.Count}{Text.items}", true);
|
|
|
}
|
|
|
-
|
|
|
- if (!User.Session.CombineList.ContainsKey(User.Session.SelectedSticker.Md5Hash))
|
|
|
- User.Session.CombineList.Add(User.Session.SelectedSticker.Md5Hash, User.Session.SelectedSticker);
|
|
|
- else
|
|
|
- User.Session.CombineList[User.Session.SelectedSticker.Md5Hash].Count = User.Session.SelectedSticker.Count;
|
|
|
+ if (User.Session.CombineList.ContainsKey(selectedSticker.Md5Hash))
|
|
|
+ {
|
|
|
+ var combineSticker = User.Session.CombineList[selectedSticker.Md5Hash];
|
|
|
+ if (selectedSticker.MaxCount < combineSticker.Count + selectedSticker.Count)
|
|
|
+ User.Session.CombineList[selectedSticker.Md5Hash].Count = selectedSticker.Count;
|
|
|
+ else
|
|
|
+ User.Session.CombineList[selectedSticker.Md5Hash].Count += selectedSticker.Count;
|
|
|
+ }
|
|
|
+ else User.Session.CombineList.Add(selectedSticker.Md5Hash, selectedSticker);
|
|
|
}
|
|
|
await new BackToCombine(User, Update).Execute();
|
|
|
}
|