Skip to content

Commit

Permalink
itemlist
Browse files Browse the repository at this point in the history
  • Loading branch information
shnok committed Oct 28, 2024
1 parent f9de098 commit 46ef90d
Show file tree
Hide file tree
Showing 21 changed files with 292 additions and 186 deletions.
23 changes: 21 additions & 2 deletions l2-unity/Assets/Resources/Scenes/Tests/Test.unity
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ MonoBehaviour:
_filteredCategories:
_usedSlots: 0
_slotCount: 0
_currentWeight: 0
_maximumWeight: 0
_adenaCount: 0
--- !u!1001 &445805727
PrefabInstance:
Expand Down Expand Up @@ -515,6 +513,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 28ac95a8338583c458ec03479c2641dd, type: 3}
m_Name:
m_EditorClassIdentifier:
_x: 0
_y: 0
_target: {fileID: 0}
_smoothCamera: 1
_camOffset: {x: 0, y: 0.8, z: 0}
Expand Down Expand Up @@ -615,6 +615,7 @@ GameObject:
- component: {fileID: 742913640}
- component: {fileID: 742913643}
- component: {fileID: 742913642}
- component: {fileID: 742913644}
m_Layer: 0
m_Name: Game
m_TagString: Untagged
Expand Down Expand Up @@ -661,6 +662,24 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 14bf3f2dcfcbba64aade5b0f3ee646a6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &742913644
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 742913639}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 823aa333124faf2469aa8b94ec983187, type: 3}
m_Name:
m_EditorClassIdentifier:
_entityMask:
serializedVersion: 2
m_Bits: 0
_clickThroughMask:
serializedVersion: 2
m_Bits: 0
--- !u!1 &813744334
GameObject:
m_ObjectHideFlags: 0
Expand Down
16 changes: 8 additions & 8 deletions l2-unity/Assets/Scripts/Game/Character/CharacterCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,38 +154,38 @@ public void GearUpPawn(PlayerAppearance appearance, UserGear gear)
{
if (appearance.Chest != 0)
{
gear.EquipArmor(appearance.Chest, ItemSlot.chest);
gear.EquipArmor(appearance.Chest, ItemSlot.SLOT_CHEST);
}
else
{
gear.EquipArmor(ItemTable.NAKED_CHEST, ItemSlot.chest);
gear.EquipArmor(ItemTable.NAKED_CHEST, ItemSlot.SLOT_CHEST);
}

if (appearance.Legs != 0)
{
gear.EquipArmor(appearance.Legs, ItemSlot.legs);
gear.EquipArmor(appearance.Legs, ItemSlot.SLOT_LEGS);
}
else
{
gear.EquipArmor(ItemTable.NAKED_LEGS, ItemSlot.legs);
gear.EquipArmor(ItemTable.NAKED_LEGS, ItemSlot.SLOT_LEGS);
}

if (appearance.Gloves != 0)
{
gear.EquipArmor(appearance.Gloves, ItemSlot.gloves);
gear.EquipArmor(appearance.Gloves, ItemSlot.SLOT_GLOVES);
}
else
{
gear.EquipArmor(ItemTable.NAKED_GLOVES, ItemSlot.gloves);
gear.EquipArmor(ItemTable.NAKED_GLOVES, ItemSlot.SLOT_GLOVES);
}

if (appearance.Feet != 0)
{
gear.EquipArmor(appearance.Feet, ItemSlot.feet);
gear.EquipArmor(appearance.Feet, ItemSlot.SLOT_FEET);
}
else
{
gear.EquipArmor(ItemTable.NAKED_BOOTS, ItemSlot.feet);
gear.EquipArmor(ItemTable.NAKED_BOOTS, ItemSlot.SLOT_FEET);
}

if (appearance.LHand != 0)
Expand Down
40 changes: 20 additions & 20 deletions l2-unity/Assets/Scripts/Game/Combat/Gear/UserGear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ public bool IsArmorAlreadyEquipped(int itemId, ItemSlot slot)

switch (slot)
{
case ItemSlot.chest:
case ItemSlot.SLOT_CHEST:
return itemId == _torsoMeta.Id;
case ItemSlot.fullarmor:
case ItemSlot.SLOT_FULL_ARMOR:
return itemId == _fullarmorMeta.Id;
case ItemSlot.legs:
case ItemSlot.SLOT_LEGS:
return itemId == _legsMeta.Id;
case ItemSlot.gloves:
case ItemSlot.SLOT_GLOVES:
return itemId == _glovesMeta.Id;
case ItemSlot.feet:
case ItemSlot.SLOT_FEET:
return itemId == _bootsMeta.Id;
}

Expand All @@ -95,38 +95,38 @@ public override void EquipAllArmors(Appearance apr)
PlayerAppearance appearance = (PlayerAppearance)apr;
if (appearance.Chest != 0)
{
EquipArmor(appearance.Chest, ItemSlot.chest);
EquipArmor(appearance.Chest, ItemSlot.SLOT_CHEST);
}
else
{
EquipArmor(ItemTable.NAKED_CHEST, ItemSlot.chest);
EquipArmor(ItemTable.NAKED_CHEST, ItemSlot.SLOT_CHEST);
}

if (appearance.Legs != 0)
{
EquipArmor(appearance.Legs, ItemSlot.legs);
EquipArmor(appearance.Legs, ItemSlot.SLOT_LEGS);
}
else
{
EquipArmor(ItemTable.NAKED_LEGS, ItemSlot.legs);
EquipArmor(ItemTable.NAKED_LEGS, ItemSlot.SLOT_LEGS);
}

if (appearance.Gloves != 0)
{
EquipArmor(appearance.Gloves, ItemSlot.gloves);
EquipArmor(appearance.Gloves, ItemSlot.SLOT_GLOVES);
}
else
{
EquipArmor(ItemTable.NAKED_GLOVES, ItemSlot.gloves);
EquipArmor(ItemTable.NAKED_GLOVES, ItemSlot.SLOT_GLOVES);
}

if (appearance.Feet != 0)
{
EquipArmor(appearance.Feet, ItemSlot.feet);
EquipArmor(appearance.Feet, ItemSlot.SLOT_FEET);
}
else
{
EquipArmor(ItemTable.NAKED_BOOTS, ItemSlot.feet);
EquipArmor(ItemTable.NAKED_BOOTS, ItemSlot.SLOT_FEET);
}
}

Expand Down Expand Up @@ -162,7 +162,7 @@ private void SetArmorPiece(Armor armor, GameObject armorPiece, ItemSlot slot)
{
switch (slot)
{
case ItemSlot.chest:
case ItemSlot.SLOT_CHEST:
if (_torso != null)
{
DestroyImmediate(_torso);
Expand All @@ -172,13 +172,13 @@ private void SetArmorPiece(Armor armor, GameObject armorPiece, ItemSlot slot)
{
DestroyImmediate(_fullarmor);
_fullarmorMeta = null;
EquipArmor(ItemTable.NAKED_LEGS, ItemSlot.legs);
EquipArmor(ItemTable.NAKED_LEGS, ItemSlot.SLOT_LEGS);
}
_torso = armorPiece;
_torsoMeta = armor;
_torso.transform.SetParent(_bodypartsContainer.transform, false);
break;
case ItemSlot.fullarmor:
case ItemSlot.SLOT_FULL_ARMOR:
if (_torso != null)
{
DestroyImmediate(_torso);
Expand All @@ -193,7 +193,7 @@ private void SetArmorPiece(Armor armor, GameObject armorPiece, ItemSlot slot)
_fullarmorMeta = armor;
_fullarmor.transform.SetParent(_bodypartsContainer.transform, false);
break;
case ItemSlot.legs:
case ItemSlot.SLOT_LEGS:
if (_legs != null)
{
DestroyImmediate(_legs);
Expand All @@ -203,13 +203,13 @@ private void SetArmorPiece(Armor armor, GameObject armorPiece, ItemSlot slot)
{
DestroyImmediate(_fullarmor);
_fullarmorMeta = null;
EquipArmor(ItemTable.NAKED_CHEST, ItemSlot.chest);
EquipArmor(ItemTable.NAKED_CHEST, ItemSlot.SLOT_CHEST);
}
_legs = armorPiece;
_legs.transform.SetParent(_bodypartsContainer.transform, false);
_legsMeta = armor;
break;
case ItemSlot.gloves:
case ItemSlot.SLOT_GLOVES:
if (_gloves != null)
{
DestroyImmediate(_gloves);
Expand All @@ -219,7 +219,7 @@ private void SetArmorPiece(Armor armor, GameObject armorPiece, ItemSlot slot)
_gloves.transform.SetParent(_bodypartsContainer.transform, false);
_glovesMeta = armor;
break;
case ItemSlot.feet:
case ItemSlot.SLOT_FEET:
if (_boots != null)
{
DestroyImmediate(_boots);
Expand Down
10 changes: 0 additions & 10 deletions l2-unity/Assets/Scripts/Game/Item/Enums/ItemCategory.cs

This file was deleted.

87 changes: 51 additions & 36 deletions l2-unity/Assets/Scripts/Game/Item/Enums/ItemSlot.cs
Original file line number Diff line number Diff line change
@@ -1,55 +1,70 @@
public enum ItemSlot : byte {
none = 0,
head = 1,
chest = 2,
legs = 3,
fullarmor = 4,
gloves = 5,
feet = 6,
lhand = 7,
rhand = 8,
lrhand = 9,
rfinger = 10,
lfinger = 11,
lear = 12,
rear = 13,
neck = 14,
underwear = 15,
ring = 16,
earring = 17
public enum ItemSlot : int
{
SLOT_NONE = 0,
SLOT_UNDERWEAR = 0x0001,
SLOT_R_EAR = 0x0002,
SLOT_L_EAR = 0x0004,
SLOT_NECK = 0x0008,
SLOT_R_FINGER = 0x0010,
SLOT_L_FINGER = 0x0020,
SLOT_HEAD = 0x0040,
SLOT_R_HAND = 0x0080,
SLOT_LR_HAND = 0x0100,
SLOT_GLOVES = 0x0200,
SLOT_CHEST = 0x0400,
SLOT_LEGS = 0x0800,
SLOT_FEET = 0x1000,
SLOT_L_HAND = 0x4000,
SLOT_FULL_ARMOR = 0x8000,


// not handled yet
SLOT_BACK = 0x1000,
SLOT_ALLWEAPON = 0x4080,
SLOT_FACE = 0x010000,
SLOT_ALLDRESS = 0x020000,
SLOT_HAIR = 0x040000,
SLOT_HAIRALL = 0x080000,
SLOT_WOLF = 0x080000,
SLOT_HATCHLING = 0x020000,
SLOT_STRIDER = 0x020000,
SLOT_BABYPET = 0x020000,
}

public class ItemSlotParser {
public static ItemSlot ParseBodyPart(string bodyPart) {
switch (bodyPart) {
public class ItemSlotParser
{
public static ItemSlot ParseBodyPart(string bodyPart)
{
switch (bodyPart)
{
case "artifact_a1":
return ItemSlot.chest;
return ItemSlot.SLOT_CHEST;
case "artifact_a2":
return ItemSlot.legs;
return ItemSlot.SLOT_LEGS;
case "artifact_a3":
return ItemSlot.feet;
return ItemSlot.SLOT_FEET;
case "head":
return ItemSlot.head;
return ItemSlot.SLOT_HEAD;
case "artifactbook":
return ItemSlot.gloves;
return ItemSlot.SLOT_GLOVES;
case "rfinger":
return ItemSlot.rfinger;
return ItemSlot.SLOT_R_FINGER;
case "lfinger":
return ItemSlot.lfinger;
return ItemSlot.SLOT_L_FINGER;
case "rear":
return ItemSlot.rear;
return ItemSlot.SLOT_R_EAR;
case "lear":
return ItemSlot.lear;
return ItemSlot.SLOT_L_EAR;
case "neck":
return ItemSlot.neck;
return ItemSlot.SLOT_NECK;
case "onepiece":
return ItemSlot.fullarmor;
return ItemSlot.SLOT_FULL_ARMOR;
case "artifact_a7":
return ItemSlot.rhand;
return ItemSlot.SLOT_R_HAND;
case "lrhand":
return ItemSlot.lrhand;
return ItemSlot.SLOT_LR_HAND;
default:
return ItemSlot.feet;
return ItemSlot.SLOT_FEET;
}
}
}
7 changes: 7 additions & 0 deletions l2-unity/Assets/Scripts/Game/Item/Enums/ItemType1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public enum ItemType1 : byte
{
// Item Type 2 : 00-weapon, 01-shield/armor, 02-ring/earring/necklace, 03-questitem, 04-adena, 05-item
TYPE1_WEAPON_RING_EARRING_NECKLACE = 0,
TYPE1_SHIELD_ARMOR = 1,
TYPE1_ITEM_QUESTITEM_ADENA = 4
}
9 changes: 9 additions & 0 deletions l2-unity/Assets/Scripts/Game/Item/Enums/TypeType2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public enum ItemType2 : byte
{
TYPE2_WEAPON = 0,
TYPE2_SHIELD_ARMOR = 1,
TYPE2_ACCESSORY = 2,
TYPE2_QUEST = 3,
TYPE2_MONEY = 4,
TYPE2_OTHER = 5
}
2 changes: 2 additions & 0 deletions l2-unity/Assets/Scripts/Game/Item/Enums/TypeType2.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 46ef90d

Please sign in to comment.