// File: /workspace/github_c_makefile_star2_O2/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 0x8ab4(%rip), %rsi      # 0x1d9e6
callq 0x83c0
xorl %r14d, %r14d
testq %rax, %rax
je 0x1510c
leaq 0x8ac0(%rip), %rsi      # 0x1da0a
movq %rbx, %rdi
callq 0x83c0
testq %rax, %rax
je 0x1510c
callq 0x10b6a
movq %rax, 0x20aec9(%rip)    # 0x21fe30
leaq 0x20a9c2(%rip), %rdi    # 0x21f930
callq 0xed98
leaq 0x58eb(%rip), %rdi      # 0x1a865
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x17172
testq %rax, %rax
je 0x15073
leaq 0x20ad9c(%rip), %r15    # 0x21fd30
movq %r15, (%rsp)
leaq 0x20a991(%rip), %rdx    # 0x21f930
leaq 0x20aa8a(%rip), %rcx    # 0x21fa30
leaq 0x20ab83(%rip), %r8     # 0x21fb30
leaq 0x20ac7c(%rip), %r9     # 0x21fc30
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x147de
movl %eax, %r14d
xorl %ebp, %ebp
leaq 0x209d4f(%rip), %r12    # 0x21ed1c
leaq 0x617a(%rip), %r13      # 0x1b14e
movq %r12, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0xed9c
testq %rax, %rax
je 0x15073
movq %r15, %rdi
movq %rax, %rsi
callq 0x8360
incl %ebp
testq %rax, %rax
je 0x14fd4
leaq 0x20aa2d(%rip), %rdi    # 0x21fa30
leaq 0x66b6(%rip), %rsi      # 0x1b6c0
callq 0x8360
testq %rax, %rax
jne 0x15073
cmpb $0x0, 0x20a915(%rip)    # 0x21f930
je 0x15073
leaq 0x20a90c(%rip), %r15    # 0x21f930
leaq 0x20a4f1(%rip), %rsi    # 0x21f51c
movq %r15, %rdi
callq 0x129f0
leaq 0x8a5e(%rip), %rdi      # 0x1da98
leaq 0x20acef(%rip), %r12    # 0x21fd30
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x125a8
leaq 0x8a65(%rip), %rsi      # 0x1daba
leaq 0x8a69(%rip), %rdx      # 0x1dac5
leaq 0x20a9cd(%rip), %r8     # 0x21fa30
pushq $0x2
popq %rdi
movq %r15, %rcx
movq %r12, %r9
xorl %eax, %eax
callq 0x1920b
movq 0x20adbe(%rip), %rdi    # 0x21fe38
callq 0xf1d9
testq %rax, %rax
jle 0x1510c
cmpb $0x0, 0x20a8a1(%rip)    # 0x21f930
jne 0x150c8
leaq 0x20ac98(%rip), %rax    # 0x21fd30
movq %rax, (%rsp)
leaq 0x20a88d(%rip), %rdx    # 0x21f930
leaq 0x20a986(%rip), %rcx    # 0x21fa30
leaq 0x20aa7f(%rip), %r8     # 0x21fb30
leaq 0x20ab78(%rip), %r9     # 0x21fc30
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x147de
movl %eax, %r14d
leaq 0x20ac61(%rip), %rax    # 0x21fd30
movq %rax, 0x8(%rsp)
leaq 0x20ab55(%rip), %rax    # 0x21fc30
movq %rax, (%rsp)
leaq 0x89d4(%rip), %rsi      # 0x1daba
leaq 0x8a03(%rip), %rdx      # 0x1daf0
leaq 0x20a83c(%rip), %rcx    # 0x21f930
leaq 0x20a935(%rip), %r8     # 0x21fa30
leaq 0x20aa2e(%rip), %r9     # 0x21fb30
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x1920b
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq