Skip to content

Commit

Permalink
fix: make buying hats cost money
Browse files Browse the repository at this point in the history
  • Loading branch information
Picoseconds committed Aug 2, 2020
1 parent bbf9d16 commit 9177f2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/moomoo/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export default class Game {

let leaderboardUpdate: (string | number)[] = [];

for (let player of stableSort(this.state.players, (a, b) => {
for (let player of stableSort(this.state.players.filter(player => !player.dead), (a, b) => {
if (a.points < b.points) return -1;
if (a.points > b.points) return 1;
return 0;
Expand Down Expand Up @@ -959,6 +959,7 @@ export default class Game {
this.kickClient(client, "Kicked for hacks");
} else {
if (client.player.points >= (getHat(packet.data[1])?.price || 0)) {
client.player.points -= getHat(packet.data[1])?.price || 0;
client.ownedHats.push(packet.data[1]);
client.socket.send(
packetFactory.serializePacket(
Expand Down

0 comments on commit 9177f2d

Please sign in to comment.