@@ -213,7 +213,8 @@ private void InitLocalization()
213213
214214 grpDrops . Text = Strings . NpcEditor . drops ;
215215 lblDropItem . Text = Strings . NpcEditor . dropitem ;
216- lblDropAmount . Text = Strings . NpcEditor . dropamount ;
216+ lblDropAmount . Text = Strings . NpcEditor . DropMaxAmount ;
217+ lblDropMinAmount . Text = Strings . NpcEditor . DropMinAmount ;
217218 lblDropChance . Text = Strings . NpcEditor . dropchance ;
218219 btnDropAdd . Text = Strings . NpcEditor . dropadd ;
219220 btnDropRemove . Text = Strings . NpcEditor . dropremove ;
@@ -448,7 +449,9 @@ private void UpdateDropValues(bool keepIndex = false)
448449 {
449450 lstDrops . Items . Add (
450451 Strings . NpcEditor . dropdisplay . ToString (
451- ItemBase . GetName ( mEditorItem . Drops [ i ] . ItemId ) , mEditorItem . Drops [ i ] . Quantity ,
452+ ItemBase . GetName ( mEditorItem . Drops [ i ] . ItemId ) ,
453+ mEditorItem . Drops [ i ] . MinQuantity ,
454+ mEditorItem . Drops [ i ] . Quantity ,
452455 mEditorItem . Drops [ i ] . Chance
453456 )
454457 ) ;
@@ -728,25 +731,34 @@ private void nudExp_ValueChanged(object sender, EventArgs e)
728731
729732 private void cmbDropItem_SelectedIndexChanged ( object sender , EventArgs e )
730733 {
731- if ( lstDrops . SelectedIndex > - 1 && lstDrops . SelectedIndex < mEditorItem . Drops . Count )
734+ if ( lstDrops . SelectedIndex < 0 || lstDrops . SelectedIndex > lstDrops . Items . Count )
732735 {
733- mEditorItem . Drops [ lstDrops . SelectedIndex ] . ItemId = ItemBase . IdFromList ( cmbDropItem . SelectedIndex - 1 ) ;
736+ return ;
734737 }
735738
739+ mEditorItem . Drops [ lstDrops . SelectedIndex ] . ItemId = ItemBase . IdFromList ( cmbDropItem . SelectedIndex - 1 ) ;
736740 UpdateDropValues ( true ) ;
737741 }
738742
739743 private void nudDropAmount_ValueChanged ( object sender , EventArgs e )
740744 {
741- // This should never be below 1. We shouldn't accept giving 0 items!
742- nudDropAmount . Value = Math . Max ( 1 , nudDropAmount . Value ) ;
745+ if ( lstDrops . SelectedIndex < 0 || lstDrops . SelectedIndex > lstDrops . Items . Count )
746+ {
747+ return ;
748+ }
743749
744- if ( lstDrops . SelectedIndex < lstDrops . Items . Count )
750+ mEditorItem . Drops [ lstDrops . SelectedIndex ] . Quantity = ( int ) nudDropAmount . Value ;
751+ UpdateDropValues ( true ) ;
752+ }
753+
754+ private void nudDropMinAmount_ValueChanged ( object sender , EventArgs e )
755+ {
756+ if ( lstDrops . SelectedIndex < 0 || lstDrops . SelectedIndex > lstDrops . Items . Count )
745757 {
746758 return ;
747759 }
748760
749- mEditorItem . Drops [ ( int ) lstDrops . SelectedIndex ] . Quantity = ( int ) nudDropAmount . Value ;
761+ mEditorItem . Drops [ lstDrops . SelectedIndex ] . MinQuantity = ( int ) nudDropMinAmount . Value ;
750762 UpdateDropValues ( true ) ;
751763 }
752764
@@ -756,6 +768,7 @@ private void lstDrops_SelectedIndexChanged(object sender, EventArgs e)
756768 {
757769 cmbDropItem . SelectedIndex = ItemBase . ListIndex ( mEditorItem . Drops [ lstDrops . SelectedIndex ] . ItemId ) + 1 ;
758770 nudDropAmount . Value = mEditorItem . Drops [ lstDrops . SelectedIndex ] . Quantity ;
771+ nudDropMinAmount . Value = mEditorItem . Drops [ lstDrops . SelectedIndex ] . MinQuantity ;
759772 nudDropChance . Value = ( decimal ) mEditorItem . Drops [ lstDrops . SelectedIndex ] . Chance ;
760773 }
761774 }
@@ -765,6 +778,7 @@ private void btnDropAdd_Click(object sender, EventArgs e)
765778 mEditorItem . Drops . Add ( new Drop ( ) ) ;
766779 mEditorItem . Drops [ mEditorItem . Drops . Count - 1 ] . ItemId = ItemBase . IdFromList ( cmbDropItem . SelectedIndex - 1 ) ;
767780 mEditorItem . Drops [ mEditorItem . Drops . Count - 1 ] . Quantity = ( int ) nudDropAmount . Value ;
781+ mEditorItem . Drops [ mEditorItem . Drops . Count - 1 ] . MinQuantity = ( int ) nudDropMinAmount . Value ;
768782 mEditorItem . Drops [ mEditorItem . Drops . Count - 1 ] . Chance = ( double ) nudDropChance . Value ;
769783
770784 UpdateDropValues ( ) ;
@@ -784,7 +798,7 @@ private void btnDropRemove_Click(object sender, EventArgs e)
784798
785799 private void nudDropChance_ValueChanged ( object sender , EventArgs e )
786800 {
787- if ( lstDrops . SelectedIndex < lstDrops . Items . Count )
801+ if ( lstDrops . SelectedIndex < 0 || lstDrops . SelectedIndex > lstDrops . Items . Count )
788802 {
789803 return ;
790804 }
0 commit comments