@@ -211,7 +211,8 @@ private void InitLocalization()
211211
212212 grpDrops . Text = Strings . NpcEditor . drops ;
213213 lblDropItem . Text = Strings . NpcEditor . dropitem ;
214- lblDropAmount . Text = Strings . NpcEditor . dropamount ;
214+ lblDropAmount . Text = Strings . NpcEditor . DropMaxAmount ;
215+ lblDropMinAmount . Text = Strings . NpcEditor . DropMinAmount ;
215216 lblDropChance . Text = Strings . NpcEditor . dropchance ;
216217 btnDropAdd . Text = Strings . NpcEditor . dropadd ;
217218 btnDropRemove . Text = Strings . NpcEditor . dropremove ;
@@ -446,7 +447,9 @@ private void UpdateDropValues(bool keepIndex = false)
446447 {
447448 lstDrops . Items . Add (
448449 Strings . NpcEditor . dropdisplay . ToString (
449- ItemBase . GetName ( mEditorItem . Drops [ i ] . ItemId ) , mEditorItem . Drops [ i ] . Quantity ,
450+ ItemBase . GetName ( mEditorItem . Drops [ i ] . ItemId ) ,
451+ mEditorItem . Drops [ i ] . MinQuantity ,
452+ mEditorItem . Drops [ i ] . Quantity ,
450453 mEditorItem . Drops [ i ] . Chance
451454 )
452455 ) ;
@@ -726,25 +729,34 @@ private void nudExp_ValueChanged(object sender, EventArgs e)
726729
727730 private void cmbDropItem_SelectedIndexChanged ( object sender , EventArgs e )
728731 {
729- if ( lstDrops . SelectedIndex > - 1 && lstDrops . SelectedIndex < mEditorItem . Drops . Count )
732+ if ( lstDrops . SelectedIndex < 0 || lstDrops . SelectedIndex > lstDrops . Items . Count )
730733 {
731- mEditorItem . Drops [ lstDrops . SelectedIndex ] . ItemId = ItemBase . IdFromList ( cmbDropItem . SelectedIndex - 1 ) ;
734+ return ;
732735 }
733736
737+ mEditorItem . Drops [ lstDrops . SelectedIndex ] . ItemId = ItemBase . IdFromList ( cmbDropItem . SelectedIndex - 1 ) ;
734738 UpdateDropValues ( true ) ;
735739 }
736740
737741 private void nudDropAmount_ValueChanged ( object sender , EventArgs e )
738742 {
739- // This should never be below 1. We shouldn't accept giving 0 items!
740- nudDropAmount . Value = Math . Max ( 1 , nudDropAmount . Value ) ;
743+ if ( lstDrops . SelectedIndex < 0 || lstDrops . SelectedIndex > lstDrops . Items . Count )
744+ {
745+ return ;
746+ }
741747
742- if ( lstDrops . SelectedIndex < lstDrops . Items . Count )
748+ mEditorItem . Drops [ lstDrops . SelectedIndex ] . Quantity = ( int ) nudDropAmount . Value ;
749+ UpdateDropValues ( true ) ;
750+ }
751+
752+ private void nudDropMinAmount_ValueChanged ( object sender , EventArgs e )
753+ {
754+ if ( lstDrops . SelectedIndex < 0 || lstDrops . SelectedIndex > lstDrops . Items . Count )
743755 {
744756 return ;
745757 }
746758
747- mEditorItem . Drops [ ( int ) lstDrops . SelectedIndex ] . Quantity = ( int ) nudDropAmount . Value ;
759+ mEditorItem . Drops [ lstDrops . SelectedIndex ] . MinQuantity = ( int ) nudDropMinAmount . Value ;
748760 UpdateDropValues ( true ) ;
749761 }
750762
@@ -754,6 +766,7 @@ private void lstDrops_SelectedIndexChanged(object sender, EventArgs e)
754766 {
755767 cmbDropItem . SelectedIndex = ItemBase . ListIndex ( mEditorItem . Drops [ lstDrops . SelectedIndex ] . ItemId ) + 1 ;
756768 nudDropAmount . Value = mEditorItem . Drops [ lstDrops . SelectedIndex ] . Quantity ;
769+ nudDropMinAmount . Value = mEditorItem . Drops [ lstDrops . SelectedIndex ] . MinQuantity ;
757770 nudDropChance . Value = ( decimal ) mEditorItem . Drops [ lstDrops . SelectedIndex ] . Chance ;
758771 }
759772 }
@@ -763,6 +776,7 @@ private void btnDropAdd_Click(object sender, EventArgs e)
763776 mEditorItem . Drops . Add ( new Drop ( ) ) ;
764777 mEditorItem . Drops [ mEditorItem . Drops . Count - 1 ] . ItemId = ItemBase . IdFromList ( cmbDropItem . SelectedIndex - 1 ) ;
765778 mEditorItem . Drops [ mEditorItem . Drops . Count - 1 ] . Quantity = ( int ) nudDropAmount . Value ;
779+ mEditorItem . Drops [ mEditorItem . Drops . Count - 1 ] . MinQuantity = ( int ) nudDropMinAmount . Value ;
766780 mEditorItem . Drops [ mEditorItem . Drops . Count - 1 ] . Chance = ( double ) nudDropChance . Value ;
767781
768782 UpdateDropValues ( ) ;
@@ -782,7 +796,7 @@ private void btnDropRemove_Click(object sender, EventArgs e)
782796
783797 private void nudDropChance_ValueChanged ( object sender , EventArgs e )
784798 {
785- if ( lstDrops . SelectedIndex < lstDrops . Items . Count )
799+ if ( lstDrops . SelectedIndex < 0 || lstDrops . SelectedIndex > lstDrops . Items . Count )
786800 {
787801 return ;
788802 }
0 commit comments