c++ skin Sash :)

  • Autor subiect #TrC
  • Dată creare
  • Răspunsuri: Răspunsuri 8
  • Vizualizări: Vizualizări 3K

#TrC

Fondator
Membru personal
11 Oct 2017
7.557
6.751
113
Monede Dragon
94
Cod:
diff --git a/source/server/common/item_length.h b/source/server/common/item_length.h
index 503a3fa6..b654cf1d 100755
--- a/source/server/common/item_length.h
+++ b/source/server/common/item_length.h
@@ -185,6 +185,7 @@ enum ECostumeSubTypes
#ifdef ENABLE_COSMETICS_SYSTEM
     COSTUME_PET = 5,
     COSTUME_MOUNT_SKIN = 6,
+    COSTUME_SASH_SKIN = 7,
#endif
     COSTUME_NUM_TYPES,
};
diff --git a/source/server/common/length.h b/source/server/common/length.h
index d737b4a5..b4261a69 100755
--- a/source/server/common/length.h
+++ b/source/server/common/length.h
@@ -244,6 +244,7 @@ enum EWearPositions
#ifdef ENABLE_COSMETICS_SYSTEM
     WEAR_COSMETIC_PET,
     WEAR_COSTUME_MOUNT_SKIN,
+    WEAR_COSTUME_SASH_SKIN,
#endif

     WEAR_MAX = 32    //
diff --git a/source/server/db/src/ProtoReader.cpp b/source/server/db/src/ProtoReader.cpp
index ace9c33a..f90b119c 100755
--- a/source/server/db/src/ProtoReader.cpp
+++ b/source/server/db/src/ProtoReader.cpp
@@ -148,7 +148,7 @@ int get_Item_SubType_Value(unsigned int type_value, string inputString)
                         "RESOURCE_STONE", "RESOURCE_METIN", "RESOURCE_ORE", "RESOURCE_AURA" };
     static string arSub16[] = { "UNIQUE_NONE", "UNIQUE_BOOK", "UNIQUE_SPECIAL_RIDE", "UNIQUE_3", "UNIQUE_4", "UNIQUE_5",
                     "UNIQUE_6", "UNIQUE_7", "UNIQUE_8", "UNIQUE_9", "USE_SPECIAL"};
-    static string arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT", "COSTUME_SASH", "COSTUME_WEAPON", "COSTUME_PET", "COSTUME_MOUNT_SKIN", "COSTUME_AURA" };
+    static string arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT", "COSTUME_SASH", "COSTUME_WEAPON", "COSTUME_PET", "COSTUME_MOUNT_SKIN", "COSTUME_SASH_SKIN", "COSTUME_AURA" };
     static string arSub29[] = { "DS_SLOT1", "DS_SLOT2", "DS_SLOT3", "DS_SLOT4", "DS_SLOT5", "DS_SLOT6" };
     static string arSub31[] = { "EXTRACT_DRAGON_SOUL", "EXTRACT_DRAGON_HEART" };
     static string arSub35[] = { "PET_EGG", "PET_UPBRINGING", "PET_BAG", "PET_FEEDSTUFF", "PET_SKILL", "PET_SKILL_DEL_BOOK", "PET_NAME_CHANGE", "PET_EXPFOOD",
diff --git a/source/server/game/src/char_item.cpp b/source/server/game/src/char_item.cpp
index 57de2ec1..9c62ae54 100755
--- a/source/server/game/src/char_item.cpp
+++ b/source/server/game/src/char_item.cpp
@@ -6174,9 +6174,25 @@ bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count)
         if (!CanUnequipNow(item))
             return false;

+        auto iWearCell = item->FindEquipCell(this);
+
+#ifdef ENABLE_COSMETICS_SYSTEM
+        if (iWearCell == WEAR_COSTUME_SASH)
+        {
+            auto sashSkin = GetWear(WEAR_COSTUME_SASH_SKIN);
+            if (sashSkin && !UnequipItem(sashSkin))
+            {
+                ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot unequip the costume sash. Not enough space."));
+                return false;
+            }
+
+            if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell))
+                return UnequipItem(item);
+        }
+#endif
+
#ifdef ENABLE_WEAPON_COSTUME_SYSTEM
-        int iWearCell = item->FindEquipCell(this);
-        if (iWearCell == WEAR_WEAPON)
+        else if (iWearCell == WEAR_WEAPON)
         {
             LPITEM costumeWeapon = GetWear(WEAR_COSTUME_WEAPON);
             if (costumeWeapon && !UnequipItem(costumeWeapon))
@@ -6749,9 +6765,21 @@ bool CHARACTER::SwapItem(BYTE bCell, BYTE bDestCell)

bool CHARACTER::UnequipItem(LPITEM item)
{
+    auto iWearCell = item->FindEquipCell(this);
+#ifdef ENABLE_COSMETICS_SYSTEM
+    if (iWearCell == WEAR_COSTUME_SASH)
+    {
+        auto sashSkin = GetWear(WEAR_COSTUME_SASH_SKIN);
+        if (sashSkin && !UnequipItem(sashSkin))
+        {
+            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot unequip the costume sash. Not enough space."));
+            return false;
+        }
+    }      
+#endif
+
#ifdef ENABLE_WEAPON_COSTUME_SYSTEM
-    int iWearCell = item->FindEquipCell(this);
-    if (iWearCell == WEAR_WEAPON)
+    else if (iWearCell == WEAR_WEAPON)
     {
         LPITEM costumeWeapon = GetWear(WEAR_COSTUME_WEAPON);
         if (costumeWeapon && !UnequipItem(costumeWeapon))
@@ -6871,6 +6899,18 @@ bool CHARACTER::EquipItem(LPITEM item, int iCandidateCell)
         return false;
     }

+#ifdef ENABLE_COSMETICS_SYSTEM
+    if (iWearCell == WEAR_COSTUME_SASH)
+    {
+        LPITEM costumeSash = GetWear(WEAR_COSTUME_SASH_SKIN);
+        if (costumeSash && !UnequipItem(costumeSash))
+        {
+            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot unequip the costume sash. Not enough space."));
+            return false;
+        }
+    }
+#endif
+
#ifdef ENABLE_WEAPON_COSTUME_SYSTEM
     if (iWearCell == WEAR_WEAPON)
     {
diff --git a/source/server/game/src/input_main.cpp b/source/server/game/src/input_main.cpp
index cd2d57ec..d7e77a2e 100755
--- a/source/server/game/src/input_main.cpp
+++ b/source/server/game/src/input_main.cpp
@@ -2166,10 +2166,10 @@ void CInputMain::SafeboxCheckin(LPCHARACTER ch, const char * c_pData)
         return;
     }

-#ifdef ENABLE_WEAPON_COSTUME_SYSTEM
+    auto iWearCell = pkItem->FindEquipCell(ch);
     if (pkItem->IsEquipped())
     {
-        int iWearCell = pkItem->FindEquipCell(ch);
+#ifdef ENABLE_WEAPON_COSTUME_SYSTEM      
         if (iWearCell == WEAR_WEAPON)
         {
             LPITEM costumeWeapon = ch->GetWear(WEAR_COSTUME_WEAPON);
@@ -2179,8 +2179,19 @@ void CInputMain::SafeboxCheckin(LPCHARACTER ch, const char * c_pData)
                 return;
             }
         }
-    }
#endif
+#ifdef ENABLE_COSMETICS_SYSTEM      
+        else if (iWearCell == WEAR_COSTUME_SASH)
+        {
+            auto costumeSash = ch->GetWear(WEAR_COSTUME_SASH_SKIN);
+            if (costumeSash && !ch->UnequipItem(costumeSash))
+            {
+                ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot unequip the costume sash. Not enough space."));
+                return;
+            }
+        }
+#endif
+    }

     // @fixme140 BEGIN
     if (ITEM_BELT == pkItem->GetType() && CBeltInventoryHelper::IsExistItemInBeltInventory(ch))
diff --git a/source/server/game/src/item.cpp b/source/server/game/src/item.cpp
index 46eeaf42..22c65eae 100755
--- a/source/server/game/src/item.cpp
+++ b/source/server/game/src/item.cpp
@@ -600,6 +600,9 @@ int CItem::FindEquipCell(LPCHARACTER ch, int iCandidateCell)
           
         else if (GetSubType() == COSTUME_MOUNT_SKIN)
             return WEAR_COSTUME_MOUNT_SKIN;          
+
+        else if (GetSubType() == COSTUME_SASH_SKIN)
+            return WEAR_COSTUME_SASH_SKIN;              
#endif
[/REPLY]

 
Ultima editare: