// File: /workspace/github_c_makefile_star2_O2/schroeder-lvb[P]sissm/src/picladmin.c
// Function: picladminInitConfig
int picladminInitConfig( void )
{
    cfsPtr cP;
    int i;
    char varArray[256];

    _queueReboot = REBOOT_CANCEL;

    cP = cfsCreate( sissmGetConfigPath() );

    // read "picladmin.pluginstate" variable from the .cfg file
    picladminConfig.pluginState = (int) cfsFetchNum( cP, "picladmin.pluginState", 0.0 );  // disabled by default

    // Read the humanized responses for when a command is issued can was successfully executed
    //
    strlcpy( picladminConfig.msgOk[0],       cfsFetchStr( cP, "picladmin.msgOk[0]",      "Ok!" ),             CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgOk[1],       cfsFetchStr( cP, "picladmin.msgOk[1]",      "Ok!" ),             CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgOk[2],       cfsFetchStr( cP, "picladmin.msgOk[2]",      "Ok!" ),             CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgOk[3],       cfsFetchStr( cP, "picladmin.msgOk[3]",      "Ok!" ),             CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgOk[4],       cfsFetchStr( cP, "picladmin.msgOk[4]",      "Ok!" ),             CFS_FETCH_MAX);

    // Read the humanized responses for when a command has an error
    //
    strlcpy( picladminConfig.msgErr[0],      cfsFetchStr( cP, "picladmin.msgErr[0]",     "Invalid Syntax!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgErr[1],      cfsFetchStr( cP, "picladmin.msgErr[1]",     "Invalid Syntax!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgErr[2],      cfsFetchStr( cP, "picladmin.msgErr[2]",     "Invalid Syntax!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgErr[3],      cfsFetchStr( cP, "picladmin.msgErr[3]",     "Invalid Syntax!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgErr[4],      cfsFetchStr( cP, "picladmin.msgErr[4]",     "Invalid Syntax!" ), CFS_FETCH_MAX);

    // Read the humanized responses for when a non-admin tries to use a command
    //
    strlcpy( picladminConfig.msgInvalid[0], cfsFetchStr( cP, "picladmin.msgInvalid[0]",  "Unauthorized!" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgInvalid[1], cfsFetchStr( cP, "picladmin.msgInvalid[1]",  "Unauthroized!" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgInvalid[2], cfsFetchStr( cP, "picladmin.msgInvalid[2]",  "Unauthroized!" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgInvalid[3], cfsFetchStr( cP, "picladmin.msgInvalid[3]",  "Unauthroized!" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgInvalid[4], cfsFetchStr( cP, "picladmin.msgInvalid[4]",  "Unauthorized!" ),   CFS_FETCH_MAX);


    // Read the 5-element rules list
    //
    strlcpy( picladminConfig.rulesInfo[0], cfsFetchStr( cP, "picladmin.rulesInfo[0]",  "" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.rulesInfo[1], cfsFetchStr( cP, "picladmin.rulesInfo[1]",  "" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.rulesInfo[2], cfsFetchStr( cP, "picladmin.rulesInfo[2]",  "" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.rulesInfo[3], cfsFetchStr( cP, "picladmin.rulesInfo[3]",  "" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.rulesInfo[4], cfsFetchStr( cP, "picladmin.rulesInfo[4]",  "" ),   CFS_FETCH_MAX);

    // Read the interval (sec) on how fast the rules are printed on player screen.  0 = no rules
    //
    picladminConfig.rulesIntervalSec = (int) cfsFetchNum( cP, "picladmin.rulesIntervalSec", 2.0 );  //  2sec apart

    // Read the server contacts info
    //
    strlcpy( picladminConfig.contactInfo, cfsFetchStr( cP, "picladmin.contactInfo",  "Contact info not set" ),   CFS_FETCH_MAX);

    // Read the operator-specified "macro" (alias) sequence
    //
    for ( i=0; i<NUM_MACROS; i++ ) {
        snprintf( varArray, 256, "picladmin.macros[%d]", i );
        strlcpy( picladminConfig.macros[i],     cfsFetchStr( cP, varArray,  "" ),   CFS_FETCH_MAX);
        replaceDoubleColonWithBell( picladminConfig.macros[i] );
    }

    strlcpy( picladminConfig.cmdPrefix,      cfsFetchStr( cP, "picladmin.cmdPrefix",      "!" ),              CFS_FETCH_MAX);

    // if nil cmdPrefix is in the .cfg file, this will cause every command to be admin command, so
    // we override that here.
    //
    if ( 0 == strlen( picladminConfig.cmdPrefix )) strlcpy( picladminConfig.cmdPrefix, "!", CFS_FETCH_MAX );

    // Set bot count max and default min values 
    // if Max value is set too high and admin issues a !bf or !bs, servers & clients may crash
    //
    picladminConfig.botMaxAllowed = (int) cfsFetchNum( cP, "picladmin.botMaxAllowed", 200.0 );
    picladminConfig.botMinDefault = (int) cfsFetchNum( cP, "picladmin.botMinDefault",  6.0 );
    if ( picladminConfig.botMaxAllowed < 2 ) picladminConfig.botMaxAllowed = 4;
    if ( picladminConfig.botMinDefault < 2 ) picladminConfig.botMinDefault = 2;

    // BotUpperMin limits the maximum number admin can specify in !botscaled !bs command.
    // Recommended value:  10.  If "0" is set (default) the limiter is disabled.
    //
    picladminConfig.botUpperMin = (int) cfsFetchNum( cP, "picladmin.botUpperMin", 0.0 );

    // text to show in-game for !ask, !prep, and !warn
    //
    strlcpy( picladminConfig.prepBlow, cfsFetchStr( cP, "picladmin.prepBlow",  
        "*Planting/Ready to detonate!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.prepCapture, cfsFetchStr( cP, "picladmin.prepCapture",  
        "*Testing Capture Point - Stepping On then Off" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.askBlow, cfsFetchStr( cP, "picladmin.askBlow",  
        "*DETONATING in 5-sec, <NEGATIVE> to halt" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.askCapture, cfsFetchStr( cP, "picladmin.askCapture",  
        "*BREACHING in 5-sec, <NEGATIVE> to halt" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.warnRusher, cfsFetchStr( cP, "picladmin.warnRusher",  
        "*Do NOT BREACH/DETONATE CACHE without ASKING TEAM" ), CFS_FETCH_MAX);

    // Read the "reasons" preset strings for ban/banid/kick/kickid commmands
    //
    for ( i=0; i<NUM_REASONS; i++ ) {
        snprintf( varArray, 256, "picladmin.reason[%d]", i );
        strlcpy( picladminConfig.reason[i],     cfsFetchStr( cP, varArray,  "" ),   CFS_FETCH_MAX);
        replaceDoubleColonWithBell( picladminConfig.reason[i] );
    }

    // Read the temp ban duration in minutes
    //
    picladminConfig.tempBanMinutes = (int) cfsFetchNum( cP, "picladmin.tempBanMinutes", 1440.0 );

    // Read the nokick exemption (from antirush autokick) window time in seconds
    //
    picladminConfig.noKickProtectSec = (int) cfsFetchNum( cP, "picladmin.noKickProtectSec",  15.0 );
    if ( picladminConfig.noKickProtectSec < 0 ) picladminConfig.noKickProtectSec = 0;

    // Info text that is shown when a player types !strict
    //
    strlcpy( picladminConfig.strictTutorial,  cfsFetchStr( cP, "picladmin.strictTutorial",
        "*Auto-kick if no '11' before breach/detonate!"), 
        CFS_FETCH_MAX);

    cfsDestroy( cP );
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
andl $0x0, 0x5236d(%rip)     # 0x5dd5c
callq 0x8973
movq %rax, %rdi
callq 0x8f80
movq %rax, %rbx
leaq 0xf805(%rip), %rsi      # 0x1b20b
xorpd %xmm0, %xmm0
movq %rax, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x28f24(%rip)     # 0x34940
leaq 0xf7fe(%rip), %rsi      # 0x1b221
leaq 0xf80a(%rip), %r14      # 0x1b234
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x28f08(%rip), %rdi     # 0x34944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf7e8(%rip), %rsi      # 0x1b238
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x292e2(%rip), %rdi     # 0x34d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf7d5(%rip), %rsi      # 0x1b24b
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x296bc(%rip), %rdi     # 0x35144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf7c2(%rip), %rsi      # 0x1b25e
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x29a96(%rip), %rdi     # 0x35544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf7af(%rip), %rsi      # 0x1b271
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x29e70(%rip), %rdi     # 0x35944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf79c(%rip), %rsi      # 0x1b284
leaq 0xf7a9(%rip), %r14      # 0x1b298
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x2a243(%rip), %rdi     # 0x35d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf793(%rip), %rsi      # 0x1b2a8
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x2a61d(%rip), %rdi     # 0x36144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf781(%rip), %rsi      # 0x1b2bc
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x2a9f7(%rip), %rdi     # 0x36544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf76f(%rip), %rsi      # 0x1b2d0
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x2add1(%rip), %rdi     # 0x36944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf75d(%rip), %rsi      # 0x1b2e4
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x2b1ab(%rip), %rdi     # 0x36d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf74b(%rip), %rsi      # 0x1b2f8
leaq 0xf75c(%rip), %r14      # 0x1b310
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x2b57e(%rip), %rdi     # 0x37144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf744(%rip), %rsi      # 0x1b31e
leaq 0xf755(%rip), %r15      # 0x1b336
movq %rbx, %rdi
movq %r15, %rdx
callq 0x8ff5
leaq 0x2b951(%rip), %rdi     # 0x37544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf73d(%rip), %rsi      # 0x1b344
movq %rbx, %rdi
movq %r15, %rdx
callq 0x8ff5
leaq 0x2bd2b(%rip), %rdi     # 0x37944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf72f(%rip), %rsi      # 0x1b35c
movq %rbx, %rdi
movq %r15, %rdx
callq 0x8ff5
leaq 0x2c105(%rip), %rdi     # 0x37d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf721(%rip), %rsi      # 0x1b374
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x2c4df(%rip), %rdi     # 0x38144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf713(%rip), %rsi      # 0x1b38c
leaq 0xea89(%rip), %r14      # 0x1a709
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x508be(%rip), %rdi     # 0x5c550
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf6fd(%rip), %rsi      # 0x1b3a3
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x50c98(%rip), %rdi     # 0x5c950
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf6ee(%rip), %rsi      # 0x1b3ba
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x51072(%rip), %rdi     # 0x5cd50
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf6df(%rip), %rsi      # 0x1b3d1
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x5144c(%rip), %rdi     # 0x5d150
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf6d0(%rip), %rsi      # 0x1b3e8
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x51826(%rip), %rdi     # 0x5d550
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf6c1(%rip), %rsi      # 0x1b3ff
movsd 0xe2c2(%rip), %xmm0     # 0x1a008
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x51bf8(%rip)     # 0x5d950
leaq 0xf6bb(%rip), %rsi      # 0x1b41a
leaq 0xf6ca(%rip), %rdx      # 0x1b430
movq %rbx, %rdi
callq 0x8ff5
leaq 0x503db(%rip), %rdi     # 0x5c150
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0x2cbbb(%rip), %r15     # 0x38944
leaq 0xf6b5(%rip), %r12      # 0x1b445
movq %rsp, %r13
xorl %ebp, %ebp
cmpq $0x80, %rbp
je 0xbde4
movl $0x100, %esi            # imm = 0x100
movq %r13, %rdi
movq %r12, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x8190
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x8ff5
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
movq %rax, %rsi
callq 0xe97a
movq %r15, %rdi
callq 0xf070
incq %rbp
addq $0x400, %r15            # imm = 0x400
jmp 0xbd95
leaq 0xf66f(%rip), %rsi      # 0x1b45a
leaq 0x139c1(%rip), %rdx     # 0x1f7b3
movq %rbx, %rdi
callq 0x8ff5
leaq 0x2c743(%rip), %rdi     # 0x38544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
cmpb $0x0, 0x2c72f(%rip)     # 0x38544
jne 0xbe20
movw $0x21, 0x2c724(%rip)    # 0x38544
leaq 0xf647(%rip), %rsi      # 0x1b46e
movsd 0xe8b9(%rip), %xmm0     # 0x1a6e8
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x4cb03(%rip)     # 0x58944
leaq 0xf63e(%rip), %rsi      # 0x1b486
movsd 0xe8a0(%rip), %xmm0     # 0x1a6f0
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x4cae6(%rip)     # 0x58948
cmpl $0x1, 0x4cadb(%rip)     # 0x58944
jg 0xbe75
movl $0x4, 0x4cacf(%rip)     # 0x58944
cmpl $0x1, %eax
jg 0xbe84
movl $0x2, 0x4cac4(%rip)     # 0x58948
leaq 0xf613(%rip), %rsi      # 0x1b49e
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x4caab(%rip)     # 0x5894c
leaq 0xf60c(%rip), %rsi      # 0x1b4b4
leaq 0xf618(%rip), %rdx      # 0x1b4c7
movq %rbx, %rdi
callq 0x8ff5
leaq 0x4ca92(%rip), %rdi     # 0x58950
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf612(%rip), %rsi      # 0x1b4e4
leaq 0xf621(%rip), %rdx      # 0x1b4fa
movq %rbx, %rdi
callq 0x8ff5
leaq 0x4ce68(%rip), %rdi     # 0x58d50
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf62c(%rip), %rsi      # 0x1b528
leaq 0xf637(%rip), %rdx      # 0x1b53a
movq %rbx, %rdi
callq 0x8ff5
leaq 0x4d23e(%rip), %rdi     # 0x59150
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf63d(%rip), %rsi      # 0x1b563
leaq 0xf64b(%rip), %rdx      # 0x1b578
movq %rbx, %rdi
callq 0x8ff5
leaq 0x4d614(%rip), %rdi     # 0x59550
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xf650(%rip), %rsi      # 0x1b5a0
leaq 0xf65e(%rip), %rdx      # 0x1b5b5
movq %rbx, %rdi
callq 0x8ff5
leaq 0x4d9ea(%rip), %rdi     # 0x59950
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0x4ddd6(%rip), %r14     # 0x59d50
leaq 0xf666(%rip), %r15      # 0x1b5e7
movq %rsp, %r12
leaq 0xe77e(%rip), %r13      # 0x1a709
xorl %ebp, %ebp
cmpq $0x9, %rbp
je 0xbfd9
movl $0x100, %esi            # imm = 0x100
movq %r12, %rdi
movq %r15, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x8190
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x8ff5
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rax, %rsi
callq 0xe97a
movq %r14, %rdi
callq 0xf070
incq %rbp
addq $0x400, %r14            # imm = 0x400
jmp 0xbf8d
leaq 0xf61c(%rip), %rsi      # 0x1b5fc
movsd 0xe710(%rip), %xmm0     # 0x1a6f8
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x5195a(%rip)     # 0x5d954
leaq 0xf614(%rip), %rsi      # 0x1b615
movsd 0xe6f7(%rip), %xmm0     # 0x1a700
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movl %eax, 0x51936(%rip)     # 0x5d958
leaq 0xf607(%rip), %rsi      # 0x1b630
leaq 0xf619(%rip), %rdx      # 0x1b649
movq %rbx, %rdi
callq 0x8ff5
leaq 0x5191d(%rip), %rdi     # 0x5d95c
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
movq %rbx, %rdi
callq 0x8fd6
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq