@@ -558,17 +558,25 @@ class GameTab
558558 if (!instalockChamps.empty ())
559559 {
560560 std::vector<std::string> instalockChampsNames;
561- instalockChampsNames.reserve (instalockChamps.size ());
561+ instalockChampsNames.reserve (instalockChamps.size () + 1 );
562+ instalockChampsNames.emplace_back (" Random" );
562563
563- std::string selectedChamp = ChampIdToName (S.gameTab .instalockId );
564- std::ranges::copy (selectedChamp, instalockComboData.input );
564+ if (S.gameTab .instalockId == -1 )
565+ {
566+ std::ranges::copy (" Random" , instalockComboData.input );
567+ }
568+ else
569+ {
570+ std::string selectedChamp = ChampIdToName (S.gameTab .instalockId );
571+ std::ranges::copy (selectedChamp, instalockComboData.input );
572+ }
565573
566574 for (size_t i = 0 ; i < instalockChamps.size (); i++)
567575 {
568576 instalockChampsNames.emplace_back (instalockChamps[i].second );
569577 if (instalockComboData.input == instalockChamps[i].second )
570578 {
571- instalockComboData.index = i;
579+ instalockComboData.index = i + 1 ;
572580 }
573581 }
574582 instalockComboData.items = instalockChampsNames;
@@ -582,11 +590,18 @@ class GameTab
582590 {
583591 if (instalockComboData.index != -1 )
584592 {
585- for ( const auto & [key, name, skins] : champSkins )
593+ if ( std::string (instalockComboData. input ) == " Random " )
586594 {
587- if (instalockComboData.input == name)
595+ S.gameTab .instalockId = -1 ;
596+ }
597+ else
598+ {
599+ for (const auto & [key, name, skins] : champSkins)
588600 {
589- S.gameTab .instalockId = key;
601+ if (instalockComboData.input == name)
602+ {
603+ S.gameTab .instalockId = key;
604+ }
590605 }
591606 }
592607 }
@@ -635,18 +650,26 @@ class GameTab
635650 std::vector<std::string> autobanChampsNames;
636651 if (!champSkins.empty ())
637652 {
638- autobanChampsNames.reserve (champSkins.size ());
653+ autobanChampsNames.reserve (champSkins.size () + 1 );
654+ autobanChampsNames.emplace_back (" None" );
639655
640- std::string selectedChamp = ChampIdToName (S.gameTab .autoBanId );
641- std::ranges::copy (selectedChamp, autobanComboData.input );
656+ if (S.gameTab .autoBanId == -1 )
657+ {
658+ std::ranges::copy (" None" , autobanComboData.input );
659+ }
660+ else
661+ {
662+ std::string selectedChamp = ChampIdToName (S.gameTab .autoBanId );
663+ std::ranges::copy (selectedChamp, autobanComboData.input );
664+ }
642665
643666 for (size_t i = 0 ; i < champSkins.size (); i++)
644667 {
645668 autobanChampsNames.emplace_back (champSkins[i].name );
646669
647670 if (autobanComboData.input == champSkins[i].name )
648671 {
649- autobanComboData.index = i;
672+ autobanComboData.index = i + 1 ;
650673 }
651674 }
652675 autobanComboData.items = autobanChampsNames;
@@ -659,11 +682,18 @@ class GameTab
659682 {
660683 if (autobanComboData.index != -1 )
661684 {
662- for (const auto & [key, name, skins] : champSkins)
685+ if (std::string (autobanComboData.input ) == " None" )
686+ {
687+ S.gameTab .autoBanId = -1 ;
688+ }
689+ else
663690 {
664- if (autobanComboData. input == name)
691+ for ( const auto & [key, name, skins] : champSkins )
665692 {
666- S.gameTab .autoBanId = key;
693+ if (autobanComboData.input == name)
694+ {
695+ S.gameTab .autoBanId = key;
696+ }
667697 }
668698 }
669699 }
@@ -1384,8 +1414,8 @@ class GameTab
13841414 // search for own actions
13851415 if (action[" actorCellId" ].asInt () == cellId)
13861416 {
1387- if (std::string actionType = action[" type" ].asString (); actionType == " pick" && S. gameTab . instalockId && S. gameTab
1388- .instalockEnabled )
1417+ if (std::string actionType = action[" type" ].asString (); actionType == " pick"
1418+ && S. gameTab . instalockId && S. gameTab .instalockEnabled )
13891419 {
13901420 // if haven't picked yet
13911421 if (action[" completed" ].asBool () == false )
@@ -1398,6 +1428,12 @@ class GameTab
13981428 if (useBackupId)
13991429 currentPick = useBackupId;
14001430
1431+ if (S.gameTab .instalockId == -1 )
1432+ {
1433+ std::vector<std::pair<int , std::string>> instalockChamps = GetInstalockChamps ();
1434+ currentPick = instalockChamps[Utils::RandomInt (0 , instalockChamps.size () - 1 )].first ;
1435+ }
1436+
14011437 session.SetUrl (std::format (" https://127.0.0.1:{}/lol-champ-select/v1/session/actions/{}" ,
14021438 LCU::league.port ,
14031439 action[" id" ].asString ()));
@@ -1425,7 +1461,8 @@ class GameTab
14251461 }
14261462 }
14271463 // action that isn't our player, if dodge on ban enabled or backup pick
1428- else if ((S.gameTab .dodgeOnBan || S.gameTab .backupId ) && S.gameTab .instalockEnabled && S.gameTab .instalockId )
1464+ else if ((S.gameTab .dodgeOnBan || S.gameTab .backupId ) && S.gameTab .instalockEnabled
1465+ && S.gameTab .instalockId && (S.gameTab .instalockId != -1 ))
14291466 {
14301467 if (isPicked)
14311468 break ;
@@ -1453,7 +1490,7 @@ class GameTab
14531490 }
14541491 else if (action[" type" ].asString () == " pick" && action[" completed" ].asBool () == true )
14551492 {
1456- if (S.gameTab .backupId && action[" championId" ].asInt () == S.gameTab .instalockId )
1493+ if (S.gameTab .backupId && ( action[" championId" ].asInt () == S.gameTab .instalockId ) )
14571494 {
14581495 useBackupId = S.gameTab .backupId ;
14591496 }
0 commit comments