@@ -618,6 +618,10 @@ public void loadPlayer()
618618 gbBuffs . Enabled = true ;
619619 btnReload . Enabled = true ;
620620 updateInvDisplay ( ) ;
621+ if ( tcMain . SelectedIndex == 0 )
622+ {
623+ item_Click ( Pb1 , null ) ;
624+ }
621625 }
622626 catch ( Exception ex )
623627 {
@@ -1088,182 +1092,191 @@ private void gb_slot_Enter(object sender, EventArgs e)
10881092
10891093 private void cbItem_SelectedIndexChanged ( object sender , EventArgs e )
10901094 {
1091- try
1095+ if ( invSelectedIndex >= 0 )
10921096 {
1093- switch ( selectedTab )
1097+ try
10941098 {
1095- case 0 :
1096- if ( cbItem . SelectedIndex . ToString ( ) != "" )
1097- {
1098- inv_main [ invSelectedIndex ] . item = ih . searchItemByName ( cbItem . SelectedItem . ToString ( ) ) ;
1099- }
1100- isSaved = false ;
1101- if ( inv_main [ invSelectedIndex ] . quantity == 0 && inv_main [ invSelectedIndex ] . item . name != "Empty" )
1102- {
1103- inv_main [ invSelectedIndex ] . quantity += 1 ;
1104- nudQuant . Value += 1 ;
1105- }
1106- if ( inv_main [ invSelectedIndex ] . item . name == "Empty" )
1107- {
1108- inv_main [ invSelectedIndex ] . quantity = 0 ;
1109- nudQuant . Value = 0 ;
1110- inv_main [ invSelectedIndex ] . isFavorite = false ;
1111- }
1112- break ;
1099+ switch ( selectedTab )
1100+ {
1101+ case 0 :
1102+ if ( cbItem . SelectedIndex . ToString ( ) != "" )
1103+ {
1104+ inv_main [ invSelectedIndex ] . item = ih . searchItemByName ( cbItem . SelectedItem . ToString ( ) ) ;
1105+ }
1106+ isSaved = false ;
1107+ if ( inv_main [ invSelectedIndex ] . quantity == 0 && inv_main [ invSelectedIndex ] . item . name != "Empty" )
1108+ {
1109+ inv_main [ invSelectedIndex ] . quantity += 1 ;
1110+ nudQuant . Value += 1 ;
1111+ }
1112+ if ( inv_main [ invSelectedIndex ] . item . name == "Empty" )
1113+ {
1114+ inv_main [ invSelectedIndex ] . quantity = 0 ;
1115+ nudQuant . Value = 0 ;
1116+ inv_main [ invSelectedIndex ] . isFavorite = false ;
1117+ }
1118+ break ;
11131119
1114- case 1 :
1115- if ( cbItem . SelectedIndex . ToString ( ) != "" )
1116- {
1117- inv_piggybank [ invSelectedIndex ] . item = ih . searchItemByName ( cbItem . SelectedItem . ToString ( ) ) ;
1118- }
1119- isSaved = false ;
1120- if ( inv_piggybank [ invSelectedIndex ] . quantity == 0 && inv_piggybank [ invSelectedIndex ] . item . name != "Empty" )
1121- {
1122- inv_piggybank [ invSelectedIndex ] . quantity += 1 ;
1123- nudQuant . Value += 1 ;
1124- }
1125- if ( inv_piggybank [ invSelectedIndex ] . item . name == "Empty" )
1126- {
1127- inv_piggybank [ invSelectedIndex ] . quantity = 0 ;
1128- nudQuant . Value = 0 ;
1129- }
1130- break ;
1120+ case 1 :
1121+ if ( cbItem . SelectedIndex . ToString ( ) != "" )
1122+ {
1123+ inv_piggybank [ invSelectedIndex ] . item = ih . searchItemByName ( cbItem . SelectedItem . ToString ( ) ) ;
1124+ }
1125+ isSaved = false ;
1126+ if ( inv_piggybank [ invSelectedIndex ] . quantity == 0 && inv_piggybank [ invSelectedIndex ] . item . name != "Empty" )
1127+ {
1128+ inv_piggybank [ invSelectedIndex ] . quantity += 1 ;
1129+ nudQuant . Value += 1 ;
1130+ }
1131+ if ( inv_piggybank [ invSelectedIndex ] . item . name == "Empty" )
1132+ {
1133+ inv_piggybank [ invSelectedIndex ] . quantity = 0 ;
1134+ nudQuant . Value = 0 ;
1135+ }
1136+ break ;
11311137
1132- case 2 :
1133- if ( cbItem . SelectedIndex . ToString ( ) != "" )
1134- {
1135- inv_safe [ invSelectedIndex ] . item = ih . searchItemByName ( cbItem . SelectedItem . ToString ( ) ) ;
1136- }
1137- isSaved = false ;
1138- if ( inv_safe [ invSelectedIndex ] . quantity == 0 && inv_safe [ invSelectedIndex ] . item . name != "Empty" )
1139- {
1140- inv_safe [ invSelectedIndex ] . quantity += 1 ;
1141- nudQuant . Value += 1 ;
1142- }
1143- if ( inv_safe [ invSelectedIndex ] . item . name == "Empty" )
1144- {
1145- inv_safe [ invSelectedIndex ] . quantity = 0 ;
1146- nudQuant . Value = 0 ;
1147- }
1148- break ;
1138+ case 2 :
1139+ if ( cbItem . SelectedIndex . ToString ( ) != "" )
1140+ {
1141+ inv_safe [ invSelectedIndex ] . item = ih . searchItemByName ( cbItem . SelectedItem . ToString ( ) ) ;
1142+ }
1143+ isSaved = false ;
1144+ if ( inv_safe [ invSelectedIndex ] . quantity == 0 && inv_safe [ invSelectedIndex ] . item . name != "Empty" )
1145+ {
1146+ inv_safe [ invSelectedIndex ] . quantity += 1 ;
1147+ nudQuant . Value += 1 ;
1148+ }
1149+ if ( inv_safe [ invSelectedIndex ] . item . name == "Empty" )
1150+ {
1151+ inv_safe [ invSelectedIndex ] . quantity = 0 ;
1152+ nudQuant . Value = 0 ;
1153+ }
1154+ break ;
11491155
1150- case 3 :
1151- if ( cbItem . SelectedIndex . ToString ( ) != "" )
1152- {
1153- inv_ammocoins [ invSelectedIndex ] . item = ih . searchItemByName ( cbItem . SelectedItem . ToString ( ) ) ;
1154- }
1155- isSaved = false ;
1156- if ( inv_ammocoins [ invSelectedIndex ] . quantity == 0 && inv_ammocoins [ invSelectedIndex ] . item . name != "Empty" )
1157- {
1158- inv_ammocoins [ invSelectedIndex ] . quantity += 1 ;
1159- nudQuant . Value += 1 ;
1160- }
1161- if ( inv_ammocoins [ invSelectedIndex ] . item . name == "Empty" )
1162- {
1163- inv_ammocoins [ invSelectedIndex ] . quantity = 0 ;
1164- nudQuant . Value = 0 ;
1165- }
1166- break ;
1156+ case 3 :
1157+ if ( cbItem . SelectedIndex . ToString ( ) != "" )
1158+ {
1159+ inv_ammocoins [ invSelectedIndex ] . item = ih . searchItemByName ( cbItem . SelectedItem . ToString ( ) ) ;
1160+ }
1161+ isSaved = false ;
1162+ if ( inv_ammocoins [ invSelectedIndex ] . quantity == 0 && inv_ammocoins [ invSelectedIndex ] . item . name != "Empty" )
1163+ {
1164+ inv_ammocoins [ invSelectedIndex ] . quantity += 1 ;
1165+ nudQuant . Value += 1 ;
1166+ }
1167+ if ( inv_ammocoins [ invSelectedIndex ] . item . name == "Empty" )
1168+ {
1169+ inv_ammocoins [ invSelectedIndex ] . quantity = 0 ;
1170+ nudQuant . Value = 0 ;
1171+ }
1172+ break ;
11671173
1168- case 4 :
1174+ case 4 :
1175+ if ( cbBuffs . SelectedIndex . ToString ( ) != "" )
1176+ {
1177+ playerBuffs [ invSelectedIndex ] . buff = ih . searchBuffByName ( cbBuffs . SelectedItem . ToString ( ) ) ;
1178+ }
1179+ isSaved = false ;
1180+ if ( playerBuffs [ invSelectedIndex ] . duration == 0 && playerBuffs [ invSelectedIndex ] . buff . name != "None" )
1181+ {
1182+ playerBuffs [ invSelectedIndex ] . duration += 1 ;
1183+ nudQuant . Value += 1 ;
1184+ }
1185+ if ( playerBuffs [ invSelectedIndex ] . buff . name == "None" )
1186+ {
1187+ playerBuffs [ invSelectedIndex ] . duration = 0 ;
1188+ nudQuant . Value = 0 ;
1189+ }
1190+ break ;
1191+ }
1192+
1193+ updateInvDisplay ( ) ;
1194+ }
1195+ catch
1196+ {
1197+
1198+ }
1199+ }
1200+ }
1201+
1202+ private void cbBuffs_SelectedIndexChanged ( object sender , EventArgs e )
1203+ {
1204+ if ( invSelectedIndex >= 0 )
1205+ {
1206+ if ( doBuffs )
1207+ {
1208+ try
1209+ {
11691210 if ( cbBuffs . SelectedIndex . ToString ( ) != "" )
11701211 {
11711212 playerBuffs [ invSelectedIndex ] . buff = ih . searchBuffByName ( cbBuffs . SelectedItem . ToString ( ) ) ;
11721213 }
11731214 isSaved = false ;
11741215 if ( playerBuffs [ invSelectedIndex ] . duration == 0 && playerBuffs [ invSelectedIndex ] . buff . name != "None" )
11751216 {
1176- playerBuffs [ invSelectedIndex ] . duration += 1 ;
1177- nudQuant . Value += 1 ;
1217+ playerBuffs [ invSelectedIndex ] . duration += 60 ;
1218+ nudDur . Value += 60 ;
11781219 }
11791220 if ( playerBuffs [ invSelectedIndex ] . buff . name == "None" )
11801221 {
11811222 playerBuffs [ invSelectedIndex ] . duration = 0 ;
1182- nudQuant . Value = 0 ;
1223+ nudDur . Value = 0 ;
11831224 }
1184- break ;
1185- }
1186-
1187- updateInvDisplay ( ) ;
1188- }
1189- catch
1190- {
1191-
1192- }
1193- }
1194-
1195- private void cbBuffs_SelectedIndexChanged ( object sender , EventArgs e )
1196- {
1197- if ( doBuffs )
1198- {
1199- try
1200- {
1201- if ( cbBuffs . SelectedIndex . ToString ( ) != "" )
1202- {
1203- playerBuffs [ invSelectedIndex ] . buff = ih . searchBuffByName ( cbBuffs . SelectedItem . ToString ( ) ) ;
1204- }
1205- isSaved = false ;
1206- if ( playerBuffs [ invSelectedIndex ] . duration == 0 && playerBuffs [ invSelectedIndex ] . buff . name != "None" )
1207- {
1208- playerBuffs [ invSelectedIndex ] . duration += 60 ;
1209- nudDur . Value += 60 ;
1225+ updateInvDisplay ( ) ;
12101226 }
1211- if ( playerBuffs [ invSelectedIndex ] . buff . name == "None" )
1227+ catch
12121228 {
1213- playerBuffs [ invSelectedIndex ] . duration = 0 ;
1214- nudDur . Value = 0 ;
1215- }
1216- updateInvDisplay ( ) ;
1217- }
1218- catch
1219- {
12201229
1230+ }
12211231 }
1222- }
1232+ }
12231233 }
12241234
12251235 private void cbPrefixes_SelectedIndexChanged ( object sender , EventArgs e )
12261236 {
1227- try
1237+ if ( invSelectedIndex >= 0 )
12281238 {
1229- switch ( selectedTab )
1239+ try
12301240 {
1231- case 0 :
1232- if ( cbPrefixes . SelectedItem . ToString ( ) != "" )
1233- {
1234- inv_main [ invSelectedIndex ] . prefix = ih . searchPrefixByName ( cbPrefixes . SelectedItem . ToString ( ) ) ;
1235- }
1236- break ;
1241+ switch ( selectedTab )
1242+ {
1243+ case 0 :
1244+ if ( cbPrefixes . SelectedItem . ToString ( ) != "" )
1245+ {
1246+ inv_main [ invSelectedIndex ] . prefix = ih . searchPrefixByName ( cbPrefixes . SelectedItem . ToString ( ) ) ;
1247+ }
1248+ break ;
12371249
1238- case 1 :
1239- if ( cbPrefixes . SelectedItem . ToString ( ) != "" )
1240- {
1241- inv_piggybank [ invSelectedIndex ] . prefix = ih . searchPrefixByName ( cbPrefixes . SelectedItem . ToString ( ) ) ;
1242- }
1243- break ;
1250+ case 1 :
1251+ if ( cbPrefixes . SelectedItem . ToString ( ) != "" )
1252+ {
1253+ inv_piggybank [ invSelectedIndex ] . prefix = ih . searchPrefixByName ( cbPrefixes . SelectedItem . ToString ( ) ) ;
1254+ }
1255+ break ;
12441256
1245- case 2 :
1246- if ( cbPrefixes . SelectedItem . ToString ( ) != "" )
1247- {
1248- inv_safe [ invSelectedIndex ] . prefix = ih . searchPrefixByName ( cbPrefixes . SelectedItem . ToString ( ) ) ;
1249- }
1250- break ;
1257+ case 2 :
1258+ if ( cbPrefixes . SelectedItem . ToString ( ) != "" )
1259+ {
1260+ inv_safe [ invSelectedIndex ] . prefix = ih . searchPrefixByName ( cbPrefixes . SelectedItem . ToString ( ) ) ;
1261+ }
1262+ break ;
12511263
1252- case 3 :
1253- if ( cbPrefixes . SelectedItem . ToString ( ) != "" )
1254- {
1255- inv_ammocoins [ invSelectedIndex ] . prefix = ih . searchPrefixByName ( cbPrefixes . SelectedItem . ToString ( ) ) ;
1256- }
1257- break ;
1258- }
1264+ case 3 :
1265+ if ( cbPrefixes . SelectedItem . ToString ( ) != "" )
1266+ {
1267+ inv_ammocoins [ invSelectedIndex ] . prefix = ih . searchPrefixByName ( cbPrefixes . SelectedItem . ToString ( ) ) ;
1268+ }
1269+ break ;
1270+ }
12591271
1260- updateInvDisplay ( ) ;
1261- isSaved = false ;
1262- }
1263- catch
1264- {
1272+ updateInvDisplay ( ) ;
1273+ isSaved = false ;
1274+ }
1275+ catch
1276+ {
12651277
1266- }
1278+ }
1279+ }
12671280 }
12681281
12691282 private void nudQuant_ValueChanged ( object sender , EventArgs e )
0 commit comments