diff --git a/Assets/PerfectWorld/Prefab/UI/Canvas.prefab b/Assets/PerfectWorld/Prefab/UI/Canvas.prefab index 11c3ef8959..fe0d5c4750 100644 --- a/Assets/PerfectWorld/Prefab/UI/Canvas.prefab +++ b/Assets/PerfectWorld/Prefab/UI/Canvas.prefab @@ -115,25 +115,189 @@ PrefabInstance: propertyPath: m_text value: objectReference: {fileID: 0} + - target: {fileID: 1464374634028484465, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_margin.z + value: 0.030044556 + objectReference: {fileID: 0} + - target: {fileID: 1464374634028484465, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontAsset + value: + objectReference: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} + - target: {fileID: 1464374634028484465, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_sharedMaterial + value: + objectReference: {fileID: 2100000, guid: 13f71bf0225d0c0439db9931000d75d0, type: 2} + - target: {fileID: 1464374634028484465, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_VerticalAlignment + value: 4096 + objectReference: {fileID: 0} + - target: {fileID: 2224911469552029187, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2224911469552029187, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2224911469552029187, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2224911469552029187, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2224911469552029187, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_SizeDelta.x + value: -25.7078 + objectReference: {fileID: 0} + - target: {fileID: 2224911469552029187, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2224911469552029187, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchoredPosition.x + value: -4.397293 + objectReference: {fileID: 0} + - target: {fileID: 2891120192736919771, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_SizeDelta.x + value: 262.3562 + objectReference: {fileID: 0} + - target: {fileID: 2891120192736919771, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_SizeDelta.y + value: 25.9796 + objectReference: {fileID: 0} + - target: {fileID: 2891120192736919771, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchoredPosition.x + value: 74.25657 + objectReference: {fileID: 0} + - target: {fileID: 2891120192736919771, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchoredPosition.y + value: 28.228401 + objectReference: {fileID: 0} + - target: {fileID: 3984476637502251390, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSize + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 3984476637502251390, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontAsset + value: + objectReference: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} + - target: {fileID: 3984476637502251390, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeMax + value: 18 + objectReference: {fileID: 0} + - target: {fileID: 3984476637502251390, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeMin + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3984476637502251390, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeBase + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 3984476637502251390, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_sharedMaterial + value: + objectReference: {fileID: 2100000, guid: 31b77628c21b17e45a6577a3d3d5aef0, type: 2} + - target: {fileID: 3992890073798626326, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3992890073798626326, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3992890073798626326, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3992890073798626326, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3992890073798626326, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_SizeDelta.x + value: -18.9426 + objectReference: {fileID: 0} + - target: {fileID: 3992890073798626326, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3992890073798626326, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchoredPosition.x + value: -5.0738983 + objectReference: {fileID: 0} - target: {fileID: 4823752405346273106, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_Name value: HUDPlayer objectReference: {fileID: 0} + - target: {fileID: 5777532589522199890, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchoredPosition.x + value: 2.300003 + objectReference: {fileID: 0} - target: {fileID: 5872129684784782099, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_text value: 0/0 objectReference: {fileID: 0} + - target: {fileID: 5872129684784782099, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSize + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 5872129684784782099, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontAsset + value: + objectReference: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} + - target: {fileID: 5872129684784782099, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeMax + value: 18 + objectReference: {fileID: 0} + - target: {fileID: 5872129684784782099, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeMin + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5872129684784782099, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeBase + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 5872129684784782099, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_sharedMaterial + value: + objectReference: {fileID: 2100000, guid: 31b77628c21b17e45a6577a3d3d5aef0, type: 2} - target: {fileID: 6583662924878292146, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_text - value: 0/0 + value: 150K/150K objectReference: {fileID: 0} + - target: {fileID: 6583662924878292146, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSize + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 6583662924878292146, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontAsset + value: + objectReference: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} + - target: {fileID: 6583662924878292146, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeMax + value: 30 + objectReference: {fileID: 0} + - target: {fileID: 6583662924878292146, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeMin + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6583662924878292146, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeBase + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 6583662924878292146, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_sharedMaterial + value: + objectReference: {fileID: 2100000, guid: 31b77628c21b17e45a6577a3d3d5aef0, type: 2} - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_Pivot.x - value: 0.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_Pivot.y - value: 0.5 + value: 1 objectReference: {fileID: 0} - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_AnchorMax.x @@ -159,6 +323,18 @@ PrefabInstance: propertyPath: m_SizeDelta.y value: 133 objectReference: {fileID: 0} + - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_LocalScale.x + value: 1.3 + objectReference: {fileID: 0} + - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_LocalScale.y + value: 1.3 + objectReference: {fileID: 0} + - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_LocalScale.z + value: 1.3 + objectReference: {fileID: 0} - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -189,11 +365,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_AnchoredPosition.x - value: 230.5 + value: 25 objectReference: {fileID: 0} - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_AnchoredPosition.y - value: -66.5 + value: -9 objectReference: {fileID: 0} - target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -207,10 +383,68 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 8086917028654197348, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_Type + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 8086917028654197348, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_FillMethod + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8575537839465846660, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8575537839465846660, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8575537839465846660, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8575537839465846660, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8575537839465846660, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_SizeDelta.x + value: -20.6339 + objectReference: {fileID: 0} + - target: {fileID: 8575537839465846660, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8575537839465846660, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_AnchoredPosition.x + value: -2.8752 + objectReference: {fileID: 0} - target: {fileID: 8867137494968155958, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} propertyPath: m_text - value: 10 + value: '105 + +' objectReference: {fileID: 0} + - target: {fileID: 8867137494968155958, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontAsset + value: + objectReference: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} + - target: {fileID: 8867137494968155958, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontStyle + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8867137494968155958, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeMax + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 8867137494968155958, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_fontSizeMin + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8867137494968155958, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + propertyPath: m_sharedMaterial + value: + objectReference: {fileID: 2100000, guid: 31b77628c21b17e45a6577a3d3d5aef0, type: 2} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -219,6 +453,17 @@ PrefabInstance: insertIndex: -1 addedObject: {fileID: 4616316815177720404} m_SourcePrefab: {fileID: 100100000, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} +--- !u!114 &246901321761552071 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5335503683694560306, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + m_PrefabInstance: {fileID: 5289107387155542773} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &835354389023896999 stripped GameObject: m_CorrespondingSourceObject: {fileID: 4823752405346273106, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} @@ -241,6 +486,9 @@ MonoBehaviour: expText: {fileID: 9091953190536401803} nameText: {fileID: 6716045574192280964} levelText: {fileID: 3632374887765724611} + healthImage: {fileID: 4133230328392276113} + manaImage: {fileID: 246901321761552071} + expImage: {fileID: 7351517459147011958} neededExp: 0 --- !u!114 &1313768687643874887 stripped MonoBehaviour: @@ -280,6 +528,17 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &4133230328392276113 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 8086917028654197348, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + m_PrefabInstance: {fileID: 5289107387155542773} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &6716045574192280964 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 1464374634028484465, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} @@ -291,6 +550,17 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &7351517459147011958 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3414706020273276291, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} + m_PrefabInstance: {fileID: 5289107387155542773} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &9091953190536401803 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 3984476637502251390, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3} diff --git a/Assets/PerfectWorld/Prefab/UI/Canvas_Skill.prefab b/Assets/PerfectWorld/Prefab/UI/Canvas_Skill.prefab index 5172617c54..277de8358f 100644 --- a/Assets/PerfectWorld/Prefab/UI/Canvas_Skill.prefab +++ b/Assets/PerfectWorld/Prefab/UI/Canvas_Skill.prefab @@ -443,7 +443,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4284393271722921544, guid: 8586a375545487f43b57c6ffdce6fbfd, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5717981154351234976, guid: 8586a375545487f43b57c6ffdce6fbfd, type: 3} propertyPath: m_Pivot.x @@ -564,7 +564,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4284393271722921544, guid: 8586a375545487f43b57c6ffdce6fbfd, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5717981154351234976, guid: 8586a375545487f43b57c6ffdce6fbfd, type: 3} propertyPath: m_Pivot.x @@ -685,7 +685,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4284393271722921544, guid: 8586a375545487f43b57c6ffdce6fbfd, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5717981154351234976, guid: 8586a375545487f43b57c6ffdce6fbfd, type: 3} propertyPath: m_Pivot.x diff --git a/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab new file mode 100644 index 0000000000..c68a796b79 --- /dev/null +++ b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab @@ -0,0 +1,627 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1448650841350251410 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1931146730219979515} + - component: {fileID: 7931617368933511578} + - component: {fileID: 5031655611580643013} + m_Layer: 5 + m_Name: TitileText (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1931146730219979515 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1448650841350251410} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8578995796031649400} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 84} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7931617368933511578 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1448650841350251410} + m_CullTransparentMesh: 1 +--- !u!114 &5031655611580643013 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1448650841350251410} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: MessageBox + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &3318234767486795022 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7677644201189461152} + - component: {fileID: 5808684862484431307} + - component: {fileID: 6436262686944836630} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7677644201189461152 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3318234767486795022} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7906706137011413807} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -81} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5808684862484431307 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3318234767486795022} + m_CullTransparentMesh: 1 +--- !u!114 &6436262686944836630 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3318234767486795022} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: OK + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4839074738306786208 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7906706137011413807} + - component: {fileID: 8280971203118505009} + - component: {fileID: 8250962023850685786} + - component: {fileID: 7766051278568089760} + m_Layer: 5 + m_Name: ButtonExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7906706137011413807 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4839074738306786208} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 7677644201189461152} + m_Father: {fileID: 8578995796031649400} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8280971203118505009 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4839074738306786208} + m_CullTransparentMesh: 1 +--- !u!114 &8250962023850685786 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4839074738306786208} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7766051278568089760 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4839074738306786208} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 8250962023850685786} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &5199518178703117250 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6428994832978992641} + - component: {fileID: 655909173274991632} + - component: {fileID: 7448521238108099750} + m_Layer: 5 + m_Name: MessageText (TMP) (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6428994832978992641 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5199518178703117250} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8578995796031649400} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 3} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &655909173274991632 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5199518178703117250} + m_CullTransparentMesh: 1 +--- !u!114 &7448521238108099750 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5199518178703117250} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Content + +' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &5492547392745930423 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8578995796031649400} + - component: {fileID: 2243330050876855902} + - component: {fileID: 3372223705930781376} + - component: {fileID: 1069295583529170983} + m_Layer: 5 + m_Name: MessageBox + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8578995796031649400 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5492547392745930423} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 7906706137011413807} + - {fileID: 1931146730219979515} + - {fileID: 6428994832978992641} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 30.6318} + m_SizeDelta: {x: 434.6896, y: 248.9211} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2243330050876855902 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5492547392745930423} + m_CullTransparentMesh: 1 +--- !u!114 &3372223705930781376 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5492547392745930423} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1069295583529170983 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5492547392745930423} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6672523dc3dacfa46b2104f504acdb6e, type: 3} + m_Name: + m_EditorClassIdentifier: + titleText: {fileID: 5031655611580643013} + messageText: {fileID: 7448521238108099750} + okButton: {fileID: 7766051278568089760} diff --git a/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab.meta b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab.meta new file mode 100644 index 0000000000..48a73f22ed --- /dev/null +++ b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 54cccb2c6a758a24183474cd385ccb2c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Prefab/UIManager.prefab b/Assets/PerfectWorld/Prefab/UIManager.prefab index d5bc78b30e..bdd591f7f4 100644 --- a/Assets/PerfectWorld/Prefab/UIManager.prefab +++ b/Assets/PerfectWorld/Prefab/UIManager.prefab @@ -2777,8 +2777,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: -50, y: 357} - m_SizeDelta: {x: 81.9939, y: 49.1664} + m_AnchoredPosition: {x: -49.2245, y: 357.7831} + m_SizeDelta: {x: 90.8501, y: 55.7939} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &5968563249516142148 CanvasRenderer: @@ -2861,19 +2861,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 3650411900463707999} m_OnClick: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 2299336709516784351} - m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine - m_MethodName: SetActive - m_Mode: 6 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 1 - m_CallState: 2 + m_Calls: [] --- !u!1 &6830984368220482060 GameObject: m_ObjectHideFlags: 0 @@ -3020,6 +3008,7 @@ GameObject: m_Component: - component: {fileID: 2780428059708698453} - component: {fileID: 1890210201668811196} + - component: {fileID: 6678802354138057098} m_Layer: 0 m_Name: UIManager m_TagString: Untagged @@ -3063,9 +3052,23 @@ MonoBehaviour: currentTargetNPCID: 0 dialogResouce: {fileID: 11400000, guid: 540bc8e61556ba4479407a2d68e17580, type: 2} canvasDlg: {fileID: 7894129013412138377} - cDlgQuickBar: {fileID: 1319801370889024573} btnSecondClick: {fileID: 1330222957695115484} m_pDlgQuickBar1: {fileID: 8338623026378970694} + m_pDlgSkillAction: {fileID: 0} +--- !u!114 &6678802354138057098 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6950113420985123515} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3c007a40af961624cae5041be0798d18, type: 3} + m_Name: + m_EditorClassIdentifier: + uiSkillButton: {fileID: 1484158212461992110} + skillUI: {fileID: 2299336709516784351} --- !u!1 &7222864739775630687 GameObject: m_ObjectHideFlags: 0 @@ -7045,32 +7048,20 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1617375721872166299, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1617375721872166299, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1617375721872166299, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 468.781 objectReference: {fileID: 0} - target: {fileID: 1617375721872166299, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -31.05 objectReference: {fileID: 0} - - target: {fileID: 1851903413579782982, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - propertyPath: label - value: - objectReference: {fileID: 4660130238732286921} - - target: {fileID: 1851903413579782982, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - propertyPath: levelName - value: - objectReference: {fileID: 4660130238732286921} - - target: {fileID: 1851903413579782982, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - propertyPath: m_subDialog - value: - objectReference: {fileID: 2580090463562447698} - target: {fileID: 2825516843822704547, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -7081,7 +7072,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2825516843822704547, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 155.2475 objectReference: {fileID: 0} - target: {fileID: 2825516843822704547, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x @@ -7093,35 +7084,35 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3959004304404627642, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3959004304404627642, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3959004304404627642, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 167.0151 objectReference: {fileID: 0} - target: {fileID: 3959004304404627642, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -22.62375 objectReference: {fileID: 0} - target: {fileID: 5330897987501731450, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5330897987501731450, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5330897987501731450, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 342.81 objectReference: {fileID: 0} - target: {fileID: 5330897987501731450, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -105.2475 objectReference: {fileID: 0} - target: {fileID: 5364487732470765845, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_IsActive @@ -7129,19 +7120,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5818092462432985527, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5818092462432985527, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5818092462432985527, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 288.8686 objectReference: {fileID: 0} - target: {fileID: 5818092462432985527, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -31.05 objectReference: {fileID: 0} - target: {fileID: 6238266639003596740, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_Name @@ -7153,87 +7144,71 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6375080618180806221, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 6375080618180806221, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 6375080618180806221, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 83.16 objectReference: {fileID: 0} - target: {fileID: 6375080618180806221, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -162.18411 objectReference: {fileID: 0} - - target: {fileID: 7661205641906674001, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - propertyPath: m_pSubRank - value: - objectReference: {fileID: 5821303484157812317} - - target: {fileID: 7661205641906674001, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - propertyPath: m_pSubSkill - value: - objectReference: {fileID: 2580090463562447698} - - target: {fileID: 7661205641906674001, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - propertyPath: m_contentRoot - value: - objectReference: {fileID: 4198350107324523797} - - target: {fileID: 7688900625148083785, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - propertyPath: skillIcon - value: - objectReference: {fileID: 9059833306997052970} - target: {fileID: 8029283128219612690, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8029283128219612690, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8029283128219612690, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 83.16 objectReference: {fileID: 0} - target: {fileID: 8029283128219612690, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -292.4765 objectReference: {fileID: 0} - target: {fileID: 8302858527499935758, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_SizeDelta.y - value: 183.2475 + value: 28 objectReference: {fileID: 0} - target: {fileID: 9102658109286783788, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9102658109286783788, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9102658109286783788, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 83.16 objectReference: {fileID: 0} - target: {fileID: 9102658109286783788, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -48.51895 objectReference: {fileID: 0} - target: {fileID: 9184880796936692226, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9184880796936692226, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9184880796936692226, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 108.9562 objectReference: {fileID: 0} - target: {fileID: 9184880796936692226, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -31.05 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -7245,60 +7220,11 @@ GameObject: m_CorrespondingSourceObject: {fileID: 6238266639003596740, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} m_PrefabInstance: {fileID: 5294584971749082395} m_PrefabAsset: {fileID: 0} ---- !u!114 &2580090463562447698 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7688900625148083785, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - m_PrefabInstance: {fileID: 5294584971749082395} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 05377af3dd0a3a84fbff62d8e0a572f9, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!224 &4198350107324523797 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 8302858527499935758, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - m_PrefabInstance: {fileID: 5294584971749082395} - m_PrefabAsset: {fileID: 0} ---- !u!114 &4660130238732286921 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 708823501721075410, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - m_PrefabInstance: {fileID: 5294584971749082395} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!224 &4742272256638967314 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 627631504828013321, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} m_PrefabInstance: {fileID: 5294584971749082395} m_PrefabAsset: {fileID: 0} ---- !u!114 &5821303484157812317 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1851903413579782982, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - m_PrefabInstance: {fileID: 5294584971749082395} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7f3b136cb144656428e4764d58c18c52, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!114 &9059833306997052970 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 3801278460223427377, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} - m_PrefabInstance: {fileID: 5294584971749082395} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &7325623227323765241 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset index 415919ac8c..81e92ecbf1 100644 --- a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset +++ b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset @@ -27,3 +27,5 @@ MonoBehaviour: prefab: {fileID: 977375840943150650, guid: 51bad2e6d1ec69a4683135ce85288faa, type: 3} - id: Win_Hpmpxp prefab: {fileID: 6032603119232429246, guid: 8350aa55906d08448bb47e10a473ca61, type: 3} + - id: Win_Produce + prefab: {fileID: 5750242998044155948, guid: ecf0d8daf08db6f4a8d94a4bb07847ec, type: 3} diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs index a0c091501c..905b313812 100644 --- a/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/ElementDataManProvider.cs @@ -33,6 +33,8 @@ namespace BrewMonster await UniTask.DelayFrame(1); } var result = await _elementDataMan.load_data(); + //TODO: this is for testing. move it to other place + itemdataman.load_data("",false); if (result == -1) { BMLogger.LogError("ElementDataManProvider: Failed to load element data"); @@ -40,6 +42,9 @@ namespace BrewMonster else { BMLogger.Log("ElementDataManProvider: Successfully loaded element data"); + // Build suite equip tab now that data is loaded + // 数据加载完成后构建套装装备表 + BrewMonster.Network.EC_Game.BuildSuiteEquipTab(); } } catch (Exception ex) diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs index 085a7974ea..45aa4f3edb 100644 --- a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs @@ -1590,6 +1590,10 @@ namespace ModelRenderer.Scripts.GameData recipe_id_data_map[id] = data; recipe_index_id_map[recipe_index_id_map.Count] = id; break; + case ID_SPACE.ID_SPACE_ADDON: + addon_id_data_map[id] = data; + addon_index_id_map[addon_index_id_map.Count] = id; + break; default: break; diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs new file mode 100644 index 0000000000..36685b2f41 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs @@ -0,0 +1,1234 @@ +using BrewMonster.ELEMENT_DATA; +using ModelRenderer.Scripts.GameData; +using BrewMonster; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Linq; +using System; +using BrewMonster.abase; +public static class generate_item_temp +{ + public static int generate_weapon(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls, + GEN_ADDON_MODE normal_addon ,item_tag_t tag,List sa_list = null) + { + DATA_TYPE datatype = DATA_TYPE.DT_INVALID; + data = new byte[0]; + size = 0; + int i=0; + object obj = itemdataman._edm.get_data_ptr(id, idspace,ref datatype); + if(obj == null || datatype != DATA_TYPE.DT_WEAPON_ESSENCE) + { + return -1; + } + WEAPON_ESSENCE ess = (WEAPON_ESSENCE)obj; + + //$$$$$$$$$$$ ���ڼ�����Ʒû�ж��������Բ������� + + if(ess.id_sub_type == 300 || ess.id_sub_type == 293 || ess.id_sub_type == 76 || ess.id_sub_type == 291) + { + return -1; + } + size =(uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(_item_content)) + Marshal.SizeOf(typeof(_weapon_essence))); + + // ����׶�? + uint hole_num = 0; + if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP) + { + float[] drop_probability_socket = { ess.drop_probability_socket0, ess.drop_probability_socket1, ess.drop_probability_socket2 }; + hole_num = (uint)element_data.RandSelect(drop_probability_socket.ToList(), cls, LOWER.LOWER_TREND); //�׶�����Ŀ + } + else //if(normal_addon == element_data::ADDON_LIST_PRODUCE || normal_addon == element_data::ADDON_LIST_SPEC) + { + float[] make_probability_socket = { ess.make_probability_socket0, ess.make_probability_socket1, ess.make_probability_socket2 }; + hole_num = (uint)element_data.RandSelect(make_probability_socket.ToList(), cls, LOWER.LOWER_TREND); //�׶�����Ŀ + } + size += hole_num*sizeof(int); // size ����hole_num������type + + //����tag size + //ASSERT(tag_size >= sizeof(short)); + size += tag.size; + + + // ���addons + uint candidate_num = itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS; + byte[] addon_buf = new byte[candidate_num*Marshal.SizeOf(typeof(itemdataman._addon))]; + float[] probability_addon_num = { ess.probability_addon_num0, ess.probability_addon_num1, ess.probability_addon_num2, ess.probability_addon_num3, ess.probability_addon_num4, ess.probability_addon_num5 }; + //log each probability_addon_num + uint addon_num = (uint)element_data.RandSelect(probability_addon_num.ToList(), cls, LOWER.LOWER_TREND); //���Ա���Ŀ����Ŀ + + uint addon_size = 0; + // if(ess->fixed_props) + // { + // addon_size = generate_equipment_addon_buffer_2(DT_WEAPON_ESSENCE, (int*)&(ess->addons[0]), sizeof(int)+sizeof(float),32, addon_buf,addon_num); + // } + // else + // { + // if(addon_num || normal_addon == element_data::ADDON_LIST_SPEC) + // { + // generate_template_addon(DT_WEAPON_ESSENCE,ess->probability_unique, + // (char*)ess->uniques,(char*)ess->rands,(char*)ess->addons, + // addon_buf,addon_num,addon_size,cls,normal_addon,sa_list); + // } + // else + // { + // if (normal_addon == element_data::ADDON_LIST_SPEC) + // { + // addon_size = generate_spec_addon_buffer(DT_WEAPON_ESSENCE,addon_buf,ELEMENTDATAMAN_MAX_NUM_ADDONS,addon_num,sa_list); + // } + // } + // } + if(ess.fixed_props!=0) + { + // this list store the addon id + // addon_size = generate_equipment_addon_buffer_2(DT_WEAPON_ESSENCE, (int*)&(ess->addons[0]), sizeof(int)+sizeof(float),32, addon_buf,addon_num); + List addon_list = ess.addons.Select(a => (int)a.id_addon).ToList(); + addon_size = itemdataman.generate_equipment_addon_buffer_2(DATA_TYPE.DT_WEAPON_ESSENCE, addon_list, addon_buf,0, addon_num); + } + else + { + if(addon_num > 0 || normal_addon == GEN_ADDON_MODE.ADDON_LIST_SPEC) + { + List unique_list = ess.uniques.Select(a => (int)a.id_unique).ToList(); + List produce_list = ess.rands.Select(a => (int)a.id_rand).ToList(); + List addons_list = ess.addons.Select(a => (int)a.id_addon).ToList(); + itemdataman.generate_template_addon( + DATA_TYPE.DT_WEAPON_ESSENCE,ess.probability_unique, + unique_list,produce_list,addons_list, + addon_buf,ref addon_num,ref addon_size,cls,normal_addon,sa_list); + } + else + { + if (normal_addon == GEN_ADDON_MODE.ADDON_LIST_SPEC) + { + addon_size = itemdataman.generate_spec_addon_buffer(DATA_TYPE.DT_WEAPON_ESSENCE,addon_buf,0,itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS, addon_num,sa_list); + } + } + } + + size += addon_size; + + // allocate the buffer with exact length + // *data = (char *)abase::fastalloc(size); + + data = new byte[size]; + //byte[] buf = data; + int offset = 0; + + // *(unsigned int*)buf = id; buf += sizeof(unsigned int); //��Ʒ��ģ��ID + // *(size_t*)buf = 1; buf += sizeof(size_t); //��Ʒ������ + // *(size_t*)buf = ess->pile_num_max; buf += sizeof(size_t); //��Ʒ�Ķѵ����� + // *(int*)buf = ELEMENTDATAMAN_EQUIP_MASK_WEAPON|(addon_num?0x40000000:0); buf += sizeof(int); //��Ʒ�Ŀ�װ����־���̶�ֵ���� + // *(int*)buf = ess->proc_type; buf += sizeof(int); //��Ʒ�Ĵ�����ʽ + // *(int*)buf = DT_WEAPON_ESSENCE; buf += sizeof(int); //��Ʒ��Ӧ�����ID + WriteUInt(data, ref offset, id); + WriteUInt(data, ref offset, 1); + WriteInt(data, ref offset, ess.pile_num_max); + WriteInt(data, ref offset,(int)(itemdataman.ELEMENTDATAMAN_EQUIP_MASK_WEAPON|(addon_num>0?0x40000000:0))); + WriteUInt(data, ref offset, ess.proc_type); + WriteInt(data, ref offset, (int)DATA_TYPE.DT_WEAPON_ESSENCE); + // if(ess->has_guid == 1){ + // int g1,g2; + // get_item_guid(id,g1,g2); + // *(int*)buf = g1; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid + // *(int*)buf = g2; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid + // } + // else{ + // *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid + // *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid + // } + // *(int*)buf = ess->price; buf += sizeof(int); //��Ʒ�ļ۸� + // *(int*)buf = 0; buf += sizeof(int); //����ʱ�� + if(ess.has_guid == 1) + { + int g1,g2; + itemdataman.get_item_guid(id,out g1,out g2); + WriteInt(data, ref offset, g1); + WriteInt(data, ref offset, g2); + } + else + { + WriteInt(data, ref offset, 0); + WriteInt(data, ref offset, 0); + } + WriteInt(data, ref offset, ess.price); + WriteInt(data, ref offset, 0); + + // size_t* content_length = (size_t*)buf; buf += sizeof(size_t); //��סbuf��ָ�룬�Ժ����� + // char ** item_content = (char **)buf; buf += sizeof(char *); //��סbuf��ָ�룬�Ժ����� + // *item_content = buf; + // *content_length = (char *)(*data)+size-buf; + + // Then content_length store the length of the content. + // The item_content store the position of the start point of the content. + // Skip content_length and item_content pointer. So the remain is the content. + // After that we can calculate the content_length and item_content pointer. + int content_length = 0; + int content_length_ptr = offset; + WriteInt(data, ref offset, 0); + int item_content = offset; + WriteInt(data, ref offset, 0); + content_length = (int)(size - offset); + WriteInt(data, ref content_length_ptr, content_length); + WriteInt(data, ref item_content, offset); + + // prerequisition + // char * require_ptr = buf; + // *(short*)buf = ess->require_level; buf += sizeof(short); //prerequisition level + // *(short*)buf = ess->character_combo_id&0xFFFF; buf += sizeof(short); //prerequisition race + // *(short*)buf = ess->require_strength; buf += sizeof(short); //prerequisition strength + // *(short*)buf = ess->require_tili; buf += sizeof(short); //prerequisition val + // *(short*)buf = ess->require_agility; buf += sizeof(short); //prerequisition agility + // *(short*)buf = ess->require_energy; buf += sizeof(short); //prerequisition energy + int require_ptr = offset; + WriteShort(data, ref offset, (short)ess.require_level); + WriteShort(data, ref offset, (short)(ess.character_combo_id&0xFFFF)); + WriteShort(data, ref offset, (short)ess.require_strength); + WriteShort(data, ref offset, (short)ess.require_tili); + WriteShort(data, ref offset, (short)ess.require_agility); + WriteShort(data, ref offset, (short)ess.require_energy); + + + // int temp2 = element_data::RandNormal(ess->durability_min, ess->durability_max, cls,element_data::LOWER_TREND); + // int temp; + // if(normal_addon != element_data::ADDON_LIST_DROP || ess->proc_type & 0x1000) + // { + // temp = temp2; + // } + // else + // { + // temp = element_data::RandNormal(ess->durability_drop_min, ess->durability_drop_max, cls,element_data::UPPER_TREND); + // if(temp > temp2) temp = temp2; + // } + int temp2 = element_data.RandNormal(ess.durability_min, ess.durability_max, cls, LOWER.LOWER_TREND); + int temp = temp2; + if(normal_addon != GEN_ADDON_MODE.ADDON_LIST_DROP || (ess.proc_type & 0x1000) != 0) + { + temp = temp2; + } + else + { + temp = element_data.RandNormal(ess.durability_drop_min, ess.durability_drop_max, cls, UPPER.UPPER_TREND); + if(temp > temp2) temp = temp2; + } + + // *(int*)buf = temp; buf += sizeof(int); //prerequisition durability + // *(int*)buf = temp2; buf += sizeof(int); //prerequisition max_durability + WriteInt(data, ref offset, temp); // durability + WriteInt(data, ref offset, temp2); // max_durability + + // //���������߱�ǩע���ǩ���ڱ����С�ͱ�������֮�� + // *(short*)buf = sizeof(_weapon_essence); buf += sizeof(short); //װ�������С���ֽڣ�? + // memcpy(buf,tag,tag_size); + // buf += tag_size; + WriteShort(data, ref offset, (short)Marshal.SizeOf(typeof(_weapon_essence))); + + WriteByte(data, ref offset, tag.type); // MadeFrom + WriteByte(data, ref offset, (byte)tag.size); + + //essence //char ����[]; //ÿ�ֲ�ͬװ���ı���ṹ���? + // char * essence_ptr = buf; + int essence_ptr = offset; + // switch(ess->short_range_mode) + // { + // default: + // case 0: *(short*)buf = 1; break; //Զ�� + // case 1: *(short*)buf = 0; break; //���� + // case 2: *(short*)buf = 2; break; //�̿ͽ��� + // } + // buf += sizeof(short); //�������? ��Ӧģ����Ľ���Զ�̱��? + switch(ess.short_range_mode) + { + default: + case 0: + WriteShort(data, ref offset, (short)1); + break; + case 1: + WriteShort(data, ref offset, (short)0); + break; + case 2: + WriteShort(data, ref offset, (short)2); + break; + } + // *(short*)buf = 0; buf += sizeof(short); //���ֵ����ʹ��? + // *(int*)buf = ess->id_major_type; buf += sizeof(int); //�������� ��Ӧģ����Ĵ���? ���絶�� ������ + // *(int*)buf = ess->level; buf += sizeof(int); //�������� ijЩ������Ҫ�������� + // *(int*)buf = ess->require_projectile; buf += sizeof(int); //��Ҫ��ҩ������ + // *(int*)buf = ess->damage_low; buf += sizeof(int); //����������С��ֵ + // *(int*)buf = element_data::RandNormal(ess->damage_high_min, ess->damage_high_max, cls,element_data::LOWER_TREND); buf += sizeof(int); //������������ֵ + // *(int*)buf = ess->magic_daage_low; buf += sizeof(int); //ħ����������? + // *(int*)buf = element_data::RandNormal(ess->magic_damage_high_min, ess->magic_damage_high_max, cls,element_data::LOWER_TREND); buf += sizeof(int); //ħ������ + WriteShort(data, ref offset, (short)0); + WriteUInt(data, ref offset, ess.id_major_type); + WriteInt(data, ref offset, ess.level); + WriteUInt(data, ref offset, ess.require_projectile); + WriteInt(data, ref offset, ess.damage_low); + WriteInt(data, ref offset, element_data.RandNormal(ess.damage_high_min, ess.damage_high_max, cls, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, ess.magic_damage_low); + WriteInt(data, ref offset, element_data.RandNormal(ess.magic_damage_high_min, ess.magic_damage_high_max, cls, LOWER.LOWER_TREND)); + // WEAPON_SUB_TYPE * subtype = (WEAPON_SUB_TYPE * )get_data_ptr(ess->id_sub_type, ID_SPACE_ESSENCE, datatype); + // if(subtype == NULL || datatype != DT_WEAPON_SUB_TYPE) + // { + // // assert(false); + // *(int*)buf = 0; buf += sizeof(int); + // } + // else + // { + // unsigned int index = element_data::RandSelect(&(subtype->probability_fastest), sizeof(float), 5, cls,element_data::MIDDLE_TREND); + // *(int*)buf = (int)(subtype->attack_speed*20.f + 0.1f) + (index - 2); buf += sizeof(int); //ģ���е���0.05����? + // } + WEAPON_SUB_TYPE subtype = new WEAPON_SUB_TYPE(); + object sub_type_temp = itemdataman._edm.get_data_ptr(ess.id_sub_type, ID_SPACE.ID_SPACE_ESSENCE, ref datatype); + if(sub_type_temp == null || datatype != DATA_TYPE.DT_WEAPON_SUB_TYPE) + { + WriteInt(data, ref offset, 0); + } + else + { + subtype = (WEAPON_SUB_TYPE)sub_type_temp; + float[] probability_attack_speed = { subtype.probability_fastest, subtype.probability_fast, subtype.probability_normal, subtype.probability_slow, subtype.probability_slowest }; + int index = element_data.RandSelect(probability_attack_speed.ToList(), cls, MIDDLE.MIDDLE_TREND); + WriteInt(data, ref offset, (int)(subtype.attack_speed*20f + 0.1f) + (index - 2)); + } + + // *(float*)buf = ess->attack_range; buf += sizeof(float); + // *(float*)buf = subtype->attack_short_range; buf += sizeof(float); + // *(short*)buf = hole_num; buf += sizeof(short); //�׶�����Ŀ + // *(short*)buf = 0; buf += sizeof(short); //�׶��������������� + // for(i=0; i>13)*sizeof(int)+sizeof(int); + // } + addon_data addon_data = new addon_data(); + prerequisition prerequisition = new prerequisition(); + // Read prerequisition from data buffer (where it was written) once before the loop + int require_ptr_copy = require_ptr; + ReadPrerequisition(data, ref require_ptr_copy, out prerequisition); + for(i = 0; i < addon_num; i++) + { + ReadInt(addon_buf, ref addon_sld, out addon_data.id); + ReadAddonData(addon_buf, ref addon_sld, out addon_data); + itemdataman.addon_update_ess_data(addon_data, essence_ptr, Marshal.SizeOf(typeof(_weapon_essence)), prerequisition); + addon_sld += ((addon_data.id & 0x6000)>>13)*sizeof(int)+sizeof(int); + } + + // memcpy(buf, addon_buf, addon_size); + // set_to_classid(DT_WEAPON_ESSENCE, (item_data*)(*data), -1); + itemdataman.update_require_data(ref prerequisition); + // Write updated prerequisition back to data buffer + int require_ptr_write = require_ptr; + WritePrerequisition(data, ref require_ptr_write, prerequisition); + // Copy the entire addon buffer instead of writing a single addon_data + if(addon_size > 0) + { + Array.Copy(addon_buf, 0, data, offset, (int)addon_size); + offset += (int)addon_size; + } + itemdataman.set_to_classid(DATA_TYPE.DT_WEAPON_ESSENCE, data, -1); + return 0; + } + private static void generate_magic_defense(int[] res, List res_list , RAND_CLASS cls, + bool b_fixed = false) // + { + float[] count_prop = {0.35f,0.25f,0.20f,0.15f,0.05f,0.051f}; + float[] md_adjust = {1.0f,1.1f,1.3f,1.6f,2.0f}; + int RE_num = 0; + if(!b_fixed) + { + RE_num = element_data.RandSelect(count_prop.ToList(), cls, LOWER.LOWER_TREND); + } + if(RE_num == 5) return; + // Ensure RE_num is within valid range for md_adjust array (0-4) + if(RE_num < 0 || RE_num >= md_adjust.Length) + { + return; + } + int[] md = {0,1,2,3,4}; + for(int i = 0; i < RE_num; i++) + { + int r = abase.Rand(i,4); + int t = md[i]; + md[i] = md[r]; + md[r] = t; + } + float adj = md_adjust[RE_num]; + for(int i = 0; i < 5 - RE_num; i++) + { + int index = md[i]; + // Check if res_list has enough elements (need at least index*2+2 elements for low and high) + if(res_list == null || res_list.Count < (index * 2 + 2)) + { + // Skip this index if not enough data + continue; + } + int low = res_list[index *2].low; + int high= res_list[index *2+1].high; + res[index] = (int)(element_data.RandNormal(low, high, cls, LOWER.LOWER_TREND) * adj); + } + } + public static int generate_armor(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls, + GEN_ADDON_MODE normal_addon ,item_tag_t tag,List sa_list = null) + { + DATA_TYPE datatype = DATA_TYPE.DT_INVALID; + data = new byte[0]; + size = 0; + int i=0; + object obj = itemdataman._edm.get_data_ptr(id, idspace,ref datatype); + if(obj == null || datatype != DATA_TYPE.DT_ARMOR_ESSENCE) + { + return -1; + } + ARMOR_ESSENCE ess = (ARMOR_ESSENCE)obj; + size =(uint) (Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(_item_content)) + Marshal.SizeOf(typeof(ARMOR_ESSENCE))); + data = new byte[size]; + int offset = 0; + short hole_num = 0; + if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP) + { + float[] drop_probability_socket = { ess.drop_probability_socket0, ess.drop_probability_socket1, ess.drop_probability_socket2 }; + hole_num = (short)element_data.RandSelect(drop_probability_socket.ToList(), cls, LOWER.LOWER_TREND); //�׶�����Ŀ + } + else //if(normal_addon == element_data::ADDON_LIST_PRODUCE || normal_addon == element_data::ADDON_LIST_SPEC) + { + float[] make_probability_socket = { ess.make_probability_socket0, ess.make_probability_socket1, ess.make_probability_socket2 }; + hole_num = (short)element_data.RandSelect(make_probability_socket.ToList(), cls, MIDDLE.MIDDLE_TREND); //�׶�����Ŀ + } + size += (uint)(hole_num*sizeof(int)); // size ����hole_num������type + size += (uint)Marshal.SizeOf(typeof(item_tag_t)); + uint candidate_num = itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS; + byte[] addon_buf = new byte[candidate_num*Marshal.SizeOf(typeof(itemdataman._addon))]; + float[] probability_addon_num = { ess.probability_addon_num0, ess.probability_addon_num1, ess.probability_addon_num2, ess.probability_addon_num3, ess.probability_addon_num4 }; + uint addon_num = (uint)element_data.RandSelect(probability_addon_num.ToList(), cls, LOWER.LOWER_TREND); //���Ա���Ŀ����Ŀ + uint addon_size = 0; + if(ess.fixed_props!=0) + { + List addon_list = ess.addons.Select(a => (int)a.id_addon).ToList(); + addon_size = itemdataman.generate_equipment_addon_buffer_2(DATA_TYPE.DT_ARMOR_ESSENCE, addon_list, addon_buf,0, addon_num); + } + else + { + if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP) + { + List addon_list = ess.addons.Select(a => (int)a.id_addon).ToList(); + addon_size = itemdataman.generate_equipment_addon_buffer(DATA_TYPE.DT_ARMOR_ESSENCE, addon_list, (int)candidate_num, addon_buf,0, addon_num); + } + else if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_PRODUCE) + { + List addon_list = ess.rands.Select(a => (int)a.id_rand).ToList(); + addon_size = itemdataman.generate_equipment_addon_buffer(DATA_TYPE.DT_ARMOR_ESSENCE, addon_list, (int)candidate_num, addon_buf,0, addon_num); + } + else if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_SPEC) + { + addon_size = itemdataman.generate_spec_addon_buffer(DATA_TYPE.DT_ARMOR_ESSENCE,addon_buf,0,itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS, addon_num,sa_list); + } + else + { + addon_size = 0; + addon_num = 0; + } + } + size += addon_size; + data = new byte[size]; + WriteUInt(data, ref offset, id); + WriteUInt(data, ref offset, 1); + WriteInt(data, ref offset, ess.pile_num_max); + object sub_type_temp = itemdataman._edm.get_data_ptr(ess.id_sub_type, ID_SPACE.ID_SPACE_ESSENCE, ref datatype); + if(sub_type_temp == null || datatype != DATA_TYPE.DT_ARMOR_SUB_TYPE) + { + return -1; + } + else + { + ARMOR_SUB_TYPE sub_type = (ARMOR_SUB_TYPE)sub_type_temp; + WriteUInt(data, ref offset, sub_type.equip_mask|((addon_num > 0)?itemdataman.ELEMENTDATAMAN_EQUIP_MASK_HAS_ADDON:0)); + } + WriteUInt(data, ref offset, ess.proc_type); + WriteInt(data, ref offset, (int)DATA_TYPE.DT_ARMOR_ESSENCE); + if(ess.has_guid == 1) + { + int g1,g2; + itemdataman.get_item_guid(id,out g1,out g2); + WriteInt(data, ref offset, g1); + WriteInt(data, ref offset, g2); + } + else + { + WriteInt(data, ref offset, 0); + WriteInt(data, ref offset, 0); + } + WriteInt(data, ref offset, ess.price); + WriteInt(data, ref offset, 0); + + int content_length = 0; + int content_length_ptr = offset; + WriteInt(data, ref offset, 0); + int item_content = offset; + WriteInt(data, ref offset, 0); + content_length = (int)(size - offset); + WriteInt(data, ref content_length_ptr, content_length); + WriteInt(data, ref item_content, offset); + + int require_ptr = offset; + WriteShort(data, ref offset, (short)ess.require_level); + WriteShort(data, ref offset, (short)(ess.character_combo_id&0xFFFF)); + WriteShort(data, ref offset, (short)ess.require_strength); + WriteShort(data, ref offset, (short)ess.require_tili); + WriteShort(data, ref offset, (short)ess.require_agility); + WriteShort(data, ref offset, (short)ess.require_energy); + + int temp2 = element_data.RandNormal(ess.durability_min, ess.durability_max, cls, LOWER.LOWER_TREND); + int temp = temp2; + if(normal_addon != GEN_ADDON_MODE.ADDON_LIST_DROP || (ess.proc_type & 0x1000) != 0) + { + temp = temp2; + } + else + { + temp = element_data.RandNormal(ess.durability_drop_min, ess.durability_drop_max, cls, UPPER.UPPER_TREND); + if(temp > temp2) temp = temp2; + } + WriteInt(data, ref offset, temp); // durability + WriteInt(data, ref offset, temp2); // max_durability + + WriteShort(data, ref offset, (short)Marshal.SizeOf(typeof(ARMOR_ESSENCE))); + WriteByte(data, ref offset, (byte)tag.type); // MadeFrom + WriteByte(data, ref offset, (byte)tag.size); + int essence_ptr = offset; + WriteInt(data, ref offset, element_data.RandNormal(ess.defence_low, ess.defence_high, cls, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, element_data.RandNormal(ess.armor_enhance_low, ess.armor_enhance_high, cls, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, element_data.RandNormal(ess.mp_enhance_low, ess.mp_enhance_high, cls, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, element_data.RandNormal(ess.hp_enhance_low, ess.hp_enhance_high, cls, LOWER.LOWER_TREND)); + int[] res = {0,0,0,0,0}; + List res_list = ess.magic_defences.ToList(); + generate_magic_defense(res, res_list, cls, ess.force_all_magic_defences != 0 || ess.fixed_props!=0); + WriteInt(data, ref offset, res[0]); + WriteInt(data, ref offset, res[1]); + WriteInt(data, ref offset, res[2]); + WriteInt(data, ref offset, res[3]); + WriteInt(data, ref offset, res[4]); + WriteShort(data, ref offset, hole_num); + WriteShort(data, ref offset, 0); + for(i = 0; i < hole_num; i++) + { + WriteInt(data, ref offset, 0); + } + WriteInt(data, ref offset, (int)addon_num); + int addon_sld = offset; + addon_data addon_data = new addon_data(); + prerequisition prerequisition = new prerequisition(); + // Read prerequisition from data buffer (where it was written) once before the loop + int require_ptr_copy_armor = require_ptr; + ReadPrerequisition(data, ref require_ptr_copy_armor, out prerequisition); + for(i = 0; i < addon_num; i++) + { + ReadInt(addon_buf, ref addon_sld, out addon_data.id); + ReadAddonData(addon_buf, ref addon_sld, out addon_data); + itemdataman.addon_update_ess_data(addon_data, essence_ptr, Marshal.SizeOf(typeof(_weapon_essence)), prerequisition); + addon_sld += ((addon_data.id & 0x6000)>>13)*sizeof(int)+sizeof(int); + } + itemdataman.update_require_data(ref prerequisition); + // Write updated prerequisition back to data buffer + int require_ptr_write_armor = require_ptr; + WritePrerequisition(data, ref require_ptr_write_armor, prerequisition); + if(addon_size > 0) + { + Array.Copy(addon_buf, 0, data, offset, (int)addon_size); + offset += (int)addon_size; + } + itemdataman.set_to_classid(DATA_TYPE.DT_ARMOR_ESSENCE, data, -1); + return 0; + } + public static int generate_tasknormalmatter(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls, + GEN_ADDON_MODE normal_addon ,item_tag_t tag,List sa_list = null) + { + // DATA_TYPE datatype; + DATA_TYPE datatype = DATA_TYPE.DT_INVALID; + data = new byte[0]; + size = 0; + int i=0; + // TASKNORMALMATTER_ESSENCE * ess = (TASKNORMALMATTER_ESSENCE *)get_data_ptr(id, idspace, datatype); + object obj = itemdataman._edm.get_data_ptr(id, idspace,ref datatype); + if(obj == null || datatype != DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE) + { + return -1; + } + TASKNORMALMATTER_ESSENCE ess = (TASKNORMALMATTER_ESSENCE)obj; + size =(uint) (Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(TASKNORMALMATTER_ESSENCE))); + data = new byte[size]; + int offset = 0; + WriteUInt(data, ref offset, ess.id); + WriteUInt(data, ref offset, 1); + WriteInt(data, ref offset, ess.pile_num_max); + WriteInt(data, ref offset, 0); + WriteUInt(data, ref offset, ess.proc_type); + WriteInt(data, ref offset, (int)DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE); + if(ess.has_guid == 1) + { + int g1,g2; + itemdataman.get_item_guid(id,out g1,out g2); + WriteInt(data, ref offset, g1); + WriteInt(data, ref offset, g2); + } + else + { + WriteInt(data, ref offset, 0); + WriteInt(data, ref offset, 0); + } + WriteInt(data, ref offset, ess.price); + WriteInt(data, ref offset, 0); + + int content_length; + int content_length_ptr = offset; + WriteInt(data, ref offset, 0); + int item_content = offset; + WriteInt(data, ref offset, 0); + content_length = (int)(size - offset); + WriteInt(data, ref content_length_ptr, content_length); + WriteInt(data, ref item_content, offset); + + itemdataman.set_to_classid(DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE, data, -1); + return 0; + } + + #region Write Functions + private static void WriteUInt(byte[] buf, ref int offset, uint value) + { + Array.Copy(BitConverter.GetBytes(value), 0, buf, offset, 4); + offset = offset + 4; + } + private static void WriteInt(byte[] buf, ref int offset, int value) + { + Array.Copy(BitConverter.GetBytes(value), 0, buf, offset, 4); + offset = offset + 4; + } + private static void WriteShort(byte[] buf, ref int offset, short value) + { + Array.Copy(BitConverter.GetBytes(value), 0, buf, offset, 2); + offset = offset + 2; + } + private static void WriteFloat(byte[] buf, ref int offset, float value) + { + Array.Copy(BitConverter.GetBytes(value), 0, buf, offset, 4); + offset = offset + 4; + } + private static void WriteTag(byte[] buf, ref int offset, item_tag_t tag) + { + buf[offset] = tag.type; + offset = offset + 1; + buf[offset] = tag.size; + offset = offset + 1; + } + private static void WriteAddonData(byte[] buf, ref int offset, addon_data value) + { + WriteInt(buf, ref offset, value.id); + for(int i = 0; i < 3; i++) + { + WriteInt(buf, ref offset, value.arg[i]); + } + } + private static void WriteByte(byte[] buf, ref int offset, byte value) + { + buf[offset] = value; + offset = offset + 1; + } + #endregion + #region Read Functions + private static void ReadInt(byte[] buf, ref int offset, out int value) + { + value = BitConverter.ToInt32(buf, offset); + offset = offset + 4; + } + private static void ReadAddonData(byte[] buf, ref int offset, out addon_data value) + { + value = new addon_data(); + value.id = BitConverter.ToInt32(buf, offset); + offset = offset + 4; + value.arg = new int[3]; + for(int i = 0; i < 3; i++) + { + value.arg[i] = BitConverter.ToInt32(buf, offset); + offset = offset + 4; + } + } + private static void ReadPrerequisition(byte[] buf, ref int offset, out prerequisition value) + { + value = new prerequisition(); + value.level = BitConverter.ToInt16(buf, offset); + offset = offset + 2; + value.race = BitConverter.ToInt16(buf, offset); + offset = offset + 2; + value.strength = BitConverter.ToInt16(buf, offset); + offset = offset + 2; + value.vitality = BitConverter.ToInt16(buf, offset); + offset = offset + 2; + value.agility = BitConverter.ToInt16(buf, offset); + offset = offset + 2; + value.energy = BitConverter.ToInt16(buf, offset); + offset = offset + 2; + value.durability = BitConverter.ToInt32(buf, offset); + offset = offset + 4; + value.max_durability = BitConverter.ToInt32(buf, offset); + offset = offset + 4; + } + private static void WritePrerequisition(byte[] buf, ref int offset, prerequisition value) + { + WriteShort(buf, ref offset, value.level); + WriteShort(buf, ref offset, value.race); + WriteShort(buf, ref offset, value.strength); + WriteShort(buf, ref offset, value.vitality); + WriteShort(buf, ref offset, value.agility); + WriteShort(buf, ref offset, value.energy); + WriteInt(buf, ref offset, value.durability); + WriteInt(buf, ref offset, value.max_durability); + } + #endregion + + private static void PrintData(byte[] buf, int offset, int size) + { + for(int i = offset; i < offset + size; i++) + { + BMLogger.Log("[thn]PrintData: buf[" + i + "]: " + buf[i]); + } + } + private static void PrintPreData(byte[] buf, int offset, int size) + { + for(int i = offset-1; i >= offset - size; i--) + { + BMLogger.Log("[thn]PrintPreData: buf[" + i + "]: " + buf[i]); + } + } +} + +#region unimplemented + +// template +// int generate_projectile(unsigned int id, ID_SPACE idspace, char ** data, size_t& size, RAND_CLASS cls) +// { +// DATA_TYPE datatype; +// PROJECTILE_ESSENCE * ess = (PROJECTILE_ESSENCE *)get_data_ptr(id, idspace, datatype); +// if(ess == NULL || datatype != DT_PROJECTILE_ESSENCE) return -1; + +// size = sizeof(item_data) + sizeof(_item_content) + sizeof(_projectile_essence); +// // �޿׶� +// // �̶�addons 4�� +// char addon_buf[ELEMENTDATAMAN_MAX_NUM_ADDONS*sizeof(_addon)]; +// unsigned int addon_num = 4; //���Ա���Ŀ����Ŀ�̶� 4 + +// size_t addon_size = generate_equipment_addon_buffer_2(DT_PROJECTILE_ESSENCE, (int*)&(ess->id_addon0),sizeof(int), 4, addon_buf,addon_num); +// size += addon_size; + +// //����tag size +// size += sizeof(short); + +// // allocate the buffer with exact length +// *data = (char *)abase::fastalloc(size); +// char * buf = *data; + +// *(unsigned int*)buf = id; buf += sizeof(unsigned int); //��Ʒ��ģ��ID +// *(size_t*)buf = 1; buf += sizeof(size_t); //��Ʒ������ +// *(size_t*)buf = ess->pile_num_max; buf += sizeof(size_t); //��Ʒ�Ķѵ����� +// *(int*)buf = ELEMENTDATAMAN_EQUIP_MASK_PROJECTILE|(addon_num?0x40000000:0); buf += sizeof(int); //��Ʒ�Ŀ�װ����־ +// *(int*)buf = ess->proc_type; buf += sizeof(int); //��Ʒ�Ĵ�����ʽ +// *(int*)buf = DT_PROJECTILE_ESSENCE; buf += sizeof(int); //��Ʒ��Ӧ�����ID +// if(ess->has_guid == 1){ +// int g1,g2; +// get_item_guid(id,g1,g2); +// *(int*)buf = g1; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = g2; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// else{ +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// *(int*)buf = ess->price; buf += sizeof(int); //��Ʒ�ļ۸� +// *(int*)buf = 0; buf += sizeof(int); //����ʱ�� +// size_t* content_length = (size_t*)buf; buf += sizeof(size_t); //��סbuf��ָ�룬�Ժ����� +// char ** item_content = (char **)buf; buf += sizeof(char *); //��סbuf��ָ�룬�Ժ����� +// *content_length = (char*)(*data)+size-buf; +// *item_content = buf; + +// // prerequisition +// char * require_ptr = buf; +// //����int����6�� +// *(short*)buf = 0; buf += sizeof(short); //prerequisition level +// *(short*)buf = (short)0xFFFF; buf += sizeof(short); +// *(short*)buf = 0; buf += sizeof(short); //prerequisition strength +// *(short*)buf = 0; buf += sizeof(short); +// *(short*)buf = 0; buf += sizeof(short); //prerequisition agility +// *(short*)buf = 0; buf += sizeof(short); + +// *(int*)buf = 1; buf += sizeof(int); //prerequisition durability +// *(int*)buf = 1; buf += sizeof(int); //prerequisition max_durability +// *(short*)buf = sizeof(_projectile_essence); buf += sizeof(short); //װ�������С���ֽڣ� +// *(char*)buf = element_data::IMT_NULL;buf += sizeof(char); +// *(char*)buf = 0; buf += sizeof(char); + +// // projectile_essence ���� +// char * essence_ptr = buf; +// *(int*)buf = ess->type; buf += sizeof(int); //��ҩ���� +// *(int*)buf = ess->damage_enhance; buf += sizeof(int); //���������Ĺ����� +// *(int*)buf = ess->damage_scale_enhance; buf += sizeof(int); //���ձ������ӹ����� +// *(int*)buf = ess->require_weapon_level_min; buf += sizeof(int); //��Ҫ�����ȼ� +// *(int*)buf = ess->require_weapon_level_max; buf += sizeof(int); //��Ҫ�����ȼ� + +// // �׶� +// *(short*)buf = 0; buf += sizeof(short); +// *(short*)buf = 0; buf += sizeof(short); + + +// // addon +// *(int*)buf = addon_num; buf += sizeof(int); + +// char * addon_sld = addon_buf; +// for(size_t i=0; i>13)*sizeof(int)+sizeof(int); +// } +// update_require_data((prerequisition*)require_ptr); +// memcpy(buf, addon_buf, addon_size); +// set_to_classid(DT_PROJECTILE_ESSENCE, (item_data*)(*data), -1); + +// return 0; +// } +// template +// int generate_quiver(unsigned int id, ID_SPACE idspace, char ** data, size_t& size, RAND_CLASS cls) +// { +// DATA_TYPE datatype; +// QUIVER_ESSENCE * ess = (QUIVER_ESSENCE *)get_data_ptr(id, ID_SPACE_ESSENCE, datatype); +// if(ess == NULL || datatype != DT_QUIVER_ESSENCE) return -1; +// datatype = DT_PROJECTILE_ESSENCE; +// //���ﲻ����dup��ʽ +// // if(generate_projectile(ess->id_projectile, ID_SPACE_ESSENCE, (char **)data, size, cls) == 0) +// int ret = duplicate_static_item(id, data,size); +// if(ret == 0) +// { +// ASSERT(ess->num_max < (int)((item_data*)(*data))->pile_limit); +// ((item_data*)(*data))->count = element_data::RandNormal(ess->num_min,ess->num_max,cls,element_data::LOWER_TREND); +// return 0; +// } +// else +// return -1; +// /* { +// ASSERT(ess->num_max < (int)((item_data*)(*data))->pile_limit); +// ((item_data*)(*data))->count = element_data::RandNormal(ess->num_min,ess->num_max,cls); +// return 0; +// } +// else +// return -1; +// */ +// } + + +// template +// int generate_quiver_for_sell(unsigned int id, ID_SPACE idspace, char ** data, size_t& size, RAND_CLASS cls) +// { +// DATA_TYPE datatype; +// QUIVER_ESSENCE * ess = (QUIVER_ESSENCE *)get_data_ptr(id, ID_SPACE_ESSENCE, datatype); +// if(ess == NULL || datatype != DT_QUIVER_ESSENCE) return -1; +// datatype = DT_PROJECTILE_ESSENCE; +// //�����޷���dup����Ϊ���� +// if(generate_projectile(ess->id_projectile, ID_SPACE_ESSENCE, (char **)data, size, cls) == 0) +// { +// ASSERT(ess->num_max < (int)((item_data*)(*data))->pile_limit); +// ((item_data*)(*data))->count = element_data::RandNormal(ess->num_min,ess->num_max,cls,element_data::LOWER_TREND); +// return 0; +// } +// else +// return -1; +// } + +// template +// int generate_decoration(unsigned int id, ID_SPACE idspace, char ** data, size_t& size, RAND_CLASS cls,element_data::GEN_ADDON_MODE normal_addon,const void * tag,size_t tag_size, int * sa_list = NULL) +// { +// DATA_TYPE datatype; +// size_t i=0; +// DECORATION_ESSENCE * ess = (DECORATION_ESSENCE *)get_data_ptr(id, idspace, datatype); +// if(ess == NULL || datatype != DT_DECORATION_ESSENCE) return -1; + +// size = sizeof(item_data) + sizeof(_item_content) + sizeof(_decoration_essence); +// // �׶� +// unsigned int hole_num = 0; //�׶�����Ŀ + +// // ���addons +// char addon_buf[ELEMENTDATAMAN_MAX_NUM_ADDONS*sizeof(_addon)]; +// unsigned int addon_num = element_data::RandSelect(&(ess->probability_addon_num0),sizeof(float), 5,cls,element_data::LOWER_TREND); //���Ա���Ŀ����Ŀ + +// size_t addon_size = 0; +// if(ess->fixed_props) +// { +// addon_size = generate_equipment_addon_buffer_2(DT_DECORATION_ESSENCE, (int*)&(ess->addons[0]), sizeof(int)+sizeof(float),32, addon_buf,addon_num); +// } +// else +// { +// if(normal_addon == element_data::ADDON_LIST_DROP) +// addon_size = generate_equipment_addon_buffer(DT_DECORATION_ESSENCE, (char*)&(ess->addons[0]), 32, addon_buf,addon_num); +// else if(normal_addon == element_data::ADDON_LIST_PRODUCE) +// addon_size = generate_equipment_addon_buffer(DT_DECORATION_ESSENCE, (char*)&(ess->rands[0]), 32, addon_buf,addon_num); +// else if (normal_addon == element_data::ADDON_LIST_SPEC) +// { +// addon_size = generate_spec_addon_buffer(DT_DECORATION_ESSENCE,addon_buf,ELEMENTDATAMAN_MAX_NUM_ADDONS,addon_num,sa_list); +// } +// else +// { +// addon_size = 0; +// addon_num = 0; +// } +// } +// size += addon_size; + +// //����tag size +// ASSERT(tag_size >= sizeof(short)); +// size += tag_size; + + +// // allocate the buffer with exact length +// *data = (char *)abase::fastalloc(size); +// char * buf = (*data); + + +// *(unsigned int*)buf = id; buf += sizeof(unsigned int); //��Ʒ��ģ��ID +// *(size_t*)buf = 1; buf += sizeof(size_t); //��Ʒ������ +// *(size_t*)buf = ess->pile_num_max; buf += sizeof(size_t); //��Ʒ�Ķѵ����� +// DECORATION_SUB_TYPE* sub_type = (DECORATION_SUB_TYPE*)get_data_ptr(ess->id_sub_type, ID_SPACE_ESSENCE, datatype); +// if(sub_type == NULL || datatype != DT_DECORATION_SUB_TYPE) // error +// return -1; +// *(int*)buf = sub_type->equip_mask|(addon_num?ELEMENTDATAMAN_EQUIP_MASK_HAS_ADDON:0); buf += sizeof(int); //��Ʒ�Ŀ�װ����־ +// *(int*)buf = ess->proc_type; buf += sizeof(int); //��Ʒ�Ĵ�����ʽ +// *(int*)buf = DT_DECORATION_ESSENCE; buf += sizeof(int); //��Ʒ��Ӧ�����ID +// if(ess->has_guid == 1){ +// int g1,g2; +// get_item_guid(id,g1,g2); +// *(int*)buf = g1; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = g2; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// else{ +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// *(int*)buf = ess->price; buf += sizeof(int); //��Ʒ�ļ۸� +// *(int*)buf = 0; buf += sizeof(int); //����ʱ�� +// size_t* content_length = (size_t*)buf; buf += sizeof(size_t); //��סbuf��ָ�룬�Ժ����� +// char ** item_content = (char **)buf; buf += sizeof(char *); //��סbuf��ָ�룬�Ժ����� +// *content_length = (char*)(*data)+size-buf; +// *item_content = buf; + +// // prerequisition +// char * require_ptr = buf; +// *(short*)buf = ess->require_level; buf += sizeof(short); //prerequisition level +// *(short*)buf = ess->character_combo_id&0xFFFF; buf += sizeof(short); //prerequisition race +// *(short*)buf = ess->require_strength; buf += sizeof(short); //prerequisition strength +// *(short*)buf = ess->require_tili; buf += sizeof(short); //prerequisition val +// *(short*)buf = ess->require_agility; buf += sizeof(short); //prerequisition agility +// *(short*)buf = ess->require_energy; buf += sizeof(short); //prerequisition energy + +// int temp2 = element_data::RandNormal(ess->durability_min, ess->durability_max, cls,element_data::LOWER_TREND); +// int temp; +// if(normal_addon != element_data::ADDON_LIST_DROP || ess->proc_type & 0x1000) +// { +// temp = temp2; +// } +// else +// { +// temp = element_data::RandNormal(ess->durability_drop_min, ess->durability_drop_max, cls,element_data::UPPER_TREND); +// if(temp > temp2) temp = temp2; +// } +// *(int*)buf = temp; buf += sizeof(int); //prerequisition durability +// *(int*)buf = temp2; buf += sizeof(int); //prerequisition max_durability + +// //���������߱�ǩע���ǩ���ڱ����С�ͱ�������֮�� +// *(short*)buf = sizeof(_decoration_essence); buf += sizeof(short); //װ�������С���ֽڣ� +// memcpy(buf,tag,tag_size); +// buf += tag_size; + + +// // ���� +// char * essence_ptr = buf; +// *(int*)buf = element_data::RandNormal(ess->damage_low, ess->damage_high, cls,element_data::LOWER_TREND); buf += sizeof(int); //int damage; +// *(int*)buf = element_data::RandNormal(ess->magic_damage_low, ess->magic_damage_high, cls,element_data::LOWER_TREND); buf += sizeof(int); //int magic_damage; +// *(int*)buf = element_data::RandNormal(ess->defence_low, ess->defence_high, cls,element_data::LOWER_TREND); buf += sizeof(int); //int defense; +// *(int*)buf = element_data::RandNormal(ess->armor_enhance_low, ess->armor_enhance_high, cls,element_data::LOWER_TREND); buf += sizeof(int); //int armor; + +// //���� +// int res[5] = {0,0,0,0,0}; +// generate_magic_defense(res,(int*)(ess->magic_defences),cls,ess->fixed_props!=0); + +// *(int*)buf = res[0]; buf += sizeof(int); +// *(int*)buf = res[1]; buf += sizeof(int); +// *(int*)buf = res[2]; buf += sizeof(int); +// *(int*)buf = res[3]; buf += sizeof(int); +// *(int*)buf = res[4]; buf += sizeof(int); + +// // �׶� +// *(short*)buf = hole_num; buf += sizeof(short); //�׶�����Ŀ +// *(short*)buf = 0; buf += sizeof(short); //�׶��������������� + +// // addon +// *(int*)buf = addon_num; buf += sizeof(int); +// char * addon_sld = addon_buf; +// for(i=0; i>13)*sizeof(int)+sizeof(int); +// } +// update_require_data((prerequisition*)require_ptr); +// memcpy(buf, addon_buf, addon_size); +// set_to_classid(DT_DECORATION_ESSENCE, (item_data*)(*data), -1); + +// return 0; +// } + +// template +// int generate_stone(unsigned int id, ID_SPACE idspace, char ** data, size_t& size, RAND_CLASS cls) +// { +// DATA_TYPE datatype; +// STONE_ESSENCE * ess = (STONE_ESSENCE *)get_data_ptr(id, idspace, datatype); +// if(ess == NULL || datatype != DT_STONE_ESSENCE) return -1; + + +// char addon_buf[ELEMENTDATAMAN_MAX_NUM_ADDONS*sizeof(_addon)]; +// int *pBuf = (int*)addon_buf; +// *pBuf = 1; //only one weapon addon now +// size_t addon_size = generate_addon_buffer(datatype,ess->id_addon_damage, (char*)(pBuf + 1)); +// if(addon_size) +// { +// pBuf = (int*)(((char*)(pBuf+1)) + addon_size); +// } +// else +// { +// ASSERT(false); +// return -1; +// } + +// *pBuf = 1; //only one armor addon now +// addon_size = generate_addon_buffer(datatype,ess->id_addon_defence, (char*)(pBuf + 1)); +// if(addon_size) +// { +// pBuf = (int*)(((char*)(pBuf+1)) + addon_size); +// } +// else +// { +// ASSERT(false); +// return -1; +// } + +// size_t ess_size = ((char*)pBuf) - addon_buf; +// size = sizeof(item_data) + ess_size; + +// // allocate the buffer with exact length +// *data = (char *)abase::fastalloc(size); +// char *buf = *data; +// *(unsigned int*)buf = id; buf += sizeof(unsigned int); //��Ʒ��ģ��ID +// *(size_t*)buf = 1; buf += sizeof(size_t); //��Ʒ������ +// *(size_t*)buf = ess->pile_num_max;buf += sizeof(size_t); //��Ʒ�Ķѵ����� +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ�Ŀ�װ����־ +// *(int*)buf = ess->proc_type; buf += sizeof(int); //��Ʒ�Ĵ�����ʽ +// *(int*)buf = DT_STONE_ESSENCE; buf += sizeof(int); //��Ʒ��Ӧ�����ID +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = ess->price; buf += sizeof(int); //��Ʒ�ļ۸� +// *(int*)buf = 0; buf += sizeof(int); //����ʱ�� +// size_t* content_length = (size_t*)buf; buf += sizeof(size_t); //��סbuf��ָ�룬�Ժ����� +// char ** item_content = (char **)buf; buf += sizeof(char *); //��סbuf��ָ�룬�Ժ����� +// *content_length = size - (buf - (char*)(*data)); +// *item_content = buf; +// memcpy(buf, addon_buf, ess_size); +// set_to_classid(DT_STONE_ESSENCE, (item_data*)(*data), -1); +// return 0; +// } + +// template +// int generate_medicine(unsigned int id, ID_SPACE idspace, char ** data, size_t& size, RAND_CLASS cls) +// { +// DATA_TYPE datatype; +// MEDICINE_ESSENCE * ess = (MEDICINE_ESSENCE *)get_data_ptr(id, idspace, datatype); +// if(ess == NULL || datatype != DT_MEDICINE_ESSENCE) return -1; + +// size = sizeof(item_data); + +// switch(ess->id_major_type) +// { +// case 1794: // ��Ѫ���� +// case 1802: // ��ħ���� +// case 1810: // ��Ѫ��ħ���� +// size += sizeof(size_t) + sizeof(int) + sizeof(int) + sizeof(int); +// break; +// case 1815: // �ⶾҩ +// case 2038: // ˲��ⶾҩ +// size += sizeof(int) + sizeof(int); +// break; +// default: +// return -1; +// } + +// // allocate the buffer with exact length +// *data = (char *)abase::fastalloc(size); +// char * buf = (*data); + +// *(unsigned int*)buf = id; buf += sizeof(unsigned int); //��Ʒ��ģ��ID +// *(size_t*)buf = 1; buf += sizeof(size_t); //��Ʒ������ +// *(size_t*)buf = ess->pile_num_max; buf += sizeof(size_t); //��Ʒ�Ķѵ����� +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ�Ŀ�װ����־ +// *(int*)buf = ess->proc_type; buf += sizeof(int); //��Ʒ�Ĵ�����ʽ +// *(int*)buf = DT_MEDICINE_ESSENCE; buf += sizeof(int); //��Ʒ��Ӧ�����ID +// if(ess->has_guid == 1){ +// int g1,g2; +// get_item_guid(id,g1,g2); +// *(int*)buf = g1; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = g2; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// else{ +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// *(int*)buf = ess->price; buf += sizeof(int); //��Ʒ�ļ۸� +// *(int*)buf = 0; buf += sizeof(int); //����ʱ�� +// size_t* content_length = (size_t*)buf; buf += sizeof(size_t); //��סbuf��ָ�룬�Ժ����� +// char ** item_content = (char **)buf; buf += sizeof(char *); //��סbuf��ָ�룬�Ժ����� +// *content_length = (char*)(*data)+size-buf; +// *item_content = buf; + +// switch(ess->id_major_type) +// { +// case 1794: // ��Ѫ���� +// if(ess->cool_time < 1000) ess->cool_time *= 100; +// *(int*)buf = ess->hp_add_total; buf += sizeof(int); +// *(int*)buf = ess->hp_add_time; buf += sizeof(int); +// *(int*)buf = ess->cool_time; buf += sizeof(int); +// *(int*)buf = ess->require_level; buf += sizeof(int); +// ASSERT(ess->hp_add_time && ess->hp_add_total); +// ASSERT(ess->hp_add_total/ess->hp_add_time); +// break; +// case 1802: // ��ħ���� +// if(ess->cool_time < 1000) ess->cool_time *= 100; +// *(int*)buf = ess->mp_add_total; buf += sizeof(int); +// *(int*)buf = ess->mp_add_time; buf += sizeof(int); +// *(int*)buf = ess->cool_time; buf += sizeof(int); +// *(int*)buf = ess->require_level; buf += sizeof(int); +// ASSERT(ess->mp_add_time && ess->mp_add_total); +// ASSERT(ess->mp_add_total/ess->mp_add_time); +// break; +// case 1810: // ��Ѫ��ħ���� +// if(ess->cool_time < 1000) ess->cool_time *= 100; +// *(int*)buf = ess->mp_add_total; buf += sizeof(int); +// *(int*)buf = ess->hp_add_total; buf += sizeof(int); +// *(int*)buf = ess->cool_time; buf += sizeof(int); +// *(int*)buf = ess->require_level; buf += sizeof(int); +// ASSERT(ess->hp_add_time || ess->mp_add_total); +// break; +// case 1815: // �ⶾҩ +// case 2038: // ˲��ⶾҩ +// if(ess->cool_time < 1000) ess->cool_time *= 100; +// *(int*)buf = ess->cool_time; buf += sizeof(int); +// *(int*)buf = ess->require_level; buf += sizeof(int); +// break; +// default: +// return -1; +// } +// set_to_classid(DT_MEDICINE_ESSENCE, (item_data*)(*data), ess->id_major_type); + +// return 0; +// } + +// template +// int generate_material(unsigned int id, ID_SPACE idspace, char ** data, size_t& size, ESSENCE * p, DATA_TYPE DTYPE) +// { +// DATA_TYPE datatype; +// ESSENCE * ess = (ESSENCE *)get_data_ptr(id, idspace, datatype); +// if(ess == NULL || datatype != DTYPE) return -1; + +// size = sizeof(item_data) ; + +// // allocate the buffer with exact length +// *data = (char *)abase::fastalloc(size); +// char * buf = (*data); + +// *(unsigned int*)buf = id; buf += sizeof(unsigned int); //��Ʒ��ģ��ID +// *(size_t*)buf = 1; buf += sizeof(size_t); //��Ʒ������ +// *(size_t*)buf = ess->pile_num_max; buf += sizeof(size_t); //��Ʒ�Ķѵ����� +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ�Ŀ�װ����־ +// *(int*)buf = ess->proc_type; buf += sizeof(int); //��Ʒ�Ĵ�����ʽ +// *(int*)buf = DTYPE; buf += sizeof(int); //��Ʒ��Ӧ�����ID +// if(ess->has_guid == 1){ +// int g1,g2; +// get_item_guid(id,g1,g2); +// *(int*)buf = g1; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = g2; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// else{ +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// *(int*)buf = ess->price; buf += sizeof(int); //��Ʒ�ļ۸� +// *(int*)buf = 0; buf += sizeof(int); //����ʱ�� +// size_t* content_length = (size_t*)buf; buf += sizeof(size_t); //��סbuf��ָ�룬�Ժ����� +// char ** item_content = (char **)buf; buf += sizeof(char *); //��סbuf��ָ�룬�Ժ����� +// *content_length = (char*)(*data)+size-buf; +// *item_content = buf; + +// set_to_classid(DTYPE, (item_data*)(*data), -1); +// return 0; +// } + +// template +// int generate_skilltome(unsigned int id, ID_SPACE idspace, char ** data, size_t& size, RAND_CLASS cls) +// { +// DATA_TYPE datatype; +// SKILLTOME_ESSENCE * ess = (SKILLTOME_ESSENCE *)get_data_ptr(id, idspace, datatype); +// if(ess == NULL || datatype != DT_SKILLTOME_ESSENCE) return -1; + +// size = sizeof(item_data); + +// // allocate the buffer with exact length +// *data = (char *)abase::fastalloc(size); +// char * buf = (*data); + +// *(unsigned int*)buf = id; buf += sizeof(unsigned int); //��Ʒ��ģ��ID +// *(size_t*)buf = 1; buf += sizeof(size_t); //��Ʒ������ +// *(size_t*)buf = ess->pile_num_max; buf += sizeof(size_t); //��Ʒ�Ķѵ����� +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ�Ŀ�װ����־ +// *(int*)buf = ess->proc_type; buf += sizeof(int); //��Ʒ�Ĵ�����ʽ +// *(int*)buf = DT_SKILLTOME_ESSENCE; buf += sizeof(int); //��Ʒ��Ӧ�����ID +// if(ess->has_guid == 1){ +// int g1,g2; +// get_item_guid(id,g1,g2); +// *(int*)buf = g1; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = g2; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// else{ +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid +// } +// *(int*)buf = ess->price; buf += sizeof(int); //��Ʒ�ļ۸� +// *(int*)buf = 0; buf += sizeof(int); //����ʱ�� +// size_t* content_length = (size_t*)buf; buf += sizeof(size_t); //��סbuf��ָ�룬�Ժ����� +// char ** item_content = (char **)buf; buf += sizeof(char *); //��סbuf��ָ�룬�Ժ����� +// *content_length = (char*)(*data)+size-buf; +// *item_content = buf; + +// set_to_classid(DT_SKILLTOME_ESSENCE, (item_data*)(*data), -1); +// return 0; +// } + +#endregion \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs.meta b/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs.meta new file mode 100644 index 0000000000..872a95ed0c --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ef4cf49bb69644c19a3a3904a40db7db \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs new file mode 100644 index 0000000000..b4085ec4c8 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs @@ -0,0 +1,1041 @@ +using BrewMonster.ELEMENT_DATA; +using BrewMonster.Network; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; +using ModelRenderer.Scripts.GameData; +using System.Runtime.InteropServices; +namespace BrewMonster +{ + + + namespace abase + { + public static class abase + { + const int RAND_MAX = 0x7fff; + public static int Rand(int lower, int upper) + { + if (upper == lower) + return lower; + // Handle invalid range where lower > upper + if (lower > upper) + { + // Swap values to ensure valid range + int temp = lower; + lower = upper; + upper = temp; + } + return new System.Random().Next(lower, upper); + } + + public static float Rand(float lower, float upper) + { + float rng = (float)new System.Random().NextDouble(); + return lower + (upper - lower) * rng / (float)RAND_MAX; + } + + public static int RandNormal(float lower, float upper) { return (int)Rand(lower, upper); } + public static float RandUniform() { return Rand(0f, 1f); } + + public static int RandSelect(List option) + { + int num = option.Count; + float op = RandUniform(); + for (int i = 0; i IndexList; + public int IdxCap; + public int IdxIndex; + public List RandList; + public int RandCap; + public int RandIndex; + //SpecRand() :IndexList(0),IdxCap(0),IdxIndex(0),RandList(0),RandCap(0),RandIndex(0) { } + + public SpecRand() { + IndexList = new List(); + IdxCap = 0; + IdxIndex = 0; + RandList = new List(); + RandCap = 0; + RandIndex = 0; + + } + public int RandSelect(int num) + { + if (IndexList == null || IndexList.Count == 0) return 0; + if (IdxIndex >= IdxCap) return 0; + if (num <= 0) return 0; + int idx = IndexList[IdxIndex++]; + if (idx >= num) idx = num - 1; + return idx; + } + + public int RandNormal(int lower, int upper) + { + if (RandList == null || RandList.Count == 0) return lower; + if (RandIndex >= RandCap) return lower; + float r = RandList[RandIndex++]; + if (r < 0) r = 0f; + if (r >= 1.0f) r = 0.9999999f; + return (int)((upper - lower + 1) * r + lower); + } + + public float Rand(float lower, float upper) + { + if (RandList == null || RandList.Count == 0) return lower; + if (RandIndex >= RandCap) return lower; + float r = RandList[RandIndex++]; + if (r < 0) r = 0f; + if (r >= 1.0f) r = 0.9999999f; + return (float)((upper - lower) * r + lower); + } + } + public class SpecCls + { + SpecRand imp; + public SpecCls(SpecRand tmp) { + imp = tmp; + } + //Could be wrong, need to check + public int RandSelect(List option) + { + int num = option.Count; + if(imp != null) return imp.RandSelect(num); + return 0; + } + + public int RandNormal(int lower, int upper) + { + if (imp != null) return imp.RandNormal(lower, upper); + return lower; + } + + public float Rand(float lower, float upper) + { + if (imp != null) return imp.Rand(lower, upper); + return lower; + } + } + public static class element_data + { + public static int RandNormal(int lower, int upper, TCls c ,TTrend trend) + { + if(c != null && c.Equals(NORMAL.NORMAL_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + else if (trend != null && trend.Equals(UPPER.UPPER_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + else if (trend != null && trend.Equals(ANY.ANY_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + } + else if(c != null && c.Equals(SPECIFIC.SPECIFIC_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return lower; + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return (lower + upper) / 2; + } + else if (trend != null && trend.Equals(UPPER.UPPER_TREND)) + { + return upper; + } + else if (trend != null && trend.Equals(ANY.ANY_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + } + return 0; + } + public static int RandSelect(List option, TCls c, TTrend trend) + { + if(c != null && c.Equals(NORMAL.NORMAL_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return abase.abase.RandSelect(option); + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return abase.abase.RandSelect(option); + } + } + else if(c != null && c.Equals(SPECIFIC.SPECIFIC_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return 0; + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return option.Count /2; + } + } + return 0; + } + public static float Rand(float lower, float upper, TCls c, TTrend trend) + { + if(c != null && c.Equals(NORMAL.NORMAL_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return abase.abase.Rand(lower, upper); + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return abase.abase.Rand(lower, upper); + } + else if (trend != null && trend.Equals(UPPER.UPPER_TREND)) + { + return abase.abase.Rand(lower, upper); + } + else if (trend != null && trend.Equals(ANY.ANY_TREND)) + { + return abase.abase.Rand(lower, upper); + } + } + else if(c != null && c.Equals(SPECIFIC.SPECIFIC_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return lower; + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return (lower + upper) / 2; + } + else if (trend != null && trend.Equals(UPPER.UPPER_TREND)) + { + return upper; + } + else if (trend != null && trend.Equals(ANY.ANY_TREND)) + { + return abase.abase.Rand(lower, upper); + } + } + return 0; + } + } + public enum GEN_ADDON_MODE + { + ADDON_LIST_SHOP, + ADDON_LIST_DROP, + ADDON_LIST_PRODUCE, + ADDON_LIST_SPEC, + }; + public enum ITEM_MAKE_TAG + { + IMT_NULL, + IMT_CREATE, + IMT_DROP, + IMT_SHOP, + IMT_PRODUCE, + IMT_SIGN, //װ����ǩ�� + }; + //#pragma pack(1) + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct item_tag_t + { + public byte type; + public byte size; + public item_tag_t(byte type, byte size) + { + this.type = type; + this.size = size; + } + }; + //#pragma pack() + + };// name space element_data + public struct LOCATION + { + public DATA_TYPE type; + public object pos; + }; + public struct guid_t + { + public int guid1; + public int guid2; + } + public struct item_data + { + public uint type; //��Ʒ��ģ��ID + public int count; //��Ʒ������ + public int pile_limit; //��Ʒ�Ķѵ����� + public int equip_mask; //��Ʒ�Ŀ�װ����־��0x8000��ʾ����Ƕ�� + public int proc_type; //��Ʒ�Ĵ�����ʽ + public int classid; //��Ʒ��Ӧ�����ID + public guid_t guid; //��Ʒ��GUID + public int price; //��Ʒ�ļ۸� + public int expire_date; //����ʱ�� + public int content_length; + public byte[] item_content; + }; + public struct _item_content + { + public prerequisition preq; + public short sizeofessence; //װ�������С���ֽڣ�; + // essence //char ����[]; //ÿ�ֲ�ͬװ���ı���ṹ��ͬ + public int num_hole; //�׶�����Ŀ��������; + // int hole_type[MAX_NUM_HOLES]; //�׶���Ƕ���������[�׶�����Ŀ]; //����׶���ĿΪ0,��������� + public int num_addon; //���Ա���Ŀ����Ŀ��������; + // _addon ad[MAX_NUM_ADDONS]; //[���Ա���Ŀ����Ŀ]; + }; + public struct addon_data + { + public int id; + public int[] arg; + public addon_data(int id =0) { + this.id = id; + arg = new int[3]{0,0,0}; + } + }; + public struct prerequisition + { + public short level; + public short race; + public short strength; + public short vitality; + public short agility; + public short energy; + public int durability; + public int max_durability; + }; + public enum WEAPON_TYPE + { + WEAPON_TYPE_MELEE = 0, + WEAPON_TYPE_RANGE = 1, + WEAPON_TYPE_MELEE_ASN = 2, //�̿�ʹ�õĽ���������������Ӱ���﹥�⣬�����������ͬ + }; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct _weapon_essence + { + + public short weapon_type; //������� ��Ӧģ����Ľ���Զ�̱�־ + public short weapon_delay; //�����Ĺ����ӳ�ʱ�䣬��50msΪ��λ + public int weapon_class; //�������� ��Ӧģ����Ĵ��� ���絶�� ������ + public int weapon_level; //�������� ijЩ������Ҫ�������� + public int require_projectile; //��Ҫ��ҩ������ + public int damage_low; //����������С��ֵ + public int damage_high; //������������ֵ + public int magic_damage_low; //ħ������ + public int magic_damage_high; //ħ������ + public int attack_speed; + public float attack_range; + public float attack_short_range; + }; + public static class itemdataman + { + #region const + public const uint ELEMENTDATAMAN_MAX_NUM_ADDON_PARAM = 3; + public struct _addon //������Ŀ + { + public int addon_type; + public int[] addon_arg; // 0 ~ 3 ��Ŀ�� ((type & 0x6000)>>13) + public _addon(int addon_type) { + this.addon_type = addon_type; + addon_arg = new int[ELEMENTDATAMAN_MAX_NUM_ADDON_PARAM]; + } + }; + #region Equip Mask + public const uint ELEMENTDATAMAN_MAX_NUM_HOLES = 5; + public const uint ELEMENTDATAMAN_MAX_NUM_ADDONS = 32; + public const uint ELEMENTDATAMAN_EQUIP_MASK_WEAPON = 0x0001; + public const uint ELEMENTDATAMAN_EQUIP_MASK_HEAD = 0x0002; + public const uint ELEMENTDATAMAN_EQUIP_MASK_NECK = 0x0004; + public const uint ELEMENTDATAMAN_EQUIP_MASK_SHOULDER = 0x0008; + public const uint ELEMENTDATAMAN_EQUIP_MASK_BODY = 0x0010; + public const uint ELEMENTDATAMAN_EQUIP_MASK_WAIST = 0x0020; + public const uint ELEMENTDATAMAN_EQUIP_MASK_LEG = 0x0040; + public const uint ELEMENTDATAMAN_EQUIP_MASK_FOOT = 0x0080; + public const uint ELEMENTDATAMAN_EQUIP_MASK_WRIST = 0x0100; + public const uint ELEMENTDATAMAN_EQUIP_MASK_FINGER1 = 0x0200; + public const uint ELEMENTDATAMAN_EQUIP_MASK_FINGER2 = 0x0400; + public const uint ELEMENTDATAMAN_EQUIP_MASK_PROJECTILE = 0x0800; + public const uint ELEMENTDATAMAN_EQUIP_MASK_FLYSWORD = 0x1000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_DAMAGERUNE = 0x20000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_BIBLE = 0x40000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_SPEAKER = 0x80000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_AUTO_HP = 0x100000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_AUTO_MP = 0x200000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_ELF = 0x800000; //lgc + public const uint ELEMENTDATAMAN_EQUIP_MASK_STALLCARD = 0x1000000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_FORCE_TICKET = 0x4000000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_DYNSKILL_ALL = 0x18000000; public const uint ELEMENTDATAMAN_EQUIP_MASK_HAS_ADDON = 0x40000000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_EXTEND64 = 0x80000000; + public const uint ELEMENTDATAMAN_EQUIP_MASK_HIGH = 0xC0000000; + #endregion + #endregion + public static Dictionary sale_item_id_index_map = new Dictionary(); + public static elementdataman _edm; + + public static List sale_item_ptr_array = new List(); + public static List sale_item_size_array = new List(); + public static int load_data(string pathname, bool disable_bind2) + { + _edm = ElementDataManProvider.GetElementDataMan(); + + generate_item_for_sell(disable_bind2); + return 0; + // if(await _edm.load_data(pathname) == 0) + // { + // generate_item_for_sell(disable_bind2); + // return 0; + // } + // else + // return -1; + } + + public static int generate_item_for_sell(bool disable_bind2) + { + + //#define CASE_CLEAR_PROC_TYPE(ESSENCE) case DT_##ESSENCE: \ + // {\ + // DATA_TYPE dt2;\ + // ESSENCE* ess = (ESSENCE*)get_data_ptr(id, ID_SPACE_ESSENCE, dt2); \ + // if (dt2 == datatype && ess && disable_bind2) ess->proc_type &= ~(0x0040);\ + // } + + byte[] item = null; + uint size = 0; + int ret = 0; + DATA_TYPE datatype = DATA_TYPE.DT_INVALID; + item_tag_t tag = new item_tag_t((byte)ITEM_MAKE_TAG.IMT_SHOP, (byte)0); + //uint id = _edm.get_first_data_id(ID_SPACE.ID_SPACE_ESSENCE,ref datatype); + for (int i = 0; i < _edm.essence_id_data_type_map.Count; i++) + { + ret = 0; + uint id = _edm.get_data_id(ID_SPACE.ID_SPACE_ESSENCE, i, ref datatype); + switch (datatype) + { + case DATA_TYPE.DT_WEAPON_ESSENCE: + ret = generate_item_temp.generate_weapon(id,ID_SPACE.ID_SPACE_ESSENCE, + out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag); + break; + case DATA_TYPE.DT_ARMOR_ESSENCE: + ret = generate_item_temp.generate_armor(id, ID_SPACE.ID_SPACE_ESSENCE, + out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag); + break; + case DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE: + ret = generate_item_temp.generate_tasknormalmatter(id,ID_SPACE.ID_SPACE_ESSENCE, + out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag); + break; + default: + ret = -1; + break; + } + //Debug.Log("[THN]return_item_for_sell: ret:" + ret + " size:" + size + " datatype:" + datatype + " id:" + id); + if (ret == 0 && size != 0) + { + sale_item_ptr_array.Add(item); + sale_item_size_array.Add(size); + LOCATION loc; + loc.type = datatype; + loc.pos = sale_item_ptr_array.Count - 1; + sale_item_id_index_map[id] = loc; + } + #region unimplemented + + + // CASE_CLEAR_PROC_TYPE(PROJECTILE_ESSENCE) + + // ret = generate_projectile(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + + // case DT_QUIVER_ESSENCE: + // ret = generate_quiver_for_sell(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(STONE_ESSENCE) + + // ret = generate_stone(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(DECORATION_ESSENCE) + + // ret = generate_decoration(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0), element_data::ADDON_LIST_SHOP, &tag, sizeof(tag)); + // break; + + // CASE_CLEAR_PROC_TYPE(MEDICINE_ESSENCE) + + // ret = generate_medicine(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(WINGMANWING_ESSENCE) + + // ret = generate_wingmanwing(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0), &tag, sizeof(tag)); + // break; + + // CASE_CLEAR_PROC_TYPE(MATERIAL_ESSENCE) + + // ret = generate_material(id, ID_SPACE_ESSENCE, (char**)&item, size, (MATERIAL_ESSENCE*)0, DT_MATERIAL_ESSENCE); + // break; + + // CASE_CLEAR_PROC_TYPE(DYE_TICKET_ESSENCE) + + // ret = generate_material(id, ID_SPACE_ESSENCE, (char**)&item, size, (DYE_TICKET_ESSENCE*)0, DT_DYE_TICKET_ESSENCE); + // break; + + // CASE_CLEAR_PROC_TYPE(FIREWORKS_ESSENCE) + + // ret = generate_fireworks(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(WAR_TANKCALLIN_ESSENCE) + + // ret = generate_tankcallin(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(SKILLMATTER_ESSENCE) + + // ret = generate_skillmatter(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(DAMAGERUNE_ESSENCE) + + // ret = generate_damagerune(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(ARMORRUNE_ESSENCE) + + // ret = generate_armorrune(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(SKILLTOME_ESSENCE) + + // ret = generate_skilltome(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(FLYSWORD_ESSENCE) + + // ret = generate_flysword(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0), &tag, sizeof(tag)); + // break; + + // CASE_CLEAR_PROC_TYPE(TOWNSCROLL_ESSENCE) + + // ret = generate_townscroll(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(UNIONSCROLL_ESSENCE) + + // ret = generate_unionscroll(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(REVIVESCROLL_ESSENCE) + + // ret = generate_revivescroll(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(ELEMENT_ESSENCE) + + // ret = generate_element(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(TASKMATTER_ESSENCE) + + // ret = generate_taskmatter(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(TOSSMATTER_ESSENCE) + + // ret = generate_tossmatter(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(TASKDICE_ESSENCE) + + // ret = generate_taskdice(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(TASKNORMALMATTER_ESSENCE) + + // ret = generate_tasknormalmatter(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(FASHION_ESSENCE) + + // ret = generate_fashion_item(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0), &tag, sizeof(tag)); + // break; + + // CASE_CLEAR_PROC_TYPE(FACEPILL_ESSENCE) + + // ret = generate_facepill(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(FACETICKET_ESSENCE) + + // ret = generate_faceticket(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(GM_GENERATOR_ESSENCE) + + // ret = generate_gm_generator(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(PET_EGG_ESSENCE) + + // ret = generate_pet_egg(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(PET_FOOD_ESSENCE) + + // ret = generate_pet_food(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(REFINE_TICKET_ESSENCE) + + // ret = generate_refine_ticket(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(BIBLE_ESSENCE) + + // ret = generate_bible(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(SPEAKER_ESSENCE) + + // ret = generate_speaker(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(AUTOHP_ESSENCE) + + // ret = generate_hp_amulet(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(AUTOMP_ESSENCE) + + // ret = generate_mp_amulet(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(DOUBLE_EXP_ESSENCE) + + // ret = generate_double_exp(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(TRANSMITSCROLL_ESSENCE) + + // ret = generate_transmitscroll(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(GOBLIN_ESSENCE) + + // ret = generate_elf(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(GOBLIN_EQUIP_ESSENCE) + + // ret = generate_elf_equip(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(GOBLIN_EXPPILL_ESSENCE) + + // ret = generate_elf_exppill(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(SELL_CERTIFICATE_ESSENCE) + + // ret = generate_stallcard(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(TARGET_ITEM_ESSENCE) + + // ret = generate_skilltrigger2(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(LOOK_INFO_ESSENCE) + + // ret = generate_queryotherproperty(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(INC_SKILL_ABILITY_ESSENCE) + + // ret = generate_incskillability(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(WEDDING_BOOKCARD_ESSENCE) + + // ret = generate_wedding_bookcard(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(WEDDING_INVITECARD_ESSENCE) + + // ret = generate_wedding_invitecard(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(SHARPENER_ESSENCE) + + // ret = generate_sharpener(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(FACTION_MATERIAL_ESSENCE) + + // ret = generate_factionmaterial(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(CONGREGATE_ESSENCE) + + // ret = generate_congregate(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(FORCE_TOKEN_ESSENCE) + + // ret = generate_force_ticket(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(DYNSKILLEQUIP_ESSENCE) + + // ret = generate_dynskillequip(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(MONEY_CONVERTIBLE_ESSENCE) + + // ret = generate_moneyconvertibleitem(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(MONSTER_SPIRIT_ESSENCE) + + // ret = generate_soul(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(POKER_ESSENCE) + + // ret = generate_generalcard(id, ID_SPACE_ESSENCE, (char**)&item, size, element_data::SPECIFIC(0)); + // break; + + // CASE_CLEAR_PROC_TYPE(POKER_DICE_ESSENCE) + + // ret = generate_generalcard_dice(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(SHOP_TOKEN_ESSENCE) + + // ret = generate_shoptoken(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // CASE_CLEAR_PROC_TYPE(UNIVERSAL_TOKEN_ESSENCE) + + // ret = generate_universal_token(id, ID_SPACE_ESSENCE, (char**)&item, size); + // break; + + // case DT_MONSTER_ESSENCE: + // case DT_NPC_ESSENCE: + // default: + // continue; + + // } + #endregion + } + return 0; + } + + + private static item_data deserialize_item_data(byte[] buffer) + { + // Deserialize item_data from byte array + // Layout matches generate_item_temp.cs serialization order + // type (uint), count (uint written as 1), pile_limit (int), equip_mask (int), + // proc_type (uint), classid (int), guid1 (int), guid2 (int), price (int), expire_date (int), + // content_length (int), item_content pointer (int) + int offset = 0; + item_data item = new item_data(); + + item.type = BitConverter.ToUInt32(buffer, offset); offset += 4; + // count is written as uint but struct has int, read as uint then cast + item.count = (int)BitConverter.ToUInt32(buffer, offset); offset += 4; + item.pile_limit = BitConverter.ToInt32(buffer, offset); offset += 4; + item.equip_mask = BitConverter.ToInt32(buffer, offset); offset += 4; + // proc_type is written as uint but struct has int, read as uint then cast + item.proc_type = (int)BitConverter.ToUInt32(buffer, offset); offset += 4; + item.classid = BitConverter.ToInt32(buffer, offset); offset += 4; + item.guid.guid1 = BitConverter.ToInt32(buffer, offset); offset += 4; + item.guid.guid2 = BitConverter.ToInt32(buffer, offset); offset += 4; + item.price = BitConverter.ToInt32(buffer, offset); offset += 4; + item.expire_date = BitConverter.ToInt32(buffer, offset); offset += 4; + item.content_length = BitConverter.ToInt32(buffer, offset); offset += 4; + + // item_content is stored as an offset/pointer in the buffer (points to where content starts) + int item_content_offset = BitConverter.ToInt32(buffer, offset); offset += 4; + // Extract the actual content bytes + if (item.content_length > 0 && item_content_offset > 0 && item_content_offset < buffer.Length) + { + int contentStart = item_content_offset; + int contentEnd = Math.Min(contentStart + item.content_length, buffer.Length); + int actualLength = contentEnd - contentStart; + if (actualLength > 0) + { + item.item_content = new byte[actualLength]; + Array.Copy(buffer, contentStart, item.item_content, 0, actualLength); + } + else + { + item.item_content = new byte[0]; + } + } + else + { + item.item_content = new byte[0]; + } + return item; + } + + public static object get_item_for_sell(uint id) + { + LOCATION itr; + bool result = sale_item_id_index_map.TryGetValue(id, out itr); + if (result) + { + // itr.pos contains the index into sale_item_ptr_array + int index = (int)itr.pos; + if (index >= 0 && index < sale_item_ptr_array.Count) + { + byte[] itemBuffer = sale_item_ptr_array[index]; + if (itemBuffer != null && itemBuffer.Length > 0) + { + item_data item = deserialize_item_data(itemBuffer); + return item; + } + } + } + return null; + } + + public static uint generate_equipment_addon_buffer_2 + (DATA_TYPE essencetype, + List candidate_addon, + byte[] addon_buffer, int start_offset, + uint addon_num) + { + + //���ɶ��addon�����ܻ��в�������ʧ�� + //if(addon_num == 0) + //return 0; + byte[] addon_sld = addon_buffer; + int i,j; + int anum = 0; + int offset = start_offset; + for(i=0; i( + DATA_TYPE dt,float unique_prob, + List unique, List produce, List drop, byte[] addon_buf, + ref uint addon_num,ref uint addon_size, RAN_CLASS cls,GEN_ADDON_MODE normal_addon,List sa_list) + { + if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP) + { + uint un = 0; + //ASSERT(addon_size == 0); + if(element_data.Rand(0f,1f,cls,LOWER.LOWER_TREND) < unique_prob) + { + un = 1; + addon_size = generate_equipment_addon_buffer(dt, unique, 16, addon_buf,0, un); + addon_num -= un; + } + addon_size += generate_equipment_addon_buffer(dt, drop, 32, addon_buf, (int)addon_size, addon_num); + addon_num += un; + } + else if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_PRODUCE) + { + uint un = 0; + //ASSERT(addon_size == 0); + if(element_data.Rand(0f,1f,cls,LOWER.LOWER_TREND) < unique_prob) + { + un = 1; + addon_size = generate_equipment_addon_buffer(dt, unique, 16, addon_buf,0, un); + addon_num -= un; + } + addon_size += generate_equipment_addon_buffer(dt, produce, 32, addon_buf, (int)addon_size, addon_num); + addon_num += un; + } + else if (normal_addon == GEN_ADDON_MODE.ADDON_LIST_SPEC) + { + addon_size = generate_spec_addon_buffer(dt,addon_buf, 0, itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS, addon_num,sa_list); + } + else + { + addon_size = 0; + addon_num = 0; + } + } + + public static uint generate_equipment_addon_buffer + (DATA_TYPE essencetype, + List candidate_addon, + int candidate_num, + byte[] addon_buffer, + int start_offset, + uint addon_num) + { + if(addon_num == 0) return 0; + int[] addon_list = new int[32]; + int i; + uint anum; + //����addon��������� + for(anum = 0,i=0; i addon_list_converted = new List(); + for (int j = 0; j < anum; j++) + { + addon_list_converted.Add(addon_list[j]); + } + return generate_equipment_addon_buffer_2(essencetype, addon_list_converted, addon_buffer, start_offset, addon_num); + } + + public static uint generate_spec_addon_buffer + (DATA_TYPE essencetype, + byte[] addon_buffer, + int start_offset, + uint max_addon_size, + uint addon_num, + List sa_list) + { + addon_num = 0; + if(sa_list.Count == 0) return 0; + int i; + for(i = 0; i < max_addon_size; i ++) + { + if(sa_list[i] <= 0) break; + } + if(i == 0 ) return 0; + addon_num = (uint)i; + return generate_equipment_addon_buffer_2(essencetype,sa_list,addon_buffer,start_offset, addon_num); + } + public static void get_item_guid( uint id, out int g1, out int g2) + { + EC_Game.get_item_guid(id,out g1,out g2); + } + public static int addon_update_ess_data(addon_data data, object essence,int ess_size, prerequisition require) + { + return EC_Game.addon_update_ess_data(data, essence, ess_size, require); + } + public static void update_require_data(ref prerequisition require) + { + EC_Game.update_require_data(ref require); + } + public static void set_to_classid(DATA_TYPE type, byte[] data, int major_type) + { + EC_Game.set_to_classid(type, data, major_type); + } + } + +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs.meta b/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs.meta new file mode 100644 index 0000000000..258444a357 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a9c1175c22dab468e92f37bc79dfbef1 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Common/EC_C2SCmdCache.cs b/Assets/PerfectWorld/Scripts/Common/EC_C2SCmdCache.cs index cf06359f56..74266efb0c 100644 --- a/Assets/PerfectWorld/Scripts/Common/EC_C2SCmdCache.cs +++ b/Assets/PerfectWorld/Scripts/Common/EC_C2SCmdCache.cs @@ -556,7 +556,7 @@ namespace BrewMonster.Common if (pCnt.IsFull()) { pCnt.Reset(); - UnityGameSession.Instance.GameSession.RequestReviveBase(param); + UnityGameSession.Instance.GameSession.c2s_SendCmdReviveVillage(param); } } @@ -568,7 +568,7 @@ namespace BrewMonster.Common if (pCnt.IsFull()) { pCnt.Reset(); - UnityGameSession.Instance.GameSession.RequestReviveItem(param); + UnityGameSession.Instance.GameSession.c2s_SendCmdReviveItem(param); } } diff --git a/Assets/PerfectWorld/Scripts/GameData/EC_RoleType.cs b/Assets/PerfectWorld/Scripts/GameData/EC_RoleType.cs index 6c68d43354..665c65cbe3 100644 --- a/Assets/PerfectWorld/Scripts/GameData/EC_RoleType.cs +++ b/Assets/PerfectWorld/Scripts/GameData/EC_RoleType.cs @@ -204,3 +204,21 @@ public struct ROLEEXTPROP_DEF armor = 0; } }; + +// Profession +public enum PROFESSION +{ + PROF_WARRIOR = 0, // 0:���� + PROF_MAGE, // 1:��ʦ + PROF_MONK, // 2:��ʦ + PROF_HAG, // 3:���� + PROF_ORC, // 4:���� + PROF_GHOST, // 5:�̿� + PROF_ARCHOR, // 6:��â + PROF_ANGEL, // 7:���� + PROF_JIANLING, // 8:���� + PROF_MEILING, // 9:���� + PROF_YEYING, // 10:ҹӰ + PROF_YUEXIAN, // 11:���� + NUM_PROFESSION, +}; \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs index ba788aaf41..aa4482b4b9 100644 --- a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs +++ b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs @@ -30,6 +30,8 @@ namespace BrewMonster [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public ushort[] name; // Name + public string Name => ByteToStringUtils.UshortArrayToUnicodeString(name); + public int num_params; // Number of parameters public int param1; // Parameter 1 public int param2; // Parameter 2 @@ -559,6 +561,8 @@ namespace BrewMonster [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public ushort[] name; // Suite name, max 15 characters + public string Name => ByteToStringUtils.UshortArrayToUnicodeString(name); + public int max_equips; // Maximum equipment in suite [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Assets/PerfectWorld/Scripts/Inventory/EC_IvtrType.cs b/Assets/PerfectWorld/Scripts/Inventory/EC_IvtrType.cs index 344b4926be..27a4b3dcf8 100644 --- a/Assets/PerfectWorld/Scripts/Inventory/EC_IvtrType.cs +++ b/Assets/PerfectWorld/Scripts/Inventory/EC_IvtrType.cs @@ -2,6 +2,10 @@ namespace BrewMonster.Scripts { public class InventoryConst { + // Equipment endurance scale + public const int ENDURANCE_SCALE = 100; + // NUM_MAGICCLASS + public const int NUM_MAGICCLASS = 5; // Index of item in equipment inventory public const int EQUIPIVTR_WEAPON = 0; public const int EQUIPIVTR_HEAD = 1; diff --git a/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.cs b/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.cs index 409d1d3335..c700460d61 100644 --- a/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.cs +++ b/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.cs @@ -8,7 +8,6 @@ using System.Globalization; using System.IO; using UnityEngine; using UnityEngine.AddressableAssets; - namespace BrewMonster.Network { public partial class EC_Game @@ -25,8 +24,12 @@ namespace BrewMonster.Network private static BrewMonster.CECStringTab m_FixedMsgs; // Fixed message table private static BrewMonster.CECStringTab m_ItemDesc; // Item desciption string table private static BrewMonster.CECStringTab m_ItemExtDesc; // Item extend description string table + private static BrewMonster.CECStringTab m_ItemExtProp; // Item extend prop string table + private static BrewMonster.CECStringTab ItemColTab; // Item color string table + private static Dictionary m_SuiteEquipTab; // Item suite string table private static BrewMonster.CECStringTab m_SkillDesc = new CECStringTab(); // Skill description string table private static BrewMonster.CECStringTab m_BuffDesc; // Buff description string table + private static Dictionary m_ItemMsgMap; // TemplateId -> (MessageId, DisplayMode) private static CECConfigs m_pConfigs; private static int m_iCurCursor; // Current cursor @@ -71,7 +74,19 @@ namespace BrewMonster.Network { return m_BuffDesc; } - + public static BrewMonster.CECStringTab GetItemExtProp() + { + return m_ItemExtProp; + } + public static BrewMonster.CECStringTab GetItemColTab() + { + return ItemColTab; + } + public static Dictionary GetSuiteEquipTab() + { + Debug.Log("[EC_Game] GetSuiteEquipTab: " + m_SuiteEquipTab.Count); + return m_SuiteEquipTab; + } public static bool TryGetItemMsg(int templateId, out int messageId, out int displayMode) { messageId = 0; @@ -97,7 +112,6 @@ namespace BrewMonster.Network // Load task templates // if (m_pTaskMan == null) m_pTaskMan = new ATaskTemplMan(); m_pTaskMan = new ATaskTemplMan(); - m_pTaskMan.Init(m_pElementDataMan); m_pConfigs = new CECConfigs(); /*ElementClient.g_GameCfgs*/; if (!m_pTaskMan.InitStorageTask()) @@ -135,7 +149,9 @@ namespace BrewMonster.Network m_ItemExtDesc = new BrewMonster.CECStringTab(); m_SkillDesc = new BrewMonster.CECStringTab(); m_BuffDesc = new BrewMonster.CECStringTab(); - + m_ItemExtProp = new BrewMonster.CECStringTab(); + ItemColTab = new BrewMonster.CECStringTab(); + m_SuiteEquipTab = new Dictionary(); try { // Addressables-only loading (no StreamingAssets/configs file IO). @@ -165,11 +181,22 @@ namespace BrewMonster.Network { Debug.LogWarning("[EC_Game] Failed to load skillstr.txt"); } - + var itemExtPropTa = Addressables.LoadAssetAsync("Assets/Addressable/item_ext_prop.txt").WaitForCompletion(); + if (!m_ItemExtProp.InitFromTextAsset(itemExtPropTa, true)) + { + Debug.LogWarning("[EC_Game] Failed to load item_ext_prop.txt"); + } + var itemColTa = Addressables.LoadAssetAsync("Assets/Addressable/item_col.txt").WaitForCompletion(); + if (!ItemColTab.InitFromTextAsset(itemColTa, true)) + { + Debug.LogWarning("[EC_Game] Failed to load item_col.txt"); + } + // Note: There's no buff_desc.txt file in the configs folder // You may need to create this file or use a different source for buff descriptions // (If you add it to Addressables later, load it here.) - + // BuildSuiteEquipTab() is now called from ElementDataManProvider after data is loaded + // BuildSuiteEquipTab() 现在在 ElementDataManProvider 数据加载完成后调用 // Load item message map (template -> message id) LoadItemMsgMap(); @@ -267,6 +294,30 @@ namespace BrewMonster.Network long unixTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); return (int)unixTime + m_iTimeError; } + + #region Dummy Methods for itemdataman + public static int addon_generate_arg(DATA_TYPE type, addon_data data, int arg_num/*��ʼ�IJ�������*/) + { + return arg_num; + } + public static void get_item_guid(uint id, out int g1, out int g2) + { + g1 = 0; + g2 = 1; + } + public static int addon_update_ess_data(addon_data data, object essence,int ess_size, prerequisition require) + { + return 0; + } + public static void update_require_data(ref prerequisition require) + { + require.durability *= BrewMonster.Scripts.InventoryConst.ENDURANCE_SCALE; + require.max_durability *= BrewMonster.Scripts.InventoryConst.ENDURANCE_SCALE; + } + public static void set_to_classid(DATA_TYPE type, byte[] data, int major_type) + { + } + #endregion //////////////////////////////////////////////////////////////////////////////// // @@ -401,6 +452,86 @@ namespace BrewMonster.Network map = list[0].strMap; return true; } + + /// + /// Build suite equip tab mapping. Must be called after m_pElementDataMan is initialized and data is loaded. + /// 构建套装装备表映射。必须在 m_pElementDataMan 初始化且数据加载完成后调用。 + /// + public static void BuildSuiteEquipTab() + { + if (m_pElementDataMan == null) + { + return; + } + + // Ensure m_SuiteEquipTab is initialized + // 确保 m_SuiteEquipTab 已初始化 + if (m_SuiteEquipTab == null) + { + m_SuiteEquipTab = new Dictionary(); + } + + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + elementdataman _edm = ElementDataManProvider.GetElementDataMan(); + for (int i = 0; i < _edm.essence_id_data_type_map.Count; i++) + { + uint tid = _edm.get_data_id(ID_SPACE.ID_SPACE_ESSENCE, i, ref DataType); + object pData = _edm.get_data_ptr(tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + switch (DataType) + { + case DATA_TYPE.DT_SUITE_ESSENCE: + SUITE_ESSENCE pSuiteEss = (SUITE_ESSENCE)pData; + pSuiteEss.max_equips = 0; + for (int j=0; j<12; j++) + { + if( pSuiteEss.equipments[j].id != 0 ) + { + pSuiteEss.max_equips ++; + int index = (int)pSuiteEss.equipments[j].id; + m_SuiteEquipTab[index] = (int)tid; + } + } + break; + case DATA_TYPE.DT_POKER_SUITE_ESSENCE: + POKER_SUITE_ESSENCE pPokerSuiteEss = (POKER_SUITE_ESSENCE)pData; + for (int j=0; j<6; j++) + { + if( pPokerSuiteEss.list[j] != 0 ) + { + int index = (int)pPokerSuiteEss.list[j]; + m_SuiteEquipTab[index] = (int)tid; + } + } + break; + + case DATA_TYPE.DT_FASHION_SUITE_ESSENCE: + FASHION_SUITE_ESSENCE pFashionSuiteEss = (FASHION_SUITE_ESSENCE)pData; + for (int j=0; j<6; j++) + { + if( pFashionSuiteEss.list[j] != 0 ) + { + int index = (int)pFashionSuiteEss.list[j]; + m_SuiteEquipTab[index] = (int)tid; + } + } + break; + } + } + } + public static int GetItemNameColorIdx(int tid, int iDefIndex = 0) + { + int iIndex = iDefIndex; + string color = ItemColTab.GetWideString(tid); + if (!string.IsNullOrEmpty(color)) + iIndex = color.GetHashCode(); + if (iIndex < 0 || iIndex >= 10) + { + iIndex = 0; + } + return iIndex; + } + + #endregion } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/CECManager.cs b/Assets/PerfectWorld/Scripts/Managers/CECManager.cs index 82cec3e0fc..ef918b4c7f 100644 --- a/Assets/PerfectWorld/Scripts/Managers/CECManager.cs +++ b/Assets/PerfectWorld/Scripts/Managers/CECManager.cs @@ -158,6 +158,9 @@ namespace BrewMonster.Managers + + + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_HostInputFilter.cs b/Assets/PerfectWorld/Scripts/Managers/EC_HostInputFilter.cs index 5294ce8632..e67b805838 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_HostInputFilter.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_HostInputFilter.cs @@ -148,10 +148,29 @@ namespace BrewMonster // Note: This would require GetMouseOnPateTextNPC implementation // For now, we'll proceed with raycast if (Physics.RaycastNonAlloc(ray, hits) > 0) - { - // Check if hit terrain, building, or forest (no CECObject component) - if (!hits[0].collider.gameObject.TryGetComponent(out CECObject clickedObject)) + { + //Becauce of using RaycastNonAlloc, we need to sort hits by distance. + GameObject closestObject = null; + float closestDistance = float.MaxValue; + foreach (var hit in hits) { + if(hit.collider == null) + { + continue; + } + if(hit.distance < closestDistance) + { + closestDistance = hit.distance; + closestObject = hit.collider.gameObject; + } + } + if(closestObject == null) + { + return; + } + // Check if hit terrain, building, or forest (no CECObject component) + if (!closestObject.TryGetComponent(out CECObject clickedObject)) + { //ENABLE LATER - CURRENT WORKING FINE // Hit terrain / building / forest / Hit terrain // if (m_pWorkMan.IsSitting()) diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_Inventory.cs b/Assets/PerfectWorld/Scripts/Managers/EC_Inventory.cs index 71a171410d..46d718d016 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_Inventory.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_Inventory.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Unity.VisualScripting; using UnityEngine; namespace BrewMonster.Scripts.Managers @@ -24,13 +25,13 @@ namespace BrewMonster.Scripts.Managers IVTRTYPE_TRASHBOX2 = 4, // Trash box - material box IVTRTYPE_TRASHBOX3 = 5, // Trash box - fashion box IVTRTYPE_ACCOUNT_BOX = 6, // User account box - IVTRTYPE_GENERALCARD_BOX = 7; // ư + IVTRTYPE_GENERALCARD_BOX = 7; // ���ư��� }; - // ע IVTRTYPE_CLIENT_GENERALCARD_PACK öֵܺ Inventory type ֵظ + // ע�� IVTRTYPE_CLIENT_GENERALCARD_PACK ö��ֵ���ܺ������ Inventory type ֵ�ظ����� public static class IVTRTYPE_PACK_CLIENT_GENERALCAR { - public const int IVTRTYPE_CLIENT_GENERALCARD_PACK = 1024; // ͻ˱ذ ڿͼҪѻÿͨ췢͡Ϊͳһ촰ڵƷӱذ + public const int IVTRTYPE_CLIENT_GENERALCARD_PACK = 1024; // �ͻ��˱��ذ����� ���ڿ���ͼ��Ҫ����ѻ�ÿ���ͨ�����췢�͡�Ϊ��ͳһ�������촰�ڵ���Ʒ�����ӱ��ذ����� }; public EC_Inventory() @@ -168,14 +169,7 @@ namespace BrewMonster.Scripts.Managers { return false; } - - var newItem = new EC_IvtrItem(tid, iExpireDate) - { - Slot = firstEmpty, - State = 0, - Crc = 0, - Content = null - }; + var newItem = EC_IvtrItem.CreateItem(tid, iExpireDate, iAmount); newItem.SetCount(iAmount); m_aItems[firstEmpty] = newItem; @@ -203,15 +197,7 @@ namespace BrewMonster.Scripts.Managers if (pDst == null) { - var clone = new EC_IvtrItem(pSrc.GetTemplateID(), pSrc.GetExpireDate()) - { - Slot = iDest, - Package = pSrc.Package, - State = pSrc.State, - Crc = pSrc.Crc, - Content = pSrc.Content != null ? (byte[])pSrc.Content.Clone() : null - }; - clone.SetCount(iAmount); + var clone = EC_IvtrItem.CreateItem(pSrc.GetTemplateID(), pSrc.GetExpireDate(), iAmount); m_aItems[iDest] = clone; } else diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs index 4107c5d1fb..8b0b0af771 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs @@ -85,7 +85,7 @@ namespace BrewMonster.Scripts.Managers private byte currentSelectedPackage; private int currentSelectedSlot; private EC_IvtrItem currentSelectedItem; - private EC_IvtrEquip currentSelectedEquipment; + private EC_IvtrItem currentSelectedEquipment; private const byte PKG_INVENTORY = 0; private const byte PKG_EQUIPMENT = 1; @@ -281,19 +281,13 @@ namespace BrewMonster.Scripts.Managers /// /// Create EC_IvtrEquip object from InventoryItemData /// - private EC_IvtrEquip CreateEquipmentFromItemData(EC_IvtrItem itemData) + private EC_IvtrItem CreateEquipmentFromItemData(EC_IvtrItem itemData) { if (itemData == null) return null; - var equipment = new EC_IvtrEquip(itemData.m_tid, itemData.m_expire_date); - - // Set basic properties (use default values since InventoryItemData doesn't have these) - equipment.Price = 0; - equipment.Count = itemData.m_iCount; - equipment.PriceScale = 1.0f; - equipment.ScaleType = 0; - + var equipment = EC_IvtrItem.CreateItem(itemData.m_tid, itemData.m_expire_date, itemData.m_iCount); + // Parse item info if available (use Content field) if (itemData.Content != null && itemData.Content.Length > 0) { @@ -856,11 +850,11 @@ namespace BrewMonster.Scripts.Managers string fullDesc = null; if (showEquipmentDetails && currentSelectedEquipment != null) { - fullDesc = currentSelectedEquipment.GetNormalDesc(); + fullDesc = currentSelectedEquipment.GetDesc(EC_IvtrItem.DescType.DESC_NORMAL, EC_Game.GetGameRun().GetHostPlayer().GetEquipment()); } else { - fullDesc = item.GetDesc(); + fullDesc = item.GetDesc(EC_IvtrItem.DescType.DESC_NORMAL, EC_Game.GetGameRun().GetHostPlayer().GetEquipment()); } if (!string.IsNullOrEmpty(fullDesc)) @@ -880,55 +874,7 @@ namespace BrewMonster.Scripts.Managers // C++ code doesn't check IsInitialized() - it just calls GetWideString() directly // 完全按照C++代码获取扩展描述:g_pGame->GetItemExtDesc(m_tid) // C++代码不检查IsInitialized() - 它直接调用GetWideString() - string szExtDesc = null; - try - { - var itemExtDescTab = EC_Game.GetItemExtDesc(); - if (itemExtDescTab != null) - { - // First try to get mapped message ID (like TryGetItemExtDesc does) - // 首先尝试获取映射的消息ID(如TryGetItemExtDesc所做) - if (EC_Game.TryGetItemMsg(item.m_tid, out int messageId, out int displayMode)) - { - szExtDesc = itemExtDescTab.GetWideString(messageId); - } - - // Fallback: direct lookup using tid (exactly like C++: m_ItemExtDesc.GetWideString(tid)) - // 回退:直接使用tid查找(完全像C++:m_ItemExtDesc.GetWideString(tid)) - if (string.IsNullOrEmpty(szExtDesc)) - { - szExtDesc = itemExtDescTab.GetWideString(item.m_tid); - } - } - } - catch (System.Exception ex) - { - // Only log once to avoid spam - // 仅记录一次以避免垃圾日志 - if (!m_HasLoggedExtDescError) - { - Debug.LogWarning($"[InventoryUI] Error getting extended description: {ex.Message}"); - m_HasLoggedExtDescError = true; - } - } - - // Display extended description if found (exactly like C++ checks: if (!szExtDesc || !szExtDesc[0])) - // 如果找到扩展描述则显示(完全像C++检查:if (!szExtDesc || !szExtDesc[0])) - string displayText = !string.IsNullOrEmpty(szExtDesc) - ? szExtDesc.Replace("\\r", "\n") - : ""; - - // Debug logging to diagnose issues - // 调试日志以诊断问题 - if (string.IsNullOrEmpty(displayText)) - { - Debug.Log($"[InventoryUI] Extended description is empty for tid={item.m_tid}. szExtDesc was null/empty."); - } - else - { - Debug.Log($"[InventoryUI] Found extended description for tid={item.m_tid}, length={displayText.Length}"); - } - + // Setup equip and drop buttons SetupEquipButton(package, item); SetupDropButton(package, item); @@ -937,17 +883,7 @@ namespace BrewMonster.Scripts.Managers // 先显示面板 ShowDetailPanel(true); - // Set text directly - if this causes rebuild issues, we'll use coroutine - // 直接设置文本 - 如果这导致重建问题,我们将使用协程 - if (extendedDescText != null) - { - extendedDescText.Set(displayText); - Debug.Log($"[InventoryUI] Set extended description text, extendedDescText is {(extendedDescText == null ? "null" : "not null")}"); - } - else - { - Debug.LogWarning("[InventoryUI] extendedDescText is null! Check Inspector assignment."); - } + } private void SetupEquipButton(byte package, EC_IvtrItem item) diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs.meta deleted file mode 100644 index 71ac740d78..0000000000 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 50210c0839c503b42843db0237a9c3a8 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs.meta deleted file mode 100644 index 8045c9c72f..0000000000 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 423a6efd71f143f08096d684ca414bba -timeCreated: 1757752654 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.meta new file mode 100644 index 0000000000..83b999b8d5 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c5535276db3184cac9313d3cc28bca47 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmor.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmor.cs new file mode 100644 index 0000000000..7342e66121 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmor.cs @@ -0,0 +1,538 @@ +// /* +// * FILE: EC_IvtrWeapon.cpp +// * +// * DESCRIPTION: +// * +// * CREATED BY: Duyuxin, 2004/11/19 +// * +// * HISTORY: +// * +// * Copyright (c) 2004 Archosaur Studio, All Rights Reserved. +// */ + +// #include "EC_Global.h" +// #include "EC_IvtrWeapon.h" +// #include "EC_Game.h" +// #include "EC_FixedMsg.h" +// #include "EC_GameRun.h" +// #include "EC_HostPlayer.h" +// #include "EC_RTDebug.h" +// #include "elementdataman.h" +// #include "EC_Configs.h" +using BrewMonster; +using ModelRenderer.Scripts.GameData; +using System.Collections.Generic; +using BrewMonster.Network; +using BrewMonster.Scripts.Managers; +using BrewMonster.Scripts; +#region C# regions +// #define new A_DEBUG_NEW + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Define and Macro +// // +// /////////////////////////////////////////////////////////////////////////// + + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Reference to External variables and functions +// // +// /////////////////////////////////////////////////////////////////////////// + + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Local Types and Variables and Global variables +// // +// /////////////////////////////////////////////////////////////////////////// + + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Local functions +// // +// /////////////////////////////////////////////////////////////////////////// + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Implement CECIvtrWeapon +// // +// /////////////////////////////////////////////////////////////////////////// +#endregion + +namespace PerfectWorld.Scripts.Managers +{ + + public class EC_IvtrArmor : EC_IvtrEquip + { + //Attributes + //Weapon essence data + protected IVTR_ESSENCE_ARMOR m_Essence; + // data in database + protected ARMOR_MAJOR_TYPE m_pDBMajorType; + protected ARMOR_SUB_TYPE m_pDBSubType; + protected ARMOR_ESSENCE m_pDBEssence; + + public EC_IvtrArmor(int tid, int expire_date) : base(tid, expire_date) + { + m_iCID = (int)InventoryClassId.ICID_ARMOR; + elementdataman pDB = ElementDataManProvider.GetElementDataMan(); + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + m_pDBEssence = (ARMOR_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_pDBMajorType = (ARMOR_MAJOR_TYPE)pDB.get_data_ptr(m_pDBEssence.id_major_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_pDBSubType = (ARMOR_SUB_TYPE)pDB.get_data_ptr(m_pDBEssence.id_sub_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_iPileLimit = m_pDBEssence.pile_num_max; + m_iPrice = m_pDBEssence.price; + m_iShopPrice = m_pDBEssence.shop_price; + m_i64EquipMask = m_pDBSubType.equip_mask; + m_iProcType = (int)m_pDBEssence.proc_type; + + FixProps = m_pDBEssence.fixed_props; + RepairFee = m_pDBEssence.repairfee; + ReputationReq = m_pDBEssence.require_reputation; + } + public EC_IvtrArmor(EC_IvtrArmor other) : base(other) + { + m_pDBEssence = other.m_pDBEssence; + m_pDBMajorType = other.m_pDBMajorType; + m_pDBSubType = other.m_pDBSubType; + m_Essence = other.m_Essence; + } + + // CECIvtrWeapon::~CECIvtrWeapon() + // { + // } + + public override bool SetItemInfo(byte[] pInfoData, int iDataLen) + { + base.SetItemInfo(pInfoData, iDataLen); + if(pInfoData == null || iDataLen == 0) + { + return true; + } + + try + { + CECDataReader dr = new CECDataReader(pInfoData ,iDataLen); + // Skip equip requirements and endurance + dr.Offset(6 * sizeof(short), CECDataReader.SEEK_CUR); + dr.Offset(2 * sizeof(int), CECDataReader.SEEK_CUR); + int iEssenceSize = dr.ReadShort(); + // Skip maker's information + dr.ReadByte(); + int iMakerLen = dr.ReadByte(); + dr.Offset(iMakerLen, CECDataReader.SEEK_CUR); + byte[] iEssenceData = dr.ReadData(iEssenceSize); + m_Essence = new IVTR_ESSENCE_ARMOR(iEssenceData); + // ���븽������˵�� + if(m_pDBEssence.fixed_props != 0 && m_pDBEssence.probability_addon_num0 != 1.0f) + { + // Get database data + elementdataman pDataMan = ElementDataManProvider.GetElementDataMan(); + CECStringTab PropTab = EC_Game.GetItemExtProp(); + int i, iSize = 0; + for(i=0;i<32;i++) + { + if(m_pDBEssence.addons[i].id_addon != 0) + iSize++; + } + if(iSize > 0 && Props.Count == 0) + { + Props.Capacity = iSize; + for(i=0;i<32;i++) + { + if(m_pDBEssence.addons[i].id_addon != 0) + { + Property Prop = new Property(); + Prop.Type = (int)m_pDBEssence.addons[i].id_addon; + Prop.Embed = false; + Prop.Suite = false; + Prop.Engraved = false; + Prop.Local = false; + byte bType = PropTab.GetWideString(Prop.Type) != null ? (byte)0xff : (byte)0xff; + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + object pData = pDataMan.get_data_ptr(m_pDBEssence.addons[i].id_addon, ID_SPACE.ID_SPACE_ADDON, ref DataType); + if (DataType != DATA_TYPE.DT_EQUIPMENT_ADDON) + { + return false; + } + EQUIPMENT_ADDON pAddon = (EQUIPMENT_ADDON)pData; + Prop.NumParam = pAddon.num_params; + for(int j=0; j < Prop.NumParam; j++) + { + if(j==0) + { + Prop.Params[0] = pAddon.param1; + } + else if(j==1) + { + Prop.Params[1] = pAddon.param2; + } + else if(j==2) + { + Prop.Params[2] = pAddon.param3; + } + } + Props.Add(Prop); + } + } + } + } + return true; + } + catch ( System.Exception e) + { + return false; + } + } + // Get item default information from database + public override void DefaultInfo() + { + LevelReq = m_pDBEssence.require_level; + StrengthReq = m_pDBEssence.require_strength; + AgilityReq = m_pDBEssence.require_agility; + ReputationReq = m_pDBEssence.require_reputation; + CurEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE; + MaxEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE; + } + // Get item icon file name + public override string GetIconFile() + { + return m_pDBEssence.FileIcon; + } + // Get item name + public override string GetName() + { + return m_pDBEssence.Name; + } + // Get preview info + public override string GetPreviewInfo() + { + int[] aPEEVals = new int[MAX_PEEINDEX]; + int[] aRefines = new int[MAX_REFINEINDEX]; + for(int i=0; i 0) + { + AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMESOCKET), GetName(), Holes.Count); + } + else + { + AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName()); + } + // Refine level + if (RefineLvl > 0) + AddDescText(-1, true, "{0} +{1}", pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), RefineLvl); + else + m_strDesc += "\\r"; + AddIDDescText(); + AddBindDescText(); + // Is destroying? + AddDestroyingDesc((int)m_pDBEssence.id_drop_after_damaged, m_pDBEssence.num_drop_after_damaged); + AddExpireTimeDesc(); + // Sub class name + AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_CLASSNAME), m_pDBSubType.name.ToString()); + // Weapon level + AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), m_pDBEssence.level); + + // Physical defence + if (m_Essence.defense - aPEEVals[PEEI_PHYDEF] + aRefines[REFINE_PHYDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PHYDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.defense - aPEEVals[PEEI_PHYDEF] + aRefines[REFINE_PHYDEF]); + } + // Dodge + if (m_Essence.armor - aPEEVals[PEEI_DODGE] + aRefines[REFINE_DODGE] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_DODGE)); + AddDescText(white, true, " +{0}", m_Essence.armor - aPEEVals[PEEI_DODGE] + aRefines[REFINE_DODGE]); + } + // HP + if (m_Essence.hp_enhance - aPEEVals[PEEI_HP] + aRefines[REFINE_HP] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDHP)); + AddDescText(white, true, " +{0}", m_Essence.hp_enhance - aPEEVals[PEEI_HP] + aRefines[REFINE_HP]); + } + // MP + if (m_Essence.mp_enhance - aPEEVals[PEEI_MP] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDMP)); + AddDescText(white, true, " +{0}", m_Essence.mp_enhance - aPEEVals[PEEI_MP]); + } + // Gold Resistance + if (m_Essence.resistance[0] - aPEEVals[PEEI_GOLDDEF] + aRefines[REFINE_GOLDDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_GOLDDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[0] - aPEEVals[PEEI_GOLDDEF] + aRefines[REFINE_GOLDDEF]); + } + // Wood Resistance + if (m_Essence.resistance[1] - aPEEVals[PEEI_WOODDEF] + aRefines[REFINE_WOODDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WOODDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[1] - aPEEVals[PEEI_WOODDEF] + aRefines[REFINE_WOODDEF]); + } + // Water Resistance + if (m_Essence.resistance[2] - aPEEVals[PEEI_WATERDEF] + aRefines[REFINE_WATERDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WATERDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[2] - aPEEVals[PEEI_WATERDEF] + aRefines[REFINE_WATERDEF]); + } + // Fire Resistance + if (m_Essence.resistance[3] - aPEEVals[PEEI_FIREDEF] + aRefines[REFINE_FIREDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_FIREDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[3] - aPEEVals[PEEI_FIREDEF] + aRefines[REFINE_FIREDEF]); + } + // Earth Resistance + if (m_Essence.resistance[4] - aPEEVals[PEEI_EARTHDEF] + aRefines[REFINE_EARTHDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_EARTHDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[4] - aPEEVals[PEEI_EARTHDEF] + aRefines[REFINE_EARTHDEF]); + } + // Endurance + int col = white; + if (CurEndurance == 0) + col = red; + else if ((dwPEE & PEE_ENDURANCE) != 0) + col = lblue; + AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENDURANCE)); + AddDescText(col, true, " {0}/{1}", VisualizeEndurance(CurEndurance), VisualizeEndurance(MaxEndurance)); + + // Profession requirement + AddProfReqDesc((uint)ProfReq); + // Level requirment + if (LevelReq != 0) + { + col = pHost.GetMaxLevelSofar() >= LevelReq ? white : red; + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), LevelReq); + } + // Strength requirment + if (StrengthReq != 0) + { + col = pHost.GetExtendProps().bs.strength < StrengthReq ? red : ((dwPEE & PEE_STRENGTHREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_STRENGTHREQ), StrengthReq); + } + // Agility requirment + if (AgilityReq != 0) + { + col = pHost.GetExtendProps().bs.agility < AgilityReq ? red : ((dwPEE & PEE_AGILITYREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_AGILITYREQ), AgilityReq); + } + // Vitality requirment + if (VitalityReq != 0) + { + col = pHost.GetExtendProps().bs.vitality < VitalityReq ? red : ((dwPEE & PEE_VITALITYREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_VITALITYREQ), VitalityReq); + } + // Energy requirment + if (EnergyReq != 0) + { + col = pHost.GetExtendProps().bs.energy < EnergyReq ? red : ((dwPEE & PEE_ENERGYREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENERGYREQ), EnergyReq); + } + // Reputation requirement + AddReputationReqDesc(); + // Add addon properties + if (!string.IsNullOrEmpty(strAddon)) + m_strDesc += strAddon; + // Build tessera description + BuildTesseraDesc(); + if(m_pDBEssence.fixed_props == 0 && m_bIsInNPCPack) + AddDescText((int)DescriptipionMsg.ITEMDESC_COL2_BRIGHTBLUE, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_HASRANDOM_PROP)); + // Price + AddPriceDesc(white, bRepair); + AddSharpenerDesc(); + AddEngravedDesc(); + AddMakerDesc(); + m_strDesc += "\\r"; + AddSuiteDesc(); + AddExtDescText(); + return m_strDesc; + } + // // Does this equipment has random property ? + public bool HasRandomProp() + { + for (int i = 0; i < Props.Count; i++) + { + if (!Props[i].Embed && !Props[i].Engraved && Props[i].Type == 472) + return true; + } + return false; + } + public int GetRefineMaterialNum() + { + return m_pDBEssence.material_need; + } + public override uint GetRefineAddOn() + { + return (uint)m_pDBEssence.levelup_addon; + } + public override string GetDropModel() + { + return m_pDBEssence.FileMatter; + } + public override bool IsRare() + { + return base.IsRare() || m_pDBEssence.level >= 6; + } + public override int GetItemLevel() + { + return m_pDBEssence.level; + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmor.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmor.cs.meta new file mode 100644 index 0000000000..eb86dd22d2 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmor.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 30e9ab67f87a542d59ff94440cb4e78c \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmorrune.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmorrune.cs new file mode 100644 index 0000000000..d6265d5373 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmorrune.cs @@ -0,0 +1,16 @@ + +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrArmorrune : EC_IvtrItem + { + public EC_IvtrArmorrune(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrArmorrune(EC_IvtrArmorrune other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmorrune.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmorrune.cs.meta new file mode 100644 index 0000000000..7c6f4748db --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArmorrune.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a1e7bdbebb3744fd78b3c9906d93f2ab \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArrow.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArrow.cs new file mode 100644 index 0000000000..b539ae2fd2 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArrow.cs @@ -0,0 +1,14 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrArrow : EC_IvtrEquip + { + public EC_IvtrArrow(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrArrow(EC_IvtrArrow other) : base(other) + { + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArrow.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArrow.cs.meta new file mode 100644 index 0000000000..c85739af4b --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrArrow.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d252cb1fcb2e946688fd6836548fd0d4 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoHp.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoHp.cs new file mode 100644 index 0000000000..72f8f163fa --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoHp.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrAutoHp : EC_IvtrItem + { + public EC_IvtrAutoHp(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrAutoHp(EC_IvtrAutoHp other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoHp.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoHp.cs.meta new file mode 100644 index 0000000000..2f58dd1e84 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoHp.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 67deebf01a6fc4678a8eb801cae72d0e \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoMp.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoMp.cs new file mode 100644 index 0000000000..5bb5775c17 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoMp.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrAutoMp : EC_IvtrItem + { + public EC_IvtrAutoMp(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrAutoMp(EC_IvtrAutoMp other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoMp.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoMp.cs.meta new file mode 100644 index 0000000000..af7c51314b --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrAutoMp.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5e4aa169619834c7fa8e2421d81b9f36 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrBible.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrBible.cs new file mode 100644 index 0000000000..3a1e3607c3 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrBible.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrBible : EC_IvtrItem + { + public EC_IvtrBible(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrBible(EC_IvtrBible other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrBible.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrBible.cs.meta new file mode 100644 index 0000000000..332fe117d7 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrBible.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f352a8dce1daf4a078e5f1df0222d854 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCertificate.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCertificate.cs new file mode 100644 index 0000000000..17af84f155 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCertificate.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrCertificate : EC_IvtrItem + { + public EC_IvtrCertificate(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrCertificate(EC_IvtrCertificate other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCertificate.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCertificate.cs.meta new file mode 100644 index 0000000000..443976210f --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCertificate.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 150298d1bd0fb446a8cc9231d5145cad \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCongregate.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCongregate.cs new file mode 100644 index 0000000000..0508913946 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCongregate.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrCongregate : EC_IvtrItem + { + public EC_IvtrCongregate(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrCongregate(EC_IvtrCongregate other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCongregate.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCongregate.cs.meta new file mode 100644 index 0000000000..9251a506a3 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrCongregate.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: bf279660c3b2b4027bc9d97e691c1870 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDamagerune.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDamagerune.cs new file mode 100644 index 0000000000..405849bb17 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDamagerune.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrDamagerune : EC_IvtrItem + { + public EC_IvtrDamagerune(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrDamagerune(EC_IvtrDamagerune other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDamagerune.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDamagerune.cs.meta new file mode 100644 index 0000000000..15e7015b3d --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDamagerune.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d2481f9333ffc4852bb83fb78511f6da \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDecoration.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDecoration.cs new file mode 100644 index 0000000000..bd2bc8d3e5 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDecoration.cs @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Define and Macro +// +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////// +// +// Reference to External variables and functions +// +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////// +// +// Local Types and Variables and Global variables +// +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////// +// +// Local functions +// +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////// +// +// Implement CECIvtrDecoration +// +/////////////////////////////////////////////////////////////////////////// +using BrewMonster; +using ModelRenderer.Scripts.GameData; +using System.Collections.Generic; +using BrewMonster.Network; +using BrewMonster.Scripts.Managers; +using BrewMonster.Scripts; +namespace PerfectWorld.Scripts.Managers +{ + + public class EC_IvtrDecoration : EC_IvtrEquip + { + protected IVTR_ESSENCE_DECORATION m_Essence; + protected DECORATION_MAJOR_TYPE m_pDBMajorType; + protected DECORATION_SUB_TYPE m_pDBSubType; + protected DECORATION_ESSENCE m_pDBEssence; + + public EC_IvtrDecoration(int tid, int expire_date) : base(tid, expire_date) + { + m_iCID = (int)InventoryClassId.ICID_DECORATION; + elementdataman pDB = ElementDataManProvider.GetElementDataMan(); + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + m_pDBEssence = (DECORATION_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_pDBMajorType = (DECORATION_MAJOR_TYPE)pDB.get_data_ptr(m_pDBEssence.id_major_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_pDBSubType = (DECORATION_SUB_TYPE)pDB.get_data_ptr(m_pDBEssence.id_sub_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_iPileLimit = m_pDBEssence.pile_num_max; + m_iPrice = m_pDBEssence.price; + m_iShopPrice = m_pDBEssence.shop_price; + m_i64EquipMask = m_pDBSubType.equip_mask; + m_iProcType = (int)m_pDBEssence.proc_type; + + FixProps = m_pDBEssence.fixed_props; + RepairFee = m_pDBEssence.repairfee; + ReputationReq = m_pDBEssence.require_reputation; + } + + public EC_IvtrDecoration(EC_IvtrDecoration other) : base(other) + { + m_pDBEssence = other.m_pDBEssence; + m_pDBMajorType = other.m_pDBMajorType; + m_pDBSubType = other.m_pDBSubType; + m_Essence = other.m_Essence; + } + + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDecoration.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDecoration.cs.meta new file mode 100644 index 0000000000..3dc57a1d75 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDecoration.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 238a4e2d1554d44b0a9f3f283a9badd7 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDestroyingEssence.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDestroyingEssence.cs new file mode 100644 index 0000000000..6e05875dd8 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDestroyingEssence.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrDestroyingEssence : EC_IvtrItem + { + public EC_IvtrDestroyingEssence(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrDestroyingEssence(EC_IvtrDestroyingEssence other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDestroyingEssence.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDestroyingEssence.cs.meta new file mode 100644 index 0000000000..c0c4fb2b54 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDestroyingEssence.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 584e97711b3bb4f97a18866bd56ce985 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDoubleExp.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDoubleExp.cs new file mode 100644 index 0000000000..52778da300 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDoubleExp.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrDoubleExp : EC_IvtrItem + { + public EC_IvtrDoubleExp(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrDoubleExp(EC_IvtrDoubleExp other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDoubleExp.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDoubleExp.cs.meta new file mode 100644 index 0000000000..75b93a1eb0 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDoubleExp.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 684f0b389343e420dbf9d02a184554b8 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDyeTicket.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDyeTicket.cs new file mode 100644 index 0000000000..11d8162ba5 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDyeTicket.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrDyeTicket : EC_IvtrItem + { + public EC_IvtrDyeTicket(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrDyeTicket(EC_IvtrDyeTicket other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDyeTicket.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDyeTicket.cs.meta new file mode 100644 index 0000000000..c4abf8e13f --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDyeTicket.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2b30a0678c3bb488e8579f6b1cff0847 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDynSkillEquip.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDynSkillEquip.cs new file mode 100644 index 0000000000..4e18b6edc4 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDynSkillEquip.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrDynSkillEquip : EC_IvtrEquip + { + public EC_IvtrDynSkillEquip(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrDynSkillEquip(EC_IvtrDynSkillEquip other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDynSkillEquip.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDynSkillEquip.cs.meta new file mode 100644 index 0000000000..651665273d --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrDynSkillEquip.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a1a5aae82e25b4ce5aeb499cb804f9fa \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrElement.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrElement.cs new file mode 100644 index 0000000000..f667324b31 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrElement.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrElement : EC_IvtrItem + { + public EC_IvtrElement(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrElement(EC_IvtrElement other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrElement.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrElement.cs.meta new file mode 100644 index 0000000000..6afa910abc --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrElement.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 28e3dc4074f0246449da8b794ca2a018 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs similarity index 91% rename from Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs rename to Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs index 95ae58a93d..c2e77eb454 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using UnityEngine; +using UnityEngine.AddressableAssets; using ModelRenderer.Scripts.GameData; using ModelRenderer.Scripts.Common; using BrewMonster; @@ -14,6 +15,8 @@ using System.Reflection; using BrewMonster.Scripts.Managers; using BrewMonster.Scripts; using UnityEngine.AddressableAssets; +using CSNetwork.Protocols; +using Unity.VisualScripting; namespace PerfectWorld.Scripts.Managers { @@ -25,14 +28,83 @@ namespace PerfectWorld.Scripts.Managers { #region Constants and Enums - // Item Class IDs - public const int ICID_EQUIP = 1; - public const int ICID_WEAPON = 2; + public enum EQUIP_CLASS_ID + { + ICID_ITEM = -100, + ICID_EQUIP = -101, + ICID_ARMOR = 0, + ICID_ARMORRUNE, + ICID_ARROW, + ICID_DECORATION, + ICID_DMGRUNE, + ICID_ELEMENT, + ICID_FASHION, + ICID_FLYSWORD, + ICID_MATERIAL, + ICID_MEDICINE, + ICID_REVSCROLL, + ICID_SKILLTOME, + ICID_TOSSMAT, + ICID_TOWNSCROLL, + ICID_UNIONSCROLL, + ICID_WEAPON, + ICID_TASKITEM, + ICID_STONE, + ICID_WING, + ICID_TASKDICE, + ICID_TASKNMMATTER, + ICID_ERRORITEM, + ICID_FACETICKET, + ICID_FACEPILL, + ICID_GM_GENERATOR, + ICID_RECIPE, + ICID_PETEGG, + ICID_PETFOOD, + ICID_PETFACETICKET, + ICID_FIREWORK, + ICID_TANKCALLIN, + ICID_SKILLMATTER, + ICID_REFINETICKET, + ICID_DESTROYINGESSENCE, + ICID_BIBLE, + ICID_SPEAKER, + ICID_AUTOHP, + ICID_AUTOMP, + ICID_DOUBLEEXP, + ICID_TRANSMITSCROLL, + ICID_DYETICKET, + ICID_GOBLIN, + ICID_GOBLIN_EQUIP, + ICID_GOBLIN_EXPPILL, + ICID_CERTIFICATE, + ICID_TARGETITEM, + ICID_LOOKINFOITEM, + ICID_INCSKILLABILITY, + ICID_WEDDINGBOOKCARD, + ICID_WEDDINGINVITECARD, + ICID_SHARPENER, + ICID_FACTIONMATERIAL, + ICID_CONGREGATE, + ICID_FORCETOKEN, + ICID_DYNSKILLEQUIP, + ICID_MONEYCONVERTIBLE, + ICID_MONSTERSPIRIT, + ICID_GENERALCARD, + ICID_GENERALCARD_DICE, + ICID_SHOPTOKEN, + ICID_UNIVERSAL_TOKEN, + } // Item Made From Types - public const byte IMT_NULL = 0; - public const byte IMT_SIGN = 1; - + public enum ITEM_MAKE_TAG + { + IMT_NULL, + IMT_CREATE, // GM ���� + IMT_DROP, // ������� + IMT_SHOP, // �̳ǻ��̵���� + IMT_PRODUCE, // ������ + IMT_SIGN, // װ��ǩ�� + }; // Property Effect Essence Flags public const uint PEE_PHYDAMAGE = 0x00000001; public const uint PEE_MAGICDAMAGE = 0x00000002; @@ -97,11 +169,14 @@ namespace PerfectWorld.Scripts.Managers #endregion - #region Fields + #region Public Fields // Basic Item Properties public int TemplateId { get; set; } public int ExpireDate { get; set; } + /// + /// class id + /// public int CID { get; set; } public int Price { get; set; } public int Count { get; set; } @@ -136,11 +211,9 @@ namespace PerfectWorld.Scripts.Managers // Equipment Arrays public List Holes { get; set; } public List Props { get; set; } - - // Description - protected string m_strDesc = ""; - #endregion + + #region Base Stats (from Element Data) @@ -497,11 +570,11 @@ namespace PerfectWorld.Scripts.Managers #region Constructor - public EC_IvtrEquip(int tid, int expireDate) + public EC_IvtrEquip(int tid, int expireDate) : base(tid, expireDate) { TemplateId = tid; ExpireDate = expireDate; - CID = ICID_EQUIP; + CID = (int)InventoryClassId.ICID_EQUIP; Price = 0; Count = 1; PriceScale = 1.0f; @@ -568,8 +641,9 @@ namespace PerfectWorld.Scripts.Managers /// /// Set item detail information from binary data /// - public bool SetItemInfo(byte[] infoData, int dataLen) + public override bool SetItemInfo(byte[] infoData, int dataLen) { + base.SetItemInfo(infoData, dataLen); if (infoData == null || dataLen == 0) return true; @@ -588,7 +662,6 @@ namespace PerfectWorld.Scripts.Managers return true; } - Debug.LogError("EC_IvtrEquip::SetItemInfo: could not parse detail payload"); return false; } @@ -596,62 +669,50 @@ namespace PerfectWorld.Scripts.Managers { try { - int offset = 0; - - if (len < 6 * 2 + 2 * 4 + 2) return false; - - LevelReq = BitConverter.ToInt16(data, offset); offset += 2; - ProfReq = BitConverter.ToInt16(data, offset); offset += 2; - StrengthReq= BitConverter.ToInt16(data, offset); offset += 2; - VitalityReq= BitConverter.ToInt16(data, offset); offset += 2; - AgilityReq = BitConverter.ToInt16(data, offset); offset += 2; - EnergyReq = BitConverter.ToInt16(data, offset); offset += 2; - - CurEndurance = BitConverter.ToInt32(data, offset); offset += 4; - MaxEndurance = BitConverter.ToInt32(data, offset); offset += 4; - - int essenceSize = BitConverter.ToInt16(data, offset); offset += 2; - - // Maker info (type + length + payload) - if (offset + 2 <= len) + CECDataReader dr = new CECDataReader(data, len); + LevelReq = dr.ReadShort(); + ProfReq = dr.ReadShort(); + StrengthReq= dr.ReadShort(); + VitalityReq= dr.ReadShort(); + AgilityReq = dr.ReadShort(); + EnergyReq = dr.ReadShort(); + CurEndurance = dr.ReadInt(); + MaxEndurance = dr.ReadInt(); + int essenceSize = dr.ReadShort(); + ReadMakerInfo(dr); + dr.Offset(essenceSize, CECDataReader.SEEK_CUR); + if(essenceSize < 0 ) { - ReadMakerInfo(data, ref offset); + throw new Exception("TYPE_DATAERR"); } - if (essenceSize < 0 || offset + essenceSize > len) return false; - offset += essenceSize; // skip essence for now - - if (offset + 2 + 2 > len) return false; - int numHole = BitConverter.ToInt16(data, offset); offset += 2; - StoneMask = BitConverter.ToUInt16(data, offset); offset += 2; - - Holes.Clear(); + int numHole = dr.ReadShort(); + StoneMask = (ushort)dr.ReadShort(); if (numHole > 0) { - if (offset + 4 * numHole > len) return false; + Holes.Clear(); Holes.Capacity = numHole; for (int i = 0; i < numHole; i++) { - Holes.Add(BitConverter.ToInt32(data, offset)); offset += 4; + Holes.Add(dr.ReadInt()); } } - else if (numHole < 0) + else if (numHole == 0) { - return false; + Holes.Clear(); } - - if (offset + 4 > len) return false; - int numProp = BitConverter.ToInt32(data, offset); offset += 4; - - Props.Clear(); + else + { + throw new Exception("TYPE_DATAERR"); + } + int numProp = dr.ReadInt(); if (numProp > 0) { + Props.Clear(); Props.Capacity = numProp; for (int i = 0; i < numProp; i++) { - if (offset + 4 > len) return false; - int type = BitConverter.ToInt32(data, offset); offset += 4; - + int type = dr.ReadInt(); Property prop = new Property(); prop.Type = type & 0x1fff; prop.NumParam = (type & 0x6000) >> 13; @@ -662,15 +723,18 @@ namespace PerfectWorld.Scripts.Managers for (int j = 0; j < prop.NumParam; j++) { - if (offset + 4 > len) return false; - prop.Params[j] = BitConverter.ToInt32(data, offset); offset += 4; + prop.Params[j] = dr.ReadInt(); } Props.Add(prop); } } - else if (numProp < 0) + else if (numProp == 0) { - return false; + Props.Clear(); + } + else + { + throw new Exception("TYPE_DATAERR"); } // Sanity check to catch misalignment @@ -679,7 +743,10 @@ namespace PerfectWorld.Scripts.Managers return true; } - catch { return false; } + catch (System.Exception ex) { + BMLogger.LogError("CECIvtrEquip::SetItemInfo, data read error (" + ex.GetType() + ")" + ex.StackTrace); + return false; + } } private bool TryParseEquipInfoLegacy(byte[] data, int len) @@ -706,7 +773,7 @@ namespace PerfectWorld.Scripts.Managers MaxEndurance = BitConverter.ToInt32(data, offset); offset += 4; int essenceSize = BitConverter.ToInt16(data, offset); offset += 2; - ReadMakerInfo(data, ref offset); + //ReadMakerInfo(data, ref offset); if (essenceSize < 0 || offset + essenceSize > len) return false; offset += essenceSize; @@ -752,33 +819,55 @@ namespace PerfectWorld.Scripts.Managers /// /// Read maker information from binary data /// - private void ReadMakerInfo(byte[] data, ref int offset) + private void ReadMakerInfo(CECDataReader dr) { - MadeFrom = data[offset++]; - int makerLen = data[offset++]; - + // Debug: Log the bytes at current position before reading + // We need to check what bytes are actually at the reader position + MadeFrom = dr.ReadByte(); + int makerLen = dr.ReadByte(); if (makerLen > 0) { - if (MadeFrom == IMT_SIGN) + if (MadeFrom == (byte)ITEM_MAKE_TAG.IMT_SIGN) { - ushort color = BitConverter.ToUInt16(data, offset); offset += 2; - makerLen -= 2; - - string maker = System.Text.Encoding.Unicode.GetString(data, offset, makerLen); - offset += makerLen; + ushort color = (ushort)dr.ReadShort(); + makerLen -= sizeof(ushort); + byte[] makerData = dr.ReadData(makerLen); + // Find null terminator (0x00 0x00 for Unicode) and decode only up to that point + int actualLength = makerLen; + for (int i = 0; i < makerLen - 1; i += 2) + { + if (makerData[i] == 0 && makerData[i + 1] == 0) + { + actualLength = i; + break; + } + } + string maker = System.Text.Encoding.Unicode.GetString(makerData, 0, actualLength).TrimEnd('\0'); if (string.IsNullOrEmpty(maker)) { - Debug.LogWarning($"EC_IvtrEquip::ReadMakerInfo: Invalid maker info with makerLen={makerLen + 2}"); return; } - - SetNewMark(maker, ColorFromWord(color)); + //#define FASHION_WORDCOLOR_TO_A3DCOLOR(c) A3DCOLORRGB(((c) & (0x1f << 10)) >> 7, ((c) & (0x1f << 5)) >> 2, ((c) & 0x1f) << 3) + //A3DCOLOR clr = FASHION_WORDCOLOR_TO_A3DCOLOR(color); + Color clr = ColorFromWord(color); + SetNewMark(maker, clr); } else { - Maker = System.Text.Encoding.Unicode.GetString(data, offset, makerLen); - offset += makerLen; + //m_strMaker = ACString((ACHAR*)dr.Read_Data(iMakerLen), iMakerLen / sizeof (ACHAR)); + byte[] makerData = dr.ReadData(makerLen); + // Find null terminator (0x00 0x00 for Unicode) and decode only up to that point + int actualLength = makerLen; + for (int i = 0; i < makerLen - 1; i += 2) + { + if (makerData[i] == 0 && makerData[i + 1] == 0) + { + actualLength = i; + break; + } + } + Maker = System.Text.Encoding.Unicode.GetString(makerData, 0, actualLength).TrimEnd('\0'); } } else @@ -809,7 +898,7 @@ namespace PerfectWorld.Scripts.Managers // Add equipment mark display string Maker = string.Format(GetItemDescString(DescriptipionMsg.ITEMDESC_EQUIPMARK), Maker); } - MadeFrom = string.IsNullOrEmpty(mark) ? IMT_NULL : IMT_SIGN; + MadeFrom = string.IsNullOrEmpty(mark) ? (byte)ITEM_MAKE_TAG.IMT_NULL : (byte)ITEM_MAKE_TAG.IMT_SIGN; } #endregion @@ -819,7 +908,7 @@ namespace PerfectWorld.Scripts.Managers /// /// Get item name /// - public string GetName() + public virtual string GetName() { return EC_IvtrItemUtils.Instance.ResolveItemName(TemplateId); } @@ -929,7 +1018,7 @@ namespace PerfectWorld.Scripts.Managers /// /// Check if item is rare /// - public bool IsRare() + public virtual bool IsRare() { return RefineLvl >= 3; } @@ -1210,7 +1299,6 @@ namespace PerfectWorld.Scripts.Managers } } - Debug.Log($"[EC_IvtrEquip] Loaded {s_propIdToType.Count} property mappings from Addressables"); } else { @@ -1281,7 +1369,7 @@ namespace PerfectWorld.Scripts.Managers /// /// Decide equipment name color /// - public int DecideNameCol() + protected override int DecideNameCol() { int index = GetColorStrID(TemplateId); if (index >= 0) @@ -1306,10 +1394,16 @@ namespace PerfectWorld.Scripts.Managers /// /// Get color string ID for template /// - private int GetColorStrID(int templateId) + public override int GetColorStrID(int templateId) { // This would normally query the game's color system - return -1; + int iIndex = EC_Game.GetItemNameColorIdx(templateId); + if (iIndex <= 0) + return -1; + else if (iIndex < 7) + return (int)DescriptipionMsg.ITEMDESC_COL_LIGHTBLUE + iIndex - 1; + else + return (int)DescriptipionMsg.ITEMDESC_COL2_START + iIndex - 7 + 1; } #endregion @@ -1320,7 +1414,7 @@ namespace PerfectWorld.Scripts.Managers /// Get normal in-inventory description, mirroring C++ CECIvtrEquip::GetNormalDesc. /// This is a single formatted string using ^color codes and '\\r' as line separators. /// - public string GetNormalDesc() + protected override string GetNormalDesc(bool bRepair) { // Build addon and refine properties and save it (like C++ does first) int[] aPEEVals = new int[MAX_PEEINDEX]; @@ -1386,7 +1480,7 @@ namespace PerfectWorld.Scripts.Managers // 5) Add-on properties (non-embedded, non-suite, non-engraved) if (!string.IsNullOrEmpty(strAddon)) m_strDesc += strAddon; - + AddPriceDesc(white, false); // 6) Tessera / stones (socketed gems) BuildTesseraDesc(); @@ -1402,10 +1496,10 @@ namespace PerfectWorld.Scripts.Managers // 10) Maker & destroying info if any AddMakerDesc(); // Destroying description is added by caller when needed; keep it optional here. - + m_strDesc += "\\r"; + AddExtDescText(); + Debug.Log("m_strDesc add ext desc text: " + m_strDesc); // 11) Price (sell price scaled) - AddPriceDesc(white, false); - return m_strDesc; } @@ -2016,7 +2110,7 @@ namespace PerfectWorld.Scripts.Managers { return 0; } - + /// /// Check the special refine property /// @@ -2104,7 +2198,6 @@ namespace PerfectWorld.Scripts.Managers RefineLvl = 0; PropNum = 0; EmbedNum = 0; - if (Props.Count == 0) return; @@ -2155,6 +2248,11 @@ namespace PerfectWorld.Scripts.Managers public int GetSuiteID() { // This would normally query the game's suite equip table + Dictionary suiteEquipTab = EC_Game.GetSuiteEquipTab(); + if (suiteEquipTab.TryGetValue(GetTemplateID(), out int suiteId)) + { + return suiteId; + } return 0; } @@ -2246,7 +2344,7 @@ namespace PerfectWorld.Scripts.Managers /// /// Add description text /// - private void AddDescText(int color, bool newLine, string format, params object[] args) + protected override void AddDescText(int color, bool newLine, string format, params object[] args) { if (color >= 0) { @@ -2605,40 +2703,40 @@ namespace PerfectWorld.Scripts.Managers if (!IsSharpenerProperty(propType)) { switch (propType) - { + { case 0: // ������ - if(!local) - { - if (aPEEVals != null) - aPEEVals[PEEI_PHYDAMAGE] += p0; - } - - AddDescText(color, false, GetItemDescString(DescriptipionMsg.ITEMDESC_ADDPHYDAMAGE)); - AddDescText(color, true, " %+d", p0); - break; + if(!local) + { + if (aPEEVals != null) + aPEEVals[PEEI_PHYDAMAGE] += p0; + } + + AddDescText(color, false, GetItemDescString(DescriptipionMsg.ITEMDESC_ADDPHYDAMAGE)); + AddDescText(color, true, " %+d", p0); + break; case 1: // ���������� - if(local) - { - if(p0 != p1) - { - AddDescText(color, false, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0); - AddDescText(color, true, "~%d", p1); - } - else - { - AddDescText(color, true, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0); - } - } - else - { - if (aPEEVals != null) - aPEEVals[PEEI_MAX_PHYDAMAGE] += p0; - - AddDescText(color, true, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0); - } + if(local) + { + if(p0 != p1) + { + AddDescText(color, false, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0); + AddDescText(color, true, "~%d", p1); + } + else + { + AddDescText(color, true, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0); + } + } + else + { + if (aPEEVals != null) + aPEEVals[PEEI_MAX_PHYDAMAGE] += p0; + + AddDescText(color, true, GetItemDescString(DescriptipionMsg.ITEMDESC_MAXPHYDAMAGE), p0); + } break; case 2: // ������(%) @@ -4044,21 +4142,19 @@ namespace PerfectWorld.Scripts.Managers /// /// Build add-ons properties description /// - private void BuildAddOnPropDesc(int[] aPEEVals, int[] aRefines) + protected void BuildAddOnPropDesc(int[] aPEEVals, int[] aRefines) { if (Props.Count == 0) return; // Change color m_strDesc += GetColorString(DescriptipionMsg.ITEMDESC_COL_LIGHTBLUE); - foreach (Property prop in Props) { // Properties added by Embedded stone will be printed by BuildTesseraDesc() later // Ignore suite properties also if (prop.Embed || prop.Suite || prop.Engraved) continue; - AddOneAddOnPropDesc(prop.Type, prop.Params, aPEEVals, aRefines, prop.Local); } } @@ -4069,7 +4165,6 @@ namespace PerfectWorld.Scripts.Managers public int GetSoulPowerAdded() { int added = 0; - int propertyCount = Props.Count; foreach (Property prop in Props) { @@ -4089,7 +4184,7 @@ namespace PerfectWorld.Scripts.Managers /// /// Build tessera description (socketed gems/stones) /// - private void BuildTesseraDesc() + protected void BuildTesseraDesc() { if (Holes.Count == 0) return; @@ -4115,10 +4210,23 @@ namespace PerfectWorld.Scripts.Managers } } + struct SUITEITEM + { + public bool bEnabled; + public int tid; + public char[] szName; + public string Name => new string(szName); + public SUITEITEM(bool bEnabled, int tid) + { + this.bEnabled = bEnabled; + this.tid = tid; + this.szName = new char[32]; + } + } /// /// Add suite description /// - private void AddSuiteDesc() + protected void AddSuiteDesc() { int idSuite = GetSuiteID(); if (idSuite == 0) @@ -4133,63 +4241,128 @@ namespace PerfectWorld.Scripts.Managers // ASSERT in C++ return; } - - // In C#, we'd need to cast to SUITE_ESSENCE struct - // For now, use placeholder values - string suiteName = "Suite"; // TODO: Get from SUITE_ESSENCE.name - int maxEquips = 12; // TODO: Get from SUITE_ESSENCE.max_equips - - // Get host player (would normally come from EC_Game.GetGameRun().GetHostPlayer()) - // Check if this equipment is in host's equipment pack - bool showDetail = false; // TODO: Check if m_pDescIvtr == pHostPlayer->GetEquipment() + SUITE_ESSENCE pSuiteEss = (SUITE_ESSENCE)pData; + CECHostPlayer hostPlayer = EC_Game.GetGameRun().GetHostPlayer(); // Colors - int nameCol = DecideNameCol(); + int iNameCol = DecideNameCol(); int lblue = (int)DescriptipionMsg.ITEMDESC_COL_LIGHTBLUE; + int green = (int)DescriptipionMsg.ITEMDESC_COL_GREEN; + int gray = (int)DescriptipionMsg.ITEMDESC_COL_GRAY; + int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE; int yellow = (int)DescriptipionMsg.ITEMDESC_COL_YELLOW; // Save current description string strCurDesc = m_strDesc; - - if (!showDetail) + bool bShowDetail = true; + if (hostPlayer.GetEquipment() != m_pDescIvtr) + bShowDetail = false; + else { - // Isn't equipment inventory, only add total suite number info. + for(int i = 0; i < m_pDescIvtr.GetSize(); i++) + { + EC_IvtrItem pItem = m_pDescIvtr.GetItem(i); + if (pItem == null) + { + bShowDetail = false; + continue; + } + if (pItem.m_tid == this.m_tid) + { + bShowDetail = true; + break; + } + } + } + + if (!bShowDetail) + { m_strDesc = "\\r\\r"; - AddDescText(nameCol, false, "{0} ({1})", suiteName, maxEquips); + AddDescText(iNameCol, true, "{0} {1}/{2}", pSuiteEss.Name, 0, pSuiteEss.max_equips); m_strDesc = strCurDesc + m_strDesc; return; } - - // Maximum number of suite items + // Maximum number of suite items const int MAX_NUM = 12; + SUITEITEM[] aSuiteItems = new SUITEITEM[MAX_NUM]; - // Get equipped suite item list - int[] aEquipped = new int[MAX_NUM]; - int itemCnt = 0; // TODO: Get from pHostPlayer->GetEquippedSuiteItem(idSuite, aEquipped) - if (itemCnt == 0) - return; - - m_strDesc = "\\r\\r"; - - // Build suite addon properties at first - if (itemCnt > 1) + + int maxEquips = (pSuiteEss.max_equips > MAX_NUM) ? MAX_NUM : (int)pSuiteEss.max_equips; + for(int i = 0; i < maxEquips; i++) { - // Change color - AddDescText(lblue, false, ""); - - // In C++, this loops through suite addons and displays them - // For now, skip detailed addon display + aSuiteItems[i].bEnabled = false; + aSuiteItems[i].tid = (int)pSuiteEss.equipments[i].id; + aSuiteItems[i].szName = new char[32]; + aSuiteItems[i].szName[0] = '\0'; + EC_IvtrItem pEquipItem = CreateItem((int)pSuiteEss.equipments[i].id, 0,1); + if (pEquipItem != null) + { + aSuiteItems[i].szName = pEquipItem.GetName().ToCharArray(); + //delete pEquipItem; + } + else + { + aSuiteItems[i].tid = 0; + } + } + int iItemCnt; + int[] aEquipped = new int[MAX_NUM]; + iItemCnt = hostPlayer.GetEquippedSuiteItem(idSuite,ref aEquipped); + if(iItemCnt == 0) return; + + m_strDesc += "\\r\\r"; + // Build suite addon properties at first + for (int i = 0; i < MAX_NUM; i++) + { + for(int j = 0; j < iItemCnt; j++) + { + if (aSuiteItems[i].tid == aEquipped[j]) + { + aSuiteItems[i].bEnabled = true; + break; + } + } } - // Add suite name - AddDescText(yellow, true, "{0} ({1} / {2})", suiteName, itemCnt, maxEquips); - - // List suite item names would go here - // In C++, this creates SUITEITEM array and lists enabled/disabled items - // green, gray, white colors would be used here for enabled/disabled items - // For now, simplified version + if(iItemCnt > 1) + { + // Change color + AddDescText(lblue, false, ""); + + for (int i=1; i < iItemCnt; i++) + { + int idProp = (int)pSuiteEss.addons[i-1].id; + if (idProp == 0) + continue; + + pData = dataMan.get_data_ptr((uint)idProp, ID_SPACE.ID_SPACE_ADDON, ref dataType); + if (dataType != DATA_TYPE.DT_EQUIPMENT_ADDON) + { + continue; + } + + EQUIPMENT_ADDON pAddOn = (EQUIPMENT_ADDON)pData; + + AddDescText(-1, false, "(%d) ", i+1); + AddDescText(-1, true, "%s", pAddOn.Name); + } + } + // Add suite name + AddDescText(yellow/*iNameCol*/, true, "{0} ({1} / {2})", pSuiteEss.Name, iItemCnt, pSuiteEss.max_equips); + for (int i=0; i < pSuiteEss.max_equips; i++) + { + SUITEITEM suiteItem = aSuiteItems[i]; + if (suiteItem.tid == 0) + continue; + + int col = suiteItem.bEnabled ? green : gray; + bool bRet = (i == pSuiteEss.max_equips-1) ? false : true; + + // Add item name + AddDescText(col, bRet, " %s", suiteItem.Name); + } } - + /// /// Add destroying description /// @@ -4225,7 +4398,7 @@ namespace PerfectWorld.Scripts.Managers /// /// Add reputation requirement description /// - private void AddReputationReqDesc() + protected void AddReputationReqDesc() { if (ReputationReq == 0) return; @@ -4258,7 +4431,7 @@ namespace PerfectWorld.Scripts.Managers /// /// Add sharpener description (磨刀石 properties) /// - private void AddSharpenerDesc() + protected void AddSharpenerDesc() { if (Props.Count == 0) return; @@ -4437,7 +4610,7 @@ namespace PerfectWorld.Scripts.Managers /// Append engraved property descriptions to the current description buffer. /// Mirrors the behaviour of the original C++ AddEngravedDesc. /// - private void AddEngravedDesc() + protected void AddEngravedDesc() { if (Props.Count == 0) return; @@ -4469,14 +4642,14 @@ namespace PerfectWorld.Scripts.Managers /// /// Append maker description (signature / crafted by) to the description buffer. /// - private void AddMakerDesc() + protected void AddMakerDesc() { if (string.IsNullOrEmpty(Maker)) return; - m_strDesc += "\\r"; + m_strDesc += "\\r"; // For signed marks (IMT_SIGN), Maker already contains color codes and formatted text. - if (MadeFrom == IMT_SIGN) + if (MadeFrom == (byte)ITEM_MAKE_TAG.IMT_SIGN) { m_strDesc += Maker; } @@ -4489,7 +4662,7 @@ namespace PerfectWorld.Scripts.Managers fmt = "Made by {0}"; } AddDescText((int)DescriptipionMsg.ITEMDESC_COL_GREEN, false, fmt, Maker); - } + } } /// @@ -4557,7 +4730,7 @@ namespace PerfectWorld.Scripts.Managers /// /// Get preview info /// - public string GetPreviewInfo() + public virtual string GetPreviewInfo() { m_strDesc = ""; BuildAddOnPropDesc(null, null); @@ -4620,7 +4793,60 @@ namespace PerfectWorld.Scripts.Managers return m_strDesc; } - + public struct RefineEffect + { + int m_refineIndex; + public int RefineIndex{ get { return m_refineIndex; } set { m_refineIndex = value; } } + int m_incEffect; + public int IncEffect{ get { return m_incEffect; } set { m_incEffect = value; } } + + int[] m_aPEEVals; + public int[] APEEVals{ get { return m_aPEEVals; } set { m_aPEEVals = value; } } + int[] m_aRefines; + public int[] ARefines{ get { return m_aRefines; } set { m_aRefines = value; } } + + string m_clrAttribute; + public string ClrAttribute{ get { return m_clrAttribute; } set { m_clrAttribute = value; } } + string m_clrEffect; + public string ClrEffect{ get { return m_clrEffect; } set { m_clrEffect = value; } } + + public RefineEffect(int[] aPEEVals, int[] aRefines, string clrAttribute, string clrEffect) + { + m_refineIndex = -1; + m_incEffect = 0; + m_aPEEVals = aPEEVals; + m_aRefines = aRefines; + m_clrAttribute = clrAttribute; + m_clrEffect = clrEffect; + } + + public void Set(int refineIndex, int incEffect){ + m_refineIndex = refineIndex; + m_incEffect = incEffect; + } + + public int GetIncEffect(){ + return m_incEffect; + } + public string GetClrAttribute(){ + return m_clrAttribute; + } + public string GetClrEffect(){ + return m_clrEffect; + } + }; + public virtual bool GetRefineEffectFor(string strEffect, RefineEffect rhs){ return false; } + public static int CalcRefineEffect(int refineLevel, int baseEffect) + { + const int MAX_REFINE_LEVEL = 12; + float[] refine_factor = new float[MAX_REFINE_LEVEL + 1] + { 0, 1.0f, 2.0f, 3.05f, 4.3f, 5.75f, 7.55f, 9.95f, 13f, 17.05f, 22.3f, 29f, 37.5f }; + if (refineLevel >= 0 && refineLevel <= MAX_REFINE_LEVEL){ + return (int)(baseEffect * refine_factor[refineLevel] + 0.1f); + } + return 0; + } + #endregion } diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs.meta new file mode 100644 index 0000000000..81db6a40d0 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrEquip.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f740d7d39c73f41a7a352c569c5442db \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFacePill.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFacePill.cs new file mode 100644 index 0000000000..815c598198 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFacePill.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrFacePill : EC_IvtrItem + { + public EC_IvtrFacePill(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrFacePill(EC_IvtrFacePill other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFacePill.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFacePill.cs.meta new file mode 100644 index 0000000000..8009dce62b --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFacePill.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a8785f321cb1c42e784355f0e452a2f8 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFaceTicket.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFaceTicket.cs new file mode 100644 index 0000000000..9c1fd6ccaa --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFaceTicket.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrFaceTicket : EC_IvtrItem + { + public EC_IvtrFaceTicket(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrFaceTicket(EC_IvtrFaceTicket other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFaceTicket.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFaceTicket.cs.meta new file mode 100644 index 0000000000..dc9acdba94 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFaceTicket.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 97a6a36bce3c046a88e5c12e8ac79b03 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFactionMaterial.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFactionMaterial.cs new file mode 100644 index 0000000000..3429a0b219 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFactionMaterial.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrFactionMaterial : EC_IvtrItem + { + public EC_IvtrFactionMaterial(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrFactionMaterial(EC_IvtrFactionMaterial other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFactionMaterial.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFactionMaterial.cs.meta new file mode 100644 index 0000000000..20cddc454f --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFactionMaterial.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e3a3f865615ba4eaca9942d99698c332 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFashion.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFashion.cs new file mode 100644 index 0000000000..a6c1751657 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFashion.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrFashion : EC_IvtrItem + { + public EC_IvtrFashion(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrFashion(EC_IvtrFashion other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFashion.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFashion.cs.meta new file mode 100644 index 0000000000..d9d6ea16e4 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFashion.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8cbdfe37e56eb46be91ac835220dfb25 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFirework.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFirework.cs new file mode 100644 index 0000000000..71d75113d0 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFirework.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrFirework : EC_IvtrItem + { + public EC_IvtrFirework(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrFirework(EC_IvtrFirework other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFirework.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFirework.cs.meta new file mode 100644 index 0000000000..c2130f4714 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFirework.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9a4c28d0768f341b2aef5ec207875a31 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFlysword.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFlysword.cs new file mode 100644 index 0000000000..210d40eda0 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFlysword.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrFlysword : EC_IvtrItem + { + public EC_IvtrFlysword(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrFlysword(EC_IvtrFlysword other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFlysword.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFlysword.cs.meta new file mode 100644 index 0000000000..eb9291c8e5 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrFlysword.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 76745e0d1f528425eac71363b77c8cdd \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrForceToken.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrForceToken.cs new file mode 100644 index 0000000000..26dc9fed3e --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrForceToken.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrForceToken : EC_IvtrItem + { + public EC_IvtrForceToken(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrForceToken(EC_IvtrForceToken other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrForceToken.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrForceToken.cs.meta new file mode 100644 index 0000000000..7c1d676914 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrForceToken.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: de39c4a9aa1e1434c96ce485ea144291 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCard.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCard.cs new file mode 100644 index 0000000000..de46434948 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCard.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrGeneralCard : EC_IvtrItem + { + public EC_IvtrGeneralCard(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrGeneralCard(EC_IvtrGeneralCard other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCard.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCard.cs.meta new file mode 100644 index 0000000000..2344d68880 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCard.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: bfe40c592c38542d2a590310173f5c8c \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCardDice.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCardDice.cs new file mode 100644 index 0000000000..df28fd9d9a --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCardDice.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrGeneralCardDice : EC_IvtrItem + { + public EC_IvtrGeneralCardDice(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrGeneralCardDice(EC_IvtrGeneralCardDice other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCardDice.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCardDice.cs.meta new file mode 100644 index 0000000000..3d919e4baf --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGeneralCardDice.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ab3e2b5b4e09949a69cfc003d0103804 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGmGenerator.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGmGenerator.cs new file mode 100644 index 0000000000..75f77cf24c --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGmGenerator.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrGmGenerator : EC_IvtrItem + { + public EC_IvtrGmGenerator(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrGmGenerator(EC_IvtrGmGenerator other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGmGenerator.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGmGenerator.cs.meta new file mode 100644 index 0000000000..cd7c06a818 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGmGenerator.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 92617801fcd734adfa84fb4d4ca84f0c \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs new file mode 100644 index 0000000000..44878eb090 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrGoblin : EC_IvtrItem + { + public EC_IvtrGoblin(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrGoblin(EC_IvtrGoblin other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs.meta new file mode 100644 index 0000000000..4903722714 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblin.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c8726058514b64b129c6b619e7e1d3fa \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinEquip.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinEquip.cs new file mode 100644 index 0000000000..26374a3219 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinEquip.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrGoblinEquip : EC_IvtrEquip + { + public EC_IvtrGoblinEquip(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrGoblinEquip(EC_IvtrGoblinEquip other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinEquip.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinEquip.cs.meta new file mode 100644 index 0000000000..b92fb38bb4 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinEquip.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 89be2e126b8d44151bdd559226b0f306 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinExpPill.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinExpPill.cs new file mode 100644 index 0000000000..b6c49d6aaa --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinExpPill.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrGoblinExpPill : EC_IvtrItem + { + public EC_IvtrGoblinExpPill(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrGoblinExpPill(EC_IvtrGoblinExpPill other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinExpPill.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinExpPill.cs.meta new file mode 100644 index 0000000000..becac7c872 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrGoblinExpPill.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4b383fd16faa444fa8dc9a5c4e4aac86 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrIncSkillAbility.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrIncSkillAbility.cs new file mode 100644 index 0000000000..93c8043715 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrIncSkillAbility.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrIncSkillAbility : EC_IvtrItem + { + public EC_IvtrIncSkillAbility(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrIncSkillAbility(EC_IvtrIncSkillAbility other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrIncSkillAbility.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrIncSkillAbility.cs.meta new file mode 100644 index 0000000000..044cd3f346 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrIncSkillAbility.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4050b6d604fee48c399953ca2707f650 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs similarity index 80% rename from Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs rename to Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs index 27b11f1fae..8f3142b426 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs @@ -167,17 +167,14 @@ namespace BrewMonster.Scripts.Managers } } - Debug.Log($"[Inventory] Loaded multi-sprite atlas with {atlasSprites.Length} sprites"); } else { - Debug.LogWarning("[Inventory] Failed to load multi-sprite atlas: iconlist_ivtrm_multisprite"); _multiSpriteAtlas = new Sprite[0]; // Prevent repeated loading attempts } } catch (Exception ex) { - Debug.LogError($"[Inventory] Error loading multi-sprite atlas: {ex.Message}"); _multiSpriteAtlas = new Sprite[0]; // Prevent repeated loading attempts } } @@ -332,7 +329,6 @@ namespace BrewMonster.Scripts.Managers try { var val = getNameMethod.Invoke(data, null) as string; - Debug.Log($"[Inventory] GetName method result: '{val}' (length: {val?.Length ?? 0})"); if (!string.IsNullOrEmpty(val) && !string.IsNullOrWhiteSpace(val)) return val; } catch (Exception ex) @@ -459,15 +455,12 @@ namespace BrewMonster.Scripts.Managers ci += extraLen; } - var item = new EC_IvtrItem(tid, expireDate) - { - Package = byPackage, - Slot = slotIndex, - State = state, - Crc = crc, - Content = extra - }; - item.SetCount(amount); + var item = EC_IvtrItem.CreateItem(tid, expireDate, amount); + item.Package = byPackage; + item.Slot = slotIndex; + item.State = state; + item.Crc = crc; + item.Content = extra; items.Add(item); } @@ -707,7 +700,7 @@ namespace BrewMonster.Scripts.Managers public bool m_bNeedUpdate; // true, detail data needs to be updated public bool m_bUpdating; // true, being updating detail data public uint m_dwUptTime; // Time when updating request was sent (ms) - public string m_strDesc; // Item description + public string m_strDesc = ""; // Item description public bool m_bIsInNPCPack; // true, this item is in NPC package public bool m_bLocalDetailData; // true, data from GetDetailDataFromLocal @@ -812,6 +805,195 @@ namespace BrewMonster.Scripts.Managers public static EC_IvtrItem CreateItem(int tid, int expire_date, int iCount, int idSpace = 0) { var pItem = new EC_IvtrItem(tid, expire_date); + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + object data = ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + Debug.Log("DataType: " + DataType); + switch(DataType) + { + case DATA_TYPE.DT_WEAPON_ESSENCE: + pItem = new EC_IvtrWeapon(tid, expire_date); + break; + case DATA_TYPE.DT_PROJECTILE_ESSENCE: + pItem = new EC_IvtrArrow(tid, expire_date); + break; + case DATA_TYPE.DT_ARMOR_ESSENCE: + pItem = new EC_IvtrArmor(tid, expire_date); + break; + case DATA_TYPE.DT_DECORATION_ESSENCE: + pItem = new EC_IvtrDecoration(tid, expire_date); + break; + case DATA_TYPE.DT_FASHION_ESSENCE: + pItem = new EC_IvtrFashion(tid, expire_date); + break; + case DATA_TYPE.DT_MEDICINE_ESSENCE: + pItem = new EC_IvtrMedicine(tid, expire_date); + break; + case DATA_TYPE.DT_MATERIAL_ESSENCE: + pItem = new EC_IvtrMaterial(tid, expire_date); + break; + case DATA_TYPE.DT_DAMAGERUNE_ESSENCE: + pItem = new EC_IvtrDamagerune(tid, expire_date); + break; + case DATA_TYPE.DT_ARMORRUNE_ESSENCE: + pItem = new EC_IvtrArmorrune(tid, expire_date); + break; + case DATA_TYPE.DT_SKILLTOME_ESSENCE: + pItem = new EC_IvtrSkilltome(tid, expire_date); + break; + case DATA_TYPE.DT_FLYSWORD_ESSENCE: + pItem = new EC_IvtrFlysword(tid, expire_date); + break; + case DATA_TYPE.DT_TOWNSCROLL_ESSENCE: + pItem = new EC_IvtrTownscroll(tid, expire_date); + break; + case DATA_TYPE.DT_UNIONSCROLL_ESSENCE: + pItem = new EC_IvtrUnionscroll(tid, expire_date); + break; + case DATA_TYPE.DT_REVIVESCROLL_ESSENCE: + pItem = new EC_IvtrRevScroll(tid, expire_date); + break; + case DATA_TYPE.DT_ELEMENT_ESSENCE: + pItem = new EC_IvtrElement(tid, expire_date); + break; + case DATA_TYPE.DT_TOSSMATTER_ESSENCE: + pItem = new EC_IvtrTossMat(tid, expire_date); + break; + case DATA_TYPE.DT_TASKMATTER_ESSENCE: + pItem = new EC_IvtrTaskmatter(tid, expire_date); + break; + case DATA_TYPE.DT_STONE_ESSENCE: + pItem = new EC_IvtrStone(tid, expire_date); + break; + case DATA_TYPE.DT_WINGMANWING_ESSENCE: + pItem = new EC_IvtrWing(tid, expire_date); + break; + case DATA_TYPE.DT_TASKDICE_ESSENCE: + pItem = new EC_IvtrTaskDice(tid, expire_date); + break; + case DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE: + pItem = new EC_IvtrTaskNmMatter(tid, expire_date); + break; + case DATA_TYPE.DT_FACETICKET_ESSENCE: + pItem = new EC_IvtrFaceTicket(tid, expire_date); + break; + case DATA_TYPE.DT_FACEPILL_ESSENCE: + pItem = new EC_IvtrFacePill(tid, expire_date); + break; + case DATA_TYPE.DT_GM_GENERATOR_ESSENCE: + pItem = new EC_IvtrGmGenerator(tid, expire_date); + break; + case DATA_TYPE.DT_RECIPE_ESSENCE: + pItem = new EC_IvtrRecipe(tid, expire_date); + break; + case DATA_TYPE.DT_PET_EGG_ESSENCE: + pItem = new EC_IvtrPetEgg(tid, expire_date); + break; + case DATA_TYPE.DT_PET_FOOD_ESSENCE: + pItem = new EC_IvtrPetFood(tid, expire_date); + break; + case DATA_TYPE.DT_PET_FACETICKET_ESSENCE: + pItem = new EC_IvtrPetFaceTicket(tid, expire_date); + break; + case DATA_TYPE.DT_FIREWORKS_ESSENCE: + pItem = new EC_IvtrFirework(tid, expire_date); + break; + case DATA_TYPE.DT_WAR_TANKCALLIN_ESSENCE: + pItem = new EC_IvtrWarTankCallin(tid, expire_date); + break; + case DATA_TYPE.DT_SKILLMATTER_ESSENCE: + pItem = new EC_IvtrSkillMat(tid, expire_date); + break; + case DATA_TYPE.DT_INC_SKILL_ABILITY_ESSENCE: + pItem = new EC_IvtrIncSkillAbility(tid, expire_date); + break; + case DATA_TYPE.DT_REFINE_TICKET_ESSENCE: + pItem = new EC_IvtrRefineTicket(tid, expire_date); + break; + case DATA_TYPE.DT_DESTROYING_ESSENCE: + pItem = new EC_IvtrDestroyingEssence(tid, expire_date); + break; + case DATA_TYPE.DT_BIBLE_ESSENCE: + pItem = new EC_IvtrBible(tid, expire_date); + break; + case DATA_TYPE.DT_SPEAKER_ESSENCE: + pItem = new EC_IvtrSpeaker(tid, expire_date); + break; + case DATA_TYPE.DT_AUTOHP_ESSENCE: + pItem = new EC_IvtrAutoHp(tid, expire_date); + break; + case DATA_TYPE.DT_AUTOMP_ESSENCE: + pItem = new EC_IvtrAutoMp(tid, expire_date); + break; + case DATA_TYPE.DT_DOUBLE_EXP_ESSENCE: + pItem = new EC_IvtrDoubleExp(tid, expire_date); + break; + case DATA_TYPE.DT_DYE_TICKET_ESSENCE: + pItem = new EC_IvtrDyeTicket(tid, expire_date); + break; + case DATA_TYPE.DT_TRANSMITSCROLL_ESSENCE: + pItem = new EC_IvtrTransmitScroll(tid, expire_date); + break; + case DATA_TYPE.DT_GOBLIN_ESSENCE: + pItem = new EC_IvtrGoblin(tid, expire_date); + break; + case DATA_TYPE.DT_GOBLIN_EQUIP_ESSENCE: + pItem = new EC_IvtrGoblinEquip(tid, expire_date); + break; + case DATA_TYPE.DT_GOBLIN_EXPPILL_ESSENCE: + pItem = new EC_IvtrGoblinExpPill(tid, expire_date); + break; + case DATA_TYPE.DT_SELL_CERTIFICATE_ESSENCE: + pItem = new EC_IvtrCertificate(tid, expire_date); + break; + case DATA_TYPE.DT_TARGET_ITEM_ESSENCE: + pItem = new EC_IvtrTargetItem(tid, expire_date); + break; + case DATA_TYPE.DT_LOOK_INFO_ESSENCE: + pItem = new EC_IvtrLookInfoItem(tid, expire_date); + break; + case DATA_TYPE.DT_WEDDING_BOOKCARD_ESSENCE: + pItem = new EC_IvtrWeddingBookCard(tid, expire_date); + break; + case DATA_TYPE.DT_WEDDING_INVITECARD_ESSENCE: + pItem = new EC_IvtrWeddingInviteCard(tid, expire_date); + break; + case DATA_TYPE.DT_SHARPENER_ESSENCE: + pItem = new EC_IvtrSharpener(tid, expire_date); + break; + case DATA_TYPE.DT_FACTION_MATERIAL_ESSENCE: + pItem = new EC_IvtrFactionMaterial(tid, expire_date); + break; + case DATA_TYPE.DT_CONGREGATE_ESSENCE: + pItem = new EC_IvtrCongregate(tid, expire_date); + break; + case DATA_TYPE.DT_FORCE_TOKEN_ESSENCE: + pItem = new EC_IvtrForceToken(tid, expire_date); + break; + case DATA_TYPE.DT_DYNSKILLEQUIP_ESSENCE: + pItem = new EC_IvtrDynSkillEquip(tid, expire_date); + break; + case DATA_TYPE.DT_MONEY_CONVERTIBLE_ESSENCE: + pItem = new EC_IvtrMoneyConvertible(tid, expire_date); + break; + case DATA_TYPE.DT_MONSTER_SPIRIT_ESSENCE: + pItem = new EC_IvtrMonsterSpirit(tid, expire_date); + break; + case DATA_TYPE.DT_POKER_ESSENCE: + pItem = new EC_IvtrGeneralCard(tid, expire_date); + break; + case DATA_TYPE.DT_POKER_DICE_ESSENCE: + pItem = new EC_IvtrGeneralCardDice(tid, expire_date); + break; + case DATA_TYPE.DT_SHOP_TOKEN_ESSENCE: + pItem = new EC_IvtrShopToken(tid, expire_date); + break; + case DATA_TYPE.DT_UNIVERSAL_TOKEN_ESSENCE: + pItem = new EC_IvtrUniversalToken(tid, expire_date); + break; + default: + pItem = new EC_IvtrUnknown(tid, expire_date); + break; + } pItem.SetCount(iCount); return pItem; } @@ -951,7 +1133,7 @@ namespace BrewMonster.Scripts.Managers /// Clone item (shallow copy, same as C++ default). public virtual EC_IvtrItem Clone() { - return new EC_IvtrItem(this); + return CreateItem(m_tid, m_expire_date, m_iCount, m_iCID); } /// Get item cool time in milliseconds (0 by default). @@ -1154,10 +1336,20 @@ namespace BrewMonster.Scripts.Managers // m_dwUptTime could be set from a game time provider when available. } - public void GetDetailDataFromLocal() + public virtual void GetDetailDataFromLocal() { - // Placeholder: when itemdataman is ported, this will read default item content. - SetItemInfo(null, 0); + //itemdataman* pItemDataMan = g_pGame->GetItemDataMan(); + object pData_temp = itemdataman.get_item_for_sell((uint)m_tid); + if(pData_temp == null) + { + SetItemInfo(null, 0); + SetLocalProps(); + m_bLocalDetailData = true; + return; + } + item_data pData = (item_data)pData_temp; + SetItemInfo(pData.item_content, pData.content_length); + SetLocalProps(); m_bLocalDetailData = true; } @@ -1188,25 +1380,9 @@ namespace BrewMonster.Scripts.Managers m_strDesc = string.Empty; // Item name line - string name = GetName(); - if (!string.IsNullOrEmpty(name)) - { - AddDescText(0, true, name); - } - - // Core description from item_desc.txt (via EC_Game / TryGetItemMsg) - string mainDesc = TryGetItemMainDesc(); - if (!string.IsNullOrEmpty(mainDesc)) - { - AddDescText(0, true, mainDesc); - } - - // Extended description from item_ext_desc.txt - string extDesc = TryGetItemExtDesc(); - if (!string.IsNullOrEmpty(extDesc)) - { - AddDescText(0, true, extDesc); - } + CECStringTab pDescTab = EC_Game.GetItemDesc(); + AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ERRORITEM)); + AddDescText((int)DescriptipionMsg.ITEMDESC_COL_WHITE, false, "({0})", m_tid); TrimLastReturn(); return m_strDesc; @@ -1230,8 +1406,32 @@ namespace BrewMonster.Scripts.Managers AddDescText(col, true, "Price: {0}", price); } - protected virtual void AddProfReqDesc(int iProfReq) + protected virtual void AddProfReqDesc(uint iProfReq) { + if (EC_ProfConfigs.ContainsAllProfession(iProfReq)) + { + return;// All profession permit equirement + } + CECStringTab pDescTab = EC_Game.GetItemDesc(); + CECGameRun pGameRun = EC_Game.GetGameRun(); + CECHostPlayer pHost = pGameRun.GetHostPlayer(); + int col = (iProfReq & (1 << pHost.GetProfession())) != 0 ? (int)DescriptipionMsg.ITEMDESC_COL_WHITE : (int)DescriptipionMsg.ITEMDESC_COL_RED; + AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PROFESSIONREQ)); + for (int i = 0; i < (int)Profession.NUM_PROFESSION; i++) + { + if ((iProfReq & (1 << i)) != 0) + { + m_strDesc += " "; + string profName = pGameRun.GetProfName(i); + // Remove newline and carriage return characters that cause UI display issues + if (!string.IsNullOrEmpty(profName)) + { + profName = profName.Replace("\r", "").Replace("\n", "").Trim(); + } + AddDescText(col, false, profName); + } + } + AddDescText(col, true, " "); } protected virtual int DecideNameCol() @@ -1243,7 +1443,7 @@ namespace BrewMonster.Scripts.Managers { } - protected void AddDescText(int iCol, bool bRet, string szText, params object[] args) + protected virtual void AddDescText(int iCol, bool bRet, string szText, params object[] args) { string line = (args != null && args.Length > 0) ? string.Format(szText, args) : szText; m_strDesc += line; @@ -1266,10 +1466,23 @@ namespace BrewMonster.Scripts.Managers // Add special properties description / 添加特殊属性描述 var pDescTab = EC_Game.GetItemDesc(); // Note: ITEMDESC_COL2_BRIGHTBLUE constant - adjust based on actual string table / 注意:ITEMDESC_COL2_BRIGHTBLUE常量 - 根据实际字符串表调整 - int green = 1000; // ITEMDESC_COL2_BRIGHTBLUE placeholder - adjust this value - + int green = (int)DescriptipionMsg.ITEMDESC_COL2_BRIGHTBLUE; // ITEMDESC_COL2_BRIGHTBLUE placeholder - adjust this value + if(typeof(EC_IvtrArmor) == this.GetType()) + { + Debug.Log("This is an armor"); + } + + Debug.Log("armor m_iCID: " + m_iCID); + Debug.Log("armor m_iProcType: " + m_iProcType); if (m_iCID != (int)InventoryClassId.ICID_GOBLIN) // goblin does not need to display these special properties / 地精不需要显示这些特殊属性 { + Debug.Log("m_iCID != (int)InventoryClassId.ICID_GOBLIN"); + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_NO_USER_TRASH: " + (m_iProcType & (int)ProcType.PROC_NO_USER_TRASH)); + Debug.Log("!((m_iProcType & (int)ProcType.PROC_BINDING) != 0): " + !((m_iProcType & (int)ProcType.PROC_BINDING) != 0)); + Debug.Log("((m_iProcType & (int)ProcType.PROC_DROPWHENDIE) != 0): " + ((m_iProcType & (int)ProcType.PROC_DROPWHENDIE) != 0)); + Debug.Log("((m_iProcType & (int)ProcType.PROC_DROPPABLE) != 0): " + ((m_iProcType & (int)ProcType.PROC_DROPPABLE) != 0)); + Debug.Log("((m_iProcType & (int)ProcType.PROC_SELLABLE) != 0): " + ((m_iProcType & (int)ProcType.PROC_SELLABLE) != 0)); // Exact C++ logic: (PROC_NO_USER_TRASH) || (!PROC_BINDING && (PROC_DROPWHENDIE || ...)) // 精确的C++逻辑:(PROC_NO_USER_TRASH) || (!PROC_BINDING && (PROC_DROPWHENDIE || ...)) if ((m_iProcType & (int)ProcType.PROC_NO_USER_TRASH) != 0 @@ -1293,121 +1506,140 @@ namespace BrewMonster.Scripts.Managers m_strDesc += szCol; } } - - // Note: These message IDs are placeholders - adjust based on actual string table / 注意:这些消息ID是占位符 - 根据实际字符串表调整 + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_DROPWHENDIE: " + (m_iProcType & (int)ProcType.PROC_DROPWHENDIE)); if ((m_iProcType & (int)ProcType.PROC_DROPWHENDIE) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_DEAD_PROTECT placeholder - adjust this value - string desc = pDescTab.GetWideString(2000); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_DEAD_PROTECT); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_DROPPABLE: " + (m_iProcType & (int)ProcType.PROC_DROPPABLE)); if ((m_iProcType & (int)ProcType.PROC_DROPPABLE) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_NO_DROP placeholder - adjust this value - string desc = pDescTab.GetWideString(2001); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NO_DROP); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_SELLABLE: " + (m_iProcType & (int)ProcType.PROC_SELLABLE)); if ((m_iProcType & (int)ProcType.PROC_SELLABLE) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_NO_TRADE placeholder - adjust this value - string desc = pDescTab.GetWideString(2002); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NO_TRADE); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_TRADEABLE: " + (m_iProcType & (int)ProcType.PROC_TRADEABLE)); if ((m_iProcType & (int)ProcType.PROC_TRADEABLE) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_NO_PLAYER_TRADE placeholder - adjust this value - string desc = pDescTab.GetWideString(2003); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NO_PLAYER_TRADE); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_DISAPEAR: " + (m_iProcType & (int)ProcType.PROC_DISAPEAR)); if ((m_iProcType & (int)ProcType.PROC_DISAPEAR) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_LEAVE_SCENE_DISAPEAR placeholder - adjust this value - string desc = pDescTab.GetWideString(2004); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEAVE_SCENE_DISAPEAR); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_USE: " + (m_iProcType & (int)ProcType.PROC_USE)); if ((m_iProcType & (int)ProcType.PROC_USE) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_USE_AFTER_PICK_UP placeholder - adjust this value - string desc = pDescTab.GetWideString(2005); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_USE_AFTER_PICK_UP); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_DEADDROP: " + (m_iProcType & (int)ProcType.PROC_DEADDROP)); if ((m_iProcType & (int)ProcType.PROC_DEADDROP) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_DROP_WHEN_DEAD placeholder - adjust this value - string desc = pDescTab.GetWideString(2006); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_DROP_WHEN_DEAD); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_OFFLINE: " + (m_iProcType & (int)ProcType.PROC_OFFLINE)); if ((m_iProcType & (int)ProcType.PROC_OFFLINE) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_DROP_WHEN_OFFLINE placeholder - adjust this value - string desc = pDescTab.GetWideString(2007); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_DROP_WHEN_OFFLINE); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_UNREPAIRABLE: " + (m_iProcType & (int)ProcType.PROC_UNREPAIRABLE)); if ((m_iProcType & (int)ProcType.PROC_UNREPAIRABLE) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_UNREPAIRABLE placeholder - adjust this value - string desc = pDescTab.GetWideString(2008); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_UNREPAIRABLE); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } + Debug.Log("m_iProcType: " + m_iProcType); + Debug.Log("m_iProcType & (int)ProcType.PROC_NO_USER_TRASH: " + (m_iProcType & (int)ProcType.PROC_NO_USER_TRASH)); if ((m_iProcType & (int)ProcType.PROC_NO_USER_TRASH) != 0) { m_strDesc += "\\r"; if (pDescTab != null && pDescTab.IsInitialized()) { - // ITEMDESC_NO_USER_TRASH placeholder - adjust this value - string desc = pDescTab.GetWideString(2009); // Placeholder ID + string desc = pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NO_USER_TRASH); if (!string.IsNullOrEmpty(desc)) m_strDesc += desc; } + Debug.Log("m_strDesc: " + m_strDesc); } } else { + Debug.Log("m_iCID == (int)InventoryClassId.ICID_GOBLIN"); TrimLastReturn(); } } @@ -1484,7 +1716,7 @@ namespace BrewMonster.Scripts.Managers str = iPrice.ToString(); } - protected int GetColorStrID(int tid) + public virtual int GetColorStrID(int templateId) { // Placeholder: color index lookup; return -1 (white) by default. return -1; diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs.meta new file mode 100644 index 0000000000..a258db67cc --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrItem.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 566fc2d24eefe48e7bd10ed67d15563f \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrLookInfoItem.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrLookInfoItem.cs new file mode 100644 index 0000000000..4ea2355ccf --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrLookInfoItem.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrLookInfoItem : EC_IvtrItem + { + public EC_IvtrLookInfoItem(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrLookInfoItem(EC_IvtrLookInfoItem other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrLookInfoItem.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrLookInfoItem.cs.meta new file mode 100644 index 0000000000..adeb476543 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrLookInfoItem.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 384fce986646f438698912f0c15b9ba8 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMaterial.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMaterial.cs new file mode 100644 index 0000000000..9880098373 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMaterial.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrMaterial : EC_IvtrItem + { + public EC_IvtrMaterial(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrMaterial(EC_IvtrMaterial other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMaterial.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMaterial.cs.meta new file mode 100644 index 0000000000..bc18aa001d --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMaterial.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e681cc9149ec5499fa6584a02a3916e1 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMedicine.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMedicine.cs new file mode 100644 index 0000000000..43bcfd2d13 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMedicine.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrMedicine : EC_IvtrItem + { + public EC_IvtrMedicine(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrMedicine(EC_IvtrMedicine other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMedicine.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMedicine.cs.meta new file mode 100644 index 0000000000..961e1f6544 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMedicine.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ed110c7e41c6f437791bdf92da68019c \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMoneyConvertible.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMoneyConvertible.cs new file mode 100644 index 0000000000..0706daf572 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMoneyConvertible.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrMoneyConvertible : EC_IvtrItem + { + public EC_IvtrMoneyConvertible(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrMoneyConvertible(EC_IvtrMoneyConvertible other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMoneyConvertible.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMoneyConvertible.cs.meta new file mode 100644 index 0000000000..b05aa11779 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMoneyConvertible.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6b6e854a6db4c4d87aaaeba867d72bae \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMonsterSpirit.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMonsterSpirit.cs new file mode 100644 index 0000000000..e214eee652 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMonsterSpirit.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrMonsterSpirit : EC_IvtrItem + { + public EC_IvtrMonsterSpirit(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrMonsterSpirit(EC_IvtrMonsterSpirit other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMonsterSpirit.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMonsterSpirit.cs.meta new file mode 100644 index 0000000000..e4c2cb4dd4 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrMonsterSpirit.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b3ec2fe733bae45c982969aed8b8eae0 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs new file mode 100644 index 0000000000..df0cbbd059 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrPetEgg : EC_IvtrItem + { + public EC_IvtrPetEgg(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrPetEgg(EC_IvtrPetEgg other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs.meta new file mode 100644 index 0000000000..e65af61f2c --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 31d39c5195d7e45fa91082d7db9b3204 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFaceTicket.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFaceTicket.cs new file mode 100644 index 0000000000..61f0e12023 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFaceTicket.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrPetFaceTicket : EC_IvtrItem + { + public EC_IvtrPetFaceTicket(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrPetFaceTicket(EC_IvtrPetFaceTicket other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFaceTicket.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFaceTicket.cs.meta new file mode 100644 index 0000000000..230d4c038c --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFaceTicket.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 7c61b694d841e4db5ac2811b04531e7f \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFood.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFood.cs new file mode 100644 index 0000000000..8a52b6b14e --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFood.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrPetFood : EC_IvtrItem + { + public EC_IvtrPetFood(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrPetFood(EC_IvtrPetFood other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFood.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFood.cs.meta new file mode 100644 index 0000000000..fe60acf730 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetFood.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5d8c5f936052f4ed0b63e061797eefbb \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRecipe.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRecipe.cs new file mode 100644 index 0000000000..f03d3efb62 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRecipe.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrRecipe : EC_IvtrItem + { + public EC_IvtrRecipe(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrRecipe(EC_IvtrRecipe other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRecipe.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRecipe.cs.meta new file mode 100644 index 0000000000..7554ac322d --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRecipe.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8aa46bf1a8e2045fcb18711081dcfe56 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRefineTicket.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRefineTicket.cs new file mode 100644 index 0000000000..054a81b253 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRefineTicket.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrRefineTicket : EC_IvtrItem + { + public EC_IvtrRefineTicket(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrRefineTicket(EC_IvtrRefineTicket other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRefineTicket.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRefineTicket.cs.meta new file mode 100644 index 0000000000..416637606a --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRefineTicket.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4b2d8c8d5a4104436b97dfb062ddea9e \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRevScroll.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRevScroll.cs new file mode 100644 index 0000000000..d3a8b51c1e --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRevScroll.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrRevScroll : EC_IvtrItem + { + public EC_IvtrRevScroll(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrRevScroll(EC_IvtrRevScroll other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRevScroll.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRevScroll.cs.meta new file mode 100644 index 0000000000..4bafc16c29 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrRevScroll.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 372c6fa94e6ba473a89724868d182446 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSharpener.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSharpener.cs new file mode 100644 index 0000000000..3cb60d730e --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSharpener.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrSharpener : EC_IvtrItem + { + public EC_IvtrSharpener(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrSharpener(EC_IvtrSharpener other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSharpener.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSharpener.cs.meta new file mode 100644 index 0000000000..9630e67b8b --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSharpener.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3745d3b71429d4e70bd85ff957d53edd \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrShopToken.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrShopToken.cs new file mode 100644 index 0000000000..df78933a96 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrShopToken.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrShopToken : EC_IvtrItem + { + public EC_IvtrShopToken(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrShopToken(EC_IvtrShopToken other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrShopToken.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrShopToken.cs.meta new file mode 100644 index 0000000000..73579be3f6 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrShopToken.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cbc68d3b08ef143159eed39309cbb601 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkillMat.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkillMat.cs new file mode 100644 index 0000000000..70163c6aec --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkillMat.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrSkillMat : EC_IvtrItem + { + public EC_IvtrSkillMat(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrSkillMat(EC_IvtrSkillMat other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkillMat.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkillMat.cs.meta new file mode 100644 index 0000000000..d709477560 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkillMat.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8345b2a53fffb4e638d9712b6e9e49fa \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkilltome.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkilltome.cs new file mode 100644 index 0000000000..4198416cce --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkilltome.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrSkilltome : EC_IvtrItem + { + public EC_IvtrSkilltome(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrSkilltome(EC_IvtrSkilltome other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkilltome.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkilltome.cs.meta new file mode 100644 index 0000000000..247c268e85 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSkilltome.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0c332a9a7de2647368ec4fbfd1864bfe \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSpeaker.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSpeaker.cs new file mode 100644 index 0000000000..ecfb1b0ed9 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSpeaker.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrSpeaker : EC_IvtrItem + { + public EC_IvtrSpeaker(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrSpeaker(EC_IvtrSpeaker other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSpeaker.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSpeaker.cs.meta new file mode 100644 index 0000000000..83cd26436e --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrSpeaker.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f9c5f08a7605b4065bf7ec878319726b \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrStone.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrStone.cs new file mode 100644 index 0000000000..f8347605b2 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrStone.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrStone : EC_IvtrItem + { + public EC_IvtrStone(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrStone(EC_IvtrStone other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrStone.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrStone.cs.meta new file mode 100644 index 0000000000..bbd09076b1 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrStone.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f63e461e231d0493a91f04c79939de2d \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTargetItem.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTargetItem.cs new file mode 100644 index 0000000000..a050b3d567 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTargetItem.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrTargetItem : EC_IvtrItem + { + public EC_IvtrTargetItem(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrTargetItem(EC_IvtrTargetItem other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTargetItem.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTargetItem.cs.meta new file mode 100644 index 0000000000..883a60b911 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTargetItem.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5d398d1de827b4c00a343b156823daab \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskDice.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskDice.cs new file mode 100644 index 0000000000..8640b0f0f8 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskDice.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrTaskDice : EC_IvtrItem + { + public EC_IvtrTaskDice(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrTaskDice(EC_IvtrTaskDice other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskDice.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskDice.cs.meta new file mode 100644 index 0000000000..3f9092596f --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskDice.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fbb2d62b01d4147cfa0ab3a7b7dac6aa \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskNmMatter.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskNmMatter.cs new file mode 100644 index 0000000000..beacce0272 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskNmMatter.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrTaskNmMatter : EC_IvtrItem + { + public EC_IvtrTaskNmMatter(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrTaskNmMatter(EC_IvtrTaskNmMatter other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskNmMatter.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskNmMatter.cs.meta new file mode 100644 index 0000000000..72e0db075c --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskNmMatter.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 60f885de6744b42d6845b850338569e0 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskmatter.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskmatter.cs new file mode 100644 index 0000000000..4a47bd6643 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskmatter.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrTaskmatter : EC_IvtrItem + { + public EC_IvtrTaskmatter(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrTaskmatter(EC_IvtrTaskmatter other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskmatter.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskmatter.cs.meta new file mode 100644 index 0000000000..a1f695d266 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTaskmatter.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ee5181c9a0786409fb452d21d947eab7 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTossMat.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTossMat.cs new file mode 100644 index 0000000000..3d2f7480c3 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTossMat.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrTossMat : EC_IvtrItem + { + public EC_IvtrTossMat(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrTossMat(EC_IvtrTossMat other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTossMat.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTossMat.cs.meta new file mode 100644 index 0000000000..5465cc5143 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTossMat.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d0862d72a75a24b049b47750d294ceb9 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTownscroll.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTownscroll.cs new file mode 100644 index 0000000000..8067c0d98e --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTownscroll.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrTownscroll : EC_IvtrItem + { + public EC_IvtrTownscroll(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrTownscroll(EC_IvtrTownscroll other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTownscroll.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTownscroll.cs.meta new file mode 100644 index 0000000000..fb8bf7f071 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTownscroll.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c230794db6d284141bc37798ecdc3a19 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTransmitScroll.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTransmitScroll.cs new file mode 100644 index 0000000000..1d06d9a69f --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTransmitScroll.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrTransmitScroll : EC_IvtrItem + { + public EC_IvtrTransmitScroll(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrTransmitScroll(EC_IvtrTransmitScroll other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTransmitScroll.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTransmitScroll.cs.meta new file mode 100644 index 0000000000..f1acff0994 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrTransmitScroll.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: bf880e0f7632c4c5aa8f6121e4bc6ce8 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrType.cs similarity index 70% rename from Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs rename to Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrType.cs index b42a4e4aba..9b8c404d10 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrType.cs @@ -49,10 +49,271 @@ namespace BrewMonster.Scripts.Managers SIZE_ALL_EQUIPIVTR, SIZE_GENERALCARD_EQUIPIVTR = SIZE_ALL_EQUIPIVTR - EQUIPIVTR_GENERALCARD1, } + #region Inventory Essence Struct + #pragma pack(1) + public struct IVTR_ESSENCE_WEAPON + { + public short weapon_type; + public short weapon_dealy; + public int weapon_class; + public int weapon_level; + public int require_projectile; // ��Ҫ��ҩ������ + public int damage_low; // ����������С��ֵ + public int damage_high; // ������������ֵ + public int magic_damage_low; // ħ������ + public int magic_damage_high; // ħ������ + // public int attack; // ������ + public int attack_speed; + public float attack_range; + public float attack_short_range; + public IVTR_ESSENCE_WEAPON( byte[] data) + { + Debug.Log("IVTR_ESSENCE_WEAPON: data.Length: " + data.Length); + CECDataReader dr = new (data, data.Length); + weapon_type = dr.ReadShort(); + weapon_dealy = dr.ReadShort(); + weapon_class = dr.ReadInt(); + weapon_level = dr.ReadInt(); + require_projectile = dr.ReadInt(); + damage_low = dr.ReadInt(); + damage_high = dr.ReadInt(); + magic_damage_low = dr.ReadInt(); + magic_damage_high = dr.ReadInt(); + attack_speed = dr.ReadInt(); + attack_range = dr.ReadFloat(); + attack_short_range = dr.ReadFloat(); + } + }; + public struct IVTR_ESSENCE_ARROW + { + // TODO : implement data later + // DWORD dwBowMask; + // int iDamage; + // int iDamageScale; + // int iWeaponReqLow; + // int iWeaponReqHigh; + }; + public struct IVTR_ESSENCE_DECORATION + { + int damage; + int magic_damage; + int defense; + int armor; + int[] resistance; + public IVTR_ESSENCE_DECORATION(byte[] data) + { + Debug.Log("IVTR_ESSENCE_DECORATION: data.Length: " + data.Length); + CECDataReader dr = new (data, data.Length); + damage = dr.ReadInt(); + magic_damage = dr.ReadInt(); + defense = dr.ReadInt(); + armor = dr.ReadInt(); + resistance = new int[InventoryConst.NUM_MAGICCLASS]; + for(int i = 0; i < InventoryConst.NUM_MAGICCLASS; i++) + { + resistance[i] = dr.ReadInt(); + } + } + }; + public struct IVTR_ESSENCE_ARMOR + { + // TODO : implement data later + public int defense; + public int armor; + public int mp_enhance; + public int hp_enhance; + public int[] resistance; + public IVTR_ESSENCE_ARMOR(byte[] data) + { + Debug.Log("IVTR_ESSENCE_ARMOR: data.Length: " + data.Length); + resistance = new int[InventoryConst.NUM_MAGICCLASS]; + CECDataReader dr = new (data, data.Length); + defense = dr.ReadInt(); + armor = dr.ReadInt(); + mp_enhance = dr.ReadInt(); + hp_enhance = dr.ReadInt(); + for(int i = 0; i < InventoryConst.NUM_MAGICCLASS; i++) + { + resistance[i] = dr.ReadInt(); + } + } + }; + public struct IVTR_ESSENCE_FASHION + { + // TODO : implement data later + // int require_level; + // unsigned short color; + // unsigned short gender; + }; + public struct IVTR_ESSENCE_FLYSWORD + { + // TODO : implement data later + // int cur_time; + // int max_time; + // short require_level; + // char level; + // char improve_level; + // int profession; + // size_t time_per_element; + // float speed_increase; + // float speed_increase2; + }; + public struct IVTR_ESSENCE_WING + { + // TODO : implement data later + // int require_level; + // size_t mp_launch; + // size_t mp_per_second; + // float speed_increase; + }; + public struct IVTR_ESSENCE_AUTOHP + { + // TODO : implement data later + // int hp_left; + // float trigger; + }; + public struct IVTR_ESSENCE_AUTOMP + { + // TODO : implement data later + // int mp_left; + // float trigger; + }; + public struct IVTR_ESSENCE_PETEGG + { + // TODO : implement data later + // int req_level; + // int req_class; + // int honor_point; + // int pet_tid; + // int pet_vis_tid; + // int pet_egg_tid; + // int pet_class; + // short level; + // unsigned short color; + // int exp; + // int skill_point; + // unsigned short name_len; + // unsigned short skill_count; + // wchar_t name[8]; + }; + public struct IVTR_ESSENCE_DESTROYING + { + // TODO : implement data later + // int tid; + }; + public struct IVTR_ESSENCE_GOBLIN + { + struct _GOBLIN_DATA + { + // TODO : implement data later + // unsigned int exp; + // short level; + // short total_attribute; + // short strength; + // short agility; + // short vitality; + // short energy; + // short total_genius; + // short genius[5]; + // short refine_level; + // int stamina; + // int status_value; + }; + // TODO : implement data later + // _GOBLIN_DATA data; + // int equip_cnt; + // int skill_cnt; + }; + public struct IVTR_ESSENCE_WEDDING_BOOKCARD + { + // TODO : implement data later + // int year; + // int month; + // int day; + }; + public struct IVTR_ESSENCE_WEDDING_INVITECARD + { + // TODO : implement data later + // int start_time; + // int end_time; + // int groom; + // int bride; + // int scene; + // int invitee; + }; + public struct IVTR_ESSENCE_FORCE_TOKEN + { + // TODO : implement data later + // int require_force; + // int repu_total; + // int repu_inc_ratio; + }; + public struct IVTR_ESSENCE_MONSTERSPIRIT + { + // TODO : implement data later + // int level; + // int type; + // int power; + }; + public struct IVTR_ESSENCE_GENERALCARD + { + // TODO : implement data later + // int type; + // int rank; + // int require_level; + // int require_leadership; + // int max_level; + // int level; + // int exp; + // int rebirth_times; + }; + #pragma pack() + + #endregion public static class EC_IvtrType { - + #region Equipment Mask 64 Bit Constants + public const long EQUIP_MASK64_WEAPON = 0x0000000000000001; + public const long EQUIP_MASK64_HEAD = 0x0000000000000002; + public const long EQUIP_MASK64_NECK = 0x0000000000000004; + public const long EQUIP_MASK64_SHOULDER = 0x0000000000000008; + public const long EQUIP_MASK64_BODY = 0x0000000000000010; + public const long EQUIP_MASK64_WAIST = 0x0000000000000020; + public const long EQUIP_MASK64_LEG = 0x0000000000000040; + public const long EQUIP_MASK64_FOOT = 0x0000000000000080; + public const long EQUIP_MASK64_WRIST = 0x0000000000000100; + public const long EQUIP_MASK64_FINGER1 = 0x0000000000000200; + public const long EQUIP_MASK64_FINGER2 = 0x0000000000000400; + public const long EQUIP_MASK64_PROJECTILE = 0x0000000000000800; + public const long EQUIP_MASK64_FLYSWORD = 0x0000000000001000; + public const long EQUIP_MASK64_FASHION_BODY = 0x0000000000002000; + public const long EQUIP_MASK64_FASHION_LEG = 0x0000000000004000; + public const long EQUIP_MASK64_FASHION_FOOT = 0x0000000000008000; + public const long EQUIP_MASK64_FASHION_WRIST = 0x0000000000010000; + public const long EQUIP_MASK64_RUNE = 0x0000000000020000; + public const long EQUIP_MASK64_BIBLE = 0x0000000000040000; + public const long EQUIP_MASK64_SPEAKER = 0x0000000000080000; + public const long EQUIP_MASK64_AUTOHP = 0x0000000000100000; + public const long EQUIP_MASK64_AUTOMP = 0x0000000000200000; + public const long EQUIP_MASK64_POCKET = 0x0000000000400000; + public const long EQUIP_MASK64_GOBLIN = 0x0000000000800000; + public const long EQUIP_MASK64_CERTIFICATE = 0x0000000001000000; + public const long EQUIP_MASK64_FASHION_HEAD = 0x0000000002000000; + public const long EQUIP_MASK64_FORCE_TICKET = 0x0000000004000000; + public const long EQUIP_MASK64_DYNSKILLEQUIP1 = 0x0000000008000000; + public const long EQUIP_MASK64_DYNSKILLEQUIP2 = 0x0000000010000000; + public const long EQUIP_MASK64_FASHION_WEAPON = 0x0000000020000000; + public const long EQUIP_MASK64_USED1 = 0x0000000040000000; + public const long EQUIP_MASK64_USED2 = 0x0000000080000000; + public const long EQUIP_MASK64_GENERALCARD1 = 0x0000000100000000; + public const long EQUIP_MASK64_GENERALCARD2 = 0x0000000200000000; + public const long EQUIP_MASK64_GENERALCARD3 = 0x0000000400000000; + public const long EQUIP_MASK64_GENERALCARD4 = 0x0000000800000000; + public const long EQUIP_MASK64_GENERALCARD5 = 0x0000001000000000; + public const long EQUIP_MASK64_GENERALCARD6 = 0x0000002000000000; + public const long EQUIP_MASK64_ALL = 0x0000003f3fffffff; + #endregion public static byte GetEquipLocationForItem(int templateId) { try diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrType.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrType.cs.meta new file mode 100644 index 0000000000..f3b1b3f25d --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrType.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0d6b0a75085cc42469ae53d5f9a73deb \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnionscroll.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnionscroll.cs new file mode 100644 index 0000000000..bfbd189bc8 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnionscroll.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrUnionscroll : EC_IvtrItem + { + public EC_IvtrUnionscroll(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrUnionscroll(EC_IvtrUnionscroll other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnionscroll.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnionscroll.cs.meta new file mode 100644 index 0000000000..db55422520 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnionscroll.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 32a4322d6b8154a7a916851714b261bc \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUniversalToken.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUniversalToken.cs new file mode 100644 index 0000000000..b92d7dc6d9 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUniversalToken.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrUniversalToken : EC_IvtrItem + { + public EC_IvtrUniversalToken(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrUniversalToken(EC_IvtrUniversalToken other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUniversalToken.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUniversalToken.cs.meta new file mode 100644 index 0000000000..09897c9502 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUniversalToken.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 339e47e7d10564c33ba1c024da3560e8 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnknown.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnknown.cs new file mode 100644 index 0000000000..9a11faf95d --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnknown.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrUnknown : EC_IvtrItem + { + public EC_IvtrUnknown(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrUnknown(EC_IvtrUnknown other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnknown.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnknown.cs.meta new file mode 100644 index 0000000000..39c294cdae --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrUnknown.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: aa277165d27084e1f88617516f495697 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWarTankCallin.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWarTankCallin.cs new file mode 100644 index 0000000000..b64255cb43 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWarTankCallin.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrWarTankCallin : EC_IvtrItem + { + public EC_IvtrWarTankCallin(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrWarTankCallin(EC_IvtrWarTankCallin other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWarTankCallin.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWarTankCallin.cs.meta new file mode 100644 index 0000000000..22a4b23913 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWarTankCallin.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b61a51beb0c3e4e7f936069474a9549d \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeapon.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeapon.cs new file mode 100644 index 0000000000..e790fb4139 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeapon.cs @@ -0,0 +1,436 @@ +// /* +// * FILE: EC_IvtrWeapon.cpp +// * +// * DESCRIPTION: +// * +// * CREATED BY: Duyuxin, 2004/11/19 +// * +// * HISTORY: +// * +// * Copyright (c) 2004 Archosaur Studio, All Rights Reserved. +// */ + +// #include "EC_Global.h" +// #include "EC_IvtrWeapon.h" +// #include "EC_Game.h" +// #include "EC_FixedMsg.h" +// #include "EC_GameRun.h" +// #include "EC_HostPlayer.h" +// #include "EC_RTDebug.h" +// #include "elementdataman.h" +// #include "EC_Configs.h" +using BrewMonster; +using ModelRenderer.Scripts.GameData; +using System.Collections.Generic; +using BrewMonster.Network; +using BrewMonster.Scripts.Managers; +using BrewMonster.Scripts; +#region C# regions +// #define new A_DEBUG_NEW + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Define and Macro +// // +// /////////////////////////////////////////////////////////////////////////// + + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Reference to External variables and functions +// // +// /////////////////////////////////////////////////////////////////////////// + + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Local Types and Variables and Global variables +// // +// /////////////////////////////////////////////////////////////////////////// + + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Local functions +// // +// /////////////////////////////////////////////////////////////////////////// + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Implement CECIvtrWeapon +// // +// /////////////////////////////////////////////////////////////////////////// +#endregion + +namespace PerfectWorld.Scripts.Managers +{ + + public class EC_IvtrWeapon : EC_IvtrEquip + { + //Attributes + //Weapon essence data + protected IVTR_ESSENCE_WEAPON m_Essence; + // data in database + protected WEAPON_MAJOR_TYPE m_pDBMajorType; + protected WEAPON_SUB_TYPE m_pDBSubType; + protected WEAPON_ESSENCE m_pDBEssence; + + public EC_IvtrWeapon(int tid, int expire_date) : base(tid, expire_date) + { + m_iCID = (int)InventoryClassId.ICID_WEAPON; + elementdataman pDB = ElementDataManProvider.GetElementDataMan(); + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + m_pDBEssence = (WEAPON_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_pDBMajorType = (WEAPON_MAJOR_TYPE)pDB.get_data_ptr(m_pDBEssence.id_major_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_pDBSubType = (WEAPON_SUB_TYPE)pDB.get_data_ptr(m_pDBEssence.id_sub_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_iPileLimit = m_pDBEssence.pile_num_max; + m_iPrice = m_pDBEssence.price; + m_iShopPrice = m_pDBEssence.shop_price; + m_i64EquipMask = (long)EC_IvtrType.EQUIP_MASK64_WEAPON; + m_iProcType = (int)m_pDBEssence.proc_type; + + FixProps = m_pDBEssence.fixed_props; + RepairFee = m_pDBEssence.repairfee; + ReputationReq = m_pDBEssence.require_reputation; + } + public EC_IvtrWeapon(EC_IvtrWeapon other) : base(other) + { + m_pDBEssence = other.m_pDBEssence; + m_pDBMajorType = other.m_pDBMajorType; + m_pDBSubType = other.m_pDBSubType; + m_Essence = other.m_Essence; + } + + // CECIvtrWeapon::~CECIvtrWeapon() + // { + // } + + public override bool SetItemInfo(byte[] pInfoData, int iDataLen) + { + base.SetItemInfo(pInfoData, iDataLen); + if(pInfoData == null || iDataLen == 0) + { + return true; + } + + try + { + CECDataReader dr = new CECDataReader(pInfoData ,iDataLen); + // Skip equip requirements and endurance + dr.Offset(6 * sizeof(short), CECDataReader.SEEK_CUR); + dr.Offset(2 * sizeof(int), CECDataReader.SEEK_CUR); + int iEssenceSize = dr.ReadShort(); + // Skip maker's information + dr.ReadByte(); + int iMakerLen = dr.ReadByte(); + dr.Offset(iMakerLen, CECDataReader.SEEK_CUR); + byte[] iEssenceData = dr.ReadData(iEssenceSize); + m_Essence = new IVTR_ESSENCE_WEAPON(iEssenceData); + BMLogger.Log("[thn] weapon addon m_Essence: " + m_Essence.ToString()); + // ���븽������˵�� + if(m_pDBEssence.fixed_props != 0 && m_pDBEssence.probability_addon_num0 != 1.0f) + { + // Get database data + elementdataman pDataMan = ElementDataManProvider.GetElementDataMan(); + CECStringTab PropTab = EC_Game.GetItemExtProp(); + int i, iSize = 0; + for(i=0;i<32;i++) + { + if(m_pDBEssence.addons[i].id_addon != 0) + iSize++; + } + if(iSize > 0 && Props.Count == 0) + { + Props.Capacity = iSize; + for(i=0;i<32;i++) + { + if(m_pDBEssence.addons[i].id_addon != 0) + { + Property Prop = new Property(); + Prop.Type = (int)m_pDBEssence.addons[i].id_addon; + Prop.Embed = false; + Prop.Suite = false; + Prop.Engraved = false; + Prop.Local = false; + byte bType = PropTab.GetWideString(Prop.Type) != null ? (byte)0xff : (byte)0xff; + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + object pData = pDataMan.get_data_ptr(m_pDBEssence.addons[i].id_addon, ID_SPACE.ID_SPACE_ADDON, ref DataType); + if (DataType != DATA_TYPE.DT_EQUIPMENT_ADDON) + { + return false; + } + EQUIPMENT_ADDON pAddon = (EQUIPMENT_ADDON)pData; + Prop.NumParam = pAddon.num_params; + for(int j=0; j < Prop.NumParam; j++) + { + if(j==0) + { + Prop.Params[0] = pAddon.param1; + } + else if(j==1) + { + Prop.Params[1] = pAddon.param2; + } + else if(j==2) + { + Prop.Params[2] = pAddon.param3; + } + } + Props.Add(Prop); + } + } + } + } + return true; + } + catch ( System.Exception e) + { + return false; + } + } + // Get item default information from database + public override void DefaultInfo() + { + LevelReq = m_pDBEssence.require_level; + StrengthReq = m_pDBEssence.require_strength; + AgilityReq = m_pDBEssence.require_agility; + ReputationReq = m_pDBEssence.require_reputation; + CurEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE; + MaxEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE; + } + // Get item icon file name + public override string GetIconFile() + { + return m_pDBEssence.FileIcon; + } + // Get item name + public override string GetName() + { + BMLogger.Log("[THN]EC_IvtrWeapon: GetName: m_pDBEssence.Name: " + m_pDBEssence.Name); + return m_pDBEssence.Name; + } + // Get preview info + public override string GetPreviewInfo() + { + int[] aPEEVals = new int[MAX_PEEINDEX]; + int[] aRefines = new int[MAX_REFINEINDEX]; + for(int i=0; i 0) + { + AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMESOCKET), GetName(), Holes.Count); + } + else + { + AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName()); + } + if (RefineLvl > 0) + AddDescText(-1, true, "{0} +{1}", pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), RefineLvl); + else + m_strDesc += "\\r"; + AddIDDescText(); + AddBindDescText(); + // Is destroying? + AddDestroyingDesc((int)m_pDBEssence.id_drop_after_damaged, m_pDBEssence.num_drop_after_damaged); + AddExpireTimeDesc(); + // Sub class name + AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_CLASSNAME), m_pDBSubType.name.ToString()); + // Weapon level + AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), m_Essence.weapon_level); + // Attack speed + int col = ((dwPEE & PEE_ATKSPEED) != 0) ? lblue : white; + if (Props != null && Props.Count > 0 && Props[0].Local) + col = white; + AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ATKSPEED)); + AddDescText(col, true, " {0:F2}", 1.0f / (m_Essence.attack_speed * 0.05f)); + // Attack distance + AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ATKDISTANCE), m_Essence.attack_range - aPEEVals[PEEI_ATKDIST]); + // Weak distance + if (m_Essence.weapon_type == (int)WEAPON_TYPE.WEAPON_TYPE_RANGE) + AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WEAKDIST), m_Essence.attack_short_range); + // Physical damage + if (m_Essence.damage_low != 0 || m_Essence.damage_high != 0 || aRefines[REFINE_PHYDAMAGE] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PHYDAMAGE)); + AddDescText(white, true, " {0}-{1}", m_Essence.damage_low - aPEEVals[PEEI_PHYDAMAGE] + aRefines[REFINE_PHYDAMAGE], + m_Essence.damage_high - aPEEVals[PEEI_PHYDAMAGE] - aPEEVals[PEEI_MAX_PHYDAMAGE] + aRefines[REFINE_PHYDAMAGE]); + } + // Magic damage + if (m_Essence.magic_damage_low != 0 || m_Essence.magic_damage_high != 0 || aRefines[REFINE_MAGICDAMAGE] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_MAGICDAMAGE)); + AddDescText(white, true, " {0}-{1}", m_Essence.magic_damage_low - aPEEVals[PEEI_MAGICDAMAGE] + aRefines[REFINE_MAGICDAMAGE], + m_Essence.magic_damage_high - aPEEVals[PEEI_MAGICDAMAGE] - aPEEVals[PEEI_MAX_MAGICDAMAGE] + aRefines[REFINE_MAGICDAMAGE]); + } + // Endurance + col = white; + if (CurEndurance == 0) + col = red; + else if ((dwPEE & PEE_ENDURANCE) != 0) + col = lblue; + AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENDURANCE)); + AddDescText(col, true, " {0}/{1}", VisualizeEndurance(CurEndurance), VisualizeEndurance(MaxEndurance)); + // Projectile requirement + if (m_Essence.weapon_type == (int)WEAPON_TYPE.WEAPON_TYPE_RANGE && m_Essence.require_projectile != 0) + { + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + object pData = ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)m_Essence.require_projectile, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + PROJECTILE_TYPE pProjectile = (PROJECTILE_TYPE)pData; + AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PROJECTILE), pProjectile.name); + } + // Profession requirement + AddProfReqDesc((uint)ProfReq); + // Level requirment + if (LevelReq != 0) + { + col = pHost.GetMaxLevelSofar() >= LevelReq ? white : red; + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), LevelReq); + } + // Strength requirment + if (StrengthReq != 0) + { + col = pHost.GetExtendProps().bs.strength < StrengthReq ? red : ((dwPEE & PEE_STRENGTHREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_STRENGTHREQ), StrengthReq); + } + // Agility requirment + if (AgilityReq != 0) + { + col = pHost.GetExtendProps().bs.agility < AgilityReq ? red : ((dwPEE & PEE_AGILITYREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_AGILITYREQ), AgilityReq); + } + // Vitality requirment + if (VitalityReq != 0) + { + col = pHost.GetExtendProps().bs.vitality < VitalityReq ? red : ((dwPEE & PEE_VITALITYREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_VITALITYREQ), VitalityReq); + } + // Energy requirment + if (EnergyReq != 0) + { + col = pHost.GetExtendProps().bs.energy < EnergyReq ? red : ((dwPEE & PEE_ENERGYREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENERGYREQ), EnergyReq); + } + // Reputation requirement + AddReputationReqDesc(); + // Add addon properties + if (!string.IsNullOrEmpty(strAddon)) + m_strDesc += strAddon; + // Build tessera description + BuildTesseraDesc(); + if(m_pDBEssence.fixed_props == 0 && m_bIsInNPCPack) + AddDescText((int)DescriptipionMsg.ITEMDESC_COL2_BRIGHTBLUE, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_HASRANDOM_PROP)); + // Price + AddPriceDesc(white, bRepair); + AddSharpenerDesc(); + AddEngravedDesc(); + AddMakerDesc(); + AddSuiteDesc(); + AddExtDescText(); + return m_strDesc; + } + // Get weapon attack speed index + public int GetAttackSpeedIndex() + { + float fCurSpeed = m_Essence.attack_speed * 0.05f - m_pDBSubType.attack_speed; + if (fCurSpeed < -0.101f) + return (int)DescriptipionMsg.ITEMDESC_ATKSPD_VERYFAST; + else if (fCurSpeed < -0.001f) + return (int)DescriptipionMsg.ITEMDESC_ATKSPD_FAST; + else if (fCurSpeed < 0.001f) + return (int)DescriptipionMsg.ITEMDESC_ATKSPD_NORMAL; + else if (fCurSpeed <= 0.101f) + return (int)DescriptipionMsg.ITEMDESC_ATKSPD_SLOW; + else + return (int)DescriptipionMsg.ITEMDESC_ATKSPD_VERYSLOW; + } + // // Does this equipment has random property ? + public bool HasRandomProp() + { + for (int i = 0; i < Props.Count; i++) + { + if (!Props[i].Embed && !Props[i].Engraved && Props[i].Type == 472) + return true; + } + return false; + } + public int GetRefineMaterialNum() + { + return m_pDBEssence.material_need; + } + public override uint GetRefineAddOn() + { + return (uint)m_pDBEssence.levelup_addon; + } + public override string GetDropModel() + { + return m_pDBEssence.FileMatter; + } + public override bool IsRare() + { + return base.IsRare() || m_Essence.weapon_level >= 6; + } + public override int GetItemLevel() + { + return m_Essence.weapon_level; + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeapon.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeapon.cs.meta new file mode 100644 index 0000000000..60ddf96e84 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeapon.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1cf2e151fb8e443f7a7bbae40715b41b \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingBookCard.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingBookCard.cs new file mode 100644 index 0000000000..3830a3dc63 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingBookCard.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrWeddingBookCard : EC_IvtrEquip + { + public EC_IvtrWeddingBookCard(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrWeddingBookCard(EC_IvtrWeddingBookCard other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingBookCard.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingBookCard.cs.meta new file mode 100644 index 0000000000..f28abbbcfa --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingBookCard.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 666c3ae30ba534a02992c0427e5a0e6a \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingInviteCard.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingInviteCard.cs new file mode 100644 index 0000000000..df35857e6e --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingInviteCard.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrWeddingInviteCard : EC_IvtrEquip + { + public EC_IvtrWeddingInviteCard(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrWeddingInviteCard(EC_IvtrWeddingInviteCard other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingInviteCard.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingInviteCard.cs.meta new file mode 100644 index 0000000000..5c4612c4ec --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWeddingInviteCard.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 58cbf5818304d4f98a1e7361ced6f2c7 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWing.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWing.cs new file mode 100644 index 0000000000..a5569ff068 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWing.cs @@ -0,0 +1,15 @@ +using BrewMonster.Scripts.Managers; +namespace PerfectWorld.Scripts.Managers +{ + public class EC_IvtrWing : EC_IvtrEquip + { + public EC_IvtrWing(int tid, int expire_date) : base(tid, expire_date) + { + } + + public EC_IvtrWing(EC_IvtrWing other) : base(other) + { + } + } +} + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWing.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWing.cs.meta new file mode 100644 index 0000000000..36cc95f281 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrWing.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 7f778acb7758b46a4bb1585e72478993 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs.meta deleted file mode 100644 index 23d9a53190..0000000000 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 5e2d99e48520e824c9a27badd6c75625 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_ProfConfigs.cs b/Assets/PerfectWorld/Scripts/Managers/EC_ProfConfigs.cs new file mode 100644 index 0000000000..9376a5aca3 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_ProfConfigs.cs @@ -0,0 +1,153 @@ +using BrewMonster.Scripts; +using BrewMonster; +public static class EC_ProfConfigs +{ + + public static bool IsProfession(int prof) + { + return prof >= 0 && prof < (int)Profession.NUM_PROFESSION; + } + + public static bool IsGender(int gender) + { + return gender >= 0 && gender < (int)Gender.NUM_GENDER; + } + + public static bool IsRace(int race) + { + return race >= 0 && race < (int)Race.NUM_RACE; + } + + public static bool IsExist(int prof, int gender) + { + if (IsProfession(prof) && IsGender(gender)){ + bool[,] s_bExist = { + { true, true}, // 0:���� + { true, true}, // 1:��ʦ + { true, true}, // 2:��ʦ + { false, true}, // 3:���� + { true, false}, // 4:���� + { true, true}, // 5:�̿� + { true, true}, // 6:��â + { true, true}, // 7:���� + { true, true}, // 8:���� + { true, true}, // 9:���� + { true, true}, // 10:ҹӰ + { true, true}, // 11:���� + }; + return s_bExist[prof, gender]; + }else{ + //BMLogger.LogError("EC_ProfConfigs: IsExist: prof: {0} gender: {1} is not exist", prof, gender); + return false; + } + } + + public static int GetCounterpartGender(int gender) + { + return gender == (int)Gender.GENDER_MALE ? (int)Gender.GENDER_FEMALE : (int)Gender.GENDER_MALE; + } + + public static bool CanShowOnCreate(int prof, int gender) + { + // ������ɫʱ�Ƿ�Ӧ����ʾ��ְҵģ�ͣ�ÿְҵ��ʾһ���Ա� + if (IsProfession(prof) && IsGender(gender)){ + bool[] s_bShowMale = { + true, // 0:������ + false, // 1:��ʦ�� + false, // 2:��ʦ�� + false, // 3:������ + true, // 4:������ + true, // 5:�̿��� + true, // 6:��â�� + false, // 7:������ + true, // 8:������ + false, // 9:������ + true, // 8:ҹӰ�� + false, // 9:������ + }; + return (gender == (int)Gender.GENDER_MALE) ? s_bShowMale[prof] : !s_bShowMale[prof]; + } + //BMLogger.LogError("EC_ProfConfigs: CanShowOnCreate: prof: {0} gender: {1} is not exist", prof, gender); + return false; + } + + public static int GetRaceShowOrder(int race) + { + // ֵԽС���ȼ�Խ�� + if (IsRace(race)){ + int[] s_nRaceOrder = { + 1, + 2, + 3, + 4, + 5, + 0, + }; + return s_nRaceOrder[race]; + } + //BMLogger.LogError("EC_ProfConfigs: GetRaceShowOrder: race: {0} is not exist", race); + return -1; + } + + public static int GetRaceByProfession(int prof) + { + if (IsProfession(prof)){ + int[] s_nProfRace = { + (int)Race.RACE_HUMAN, + (int)Race.RACE_HUMAN, + (int)Race.RACE_GHOST, + (int)Race.RACE_ORC, + (int)Race.RACE_ORC, + (int)Race.RACE_GHOST, + (int)Race.RACE_ELF, + (int)Race.RACE_ELF, + (int)Race.RACE_LING, + (int)Race.RACE_LING, + (int)Race.RACE_OBORO, + (int)Race.RACE_OBORO, + }; + return s_nProfRace[prof]; + } + //BMLogger.LogError("EC_ProfConfigs: GetRaceByProfession: prof: {0} is not exist", prof); + return -1; + } + + public static int GetProfessionShowOrderInRace(int prof) + { + // ֵԽС���ȼ�Խ�� + if (IsProfession(prof)){ + int[] s_nRaceZeroShowOrderProf = { + (int)Profession.PROF_WARRIOR, // ���ࣺ���� + (int)Profession.PROF_ORC, // ���壺���� + (int)Profession.PROF_ANGEL, // ���ˣ����� + (int)Profession.PROF_MONK, // ϫ�壺��ʦ + (int)Profession.PROF_JIANLING, // ���壺���� + (int)Profession.PROF_YEYING, // ���壺ҹӰ + }; + int race = GetRaceByProfession(prof); + return prof == s_nRaceZeroShowOrderProf[race] ? 0 : 1; + } + //BMLogger.LogError("EC_ProfConfigs: GetProfessionShowOrderInRace: prof: {0} is not exist", prof); + return -1; + } + + public static bool ContainsAllProfession(uint mask){ + return (GetAllProfessionMask() & mask) == GetAllProfessionMask(); + } + + public static uint GetAllProfessionMask(){ + const uint ALL_PROFESSION_MASK = (1 << (int)Profession.NUM_PROFESSION)-1; + return ALL_PROFESSION_MASK; + } + + public static int GetMaxBodyID(int prof) + { + if (IsProfession(prof)){ + // PROF_ANGEL, PROF_ARCHOR, PROF_MAGE, PROF_WARRIOR didn't have nBodyID + int[] s_maxBodyID = {-1, -1, 4, 5, 3, 4, -1, -1, 4, 4, 1, 1 }; + return s_maxBodyID[prof]; + } + //BMLogger.LogError("EC_ProfConfigs: GetMaxBodyID: prof: {0} is not exist", prof); + return -1; + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_ProfConfigs.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_ProfConfigs.cs.meta new file mode 100644 index 0000000000..311fa84a47 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_ProfConfigs.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 642d432c42e2d4929aa9b4b989d5334e \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_Skill.cs b/Assets/PerfectWorld/Scripts/Managers/EC_Skill.cs index e737f4f1f7..6266bf6d04 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_Skill.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_Skill.cs @@ -148,7 +148,6 @@ namespace BrewMonster if (m_bCooling) { - // In cooling state m_iCoolCnt -= tickTime; if (m_iCoolCnt <= 0) { @@ -195,6 +194,7 @@ namespace BrewMonster // iTotalTime: total cooling time, 0 means to use cooling time in database public void StartCooling(int iTotalTime, int iStartCnt) { + BMLogger.LogError($"StartCooling iTotalTime={iTotalTime}, iStartCnt={iStartCnt}"); m_iCoolTime = iTotalTime != 0 ? iTotalTime : GetCoreCoolingTime(); m_iCoolCnt = iStartCnt; m_bCooling = true; @@ -394,11 +394,6 @@ namespace BrewMonster return m_pSkillCore != null ? m_pSkillCore.GetRequiredLevel() : 0; } - public int GetRequiredSp() - { - return m_pSkillCore != null ? m_pSkillCore.GetRequiredSp() : 0; - } - public int GetRequiredBook() { return m_pSkillCore != null ? m_pSkillCore.GetRequiredBook() : 0; @@ -409,11 +404,6 @@ namespace BrewMonster return m_pSkillCore != null ? m_pSkillCore.GetRequiredSkill() : new SkillArrayWrapper(new List()); }*/ - public int GetRequiredMoney() - { - return m_pSkillCore != null ? m_pSkillCore.GetRequiredMoney() : 0; - } - /* public int GetRequiredItem() { return m_pSkillCore != null ? m_pSkillCore.GetItemCost() : 0; diff --git a/Assets/PerfectWorld/Scripts/Move/CECPlayer.Task.cs b/Assets/PerfectWorld/Scripts/Move/CECPlayer.Task.cs index 2f8db1fcc7..ede37f569b 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECPlayer.Task.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECPlayer.Task.cs @@ -3,10 +3,12 @@ namespace BrewMonster partial class CECPlayer { - protected int m_iMoneyCnt; // Amount of money the player has + protected uint m_iMoneyCnt; // Amount of money the player has protected int m_iMaxMoney; - public int GetMoneyAmount() { return m_iMoneyCnt; } + public uint GetMoneyAmount() { return m_iMoneyCnt; } public int GetMaxMoneyAmount() { return m_iMaxMoney; } + public void SetMoneyAmount(uint iMoneyCnt) { m_iMoneyCnt = iMoneyCnt; } + public byte GetShapeMask() { // restore the original data from 8~15 bit diff --git a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs index 36dfb23267..04b76b0d7e 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs @@ -94,7 +94,7 @@ namespace BrewMonster public MOVECONST m_MoveConst; // Const used when moving control public Move_Mode m_MoveMode; - public MOVECONST[] aMoveConsts = new MOVECONST[PROFESSION.NUM_PROFESSION * GENDER.NUM_GENDER] + public MOVECONST[] aMoveConsts = new MOVECONST[(int)PROFESSION.NUM_PROFESSION * GENDER.NUM_GENDER] { // ÎäÏÀ // fStepHei fMinAirHei fMinWaterHei fShoreDepth fWaterSurf @@ -135,7 +135,7 @@ namespace BrewMonster new MOVECONST(0.8f, 1.6f, 0.3f, 1.5f, 0.55f), }; - public A3DVECTOR3[] aExts = new A3DVECTOR3[PROFESSION.NUM_PROFESSION * GENDER.NUM_GENDER] + public A3DVECTOR3[] aExts = new A3DVECTOR3[(int)PROFESSION.NUM_PROFESSION * GENDER.NUM_GENDER] { new A3DVECTOR3(0.4f, 0.9f, 0.4f), // ÎäÏÀ new A3DVECTOR3(0.3f, 0.85f, 0.3f), @@ -448,6 +448,10 @@ namespace BrewMonster { return m_PlayerInfo; } + // Get basic properties + public ROLEBASICPROP GetBasicProps() { return m_BasicProps; } + // Get extend properties + public ROLEEXTPROP GetExtendProps() { return m_ExtProps; } protected override void Update() { base.Update(); @@ -875,12 +879,6 @@ namespace BrewMonster //return iLevel * iLevel * 500; } - // Get basic properties - public ROLEBASICPROP GetBasicProps() - { - return m_BasicProps; - } - public override void TurnFaceTo(int idTarget, float dwTime = 200) { if (idTarget != 0) @@ -1144,6 +1142,9 @@ namespace BrewMonster return false; } + public CECSkill GetCurSkill() { return m_pCurSkill; } + public bool IsHangerOn() { return m_bHangerOn; } + public bool PlaySkillCastActionWithName(int idSkill, string szActName, bool bNoFX/* =false */) { return m_pActionController != null @@ -1209,10 +1210,10 @@ namespace BrewMonster // 空中动作 / Air action string szActionMiddleName = null; if ((m_wingType == enumWingType.WINGTYPE_WING && IsFlying()) || - (m_iProfession == PROFESSION.PROF_ANGEL) || - (m_iProfession == PROFESSION.PROF_ARCHOR) || - (m_iProfession == PROFESSION.PROF_MONK) || - (m_iProfession == PROFESSION.PROF_GHOST)) + (m_iProfession == (int)PROFESSION.PROF_ANGEL) || + (m_iProfession == (int)PROFESSION.PROF_ARCHOR) || + (m_iProfession == (int)PROFESSION.PROF_MONK) || + (m_iProfession == (int)PROFESSION.PROF_GHOST)) { szActionMiddleName = "_空中翅膀"; // Air with wings / 空中翅膀 } @@ -1579,31 +1580,31 @@ namespace BrewMonster { bool bRet = false; - /* if (vPos.y < fWaterHei - m_MoveConst.fShoreDepth) - bRet = true; - else if (vPos.y < fWaterHei && fWaterHei - fGndHei > m_MoveConst.fShoreDepth) - bRet = true; - */ - // if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf - m_aabb.Extents.y) - // if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf + 0.01f) + /* if (vPos.y < fWaterHei - m_MoveConst.fShoreDepth) + bRet = true; + else if (vPos.y < fWaterHei && fWaterHei - fGndHei > m_MoveConst.fShoreDepth) + bRet = true; + */ + // if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf - m_aabb.Extents.y) + // if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf + 0.01f) - /* - if (vPos.y < fWaterHei - m_MoveConst.fShoreDepth) - bRet = true; - else if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf + 0.01f && fWaterHei - fGndHei > m_MoveConst.fShoreDepth) - bRet = true; - */ + /* + if (vPos.y < fWaterHei - m_MoveConst.fShoreDepth) + bRet = true; + else if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf + 0.01f && fWaterHei - fGndHei > m_MoveConst.fShoreDepth) + bRet = true; + */ - //@note : modify the water test. By Kuiwu[12/10/2005] - if (vPos.y + m_aabbServer.Extents.y= 0.2f ) - else if (vPos.y + m_aabbServer.Extents.y= 0.01f ) - { - bRet = true; - } + //@note : modify the water test. By Kuiwu[12/10/2005] + if (vPos.y + m_aabbServer.Extents.y < fWaterHei - m_MoveConst.fWaterSurf - 0.001f) + { + bRet = true; + } + //else if (vPos.y + m_aabb.Extents.y < fWaterHei- m_MoveConst.fWaterSurf + 1E-4f && vPos.y - fGndHei >= 0.2f ) + else if (vPos.y + m_aabbServer.Extents.y < fWaterHei - m_MoveConst.fWaterSurf + 1E-4f && vPos.y - fGndHei >= 0.01f) + { + bRet = true; + } return bRet; @@ -1613,8 +1614,6 @@ namespace BrewMonster public void SetAboutToDie(bool bFlag) { m_bAboutToDie = bFlag; } - public bool IsHangerOn() { return m_bHangerOn; } - // Show / hide wing public void ShowWing(bool bShow) { diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs index 5b979939c9..d44e949500 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs @@ -1409,27 +1409,31 @@ namespace CSNetwork.S2CCommand // public char data[1]; //}; + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct cmd_sevnpc_hello { public int id; }; + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct cmd_normal_attack { public byte pvp_mask; }; + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct cmd_select_target { public int id; }; - + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct cmd_sevnpc_serve { public int service_type; public uint len; }; + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct accept_task_CONTENT { public int idTask; @@ -1437,16 +1441,32 @@ namespace CSNetwork.S2CCommand public int idRefreshItem; }; + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct SevReturnTaskCONTENT { public int idTask; public int iChoice; } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct SevTaskMatterCONTENT { public int idTask; } + public struct NPCSevMakeItemCONTENT + { + public int idSkill; + public int idItem; + public uint dwCount; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct SevLearnSkillCONTENT + { + public int idSkill; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct cmd_sevnpc_serve2 { public int service_type; diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs index 5a93d1fb43..705cfde58e 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs @@ -369,7 +369,7 @@ namespace CSNetwork.C2SCommand }; return SerializeCommand(CommandID.PICKUP, cmd); } - public static Octets CreateCheckSecurityPassWd(string password) + public static Octets c2s_SendCmdOpenFashionTrash(string password) { // Calculate password length (similar to C++ strlen) uint passwdSize = 0; @@ -394,11 +394,11 @@ namespace CSNetwork.C2SCommand return octets; } - public static Octets CreateQueryPlayerCash() + public static Octets c2s_SendCmdQueryCashInfo() { return SerializeCommand(CommandID.QUERY_CASH_INFO); } - public static Octets CreateEquipItem(byte iIvtrIdx, byte iEquipIdx) + public static Octets c2s_SendCmdEquipItem(byte iIvtrIdx, byte iEquipIdx) { var cmd = new CMD_EquipItem { @@ -408,7 +408,7 @@ namespace CSNetwork.C2SCommand return SerializeCommand(CommandID.EQUIP_ITEM, cmd); } - public static Octets CreateGetInventoryDetail(byte byPackage) + public static Octets c2s_SendCmdGetIvtrDetailData(byte byPackage) { var cmd = new CMD_GetInventoryDetail { @@ -417,7 +417,7 @@ namespace CSNetwork.C2SCommand return SerializeCommand(CommandID.GET_IVTR_DETAIL, cmd); } - public static Octets CreateReviveBase(int param) + public static Octets c2s_SendCmdReviveVillage(int param) { var cmd = new cmd_revive { @@ -425,7 +425,7 @@ namespace CSNetwork.C2SCommand }; return SerializeCommand(CommandID.REVIVE_VILLAGE, cmd); } - public static Octets CreateReviveItem(int param) + public static Octets c2s_SendCmdReviveItem(int param) { var cmd = new cmd_revive { @@ -620,6 +620,20 @@ namespace CSNetwork.C2SCommand return SerializeCommand(CommandID.SEVNPC_SERVE, cmd, content); } + public static Octets CreateNPCSevLearnSkillCmd(int idSkill) + { + var cmd = new cmd_sevnpc_serve + { + service_type = NPC_service_type.GP_NPCSEV_LEARN, + len = (uint)Marshal.SizeOf() + }; + SevLearnSkillCONTENT content = new SevLearnSkillCONTENT() + { + idSkill = idSkill + }; + return SerializeCommand(CommandID.SEVNPC_SERVE, cmd, content); + } + public static Octets CreateNPCSevBuyCmd(int itemNum, CSNetwork.C2SCommand.npc_trade_item[] items) { if (itemNum <= 0 || items == null || items.Length < itemNum) @@ -689,6 +703,25 @@ namespace CSNetwork.C2SCommand return octets; } + + public static Octets CreateNPCSevMakeItemCmd(int idSkill, int idItem, uint dwCount) + { + var cmd = new cmd_sevnpc_serve + { + service_type = NPC_service_type.GP_NPCSEV_MAKEITEM, + len = (uint)Marshal.SizeOf() + }; + + NPCSevMakeItemCONTENT content = new NPCSevMakeItemCONTENT() + { + idSkill = idSkill, + idItem = idItem, + dwCount = dwCount + }; + + return SerializeCommand(CommandID.SEVNPC_SERVE, cmd, content); + } + public static Octets CreateEmoteActionCmd(int wPose) { cmd_emote_action pCmd = new cmd_emote_action() @@ -747,7 +780,7 @@ namespace CSNetwork.C2SCommand return SerializeCommand(CommandID.AUTO_TEAM_SET_GOAL, pCmd); } - public static Octets c2s_CmdGatherMaterial(int idMatter, int iToolPack, int iToolIdx, int idTool, int idTask) + public static Octets c2s_SendCmdGatherMaterial(int idMatter, int iToolPack, int iToolIdx, int idTool, int idTask) { var cmd = new cmd_gather_material { diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs index 693d78415a..61b616ef62 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs @@ -1369,6 +1369,30 @@ namespace CSNetwork.GPDataType public byte byPackage; public byte bySlot; } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_produce_start + { + public ushort use_time; + public ushort count; + public int type; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_produce_once + { + public int type; + public uint amount; + public uint slot_amount; + public byte where; // Which package: 0 standard, 2 trash, 1 equip + public byte index; // Which slot in that package + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_produce_null + { + public int type; + } [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct info_matter { @@ -1584,7 +1608,19 @@ namespace CSNetwork.GPDataType { return (id & 0x80000000) != 0 && (id & 0x40000000) == 0; } + public static string ReplacePercentD(string fmt, params object[] args) + { + if (string.IsNullOrEmpty(fmt) || args == null || args.Length == 0) + return fmt; + for (int i = 0; i < args.Length; i++) + { + int idx = fmt.IndexOf("%d", StringComparison.Ordinal); + if (idx < 0) break; // hết %d + fmt = fmt.Substring(0, idx) + args[i]?.ToString() + fmt.Substring(idx + 2); + } + return fmt; + } public static bool ISMONEYTID(int tid) { return tid == 3044; @@ -2121,6 +2157,7 @@ namespace CSNetwork.GPDataType }; [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_object_takeoff { public int object_id; @@ -2137,5 +2174,26 @@ namespace CSNetwork.GPDataType { public byte is_active; }; + public struct cmd_reincarnation_tome_info + { + public int tome_exp; + public char tome_active; // 1����0δ���� + public int count; + public struct _entry + { + public int level; + public int timestamp; + public int exp; + }; + public _entry[] records; + public bool CheckValid(int buf_size, out int sz) + { sz = 0; + if (count < 0) + return false; + sz = Marshal.SizeOf() - Marshal.SizeOf<_entry[]>(); + sz += count * Marshal.SizeOf<_entry>(); + return buf_size >= sz; + } + }; } diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index f49163892e..adef4669ff 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -1,4 +1,4 @@ -using BrewMonster; +using BrewMonster; using BrewMonster.Common; using BrewMonster.Managers; using BrewMonster.Network; @@ -226,64 +226,64 @@ namespace CSNetwork SendProtocol(gamedatasendRequest); } - public void RequestInventoryAsync(byte byPackage, Action callback) + public void c2s_SendCmdGetIvtrDetailData(byte byPackage, Action callback) { gamedatasend gamedatasendRequest = new gamedatasend(); - gamedatasendRequest.Data = CSNetwork.C2SCommand.C2SCommandFactory.CreateGetInventoryDetail(byPackage); + gamedatasendRequest.Data = CSNetwork.C2SCommand.C2SCommandFactory.c2s_SendCmdGetIvtrDetailData(byPackage); SendProtocol(gamedatasendRequest, callback); } - public void RequestQueryPlayerCash() + public void c2s_SendCmdQueryCashInfo() { gamedatasend gamedatasendRequest = new gamedatasend(); - gamedatasendRequest.Data = C2SCommandFactory.CreateQueryPlayerCash(); + gamedatasendRequest.Data = C2SCommandFactory.c2s_SendCmdQueryCashInfo(); SendProtocol(gamedatasendRequest); } - public void RequestCheckSecurityPassWd(string password) + public void c2s_SendCmdOpenFashionTrash(string password) { gamedatasend gamedatasendRequest = new gamedatasend(); - gamedatasendRequest.Data = C2SCommandFactory.CreateCheckSecurityPassWd(password); + gamedatasendRequest.Data = C2SCommandFactory.c2s_SendCmdOpenFashionTrash(password); SendProtocol(gamedatasendRequest); } - public void RequestEquipItem(byte iIvtrIdx, byte iEquipIdx, Action callback) + public void c2s_SendCmdEquipItem(byte iIvtrIdx, byte iEquipIdx, Action callback) { gamedatasend gamedatasendRequest = new gamedatasend(); - gamedatasendRequest.Data = CSNetwork.C2SCommand.C2SCommandFactory.CreateEquipItem(iIvtrIdx, iEquipIdx); + gamedatasendRequest.Data = CSNetwork.C2SCommand.C2SCommandFactory.c2s_SendCmdEquipItem(iIvtrIdx, iEquipIdx); SendProtocol(gamedatasendRequest, callback); } - public void RequestReviveBase(int param = 0) + public void c2s_SendCmdReviveVillage(int param = 0) { gamedatasend gamedatasendRequest = new gamedatasend(); - gamedatasendRequest.Data = C2SCommandFactory.CreateReviveBase(param); + gamedatasendRequest.Data = C2SCommandFactory.c2s_SendCmdReviveVillage(param); SendProtocol(gamedatasendRequest); } - public void RequestReviveItem(int param = 0) + public void c2s_SendCmdReviveItem(int param = 0) { gamedatasend gamedatasendRequest = new gamedatasend(); - gamedatasendRequest.Data = C2SCommandFactory.CreateReviveBase(param); + gamedatasendRequest.Data = C2SCommandFactory.c2s_SendCmdReviveVillage(param); SendProtocol(gamedatasendRequest); } public void RequestReviveByPlayer(int param = 0) { gamedatasend gamedatasendRequest = new gamedatasend(); - gamedatasendRequest.Data = C2SCommandFactory.CreateReviveBase(param); + gamedatasendRequest.Data = C2SCommandFactory.c2s_SendCmdReviveVillage(param); SendProtocol(gamedatasendRequest); } - public void RequestMallShopping(uint count, CMD_MallShopping.goods[] goodsArray) + public void c2s_SendCmdMallShopping(uint count, CMD_MallShopping.goods[] goodsArray) { gamedatasend gamedatasendRequest = new gamedatasend(); gamedatasendRequest.Data = CSNetwork.C2SCommand.C2SCommandFactory.CreateGetMallShopping(count, goodsArray); SendProtocol(gamedatasendRequest); } - public void c2s_CmdGatherMaterial(int idMatter, int iToolPack, int idToolIndex, int idTool, int idTask) + public void c2s_SendCmdGatherMaterial(int idMatter, int iToolPack, int idToolIndex, int idTool, int idTask) { gamedatasend gamedatasendRequest = new gamedatasend(); - gamedatasendRequest.Data = CSNetwork.C2SCommand.C2SCommandFactory.c2s_CmdGatherMaterial(idMatter, iToolPack, idToolIndex, idTool, idTask); + gamedatasendRequest.Data = CSNetwork.C2SCommand.C2SCommandFactory.c2s_SendCmdGatherMaterial(idMatter, iToolPack, idToolIndex, idTool, idTask); SendProtocol(gamedatasendRequest); } @@ -515,7 +515,7 @@ namespace CSNetwork break; case CommandID.PICKUP_ITEM: case CommandID.HOST_OBTAIN_ITEM: - // case CommandID.PRODUCE_ONCE: + case CommandID.PRODUCE_ONCE: case CommandID.TASK_DELIVER_ITEM: EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_PICKUPITEM, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); @@ -586,8 +586,17 @@ namespace CSNetwork break; case CommandID.ERROR_MESSAGE: - _logger.Info($"### GameDataSend: ERROR_MESSAGE: {BitConverter.ToInt32(pDataBuf, 0)}"); + { + int errRaw = BitConverter.ToInt32(pDataBuf, 0); + // Note: _logger may be configured as a file logger via SetLogPath(), so also log to console for visibility. + _logger.Info($"### GameDataSend: ERROR_MESSAGE: {errRaw}"); +#if UNITY_EDITOR + BMLogger.LogError($"### GameDataSend: ERROR_MESSAGE: {errRaw}"); +#endif cmd_error_msg pCmd = GPDataTypeHelper.FromBytes(pDataBuf); +#if UNITY_EDITOR + BMLogger.LogError($"### GameDataSend: ERROR_MESSAGE parsed iMessage={pCmd.iMessage}"); +#endif if (pCmd.iMessage != 0) { @@ -642,6 +651,7 @@ namespace CSNetwork } break; + } case CommandID.SELECT_TARGET: case CommandID.UNSELECT: @@ -673,6 +683,16 @@ namespace CSNetwork break; case CommandID.NPC_GREETING: { + // If this greeting is from the skill-learn NPC, record it (C++ skill dialog relies on this). + try + { + cmd_npc_greeting greet = GPDataTypeHelper.FromBytes(pDataBuf); + CECHostSkillModel.Instance.OnNpcGreeting(greet.idObject); + } + catch (Exception ex) + { + _logger.Log(LogType.Warning, $"Failed to parse NPC_GREETING payload: {ex.Message}"); + } EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_NPCGREETING, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); break; } @@ -810,7 +830,26 @@ namespace CSNetwork case CommandID.FLYSWORD_TIME: EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_FLYSWORDTIME, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); break; + case CommandID.PRODUCE_START: + case CommandID.PRODUCE_END: + case CommandID.PRODUCE_NULL: + // Post MSG_HST_PRODUCEITEM message with command ID as parameter (matches C++ behavior) + EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_PRODUCEITEM, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); + break; + + case CommandID.LEARN_SKILL: + BMLogger.LogError("### GameDataSend: LEARN_SKILL"); + EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_LEARNSKILL, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); + break; + default: +#if UNITY_EDITOR + if (isDebug) + { + BMLogger.LogError($"### GameDataSend: Unhandled CMDID {pCmdHeader} (payloadBytes={pDataBuf?.Length ?? 0})"); + } +#endif + break; } } @@ -1251,6 +1290,12 @@ namespace CSNetwork gamedatasend.Data = C2SCommandFactory.CreateNPCSevWaypointCmd(NPC_service_type.GP_NPCSEV_WAYPOINT, 0); SendProtocol(gamedatasend); } + public void c2s_SendCmdNPCSevMakeItem(int idSkill, int idItem, uint dwCount) + { + gamedatasend gamedatasend = new gamedatasend(); + gamedatasend.Data = C2SCommandFactory.CreateNPCSevMakeItemCmd(idSkill, idItem, dwCount); + SendProtocol(gamedatasend); + } public void GetRoleBaseInfo(int iNumRole, List aRoleIDs) { int iNumLimit = 128; @@ -1323,6 +1368,15 @@ namespace CSNetwork SendProtocol(gamedatasend); } + public void c2s_SendCmdNPCSevLearnSkill(int idSkill) + { + gamedatasend gamedatasend = new gamedatasend(); + gamedatasend.Data = C2SCommandFactory.CreateNPCSevLearnSkillCmd(idSkill); + BMLogger.LogError("HoangDev : c2s_SendCmdNPCSevLearnSkill gamedatasend.Data : " + gamedatasend.Data.Size); + BMLogger.LogError("HoangDev : c2s_SendCmdNPCSevLearnSkill idSkill : " + idSkill); + SendProtocol(gamedatasend); + } + public void c2s_SendCmdNPCSevBuy(int itemNum, C2SCommand.npc_trade_item[] items) { if (itemNum <= 0 || items == null || items.Length < itemNum) diff --git a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs index 5c6bbb11c3..04382a78c6 100644 --- a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs @@ -42,7 +42,7 @@ namespace BrewMonster.Network public void OnValidate() { - if (isDebg != lastDebug) + if (_gameSession != null && isDebg != lastDebug) { _gameSession.IsDebug = isDebg; lastDebug = isDebg; @@ -183,11 +183,11 @@ namespace BrewMonster.Network } public static void RequestInventoryAsync(byte byPackage, Action callback = null) { - Instance._gameSession.RequestInventoryAsync(byPackage, callback); + Instance._gameSession.c2s_SendCmdGetIvtrDetailData(byPackage, callback); } public static void RequesrQueryPlayerCash() { - Instance._gameSession.RequestQueryPlayerCash(); + Instance._gameSession.c2s_SendCmdQueryCashInfo(); } public static void RequestDropEquipItem(byte index) { @@ -195,7 +195,7 @@ namespace BrewMonster.Network } public static void RequestEquipItemAsync(byte iIvtrIdx, byte iEquipIdx, Action callback = null) { - Instance._gameSession.RequestEquipItem(iIvtrIdx, iEquipIdx, callback); + Instance._gameSession.c2s_SendCmdEquipItem(iIvtrIdx, iEquipIdx, callback); } public static void RequestPickupItem(int idItem, int tid) { @@ -211,7 +211,7 @@ namespace BrewMonster.Network } public static void RequestCheckSecurityPassWd(string password) { - Instance._gameSession.RequestCheckSecurityPassWd(password); + Instance._gameSession.c2s_SendCmdOpenFashionTrash(password); } public static void c2s_SendCmdContinueAction() { @@ -241,7 +241,7 @@ namespace BrewMonster.Network goods_pos = good_pos } }; - Instance._gameSession.RequestMallShopping(count, goods); + Instance._gameSession.c2s_SendCmdMallShopping(count, goods); } public static void RequestAllInventoriesAsync(Action callback = null, params byte[] packages) { @@ -265,7 +265,11 @@ namespace BrewMonster.Network RequestInventoryAsync(p, onOneDone); } } - + public static void c2s_SendCmdNPCSevLearnSkill(int idSkill) + { + BMLogger.LogError("c2s_SendCmdNPCSevLearnSkill"); + Instance._gameSession.c2s_SendCmdNPCSevLearnSkill(idSkill); + } public static void c2s_CmdNPCSevHello(int nid) { Instance._gameSession.CmdCache.SendCmdNPCSevHello(nid); @@ -295,6 +299,11 @@ namespace BrewMonster.Network Instance._gameSession.c2s_SendCmdNPCSevWaypoint(); } + public static void c2s_CmdNPCSevMakeItem(int idSkill, int idItem, uint dwCount) + { + Instance._gameSession.c2s_SendCmdNPCSevMakeItem(idSkill, idItem, dwCount); + } + public void GetFactionInfo(int iNumFaction, int[] aFactinoIDs) { m_stubbornFactionInfoSender.Add(iNumFaction, aFactinoIDs); @@ -365,13 +374,12 @@ namespace BrewMonster.Network } public static void c2s_CmdGatherMaterial(int idMatter, int iToolPack, int idToolIndex, int idTool, int idTask) { - Instance._gameSession.c2s_CmdGatherMaterial(idMatter, iToolPack, idToolIndex, idTool, idTask); + Instance._gameSession.c2s_SendCmdGatherMaterial(idMatter, iToolPack, idToolIndex, idTool, idTask); } #endregion public static void GetRoleBaseInfo(int iNumRole, List aRoleIDs) { - BMLogger.Log($"GetRoleBaseInfo: {iNumRole} {string.Join(", ", aRoleIDs)}"); Instance._gameSession.GetRoleBaseInfo(iNumRole, aRoleIDs); } diff --git a/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs b/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs index e12cba7f0c..5d55628c80 100644 --- a/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs +++ b/Assets/PerfectWorld/Scripts/Players/EC_ElsePlayer.cs @@ -248,7 +248,6 @@ namespace BrewMonster SetServerPos(Cmd.dest); float fDist = m_vMoveDir.Normalize(); - BrewMonster.BMLogger.Log($"HoangDev : {fDist} : {MAX_LAGDIST} || {m_fMoveSpeed}"); if (fDist >= MAX_LAGDIST || m_fMoveSpeed < 0.01f) { diff --git a/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs b/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs index f8f39a97aa..abbbe8f79d 100644 --- a/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs +++ b/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs @@ -5,6 +5,7 @@ using ModelRenderer.Scripts.GameData; using System; using System.Collections.Generic; using System.Runtime.InteropServices; +using UnityEngine; namespace BrewMonster.Scripts.Skills { @@ -24,6 +25,7 @@ namespace BrewMonster.Scripts.Skills set => instance = value; } + ElementSkill s = null; Dictionary m_allProfSkills = new Dictionary(); Dictionary> m_allRankProfSkills = new Dictionary>(); private HashSet m_allProfNPCs = new HashSet(); @@ -32,19 +34,85 @@ namespace BrewMonster.Scripts.Skills private Dictionary m_godRootMap = new Dictionary(); private Dictionary m_baseRootMap = new Dictionary(); private int m_skillLearnNPCNID; + private bool m_bReceivedNPCGreeting; private bool m_bInitialized; private Octets m_npcListData; - /// - /// 获取当前职业的全部技能映射(阶位 -> 技能列表) / Get rank-to-skills map for current profession. - /// +#if UNITY_EDITOR + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] + static void BeforeSceneLoad() + { + BMLogger.LogError("CECHostSkillModel BeforeSceneLoad Reset"); + Instance = null; + } +#endif public IReadOnlyDictionary> GetAllRankProfSkills() { return m_allRankProfSkills; } + public CECHostSkillModel() + { + m_skillLearnNPCNID = 0; + m_bReceivedNPCGreeting = false; + m_bInitialized = false; + } + // NPC技能学习相关 / Skill-learn NPC helpers + public bool IsSkillLearnNPC(int nid) => nid == m_skillLearnNPCNID; + public bool IsSkillLearnNPCExsit() => m_skillLearnNPCNID != 0; + public bool IsReceivedNPCGreeting() => m_bReceivedNPCGreeting; + public void SetReceivedNPCGreeting(bool received) => m_bReceivedNPCGreeting = received; + + public void OnNpcGreeting(int idObject) + { + // cmd_npc_greeting.idObject is the NPC/player id (nid) + if (idObject == m_skillLearnNPCNID && m_skillLearnNPCNID != 0) + { + m_bReceivedNPCGreeting = true; + //BMLogger.LogError($"[Skill] Received NPC_GREETING from skill-learn NPC nid={m_skillLearnNPCNID}"); + } + } + + public void SendHelloToSkillLearnNPC() + { + //BMLogger.LogError($"[Skill] Sent SEVNPC_HELLO to skill-learn NPC nid={m_skillLearnNPCNID}"); + + if (m_skillLearnNPCNID != 0) + { + // C++: g_pGame->GetGameSession()->c2s_CmdNPCSevHello(m_skillLearnNPCNID); + BrewMonster.Network.UnityGameSession.c2s_CmdNPCSevHello(m_skillLearnNPCNID); + //BMLogger.LogError($"[Skill] Sent SEVNPC_HELLO to skill-learn NPC nid={m_skillLearnNPCNID}"); + } + } + public enumSkillLearnedState GetSkillLearnedState(int skillID) + { + CECSkill pSkill = CECGameRun.Instance.GetHostPlayer().GetNormalSkill(skillID); + if (pSkill != null) + { + if (pSkill.GetSkillLevel() < pSkill.GetMaxLevel()) + { + return enumSkillLearnedState.SKILL_LEARNED; + } + else + { + return enumSkillLearnedState.SKILL_FULL; + } + } + else + { + if (ElementSkill.IsOverridden((uint)skillID)) + { + return enumSkillLearnedState.SKILL_OVERRIDDEN; + } + else + { + return enumSkillLearnedState.SKILL_NOT_LEARNED; + } + } + } public void Initialize() { + //BMLogger.LogError("HoangDev CECHostSkillModel Initialize called"); // Çå¿ÕËùÓм¼ÄÜ£¬·ÀÖ¹ÒòΪ¶à¸ö½ÇÉ«µÇ¼µ¼ÖÂÖØ¸´¼ÓÔØ¼¼ÄÜ Release(); @@ -61,9 +129,10 @@ namespace BrewMonster.Scripts.Skills } public void ProcessServiceList() { + //BMLogger.LogError("HoangDev: ProcessServiceList"); if (m_npcListData == null) { - BMLogger.LogWarning("CECHostSkillModel::ProcessServiceList, m_npcListData is null."); + BMLogger.LogError("CECHostSkillModel::ProcessServiceList, m_npcListData is null."); return; } if (m_npcListData.Size > 0) @@ -87,17 +156,21 @@ namespace BrewMonster.Scripts.Skills npcList.list[z] = GPDataTypeHelper.FromBytes(bodyBytes, offset); offset += NpcEntrySize; } - + //BMLogger.LogError("ProcessServiceList npcList.count:" + npcList.count); + //BMLogger.LogError("ProcessServiceList m_allProfNPCs.count:" + m_allProfNPCs.Count); int i; for (i = 0; i < npcList.count; i++) { int tid = npcList.list[i].tid; - + //BMLogger.LogError("ProcessServiceList tid:" + tid); if (m_allProfNPCs.Contains(tid)) { + //BMLogger.LogError("m_skillLearnNPCNID : " + m_skillLearnNPCNID); + //BMLogger.LogError("npcList.list[i].nid : " + npcList.list[i].nid); if (m_skillLearnNPCNID != npcList.list[i].nid) { m_skillLearnNPCNID = npcList.list[i].nid; + m_bReceivedNPCGreeting = false; // new NPC -> need greeting again SetCurServiceSkills(tid); var change = new CECSkillPanelChange(CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_NPC, 0, 0); //NotifyObservers(change); @@ -113,9 +186,10 @@ namespace BrewMonster.Scripts.Skills var change = new CECSkillPanelChange(CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_NPC, 0, 0); //NotifyObservers(change); } - m_npcListData.Clear(); } + //BMLogger.LogError("HoangDev: m_npcListData.Size :"+ m_npcListData.Size); + } private readonly HashSet m_curServiceSkills = new HashSet(); public string GetSkillIcon(int skillID) @@ -125,6 +199,7 @@ namespace BrewMonster.Scripts.Skills } public void SetCurServiceSkills(int tid) { + //BMLogger.LogError("SetCurServiceSkills " + tid); m_curServiceSkills.Clear(); if (tid == 0) return; @@ -138,7 +213,6 @@ namespace BrewMonster.Scripts.Skills return; var npcEssence = (NPC_ESSENCE)dataprt; - // Get skill service block from id_skill_service var dataprt2 = pDB.get_data_ptr(npcEssence.id_skill_service, ID_SPACE.ID_SPACE_ESSENCE, ref dt); if (dataprt2 == null) return; @@ -148,8 +222,74 @@ namespace BrewMonster.Scripts.Skills foreach (int skillId in skillService.id_skills) { if (skillId != 0) - m_curServiceSkills.Add(skillId); + { m_curServiceSkills.Add(skillId); } } + //BMLogger.LogError("SetCurServiceSkills m_curServiceSkills count:" + m_curServiceSkills.Count); + //BMLogger.LogError("SetCurServiceSkills skillService.id_skills count:" + skillService.id_skills.Length); + } + public enumSkillFitLevelState GetSkillFitLevel(int skillID) + { + if (!m_allProfSkills.ContainsKey(skillID)) + { + BMLogger.LogError("skillID not exist in m_allProfSkills"); + return default; + } + int maxLevel = CECGameRun.Instance.GetHostPlayer().GetMaxLevelSofar(); + int rank = CECGameRun.Instance.GetHostPlayer().GetBasicProps().iLevel2; + int realmLevel = CECGameRun.Instance.GetHostPlayer().GetRealmLevel(); + + return GetSkillFitLevel(skillID, maxLevel, rank, realmLevel); + } + enumSkillFitLevelState GetSkillFitLevel(int skillID, int maxLevel, int rank, int realmLevel) + { + if (!m_allProfSkills.ContainsKey(skillID)) + { + BMLogger.LogError("skillID not exist in m_allProfSkills"); + return default; + } + + int skillLevel = 1; //½«ÒªÑ§Ï°µÄ¼¼Äܼ¶±ð + CECSkill pSkill = CECGameRun.Instance.GetHostPlayer().GetNormalSkill(skillID); + if (pSkill != null) + { + skillLevel = pSkill.GetSkillLevel() + 1; + if (skillLevel > pSkill.GetMaxLevel()) + { + return enumSkillFitLevelState.SKILL_NOT_FIT_LEVEL; + } + } + + s = ElementSkill.Create((uint)skillID, skillLevel); + + if (s.GetRequiredLevel() > maxLevel) + { + return enumSkillFitLevelState.SKILL_NOT_FIT_LEVEL; + } + // ÐÞÕæµÈ¼¶²»¹» + CECTaoistRank curTaoistRank = CECTaoistRank.GetTaoistRank(rank); + CECTaoistRank reqTaoistRank = CECTaoistRank.GetTaoistRank(s.GetRank()); + if ((curTaoistRank.IsEvilRank() && reqTaoistRank.IsGodRank()) || + (curTaoistRank.IsGodRank() && reqTaoistRank.IsEvilRank()) || + (curTaoistRank.GetID() < reqTaoistRank.GetID())) + { + return enumSkillFitLevelState.SKILL_NOT_FIT_LEVEL; + } + // ¾³½ç²»¹» + if (s.GetRequiredRealmLevel() > realmLevel) + { + return enumSkillFitLevelState.SKILL_NOT_FIT_LEVEL; + } + + return enumSkillFitLevelState.SKILL_FIT_LEVEL; + } + public int CheckLearnCondition(int skillID) + { + return CECGameRun.Instance.GetHostPlayer().CheckSkillLearnCondition(skillID, true); + } + public int GetRequiredBook(int skillID, int level) + { + int itemId = ElementSkill.GetRequiredBook((uint)skillID, level); + return itemId; } public void RecvNPCServiceList(Octets Data) { @@ -170,6 +310,24 @@ namespace BrewMonster.Scripts.Skills InitializeRootOfSkillTree(rootSkillID); } } + public int GetSkillCurrentLevel(int skillID) + { + if (!m_allProfSkills.ContainsKey(skillID)) + { + BMLogger.LogError("skillID not exist in m_allProfSkills"); + return 0; + } + + CECSkill pSkill = CECGameRun.Instance.GetHostPlayer().GetNormalSkill(skillID); + if (pSkill != null) + { + return pSkill.GetSkillLevel(); + } + else + { + return 0; + } + } private void InitializeRootOfSkillTree(int rootSkillID) { var skillRootMap = GetSkillRootMap(rootSkillID); @@ -229,7 +387,7 @@ namespace BrewMonster.Scripts.Skills { if (!m_allProfSkills.TryGetValue(skillID, out var skill)) { - throw new Exception($"Skill {skillID} not found in m_allProfSkills"); + BMLogger.LogError($"Skill {skillID} not found in m_allProfSkills"); } var juniors = skill.GetJunior(); @@ -262,6 +420,8 @@ namespace BrewMonster.Scripts.Skills DATA_TYPE dt = DATA_TYPE.DT_NPC_ESSENCE; elementdataman pDB = ElementDataManProvider.GetElementDataMan(); var map = pDB.GetAllDataTypeWithType(ID_SPACE.ID_SPACE_ESSENCE, dt); + //BMLogger.LogError("Hoang Dev map Count :" + map.Length); + foreach (var obj in map) { NPC_ESSENCE npcEssence = (NPC_ESSENCE)obj; @@ -276,7 +436,12 @@ namespace BrewMonster.Scripts.Skills { ElementSkill pSkill = ElementSkill.Create(skillService.id_skills[i], 1); - if (pSkill == null) return; + if (pSkill == null) + { + //BMLogger.LogError($"Hoang Dev pSkill is null for skill {i} :" + skillService.id_skills[i]); + continue; + } + if (pSkill.GetCls() == CECGameRun.Instance.GetHostPlayer().GetProfession()) { @@ -288,11 +453,12 @@ namespace BrewMonster.Scripts.Skills } if (profCorrect) { + //BMLogger.LogError("m_allProfNPCs.Add " + (int)npcEssence.id); m_allProfNPCs.Add((int)npcEssence.id); } + //BMLogger.LogError("Hoang Dev skillService.id_skills.Length :" + skillService.id_skills.Length); } } - } public void InitAllSkillsOfCurProf() { @@ -345,8 +511,7 @@ namespace BrewMonster.Scripts.Skills m_allRankProfSkills[pSkill.GetRank()].Add((int)curID); } } - BMLogger.LogError("CECHostSkillModel::InitAllSkillsOfCurProf: total prof skills = " + m_allRankProfSkills.Count); - // --- B3: Sắp xếp skill trong từng rank theo thứ tự hiển thị --- + foreach (var kvp in m_allRankProfSkills) { kvp.Value.Sort((lhs, rhs) => @@ -378,6 +543,7 @@ namespace BrewMonster.Scripts.Skills private void Release() { + //BMLogger.LogError("HoangDev CECHostSkillModel Release called"); m_allProfSkills.Clear(); // Dọn sạch tất cả dictionary / map @@ -400,6 +566,96 @@ namespace BrewMonster.Scripts.Skills CECSkill skill = new CECSkill(skillID, 1); return (skill.GetNameDisplay()); } + public bool CheckPreItem(int itemID) + { + return CECGameRun.Instance.GetHostPlayer().GetPack().FindItem(itemID) != -1; + } + public bool IsSkillServedByNPC(int skillID) + { + return m_curServiceSkills.Contains(skillID); + } + public int GetSkillSp(int skillID, int level) + { + if (!m_allProfSkills.ContainsKey(skillID)) + { + BMLogger.LogError("skillID not exist in m_allProfSkills"); + return 0; + } + + return ElementSkill.GetRequiredSp((uint)skillID, level); + } + public int GetSkillMoney(int skillID, int level) + { + if (!m_allProfSkills.ContainsKey(skillID)) + { + BMLogger.LogError("skillID not exist in m_allProfSkills"); + return 0; + } + + return ElementSkill.GetRequiredMoney((uint)skillID, level); + } + public Dictionary GetRequiredSkill(int skillID, int level) + { + Dictionary requiredSkill = new(); + + ElementSkill s = ElementSkill.Create((uint)skillID, level); + // giả định GetRequiredSkill() trả về List> hoặc IReadOnlyList<...> + Dictionary skills = s.GetRequiredSkill(); + if (skills == null || skills.Count == 0) + return null; + foreach (var skill in skills) + { + if (skill.Key != 0) + { + requiredSkill.Add(skill.Key, skill.Value); + } + } + + return requiredSkill; + } + public bool CheckPreSkillLevel(int skillID, int level) + { + if (GetSkillLearnedState(skillID) == enumSkillLearnedState.SKILL_OVERRIDDEN) + { + // Èç¹û¸ÃǰÌá¼¼Äܱ»¸²¸Ç£¬ÔòǰÌá¼¼ÄÜÒ»¶¨Âú×ã + return true; + } + return GetSkillCurrentLevel(skillID) >= level; + } + + // Called when a skill is learned / 当学习新技能后调用 + public void OnLearnSkill(int skillID, int skillLevel) + { + if (!m_allProfSkills.ContainsKey(skillID)) + { + return; + } + + // 检查学习新技能后是否有技能被覆盖 / Check if any skills are overridden after learning the new skill + bool newOverridden = false; + var juniors = GetJunior(skillID); + if (juniors.Count > 0) + { + newOverridden = true; + } + + if (newOverridden) + { + CECSkillPanelChange change = new CECSkillPanelChange( + CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_OVERRIDDEN, + skillID, + skillLevel); + EventBus.Publish(change); + } + else + { + CECSkillPanelChange change = new CECSkillPanelChange( + CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_LEVEL_UP, + skillID, + skillLevel); + EventBus.Publish(change); + } + } } public enum enumSkillFitLevelState @@ -422,7 +678,7 @@ namespace BrewMonster.Scripts.Skills SKILL_EVIL, // �ɼ��� / Immortal skill SKILL_GOD, // ħ���� / Demonic skill } - public class CECSkillPanelChange : CECObservableChange + public struct CECSkillPanelChange { public enum enumChangeMask { @@ -442,5 +698,4 @@ namespace BrewMonster.Scripts.Skills m_skillLevel = level; } } - } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs b/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs index 5b2399d2f1..8e1e01e415 100644 --- a/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs +++ b/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs @@ -133,6 +133,7 @@ namespace BrewMonster.Scripts.Skills public const byte FORM_BEASTIE = 2; //��С���� static SkillStub s; + static Skill skill; public static uint NextSkill(uint id = 0) { @@ -218,20 +219,40 @@ namespace BrewMonster.Scripts.Skills // ѧϰn������Ҫ�����Ҽ��� public virtual int GetRequiredLevel() { return 0; } // ѧϰn��������Ҫ�ļ��ܵ� - public virtual int GetRequiredSp() { return 0; } + public static int GetRequiredSp(uint id, int level) + { + skill = Skill.Create(id, level); + if (skill == null) + return 0; + + int ret = skill.GetRequiredSp(); + return ret; + } // ѧϰn����Ҫ�ļ����� public virtual int GetRequiredBook() { return 0; } // ѧϰ��Ҫ��Ǯ - public virtual int GetRequiredMoney() { return 0; } + public static int GetRequiredBook(uint id, int level) + { + skill = Skill.Create(id, level); + if (skill == null) + return 0; + + int ret = skill.GetRequiredBook(); + return ret; + } // ѧϰ���󾳽�ȼ�? public virtual int GetRequiredRealmLevel() { return 0; } - // ǰ�Ἴ�� + public virtual Dictionary GetRequiredSkill() => new Dictionary(); - // ��ʾ˳�� + public virtual int GetShowOrder() { return 0; } - // ���ü��ܼ��� + public virtual int SetLevel(int level) { return 0; } - // ������󼶱�? + + public static int SetLevel(uint id, int level) + { + return SkillWrapper.Instance.SetLevel(id, level); + } public virtual int GetMaxLevel() { return 0; } public static byte GetType(uint id) { @@ -313,5 +334,96 @@ namespace BrewMonster.Scripts.Skills } public virtual byte GetAllowForms() { return 0; } public virtual bool Interrupt() { return true; } + public static int GetRequiredMoney(uint id, int level) + { + skill = Skill.Create(id, level); + if (skill == null) + return 0; + + int ret = skill.GetRequiredMoney(); + return ret; + } + + // 学习技能条件检查 // Learning skill condition check + // 返回值 // Return values: + // 0: 成功 // Success + // 1: 技能点不够 // Not enough skill points + // 2: 等级不够 // Level not enough + // 3: 错误 // Error + // 4: 职业不匹配 // Profession mismatch + // 5: 技能ID // Skill ID error + // 6: 钱不够 // Not enough money + // 7: 阶级不符 // Rank mismatch + // 9: 前置技能级别不够 // Prerequisite skill level not enough + // 10: 熟练度不够 // Ability not enough + // 11: 被覆盖 // Overridden + // 12: 境界等级不够 // Realm level not enough + public static int LearnCondition(uint id, LearnRequirement info, int ilevel) + { + skill = Skill.Create(id, ilevel); + if (skill == null) + return 5; + + int ret = 0; + SkillWrapper wrapper = SkillWrapper.Instance; + + if (wrapper.IsOverridden(id)) + return 11; + + int srank, prank; + srank = skill.GetRank(); + prank = info.rank; + if (srank > prank) + ret = 7; + else + { + srank = (int)(srank * 0.1); + prank = (int)(prank * 0.1); + if (srank != prank && srank != 0) + ret = 7; + } + + if (ilevel < 1 || ilevel > skill.GetMaxLevel()) + ret = 3; + else if (info.profession != skill.GetCls() && skill.GetCls() != 255) + ret = 4; + else if (info.level < skill.GetRequiredLevel()) + ret = 2; + + if (ret != 0) + { + return ret; + } + + if (info.sp < skill.GetRequiredSp()) + ret = 1; + else if (info.money < skill.GetRequiredMoney()) + ret = 6; + + var pre_skills = skill.GetRequiredSkill(); + foreach (var kvp in pre_skills) + { + uint pre_id = kvp.Key; + int pre_level = kvp.Value; + if (pre_id > 0 && wrapper.GetLevel(pre_id) < pre_level && !wrapper.IsOverridden(pre_id)) + { + ret = 9; + break; + } + } + + if (ilevel > 1) + { + skill.SetLevel(ilevel - 1); + int ability = skill.GetMaxability(); + if (ability > 0 && wrapper.GetAbility(id) < ability) + ret = 10; + } + + if (info.realm_level < skill.GetRequiredRealmLevel()) + ret = 12; + + return ret; + } } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Skills/SkillWrapper.cs b/Assets/PerfectWorld/Scripts/Skills/SkillWrapper.cs index 3950be8ad4..2118f3882d 100644 --- a/Assets/PerfectWorld/Scripts/Skills/SkillWrapper.cs +++ b/Assets/PerfectWorld/Scripts/Skills/SkillWrapper.cs @@ -56,5 +56,43 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.Skills } return false; } + + public int GetLevel(uint id) + { + if (map.TryGetValue(id, out PersistentData data)) + return data.level; + return 0; + } + + public int GetAbility(uint id) + { + if (map.TryGetValue(id, out PersistentData data)) + return data.ability; + return 0; + } + + public int SetAbility(uint id, int ability) + { + if (map.TryGetValue(id, out PersistentData data)) + { + int old = data.ability; + data.ability = ability; + map[id] = data; + return old; + } + return 0; + } + + public int SetLevel(uint id, int level) + { + if (map.TryGetValue(id, out PersistentData data)) + { + int old = data.level; + data.level = level; + map[id] = data; + return old; + } + return 0; + } } } diff --git a/Assets/PerfectWorld/Scripts/Skills/skill.cs b/Assets/PerfectWorld/Scripts/Skills/skill.cs index 059647e429..0f4f7da32c 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill.cs @@ -1,293 +1,300 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace BrewMonster.Scripts.Skills -{ - public class Range - { - /// 0=point 1=line 2=self sphere 3=target sphere 4=cone 5=self - public byte type; // 0�� 1�� 2������ 3Ŀ���� 4Բ׶�� 5���� - - public bool IsPoint() { return type == 0; } - public bool IsLine() { return type == 1; } - public bool IsSelfBall() { return type == 2; } - public bool IsTargetBall() { return type == 3; } - public bool IsSector() { return type == 4; } - public bool IsSelf() { return type == 5; } - public bool NoTarget() { return type == 2 || type == 5; } - - } - - // ռλ������ // Placeholder Skill class - public class Skill : ElementSkill - { - protected SkillStub stub; - protected PlayerWrapper player; - - protected uint id; - protected uint level; - - Skill(uint i, SkillStub s) - { - id = i; - stub = s; - player = new PlayerWrapper(); - } - public static Skill Create(uint id, int n) - { - SkillStub stub = SkillStub.GetStub(id); - if (stub == null) - return null; - Skill skill = new Skill(id, stub); - int max = skill.GetMaxLevel(); - if (n > max) - skill.SetLevel(max); - else - skill.SetLevel(n); - return skill; - } - public override int GetMaxLevel() { return stub.GetMaxLevel(); } - public override int SetLevel(int l) - { - uint tmp = level; - level = (uint)l; - return (int)tmp; - } - public override int GetItemCost() { return stub.itemcost; } - - public int GetLevel() { return (int)level; } - public PlayerWrapper GetPlayer() - { - return player; - } - public override int GetRank() { return stub.rank; } - public override bool IsInstant() { return stub.time_type == 1; } - - public override int GetCls() - { - return stub.GetCls(); - } - public override Dictionary GetJunior() - { - return stub.is_senior != 0 ? stub.pre_skills : new Dictionary(); - } - public override int GetRangeType() { return stub.GetRange().type; } - - public override int GetTargetType() - { - if (stub.restrict_corpse == 1) - return 2; - if (stub.restrict_corpse == 2) - return 3; - if (stub.type == (int)skill_type.TYPE_ATTACK || stub.type == (int)skill_type.TYPE_CURSE) - return 1; - if (stub.type == (int)skill_type.TYPE_BLESSPET) - return 4; - if (stub.GetRange().NoTarget()) - return 0; - return 1; - } - public override byte GetType() { return stub.type; } - public override int GetCommonCoolDown() { return stub.commoncooldown; } - - public override string GetIcon() - { - return stub.GetIcon(); - } - public override string GetName() { return stub.GetName(); } - public override float GetPrayRange(float range, float prayplus) - { - player.SetRange(range); - player.SetPrayrangeplus(prayplus); - if (stub.type == (int)skill_type.TYPE_ATTACK || stub.type == (int)skill_type.TYPE_CURSE) - { - if (stub.auto_attack) - { - float r = 0.3f * stub.GetPraydistance(this); - - if (r >= 1.0) - return stub.GetPraydistance(this) - 1.0f; - else - return (float)0.7 * stub.GetPraydistance(this); - } - else - return stub.GetPraydistance(this); - } - if (stub.type == (int)skill_type.TYPE_JUMP) - return stub.GetPraydistance(this); - if (stub.GetRange().NoTarget()) - return -1; - else - return stub.GetPraydistance(this); - } - public override int GetCoolingTime() { return stub.GetCoolingtime(this); } - - } - - - public abstract class SkillStub - { - public const int MIN_LEVEL = 1; - public const int MAX_LEVEL = 10; - - // Base info - public uint id; // Ψһ���ֱ�ʶ // Unique identifier - public int cls; // ְҵ // Class/Profession - public string name; // �������� // Skill name - public string nativename; // ������ // Native name - public string icon; // ����ͼ�� // Skill icon - public int max_level; // ������󼶱�? // Maximum level - public byte type; // �������? 1�������� 2�������� 3�����ٻ� 4���� 5���� // Skill type: 1-Normal 2-Special 3-Partner 4-Mount 5-Other - - // Execute condition - public bool allow_ride; // ������? // Allow while riding - public short attr; // ����������, 1������2��3ľ��4ˮ��5��6�� ��ѡһ Ĭ�ϣ������� // Attribute: 1-Metal 2-Earth 3-Wood 4-Water 5-Fire 6-Special (Choose one, default none) - public int rank; // ���漶�� // Rank - public int eventflag; // Event flag - public byte is_senior; // Senior flag - public bool is_inherent; // �������ܣ�����ѧ������ // Inherent skill, cannot be learned - public bool is_movingcast; // �ƶ�ʩ�� // Can cast while moving - public int npcdelay; // NPC delay - public int showorder; // Display order - public byte allow_forms; // Allowed forms - public int apcost; // AP cost - public int apgain; // AP gain - public byte doenchant; // Do enchant - public byte dobless; // Do bless - public int arrowcost; // Arrow cost - public Dictionary pre_skills; - - // Execute condition - public bool allow_land; // ½����Ч // Effective on land - public bool allow_air; // ������Ч // Effective in air - public bool allow_water; // ˮ����Ч // Effective in water - public bool notuse_in_combat; // ս��״̬������ // Cannot use in combat state - public int restrict_corpse; // ֻ��ʬ����Ч // Only effective on corpses - public bool restrict_change; // �Ƿ���Ա��� // Whether can transform - public bool restrict_attach; // �Ƿ���Ը��� // Whether can possess - public bool auto_attack; // ʹ�ú��Ƿ��Զ����� // Whether to auto attack after use - public byte time_type; // ˲������ // Instant cast type - public byte long_range; - public byte posdouble; // λ��ѡ�� // Position selection - public int clslimit; // ְҵ���� // Class restriction - - public int commoncooldown; // ������ȴmask bit0-4 ������ȴ0-4 bit5-9 ��Ʒ��ȴ0-4 - // Common cooldown mask bit0-4 skill cooldown 0-4 bit5-9 item cooldown 0-4 - public int commoncooldowntime; // ��ȴʱ�䣬��λ���� // Cooldown time in milliseconds - - public int itemcost; // �ͷ�ʱ������Ʒ >0��Ч // Item cost when casting, effective if >0 - - // ������� // Combo related - public int combosk_preskill; - public int combosk_interval; - public int combosk_nobreak; - - public string effect; - public string aerial_effect; - - public Range range; - public bool has_stateattack; - - public List restrict_weapons = new List(); - public static Dictionary map = new Dictionary(); - public static Dictionary GetMap() => map; - public static Dictionary> comboSkillMap = new Dictionary>(); - public static Dictionary> GetComboSkMap() => comboSkillMap; - - public static Dictionary> inheritSkillMap = new Dictionary>(); - -/*#if UNITY_EDITOR - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void OnPlay() - { - BMLogger.LogError("SkillStub OnPlay Reset"); - map = new Dictionary(); - comboSkillMap = new Dictionary>(); - inheritSkillMap = new Dictionary>(); - } -#endif*/ - public SkillStub(uint i) - { - id = i; - is_inherent = (false); - is_movingcast = (false); - itemcost = (0); - combosk_preskill = (0); - combosk_interval = (0); - combosk_nobreak = (0); - if (GetStub(id) == null) - { - GetMap().Add(id, this); - } - } - public static List GetInherentSkillList(uint cls) - { - return inheritSkillMap[cls]; - } - - public static SkillStub GetStub(uint i) - { - return GetMap().TryGetValue(i, out var stub) ? stub : null; - } - public int GetItemCost() { return itemcost; } - public static void InitStaticData() - { - var map = GetMap(); - foreach (var skill in map) - { - SkillStub sk = skill.Value; - if (sk.is_inherent) GetInherentSkillList((uint)sk.cls).Add(sk.id); - if (sk.combosk_preskill > 0) GetComboSkMap()[(uint)sk.combosk_preskill].Add(sk.id); - } - } - - public List GetPostComboSkill(uint id) - { - var m = GetComboSkMap(); - if (m.TryGetValue(id, out var list)) return list; - return null; - } - - // ����Ϊ��C++ת���Ľӿ� // The following methods are converted from C++ - public uint GetId() { return id; } - public int GetCls() { return cls; } - public string GetName() { return name; } - public string GetIcon() { return icon; } - public int GetMaxLevel() { return max_level; } - public Range GetRange() { return range; } - public bool IsMovingSkill() { return is_movingcast; } - public byte GetType() { return type; } // ����System.Object.GetType // Hide System.Object.GetType - - // ����ʱ����麯�� // Runtime-related virtual functions - public virtual int GetCoolingtime(Skill skill) { return 5000; } - public virtual int GetRequiredSp(Skill skill) { return 0; } - public virtual int GetRequiredLevel(Skill skill) { return 0; } - public virtual int GetMaxAbility(Skill skill) { return 0; } - public virtual int GetRequiredItem(Skill skill) { return 0; } - public virtual int GetRequiredMoney(Skill skill) { return 0; } - public virtual int GetRequiredRealmLevel(Skill skill) { return 0; } - public virtual float GetPraydistance(Skill skill) { return 0f; } - public virtual float GetMpcost(Skill skill) { return 0f; } - public virtual int GetExecutetime(Skill skill) { return 1000; } - public virtual bool CheckHpCondition(int hp, int max_hp) { return true; } - public virtual bool CheckComboSkExtraCondition(Skill skill) { return true; } - public virtual int GetIntroduction(Skill skill, ushort[] descBuffer, int descBufferLen, ushort[] titleBuffer) { return 0; } - - // ������Ч�Լ�� // Validate weapon restriction - public bool ValidWeapon(int weapon) - { - if (restrict_weapons != null) - { - int i; - for (i = 0; i < restrict_weapons.Count; i++) - { - if (weapon == restrict_weapons[i]) - return true; - } - if (i > 0 && i >= restrict_weapons.Count) - return false; - } - return true; - } - } +using System.Collections.Generic; +using UnityEngine; + +namespace BrewMonster.Scripts.Skills +{ + public class Range + { + /// 0=point 1=line 2=self sphere 3=target sphere 4=cone 5=self + public byte type; // 0�� 1�� 2������ 3Ŀ���� 4Բ׶�� 5���� + + public bool IsPoint() { return type == 0; } + public bool IsLine() { return type == 1; } + public bool IsSelfBall() { return type == 2; } + public bool IsTargetBall() { return type == 3; } + public bool IsSector() { return type == 4; } + public bool IsSelf() { return type == 5; } + public bool NoTarget() { return type == 2 || type == 5; } + + } + + // ռλ������ // Placeholder Skill class + public class Skill : ElementSkill + { + protected SkillStub stub; + protected PlayerWrapper player; + + protected uint id; + protected uint level; + + Skill(uint i, SkillStub s) + { + id = i; + stub = s; + player = new PlayerWrapper(); + } + public static Skill Create(uint id, int n) + { + SkillStub stub = SkillStub.GetStub(id); + if (stub == null) + return null; + Skill skill = new Skill(id, stub); + int max = skill.GetMaxLevel(); + if (n > max) + skill.SetLevel(max); + else + skill.SetLevel(n); + return skill; + } + public override int GetMaxLevel() { return stub.GetMaxLevel(); } + public override int SetLevel(int l) + { + uint tmp = level; + level = (uint)l; + return (int)tmp; + } + public override int GetItemCost() { return stub.itemcost; } + + public int GetLevel() { return (int)level; } + public PlayerWrapper GetPlayer() + { + return player; + } + public override int GetRank() { return stub.rank; } + public override bool IsInstant() { return stub.time_type == 1; } + + public override int GetCls() + { + return stub.GetCls(); + } + public override Dictionary GetJunior() + { + return stub.is_senior != 0 ? stub.pre_skills : new Dictionary(); + } + public override int GetRangeType() { return stub.GetRange().type; } + public override int GetRequiredLevel() { return stub.GetRequiredLevel(this); } + + public override int GetTargetType() + { + if (stub.restrict_corpse == 1) + return 2; + if (stub.restrict_corpse == 2) + return 3; + if (stub.type == (int)skill_type.TYPE_ATTACK || stub.type == (int)skill_type.TYPE_CURSE) + return 1; + if (stub.type == (int)skill_type.TYPE_BLESSPET) + return 4; + if (stub.GetRange().NoTarget()) + return 0; + return 1; + } + public override byte GetType() { return stub.type; } + public override int GetCommonCoolDown() { return stub.commoncooldown; } + + public override string GetIcon() + { + return stub.GetIcon(); + } + public override string GetName() { return stub.GetName(); } + public override float GetPrayRange(float range, float prayplus) + { + player.SetRange(range); + player.SetPrayrangeplus(prayplus); + if (stub.type == (int)skill_type.TYPE_ATTACK || stub.type == (int)skill_type.TYPE_CURSE) + { + if (stub.auto_attack) + { + float r = 0.3f * stub.GetPraydistance(this); + + if (r >= 1.0) + return stub.GetPraydistance(this) - 1.0f; + else + return (float)0.7 * stub.GetPraydistance(this); + } + else + return stub.GetPraydistance(this); + } + if (stub.type == (int)skill_type.TYPE_JUMP) + return stub.GetPraydistance(this); + if (stub.GetRange().NoTarget()) + return -1; + else + return stub.GetPraydistance(this); + } + public override int GetCoolingTime() { return stub.GetCoolingtime(this); } + public int GetRequiredSp() { return stub.GetRequiredSp(this); } + public int GetRequiredMoney() { return stub.GetRequiredMoney(this); } + public override Dictionary GetRequiredSkill() { return stub.pre_skills; } + public int GetRequiredRealmLevel() { return stub.GetRequiredRealmLevel(this); } + public int GetMaxability() { return stub.GetMaxAbility(this); } + public uint GetId() { return id; } + + } + + + public abstract class SkillStub + { + public const int MIN_LEVEL = 1; + public const int MAX_LEVEL = 10; + + // Base info + public uint id; // Ψһ���ֱ�ʶ // Unique identifier + public int cls; // ְҵ // Class/Profession + public string name; // �������� // Skill name + public string nativename; // ������ // Native name + public string icon; // ����ͼ�� // Skill icon + public int max_level; // ������󼶱�? // Maximum level + public byte type; // �������? 1�������� 2�������� 3�����ٻ� 4���� 5���� // Skill type: 1-Normal 2-Special 3-Partner 4-Mount 5-Other + + // Execute condition + public bool allow_ride; // ������? // Allow while riding + public short attr; // ����������, 1������2��3ľ��4ˮ��5��6�� ��ѡһ Ĭ�ϣ������� // Attribute: 1-Metal 2-Earth 3-Wood 4-Water 5-Fire 6-Special (Choose one, default none) + public int rank; // ���漶�� // Rank + public int eventflag; // Event flag + public byte is_senior; // Senior flag + public bool is_inherent; // �������ܣ�����ѧ������ // Inherent skill, cannot be learned + public bool is_movingcast; // �ƶ�ʩ�� // Can cast while moving + public int npcdelay; // NPC delay + public int showorder; // Display order + public byte allow_forms; // Allowed forms + public int apcost; // AP cost + public int apgain; // AP gain + public byte doenchant; // Do enchant + public byte dobless; // Do bless + public int arrowcost; // Arrow cost + public Dictionary pre_skills; + + // Execute condition + public bool allow_land; // ½����Ч // Effective on land + public bool allow_air; // ������Ч // Effective in air + public bool allow_water; // ˮ����Ч // Effective in water + public bool notuse_in_combat; // ս��״̬������ // Cannot use in combat state + public int restrict_corpse; // ֻ��ʬ����Ч // Only effective on corpses + public bool restrict_change; // �Ƿ���Ա��� // Whether can transform + public bool restrict_attach; // �Ƿ���Ը��� // Whether can possess + public bool auto_attack; // ʹ�ú��Ƿ��Զ����� // Whether to auto attack after use + public byte time_type; // ˲������ // Instant cast type + public byte long_range; + public byte posdouble; // λ��ѡ�� // Position selection + public int clslimit; // ְҵ���� // Class restriction + + public int commoncooldown; // ������ȴmask bit0-4 ������ȴ0-4 bit5-9 ��Ʒ��ȴ0-4 + // Common cooldown mask bit0-4 skill cooldown 0-4 bit5-9 item cooldown 0-4 + public int commoncooldowntime; // ��ȴʱ�䣬��λ���� // Cooldown time in milliseconds + + public int itemcost; // �ͷ�ʱ������Ʒ >0��Ч // Item cost when casting, effective if >0 + + // ������� // Combo related + public int combosk_preskill; + public int combosk_interval; + public int combosk_nobreak; + + public string effect; + public string aerial_effect; + + public Range range; + public bool has_stateattack; + + public List restrict_weapons = new List(); + public static Dictionary map = new Dictionary(); + public static Dictionary GetMap() => map; + public static Dictionary> comboSkillMap = new Dictionary>(); + public static Dictionary> GetComboSkMap() => comboSkillMap; + + public static Dictionary> inheritSkillMap = new Dictionary>(); + + /*#if UNITY_EDITOR + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] + private static void OnPlay() + { + BMLogger.LogError("SkillStub OnPlay Reset"); + map = new Dictionary(); + comboSkillMap = new Dictionary>(); + inheritSkillMap = new Dictionary>(); + } + #endif*/ + public SkillStub(uint i) + { + id = i; + is_inherent = (false); + is_movingcast = (false); + itemcost = (0); + combosk_preskill = (0); + combosk_interval = (0); + combosk_nobreak = (0); + if (GetStub(id) == null) + { + GetMap().Add(id, this); + } + } + public static List GetInherentSkillList(uint cls) + { + return inheritSkillMap[cls]; + } + + public static SkillStub GetStub(uint i) + { + return GetMap().TryGetValue(i, out var stub) ? stub : null; + } + public int GetItemCost() { return itemcost; } + public static void InitStaticData() + { + var map = GetMap(); + foreach (var skill in map) + { + SkillStub sk = skill.Value; + if (sk.is_inherent) GetInherentSkillList((uint)sk.cls).Add(sk.id); + if (sk.combosk_preskill > 0) GetComboSkMap()[(uint)sk.combosk_preskill].Add(sk.id); + } + } + + public List GetPostComboSkill(uint id) + { + var m = GetComboSkMap(); + if (m.TryGetValue(id, out var list)) return list; + return null; + } + + // ����Ϊ��C++ת���Ľӿ� // The following methods are converted from C++ + public uint GetId() { return id; } + public int GetCls() { return cls; } + public string GetName() { return name; } + public string GetIcon() { return icon; } + public int GetMaxLevel() { return max_level; } + public Range GetRange() { return range; } + public bool IsMovingSkill() { return is_movingcast; } + public byte GetType() { return type; } // ����System.Object.GetType // Hide System.Object.GetType + + // ����ʱ����麯�� // Runtime-related virtual functions + public virtual int GetCoolingtime(Skill skill) { return 5000; } + public virtual int GetRequiredSp(Skill skill) { return 0; } + public virtual int GetRequiredLevel(Skill skill) { return 0; } + public virtual int GetMaxAbility(Skill skill) { return 0; } + public virtual int GetRequiredItem(Skill skill) { return 0; } + public virtual int GetRequiredMoney(Skill skill) { return 0; } + public virtual int GetRequiredRealmLevel(Skill skill) { return 0; } + public virtual float GetPraydistance(Skill skill) { return 0f; } + public virtual float GetMpcost(Skill skill) { return 0f; } + public virtual int GetExecutetime(Skill skill) { return 1000; } + public virtual bool CheckHpCondition(int hp, int max_hp) { return true; } + public virtual bool CheckComboSkExtraCondition(Skill skill) { return true; } + public virtual int GetIntroduction(Skill skill, ushort[] descBuffer, int descBufferLen, ushort[] titleBuffer) { return 0; } + + // ������Ч�Լ�� // Validate weapon restriction + public bool ValidWeapon(int weapon) + { + if (restrict_weapons != null) + { + int i; + for (i = 0; i < restrict_weapons.Count; i++) + { + if (weapon == restrict_weapons[i]) + return true; + } + if (i > 0 && i >= restrict_weapons.Count) + return false; + } + return true; + } + } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Skills/skill7.cs b/Assets/PerfectWorld/Scripts/Skills/skill7.cs index 789e39e9fc..c5803e8f7c 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill7.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill7.cs @@ -166,3 +166,6 @@ namespace BrewMonster } } + + + diff --git a/Assets/PerfectWorld/Scripts/Skills/skill8.cs b/Assets/PerfectWorld/Scripts/Skills/skill8.cs index bda0b23eb9..4e1c5570c5 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill8.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill8.cs @@ -167,3 +167,6 @@ namespace BrewMonster } } + + + diff --git a/Assets/PerfectWorld/Scripts/Skills/skill9.cs b/Assets/PerfectWorld/Scripts/Skills/skill9.cs index ec23f5e09b..8b6b383d92 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill9.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill9.cs @@ -98,3 +98,6 @@ namespace BrewMonster } } + + + diff --git a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs index 496220c2dc..d3b94653b2 100644 --- a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs +++ b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs @@ -14,7 +14,7 @@ namespace BrewMonster.UI protected Canvas m_canvas; protected Dictionary m_StringTable = new Dictionary(); protected Dictionary m_auiDialog_stringTable = new Dictionary(); - protected Dictionary m_DlgName = new Dictionary(); + public Dictionary m_DlgName = new Dictionary(); public string GetStringFromTable(int idString) { diff --git a/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs new file mode 100644 index 0000000000..488f82b625 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs @@ -0,0 +1,29 @@ +using BrewMonster.UI; +using UnityEngine; +using static CECUIManager; + +namespace BrewMonster +{ + public class CDlgMessageBox : AUIDialog + { + [SerializeField] private TMPro.TextMeshProUGUI titleText; + [SerializeField] private TMPro.TextMeshProUGUI messageText; + [SerializeField] private UnityEngine.UI.Button okButton; + private void Awake() + { + okButton.onClick.RemoveAllListeners(); + okButton.onClick.AddListener(OnOkClicked); + } + private void OnOkClicked() + { + EventBus.Publish(new MessageBoxEvent(1,this)); + Show(false); + } + public void ShowMessageBox(string title, string message) + { + SetName(title); + messageText.text = message; + Show(true); + } + } +} diff --git a/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs.meta b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs.meta new file mode 100644 index 0000000000..f8c0de59e3 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6672523dc3dacfa46b2104f504acdb6e \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs index 58717de5d1..e2aca6996c 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs @@ -13,14 +13,29 @@ namespace BrewMonster.UI protected uint m_dwData; protected object m_pvData; protected AUIManager m_pAUIManager = null; + string m_szName; public virtual void Show(bool value) { gameObject.SetActive(value); OnShowDialogue(); } + public string GetName() + { + return m_szName; + } + public bool SetName(string pszName) + { + if (m_pAUIManager.m_DlgName.ContainsKey(pszName)) + return false; - public void SetData(uint dwData, string strName) + //m_pAUIManager.m_DlgName.Remove(m_szName); + m_szName = pszName; + m_pAUIManager.m_DlgName[m_szName] = this; + + return true; + } + public void SetData(uint dwData, string strName = "") { m_strDataName = strName; m_dwData = dwData; @@ -83,22 +98,22 @@ namespace BrewMonster.UI public virtual void OnEnable() { - + } public virtual void OnDisable() { - + } public virtual void Awake() { - + m_szName = "Dialog_"; } public virtual void Start() { - + } public virtual void Update() @@ -107,7 +122,7 @@ namespace BrewMonster.UI } public virtual void OnShowDialogue() { - + } public virtual bool Render() diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs index f17662e05c..8e3068f447 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs @@ -55,7 +55,7 @@ namespace BrewMonster.UI return -1; m_Item[nIndex].strDataName[nSubIndex] = strName; m_Item[nIndex].dwData[nSubIndex] = dwItemData; - + m_Item[nIndex].SetActOnClickBtn(m_OnClickBtn, nIndex); return nIndex; } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillAction.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillAction.cs new file mode 100644 index 0000000000..ff1e37d5da --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillAction.cs @@ -0,0 +1,55 @@ +using BrewMonster.Scripts.Skills; +using BrewMonster.UI; +using System; +using UnityEngine; +using UnityEngine.UI; + +namespace BrewMonster +{ + public class CDlgSkillAction : AUIDialog + { + [SerializeField] private Button uiSkillButton; + [SerializeField] private GameObject skillUI; + + bool m_bOpenAction; + bool m_bReceivedNCPGreeting; // ǷյNPCGreeting + + public override void Awake() + { + base.Awake(); + uiSkillButton.onClick.RemoveAllListeners(); + uiSkillButton.onClick.AddListener(OnSkillButtonClicked); + } + + private void OnSkillButtonClicked() + { + TryOpenDialog(false); + } + public void TryOpenDialog(bool bAction) + { + var boolll = skillUI.activeInHierarchy; + if (boolll) + { + skillUI.SetActive(!boolll); + return; + } + skillUI.SetActive(!boolll); + + if (skillUI.activeInHierarchy) + if (!GetHostPlayer().IsTalkingWithNPC()) + { + m_bOpenAction = bAction; + CECHostSkillModel.Instance.SendHelloToSkillLearnNPC(); + SetReceivedNPCGreeting(false); + } + } + public void SetReceivedNPCGreeting(bool bReceived) + { + m_bReceivedNCPGreeting = bReceived; + } + public bool IsReceivedNPCGreeting() + { + return m_bReceivedNCPGreeting; + } + } +} diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillAction.cs.meta b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillAction.cs.meta new file mode 100644 index 0000000000..47769e3509 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillAction.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3c007a40af961624cae5041be0798d18 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs index 408003d63d..929c4f0fc9 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/CDlgSkillSubList.cs @@ -46,7 +46,7 @@ namespace BrewMonster.UI { m_contentRoot = transform as RectTransform; } - + EventBus.Subscribe(OnModelChange); CacheTemplateInfo(); HideTemplates(); } @@ -163,7 +163,7 @@ namespace BrewMonster.UI taoistRank != CECTaoistRank.GetBaseRankEnd(); taoistRank = taoistRank.GetNext()) { - BMLogger.LogError("CDlgSkillSubList::ResetDialog: Adding GetBaseRankBegin rank " + taoistRank.GetID()); + BMLogger.LogError ("ResetDialog base rank " + taoistRank.GetName()); AddDlgsOfOneRank(taoistRank); } @@ -171,8 +171,7 @@ namespace BrewMonster.UI taoistRank != CECTaoistRank.GetGodRankEnd(); taoistRank = taoistRank.GetNext()) { - BMLogger.LogError("CDlgSkillSubList::ResetDialog: Adding GetGodRankBegin rank " + taoistRank.GetID()); - + BMLogger.LogError("ResetDialog base rank " + taoistRank.GetName()); AddDlgsOfOneRank(taoistRank); } @@ -180,8 +179,7 @@ namespace BrewMonster.UI taoistRank != CECTaoistRank.GetEvilRankEnd(); taoistRank = taoistRank.GetNext()) { - BMLogger.LogError("CDlgSkillSubList::ResetDialog: Adding GetEvilRankBegin rank " + taoistRank.GetID()); - + BMLogger.LogError("ResetDialog Evil rank " + taoistRank.GetName()); AddDlgsOfOneRank(taoistRank); } @@ -204,6 +202,7 @@ namespace BrewMonster.UI // �޸�ijһ����������״̬ / Refresh a single skill sub dialog private void UpdateOneSubDlg(int skillID) { + //BMLogger.LogError("UpdateOneSubDlg"); if (!m_skillSubDialogsMap.TryGetValue(skillID, out var pSub)) { return; @@ -219,7 +218,7 @@ namespace BrewMonster.UI subListItem.Show(true); if (GetSelectedSkillID() == skillID) { - // 选中时可在此扩展树状展示 / Hook skill tree here if needed + //GetGameUIMan()->m_pDlgSkillAction->ShowSkillTree(skillID); } } @@ -271,24 +270,24 @@ namespace BrewMonster.UI if (allRankProfSkills == null) { - BMLogger.LogError("HoangDev: AddDlgsOfOneRank allRankProfSkills is null"); + //BMLogger.LogError("HoangDev: AddDlgsOfOneRank allRankProfSkills is null"); return; } if (IsEvil() && taoistRank.IsGodRank()) { - BMLogger.LogError("HoangDev: AddDlgsOfOneRank IsEvil() && taoistRank.IsGodRank()"); + //BMLogger.LogError("HoangDev: AddDlgsOfOneRank IsEvil() && taoistRank.IsGodRank()"); return; } else if (!IsEvil() && taoistRank.IsEvilRank()) { - BMLogger.LogError("HoangDev: AddDlgsOfOneRank !IsEvil() && taoistRank.IsEvilRank()"); + //BMLogger.LogError("HoangDev: AddDlgsOfOneRank !IsEvil() && taoistRank.IsEvilRank()"); return; } if (!allRankProfSkills.TryGetValue(rankID, out var rankItr) || rankItr == null || rankItr.Count == 0) { - BMLogger.LogError("HoangDev: AddDlgsOfOneRank !allRankProfSkills.TryGetValue(rankID, out var rankItr) || rankItr == null || rankItr.Count == 0"); + //BMLogger.LogError($"HoangDev: AddDlgsOfOneRank !allRankProfSkills.TryGetValue({rankID}, out var rankItr) || rankItr == null || rankItr.Count == 0"); return; } @@ -481,13 +480,12 @@ namespace BrewMonster.UI } // �м��ܱ������ˣ���Ҫ������������ / Handle model change notifications - public void OnModelChange(CECHostSkillModel p, CECSkillPanelChange q) + public void OnModelChange(CECSkillPanelChange q) { - if (q == null) + /* if (!GetGameUIMan().m_pDlgSkillAction.IsShow()) { return; - } - + }*/ if (q.m_changeMask == CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_OVERRIDDEN) { ResetDialog(); @@ -508,7 +506,7 @@ namespace BrewMonster.UI } else if (q.m_changeMask == CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_NPC) { - // NPC变化时原逻辑隐藏技能树 / Original logic hides skill tree when NPC changes + //GetGameUIMan()->m_pDlgSkillAction->Show(false); } } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs index e6b4c0231c..0012c24bae 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs @@ -763,27 +763,245 @@ namespace BrewMonster.UI else if (DataType == DATA_TYPE.DT_NPC_MAKE_SERVICE) { NPC_MAKE_SERVICE pService = (NPC_MAKE_SERVICE)pData; - m_pLst_Main.AddString(strText + Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pService.name))); + string serviceName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pService.name)); + m_pLst_Main.AddString(strText + serviceName); + + // Log NPC_MAKE_SERVICE data + BMLogger.Log($"NPC_MAKE_SERVICE detected - ServiceID: {a_uiService[i]}, MakeServiceID: {pService.id}, Name: {serviceName}, MakeSkillID: {pService.id_make_skill}, ProduceType: {pService.produce_type}"); + + // Log pages data + if (pService.pages != null) + { + for (int pageIdx = 0; pageIdx < pService.pages.Length; pageIdx++) + { + var page = pService.pages[pageIdx]; + string pageTitle = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(page.page_title)); + // Trim null characters and whitespace from page title + pageTitle = pageTitle?.TrimEnd('\0', ' ', '\t', '\r', '\n') ?? ""; + + // Collect all non-zero goods IDs with their names + // Note: id_goods contains RECIPE IDs, not item IDs + List goodsInfo = new List(); + if (page.id_goods != null) + { + for (int goodsIdx = 0; goodsIdx < page.id_goods.Length; goodsIdx++) + { + uint recipeId = page.id_goods[goodsIdx]; + if (recipeId != 0) + { + // Get recipe data, output item, and materials + string outputItemInfo = ""; + List materialInfo = new List(); + try + { + var edm = ElementDataManProvider.GetElementDataMan(); + if (edm == null) + { + // ElementDataMan is null, skip + } + else + { + // Try recipe space first + DATA_TYPE dt = DATA_TYPE.DT_INVALID; + object recipeData = edm.get_data_ptr(recipeId, ID_SPACE.ID_SPACE_RECIPE, ref dt); + + // Check if we got recipe data - sometimes dt is DT_INVALID but data is still RECIPE_ESSENCE + RECIPE_ESSENCE? recipe = null; + if (recipeData != null && recipeData is RECIPE_ESSENCE) + { + recipe = (RECIPE_ESSENCE)recipeData; + } + else if (recipeData != null && dt == DATA_TYPE.DT_RECIPE_ESSENCE) + { + recipe = (RECIPE_ESSENCE)recipeData; + } + + if (recipe.HasValue) + { + RECIPE_ESSENCE recipeValue = recipe.Value; + + // Get output item from first target (main output) + if (recipeValue.targets != null && recipeValue.targets.Length > 0) + { + if (recipeValue.targets[0].id_to_make != 0) + { + uint outputItemId = recipeValue.targets[0].id_to_make; + try + { + EC_IvtrItem pItem = EC_IvtrItem.CreateItem((int)outputItemId, 0, 1); + if (pItem != null) + { + string outputName = pItem.GetName(); + outputItemInfo = $"{outputItemId} ({outputName})"; + } + else + { + outputItemInfo = $"{outputItemId} (unknown)"; + } + } + catch (Exception ex2) + { + outputItemInfo = $"{outputItemId} (error: {ex2.Message})"; + } + } + else + { + BMLogger.LogWarning($" Recipe {recipeId}: First target id_to_make is 0"); + } + } + else + { + BMLogger.LogWarning($" Recipe {recipeId}: targets is null or empty"); + } + + // Get all materials + if (recipeValue.materials != null) + { + for (int matIdx = 0; matIdx < recipeValue.materials.Length; matIdx++) + { + var material = recipeValue.materials[matIdx]; + if (material.id != 0 && material.num > 0) + { + string materialName = ""; + try + { + EC_IvtrItem matItem = EC_IvtrItem.CreateItem((int)material.id, 0, 1); + if (matItem != null) + { + materialName = matItem.GetName(); + } + } + catch (Exception ex2) + { + materialName = $"error: {ex2.Message}"; + } + + string matEntry = !string.IsNullOrEmpty(materialName) + ? $"{material.id} ({materialName}) x{material.num}" + : $"{material.id} (unknown) x{material.num}"; + materialInfo.Add(matEntry); + } + } + } + else + { + BMLogger.LogWarning($" Recipe {recipeId}: materials is null"); + } + } + } + } + catch (Exception ex) + { + BMLogger.LogWarning($" Failed to get data for recipe ID {recipeId}: {ex.Message}\n{ex.StackTrace}"); + } + + // Format: "RecipeID -> Output: ID (Name) | Materials: ID (Name) xCount, ..." + string goodsEntry = $"Recipe {recipeId}"; + if (!string.IsNullOrEmpty(outputItemInfo)) + { + goodsEntry += $" -> Output: {outputItemInfo}"; + } + else + { + goodsEntry += " -> Output: (none)"; + } + if (materialInfo.Count > 0) + { + goodsEntry += $" | Materials: {string.Join(", ", materialInfo)}"; + } + else + { + goodsEntry += " | Materials: (none)"; + } + goodsInfo.Add(goodsEntry); + } + } + } + + // Log page if it has a title or has goods + if (!string.IsNullOrEmpty(pageTitle) || goodsInfo.Count > 0) + { + string goodsList = goodsInfo.Count > 0 ? string.Join(", ", goodsInfo) : ""; + BMLogger.Log($" Page[{pageIdx}]: Title=\"{pageTitle}\", Goods=[{goodsList}], GoodsCount={goodsInfo.Count}"); + } + } + } } else if (DataType == DATA_TYPE.DT_NPC_DECOMPOSE_SERVICE) { - //NPC_DECOMPOSE_SERVICE pService = (NPC_DECOMPOSE_SERVICE)pData; - //CECHostPlayer pHost = GetHostPlayer(); - //CECSkill pSkill; - //int j = 0; - //for (j = 0; j < pHost.GetPassiveSkillNum(); j++) - //{ - // pSkill = pHost.GetPassiveSkillByIndex(j); - // if ((pSkill.GetType() == CECSkill::TYPE_LIVE || - // pSkill.GetType() == CECSkill::TYPE_PRODUCE) && - // (int)pService.id_decompose_skill == pSkill.GetSkillID()) - // { - // m_pLst_Main.AddString(strText + pService.name); - // break; - // } - //} - //if (j == pHost.GetPassiveSkillNum()) - // continue; + NPC_DECOMPOSE_SERVICE pService = (NPC_DECOMPOSE_SERVICE)pData; + string serviceName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pService.name)); + + // Log NPC_DECOMPOSE_SERVICE data + BMLogger.Log($"NPC_DECOMPOSE_SERVICE detected - ServiceID: {a_uiService[i]}, DecomposeServiceID: {pService.id}, Name: {serviceName}, DecomposeSkillID: {pService.id_decompose_skill}"); + + CECHostPlayer hostPlayer = GetHostPlayer(); + bool hasRequiredSkill = false; + + // TODO: Implement proper skill check when GetPassiveSkillNum() and GetPassiveSkillByIndex() are available + // For now, we'll use reflection to access private GetPassiveSkillByID method or implement a workaround + // The C++ code checks if player has the required decompose skill (TYPE_LIVE or TYPE_PRODUCE) + try + { + // Try using reflection to access private GetPassiveSkillByID method + var method = typeof(CECHostPlayer).GetMethod("GetPassiveSkillByID", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + if (method != null) + { + var pSkill = method.Invoke(hostPlayer, new object[] { (int)pService.id_decompose_skill, false }) as CECSkill; + if (pSkill != null) + { + int skillType = pSkill.GetType(); + int skillID = pSkill.GetSkillID(); + + BMLogger.Log($" Found skill by ID (via reflection): ID={skillID}, Type={skillType}"); + + // Check if this is the required decompose skill with correct type + if ((skillType == (int)CECSkill.SkillType.TYPE_LIVE || + skillType == (int)CECSkill.SkillType.TYPE_PRODUCE) && + (int)pService.id_decompose_skill == skillID) + { + hasRequiredSkill = true; + BMLogger.Log($" Skill check PASSED - Player has required decompose skill (ID: {pService.id_decompose_skill}, Type: {skillType})"); + m_pLst_Main.AddString(strText + serviceName); + m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, a_uiService[i]); + m_pLst_Main.SetItemDataPtr(m_pLst_Main.GetCount() - 1, pData); + } + else + { + BMLogger.Log($" Skill found but type mismatch - Expected TYPE_LIVE or TYPE_PRODUCE, got {skillType}"); + } + } + else + { + BMLogger.Log($" Skill check FAILED - Player does not have required decompose skill (ID: {pService.id_decompose_skill})"); + } + } + else + { + BMLogger.LogWarning($" GetPassiveSkillByID method not found via reflection - skill check cannot be performed"); + // For now, show the service anyway for logging/debugging purposes + // TODO: Remove this when proper skill check is implemented + hasRequiredSkill = true; + m_pLst_Main.AddString(strText + serviceName); + m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, a_uiService[i]); + m_pLst_Main.SetItemDataPtr(m_pLst_Main.GetCount() - 1, pData); + } + } + catch (Exception ex) + { + BMLogger.LogError($"Error checking decompose skill: {ex.Message}"); + BMLogger.LogError($"Stack trace: {ex.StackTrace}"); + // For debugging: show service anyway + hasRequiredSkill = true; + m_pLst_Main.AddString(strText + serviceName); + m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, a_uiService[i]); + m_pLst_Main.SetItemDataPtr(m_pLst_Main.GetCount() - 1, pData); + } + + if (!hasRequiredSkill) + continue; } else if (DataType == DATA_TYPE.DT_NPC_IDENTIFY_SERVICE) { @@ -3024,11 +3242,22 @@ namespace BrewMonster.UI else if (DataType == DATA_TYPE.DT_NPC_MAKE_SERVICE) { NPC_MAKE_SERVICE pService = (NPC_MAKE_SERVICE)pData; + string serviceName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pService.name)); + + // Log NPC_MAKE_SERVICE data when selected + BMLogger.Log($"SelectListItem - NPC_MAKE_SERVICE selected - ServiceID: {iService}, MakeServiceID: {pService.id}, Name: {serviceName}, MakeSkillID: {pService.id_make_skill}, ProduceType: {pService.produce_type}"); + idFunction = (int)SERVICE_TYPE.NPC_MAKE; } else if (DataType == DATA_TYPE.DT_NPC_DECOMPOSE_SERVICE) { NPC_DECOMPOSE_SERVICE pService = (NPC_DECOMPOSE_SERVICE)pData; + string serviceName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pService.name)); + + // Log NPC_DECOMPOSE_SERVICE data when selected + BMLogger.Log($"SelectListItem - NPC_DECOMPOSE_SERVICE selected - ServiceID: {iService}, DecomposeServiceID: {pService.id}, Name: {serviceName}, DecomposeSkillID: {pService.id_decompose_skill}"); + BMLogger.Log($" Note: This decompose service is being treated as idFunction={SERVICE_TYPE.NPC_DECOMPOSE}"); + idFunction = (int)SERVICE_TYPE.NPC_DECOMPOSE; } else if (DataType == DATA_TYPE.DT_NPC_IDENTIFY_SERVICE) @@ -3117,7 +3346,6 @@ namespace BrewMonster.UI if (Enum.IsDefined(typeof(SERVICE_TYPE), idFunction)) { SERVICE_TYPE k = (SERVICE_TYPE)idFunction; - BMLogger.Log($" PopupCorrespondingServiceDialog: {k}"); } if (idFunction == (int)SERVICE_TYPE.NPC_SELL || idFunction == (int)SERVICE_TYPE.NPC_BUY) @@ -3216,38 +3444,106 @@ namespace BrewMonster.UI } else if (idFunction == (int)SERVICE_TYPE.NPC_MAKE) { - // C++ - //NPC_MAKE_SERVICE pMake = (NPC_MAKE_SERVICE)pData; - //if (pMake.produce_type == 2) - // pShow1 = m_pAUIManager.GetDialog("Win_Produce1"); - //else - // pShow1 = m_pAUIManager.GetDialog("Win_Produce"); - //GetGameUIMan().m_pDlgProduce = (CDlgProduce*)pShow1; - //GetHostPlayer().PrepareNPCService(iService); - //pShow1.SetDataPtr(pMake, "ptr_NPC_MAKE_SERVICE"); - //if (pMake.produce_type == 1 || - // pMake.produce_type == 3 || - // pMake.produce_type == 4 || - // pMake.produce_type == 5) - // GetGameUIMan().m_pDlgProduce.ClearMaterial(); - //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //GetGameUIMan().m_pDlgProduce.UpdateProduce(1, 0); + NPC_MAKE_SERVICE pMake = (NPC_MAKE_SERVICE)pData; - // NPC_MAKE_SERVICE pMake = (NPC_MAKE_SERVICE)pData; - // if (pMake.produce_type == 2) - // pShow1 = m_pAUIManager.GetDialog("Win_Produce1"); - // else - // pShow1 = m_pAUIManager.GetDialog("Win_Produce"); - // GetGameUIMan().m_pDlgProduce = (CDlgProduce*)pShow1; - // GetHostPlayer().PrepareNPCService(iService); - // pShow1.SetDataPtr(pMake, "ptr_NPC_MAKE_SERVICE"); - // if (pMake.produce_type == 1 || - // pMake.produce_type == 3 || - // pMake.produce_type == 4 || - // pMake.produce_type == 5) - // GetGameUIMan().m_pDlgProduce.ClearMaterial(); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - // GetGameUIMan().m_pDlgProduce.UpdateProduce(1, 0); + BMLogger.Log($"PopupCorrespondingServiceDialog - NPC_MAKE: produce_type={pMake.produce_type}, MakeSkillID={pMake.id_make_skill}"); + + // Dialog loading commented out - Win_Produce dialog not yet implemented + // Determine which dialog to use based on produce_type + //string dialogName = (pMake.produce_type == 2) ? "Win_Produce1" : "Win_Produce"; + //pShow1 = m_pAUIManager.GetDialog(dialogName); + + //if (pShow1 == null) + //{ + // BMLogger.LogError($"NPC_MAKE: Dialog '{dialogName}' not found! Service may not work correctly."); + // // Try alternative dialog name or create placeholder + // // For now, just log the error and continue + //} + //else + //{ + // // Get or set DlgProduce reference (if it exists) + // // GetGameUIMan().m_pDlgProduce = (CDlgProduce*)pShow1; + // + // // Prepare NPC service + // try + // { + // GetHostPlayer().PrepareNPCService(iService); + // } + // catch (Exception ex) + // { + // BMLogger.LogError($"NPC_MAKE: Error calling PrepareNPCService: {ex.Message}"); + // } + // + // // Set data pointer + // try + // { + // pShow1.SetDataPtr(pMake, "ptr_NPC_MAKE_SERVICE"); + // } + // catch (Exception ex) + // { + // BMLogger.LogError($"NPC_MAKE: Error setting data pointer: {ex.Message}"); + // } + // + // // Clear material for certain produce types + // if (pMake.produce_type == 1 || + // pMake.produce_type == 3 || + // pMake.produce_type == 4 || + // pMake.produce_type == 5) + // { + // try + // { + // // GetGameUIMan().m_pDlgProduce.ClearMaterial(); + // // Note: ClearMaterial() will be called when DlgProduce is implemented + // BMLogger.Log($"NPC_MAKE: Should clear material for produce_type={pMake.produce_type}"); + // } + // catch (Exception ex) + // { + // BMLogger.LogError($"NPC_MAKE: Error clearing material: {ex.Message}"); + // } + // } + // + // // Get inventory dialog + // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + // + // // Update produce dialog + // try + // { + // // GetGameUIMan().m_pDlgProduce.UpdateProduce(1, 0); + // // Note: UpdateProduce() will be called when DlgProduce is implemented + // BMLogger.Log($"NPC_MAKE: Should call UpdateProduce(1, 0)"); + // } + // catch (Exception ex) + // { + // BMLogger.LogError($"NPC_MAKE: Error updating produce: {ex.Message}"); + // } + //} + + uint npcID = pCurNPCEssence.HasValue ? pCurNPCEssence.Value.id : 0; + + AUIDialog dlg = m_pAUIManager.GetDialog("Win_Produce"); + DlgProduce dlgProduce = dlg as DlgProduce; + if (dlgProduce == null) + { + CECGameUIMan gameUIMan = GetGameUIMan(); + DialogScriptTableObject dialogResource = gameUIMan.GetDialogResource(); + Canvas canvas = gameUIMan.GetCanvas(); + + if(dlgProduce != null && canvas != null) + { + GameObject ob = dialogResource.GetPrefabDialog("Win_Produce"); + if (ob != null) + { + dlgProduce = GameObject.Instantiate(ob, canvas.transform).GetComponent(); + } + } + } + + if(dlgProduce != null) + { + dlgProduce.Show(true); + dlgProduce.OpenProduce(npcID); + } + } else if (idFunction == (int)SERVICE_TYPE.NPC_DECOMPOSE) { @@ -3535,10 +3831,10 @@ namespace BrewMonster.UI else { EC_IvtrItem pItem = EC_IvtrItem.CreateItem((int)pService.storage_open_item, 0, 1); - string szMsg; // cannot open storage task m_pLst_Main.ResetContent(); - //m_pTxt_Content.SetText(bTaskNPC ? pCurNPCEssence.Value.hello_msg : szMsg.Format(GetStringFromTable(984), pItem.GetName())); + //string szMsg = string.Format(GetStringFromTable(984), pItem.GetName()); + //m_pTxt_Content.SetText(bTaskNPC ? Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pCurNPCEssence.Value.hello_msg)) : szMsg); //SetData(NPC_DIALOG.NPC_DIALOG_TASK_LIST, ""); } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs new file mode 100644 index 0000000000..c10f7c9cb8 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs @@ -0,0 +1,742 @@ +using BrewMonster.Network; +using BrewMonster.Scripts.Managers; +using BrewMonster.Scripts.Task; +using BrewMonster.UI; +using ModelRenderer.Scripts.Common; +using PerfectWorld.Scripts.Managers; +using PerfectWorld.Scripts.Task; +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using CSNetwork; +using System.Text; +using TMPro; + +namespace BrewMonster +{ + public class DlgProduce : AUIDialog + { + [Header("Produce Tabs")] + [SerializeField] private Transform tabBtnContainer; + [SerializeField] private GameObject tabBtnPb; + [SerializeField] private string tabButtonTextComponentName = "Text"; + + [Header("Produce Detail")] + [SerializeField] private Transform itemContainer; + [SerializeField] private GameObject itemPb; + + [Header("Quantity")] + [SerializeField] private List quantityText; + [SerializeField] private Button quantityIncreaseBtn; + [SerializeField] private Button quantityDecreaseBtn; + [SerializeField] private Button quantityMaxBtn; + + private int currentQuantity = 1; + + private int produceRemainCount = 0; + private bool isProducing = false; + + [Header("Material Slots")] + [SerializeField] private List materialSlots = new List(); + + [Header("Result Slot")] + [SerializeField] private Transform itemResult; + + [Header("Item Info Panel")] + public Transform itemInfoRoot; + public TextMeshProUGUI infoNameText; + public TextMeshProUGUI infoDescText; + public TextMeshProUGUI infoExtraText; + + private NPC_MAKE_SERVICE? cachedMakeService = null; + private int currentTabIndex = 0; + private uint selectedRecipeId = 0; // Track the currently selected recipe + + static readonly Color COLOR_NOT_ENOUGH = new Color32(145, 145, 145, 255); + static readonly Color COLOR_ENOUGH = Color.white; + + [SerializeField] private Button startProduceBtn; + [SerializeField] private Button cancelProduceBtn; + + public override void Start() + { + quantityText[0].text = currentQuantity.ToString(); + quantityText[1].text = currentQuantity.ToString(); + quantityDecreaseBtn.onClick.AddListener(OnClickDecreaseBtn); + quantityIncreaseBtn.onClick.AddListener(OnClickIncreaseBtn); + + if(quantityMaxBtn != null) + { + quantityMaxBtn.onClick.AddListener(OnClickMaxBtn); + } + } + + public void OpenProduce(uint npcId) + { + if (!LoadMakeService(npcId)) + { + Debug.LogError("[DlgProduce] LoadMakeService failed"); + return; + } + + selectedRecipeId = 0; // Reset selected recipe + SetupButtonHandlers(); + CreateTabs(); + OnTabSelected(0); + } + + void SetupButtonHandlers() + { + if (startProduceBtn != null) + { + startProduceBtn.onClick.RemoveAllListeners(); + startProduceBtn.onClick.AddListener(OnStartProduceClicked); + } + + if (cancelProduceBtn != null) + { + cancelProduceBtn.onClick.RemoveAllListeners(); + cancelProduceBtn.onClick.AddListener(OnCancelProduceClicked); + } + } + + bool LoadMakeService(uint npcId) + { + var edm = ElementDataManProvider.GetElementDataMan(); + if (edm == null) + return false; + + DATA_TYPE dt = DATA_TYPE.DT_INVALID; + object npcData = edm.get_data_ptr(npcId, ID_SPACE.ID_SPACE_ESSENCE, ref dt); + + if (dt != DATA_TYPE.DT_NPC_ESSENCE || npcData == null) + return false; + + NPC_ESSENCE npc = (NPC_ESSENCE)npcData; + if (npc.id_make_service == 0) + return false; + + DATA_TYPE serviceDt = DATA_TYPE.DT_INVALID; + object serviceData = edm.get_data_ptr( + npc.id_make_service, + ID_SPACE.ID_SPACE_ESSENCE, + ref serviceDt + ); + + if (serviceDt != DATA_TYPE.DT_NPC_MAKE_SERVICE || serviceData == null) + return false; + + cachedMakeService = (NPC_MAKE_SERVICE)serviceData; + return true; + } + + void CreateTabs() + { + ClearContainer(tabBtnContainer); + + if (!cachedMakeService.HasValue || cachedMakeService.Value.pages == null) + return; + + var makeService = cachedMakeService.Value; + + for (int pageIndex = 0; pageIndex < makeService.pages.Length; pageIndex++) + { + var page = makeService.pages[pageIndex]; + bool hasRecipes = false; + if (page.id_goods != null) + { + foreach (uint recipeId in page.id_goods) + { + if (recipeId != 0) + { + hasRecipes = true; + break; + } + } + } + + if (!hasRecipes) + continue; + + GameObject tabObj = Instantiate(tabBtnPb, tabBtnContainer); + tabObj.name = $"ProduceTab_Page_{pageIndex}"; + tabObj.SetActive(true); + + string pageTitle = ByteToStringUtils.UshortArrayToUnicodeString(page.page_title); + if (string.IsNullOrWhiteSpace(pageTitle)) + pageTitle = $"Page {pageIndex + 1}"; + + TMPro.TextMeshProUGUI tabTMP = null; + TextMeshProUGUI tabText = null; + + Transform textTf = tabObj.transform.Find(tabButtonTextComponentName); + if (textTf != null) + { + tabTMP = textTf.GetComponent(); + if (tabTMP == null) + { + tabText = textTf.GetComponent(); + } + } + + if (tabTMP == null && tabText == null) + { + tabTMP = tabObj.GetComponentInChildren(); + if(tabTMP == null) + { + tabText = tabObj.GetComponentInChildren(); + } + } + + if(tabTMP != null) + tabTMP.text = pageTitle; + else if(tabText != null) + tabText.text = pageTitle; + + Button btn = tabObj.GetComponent private void OnGetRoleListComplete(List roleInfos) { - BMLogger.Log($"OnGetRoleListComplete {roleInfos.Count}"); - _roleInfos = roleInfos; } private void OnClickSelectCharacter(RoleInfo roleInfo) { - BMLogger.Log($"OnClickSelectCharacter {roleInfo.name}"); UnityGameSession.SelectRoleAsync(roleInfo, OnSelectRoleComplete); } diff --git a/Assets/PerfectWorld/Scripts/UI/NPCShopDetailPanel.cs b/Assets/PerfectWorld/Scripts/UI/NPCShopDetailPanel.cs index 1af4021df2..80e2d2c712 100644 --- a/Assets/PerfectWorld/Scripts/UI/NPCShopDetailPanel.cs +++ b/Assets/PerfectWorld/Scripts/UI/NPCShopDetailPanel.cs @@ -122,11 +122,11 @@ public class NPCShopDetailPanel : MonoBehaviour try { // Create EC_IvtrEquip for equipment items - this will work for weapons and armor - EC_IvtrEquip equipment = new EC_IvtrEquip(itemId, 0); + EC_IvtrEquip equipment = (EC_IvtrEquip)EC_IvtrItem.CreateItem(itemId, 0, 1); // For NPC shop items, we typically have static data only // Try to get description using GetNormalDesc() which works with base stats - string equipDesc = equipment.GetNormalDesc(); + string equipDesc = equipment.GetDesc(); if (!string.IsNullOrEmpty(equipDesc)) { // Replace C++ style "\r" line separators with real newlines for TMP diff --git a/Assets/PerfectWorld/Scripts/UI/ProduceItemPanel.cs b/Assets/PerfectWorld/Scripts/UI/ProduceItemPanel.cs new file mode 100644 index 0000000000..1b2e4f552b --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/ProduceItemPanel.cs @@ -0,0 +1,104 @@ +using BrewMonster; +using BrewMonster.Scripts.Managers; +using System.Collections; +using UnityEngine; +using UnityEngine.UI; +using static CSNetwork.Common.ExpTypes; + +public class ProduceItemPanel : MonoBehaviour +{ + [Header("UI")] + public Image icon; + + private uint recipeId; + private Coroutine loadIconCoroutine; + private DlgProduce ownerDlg; + private Button cachedButton; + + public void Setup(uint recipeId, DlgProduce dlg) + { + this.recipeId = recipeId; + this.ownerDlg = dlg; + + SetupClickHandler(); + LoadOutputIcon(); + } + + void SetupClickHandler() + { + if (cachedButton == null) + { + cachedButton = GetComponent