Preact: Add offer tie button in battle options (#2429)

---------

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
This commit is contained in:
Aurastic 2025-05-17 22:45:55 +05:30 committed by GitHub
parent 38534cfd52
commit 89d19a6fb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1543,7 +1543,8 @@ class BattleOptionsPanel extends PSRoomPanel {
override render() {
const room = this.props.room;
const battleRoom = this.getBattleRoom();
const isPlayer = !!battleRoom?.battle.myPokemon;
const canOfferTie = battleRoom && ((battleRoom.battle.turn >= 100 && isPlayer) || PS.user.group === '~');
return <PSPanelWrapper room={room} width={380}><div class="pad">
{battleRoom && <>
<p><strong>In this battle</strong></p>
@ -1629,7 +1630,12 @@ class BattleOptionsPanel extends PSRoomPanel {
/> Open new battles in the right-side panel
</label>
</p>}
<p><button data-cmd="/close" class="button">Done</button></p>
<p class="buttonbar">
<button data-cmd="/close" class="button">Done</button> {}
{battleRoom && <button data-cmd="/closeand /inopener /offertie" class="button" disabled={!canOfferTie}>
Offer Tie
</button>}
</p>
</div>
</PSPanelWrapper>;
}