checkNum = 0
correctNum = 1
tmp = %2
chatName = %1
showNum = @tmp
#math tmpCount {%len( @tmp) / 2}
tmpLen = %len( @tmp)
#loop 1,@tmpCount {
#math tmpLen {@tmpLen - 2}
tmpNum = %db( @convertChineseNum, %left( @tmp, 2))
#addkey tmpNumList {%i} {@tmpNum}
@tmp = %rightback( @tmp, @tmpLen)
}
#loopdb @tmpNumList {
#if %val>99 {
#math lastPos {%key - 1}
#math nextPos {%key + 1}
lastNum = %db( @tmpNumList, @lastPos)
nextNum = %db( @tmpNumList, @nextPos)
#if %val=10000 {
#math lastTwoPos {%key - 2}
lastTwoNum = %db( @tmpNumList, @lastTwoPos)
#if @lastNum!=10 {#math checkNum {@checkNum * %val}}
#unvar lastTwoPos
#unvar lastTwoNum
} {#math checkNum {@checkNum + @lastNum*%val}}
#if @nextNum>9 {#if @nextNum!=10000 {correctNum = 0}}
#unvar lastPos
#unvar nextPos
#unvar lastNum
#unvar nextNum
}
#if %val=0 {
#math nextPos {%key + 1}
nextNum = %db( @tmpNumList, @nextPos)
#math nextTwoPos {%key + 2}
nextTwoNum = %db( @tmpNumList, @nextTwoPos)
#if @nextTwoNum<10 {#math checkNum {@checkNum + @nextNum}}
#if @nextTwoNum=10000 {#math checkNum {@checkNum + @nextNum}}
#if @nextNum>9 {correctNum = 0}
#unvar nextPos
#unvar nextNum
#unvar nextTwoPos
#unvar nextTwoNum
}
#if %val=10 {
#math lastPos {%key - 1}
#math nextPos {%key + 1}
lastNum = %db( @tmpNumList, @lastPos)
nextNum = %db( @tmpNumList, @nextPos)
#if !@lastNum {#if @nextNum!=10000 {#math checkNum {@checkNum + %val + @nextNum}} {#math checkNum {%val * @nextNum}}} {#if @nextNum!=10000 {#math checkNum {@checkNum + @lastNum*%val + @nextNum}} {#math checkNum {(@checkNum + @lastNum*%val) * @nextNum}}}
#if @nextNum>9 {#if @nextNum!=10000 {correctNum = 0}}
#unvar lastPos
#unvar nextPos
#unvar lastNum
#unvar nextNum
}
#if %key=@tmpCount {
#if %val<10 {
#math lastPos {%key - 1}
lastNum = %db( @tmpNumList, @lastPos)
#if @lastNum<10 {#if @lastNum>0 {correctNum = 0}}
#unvar lastPos
#unvar lastNum
}
}
#if @tmpCount=1 {checkNum = %db( @tmpNumList, %key)}
}
#if @correctNum=0 {chat %1, 数字错误:@showNum} {chat %1, 数字为: @checkNum}
#unvar tmpNumList
#unvar checkNum
#unvar correctNum
#unvar tmp
#unvar chatName
#unvar showNum
#unvar tmpLen
#unvar tmpCount
#unvar tmpNum