// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %rdi, %rbx
leaq 0x8b1f(%rip), %rsi      # 0x1e9f6
callq 0x83b0
xorl %r14d, %r14d
testq %rax, %rax
je 0x160db
leaq 0x8b2b(%rip), %rsi      # 0x1ea1a
movq %rbx, %rdi
callq 0x83b0
testq %rax, %rax
je 0x160db
callq 0x117c0
movq %rax, 0x209f24(%rip)    # 0x21fe30
leaq 0x209a1d(%rip), %rdi    # 0x21f930
callq 0xf829
leaq 0x5946(%rip), %rdi      # 0x1b865
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x181e1
testq %rax, %rax
je 0x16040
leaq 0x209df7(%rip), %rax    # 0x21fd30
movq %rax, (%rsp)
leaq 0x2099ec(%rip), %rdx    # 0x21f930
leaq 0x209ae5(%rip), %rcx    # 0x21fa30
leaq 0x209bde(%rip), %r8     # 0x21fb30
leaq 0x209cd7(%rip), %r9     # 0x21fc30
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x15763
movl %eax, %r14d
leaq 0x208dac(%rip), %rdi    # 0x21ed1c
leaq 0x61d7(%rip), %rdx      # 0x1c14e
xorl %esi, %esi
callq 0xf82d
testq %rax, %rax
je 0x16040
movl $0x1, %ebp
leaq 0x209d9d(%rip), %r15    # 0x21fd30
leaq 0x208d82(%rip), %r12    # 0x21ed1c
leaq 0x61ad(%rip), %r13      # 0x1c14e
movq %r15, %rdi
movq %rax, %rsi
callq 0x8350
testq %rax, %rax
jne 0x15fc7
movq %r12, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0xf82d
incl %ebp
testq %rax, %rax
jne 0x15fa1
jmp 0x16040
leaq 0x209a62(%rip), %rdi    # 0x21fa30
leaq 0x8ad3(%rip), %rsi      # 0x1eaa8
callq 0x8350
testq %rax, %rax
jne 0x16040
cmpb $0x0, 0x20994a(%rip)    # 0x21f930
je 0x16040
leaq 0x209941(%rip), %r15    # 0x21f930
leaq 0x209526(%rip), %rsi    # 0x21f51c
movq %r15, %rdi
callq 0x13789
leaq 0x8aab(%rip), %rdi      # 0x1eab0
leaq 0x209d24(%rip), %r12    # 0x21fd30
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x13337
leaq 0x8ab2(%rip), %rsi      # 0x1ead2
leaq 0x8ab6(%rip), %rdx      # 0x1eadd
leaq 0x209a02(%rip), %r8     # 0x21fa30
movl $0x2, %edi
movq %r15, %rcx
movq %r12, %r9
xorl %eax, %eax
callq 0x1a3e3
movq 0x209df1(%rip), %rdi    # 0x21fe38
callq 0xfcc3
testq %rax, %rax
jle 0x160db
cmpb $0x0, 0x2098d4(%rip)    # 0x21f930
jne 0x16095
leaq 0x209ccb(%rip), %rax    # 0x21fd30
movq %rax, (%rsp)
leaq 0x2098c0(%rip), %rdx    # 0x21f930
leaq 0x2099b9(%rip), %rcx    # 0x21fa30
leaq 0x209ab2(%rip), %r8     # 0x21fb30
leaq 0x209bab(%rip), %r9     # 0x21fc30
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x15763
movl %eax, %r14d
leaq 0x209c94(%rip), %rax    # 0x21fd30
movq %rax, 0x8(%rsp)
leaq 0x209b88(%rip), %rax    # 0x21fc30
movq %rax, (%rsp)
leaq 0x8a1f(%rip), %rsi      # 0x1ead2
leaq 0x8a4e(%rip), %rdx      # 0x1eb08
leaq 0x20986f(%rip), %rcx    # 0x21f930
leaq 0x209968(%rip), %r8     # 0x21fa30
leaq 0x209a61(%rip), %r9     # 0x21fb30
movl $0x2, %edi
xorl %eax, %eax
callq 0x1a3e3
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq