// File: /workspace/github_c_makefile_star2_O3/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 0xf68e(%rip), %rsi      # 0x1c7c6
leaq 0xf692(%rip), %rdx      # 0x1c7d1
movl $0x2, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1a3e3
leaq 0x100(%rsp), %rdx
movq %rsp, %rcx
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x1554c
movl %eax, %ebx
testl %eax, %eax
jne 0xd267
movq %rsp, %rdi
callq 0x8120
cmpq $0x2, %rax
jne 0xd267
movb $0x0, 0x2(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x11f1f
testl %eax, %eax
jne 0xd1d3
callq 0x1436d
testl %eax, %eax
jne 0xd1d3
leaq 0xf63c(%rip), %rsi      # 0x1c7e4
leaq 0x100(%rsp), %rdi
callq 0x13c3d
testl %eax, %eax
jne 0xd1d3
leaq 0x69eb4(%rip), %rdi     # 0x77074
movq %rsp, %rsi
callq 0x8350
testq %rax, %rax
je 0xd1d3
movw $0x2020, (%rsp)         # imm = 0x2020
movl $0x4, %r12d
leaq 0x50e90(%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 0xd20d
addq $0x400, %r12            # imm = 0x400
cmpq $0x19004, %r12          # imm = 0x19004
jne 0xd1e3
jmp 0xd267
leaq 0xe4f4(%rip), %rdx      # 0x1b708
movq %r14, %rdi
movl $0x1, %esi
callq 0xf82d
testq %rax, %rax
je 0xd267
movq %rax, %r15
callq 0x14563
leaq 0xec9d(%rip), %rsi      # 0x1bed2
movq %rax, %rdi
callq 0x8350
testq %rax, %rax
je 0xd25d
leaq 0xe4bf(%rip), %rdx      # 0x1b708
movq %r14, %rdi
movl $0x2, %esi
callq 0xf82d
testq %rax, %rax
cmovneq %rax, %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x134e5
movl %ebx, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq