Skip to content

Commit

Permalink
fix issue with lastWhisperedPlayer being undefined (#1983)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGruber authored Mar 2, 2024
2 parents 18a65d2 + b9d4aa3 commit 2f7462a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/servers/ZoneServer2016/entities/character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class Character2016 extends BaseFullCharacter {
isReady = false;
creationDate!: string;
lastLoginDate!: string;
lastWhisperedPlayer!: string;
lastWhisperedPlayer?: string;
hasAlertedBees = false;
vehicleExitDate: number = new Date().getTime();
currentLoadoutSlot = LoadoutSlots.FISTS;
Expand Down
4 changes: 4 additions & 0 deletions src/servers/ZoneServer2016/handlers/commands/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ export const commands: Array<Command> = [
server.sendChatText(client, "[Reply] The message may not be blank!");
return;
}
if (!client.character.lastWhisperedPlayer) {
server.sendChatText(client, "[Reply] No one has whispered you yet.");
return;
}

let targetClient = server.getClientByNameOrLoginSession(
client.character.lastWhisperedPlayer
Expand Down
2 changes: 1 addition & 1 deletion src/servers/ZoneServer2016/managers/constructionmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ export class ConstructionManager {
server.updateResource(
client,
entity.characterId,
(entity.maxHealth / entity.health) * 1000000,
(entity.health / entity.maxHealth) * 1000000,
ResourceIds.CONSTRUCTION_CONDITION,
ResourceTypes.CONDITION
);
Expand Down

0 comments on commit 2f7462a

Please sign in to comment.