Skip to content

Commit

Permalink
Fix Bugs
Browse files Browse the repository at this point in the history
- Players who didn't get in the tile would get their tickets refunded.
  • Loading branch information
5jiji committed Mar 10, 2024
1 parent b74f4ec commit 507d27f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions Assets/Scripts/BidHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public void ReleasePlayersIntoTile(GameTile gt, Vector3 beltWayPointPos)
UpdateBiddingQ();
}

public void ClearFromQ(PlayerHandler ph, bool updateQ)
public void ClearFromQ(PlayerHandler ph, bool updateQ, bool unbid = false)
{
ph.ResetBid();

Expand All @@ -385,7 +385,7 @@ public void ClearFromQ(PlayerHandler ph, bool updateQ)
if (ph.pb != null)
ph.pb.ExplodeBall();

CancelTicketsUsed(ph);
CancelTicketsUsed(ph, unbid);

if (updateQ)
UpdateBiddingQ();
Expand Down Expand Up @@ -593,12 +593,15 @@ private void SetBasePrizeByRarity(RarityType rarity)
UpdateBiddingQ();
}

private async void CancelTicketsUsed(PlayerHandler ph)
private async void CancelTicketsUsed(PlayerHandler ph, bool unbid)
{
foreach (var rewardID in ph.redemptionsIds.Keys)
if (unbid)
{
List<string> redemptionsIds = ph.redemptionsIds[rewardID];
await TwitchApi.RejectRewardRedemption(rewardID, redemptionsIds);
foreach (var rewardID in ph.redemptionsIds.Keys)
{
List<string> redemptionsIds = ph.redemptionsIds[rewardID];
await TwitchApi.RejectRewardRedemption(rewardID, redemptionsIds);
}
}

ph.redemptionsIds.Clear();
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Networking/TwitchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ private void ProcessGlobalCommands(string messageId, PlayerHandler ph, string ms

else if (commandKey.StartsWith("!cancelbid") || commandKey.StartsWith("!unbid"))
{
_bidHandler.ClearFromQ(ph, updateQ:true);
_bidHandler.ClearFromQ(ph, updateQ:true, unbid:true);
}

else if (commandKey.StartsWith("!song"))
Expand Down Expand Up @@ -687,4 +687,4 @@ private string RemoveTwitchEmotes(string rawMsg, List<Emote> emotes)

return noEmotesSb.ToString();
}
}
}

0 comments on commit 507d27f

Please sign in to comment.