// File: /workspace/github_c_makefile_star2_O1/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
movl $0x0, 0x51f13(%rip)     # 0x5dd5c
callq 0x8969
movq %rax, %rdi
callq 0x9004
movq %rax, %rbx
leaq 0x103b3(%rip), %rsi     # 0x1c213
xorpd %xmm0, %xmm0
movq %rax, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x28aca(%rip)     # 0x34940
leaq 0x103ac(%rip), %rsi     # 0x1c229
leaq 0x103b8(%rip), %r14     # 0x1c23c
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x28aae(%rip), %rdi     # 0x34944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x10396(%rip), %rsi     # 0x1c240
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x28e88(%rip), %rdi     # 0x34d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x10383(%rip), %rsi     # 0x1c253
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x29262(%rip), %rdi     # 0x35144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x10370(%rip), %rsi     # 0x1c266
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x2963c(%rip), %rdi     # 0x35544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x1035d(%rip), %rsi     # 0x1c279
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x29a16(%rip), %rdi     # 0x35944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x1034a(%rip), %rsi     # 0x1c28c
leaq 0x10357(%rip), %r14     # 0x1c2a0
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x29de9(%rip), %rdi     # 0x35d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x10341(%rip), %rsi     # 0x1c2b0
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x2a1c3(%rip), %rdi     # 0x36144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x1032f(%rip), %rsi     # 0x1c2c4
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x2a59d(%rip), %rdi     # 0x36544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x1031d(%rip), %rsi     # 0x1c2d8
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x2a977(%rip), %rdi     # 0x36944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x1030b(%rip), %rsi     # 0x1c2ec
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x2ad51(%rip), %rdi     # 0x36d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x102f9(%rip), %rsi     # 0x1c300
leaq 0x1030a(%rip), %r14     # 0x1c318
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x2b124(%rip), %rdi     # 0x37144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x102f2(%rip), %rsi     # 0x1c326
leaq 0x10303(%rip), %r15     # 0x1c33e
movq %rbx, %rdi
movq %r15, %rdx
callq 0x907b
leaq 0x2b4f7(%rip), %rdi     # 0x37544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x102eb(%rip), %rsi     # 0x1c34c
movq %rbx, %rdi
movq %r15, %rdx
callq 0x907b
leaq 0x2b8d1(%rip), %rdi     # 0x37944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x102dd(%rip), %rsi     # 0x1c364
movq %rbx, %rdi
movq %r15, %rdx
callq 0x907b
leaq 0x2bcab(%rip), %rdi     # 0x37d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x102cf(%rip), %rsi     # 0x1c37c
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x2c085(%rip), %rdi     # 0x38144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x102c1(%rip), %rsi     # 0x1c394
leaq 0xf637(%rip), %r14      # 0x1b711
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x50464(%rip), %rdi     # 0x5c550
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x102ab(%rip), %rsi     # 0x1c3ab
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x5083e(%rip), %rdi     # 0x5c950
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x1029c(%rip), %rsi     # 0x1c3c2
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x50c18(%rip), %rdi     # 0x5cd50
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x1028d(%rip), %rsi     # 0x1c3d9
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x50ff2(%rip), %rdi     # 0x5d150
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x1027e(%rip), %rsi     # 0x1c3f0
movq %rbx, %rdi
movq %r14, %rdx
callq 0x907b
leaq 0x513cc(%rip), %rdi     # 0x5d550
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x1026f(%rip), %rsi     # 0x1c407
movsd 0xee68(%rip), %xmm0     # 0x1b008
movq %rbx, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x5179e(%rip)     # 0x5d950
leaq 0x10269(%rip), %rsi     # 0x1c422
leaq 0x10278(%rip), %rdx     # 0x1c438
movq %rbx, %rdi
callq 0x907b
leaq 0x4ff81(%rip), %rdi     # 0x5c150
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x2c761(%rip), %r15     # 0x38944
leaq 0x10263(%rip), %r12     # 0x1c44d
movq %rsp, %r13
xorl %ebp, %ebp
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 0x907b
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
movq %rax, %rsi
callq 0xf038
movq %r15, %rdi
callq 0xf7fe
incq %rbp
addq $0x400, %r15            # imm = 0x400
cmpq $0x80, %rbp
jne 0xc1ef
leaq 0x1021f(%rip), %rsi     # 0x1c462
leaq 0x145b9(%rip), %rdx     # 0x20803
movq %rbx, %rdi
callq 0x907b
leaq 0x2c2eb(%rip), %rdi     # 0x38544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
cmpb $0x0, 0x2c2d7(%rip)     # 0x38544
jne 0xc278
movw $0x21, 0x2c2cc(%rip)    # 0x38544
leaq 0x101f7(%rip), %rsi     # 0x1c476
movsd 0xf469(%rip), %xmm0     # 0x1b6f0
movq %rbx, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x4c6ab(%rip)     # 0x58944
leaq 0x101ee(%rip), %rsi     # 0x1c48e
movsd 0xf450(%rip), %xmm0     # 0x1b6f8
movq %rbx, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x4c68e(%rip)     # 0x58948
cmpl $0x1, 0x4c683(%rip)     # 0x58944
jg 0xc2cd
movl $0x4, 0x4c677(%rip)     # 0x58944
cmpl $0x1, %eax
jg 0xc2dc
movl $0x2, 0x4c66c(%rip)     # 0x58948
leaq 0x101c3(%rip), %rsi     # 0x1c4a6
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x4c653(%rip)     # 0x5894c
leaq 0x101bc(%rip), %rsi     # 0x1c4bc
leaq 0x101c8(%rip), %rdx     # 0x1c4cf
movq %rbx, %rdi
callq 0x907b
leaq 0x4c63a(%rip), %rdi     # 0x58950
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x101c2(%rip), %rsi     # 0x1c4ec
leaq 0x101d1(%rip), %rdx     # 0x1c502
movq %rbx, %rdi
callq 0x907b
leaq 0x4ca10(%rip), %rdi     # 0x58d50
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x101dc(%rip), %rsi     # 0x1c530
leaq 0x101e7(%rip), %rdx     # 0x1c542
movq %rbx, %rdi
callq 0x907b
leaq 0x4cde6(%rip), %rdi     # 0x59150
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x101ed(%rip), %rsi     # 0x1c56b
leaq 0x101fb(%rip), %rdx     # 0x1c580
movq %rbx, %rdi
callq 0x907b
leaq 0x4d1bc(%rip), %rdi     # 0x59550
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x10200(%rip), %rsi     # 0x1c5a8
leaq 0x1020e(%rip), %rdx     # 0x1c5bd
movq %rbx, %rdi
callq 0x907b
leaq 0x4d592(%rip), %rdi     # 0x59950
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
leaq 0x4d97e(%rip), %r14     # 0x59d50
leaq 0x10216(%rip), %r15     # 0x1c5ef
movq %rsp, %r12
leaq 0xf32e(%rip), %r13      # 0x1b711
xorl %ebp, %ebp
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 0x907b
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rax, %rsi
callq 0xf038
movq %r14, %rdi
callq 0xf7fe
incq %rbp
addq $0x400, %r14            # imm = 0x400
cmpq $0x9, %rbp
jne 0xc3e5
leaq 0x101ce(%rip), %rsi     # 0x1c604
movsd 0xf2c2(%rip), %xmm0     # 0x1b700
movq %rbx, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x51504(%rip)     # 0x5d954
leaq 0x101c6(%rip), %rsi     # 0x1c61d
movsd 0xf2a9(%rip), %xmm0     # 0x1b708
movq %rbx, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movl %eax, 0x514e0(%rip)     # 0x5d958
leaq 0x101b9(%rip), %rsi     # 0x1c638
leaq 0x101cb(%rip), %rdx     # 0x1c651
movq %rbx, %rdi
callq 0x907b
leaq 0x514c7(%rip), %rdi     # 0x5d95c
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
movq %rbx, %rdi
callq 0x905c
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq