Change first message to chat dependent

This commit is contained in:
kwaroran
2024-09-18 23:25:02 +09:00
parent 6ad841e931
commit 85609e890e
15 changed files with 50 additions and 61 deletions

View File

@@ -601,32 +601,34 @@
<Chat
character={$CurrentSimpleCharacter}
name={$CurrentCharacter.name}
message={$CurrentCharacter.firstMsgIndex === -1 ? $CurrentCharacter.firstMessage :
$CurrentCharacter.alternateGreetings[$CurrentCharacter.firstMsgIndex]}
message={$CurrentChat.fmIndex === -1 ? $CurrentCharacter.firstMessage :
$CurrentCharacter.alternateGreetings[$CurrentChat.fmIndex]}
img={getCharImage($CurrentCharacter.image, 'css')}
idx={-1}
altGreeting={$CurrentCharacter.alternateGreetings.length > 0}
largePortrait={$CurrentCharacter.largePortrait}
onReroll={() => {
const cha = $CurrentCharacter
const chat = $CurrentChat
if(cha.type !== 'group'){
if (cha.firstMsgIndex >= (cha.alternateGreetings.length - 1)){
cha.firstMsgIndex = -1
if (chat.fmIndex >= (cha.alternateGreetings.length - 1)){
chat.fmIndex = -1
}
else{
cha.firstMsgIndex += 1
chat.fmIndex += 1
}
}
$CurrentCharacter = cha
$CurrentChat = chat
}}
unReroll={() => {
const cha = $CurrentCharacter
const chat = $CurrentChat
if(cha.type !== 'group'){
if (cha.firstMsgIndex === -1){
cha.firstMsgIndex = (cha.alternateGreetings.length - 1)
if (chat.fmIndex === -1){
chat.fmIndex = (cha.alternateGreetings.length - 1)
}
else{
cha.firstMsgIndex -= 1
chat.fmIndex -= 1
}
}
$CurrentCharacter = cha