// File: /workspace/github_c_makefile_star2_O1/schroeder-lvb[P]sissm/src/pitacnomic.c
// Function: pitacnomicChatCB
int pitacnomicChatCB( char *strIn )
{
    int errCode = 0, i;
    char *typeObj, clientID[256], chatText[256];
    char *w, *v;

    logPrintf( LOG_LEVEL_INFO, "pitacnomic", "Client chat ::%s::", strIn );

    // check if this is a valid chat line 
    //
    if ( 0 == (errCode = rosterParsePlayerChat( strIn, 256, clientID, chatText ))) {
        if (( 2 == strlen( chatText ))) {
            chatText[2] = 0;

            // check if the command issuer is 'dead' -- if so, consult list of prohibited 
            // codes that can only be issued by players that are alive.
            // Exemption-1 is when SISSM is hot-restarted (but not the game server) -- in this condition
            // SISSM thinks everybody is 'dead' so, override this condition, forcing everyone is 'alive'
            // until start of the next round.
            // Exemption-2 is if the players has "deadcmdr" privilege attribute (admins/moderators) then
            // s/he may be dead, but will may issue the stack/breach/blow commands.
            //
            if ((0 == apiIsPlayerAliveByGUID( clientID )) 
                  && !apiIsHotRestart() 
                  && !apiAuthIsAttribute( clientID, "deadcmdr" )) {  // if the issuer is "dead"

                 // check if this 2-letter-code is in the "live player only" list
                 // 
                 if ( NULL != strcasestr( pitacnomicConfig.livePlayersOnly, chatText ) ) {
                     // if so, invalidate the entered text (ignored by this plugin
                     //
                     chatText[0] = ' ';  chatText[1] = ' ';
                 }
            }

            // Resume regular processing of two-letter-code.  Do a table lookup
            // and send translated string to the player chat
            //
            for (i = 0; i<PITACNOMIC_MAXSHORTS; i++) {
                if ( 0 == strncmp( pitacnomicConfig.shorts[i], chatText, 2 )) {
                    // match is found on the table.  Parse for phrase to be
                    // sent to the game.
                    //
                    if (NULL != (w = getWord( pitacnomicConfig.shorts[i], 1, "\007" ) )) {
                        typeObj = rosterGetObjectiveType();
                        if ( NULL != strcasestr( typeObj, "capturable"  ) ) {
                            ;
                        }
                        if ( NULL != strcasestr( typeObj, "weaponcache" ) ) {
                            if (NULL != (v = getWord( pitacnomicConfig.shorts[i], 2, "\007" ) )) {
                                w = v;
                             }
                        }
                        apiSaySys( w );
                    }
                    break;
                }
            }       
        }
    }

    return errCode;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rdi, %rbx
leaq 0xfa34(%rip), %rsi      # 0x1c7ec
leaq 0xfa38(%rip), %rdx      # 0x1c7f7
movl $0x2, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1a227
leaq 0x100(%rsp), %rdx
movq %rsp, %rcx
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x152a7
movl %eax, %ebx
testl %eax, %eax
jne 0xcee7
movq %rsp, %rdi
callq 0x8120
cmpq $0x2, %rax
jne 0xcee7
movb $0x0, 0x2(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x11ba6
testl %eax, %eax
jne 0xce53
callq 0x14031
testl %eax, %eax
jne 0xce53
leaq 0xf9e2(%rip), %rsi      # 0x1c80a
leaq 0x100(%rsp), %rdi
callq 0x138da
testl %eax, %eax
jne 0xce53
leaq 0x6a234(%rip), %rdi     # 0x77074
movq %rsp, %rsi
callq 0x8350
testq %rax, %rax
je 0xce53
movw $0x2020, (%rsp)         # imm = 0x2020
movl $0x4, %r12d
leaq 0x51210(%rip), %r13     # 0x5e070
movq %rsp, %r15
leaq (%r12,%r13), %r14
movl $0x2, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x8080
testl %eax, %eax
je 0xce8d
addq $0x400, %r12            # imm = 0x400
cmpq $0x19004, %r12          # imm = 0x19004
jne 0xce63
jmp 0xcee7
leaq 0xe87c(%rip), %rdx      # 0x1b710
movq %r14, %rdi
movl $0x1, %esi
callq 0xf4e1
testq %rax, %rax
je 0xcee7
movq %rax, %r15
callq 0x14246
leaq 0xf025(%rip), %rsi      # 0x1beda
movq %rax, %rdi
callq 0x8350
testq %rax, %rax
je 0xcedd
leaq 0xe847(%rip), %rdx      # 0x1b710
movq %r14, %rdi
movl $0x2, %esi
callq 0xf4e1
testq %rax, %rax
cmovneq %rax, %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x1316b
movl %ebx, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq