|
5 | 5 | ; Parameters ....: None |
6 | 6 | ; Return values .: None |
7 | 7 | ; Author ........: MyBot.run team |
8 | | -; Modified ......: CodeSlinger69 (2017) |
9 | | -; Remarks .......: This file is part of MyBot, previously known as ClashGameBot. Copyright 2015-2017 |
| 8 | +; Modified ......: CodeSlinger69 (2017), MMHK (01-2008) |
| 9 | +; Remarks .......: This file is part of MyBot, previously known as ClashGameBot. Copyright 2015-2018 |
10 | 10 | ; MyBot is distributed under the terms of the GNU GPL |
11 | 11 | ; Related .......: |
12 | 12 | ; Link ..........: https://github.com/MyBotRun/MyBot/wiki |
@@ -264,6 +264,218 @@ Func DuplicateScriptAB() |
264 | 264 | EndIf |
265 | 265 | EndFunc ;==>DuplicateScriptAB |
266 | 266 |
|
| 267 | +Func ApplyScriptDB() |
| 268 | + Local $iApply = 0 |
| 269 | + Local $aiCSVTroops[$eTroopCount] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
| 270 | + Local $aiCSVSpells[$eSpellCount] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
| 271 | + Local $aiCSVHeros[$eHeroCount][2] = [[0, 0], [0, 0], [0, 0]] |
| 272 | + Local $iCSVRedlineRoutineItem = 0, $iCSVDroplineEdgeItem = 0 |
| 273 | + Local $sCSVCCReq = "" |
| 274 | + Local $aTemp = _GUICtrlComboBox_GetListArray($g_hCmbScriptNameDB) |
| 275 | + Local $sFilename = $aTemp[_GUICtrlComboBox_GetCurSel($g_hCmbScriptNameDB) + 1] |
| 276 | + |
| 277 | + SetLog("CSV settings apply starts", $COLOR_INFO) |
| 278 | + $iApply = ParseAttackCSV_Settings_variables($aiCSVTroops, $aiCSVSpells, $aiCSVHeros, $iCSVRedlineRoutineItem, $iCSVDroplineEdgeItem, $sCSVCCReq, $sFilename) |
| 279 | + If Not $iApply Then |
| 280 | + SetLog("CSV settings apply failed", $COLOR_ERROR) |
| 281 | + Return |
| 282 | + EndIf |
| 283 | + |
| 284 | + $iApply = 0 |
| 285 | + For $i = 0 To UBound($aiCSVTroops) - 1 |
| 286 | + If $aiCSVTroops[$i] > 0 Then $iApply += 1 |
| 287 | + Next |
| 288 | + For $i = 0 To UBound($aiCSVSpells) - 1 |
| 289 | + If $aiCSVSpells[$i] > 0 Then $iApply += 1 |
| 290 | + Next |
| 291 | + If $iApply > 0 Then |
| 292 | + For $t = 0 To UBound($aiCSVTroops) - 1 ; set troops to level 1 if none on GUI |
| 293 | + If $aiCSVTroops[$t] > 0 And $g_aiTrainArmyTroopLevel[$t] = 0 Then $g_aiTrainArmyTroopLevel[$t] = 1 |
| 294 | + Next |
| 295 | + $g_aiArmyCompTroops = $aiCSVTroops |
| 296 | + For $s = 0 To UBound($aiCSVSpells) - 1 ; set spells to level 1 if none on GUI |
| 297 | + If $aiCSVSpells[$s] > 0 And $g_aiTrainArmySpellLevel[$s] = 0 Then $g_aiTrainArmySpellLevel[$s] = 1 |
| 298 | + Next |
| 299 | + $g_aiArmyCompSpells = $aiCSVSpells |
| 300 | + ApplyConfig_600_52_2("Read") |
| 301 | + SetComboTroopComp() ; GUI refresh |
| 302 | + lblTotalCountSpell2() |
| 303 | + SetLog("CSV Train settings applied", $COLOR_SUCCESS) |
| 304 | + EndIf |
| 305 | + |
| 306 | + $iApply = 0 |
| 307 | + For $i = 0 To UBound($aiCSVHeros) - 1 |
| 308 | + If $aiCSVHeros[$i][0] > 0 Then $iApply += 1 |
| 309 | + Next |
| 310 | + If $iApply > 0 Then |
| 311 | + For $h = 0 To UBound($aiCSVHeros) - 1 |
| 312 | + If $aiCSVHeros[$h][0] > 0 Then |
| 313 | + Switch $h |
| 314 | + Case $eHeroBarbarianKing |
| 315 | + $g_iActivateKing = $aiCSVHeros[$h][0] - 1 |
| 316 | + $g_iDelayActivateKing = $aiCSVHeros[$h][1] |
| 317 | + Case $eHeroArcherQueen |
| 318 | + $g_iActivateQueen = $aiCSVHeros[$h][0] - 1 |
| 319 | + $g_iDelayActivateQueen = $aiCSVHeros[$h][1] |
| 320 | + Case $eHeroGrandWarden |
| 321 | + $g_iActivateWarden = $aiCSVHeros[$h][0] - 1 |
| 322 | + $g_iDelayActivateWarden = $aiCSVHeros[$h][1] |
| 323 | + EndSwitch |
| 324 | + EndIf |
| 325 | + Next |
| 326 | + radHerosApply() |
| 327 | + SetLog("CSV Hero Ability settings applied", $COLOR_SUCCESS) |
| 328 | + |
| 329 | + GUICtrlSetState($g_hChkDBKingAttack, $aiCSVHeros[$eHeroBarbarianKing][0] > 0 ? $GUI_CHECKED : GUICtrlGetState($g_hChkDBKingAttack)) |
| 330 | + GUICtrlSetState($g_hChkDBQueenAttack, $aiCSVHeros[$eHeroArcherQueen][0] > 0 ? $GUI_CHECKED : GUICtrlGetState($g_hChkDBQueenAttack)) |
| 331 | + GUICtrlSetState($g_hChkDBWardenAttack, $aiCSVHeros[$eHeroGrandWarden][0] > 0 ? $GUI_CHECKED : GUICtrlGetState($g_hChkDBWardenAttack)) |
| 332 | + SetLog("CSV 'Attack with' Hero settings applied", $COLOR_SUCCESS) |
| 333 | + EndIf |
| 334 | + |
| 335 | + If $sCSVCCReq <> "" Then |
| 336 | + GUICtrlSetState($g_hChkDBDropCC, $GUI_CHECKED) |
| 337 | + SetLog("CSV 'Attack with' CC settings applied", $COLOR_SUCCESS) |
| 338 | + EndIf |
| 339 | + |
| 340 | + $iApply = 0 |
| 341 | + Local $ahChkDBSpell = StringSplit($g_aGroupAttackDBSpell, "#", 2) |
| 342 | + If IsArray($ahChkDBSpell) Then |
| 343 | + For $i = 0 To UBound($ahChkDBSpell) - 1 |
| 344 | + GUICtrlSetState($ahChkDBSpell[$i], $aiCSVSpells[$i] > 0 ? $GUI_CHECKED : $GUI_UNCHECKED) |
| 345 | + If $aiCSVSpells[$i] > 0 Then $iApply += 1 |
| 346 | + Next |
| 347 | + If $iApply > 0 Then SetLog("CSV 'Attack with' Spell settings applied", $COLOR_SUCCESS) |
| 348 | + EndIf |
| 349 | + |
| 350 | + If $iCSVRedlineRoutineItem > 0 And $iCSVRedlineRoutineItem <= _GUICtrlComboBox_GetCount($g_hCmbScriptRedlineImplDB) + 1 Then |
| 351 | + _GUICtrlComboBox_SetCurSel($g_hCmbScriptRedlineImplDB, $iCSVRedlineRoutineItem - 1) |
| 352 | + cmbScriptRedlineImplDB() |
| 353 | + SetLog("CSV Red Line settings applied", $COLOR_SUCCESS) |
| 354 | + Else |
| 355 | + If $iCSVRedlineRoutineItem <> 0 Then SetLog("CSV Red Line settings out of bounds", $COLOR_ERROR) |
| 356 | + EndIf |
| 357 | + If $iCSVDroplineEdgeItem > 0 And $iCSVDroplineEdgeItem <= _GUICtrlComboBox_GetCount($g_hCmbScriptDroplineDB) + 1 Then |
| 358 | + _GUICtrlComboBox_SetCurSel($g_hCmbScriptDroplineDB, $iCSVDroplineEdgeItem - 1) |
| 359 | + cmbScriptDroplineDB() |
| 360 | + SetLog("CSV Drop Line settings applied", $COLOR_SUCCESS) |
| 361 | + Else |
| 362 | + If $iCSVDroplineEdgeItem <> 0 Then SetLog("CSV Drop Line settings out of bounds", $COLOR_ERROR) |
| 363 | + EndIf |
| 364 | + |
| 365 | + If $sCSVCCReq <> "" Then |
| 366 | + $g_bRequestTroopsEnable = True |
| 367 | + $g_sRequestTroopsText = $sCSVCCReq |
| 368 | + ApplyConfig_600_11("Read") |
| 369 | + SetLog("CSV CC Request settings applied", $COLOR_SUCCESS) |
| 370 | + EndIf |
| 371 | +EndFunc ;==>ApplyScriptDB |
| 372 | + |
| 373 | +Func ApplyScriptAB() |
| 374 | + Local $iApply = 0 |
| 375 | + Local $aiCSVTroops[$eTroopCount] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
| 376 | + Local $aiCSVSpells[$eSpellCount] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
| 377 | + Local $aiCSVHeros[$eHeroCount][2] = [[0, 0], [0, 0], [0, 0]] |
| 378 | + Local $iCSVRedlineRoutineItem = 0, $iCSVDroplineEdgeItem = 0 |
| 379 | + Local $sCSVCCReq = "" |
| 380 | + Local $aTemp = _GUICtrlComboBox_GetListArray($g_hCmbScriptNameAB) |
| 381 | + Local $sFilename = $aTemp[_GUICtrlComboBox_GetCurSel($g_hCmbScriptNameAB) + 1] |
| 382 | + |
| 383 | + SetLog("CSV settings apply starts", $COLOR_INFO) |
| 384 | + $iApply = ParseAttackCSV_Settings_variables($aiCSVTroops, $aiCSVSpells, $aiCSVHeros, $iCSVRedlineRoutineItem, $iCSVDroplineEdgeItem, $sCSVCCReq, $sFilename) |
| 385 | + If Not $iApply Then |
| 386 | + SetLog("CSV settings apply failed", $COLOR_ERROR) |
| 387 | + Return |
| 388 | + EndIf |
| 389 | + |
| 390 | + $iApply = 0 |
| 391 | + For $i = 0 To UBound($aiCSVTroops) - 1 |
| 392 | + If $aiCSVTroops[$i] > 0 Then $iApply += 1 |
| 393 | + Next |
| 394 | + For $i = 0 To UBound($aiCSVSpells) - 1 |
| 395 | + If $aiCSVSpells[$i] > 0 Then $iApply += 1 |
| 396 | + Next |
| 397 | + If $iApply > 0 Then |
| 398 | + For $t = 0 To UBound($aiCSVTroops) - 1 ; set troops to level 1 if none on GUI |
| 399 | + If $aiCSVTroops[$t] > 0 And $g_aiTrainArmyTroopLevel[$t] = 0 Then $g_aiTrainArmyTroopLevel[$t] = 1 |
| 400 | + Next |
| 401 | + $g_aiArmyCompTroops = $aiCSVTroops |
| 402 | + For $s = 0 To UBound($aiCSVSpells) - 1 ; set spells to level 1 if none on GUI |
| 403 | + If $aiCSVSpells[$s] > 0 And $g_aiTrainArmySpellLevel[$s] = 0 Then $g_aiTrainArmySpellLevel[$s] = 1 |
| 404 | + Next |
| 405 | + $g_aiArmyCompSpells = $aiCSVSpells |
| 406 | + ApplyConfig_600_52_2("Read") |
| 407 | + SetComboTroopComp() ; GUI refresh |
| 408 | + lblTotalCountSpell2() |
| 409 | + SetLog("CSV Train settings applied", $COLOR_SUCCESS) |
| 410 | + EndIf |
| 411 | + |
| 412 | + $iApply = 0 |
| 413 | + For $i = 0 To UBound($aiCSVHeros) - 1 |
| 414 | + If $aiCSVHeros[$i][0] > 0 Then $iApply += 1 |
| 415 | + Next |
| 416 | + If $iApply > 0 Then |
| 417 | + For $h = 0 To UBound($aiCSVHeros) - 1 |
| 418 | + If $aiCSVHeros[$h][0] > 0 Then |
| 419 | + Switch $h |
| 420 | + Case $eHeroBarbarianKing |
| 421 | + $g_iActivateKing = $aiCSVHeros[$h][0] - 1 |
| 422 | + $g_iDelayActivateKing = $aiCSVHeros[$h][1] |
| 423 | + Case $eHeroArcherQueen |
| 424 | + $g_iActivateQueen = $aiCSVHeros[$h][0] - 1 |
| 425 | + $g_iDelayActivateQueen = $aiCSVHeros[$h][1] |
| 426 | + Case $eHeroGrandWarden |
| 427 | + $g_iActivateWarden = $aiCSVHeros[$h][0] - 1 |
| 428 | + $g_iDelayActivateWarden = $aiCSVHeros[$h][1] |
| 429 | + EndSwitch |
| 430 | + EndIf |
| 431 | + Next |
| 432 | + radHerosApply() |
| 433 | + SetLog("CSV Hero Ability settings applied", $COLOR_SUCCESS) |
| 434 | + |
| 435 | + GUICtrlSetState($g_hChkABKingAttack, $aiCSVHeros[$eHeroBarbarianKing][0] > 0 ? $GUI_CHECKED : GUICtrlGetState($g_hChkABKingAttack)) |
| 436 | + GUICtrlSetState($g_hChkABQueenAttack, $aiCSVHeros[$eHeroArcherQueen][0] > 0 ? $GUI_CHECKED : GUICtrlGetState($g_hChkABQueenAttack)) |
| 437 | + GUICtrlSetState($g_hChkABWardenAttack, $aiCSVHeros[$eHeroGrandWarden][0] > 0 ? $GUI_CHECKED : GUICtrlGetState($g_hChkABWardenAttack)) |
| 438 | + SetLog("CSV 'Attack with' Hero settings applied", $COLOR_SUCCESS) |
| 439 | + EndIf |
| 440 | + |
| 441 | + If $sCSVCCReq <> "" Then |
| 442 | + GUICtrlSetState($g_hChkABDropCC, $GUI_CHECKED) |
| 443 | + SetLog("CSV 'Attack with' CC settings applied", $COLOR_SUCCESS) |
| 444 | + EndIf |
| 445 | + |
| 446 | + $iApply = 0 |
| 447 | + Local $ahChkABSpell = StringSplit($GroupAttackABSpell, "#", 2) |
| 448 | + If IsArray($ahChkABSpell) Then |
| 449 | + For $i = 0 To UBound($ahChkABSpell) - 1 |
| 450 | + GUICtrlSetState($ahChkABSpell[$i], $aiCSVSpells[$i] > 0 ? $GUI_CHECKED : $GUI_UNCHECKED) |
| 451 | + If $aiCSVSpells[$i] > 0 Then $iApply += 1 |
| 452 | + Next |
| 453 | + If $iApply > 0 Then SetLog("CSV 'Attack with' Spell settings applied", $COLOR_SUCCESS) |
| 454 | + EndIf |
| 455 | + |
| 456 | + If $iCSVRedlineRoutineItem > 0 And $iCSVRedlineRoutineItem <= _GUICtrlComboBox_GetCount($g_hCmbScriptRedlineImplAB) + 1 Then |
| 457 | + _GUICtrlComboBox_SetCurSel($g_hCmbScriptRedlineImplAB, $iCSVRedlineRoutineItem - 1) |
| 458 | + cmbScriptRedlineImplAB() |
| 459 | + SetLog("CSV Red Line settings applied", $COLOR_SUCCESS) |
| 460 | + Else |
| 461 | + If $iCSVRedlineRoutineItem <> 0 Then SetLog("CSV Red Line settings out of bounds", $COLOR_ERROR) |
| 462 | + EndIf |
| 463 | + If $iCSVDroplineEdgeItem > 0 And $iCSVDroplineEdgeItem <= _GUICtrlComboBox_GetCount($g_hCmbScriptDroplineAB) + 1 Then |
| 464 | + _GUICtrlComboBox_SetCurSel($g_hCmbScriptDroplineAB, $iCSVDroplineEdgeItem - 1) |
| 465 | + cmbScriptDroplineAB() |
| 466 | + SetLog("CSV Drop Line settings applied", $COLOR_SUCCESS) |
| 467 | + Else |
| 468 | + If $iCSVDroplineEdgeItem <> 0 Then SetLog("CSV Drop Line settings out of bounds", $COLOR_ERROR) |
| 469 | + EndIf |
| 470 | + |
| 471 | + If $sCSVCCReq <> "" Then |
| 472 | + $g_bRequestTroopsEnable = True |
| 473 | + $g_sRequestTroopsText = $sCSVCCReq |
| 474 | + ApplyConfig_600_11("Read") |
| 475 | + SetLog("CSV CC Request settings applied", $COLOR_SUCCESS) |
| 476 | + EndIf |
| 477 | +EndFunc ;==>ApplyScriptAB |
| 478 | + |
267 | 479 | Func cmbScriptRedlineImplDB() |
268 | 480 | $g_aiAttackScrRedlineRoutine[$DB] = _GUICtrlComboBox_GetCurSel($g_hCmbScriptRedlineImplDB) |
269 | 481 | If $g_aiAttackScrRedlineRoutine[$DB] = 3 then |
|
0 commit comments