From 040415e6996a2b363ba961afa1e6c7fd4748934d Mon Sep 17 00:00:00 2001
From: Andy Newjack <andynewjack@protonmail.com>
Date: Wed, 1 Jul 2020 18:01:08 -0300
Subject: [PATCH] fix unit modifier indexes

---
 src/entity/item/unit.rs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/entity/item/unit.rs b/src/entity/item/unit.rs
index fcf4f0b..5528c1d 100644
--- a/src/entity/item/unit.rs
+++ b/src/entity/item/unit.rs
@@ -346,18 +346,18 @@ impl Unit {
         if let Some(modifier) = self.modifier {
             match modifier {
                 UnitModifier::PlusPlus => {
-                    result[7] = 3;
+                    result[6] = 2;
                 },
                 UnitModifier::Plus => {
-                    result[7] = 1;
+                    result[6] = 1;
                 },
                 UnitModifier::Minus => {
+                    result[6] = 0xFF;
                     result[7] = 0xFF;
-                    result[8] = 0xFF;
                 },
                 UnitModifier::MinusMinus => {
-                    result[7] = 0xFE;
-                    result[8] = 0xFF;
+                    result[6] = 0xFE;
+                    result[7] = 0xFF;
                 },
             }
         }
@@ -368,8 +368,8 @@ impl Unit {
     pub fn from_bytes(data: [u8; 16]) -> Result<Unit, ItemParseError> {
         let u = UnitType::parse_type([data[0], data[1], data[2]]); 
         if u.is_ok() {
-            let m = match u16::from_le_bytes([data[7], data[8]]) {
-                0x03 => Some(UnitModifier::PlusPlus),
+            let m = match u16::from_le_bytes([data[6], data[7]]) {
+                0x02 => Some(UnitModifier::PlusPlus),
                 0x01 => Some(UnitModifier::Plus),
                 0xFEFF => Some(UnitModifier::Minus),
                 0xFFFF => Some(UnitModifier::MinusMinus),