Skip to content

Commit d2ff75f

Browse files
committed
Improved equipped item index handling.
1 parent 06d9c47 commit d2ff75f

1 file changed

Lines changed: 183 additions & 0 deletions

File tree

DeS-SaveEdit/DeS.vb

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,23 +439,206 @@ Public Class DeS
439439

440440
bytes(&HFB) = cmbStartClass.SelectedIndex
441441

442+
'Left Hand 1
443+
For i = 0 To dgvWeapons.Rows.Count - 1
444+
Dim toMatch = Val(cllWeapons(cmbLeftHand1.FindStringExact(cmbLeftHand1.Text)))
445+
Dim possibleMatch = RInt32(&H2E0 + i * &H20)
446+
447+
448+
If toMatch = possibleMatch Then
449+
WUInt32(&H238, i)
450+
End If
451+
Next
442452
WUInt32(&H28C, Val(cllWeapons(cmbLeftHand1.SelectedIndex)))
453+
454+
'Right Hand 1
455+
For i = 0 To dgvWeapons.Rows.Count - 1
456+
Dim toMatch = Val(cllWeapons(cmbRightHand1.FindStringExact(cmbRightHand1.Text)))
457+
Dim possibleMatch = RInt32(&H2E0 + i * &H20)
458+
459+
460+
If toMatch = possibleMatch Then
461+
WUInt32(&H23C, i)
462+
End If
463+
Next
443464
WUInt32(&H290, Val(cllWeapons(cmbRightHand1.SelectedIndex)))
465+
466+
'Left Hand 2
467+
For i = 0 To dgvWeapons.Rows.Count - 1
468+
Dim toMatch = Val(cllWeapons(cmbLeftHand2.FindStringExact(cmbLeftHand2.Text)))
469+
Dim possibleMatch = RInt32(&H2E0 + i * &H20)
470+
471+
472+
If toMatch = possibleMatch Then
473+
WUInt32(&H240, i)
474+
End If
475+
Next
444476
WUInt32(&H294, Val(cllWeapons(cmbLeftHand2.SelectedIndex)))
477+
478+
'Right Hand 2
479+
For i = 0 To dgvWeapons.Rows.Count - 1
480+
Dim toMatch = Val(cllWeapons(cmbRightHand2.FindStringExact(cmbRightHand2.Text)))
481+
Dim possibleMatch = RInt32(&H2E0 + i * &H20)
482+
483+
484+
If toMatch = possibleMatch Then
485+
WUInt32(&H244, i)
486+
End If
487+
Next
445488
WUInt32(&H298, Val(cllWeapons(cmbRightHand2.SelectedIndex)))
446489

490+
'Arrows
491+
For i = 0 To dgvWeapons.Rows.Count - 1
492+
Dim toMatch = Val(cllWeapons(cmbArrows.FindStringExact(cmbArrows.Text)))
493+
Dim possibleMatch = RInt32(&H2E0 + i * &H20)
494+
495+
496+
If toMatch = possibleMatch Then
497+
WUInt32(&H248, i)
498+
End If
499+
Next
447500
WUInt32(&H29C, Val(cllWeapons(cmbArrows.SelectedIndex)))
501+
502+
'Bolts
503+
For i = 0 To dgvWeapons.Rows.Count - 1
504+
Dim toMatch = Val(cllWeapons(cmbBolts.FindStringExact(cmbBolts.Text)))
505+
Dim possibleMatch = RInt32(&H2E0 + i * &H20)
506+
507+
508+
If toMatch = possibleMatch Then
509+
WUInt32(&H24C, i)
510+
End If
511+
Next
448512
WUInt32(&H2A0, Val(cllWeapons(cmbBolts.SelectedIndex)))
449513

514+
515+
'Helmet
516+
For i = 0 To dgvArmor.Rows.Count - 1
517+
Dim toMatch = Val(cllArmor(cmbHelmet.FindStringExact(cmbHelmet.Text)))
518+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + i) * &H20)
519+
520+
521+
If toMatch = possibleMatch Then
522+
WUInt32(&H250, i + dgvWeapons.Rows.Count - 2)
523+
End If
524+
Next
450525
WUInt32(&H2A4, Val(cllArmor(cmbHelmet.SelectedIndex)))
526+
527+
'Chest
528+
For i = 0 To dgvArmor.Rows.Count - 1
529+
Dim toMatch = Val(cllArmor(cmbChest.FindStringExact(cmbChest.Text)))
530+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + i) * &H20)
531+
532+
533+
If toMatch = possibleMatch Then
534+
WUInt32(&H254, i + dgvWeapons.Rows.Count - 2)
535+
End If
536+
Next
451537
WUInt32(&H2A8, Val(cllArmor(cmbChest.SelectedIndex)))
538+
539+
'Gauntlets
540+
For i = 0 To dgvArmor.Rows.Count - 1
541+
Dim toMatch = Val(cllArmor(cmbGauntlets.FindStringExact(cmbGauntlets.Text)))
542+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + i) * &H20)
543+
544+
545+
If toMatch = possibleMatch Then
546+
WUInt32(&H258, i + dgvWeapons.Rows.Count - 2)
547+
End If
548+
Next
452549
WUInt32(&H2AC, Val(cllArmor(cmbGauntlets.SelectedIndex)))
550+
551+
'Leggings
552+
For i = 0 To dgvArmor.Rows.Count - 1
553+
Dim toMatch = Val(cllArmor(cmbLeggings.FindStringExact(cmbLeggings.Text)))
554+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + i) * &H20)
555+
556+
557+
If toMatch = possibleMatch Then
558+
WUInt32(&H25C, i + dgvWeapons.Rows.Count - 2)
559+
End If
560+
Next
453561
WUInt32(&H2B0, Val(cllArmor(cmbLeggings.SelectedIndex)))
454562

563+
455564
WUInt32(&H2B4, Val(cllHairstyles(cmbHairstyle.SelectedIndex)))
565+
566+
'Ring 1
567+
For i = 0 To dgvArmor.Rows.Count - 1
568+
Dim toMatch = Val(cllRings(cmbRing1.FindStringExact(cmbRing1.Text)))
569+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + i) * &H20)
570+
571+
572+
If toMatch = possibleMatch Then
573+
WUInt32(&H260, i + dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2)
574+
End If
575+
Next
456576
WUInt32(&H2B8, Val(cllRings(cmbRing1.SelectedIndex)))
577+
578+
'Ring 2
579+
For i = 0 To dgvArmor.Rows.Count - 1
580+
Dim toMatch = Val(cllRings(cmbRing2.FindStringExact(cmbRing2.Text)))
581+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + i) * &H20)
582+
583+
584+
If toMatch = possibleMatch Then
585+
WUInt32(&H264, i + dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2)
586+
End If
587+
Next
457588
WUInt32(&H2BC, Val(cllRings(cmbRing2.SelectedIndex)))
458589

590+
'Goods 1
591+
For i = 0 To dgvGoods.Rows.Count - 1
592+
Dim toMatch = RInt32(&H2C0)
593+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2 + i) * &H20)
594+
595+
596+
If toMatch = possibleMatch Then
597+
WUInt32(&H268, i + dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2)
598+
End If
599+
Next
600+
'Goods 2
601+
For i = 0 To dgvGoods.Rows.Count - 1
602+
Dim toMatch = RInt32(&H2C4)
603+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2 + i) * &H20)
604+
605+
606+
If toMatch = possibleMatch Then
607+
WUInt32(&H26C, i + dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2)
608+
End If
609+
Next
610+
'Goods 3
611+
For i = 0 To dgvGoods.Rows.Count - 1
612+
Dim toMatch = RInt32(&H2C8)
613+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2 + i) * &H20)
614+
615+
616+
If toMatch = possibleMatch Then
617+
WUInt32(&H270, i + dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2)
618+
End If
619+
Next
620+
'Goods 4
621+
For i = 0 To dgvGoods.Rows.Count - 1
622+
Dim toMatch = RInt32(&H2CC)
623+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2 + i) * &H20)
624+
625+
626+
If toMatch = possibleMatch Then
627+
WUInt32(&H274, i + dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2)
628+
End If
629+
Next
630+
'Goods 5
631+
For i = 0 To dgvGoods.Rows.Count - 1
632+
Dim toMatch = RInt32(&H2D0)
633+
Dim possibleMatch = RInt32(&H2E0 + (dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2 + i) * &H20)
634+
635+
636+
If toMatch = possibleMatch Then
637+
WUInt32(&H278, i + dgvWeapons.Rows.Count - 2 + dgvArmor.Rows.Count - 2 + dgvRings.Rows.Count - 2)
638+
End If
639+
Next
640+
641+
459642
REM InsBytes(&H2C0, UInt32ToFourByte(cllItems(cmbQuickSlot1.SelectedIndex)))
460643
REM InsBytes(&H2C4, UInt32ToFourByte(cllItems(cmbQuickSlot2.SelectedIndex)))
461644
REM InsBytes(&H2C8, UInt32ToFourByte(cllItems(cmbQuickSlot3.SelectedIndex)))

0 commit comments

Comments
 (0)