// File: /workspace/github_c_makefile_star2_O1/schroeder-lvb[P]sissm/src/piantirush.c
// Function: piantirushActivityCB
int piantirushActivityCB( char *strIn )
{
    int killDetected = 0;
    int errCode = 0, match = 0, i;
    char *s;
    static char killerName[256], killerID[256], killedName[256], killedID[256], weaponName[256];

    // check kill activity for area-clear status before breach/destruct
    // 
    if ( NULL != strstr( strIn, " killed " ) ) {
        if ( NULL != strstr( strIn, " with " ) ) {
            killDetected = 1;
            _lastKillTime = apiTimeGet();    
            strclr( killerName );
        }
    }

    // due to high rate of message, this will help to optimize
    // looking for 'kill' message
    //
    if ( killDetected ) {

        // if this feature is enabled by p2pvars
        //
        if ( 0L != p2pGetL( "piantirush.p2p.genevaKick", 0L ) ) {
            errCode = rosterParsePlayerKill(strIn, 256, killerName, killerID, killedName, killedID, weaponName );

            // looking for some weapons possibilities, such as
            // BP_Projectile_Molotov_C_2146811897 BP_Projectile_RocketAT4_C_2146858628 
            // BP_Projectile_ANM14_C_2146829547 BP_Projectile_RocketRPG7_C_2147463592 
            //
            for (match = 0, i = 0;; i++ ) {
                if ( NULL == (s = getWord( piantirushConfig.genevaWeapons, i, " " )) ) 
                    break;
                if ( NULL != strcasestr( weaponName, s ) ) {
                    match = 1;
                    break;
                }
            }
        }
 
        if ( match ) {
            // if the killer is a human, then kick
            //
            if ( NULL == strcasestr( killerID, "INVALID" ) ) {
                if ( 0 != strlen( killerName ) ) {
                    apiKick( killerName, piantirushConfig.genevaKickReason );
                    apiSay( "'%s' kicked - illegal use of '%s'", killerName, weaponName );
                    logPrintf( LOG_LEVEL_INFO, "piantirush", "Auto-Kicked restricted weapon ::%s::%s::%s", killerName, killerID, weaponName );
                }
            }
        }
    }

    // Experimental "spawn kill detection" algorithm - WIP for logging only
    //
    // Check kill activity for possible bot spawn kill
    // For CPU optimization process this only inside the check time window 'aPtr'
    // 
    if ( killDetected ) {

        if ( alarmStatus( sPtr ) > 0L ) {                  // if inside the detection window then
            if ( 0 == strlen( killerName ) )
                errCode = rosterParsePlayerKill(strIn, 256, killerName, killerID, killedName, killedID, weaponName );
            logPrintf( LOG_LEVEL_INFO, "piantirush", "Bot-spawnkill kill :%s:%s:%s:%s:%s", killerName, killerID, killedName, killedID, weaponName );
        }

    }

    return errCode;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r13
leaq 0x8d9d(%rip), %rsi      # 0x1ea06
callq 0x83b0
movb $0x1, %bl
testq %rax, %rax
je 0x15ca3
leaq 0x8dae(%rip), %rsi      # 0x1ea2a
movq %r13, %rdi
callq 0x83b0
testq %rax, %rax
je 0x15ca3
callq 0x114b2
movq %rax, 0x20a19b(%rip)    # 0x21fe30
leaq 0x209c94(%rip), %rdi    # 0x21f930
callq 0xf4dd
xorl %ebx, %ebx
xorl %ebp, %ebp
testb %bl, %bl
jne 0x15ded
leaq 0x5bb9(%rip), %rdi      # 0x1b86d
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x18004
movb $0x1, %r14b
testq %rax, %rax
je 0x15d6f
leaq 0x20a060(%rip), %rax    # 0x21fd30
movq %rax, (%rsp)
leaq 0x209c55(%rip), %rdx    # 0x21f930
leaq 0x209d4e(%rip), %rcx    # 0x21fa30
leaq 0x209e47(%rip), %r8     # 0x21fb30
leaq 0x209f40(%rip), %r9     # 0x21fc30
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x154ca
movl %eax, %ebp
leaq 0x209016(%rip), %rdi    # 0x21ed1c
leaq 0x6449(%rip), %rdx      # 0x1c156
xorl %esi, %esi
callq 0xf4e1
testq %rax, %rax
je 0x15d6f
movq %rbp, 0x18(%rsp)
movq %r13, 0x20(%rsp)
movl $0x1, %ebp
leaq 0x20a001(%rip), %r15    # 0x21fd30
leaq 0x208fe6(%rip), %r12    # 0x21ed1c
leaq 0x6419(%rip), %r13      # 0x1c156
movq %r15, %rdi
movq %rax, %rsi
callq 0x8350
testq %rax, %rax
sete %r14b
jne 0x15d65
movq %r12, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0xf4e1
incl %ebp
testq %rax, %rax
jne 0x15d3d
movq 0x20(%rsp), %r13
movq 0x18(%rsp), %rbp
testb %r14b, %r14b
jne 0x15ded
leaq 0x209cb5(%rip), %rdi    # 0x21fa30
leaq 0x8d3e(%rip), %rsi      # 0x1eac0
callq 0x8350
testq %rax, %rax
jne 0x15ded
cmpb $0x0, 0x209b9d(%rip)    # 0x21f930
je 0x15ded
leaq 0x209b94(%rip), %r15    # 0x21f930
leaq 0x209779(%rip), %rsi    # 0x21f51c
movq %r15, %rdi
callq 0x13412
leaq 0x8d16(%rip), %rdi      # 0x1eac8
leaq 0x209f77(%rip), %r12    # 0x21fd30
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x12fba
leaq 0x8d1d(%rip), %rsi      # 0x1eaea
leaq 0x8d21(%rip), %rdx      # 0x1eaf5
leaq 0x209c55(%rip), %r8     # 0x21fa30
movl $0x2, %edi
movq %r15, %rcx
movq %r12, %r9
xorl %eax, %eax
callq 0x1a227
testb %bl, %bl
jne 0x15e8f
movq 0x20a03c(%rip), %rdi    # 0x21fe38
callq 0xf97e
testq %rax, %rax
jle 0x15e8f
cmpb $0x0, 0x209b1f(%rip)    # 0x21f930
jne 0x15e49
leaq 0x209f16(%rip), %rax    # 0x21fd30
movq %rax, (%rsp)
leaq 0x209b0b(%rip), %rdx    # 0x21f930
leaq 0x209c04(%rip), %rcx    # 0x21fa30
leaq 0x209cfd(%rip), %r8     # 0x21fb30
leaq 0x209df6(%rip), %r9     # 0x21fc30
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x154ca
movl %eax, %ebp
leaq 0x209ee0(%rip), %rax    # 0x21fd30
movq %rax, 0x8(%rsp)
leaq 0x209dd4(%rip), %rax    # 0x21fc30
movq %rax, (%rsp)
leaq 0x8c83(%rip), %rsi      # 0x1eaea
leaq 0x8cb2(%rip), %rdx      # 0x1eb20
leaq 0x209abb(%rip), %rcx    # 0x21f930
leaq 0x209bb4(%rip), %r8     # 0x21fa30
leaq 0x209cad(%rip), %r9     # 0x21fb30
movl $0x2, %edi
xorl %eax, %eax
callq 0x1a227
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq