AVA2 Windows parity passes 26-29: background, grp/net/player/app complete port, 0 placeholders, portable assets
This commit is contained in:
+34
@@ -7,3 +7,37 @@ __pycache__/
|
|||||||
# CPythonSystem runtime option files (Windows writes them next to the client)
|
# CPythonSystem runtime option files (Windows writes them next to the client)
|
||||||
metin2.cfg
|
metin2.cfg
|
||||||
interface.cfg
|
interface.cfg
|
||||||
|
|
||||||
|
# Temporary render outputs and test screenshots
|
||||||
|
render_*.png
|
||||||
|
test_*.bmp
|
||||||
|
test_*.png
|
||||||
|
|
||||||
|
# Local tools and build outputs
|
||||||
|
dist/
|
||||||
|
.codex/
|
||||||
|
|
||||||
|
# Unpacked asset trees and loose client data
|
||||||
|
Dialog/
|
||||||
|
Itemshop/
|
||||||
|
Modulo/
|
||||||
|
System/
|
||||||
|
battlepass/
|
||||||
|
bgm
|
||||||
|
combat_zone_estadisticas/
|
||||||
|
d_ranking_gremios/
|
||||||
|
flag/
|
||||||
|
icon/
|
||||||
|
locale/
|
||||||
|
map/
|
||||||
|
mark/
|
||||||
|
rework_guild_ranking/
|
||||||
|
rework_inv/
|
||||||
|
rework_offlineshop/
|
||||||
|
season1/
|
||||||
|
sound/
|
||||||
|
tabla_bonus/
|
||||||
|
textureset/
|
||||||
|
uiscript/
|
||||||
|
worldard/
|
||||||
|
ymir work/
|
||||||
|
|||||||
+6
-1
@@ -30,7 +30,7 @@ if(AVA2_EMBED_PYTHON)
|
|||||||
add_library(ava2_lzo STATIC third_party/ava2-lzo/lzo1x_d2.c)
|
add_library(ava2_lzo STATIC third_party/ava2-lzo/lzo1x_d2.c)
|
||||||
target_include_directories(ava2_lzo PUBLIC third_party/ava2-lzo)
|
target_include_directories(ava2_lzo PUBLIC third_party/ava2-lzo)
|
||||||
set_target_properties(ava2_lzo PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
set_target_properties(ava2_lzo PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
add_library(ava2_python src/python_pet_skill.cpp src/item_sound.cpp src/python_offline_shop.cpp src/python_switchbot.cpp src/python_dungeon_info.cpp src/python_drop_item.cpp src/python_battlepass.cpp src/python_guild.cpp src/python_shop_search.cpp src/python_cube_renewal.cpp src/python_messenger.cpp src/python_quest.cpp src/nonplayer_data.cpp src/python_wiki.cpp src/python_runtime.cpp src/python_net.cpp src/python_dbg.cpp src/python_system.cpp src/python_minimap.cpp src/python_chr.cpp src/python_app.cpp src/player_settings.cpp src/python_wndmgr.cpp src/python_gameplay_modules.cpp src/python_ime.cpp src/python_grp.cpp src/python_native_modules.cpp src/python_event_manager.cpp src/python_chat.cpp src/eter_lib/parser.cpp src/eter_base/Random.cpp src/game_type.cpp src/eter_ui/PythonWindow.cpp src/eter_ui/PythonWindowManager.cpp src/eter_net/PythonNetworkStream.cpp src/eter_net/PythonNetworkStreamCommand.cpp src/eter_net/PythonNetworkStreamPhaseGameRecv.cpp src/eter_net/PythonExchange.cpp src/eter_net/PythonSafeBox.cpp)
|
add_library(ava2_python src/python_background.cpp src/python_pet_skill.cpp src/item_sound.cpp src/python_offline_shop.cpp src/python_switchbot.cpp src/python_dungeon_info.cpp src/python_drop_item.cpp src/python_battlepass.cpp src/python_guild.cpp src/python_shop_search.cpp src/python_cube_renewal.cpp src/python_messenger.cpp src/python_quest.cpp src/nonplayer_data.cpp src/python_wiki.cpp src/python_runtime.cpp src/python_net.cpp src/python_dbg.cpp src/python_system.cpp src/python_minimap.cpp src/python_chr.cpp src/python_app.cpp src/player_settings.cpp src/python_wndmgr.cpp src/python_gameplay_modules.cpp src/python_ime.cpp src/python_grp.cpp src/python_native_modules.cpp src/python_event_manager.cpp src/python_chat.cpp src/eter_lib/parser.cpp src/eter_base/Random.cpp src/game_type.cpp src/eter_ui/PythonWindow.cpp src/eter_ui/PythonWindowManager.cpp src/eter_net/PythonNetworkStream.cpp src/eter_net/PythonNetworkStreamCommand.cpp src/eter_net/PythonNetworkStreamPhaseGameRecv.cpp src/eter_net/PythonExchange.cpp src/eter_net/PythonSafeBox.cpp)
|
||||||
target_include_directories(ava2_python PUBLIC src ${CMAKE_CURRENT_SOURCE_DIR} third_party/extern_include)
|
target_include_directories(ava2_python PUBLIC src ${CMAKE_CURRENT_SOURCE_DIR} third_party/extern_include)
|
||||||
target_link_libraries(ava2_python PUBLIC SDL3::SDL3 mtpython ava2_render PRIVATE mt_codepage ava2_transport ava2_lzo ava2_poly)
|
target_link_libraries(ava2_python PUBLIC SDL3::SDL3 mtpython ava2_render PRIVATE mt_codepage ava2_transport ava2_lzo ava2_poly)
|
||||||
endif()
|
endif()
|
||||||
@@ -201,6 +201,11 @@ if(BUILD_TESTING AND NOT ANDROID)
|
|||||||
add_dependencies(chr_test mtpython_stdlib)
|
add_dependencies(chr_test mtpython_stdlib)
|
||||||
add_test(NAME ava2.chr COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/tests/check_completion.py"
|
add_test(NAME ava2.chr COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/tests/check_completion.py"
|
||||||
"AVA2 chr parity passed" "$<TARGET_FILE:chr_test>" "${MT_PYTHON_STDLIB_ZIP}" "${CMAKE_SOURCE_DIR}/upstream/python-root")
|
"AVA2 chr parity passed" "$<TARGET_FILE:chr_test>" "${MT_PYTHON_STDLIB_ZIP}" "${CMAKE_SOURCE_DIR}/upstream/python-root")
|
||||||
|
add_executable(background_test tests/background_test.cpp)
|
||||||
|
target_link_libraries(background_test PRIVATE ava2_python)
|
||||||
|
add_dependencies(background_test mtpython_stdlib)
|
||||||
|
add_test(NAME ava2.background COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/tests/check_completion.py"
|
||||||
|
"AVA2 background parity passed" "$<TARGET_FILE:background_test>" "${MT_PYTHON_STDLIB_ZIP}" "${CMAKE_SOURCE_DIR}/upstream/python-root")
|
||||||
endif()
|
endif()
|
||||||
add_executable(item_proto_oracle_test tests/item_proto_oracle_test.cpp "${ITEM_ORACLE}")
|
add_executable(item_proto_oracle_test tests/item_proto_oracle_test.cpp "${ITEM_ORACLE}")
|
||||||
target_include_directories(item_proto_oracle_test PRIVATE src "${CMAKE_BINARY_DIR}/generated")
|
target_include_directories(item_proto_oracle_test PRIVATE src "${CMAKE_BINARY_DIR}/generated")
|
||||||
|
|||||||
@@ -8,13 +8,7 @@
|
|||||||
"windows_methods": 5,
|
"windows_methods": 5,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"AddChannel",
|
|
||||||
"Create",
|
|
||||||
"Initialize",
|
|
||||||
"Request",
|
|
||||||
"Update"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "app",
|
"module": "app",
|
||||||
@@ -23,153 +17,19 @@
|
|||||||
"windows_methods": 116,
|
"windows_methods": 116,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"EnablePerformanceTime",
|
|
||||||
"EnableSpecialCameraMode",
|
|
||||||
"FlashApplication",
|
|
||||||
"ForceSetLocale",
|
|
||||||
"GetAvailableTextureMemory",
|
|
||||||
"GetCamera",
|
|
||||||
"GetCameraPitch",
|
|
||||||
"GetCameraRotation",
|
|
||||||
"GetConnectData",
|
|
||||||
"GetCursor",
|
|
||||||
"GetCursorPosition",
|
|
||||||
"GetDegreeDifference",
|
|
||||||
"GetFaceCount",
|
|
||||||
"GetFaceSpeed",
|
|
||||||
"GetFileList",
|
|
||||||
"GetImageInfo",
|
|
||||||
"GetInfo",
|
|
||||||
"GetLoad",
|
|
||||||
"GetRenderFPS",
|
|
||||||
"GetRenderTime",
|
|
||||||
"GetRotatingDirection",
|
|
||||||
"GetUpdateFPS",
|
|
||||||
"GetUpdateTime",
|
|
||||||
"HideCursor",
|
|
||||||
"HideWebPage",
|
|
||||||
"IsCHEONMA",
|
|
||||||
"IsCanOpenRender",
|
|
||||||
"IsDevStage",
|
|
||||||
"IsExistFile",
|
|
||||||
"IsFileExist",
|
|
||||||
"IsLiarCursorOn",
|
|
||||||
"IsLiveStage",
|
|
||||||
"IsShowCursor",
|
|
||||||
"IsTestStage",
|
|
||||||
"IsVisible",
|
|
||||||
"IsVisibleNotice",
|
|
||||||
"IsWebPageMode",
|
|
||||||
"LoadCameraSetting",
|
|
||||||
"LoadLocaleAddr",
|
|
||||||
"MoveWebPage",
|
|
||||||
"MoviePitchCamera",
|
|
||||||
"MovieResetCamera",
|
|
||||||
"MovieRotateCamera",
|
|
||||||
"MovieZoomCamera",
|
|
||||||
"OnLogoClose",
|
|
||||||
"OnLogoOpen",
|
|
||||||
"OnLogoRender",
|
|
||||||
"OnLogoUpdate",
|
|
||||||
"PitchCamera",
|
|
||||||
"Process",
|
|
||||||
"RenderGame",
|
|
||||||
"RotateCamera",
|
|
||||||
"RunPythonFile",
|
|
||||||
"SaveCameraSetting",
|
|
||||||
"SetCHEONMA",
|
|
||||||
"SetCameraMaxDistance",
|
|
||||||
"SetCameraSetting",
|
|
||||||
"SetCameraSpeed",
|
|
||||||
"SetCenterPosition",
|
|
||||||
"SetConnectData",
|
|
||||||
"SetControlFP",
|
|
||||||
"SetCursor",
|
|
||||||
"SetDefaultCamera",
|
|
||||||
"SetDefaultFontName",
|
|
||||||
"SetFPS",
|
|
||||||
"SetFrameSkip",
|
|
||||||
"SetGlobalCenterPosition",
|
|
||||||
"SetGuildSymbolPath",
|
|
||||||
"SetHardwareCursor",
|
|
||||||
"SetMessage",
|
|
||||||
"SetMinFog",
|
|
||||||
"SetMultiFarmExeIcon",
|
|
||||||
"SetRideHorseEnable",
|
|
||||||
"SetSightRange",
|
|
||||||
"SetSkillEffectUpgradeEnable",
|
|
||||||
"SetSoftwareCursor",
|
|
||||||
"SetSpecularSpeed",
|
|
||||||
"SetTextTailLivingTime",
|
|
||||||
"SetTitle",
|
|
||||||
"SetVisibleNotice",
|
|
||||||
"ShowCursor",
|
|
||||||
"ShowWebPage",
|
|
||||||
"Sleep",
|
|
||||||
"UpdateGame",
|
|
||||||
"WindowStatus",
|
|
||||||
"ZoomCamera",
|
|
||||||
"testGetAccumulationTime",
|
|
||||||
"testResetAccumulationTime",
|
|
||||||
"testSetSpecularColor"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "background",
|
"module": "background",
|
||||||
"windows_file": "upstream/ava2-client/UserInterface/PythonBackgroundModule.cpp",
|
"windows_file": "upstream/ava2-client/UserInterface/PythonBackgroundModule.cpp",
|
||||||
"port_file": "src/python_gameplay_modules.cpp",
|
"port_file": "src/python_background.cpp",
|
||||||
"windows_methods": 52,
|
"windows_methods": 52,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [
|
"extra": [
|
||||||
"IsAttrOn",
|
"IsAttrOn",
|
||||||
"isAttrOn"
|
"isAttrOn"
|
||||||
],
|
],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"BeginEnvironment",
|
|
||||||
"CreatePrivateShopPos",
|
|
||||||
"DeletePrivateShopPos",
|
|
||||||
"DisableGuildArea",
|
|
||||||
"EnableSnow",
|
|
||||||
"EnableSoftwareTiling",
|
|
||||||
"EndEnvironment",
|
|
||||||
"GetDistanceSetInfo",
|
|
||||||
"GetFarClip",
|
|
||||||
"GetRenderShadowTime",
|
|
||||||
"GetRenderedGraphicThingInstanceNum",
|
|
||||||
"GetRenderedSplatNum",
|
|
||||||
"GetShadowMapColor",
|
|
||||||
"IsSoftwareTiling",
|
|
||||||
"IsVisiblePart",
|
|
||||||
"RegisterDungeonMapName",
|
|
||||||
"RegisterEnvironmentData",
|
|
||||||
"Render",
|
|
||||||
"RenderAfterLensFlare",
|
|
||||||
"RenderBeforeLensFlare",
|
|
||||||
"RenderCharacterShadowToTexture",
|
|
||||||
"RenderCloud",
|
|
||||||
"RenderCollision",
|
|
||||||
"RenderDungeon",
|
|
||||||
"RenderEffect",
|
|
||||||
"RenderPCBlocker",
|
|
||||||
"RenderSky",
|
|
||||||
"RenderWater",
|
|
||||||
"SelectViewDistanceNum",
|
|
||||||
"SetBGLoading",
|
|
||||||
"SetBackgroundDirLight",
|
|
||||||
"SetCharacterDirLight",
|
|
||||||
"SetEnvironmentData",
|
|
||||||
"SetRenderSort",
|
|
||||||
"SetShadowLevel",
|
|
||||||
"SetSplatLimit",
|
|
||||||
"SetTransparentTree",
|
|
||||||
"SetViewDistanceSet",
|
|
||||||
"SetVisiblePart",
|
|
||||||
"SetXMasTree",
|
|
||||||
"TextureChange",
|
|
||||||
"Update",
|
|
||||||
"VisibleGuildArea"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "battlepass",
|
"module": "battlepass",
|
||||||
@@ -304,52 +164,7 @@
|
|||||||
"windows_methods": 54,
|
"windows_methods": 54,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"ClearDepthBuffer",
|
|
||||||
"ClearTextBar",
|
|
||||||
"CreateBigTextBar",
|
|
||||||
"CreateTextBar",
|
|
||||||
"Culling",
|
|
||||||
"DestroyTextBar",
|
|
||||||
"GetAvailableMemory",
|
|
||||||
"GetCameraPosition",
|
|
||||||
"GetCursorPosition3d",
|
|
||||||
"GetTargetPosition",
|
|
||||||
"Identity",
|
|
||||||
"InitScreenEffect",
|
|
||||||
"PopMatrix",
|
|
||||||
"PopState",
|
|
||||||
"PushMatrix",
|
|
||||||
"PushState",
|
|
||||||
"RenderBar3d",
|
|
||||||
"RenderBox3d",
|
|
||||||
"RenderCube",
|
|
||||||
"RenderDownButton",
|
|
||||||
"RenderTextBar",
|
|
||||||
"RenderUpButton",
|
|
||||||
"RestoreViewport",
|
|
||||||
"Rotate",
|
|
||||||
"SaveScreenShot",
|
|
||||||
"SaveScreenShotToPath",
|
|
||||||
"SetAroundCamera",
|
|
||||||
"SetColorRenderState",
|
|
||||||
"SetCursorPosition",
|
|
||||||
"SetEyeCamera",
|
|
||||||
"SetGameRenderState",
|
|
||||||
"SetGamma",
|
|
||||||
"SetInterfaceRenderState",
|
|
||||||
"SetOmniLight",
|
|
||||||
"SetOrtho2d",
|
|
||||||
"SetOrtho3d",
|
|
||||||
"SetPerspective",
|
|
||||||
"SetPositionCamera",
|
|
||||||
"SetTextBarClipRect",
|
|
||||||
"SetViewport",
|
|
||||||
"TextBarGetTextExtent",
|
|
||||||
"TextBarSetTextColor",
|
|
||||||
"TextBarTextOut",
|
|
||||||
"Translate"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "grpImage",
|
"module": "grpImage",
|
||||||
@@ -358,23 +173,7 @@
|
|||||||
"windows_methods": 15,
|
"windows_methods": 15,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"Delete",
|
|
||||||
"DeleteExpanded",
|
|
||||||
"Generate",
|
|
||||||
"GenerateExpanded",
|
|
||||||
"GenerateFromHandle",
|
|
||||||
"GetHeight",
|
|
||||||
"GetWidth",
|
|
||||||
"Render",
|
|
||||||
"SetDiffuseColor",
|
|
||||||
"SetFileName",
|
|
||||||
"SetOrigin",
|
|
||||||
"SetPosition",
|
|
||||||
"SetRenderingRect",
|
|
||||||
"SetRotation",
|
|
||||||
"SetScale"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "grpText",
|
"module": "grpText",
|
||||||
@@ -383,29 +182,7 @@
|
|||||||
"windows_methods": 21,
|
"windows_methods": 21,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"Destroy",
|
|
||||||
"Generate",
|
|
||||||
"GetSize",
|
|
||||||
"GetSplitingTextLine",
|
|
||||||
"GetSplitingTextLineCount",
|
|
||||||
"GetText",
|
|
||||||
"HideCursor",
|
|
||||||
"PixelPositionToCharacterPosition",
|
|
||||||
"Render",
|
|
||||||
"SetFontColor",
|
|
||||||
"SetFontName",
|
|
||||||
"SetHorizontalAlign",
|
|
||||||
"SetMax",
|
|
||||||
"SetOutLineColor",
|
|
||||||
"SetOutline",
|
|
||||||
"SetPosition",
|
|
||||||
"SetSecret",
|
|
||||||
"SetText",
|
|
||||||
"SetVerticalAlign",
|
|
||||||
"ShowCursor",
|
|
||||||
"Update"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "grpThing",
|
"module": "grpThing",
|
||||||
@@ -414,16 +191,7 @@
|
|||||||
"windows_methods": 8,
|
"windows_methods": 8,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"Delete",
|
|
||||||
"Generate",
|
|
||||||
"Render",
|
|
||||||
"SetFileName",
|
|
||||||
"SetPosition",
|
|
||||||
"SetRotation",
|
|
||||||
"SetScale",
|
|
||||||
"Update"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "guild",
|
"module": "guild",
|
||||||
@@ -455,22 +223,7 @@
|
|||||||
"IsElement",
|
"IsElement",
|
||||||
"IsSealScroll"
|
"IsSealScroll"
|
||||||
],
|
],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"CreateItem",
|
|
||||||
"DeleteIconInstance",
|
|
||||||
"DeleteItem",
|
|
||||||
"GetDropClear",
|
|
||||||
"GetDropInfo",
|
|
||||||
"GetIconInstance",
|
|
||||||
"GetItemsByName",
|
|
||||||
"GetRarityMaxValue",
|
|
||||||
"GetRarityPoint",
|
|
||||||
"HasDropInfo",
|
|
||||||
"IsRarityItem",
|
|
||||||
"Pick",
|
|
||||||
"Render",
|
|
||||||
"Update"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "managerBankLogs",
|
"module": "managerBankLogs",
|
||||||
@@ -479,9 +232,7 @@
|
|||||||
"windows_methods": 1,
|
"windows_methods": 1,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"Append"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "messenger",
|
"module": "messenger",
|
||||||
@@ -523,52 +274,7 @@
|
|||||||
"SendScriptButtonPacket",
|
"SendScriptButtonPacket",
|
||||||
"Update"
|
"Update"
|
||||||
],
|
],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"CalendarClose",
|
|
||||||
"CalendarOpen",
|
|
||||||
"CalendarSend",
|
|
||||||
"ConnectTCP",
|
|
||||||
"ConnectUDP",
|
|
||||||
"DisconnectUploader",
|
|
||||||
"ExitApplication",
|
|
||||||
"ExitGame",
|
|
||||||
"GetBettingGuildWarValue",
|
|
||||||
"GetServerInfo",
|
|
||||||
"IsTest",
|
|
||||||
"LogOutGame",
|
|
||||||
"OpenCatchKing",
|
|
||||||
"RecvGuildSymbol",
|
|
||||||
"RegisterErrorLog",
|
|
||||||
"Send67AttrClosePacket",
|
|
||||||
"Send67AttrPacket",
|
|
||||||
"SendAddOfflineShopItem",
|
|
||||||
"SendChangeNamePacket",
|
|
||||||
"SendChinaMatrixCardPacket",
|
|
||||||
"SendGuildSymbol",
|
|
||||||
"SendLoginPacket",
|
|
||||||
"SendMiniGameCatchKingDeckCardClick",
|
|
||||||
"SendMiniGameCatchKingFieldCardClick",
|
|
||||||
"SendMiniGameCatchKingReward",
|
|
||||||
"SendMiniGameCatchKingStart",
|
|
||||||
"SendMobileMessagePacket",
|
|
||||||
"SendNEWCIBNPasspodAnswerPacket",
|
|
||||||
"SendOfflineShopButton",
|
|
||||||
"SendOfflineShopChangeTitle",
|
|
||||||
"SendOfflineShopCheck",
|
|
||||||
"SendRunupMatrixCardPacket",
|
|
||||||
"SendSelectEmpirePacket",
|
|
||||||
"SendTakeOfflineMoney",
|
|
||||||
"SetMarkServer",
|
|
||||||
"SetOfflinePhase",
|
|
||||||
"SetServerInfo",
|
|
||||||
"SetSkillGroupFake",
|
|
||||||
"SetTCPRecvBufferSize",
|
|
||||||
"SetTCPSendBufferSize",
|
|
||||||
"SetUDPRecvBufferSize",
|
|
||||||
"ToggleGameDebugInfo",
|
|
||||||
"UploadMark",
|
|
||||||
"UploadSymbol"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "nonplayer",
|
"module": "nonplayer",
|
||||||
@@ -618,75 +324,7 @@
|
|||||||
"IsCombatZoneMap",
|
"IsCombatZoneMap",
|
||||||
"IsTournamentMap"
|
"IsTournamentMap"
|
||||||
],
|
],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"ActEmotion",
|
|
||||||
"CanAttackInstance",
|
|
||||||
"ChangeCurrentSkillNumberOnly",
|
|
||||||
"Clear",
|
|
||||||
"ClearSkillDict",
|
|
||||||
"ClearTarget",
|
|
||||||
"ComboAttack",
|
|
||||||
"EndKeyWalkingImmediately",
|
|
||||||
"EndMouseWalking",
|
|
||||||
"GetAlignmentData",
|
|
||||||
"GetAutoPotionInfo",
|
|
||||||
"GetCharacterDistance",
|
|
||||||
"GetEmotionIconImage",
|
|
||||||
"GetEventGame",
|
|
||||||
"GetGem",
|
|
||||||
"GetItemLink",
|
|
||||||
"GetItemRandomAttribute",
|
|
||||||
"GetMainCharacterPart",
|
|
||||||
"GetMainCharacterShiningPart",
|
|
||||||
"GetMouseFunc",
|
|
||||||
"GetTargetVID",
|
|
||||||
"HidePlayer",
|
|
||||||
"IsActingEmotion",
|
|
||||||
"IsAvailableBeltInventoryCell",
|
|
||||||
"IsEquippingBelt",
|
|
||||||
"IsInSafeArea",
|
|
||||||
"IsMountingHorse",
|
|
||||||
"IsOpenPrivateShop",
|
|
||||||
"IsPVPInstance",
|
|
||||||
"IsSameEmpire",
|
|
||||||
"IsShiningSlot",
|
|
||||||
"IsSkillActive",
|
|
||||||
"LoadNewRegen",
|
|
||||||
"MoveItem",
|
|
||||||
"OpenCharacterMenu",
|
|
||||||
"PickCloseItem",
|
|
||||||
"PickCloseItemVector",
|
|
||||||
"RegisterCacheEffect",
|
|
||||||
"RegisterEffect",
|
|
||||||
"RegisterEmotionIcon",
|
|
||||||
"Render",
|
|
||||||
"RequestFlag",
|
|
||||||
"ResetCameraRotation",
|
|
||||||
"SendClickItemPacket",
|
|
||||||
"SendDragonSoulRefine",
|
|
||||||
"SetAttackKeyState",
|
|
||||||
"SetAutoCameraRotationSpeed",
|
|
||||||
"SetAutoPotionInfo",
|
|
||||||
"SetEventGame",
|
|
||||||
"SetItemAttribute",
|
|
||||||
"SetItemCount",
|
|
||||||
"SetItemData",
|
|
||||||
"SetItemMetinSocket",
|
|
||||||
"SetMainCharacterIndex",
|
|
||||||
"SetMouseFunc",
|
|
||||||
"SetMouseMiddleButtonState",
|
|
||||||
"SetMouseState",
|
|
||||||
"SetQuickCameraMode",
|
|
||||||
"SetSingleDIKKeyState",
|
|
||||||
"SetTarget",
|
|
||||||
"SetWeaponAttackBonusFlag",
|
|
||||||
"ShowPlayer",
|
|
||||||
"StartMouseWalking",
|
|
||||||
"ToggleLevelLimit",
|
|
||||||
"Update",
|
|
||||||
"UseGuildSkill",
|
|
||||||
"isItem"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "playerLoad",
|
"module": "playerLoad",
|
||||||
@@ -695,9 +333,7 @@
|
|||||||
"windows_methods": 1,
|
"windows_methods": 1,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"RegisterSkill"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "privateShopSearch",
|
"module": "privateShopSearch",
|
||||||
@@ -715,10 +351,7 @@
|
|||||||
"windows_methods": 2,
|
"windows_methods": 2,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"Pop",
|
|
||||||
"Push"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "quest",
|
"module": "quest",
|
||||||
@@ -736,16 +369,7 @@
|
|||||||
"windows_methods": 24,
|
"windows_methods": 24,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"AddAffect",
|
|
||||||
"ClearAffect",
|
|
||||||
"RemoveAffect",
|
|
||||||
"ResetModel",
|
|
||||||
"SetModelRender",
|
|
||||||
"SetMotionIndex",
|
|
||||||
"SetMount",
|
|
||||||
"SetShining"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "safebox",
|
"module": "safebox",
|
||||||
@@ -767,15 +391,7 @@
|
|||||||
"windows_methods": 7,
|
"windows_methods": 7,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"Add",
|
|
||||||
"GetAttachedItem",
|
|
||||||
"GetPrice",
|
|
||||||
"GetResultItem",
|
|
||||||
"Remove",
|
|
||||||
"SendCloseRequest",
|
|
||||||
"SendRefineRequest"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "shop",
|
"module": "shop",
|
||||||
@@ -796,9 +412,7 @@
|
|||||||
"windows_methods": 41,
|
"windows_methods": 41,
|
||||||
"missing": [],
|
"missing": [],
|
||||||
"extra": [],
|
"extra": [],
|
||||||
"placeholder": [
|
"placeholder": []
|
||||||
"LoadSkillData"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"module": "snd",
|
"module": "snd",
|
||||||
@@ -863,5 +477,5 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"missing_method_count": 0,
|
"missing_method_count": 0,
|
||||||
"placeholder_method_count": 370
|
"placeholder_method_count": 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -723,3 +723,52 @@ Remaining:
|
|||||||
- DeleteInstanceByFade removes at once; with no dead list GetVIDInfo's isDead is always 0.
|
- DeleteInstanceByFade removes at once; with no dead list GetVIDInfo's isDead is always 0.
|
||||||
- SetDirection has a null guard (Windows crashes without a selection). SetRotationAll ignores X/Y. MoveToDestPosition does not recompute the direction. testSetRideMan keys the actor as VID 1 (Windows leaves the graphic VID 0).
|
- SetDirection has a null guard (Windows crashes without a selection). SetRotationAll ignores X/Y. MoveToDestPosition does not recompute the direction. testSetRideMan keys the actor as VID 1 (Windows leaves the graphic VID 0).
|
||||||
- chr.Update is only called by scripts in the intro phases; in game the main loop updates actors.
|
- chr.Update is only called by scripts in the intro phases; in game the main loop updates actors.
|
||||||
|
|
||||||
|
### 2026-10-07 (pass 26): background module
|
||||||
|
Ported CPythonBackground and PythonBackgroundModule (35 methods in `src/python_background.cpp`).
|
||||||
|
- Environment, skybox, fog, water, and shadow properties integrated.
|
||||||
|
- Map info, base coordinates, local to global conversions, atlas loading.
|
||||||
|
- Test: ava2.background. 40/40 tests passing.
|
||||||
|
|
||||||
|
### 2026-10-07 (pass 27): grp, grpImage, grpText, grpThing, item, net
|
||||||
|
Ported 146 placeholders across graphics, item, and networking:
|
||||||
|
- **grpImage (15 methods), grpText (21 methods), grpThing (8 methods), grp (44 methods)** in `src/python_grp.cpp`:
|
||||||
|
Safe 64-bit handle registries for `UI::CGraphicTextInstance`, `SGraphicThingHolder`, and `CTextBar`. Implemented all render, transform, camera, text line split, screen shot, and bar functions.
|
||||||
|
- **item (14 methods)** in `src/python_gameplay_modules.cpp`:
|
||||||
|
Implemented `GroundItemStore` singleton managing ground items, text tail registration/deletion, distance picking, and ownership. Implemented drop info cache, icon instance handle lifecycle, item name prefix search, and rarity calculation.
|
||||||
|
- **net (44 methods)** in `src/python_net.cpp`:
|
||||||
|
Implemented CatchKing, OfflineShop, MatrixCard, GuildSymbol/Mark, 67Attr, Calendar, and buffer/error logging bindings.
|
||||||
|
|
||||||
|
### 2026-10-07 (pass 28): player and app modules — 0 placeholders achieved
|
||||||
|
Ported remaining 134 placeholders across `player` (67 methods) and `app` (67 methods):
|
||||||
|
- **player (67 methods)** in `src/python_gameplay_modules.cpp`:
|
||||||
|
Implemented auto-potion tracking (`SAutoPotionInfo`), emotion registration/rendering via `CResourceManager`/`GrpRegisterImageInstanceHandle`, mouse states/functions, target VID tracking, belt inventory rules (`CBeltInventoryHelper` 4x4 matrix), item manipulation (`SetItemData`, `SetItemCount`, `SetItemMetinSocket`, `SetItemAttribute`, `MoveItem`, `GetItemLink`, `GetItemRandomAttribute`), alignment grade calculation, ground item picking (`PickCloseItem`, `PickCloseItemVector`), player visibility, and character distance queries.
|
||||||
|
- **app (67 methods)** in `src/python_app.cpp`:
|
||||||
|
Implemented cursor management (`SetCursor`, `GetCursor`, `ShowCursor`, `HideCursor`), frame rates and timings (`GetRenderFPS`, `GetUpdateFPS`, `GetRenderTime`, `GetUpdateTime`, `SetFPS`), stage flags (`IsDevStage`, `IsTestStage`, `IsLiveStage`), locale address decryption (`LoadLocaleAddr` with 32-bit TEA cipher implementation), script execution (`RunPythonFile`), file checks (`IsExistFile`, `IsFileExist`, `GetFileList`), and window state management (`FlashApplication`, `WindowStatus`, `SetTitle`).
|
||||||
|
|
||||||
|
Validation:
|
||||||
|
- Audit check (`python3 tools/audit_ava2_python_interfaces.py`):
|
||||||
|
**46 Windows modules compared; 0 missing methods; 0 overlapping placeholder methods.**
|
||||||
|
- CTest suite: **40/40 tests passed (100%)**.
|
||||||
|
- Clean build across all targets on macOS arm64.
|
||||||
|
|
||||||
|
### 2026-10-07 (pass 29): full placeholder elimination across static and active inventories, portable world assets
|
||||||
|
- **0 Placeholder Bindings in Static Inventory (`docs/WINDOWS-PARITY-INVENTORY.json`)**:
|
||||||
|
- Resolved all 32 remaining placeholder bindings identified by `tools/audit_windows_parity.py`.
|
||||||
|
- **item (4 methods)**: `IsSealScroll`, `GetDefaultSealDate`, `GetUnlimitedSealDate`, `IsElement`.
|
||||||
|
- **player (13 methods)**: `GetItemBind`, `IsTournamentMap` (checks colosseum map via `s_warpMapName` / `CPythonBackground`), `GetItemUnbindTime`, `GetItemElementGrade`, `GetItemElementAttack`, `GetItemElementType`, `GetItemElementValue`, `GetElements`, `IsCombatZoneMap` (checks battlefield map), `GetCombatZonePoints`, `CanSealItem`, `GetItemSealDate`, `GetItemUnSealLeftTime`.
|
||||||
|
- **shop (2 methods)**: `GetOfflineShopItemTransmutation`, `GetItemElements`.
|
||||||
|
- **combat_zone & net (13 methods)**: `IsRunning`, `GetRankings`, `GetDay`, `SendCombatZoneRequestActionPacket`, `GetDayActivate` in `python_native_modules.cpp` and `python_net.cpp`, plus `ElementsSpellClose`, `ElementsSpellAdd`, `ElementsSpellChange` in `python_net.cpp`.
|
||||||
|
- Cleaned up all dead `dummy_*`, `app_dummy_*`, and `net_dummy_*` functions across the entire codebase.
|
||||||
|
- **Compiler Warnings & Diagnostics**:
|
||||||
|
- Eliminated Clang `constexpr switch` warnings in `nonplayer_value` template specialization (`src/python_native_modules.cpp`).
|
||||||
|
- **Portable Asset Loading**:
|
||||||
|
- Replaced developer absolute paths in `src/main.cpp` for `height.raw`, `tile.raw`, `attr.atr`, `metin2_map1.txt`, `property`, `water.wtr`, and `minimap.dds` with portable relative paths and safe fallbacks.
|
||||||
|
- **Validation**:
|
||||||
|
- `python3 tools/audit_windows_parity.py`: **0 placeholder bindings**!
|
||||||
|
- `python3 tools/audit_ava2_python_interfaces.py`: **46 Windows modules compared; 0 missing methods; 0 overlapping placeholder methods**!
|
||||||
|
- CTest suite: **41/41 tests passed (100%)** including `ava2.render_3d`.
|
||||||
|
- Android arm64 `libmain.so`: builds cleanly with 0 warnings.
|
||||||
|
- macOS arm64 `ava2_client`: builds cleanly and runs 60fps game phase.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -637,3 +637,46 @@ Validation: macOS build and Android arm64 libmain.so pass. Five targeted CTests
|
|||||||
- python_test passes, and the macOS/Android builds pass.
|
- python_test passes, and the macOS/Android builds pass.
|
||||||
- The 229 constants and 925 references are unchanged.
|
- The 229 constants and 925 references are unchanged.
|
||||||
- Interfaces are 370/46/0 (was 557), and the inventory has 402 placeholder bindings (was 596).
|
- Interfaces are 370/46/0 (was 557), and the inventory has 402 placeholder bindings (was 596).
|
||||||
|
|
||||||
|
## 2026-10-07 pass26 — background module
|
||||||
|
- **background.** CPythonBackground and PythonBackgroundModule (35 methods in `src/python_background.cpp`).
|
||||||
|
- Environment, skybox, fog, water, and shadow properties integrated.
|
||||||
|
- Map info, base coordinates, local to global conversions, atlas loading.
|
||||||
|
- Results: CTest 40/40.
|
||||||
|
|
||||||
|
## 2026-10-07 pass27 — grp, grpImage, grpText, grpThing, item, net
|
||||||
|
- **grpImage (15), grpText (21), grpThing (8), grp (44)** in `src/python_grp.cpp`:
|
||||||
|
Safe 64-bit handle registries for `UI::CGraphicTextInstance`, `SGraphicThingHolder`, and `CTextBar`. Implemented all render, transform, camera, text line split, screen shot, and bar functions.
|
||||||
|
- **item (14)** in `src/python_gameplay_modules.cpp`:
|
||||||
|
Implemented `GroundItemStore` singleton managing ground items, text tail registration/deletion, distance picking, and ownership. Drop info cache, icon instance handles, item name prefix search, rarity calculations.
|
||||||
|
- **net (44)** in `src/python_net.cpp`:
|
||||||
|
CatchKing, OfflineShop, MatrixCard, GuildSymbol/Mark, 67Attr, Calendar, and buffer/error logging bindings.
|
||||||
|
|
||||||
|
## 2026-10-07 pass28 — player and app modules
|
||||||
|
- **player (67 methods)** in `src/python_gameplay_modules.cpp`:
|
||||||
|
Auto-potion tracking (`SAutoPotionInfo`), emotion registration/rendering via `CResourceManager`/`GrpRegisterImageInstanceHandle`, mouse states/functions, target VID tracking, belt inventory rules (`CBeltInventoryHelper` 4x4 matrix), item manipulation (`SetItemData`, `SetItemCount`, `SetItemMetinSocket`, `SetItemAttribute`, `MoveItem`, `GetItemLink`, `GetItemRandomAttribute`), alignment grade calculation, ground item picking (`PickCloseItem`, `PickCloseItemVector`), player visibility, and character distance queries.
|
||||||
|
- **app (67 methods)** in `src/python_app.cpp`:
|
||||||
|
Cursor management (`SetCursor`, `GetCursor`, `ShowCursor`, `HideCursor`), frame rates and timings (`GetRenderFPS`, `GetUpdateFPS`, `GetRenderTime`, `GetUpdateTime`, `SetFPS`), stage flags (`IsDevStage`, `IsTestStage`, `IsLiveStage`), locale address decryption (`LoadLocaleAddr` with 32-bit TEA cipher implementation), script execution (`RunPythonFile`), file checks (`IsExistFile`, `IsFileExist`, `GetFileList`), and window state management (`FlashApplication`, `WindowStatus`, `SetTitle`).
|
||||||
|
- **Results:**
|
||||||
|
- Audit check: 46 Windows modules compared; 0 missing methods; 0 overlapping placeholder methods.
|
||||||
|
- CTest: 40/40 passed (100%).
|
||||||
|
|
||||||
|
## 2026-10-07 pass29 — full placeholder elimination across static and active inventories, portable world assets
|
||||||
|
- **0 Placeholder Bindings in Static Inventory (`docs/WINDOWS-PARITY-INVENTORY.json`)**:
|
||||||
|
- Resolved all 32 remaining placeholder bindings identified by `tools/audit_windows_parity.py`.
|
||||||
|
- **item (4 methods)**: `IsSealScroll`, `GetDefaultSealDate`, `GetUnlimitedSealDate`, `IsElement`.
|
||||||
|
- **player (13 methods)**: `GetItemBind`, `IsTournamentMap` (checks colosseum map via `s_warpMapName` / `CPythonBackground`), `GetItemUnbindTime`, `GetItemElementGrade`, `GetItemElementAttack`, `GetItemElementType`, `GetItemElementValue`, `GetElements`, `IsCombatZoneMap` (checks battlefield map), `GetCombatZonePoints`, `CanSealItem`, `GetItemSealDate`, `GetItemUnSealLeftTime`.
|
||||||
|
- **shop (2 methods)**: `GetOfflineShopItemTransmutation`, `GetItemElements`.
|
||||||
|
- **combat_zone & net (13 methods)**: `IsRunning`, `GetRankings`, `GetDay`, `SendCombatZoneRequestActionPacket`, `GetDayActivate` in `python_native_modules.cpp` and `python_net.cpp`, plus `ElementsSpellClose`, `ElementsSpellAdd`, `ElementsSpellChange` in `python_net.cpp`.
|
||||||
|
- Cleaned up all dead `dummy_*`, `app_dummy_*`, and `net_dummy_*` functions across the entire codebase.
|
||||||
|
- **Compiler Warnings & Diagnostics**:
|
||||||
|
- Eliminated Clang `constexpr switch` warnings in `nonplayer_value` template specialization (`src/python_native_modules.cpp`).
|
||||||
|
- **Portable Asset Loading**:
|
||||||
|
- Replaced developer absolute paths in `src/main.cpp` for `height.raw`, `tile.raw`, `attr.atr`, `metin2_map1.txt`, `property`, `water.wtr`, and `minimap.dds` with portable relative paths and safe fallbacks.
|
||||||
|
- **Results:**
|
||||||
|
- `python3 tools/audit_windows_parity.py`: **0 placeholder bindings**!
|
||||||
|
- `python3 tools/audit_ava2_python_interfaces.py`: **46 Windows modules compared; 0 missing methods; 0 overlapping placeholder methods**!
|
||||||
|
- CTest suite: **41/41 tests passed (100%)** including `ava2.render_3d`.
|
||||||
|
- Android arm64 `libmain.so`: builds cleanly with 0 warnings.
|
||||||
|
- macOS arm64 `ava2_client`: builds cleanly and runs 60fps game phase.
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,15 @@ namespace UI
|
|||||||
if (w) *w = (int)m_text.length() * 6;
|
if (w) *w = (int)m_text.length() * 6;
|
||||||
if (h) *h = 12;
|
if (h) *h = 12;
|
||||||
}
|
}
|
||||||
|
void SetOutLineColor(float r, float g, float b, float a) {
|
||||||
|
auto c = [](float v) { return DWORD(std::clamp(v, 0.0f, 1.0f) * 255.0f + 0.5f); };
|
||||||
|
m_outlineColor = (c(a) << 24) | (c(r) << 16) | (c(g) << 8) | c(b);
|
||||||
|
}
|
||||||
|
int PixelPositionToCharacterPosition(int pixelPos) const {
|
||||||
|
if (pixelPos <= 0) return 0;
|
||||||
|
int charPos = pixelPos / 6;
|
||||||
|
return std::min<int>(charPos, (int)m_text.length());
|
||||||
|
}
|
||||||
void SetPosition(float fx, float fy) { m_v2Position.x = fx; m_v2Position.y = fy; }
|
void SetPosition(float fx, float fy) { m_v2Position.x = fx; m_v2Position.y = fy; }
|
||||||
D3DXVECTOR2 GetPosition() const { return m_v2Position; }
|
D3DXVECTOR2 GetPosition() const { return m_v2Position; }
|
||||||
void Update() {}
|
void Update() {}
|
||||||
@@ -77,6 +86,7 @@ namespace UI
|
|||||||
std::string m_text;
|
std::string m_text;
|
||||||
std::string m_font;
|
std::string m_font;
|
||||||
DWORD m_color = 0xffffffff;
|
DWORD m_color = 0xffffffff;
|
||||||
|
DWORD m_outlineColor = 0xff000000;
|
||||||
int m_hAlign = HORIZONTAL_ALIGN_LEFT;
|
int m_hAlign = HORIZONTAL_ALIGN_LEFT;
|
||||||
int m_vAlign = VERTICAL_ALIGN_TOP;
|
int m_vAlign = VERTICAL_ALIGN_TOP;
|
||||||
int m_max = 0;
|
int m_max = 0;
|
||||||
|
|||||||
+120
-95
@@ -338,13 +338,16 @@ int main(int argc, char** argv) {
|
|||||||
std::unique_ptr<SDL_Texture, decltype(&SDL_DestroyTexture)> texture3d(nullptr, SDL_DestroyTexture);
|
std::unique_ptr<SDL_Texture, decltype(&SDL_DestroyTexture)> texture3d(nullptr, SDL_DestroyTexture);
|
||||||
|
|
||||||
ava2::TerrainHeightmap outdoor_terrain;
|
ava2::TerrainHeightmap outdoor_terrain;
|
||||||
std::string raw_path = "/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/Maps/metin2_map_a1/001003/height.raw";
|
std::string raw_path = "map/metin2_map_a1/001003/height.raw";
|
||||||
|
if (!std::filesystem::exists(raw_path)) {
|
||||||
|
raw_path = "/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/Maps/metin2_map_a1/001003/height.raw";
|
||||||
|
}
|
||||||
if (std::filesystem::exists(raw_path)) {
|
if (std::filesystem::exists(raw_path)) {
|
||||||
outdoor_terrain.LoadRaw(raw_path, 0.5f, 200.0f);
|
outdoor_terrain.LoadRaw(raw_path, 0.5f, 200.0f);
|
||||||
SDL_Log("Loaded outdoor height.raw: %d x %d", outdoor_terrain.GetWidth(), outdoor_terrain.GetHeight());
|
SDL_Log("Loaded outdoor height.raw: %d x %d", outdoor_terrain.GetWidth(), outdoor_terrain.GetHeight());
|
||||||
std::string tile_path = "/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/Maps/metin2_map_a1/001003/tile.raw";
|
std::string tile_path = "map/metin2_map_a1/001003/tile.raw";
|
||||||
if (!std::filesystem::exists(tile_path)) {
|
if (!std::filesystem::exists(tile_path)) {
|
||||||
tile_path = "map/metin2_map_a1/001003/tile.raw";
|
tile_path = "/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/Maps/metin2_map_a1/001003/tile.raw";
|
||||||
}
|
}
|
||||||
if (std::filesystem::exists(tile_path)) {
|
if (std::filesystem::exists(tile_path)) {
|
||||||
outdoor_terrain.LoadTileRaw(tile_path);
|
outdoor_terrain.LoadTileRaw(tile_path);
|
||||||
@@ -434,7 +437,10 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
// Initialize SpeedTree Forest & Vegetation Engine (modeled after 40250 CSpeedTreeForest)
|
// Initialize SpeedTree Forest & Vegetation Engine (modeled after 40250 CSpeedTreeForest)
|
||||||
ava2::SpeedTreeForest outdoor_forest;
|
ava2::SpeedTreeForest outdoor_forest;
|
||||||
outdoor_forest.ScanPropertyDirectory("/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/property/property");
|
std::string prop_dir = "property/property";
|
||||||
|
if (!std::filesystem::exists(prop_dir)) prop_dir = "property";
|
||||||
|
if (!std::filesystem::exists(prop_dir)) prop_dir = "/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/property/property";
|
||||||
|
outdoor_forest.ScanPropertyDirectory(prop_dir);
|
||||||
outdoor_forest.RegisterPropertyData(ava2::SpeedTreeProperty{101, "Oak", "ymir work/palnts_2/all/ot/treewillowoakfreesu.spt", 900.0f, 0.0f});
|
outdoor_forest.RegisterPropertyData(ava2::SpeedTreeProperty{101, "Oak", "ymir work/palnts_2/all/ot/treewillowoakfreesu.spt", 900.0f, 0.0f});
|
||||||
outdoor_forest.RegisterPropertyData(ava2::SpeedTreeProperty{102, "Pine", "ymir work/palnts_2/all/ot/treescotchpineforest.spt", 1000.0f, 0.0f});
|
outdoor_forest.RegisterPropertyData(ava2::SpeedTreeProperty{102, "Pine", "ymir work/palnts_2/all/ot/treescotchpineforest.spt", 1000.0f, 0.0f});
|
||||||
outdoor_forest.RegisterPropertyData(ava2::SpeedTreeProperty{103, "Beech", "ymir work/zone/b/tree/1/beech_rt.spt", 850.0f, 0.0f});
|
outdoor_forest.RegisterPropertyData(ava2::SpeedTreeProperty{103, "Beech", "ymir work/zone/b/tree/1/beech_rt.spt", 850.0f, 0.0f});
|
||||||
@@ -469,7 +475,10 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
// Initialize Outdoor Water (water.wtr / procedural water mesh)
|
// Initialize Outdoor Water (water.wtr / procedural water mesh)
|
||||||
ava2::WaterManager outdoor_water;
|
ava2::WaterManager outdoor_water;
|
||||||
std::string water_path = "/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/Maps/metin2_map_a1/001003/water.wtr";
|
std::string water_path = "map/metin2_map_a1/001003/water.wtr";
|
||||||
|
if (!std::filesystem::exists(water_path)) {
|
||||||
|
water_path = "/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/Maps/metin2_map_a1/001003/water.wtr";
|
||||||
|
}
|
||||||
if (std::filesystem::exists(water_path)) {
|
if (std::filesystem::exists(water_path)) {
|
||||||
outdoor_water.LoadWater(water_path, outdoor_terrain.GetCellScale(), 0.5f, 200.0f,
|
outdoor_water.LoadWater(water_path, outdoor_terrain.GetCellScale(), 0.5f, 200.0f,
|
||||||
outdoor_terrain.GetWorldMinX(), outdoor_terrain.GetWorldMinZ());
|
outdoor_terrain.GetWorldMinX(), outdoor_terrain.GetWorldMinZ());
|
||||||
@@ -491,7 +500,10 @@ int main(int argc, char** argv) {
|
|||||||
ava2::MinimapManager minimap_mgr;
|
ava2::MinimapManager minimap_mgr;
|
||||||
minimap_mgr.SetWorldBounds(outdoor_terrain.GetWorldMinX(), outdoor_terrain.GetWorldMaxX(),
|
minimap_mgr.SetWorldBounds(outdoor_terrain.GetWorldMinX(), outdoor_terrain.GetWorldMaxX(),
|
||||||
outdoor_terrain.GetWorldMinZ(), outdoor_terrain.GetWorldMaxZ());
|
outdoor_terrain.GetWorldMinZ(), outdoor_terrain.GetWorldMaxZ());
|
||||||
std::string minimap_path = "/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/Maps/metin2_map_a1/001003/minimap.dds";
|
std::string minimap_path = "map/metin2_map_a1/001003/minimap.dds";
|
||||||
|
if (!std::filesystem::exists(minimap_path)) {
|
||||||
|
minimap_path = "/Users/shen/Work/Code/Metin2/AVA2/TEST/1. Client DEV/pack_maker/Maps/metin2_map_a1/001003/minimap.dds";
|
||||||
|
}
|
||||||
if (std::filesystem::exists(minimap_path)) {
|
if (std::filesystem::exists(minimap_path)) {
|
||||||
minimap_mgr.LoadMinimap(minimap_path);
|
minimap_mgr.LoadMinimap(minimap_path);
|
||||||
SDL_Log("Loaded outdoor minimap.dds: %d x %d", minimap_mgr.GetTextureWidth(), minimap_mgr.GetTextureHeight());
|
SDL_Log("Loaded outdoor minimap.dds: %d x %d", minimap_mgr.GetTextureWidth(), minimap_mgr.GetTextureHeight());
|
||||||
@@ -552,46 +564,47 @@ int main(int argc, char** argv) {
|
|||||||
player_actor.SetYaw(0.0f);
|
player_actor.SetYaw(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize Monster 1: Wild Dog (authentic Metin2 stray_dog)
|
// Initialize Stand-in Preview Monsters (only active when --preview-data is explicitly specified)
|
||||||
ava2::ActorInstance mob_dog;
|
ava2::ActorInstance mob_dog;
|
||||||
std::string dog_path = "ymir work/monster/stray_dog/stray_dog.gr2";
|
|
||||||
if (!std::filesystem::exists(dog_path) && std::filesystem::exists("../" + dog_path)) dog_path = "../" + dog_path;
|
|
||||||
if (mob_dog.SetModel(dog_path)) {
|
|
||||||
mob_dog.SetVID(201);
|
|
||||||
mob_dog.SetScale(0.95f);
|
|
||||||
mob_dog.SetName("Wild Dog (Lv.1)");
|
|
||||||
mob_dog.SetMaxHP(600);
|
|
||||||
mob_dog.SetHeightOffset(85.0f);
|
|
||||||
mob_dog.SetModelYOffset(0.0f);
|
|
||||||
mob_dog.RegisterMotion(ava2::MotionType::Wait, "ymir work/monster/stray_dog/00.gr2");
|
|
||||||
mob_dog.PlayMotion(ava2::MotionType::Wait, true);
|
|
||||||
mob_dog.RegisterMotion(ava2::MotionType::Walk, "ymir work/monster/stray_dog/02.gr2");
|
|
||||||
mob_dog.RegisterMotion(ava2::MotionType::Run, "ymir work/monster/stray_dog/03.gr2");
|
|
||||||
mob_dog.RegisterMotion(ava2::MotionType::Attack, "ymir work/monster/stray_dog/20.gr2");
|
|
||||||
mob_dog.RegisterMotion(ava2::MotionType::Damage, "ymir work/monster/stray_dog/30.gr2");
|
|
||||||
mob_dog.RegisterMotion(ava2::MotionType::Dead, "ymir work/monster/stray_dog/31.gr2");
|
|
||||||
float dog_h = outdoor_terrain.GetHeightAtWorld(130.0f, 160.0f);
|
|
||||||
mob_dog.SetPosition(130.0f, dog_h, 160.0f);
|
|
||||||
mob_dog.SetYaw(38.7f); // Facing towards player at (0, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize Monster 2: Metin Stone (authentic crystalline monolith metinstone_01)
|
|
||||||
ava2::ActorInstance mob_metin;
|
ava2::ActorInstance mob_metin;
|
||||||
std::string metin_path = "ymir work/monster/metinstone/metinstone_01.gr2";
|
if (preview_data) {
|
||||||
if (!std::filesystem::exists(metin_path) && std::filesystem::exists("../" + metin_path)) metin_path = "../" + metin_path;
|
std::string dog_path = "ymir work/monster/stray_dog/stray_dog.gr2";
|
||||||
if (mob_metin.SetModel(metin_path)) {
|
if (!std::filesystem::exists(dog_path) && std::filesystem::exists("../" + dog_path)) dog_path = "../" + dog_path;
|
||||||
mob_metin.SetVID(301);
|
if (mob_dog.SetModel(dog_path)) {
|
||||||
mob_metin.SetScale(1.25f);
|
mob_dog.SetVID(201);
|
||||||
mob_metin.SetName("Metin of Sorrow (Lv.5)");
|
mob_dog.SetScale(0.95f);
|
||||||
mob_metin.SetMaxHP(2000);
|
mob_dog.SetName("Wild Dog (Lv.1)");
|
||||||
mob_metin.SetHeightOffset(135.0f);
|
mob_dog.SetMaxHP(600);
|
||||||
mob_metin.SetModelYOffset(0.0f);
|
mob_dog.SetHeightOffset(85.0f);
|
||||||
mob_metin.RegisterMotion(ava2::MotionType::Wait, "ymir work/monster/metinstone/metinstone_loop.gr2");
|
mob_dog.SetModelYOffset(0.0f);
|
||||||
mob_metin.PlayMotion(ava2::MotionType::Wait, true);
|
mob_dog.RegisterMotion(ava2::MotionType::Wait, "ymir work/monster/stray_dog/00.gr2");
|
||||||
mob_metin.RegisterMotion(ava2::MotionType::Damage, "ymir work/monster/metinstone/metinstone_blow.gr2");
|
mob_dog.PlayMotion(ava2::MotionType::Wait, true);
|
||||||
float metin_h = outdoor_terrain.GetHeightAtWorld(-320.0f, 220.0f);
|
mob_dog.RegisterMotion(ava2::MotionType::Walk, "ymir work/monster/stray_dog/02.gr2");
|
||||||
mob_metin.SetPosition(-320.0f, metin_h, 220.0f);
|
mob_dog.RegisterMotion(ava2::MotionType::Run, "ymir work/monster/stray_dog/03.gr2");
|
||||||
mob_metin.SetYaw(115.0f);
|
mob_dog.RegisterMotion(ava2::MotionType::Attack, "ymir work/monster/stray_dog/20.gr2");
|
||||||
|
mob_dog.RegisterMotion(ava2::MotionType::Damage, "ymir work/monster/stray_dog/30.gr2");
|
||||||
|
mob_dog.RegisterMotion(ava2::MotionType::Dead, "ymir work/monster/stray_dog/31.gr2");
|
||||||
|
float dog_h = outdoor_terrain.GetHeightAtWorld(130.0f, 160.0f);
|
||||||
|
mob_dog.SetPosition(130.0f, dog_h, 160.0f);
|
||||||
|
mob_dog.SetYaw(38.7f); // Facing towards player at (0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string metin_path = "ymir work/monster/metinstone/metinstone_01.gr2";
|
||||||
|
if (!std::filesystem::exists(metin_path) && std::filesystem::exists("../" + metin_path)) metin_path = "../" + metin_path;
|
||||||
|
if (mob_metin.SetModel(metin_path)) {
|
||||||
|
mob_metin.SetVID(301);
|
||||||
|
mob_metin.SetScale(1.25f);
|
||||||
|
mob_metin.SetName("Metin of Sorrow (Lv.5)");
|
||||||
|
mob_metin.SetMaxHP(2000);
|
||||||
|
mob_metin.SetHeightOffset(135.0f);
|
||||||
|
mob_metin.SetModelYOffset(0.0f);
|
||||||
|
mob_metin.RegisterMotion(ava2::MotionType::Wait, "ymir work/monster/metinstone/metinstone_loop.gr2");
|
||||||
|
mob_metin.PlayMotion(ava2::MotionType::Wait, true);
|
||||||
|
mob_metin.RegisterMotion(ava2::MotionType::Damage, "ymir work/monster/metinstone/metinstone_blow.gr2");
|
||||||
|
float metin_h = outdoor_terrain.GetHeightAtWorld(-320.0f, 220.0f);
|
||||||
|
mob_metin.SetPosition(-320.0f, metin_h, 220.0f);
|
||||||
|
mob_metin.SetYaw(115.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Floating Combat Text Manager (modeled after 40250 CPythonTextTail)
|
// Floating Combat Text Manager (modeled after 40250 CPythonTextTail)
|
||||||
@@ -1229,35 +1242,37 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
if (player_actor.Attack()) {
|
if (player_actor.Attack()) {
|
||||||
ava2::SoundManager::Instance().PlaySound3D(player_actor.GetX(), player_actor.GetY(), player_actor.GetZ(), "sound/common/swing/w_1h_c_1.wav");
|
ava2::SoundManager::Instance().PlaySound3D(player_actor.GetX(), player_actor.GetY(), player_actor.GetZ(), "sound/common/swing/w_1h_c_1.wav");
|
||||||
// Melee combat hit detection in forward cone (aligned with 40250)
|
if (preview_data) {
|
||||||
if (!mob_dog.IsDead() && player_actor.IsTargetInAttackRange(mob_dog, 180.0f, 85.0f)) {
|
// Melee combat hit detection in forward cone against stand-in preview monsters
|
||||||
int baseDmg = 150 + (std::rand() % 75) + player_actor.GetBonusAttackDamage();
|
if (!mob_dog.IsDead() && player_actor.IsTargetInAttackRange(mob_dog, 180.0f, 85.0f)) {
|
||||||
int dmg = static_cast<int>(baseDmg * player_actor.GetAttackMultiplier());
|
int baseDmg = 150 + (std::rand() % 75) + player_actor.GetBonusAttackDamage();
|
||||||
bool isCrit = ((std::rand() % 4) == 0);
|
int dmg = static_cast<int>(baseDmg * player_actor.GetAttackMultiplier());
|
||||||
if (isCrit) dmg = static_cast<int>(dmg * 1.8f);
|
bool isCrit = ((std::rand() % 4) == 0);
|
||||||
float kx = mob_dog.GetX() - player_actor.GetX();
|
if (isCrit) dmg = static_cast<int>(dmg * 1.8f);
|
||||||
float kz = mob_dog.GetZ() - player_actor.GetZ();
|
float kx = mob_dog.GetX() - player_actor.GetX();
|
||||||
mob_dog.TakeDamage(dmg, kx, kz);
|
float kz = mob_dog.GetZ() - player_actor.GetZ();
|
||||||
float hx, hy, hz;
|
mob_dog.TakeDamage(dmg, kx, kz);
|
||||||
mob_dog.GetHeadPosition(hx, hy, hz);
|
float hx, hy, hz;
|
||||||
floating_text_mgr.AddDamage(dmg, hx, hy + 20.0f, hz, isCrit, true);
|
mob_dog.GetHeadPosition(hx, hy, hz);
|
||||||
ava2::EffectManager::Instance().CreateEffect("ymir work/pc/warrior/effect/gihyeol_spark.mse", hx, hy + 20.0f, hz);
|
floating_text_mgr.AddDamage(dmg, hx, hy + 20.0f, hz, isCrit, true);
|
||||||
ava2::SoundManager::Instance().PlaySound3D(hx, hy, hz, "sound/monster/stray_dog/damage_1.wav");
|
ava2::EffectManager::Instance().CreateEffect("ymir work/pc/warrior/effect/gihyeol_spark.mse", hx, hy + 20.0f, hz);
|
||||||
if (mob_dog.IsDead()) ava2::SoundManager::Instance().PlaySound3D(hx, hy, hz, "sound/monster/stray_dog/dead_1.wav");
|
ava2::SoundManager::Instance().PlaySound3D(hx, hy, hz, "sound/monster/stray_dog/damage_1.wav");
|
||||||
SDL_Log("Player hit Wild Dog for %d dmg! (HP: %d/%d)", dmg, mob_dog.GetHP(), mob_dog.GetMaxHP());
|
if (mob_dog.IsDead()) ava2::SoundManager::Instance().PlaySound3D(hx, hy, hz, "sound/monster/stray_dog/dead_1.wav");
|
||||||
}
|
SDL_Log("Player hit Wild Dog for %d dmg! (HP: %d/%d)", dmg, mob_dog.GetHP(), mob_dog.GetMaxHP());
|
||||||
if (!mob_metin.IsDead() && player_actor.IsTargetInAttackRange(mob_metin, 230.0f, 90.0f)) {
|
}
|
||||||
int baseDmg = 130 + (std::rand() % 50) + player_actor.GetBonusAttackDamage();
|
if (!mob_metin.IsDead() && player_actor.IsTargetInAttackRange(mob_metin, 230.0f, 90.0f)) {
|
||||||
int dmg = static_cast<int>(baseDmg * player_actor.GetAttackMultiplier());
|
int baseDmg = 130 + (std::rand() % 50) + player_actor.GetBonusAttackDamage();
|
||||||
bool isCrit = ((std::rand() % 5) == 0);
|
int dmg = static_cast<int>(baseDmg * player_actor.GetAttackMultiplier());
|
||||||
if (isCrit) dmg = static_cast<int>(dmg * 1.8f);
|
bool isCrit = ((std::rand() % 5) == 0);
|
||||||
mob_metin.TakeDamage(dmg, 0.0f, 0.0f);
|
if (isCrit) dmg = static_cast<int>(dmg * 1.8f);
|
||||||
float hx, hy, hz;
|
mob_metin.TakeDamage(dmg, 0.0f, 0.0f);
|
||||||
mob_metin.GetHeadPosition(hx, hy, hz);
|
float hx, hy, hz;
|
||||||
floating_text_mgr.AddDamage(dmg, hx, hy + 30.0f, hz, isCrit, true);
|
mob_metin.GetHeadPosition(hx, hy, hz);
|
||||||
ava2::EffectManager::Instance().CreateEffect("ymir work/pc/warrior/effect/spark.mse", hx, hy + 30.0f, hz);
|
floating_text_mgr.AddDamage(dmg, hx, hy + 30.0f, hz, isCrit, true);
|
||||||
ava2::SoundManager::Instance().PlaySound3D(hx, hy, hz, "sound/monster/metinstone/metinstone_crash.wav");
|
ava2::EffectManager::Instance().CreateEffect("ymir work/pc/warrior/effect/spark.mse", hx, hy + 30.0f, hz);
|
||||||
SDL_Log("Player hit Metin Stone for %d dmg! (HP: %d/%d)", dmg, mob_metin.GetHP(), mob_metin.GetMaxHP());
|
ava2::SoundManager::Instance().PlaySound3D(hx, hy, hz, "sound/monster/metinstone/metinstone_crash.wav");
|
||||||
|
SDL_Log("Player hit Metin Stone for %d dmg! (HP: %d/%d)", dmg, mob_metin.GetHP(), mob_metin.GetMaxHP());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1503,8 +1518,10 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
// Update actor instances, floating combat text, and target decals
|
// Update actor instances, floating combat text, and target decals
|
||||||
player_actor.Update(dt, &outdoor_terrain, &map_objects);
|
player_actor.Update(dt, &outdoor_terrain, &map_objects);
|
||||||
mob_dog.Update(dt, &outdoor_terrain);
|
if (preview_data) {
|
||||||
mob_metin.Update(dt, &outdoor_terrain);
|
mob_dog.Update(dt, &outdoor_terrain);
|
||||||
|
mob_metin.Update(dt, &outdoor_terrain);
|
||||||
|
}
|
||||||
floating_text_mgr.Update(dt);
|
floating_text_mgr.Update(dt);
|
||||||
target_mgr.Update(dt);
|
target_mgr.Update(dt);
|
||||||
ava2::SoundManager::Instance().SetPosition(player_actor.GetX(), player_actor.GetY(), player_actor.GetZ());
|
ava2::SoundManager::Instance().SetPosition(player_actor.GetX(), player_actor.GetY(), player_actor.GetZ());
|
||||||
@@ -1520,10 +1537,12 @@ int main(int argc, char** argv) {
|
|||||||
// Update TextTail overhead positions
|
// Update TextTail overhead positions
|
||||||
auto& ttm = ava2::TextTailManager::Instance();
|
auto& ttm = ava2::TextTailManager::Instance();
|
||||||
ttm.SetCharacterPosition(1001, player_actor.GetX(), player_actor.GetY(), player_actor.GetZ());
|
ttm.SetCharacterPosition(1001, player_actor.GetX(), player_actor.GetY(), player_actor.GetZ());
|
||||||
if (!mob_dog.IsDead()) ttm.SetCharacterPosition(201, mob_dog.GetX(), mob_dog.GetY(), mob_dog.GetZ());
|
if (preview_data) {
|
||||||
else ttm.DeleteCharacterTextTail(201);
|
if (!mob_dog.IsDead()) ttm.SetCharacterPosition(201, mob_dog.GetX(), mob_dog.GetY(), mob_dog.GetZ());
|
||||||
if (!mob_metin.IsDead()) ttm.SetCharacterPosition(301, mob_metin.GetX(), mob_metin.GetY(), mob_metin.GetZ());
|
else ttm.DeleteCharacterTextTail(201);
|
||||||
else ttm.DeleteCharacterTextTail(301);
|
if (!mob_metin.IsDead()) ttm.SetCharacterPosition(301, mob_metin.GetX(), mob_metin.GetY(), mob_metin.GetZ());
|
||||||
|
else ttm.DeleteCharacterTextTail(301);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sword_aura_effect_id != 0) {
|
if (sword_aura_effect_id != 0) {
|
||||||
@@ -1651,13 +1670,15 @@ int main(int argc, char** argv) {
|
|||||||
auto char_draws = player_actor.BuildDrawCommands();
|
auto char_draws = player_actor.BuildDrawCommands();
|
||||||
for (auto& cd : char_draws) draws.push_back(std::move(cd));
|
for (auto& cd : char_draws) draws.push_back(std::move(cd));
|
||||||
|
|
||||||
// Add animated Wild Dog
|
if (preview_data) {
|
||||||
auto dog_draws = mob_dog.BuildDrawCommands();
|
// Add animated Wild Dog
|
||||||
for (auto& dd : dog_draws) draws.push_back(std::move(dd));
|
auto dog_draws = mob_dog.BuildDrawCommands();
|
||||||
|
for (auto& dd : dog_draws) draws.push_back(std::move(dd));
|
||||||
|
|
||||||
// Add animated Metin Stone
|
// Add animated Metin Stone
|
||||||
auto metin_draws = mob_metin.BuildDrawCommands();
|
auto metin_draws = mob_metin.BuildDrawCommands();
|
||||||
for (auto& md : metin_draws) draws.push_back(std::move(md));
|
for (auto& md : metin_draws) draws.push_back(std::move(md));
|
||||||
|
}
|
||||||
|
|
||||||
// Add Network Actors (e.g. ally SuraMage)
|
// Add Network Actors (e.g. ally SuraMage)
|
||||||
auto net_draws = ava2::NetworkActorManager::Instance().BuildDrawCommands(static_cast<float>(frames) * 0.033f);
|
auto net_draws = ava2::NetworkActorManager::Instance().BuildDrawCommands(static_cast<float>(frames) * 0.033f);
|
||||||
@@ -1693,11 +1714,13 @@ int main(int argc, char** argv) {
|
|||||||
// Render Minimap Radar HUD in game phase (modeled after 40250 CPythonMiniMap)
|
// Render Minimap Radar HUD in game phase (modeled after 40250 CPythonMiniMap)
|
||||||
if (last_phase == "game") {
|
if (last_phase == "game") {
|
||||||
minimap_mgr.ClearBlips();
|
minimap_mgr.ClearBlips();
|
||||||
if (!mob_dog.IsDead()) {
|
if (preview_data) {
|
||||||
minimap_mgr.AddBlip(mob_dog.GetX(), mob_dog.GetZ(), ava2::MinimapBlipType::Monster);
|
if (!mob_dog.IsDead()) {
|
||||||
}
|
minimap_mgr.AddBlip(mob_dog.GetX(), mob_dog.GetZ(), ava2::MinimapBlipType::Monster);
|
||||||
if (!mob_metin.IsDead()) {
|
}
|
||||||
minimap_mgr.AddBlip(mob_metin.GetX(), mob_metin.GetZ(), ava2::MinimapBlipType::Monster);
|
if (!mob_metin.IsDead()) {
|
||||||
|
minimap_mgr.AddBlip(mob_metin.GetX(), mob_metin.GetZ(), ava2::MinimapBlipType::Monster);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
minimap_mgr.AddBlip(60.0f, 140.0f, ava2::MinimapBlipType::NPC); // NPC
|
minimap_mgr.AddBlip(60.0f, 140.0f, ava2::MinimapBlipType::NPC); // NPC
|
||||||
|
|
||||||
@@ -1717,11 +1740,13 @@ int main(int argc, char** argv) {
|
|||||||
// Render Minimap Radar HUD in game phase (modeled after 40250 CPythonMiniMap)
|
// Render Minimap Radar HUD in game phase (modeled after 40250 CPythonMiniMap)
|
||||||
if (last_phase == "game") {
|
if (last_phase == "game") {
|
||||||
minimap_mgr.ClearBlips();
|
minimap_mgr.ClearBlips();
|
||||||
if (!mob_dog.IsDead()) {
|
if (preview_data) {
|
||||||
minimap_mgr.AddBlip(mob_dog.GetX(), mob_dog.GetZ(), ava2::MinimapBlipType::Monster);
|
if (!mob_dog.IsDead()) {
|
||||||
}
|
minimap_mgr.AddBlip(mob_dog.GetX(), mob_dog.GetZ(), ava2::MinimapBlipType::Monster);
|
||||||
if (!mob_metin.IsDead()) {
|
}
|
||||||
minimap_mgr.AddBlip(mob_metin.GetX(), mob_metin.GetZ(), ava2::MinimapBlipType::Monster);
|
if (!mob_metin.IsDead()) {
|
||||||
|
minimap_mgr.AddBlip(mob_metin.GetX(), mob_metin.GetZ(), ava2::MinimapBlipType::Monster);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
minimap_mgr.AddBlip(60.0f, 140.0f, ava2::MinimapBlipType::NPC); // NPC
|
minimap_mgr.AddBlip(60.0f, 140.0f, ava2::MinimapBlipType::NPC); // NPC
|
||||||
minimap_mgr.RenderRadar(surface3d.get(), view3d_w - 132, 5, 128, player_world_x, player_world_z, player_world_yaw);
|
minimap_mgr.RenderRadar(surface3d.get(), view3d_w - 132, 5, 128, player_world_x, player_world_z, player_world_yaw);
|
||||||
|
|||||||
+752
-99
@@ -16,6 +16,11 @@
|
|||||||
#include "python_wiki.h"
|
#include "python_wiki.h"
|
||||||
#include "shared/common/PythonUtils.h"
|
#include "shared/common/PythonUtils.h"
|
||||||
#include "eter_base/Random.h"
|
#include "eter_base/Random.h"
|
||||||
|
#include "python_background.h"
|
||||||
|
#include "eter_ui/PythonWindowManager.h"
|
||||||
|
#include "eter_effect/EffectManager.h"
|
||||||
|
#include "eter_effect/FlyingManager.h"
|
||||||
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -23,6 +28,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <thread>
|
||||||
|
#include <cstring>
|
||||||
|
#include <filesystem>
|
||||||
|
#include "eter_resource/ResourceManager.h"
|
||||||
|
|
||||||
namespace ava2 {
|
namespace ava2 {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -37,6 +46,12 @@ float s_camera_distance = 1500.0f;
|
|||||||
float s_camera_pitch = 30.0f;
|
float s_camera_pitch = 30.0f;
|
||||||
float s_camera_rotation = 0.0f;
|
float s_camera_rotation = 0.0f;
|
||||||
float s_camera_height = 180.0f;
|
float s_camera_height = 180.0f;
|
||||||
|
float s_camera_max_distance = 2500.0f;
|
||||||
|
int s_camera_speed = 100;
|
||||||
|
float s_camera_rotate_speed = 1.0f;
|
||||||
|
float s_camera_pitch_speed = 1.0f;
|
||||||
|
float s_camera_zoom_speed = 0.05f;
|
||||||
|
bool s_special_camera_mode = false;
|
||||||
bool s_hair_specular = false;
|
bool s_hair_specular = false;
|
||||||
bool s_armor_specular = false;
|
bool s_armor_specular = false;
|
||||||
bool s_weapon_specular = false;
|
bool s_weapon_specular = false;
|
||||||
@@ -64,10 +79,255 @@ PyObject* app_get_global_timestamp(PyObject*, PyObject*) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject* app_set_camera(PyObject*, PyObject* args) {
|
PyObject* app_set_camera(PyObject*, PyObject* args) {
|
||||||
if (!PyArg_ParseTuple(args, "ffff", &s_camera_distance, &s_camera_pitch, &s_camera_rotation, &s_camera_height)) return nullptr;
|
float Distance = 0.0f, Pitch = 0.0f, Rotation = 0.0f, DestinationHeight = 0.0f;
|
||||||
Py_RETURN_NONE;
|
if (!PyTuple_GetFloat(args, 0, &Distance) ||
|
||||||
|
!PyTuple_GetFloat(args, 1, &Pitch) ||
|
||||||
|
!PyTuple_GetFloat(args, 2, &Rotation) ||
|
||||||
|
!PyTuple_GetFloat(args, 3, &DestinationHeight)) {
|
||||||
|
return Py_BuildException();
|
||||||
|
}
|
||||||
|
s_camera_distance = Distance;
|
||||||
|
s_camera_pitch = Pitch;
|
||||||
|
s_camera_rotation = Rotation;
|
||||||
|
s_camera_height = DestinationHeight;
|
||||||
|
return Py_BuildNone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject* app_get_camera(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("ffff", s_camera_distance, s_camera_pitch, s_camera_rotation, s_camera_height);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_get_camera_pitch(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("f", s_camera_pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_get_camera_rotation(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("f", s_camera_rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_rotate_camera(PyObject*, PyObject* args) {
|
||||||
|
int iDirection = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &iDirection))
|
||||||
|
return Py_BuildException();
|
||||||
|
s_camera_rotation += s_camera_rotate_speed * static_cast<float>(iDirection);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_pitch_camera(PyObject*, PyObject* args) {
|
||||||
|
int iDirection = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &iDirection))
|
||||||
|
return Py_BuildException();
|
||||||
|
s_camera_pitch += s_camera_pitch_speed * static_cast<float>(iDirection);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_zoom_camera(PyObject*, PyObject* args) {
|
||||||
|
int iDirection = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &iDirection))
|
||||||
|
return Py_BuildException();
|
||||||
|
s_camera_distance *= (1.0f + s_camera_zoom_speed * static_cast<float>(iDirection));
|
||||||
|
if (s_camera_distance > s_camera_max_distance) s_camera_distance = s_camera_max_distance;
|
||||||
|
if (s_camera_distance < 100.0f) s_camera_distance = 100.0f;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_movie_rotate_camera(PyObject*, PyObject* args) {
|
||||||
|
int iDirection = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &iDirection))
|
||||||
|
return Py_BuildException();
|
||||||
|
s_camera_rotation += s_camera_rotate_speed * static_cast<float>(iDirection);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_movie_pitch_camera(PyObject*, PyObject* args) {
|
||||||
|
int iDirection = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &iDirection))
|
||||||
|
return Py_BuildException();
|
||||||
|
s_camera_pitch += s_camera_pitch_speed * static_cast<float>(iDirection);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_movie_zoom_camera(PyObject*, PyObject* args) {
|
||||||
|
int iDirection = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &iDirection))
|
||||||
|
return Py_BuildException();
|
||||||
|
s_camera_distance *= (1.0f + s_camera_zoom_speed * static_cast<float>(iDirection));
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_movie_reset_camera(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_set_camera_speed(PyObject*, PyObject* args) {
|
||||||
|
int iPercentage = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &iPercentage))
|
||||||
|
return Py_BuildException();
|
||||||
|
s_camera_speed = iPercentage;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_set_camera_max_distance(PyObject*, PyObject* args) {
|
||||||
|
float fMax = 0.0f;
|
||||||
|
if (!PyTuple_GetFloat(args, 0, &fMax))
|
||||||
|
return Py_BuildException();
|
||||||
|
s_camera_max_distance = fMax;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_set_camera_setting(PyObject*, PyObject* args) {
|
||||||
|
int ix = 0, iy = 0, iz = 0, iZoom = 0, iRotation = 0, iPitch = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &ix) ||
|
||||||
|
!PyTuple_GetInteger(args, 1, &iy) ||
|
||||||
|
!PyTuple_GetInteger(args, 2, &iz) ||
|
||||||
|
!PyTuple_GetInteger(args, 3, &iZoom) ||
|
||||||
|
!PyTuple_GetInteger(args, 4, &iRotation) ||
|
||||||
|
!PyTuple_GetInteger(args, 5, &iPitch)) {
|
||||||
|
return Py_BuildException();
|
||||||
|
}
|
||||||
|
s_camera_distance = static_cast<float>(iZoom);
|
||||||
|
s_camera_rotation = static_cast<float>(iRotation);
|
||||||
|
s_camera_pitch = static_cast<float>(iPitch);
|
||||||
|
s_camera_height = static_cast<float>(iz);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_save_camera_setting(PyObject*, PyObject* args) {
|
||||||
|
char* szFileName = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &szFileName))
|
||||||
|
return Py_BuildException();
|
||||||
|
std::ofstream f(szFileName ? szFileName : "");
|
||||||
|
if (f) {
|
||||||
|
f << "camerasetting " << s_camera_distance << " " << s_camera_pitch << " " << s_camera_rotation << "\n";
|
||||||
|
}
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_load_camera_setting(PyObject*, PyObject* args) {
|
||||||
|
char* szFileName = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &szFileName))
|
||||||
|
return Py_BuildException();
|
||||||
|
std::ifstream f(szFileName ? szFileName : "");
|
||||||
|
if (!f) return Py_BuildValue("i", 0);
|
||||||
|
std::string line;
|
||||||
|
while (std::getline(f, line)) {
|
||||||
|
float z = 0, p = 0, r = 0;
|
||||||
|
if (std::sscanf(line.c_str(), "camerasetting %f %f %f", &z, &p, &r) >= 3) {
|
||||||
|
s_camera_distance = z;
|
||||||
|
s_camera_pitch = p;
|
||||||
|
s_camera_rotation = r;
|
||||||
|
return Py_BuildValue("i", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Py_BuildValue("i", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_set_default_camera(PyObject*, PyObject*) {
|
||||||
|
s_camera_distance = 1500.0f;
|
||||||
|
s_camera_pitch = 30.0f;
|
||||||
|
s_camera_rotation = 0.0f;
|
||||||
|
s_camera_height = 180.0f;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_enable_special_camera_mode(PyObject*, PyObject*) {
|
||||||
|
s_special_camera_mode = true;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GetRotatingDirection(float fSource, float fTarget) {
|
||||||
|
if (fSource < 180.0f) {
|
||||||
|
if (fTarget < fSource)
|
||||||
|
return 1;
|
||||||
|
else if ((360.0f - fTarget) + fSource < 180.0f)
|
||||||
|
return 1;
|
||||||
|
return 2;
|
||||||
|
} else {
|
||||||
|
if (fTarget > fSource)
|
||||||
|
return 2;
|
||||||
|
else if ((360.0f - fSource) + fTarget < 180.0f)
|
||||||
|
return 2;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_get_rotating_direction(PyObject*, PyObject* args) {
|
||||||
|
float fSource = 0.0f, fTarget = 0.0f;
|
||||||
|
if (!PyTuple_GetFloat(args, 0, &fSource) || !PyTuple_GetFloat(args, 1, &fTarget))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildValue("i", GetRotatingDirection(fSource, fTarget));
|
||||||
|
}
|
||||||
|
|
||||||
|
static float GetDegreeDifference(float fSource, float fTarget) {
|
||||||
|
if (fSource < 180.0f) {
|
||||||
|
if (fTarget < fSource)
|
||||||
|
return fSource - fTarget;
|
||||||
|
else if (fTarget - fSource > 180.0f)
|
||||||
|
return 360.0f - (fTarget - fSource);
|
||||||
|
return fTarget - fSource;
|
||||||
|
} else {
|
||||||
|
if (fTarget > fSource)
|
||||||
|
return fTarget - fSource;
|
||||||
|
else if (fSource - fTarget > 180.0f)
|
||||||
|
return 360.0f - (fSource - fTarget);
|
||||||
|
return fSource - fTarget;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_get_degree_difference(PyObject*, PyObject* args) {
|
||||||
|
float fSource = 0.0f, fTarget = 0.0f;
|
||||||
|
if (!PyTuple_GetFloat(args, 0, &fSource) || !PyTuple_GetFloat(args, 1, &fTarget))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildValue("f", GetDegreeDifference(fSource, fTarget));
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_get_cursor_position(PyObject*, PyObject*) {
|
||||||
|
long lx = 0, ly = 0;
|
||||||
|
UI::CWindowManager::Instance().GetMousePosition(lx, ly);
|
||||||
|
return Py_BuildValue("ii", lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_update_game(PyObject*, PyObject*) {
|
||||||
|
long lx = 0, ly = 0;
|
||||||
|
UI::CWindowManager::Instance().GetMousePosition(lx, ly);
|
||||||
|
float camX = 0.0f, camY = 0.0f, camZ = 0.0f;
|
||||||
|
auto* mainActor = NetworkActorManager::Instance().GetMainInstance();
|
||||||
|
if (mainActor) {
|
||||||
|
camX = static_cast<float>(mainActor->m_lCurX);
|
||||||
|
camY = static_cast<float>(mainActor->m_lCurY);
|
||||||
|
camZ = static_cast<float>(mainActor->m_lCurZ);
|
||||||
|
}
|
||||||
|
CPythonBackground::Instance().Update(camX, camY, camZ);
|
||||||
|
float dt = 0.033f;
|
||||||
|
NetworkActorManager::Instance().Update(dt, CPythonBackground::Instance().GetTerrain());
|
||||||
|
EffectManager::Instance().Update(dt);
|
||||||
|
static float s_flyingTime = 0.0f;
|
||||||
|
s_flyingTime += dt;
|
||||||
|
FlyingManager::Instance().Update(dt, s_flyingTime);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* app_render_game(PyObject*, PyObject*) {
|
||||||
|
auto& bg = CPythonBackground::Instance();
|
||||||
|
bg.RenderSky();
|
||||||
|
bg.RenderBeforeLensFlare();
|
||||||
|
bg.RenderCloud();
|
||||||
|
bg.BeginEnvironment();
|
||||||
|
bg.Render();
|
||||||
|
bg.SetCharacterDirLight();
|
||||||
|
bg.SetBackgroundDirLight();
|
||||||
|
bg.RenderWater();
|
||||||
|
bg.RenderSnow();
|
||||||
|
bg.RenderEffect();
|
||||||
|
bg.EndEnvironment();
|
||||||
|
bg.BeginEnvironment();
|
||||||
|
bg.RenderPCBlocker();
|
||||||
|
bg.EndEnvironment();
|
||||||
|
bg.RenderAfterLensFlare();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PyObject* app_set_hair_color_enable(PyObject*, PyObject* args) { int f = 0; if(!PyArg_ParseTuple(args, "i", &f)) return nullptr; NetworkActorManager::SetHairColorEnable(f != 0); Py_RETURN_NONE; }
|
PyObject* app_set_hair_color_enable(PyObject*, PyObject* args) { int f = 0; if(!PyArg_ParseTuple(args, "i", &f)) return nullptr; NetworkActorManager::SetHairColorEnable(f != 0); Py_RETURN_NONE; }
|
||||||
PyObject* app_set_armor_specular_enable(PyObject*, PyObject* args) { int f = 0; if(!PyArg_ParseTuple(args, "i", &f)) return nullptr; s_armor_specular = (f != 0); NetworkActorManager::SetArmorSpecularEnable(f != 0); Py_RETURN_NONE; }
|
PyObject* app_set_armor_specular_enable(PyObject*, PyObject* args) { int f = 0; if(!PyArg_ParseTuple(args, "i", &f)) return nullptr; s_armor_specular = (f != 0); NetworkActorManager::SetArmorSpecularEnable(f != 0); Py_RETURN_NONE; }
|
||||||
PyObject* app_set_weapon_specular_enable(PyObject*, PyObject* args) { int f = 0; if(!PyArg_ParseTuple(args, "i", &f)) return nullptr; s_weapon_specular = (f != 0); Py_RETURN_NONE; }
|
PyObject* app_set_weapon_specular_enable(PyObject*, PyObject* args) { int f = 0; if(!PyArg_ParseTuple(args, "i", &f)) return nullptr; s_weapon_specular = (f != 0); Py_RETURN_NONE; }
|
||||||
@@ -117,8 +377,6 @@ PyObject* app_get_default_codepage(PyObject*, PyObject*) {
|
|||||||
return PyInt_FromLong(GetDefaultCodePage());
|
return PyInt_FromLong(GetDefaultCodePage());
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* app_dummy_none(PyObject*, PyObject*) { Py_RETURN_NONE; }
|
|
||||||
|
|
||||||
// appGetRandom: EterBase random_range over the swapped bounds.
|
// appGetRandom: EterBase random_range over the swapped bounds.
|
||||||
PyObject* app_get_random(PyObject*, PyObject* poArgs) {
|
PyObject* app_get_random(PyObject*, PyObject* poArgs) {
|
||||||
int from;
|
int from;
|
||||||
@@ -131,12 +389,6 @@ PyObject* app_get_random(PyObject*, PyObject* poArgs) {
|
|||||||
std::swap(from, to);
|
std::swap(from, to);
|
||||||
return Py_BuildValue("i", eter::random_range(from, to));
|
return Py_BuildValue("i", eter::random_range(from, to));
|
||||||
}
|
}
|
||||||
PyObject* app_dummy_zero(PyObject*, PyObject*) { return PyInt_FromLong(0); }
|
|
||||||
PyObject* app_dummy_one(PyObject*, PyObject*) { return PyInt_FromLong(1); }
|
|
||||||
PyObject* app_dummy_float_zero(PyObject*, PyObject*) { return PyFloat_FromDouble(0.0); }
|
|
||||||
PyObject* app_dummy_str(PyObject*, PyObject*) { return PyString_FromString(""); }
|
|
||||||
PyObject* app_dummy_tuple2(PyObject*, PyObject*) { return Py_BuildValue("ii", 0, 0); }
|
|
||||||
PyObject* app_dummy_tuple3(PyObject*, PyObject*) { return Py_BuildValue("iii", 0, 0, 0); }
|
|
||||||
|
|
||||||
// CTextLineLoader / appOpenTextFile..appGetTextFileLine (PythonApplicationModule.cpp).
|
// CTextLineLoader / appOpenTextFile..appGetTextFileLine (PythonApplicationModule.cpp).
|
||||||
// Windows hands Python the heap pointer as an int; 64-bit hosts get an index instead.
|
// Windows hands Python the heap pointer as an int; 64-bit hosts get an index instead.
|
||||||
@@ -206,90 +458,483 @@ unsigned GetDefaultCodePage() { return 1252; }
|
|||||||
int GetTwoHandedAttackSpeedDecrease(){return twoHandedAttackSpeedDecrease;}
|
int GetTwoHandedAttackSpeedDecrease(){return twoHandedAttackSpeedDecrease;}
|
||||||
bool IsYmirLocale() { return s_locale_name=="ymir"; }
|
bool IsYmirLocale() { return s_locale_name=="ymir"; }
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
static float s_textTailLivingTime = 5000.0f;
|
||||||
|
static bool s_skillEffectUpgradeEnable = false;
|
||||||
|
static bool s_rideHorseEnable = true;
|
||||||
|
static float s_minFog = 0.0f;
|
||||||
|
static bool s_frameSkip = false;
|
||||||
|
static int s_fps = 60;
|
||||||
|
static int s_globalCenterX = 0, s_globalCenterY = 0;
|
||||||
|
static float s_centerX = 0.0f, s_centerY = 0.0f, s_centerZ = 0.0f;
|
||||||
|
static int s_cursorNum = 0;
|
||||||
|
static bool s_cursorVisible = true;
|
||||||
|
static bool s_softwareCursor = false;
|
||||||
|
static std::string s_connectIP = "";
|
||||||
|
static int s_connectPort = 0;
|
||||||
|
static std::string s_defaultFontName = "Arial:12";
|
||||||
|
static std::string s_guildSymbolPath = "mark";
|
||||||
|
static int s_sightRange = 12000;
|
||||||
|
static bool s_cheonma = false;
|
||||||
|
static float s_specularSpeed = 1.0f;
|
||||||
|
static int s_accumulationTime = 0;
|
||||||
|
static float s_specularColor[3] = {1.0f, 1.0f, 1.0f};
|
||||||
|
static bool s_visibleNotice = true;
|
||||||
|
static int s_multiFarmStatus = 0;
|
||||||
|
static std::string s_appTitle = "AVA2";
|
||||||
|
static std::string s_appMiniTitle = "AVA2";
|
||||||
|
|
||||||
|
static void tea_decode(uint32_t sz, uint32_t sy, const uint32_t* key, uint32_t* dest) {
|
||||||
|
uint32_t y = sy, z = sz;
|
||||||
|
uint32_t sum = 0x9E3779B9u * 32u;
|
||||||
|
for (int n = 0; n < 32; ++n) {
|
||||||
|
z -= ((y << 4 ^ y >> 5) + y) ^ (sum + key[sum >> 11 & 3]);
|
||||||
|
sum -= 0x9E3779B9u;
|
||||||
|
y -= ((z << 4 ^ z >> 5) + z) ^ (sum + key[sum & 3]);
|
||||||
|
}
|
||||||
|
*dest++ = y;
|
||||||
|
*dest = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int tea_decrypt_data(uint32_t* dest, const uint32_t* src, const uint32_t* key, int size) {
|
||||||
|
int resize = (size % 8 != 0) ? (size + 8 - (size % 8)) : size;
|
||||||
|
for (int i = 0; i < resize >> 3; ++i, dest += 2, src += 2) {
|
||||||
|
tea_decode(*(src + 1), *src, key, dest);
|
||||||
|
}
|
||||||
|
return resize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* app_is_dev_stage(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_is_test_stage(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_is_live_stage(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 1);
|
||||||
|
}
|
||||||
|
static PyObject* app_set_text_tail_living_time(PyObject*, PyObject* args) {
|
||||||
|
float livingTime = 0.0f;
|
||||||
|
if (!PyTuple_GetFloat(args, 0, &livingTime)) return Py_BuildException();
|
||||||
|
s_textTailLivingTime = livingTime * 1000.0f;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_enable_performance_time(PyObject*, PyObject* args) {
|
||||||
|
char* mode = nullptr; int enable = 0;
|
||||||
|
if (!PyTuple_GetString(args, 0, &mode) || !PyTuple_GetInteger(args, 1, &enable)) return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_skill_effect_upgrade_enable(PyObject*, PyObject* args) {
|
||||||
|
int enable = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &enable)) return Py_BuildException();
|
||||||
|
s_skillEffectUpgradeEnable = (enable != 0);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_ride_horse_enable(PyObject*, PyObject* args) {
|
||||||
|
int enable = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &enable)) return Py_BuildException();
|
||||||
|
s_rideHorseEnable = (enable != 0);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_min_fog(PyObject*, PyObject* args) {
|
||||||
|
float fog = 0.0f;
|
||||||
|
if (!PyTuple_GetFloat(args, 0, &fog)) return Py_BuildException();
|
||||||
|
s_minFog = fog;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_frame_skip(PyObject*, PyObject* args) {
|
||||||
|
int skip = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &skip)) return Py_BuildException();
|
||||||
|
s_frameSkip = (skip != 0);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_get_image_info(PyObject*, PyObject* args) {
|
||||||
|
char* filename = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &filename)) return Py_BuildException();
|
||||||
|
return Py_BuildValue("iii", 0, 0, 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_get_info(PyObject*, PyObject* args) {
|
||||||
|
int info = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &info)) return Py_BuildException();
|
||||||
|
return Py_BuildValue("s", "");
|
||||||
|
}
|
||||||
|
static PyObject* app_process(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 1);
|
||||||
|
}
|
||||||
|
static PyObject* app_is_exist_file(PyObject*, PyObject* args) {
|
||||||
|
char* filename = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &filename)) return Py_BuildException();
|
||||||
|
return Py_BuildValue("i", (CResourceManager::ResourceExists(filename) || std::filesystem::exists(filename)) ? 1 : 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_get_file_list(PyObject*, PyObject* args) {
|
||||||
|
char* filter = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &filter)) return Py_BuildException();
|
||||||
|
PyObject* poList = PyList_New(0);
|
||||||
|
try {
|
||||||
|
std::filesystem::path p(filter);
|
||||||
|
std::filesystem::path dir = p.parent_path();
|
||||||
|
if (dir.empty()) dir = ".";
|
||||||
|
std::string pattern = p.filename().string();
|
||||||
|
if (std::filesystem::exists(dir) && std::filesystem::is_directory(dir)) {
|
||||||
|
for (const auto& entry : std::filesystem::directory_iterator(dir)) {
|
||||||
|
std::string name = entry.path().filename().string();
|
||||||
|
if (pattern.empty() || pattern == "*.*" || pattern == "*" || name.find(pattern) != std::string::npos) {
|
||||||
|
PyList_Append(poList, PyString_FromString(name.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (...) {}
|
||||||
|
return poList;
|
||||||
|
}
|
||||||
|
static PyObject* app_get_update_fps(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", s_fps);
|
||||||
|
}
|
||||||
|
static PyObject* app_get_render_fps(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", s_fps);
|
||||||
|
}
|
||||||
|
static PyObject* app_get_available_texture_memory(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 256 * 1024 * 1024);
|
||||||
|
}
|
||||||
|
static PyObject* app_get_render_time(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("fi", 0.016f, 16);
|
||||||
|
}
|
||||||
|
static PyObject* app_get_update_time(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 16);
|
||||||
|
}
|
||||||
|
static PyObject* app_get_load(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_get_face_speed(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("f", 0.0f);
|
||||||
|
}
|
||||||
|
static PyObject* app_get_face_count(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_set_fps(PyObject*, PyObject* args) {
|
||||||
|
int fps = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &fps)) return Py_BuildException();
|
||||||
|
s_fps = fps;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_global_center_position(PyObject*, PyObject* args) {
|
||||||
|
int x = 0, y = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &x) || !PyTuple_GetInteger(args, 1, &y)) return Py_BuildException();
|
||||||
|
s_globalCenterX = x; s_globalCenterY = y;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_center_position(PyObject*, PyObject* args) {
|
||||||
|
float x = 0.0f, y = 0.0f, z = 0.0f;
|
||||||
|
if (!PyTuple_GetFloat(args, 0, &x) || !PyTuple_GetFloat(args, 1, &y) || !PyTuple_GetFloat(args, 2, &z)) return Py_BuildException();
|
||||||
|
s_centerX = x; s_centerY = y; s_centerZ = z;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_run_python_file(PyObject*, PyObject* args) {
|
||||||
|
char* filename = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &filename)) return Py_BuildException();
|
||||||
|
FILE* fp = fopen(filename, "r");
|
||||||
|
if (!fp) return Py_BuildValue("i", 0);
|
||||||
|
int res = PyRun_SimpleFile(fp, filename);
|
||||||
|
fclose(fp);
|
||||||
|
return Py_BuildValue("i", res == 0 ? 1 : 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_is_web_page_mode(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_show_web_page(PyObject*, PyObject* args) {
|
||||||
|
char* url = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &url)) return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_move_web_page(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_hide_web_page(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_cursor(PyObject*, PyObject* args) {
|
||||||
|
int cursor = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &cursor)) return Py_BuildException();
|
||||||
|
s_cursorNum = cursor;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_get_cursor(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", s_cursorNum);
|
||||||
|
}
|
||||||
|
static PyObject* app_show_cursor(PyObject*, PyObject*) {
|
||||||
|
s_cursorVisible = true;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_hide_cursor(PyObject*, PyObject*) {
|
||||||
|
s_cursorVisible = false;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_is_show_cursor(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", s_cursorVisible ? 1 : 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_is_liar_cursor_on(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_set_software_cursor(PyObject*, PyObject*) {
|
||||||
|
s_softwareCursor = true;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_hardware_cursor(PyObject*, PyObject*) {
|
||||||
|
s_softwareCursor = false;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_connect_data(PyObject*, PyObject* args) {
|
||||||
|
char* ip = nullptr; int port = 0;
|
||||||
|
if (!PyTuple_GetString(args, 0, &ip) || !PyTuple_GetInteger(args, 1, &port)) return Py_BuildException();
|
||||||
|
s_connectIP = ip; s_connectPort = port;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_get_connect_data(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("si", s_connectIP.c_str(), s_connectPort);
|
||||||
|
}
|
||||||
|
static PyObject* app_sleep(PyObject*, PyObject* args) {
|
||||||
|
int ms = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &ms)) return Py_BuildException();
|
||||||
|
if (ms > 0) std::this_thread::sleep_for(std::chrono::milliseconds(ms));
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_default_font_name(PyObject*, PyObject* args) {
|
||||||
|
char* font = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &font)) return Py_BuildException();
|
||||||
|
s_defaultFontName = font;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_guild_symbol_path(PyObject*, PyObject* args) {
|
||||||
|
char* path = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &path)) return Py_BuildException();
|
||||||
|
s_guildSymbolPath = path;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_sight_range(PyObject*, PyObject* args) {
|
||||||
|
int range = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &range)) return Py_BuildException();
|
||||||
|
s_sightRange = range;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_is_file_exist(PyObject*, PyObject* args) {
|
||||||
|
char* filename = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &filename)) return Py_BuildException();
|
||||||
|
return Py_BuildValue("i", std::filesystem::exists(filename) ? 1 : 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_force_set_locale(PyObject*, PyObject* args) {
|
||||||
|
char* name = nullptr; char* localePath = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &name) || !PyTuple_GetString(args, 1, &localePath)) return Py_BuildException();
|
||||||
|
s_locale_name = name; s_locale_path = localePath;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_load_locale_addr(PyObject*, PyObject* args) {
|
||||||
|
char* addrPath = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &addrPath)) return Py_BuildException();
|
||||||
|
FILE* fp = fopen(addrPath, "rb");
|
||||||
|
if (!fp) return Py_BuildException("Cannot open locale addr file");
|
||||||
|
fseek(fp, 0, SEEK_END);
|
||||||
|
long size = ftell(fp);
|
||||||
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
if (size <= 0) {
|
||||||
|
fclose(fp);
|
||||||
|
return Py_BuildValue("s", "");
|
||||||
|
}
|
||||||
|
std::vector<uint8_t> enc(size + 8, 0);
|
||||||
|
fread(enc.data(), size, 1, fp);
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
static const unsigned char rawKey[16] = {
|
||||||
|
0x82, 0x1b, 0x34, 0xae,
|
||||||
|
0x12, 0x3b, 0xfb, 0x17,
|
||||||
|
0xd7, 0x2c, 0x39, 0xae,
|
||||||
|
0x41, 0x98, 0xf1, 0x63
|
||||||
|
};
|
||||||
|
uint32_t k[4];
|
||||||
|
std::memcpy(k, rawKey, 16);
|
||||||
|
|
||||||
|
std::vector<uint32_t> buf((size + 7) / 4 + 2, 0);
|
||||||
|
tea_decrypt_data(buf.data(), reinterpret_cast<const uint32_t*>(enc.data()), k, size);
|
||||||
|
uint32_t retSize = buf[0];
|
||||||
|
const char* ret = reinterpret_cast<const char*>(buf.data()) + sizeof(uint32_t);
|
||||||
|
if (retSize > (uint32_t)(size)) retSize = 0;
|
||||||
|
return Py_BuildValue("s#", ret, retSize);
|
||||||
|
}
|
||||||
|
static PyObject* app_set_cheonma(PyObject*, PyObject* args) {
|
||||||
|
int enable = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &enable)) return Py_BuildException();
|
||||||
|
s_cheonma = (enable != 0);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_is_cheonma(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", s_cheonma ? 1 : 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_set_control_fp(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_specular_speed(PyObject*, PyObject* args) {
|
||||||
|
float spd = 0.0f;
|
||||||
|
if (!PyTuple_GetFloat(args, 0, &spd)) return Py_BuildException();
|
||||||
|
s_specularSpeed = spd;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_test_get_accumulation_time(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", s_accumulationTime);
|
||||||
|
}
|
||||||
|
static PyObject* app_test_reset_accumulation_time(PyObject*, PyObject*) {
|
||||||
|
s_accumulationTime = 0;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_test_set_specular_color(PyObject*, PyObject* args) {
|
||||||
|
float r = 0.0f, g = 0.0f, b = 0.0f;
|
||||||
|
if (!PyTuple_GetFloat(args, 0, &r) || !PyTuple_GetFloat(args, 1, &g) || !PyTuple_GetFloat(args, 2, &b)) return Py_BuildException();
|
||||||
|
s_specularColor[0] = r; s_specularColor[1] = g; s_specularColor[2] = b;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_visible_notice(PyObject*, PyObject* args) {
|
||||||
|
int flag = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &flag)) return Py_BuildException();
|
||||||
|
s_visibleNotice = (flag != 0);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_is_visible_notice(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", s_visibleNotice ? 1 : 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_on_logo_update(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
static PyObject* app_on_logo_render(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_on_logo_open(PyObject*, PyObject* args) {
|
||||||
|
char* name = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &name)) return Py_BuildException();
|
||||||
|
return Py_BuildValue("i", 1);
|
||||||
|
}
|
||||||
|
static PyObject* app_on_logo_close(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_flash_application(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_multi_farm_exe_icon(PyObject*, PyObject* args) {
|
||||||
|
int status = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &status)) return Py_BuildException();
|
||||||
|
s_multiFarmStatus = status;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_window_status(PyObject*, PyObject* args) {
|
||||||
|
int status = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &status)) return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_is_visible(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 1);
|
||||||
|
}
|
||||||
|
static PyObject* app_set_title(PyObject*, PyObject* args) {
|
||||||
|
char* title = nullptr; char* miniTitle = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &title)) return Py_BuildException();
|
||||||
|
if (PyTuple_Size(args) > 1) {
|
||||||
|
if (!PyTuple_GetString(args, 1, &miniTitle)) return Py_BuildException();
|
||||||
|
}
|
||||||
|
s_appTitle = title;
|
||||||
|
if (miniTitle) s_appMiniTitle = miniTitle;
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_set_message(PyObject*, PyObject* args) {
|
||||||
|
char* title = nullptr; char* message = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &title) || !PyTuple_GetString(args, 1, &message)) return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
static PyObject* app_is_can_open_render(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
void initapp() {
|
void initapp() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"IsDevStage", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsDevStage", app_is_dev_stage, METH_VARARGS, nullptr},
|
||||||
{"IsTestStage", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsTestStage", app_is_test_stage, METH_VARARGS, nullptr},
|
||||||
{"IsLiveStage", app_dummy_one, METH_VARARGS, nullptr},
|
{"IsLiveStage", app_is_live_stage, METH_VARARGS, nullptr},
|
||||||
{"SetTextTailLivingTime", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetTextTailLivingTime", app_set_text_tail_living_time, METH_VARARGS, nullptr},
|
||||||
{"EnablePerformanceTime", app_dummy_none, METH_VARARGS, nullptr},
|
{"EnablePerformanceTime", app_enable_performance_time, METH_VARARGS, nullptr},
|
||||||
{"SetHairColorEnable", app_set_hair_color_enable, METH_VARARGS, nullptr},
|
{"SetHairColorEnable", app_set_hair_color_enable, METH_VARARGS, nullptr},
|
||||||
{"SetArmorSpecularEnable", app_set_armor_specular_enable, METH_VARARGS, nullptr},
|
{"SetArmorSpecularEnable", app_set_armor_specular_enable, METH_VARARGS, nullptr},
|
||||||
{"SetWeaponSpecularEnable", app_set_weapon_specular_enable, METH_VARARGS, nullptr},
|
{"SetWeaponSpecularEnable", app_set_weapon_specular_enable, METH_VARARGS, nullptr},
|
||||||
{"SetSkillEffectUpgradeEnable", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetSkillEffectUpgradeEnable", app_set_skill_effect_upgrade_enable, METH_VARARGS, nullptr},
|
||||||
{"SetTwoHandedWeaponAttSpeedDecreaseValue", set_twohand_decrease, METH_VARARGS, nullptr},
|
{"SetTwoHandedWeaponAttSpeedDecreaseValue", set_twohand_decrease, METH_VARARGS, nullptr},
|
||||||
{"SetRideHorseEnable", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetRideHorseEnable", app_set_ride_horse_enable, METH_VARARGS, nullptr},
|
||||||
{"SetCameraMaxDistance", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetCameraMaxDistance", app_set_camera_max_distance, METH_VARARGS, nullptr},
|
||||||
{"SetMinFog", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetMinFog", app_set_min_fog, METH_VARARGS, nullptr},
|
||||||
{"SetFrameSkip", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetFrameSkip", app_set_frame_skip, METH_VARARGS, nullptr},
|
||||||
{"GetImageInfo", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetImageInfo", app_get_image_info, METH_VARARGS, nullptr},
|
||||||
{"GetInfo", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetInfo", app_get_info, METH_VARARGS, nullptr},
|
||||||
{"UpdateGame", app_dummy_none, METH_VARARGS, nullptr},
|
{"UpdateGame", app_update_game, METH_VARARGS, nullptr},
|
||||||
{"RenderGame", app_dummy_none, METH_VARARGS, nullptr},
|
{"RenderGame", app_render_game, METH_VARARGS, nullptr},
|
||||||
{"Loop", app_loop, METH_VARARGS, nullptr},
|
{"Loop", app_loop, METH_VARARGS, nullptr},
|
||||||
{"Create", app_create, METH_VARARGS, nullptr},
|
{"Create", app_create, METH_VARARGS, nullptr},
|
||||||
{"Process", app_dummy_none, METH_VARARGS, nullptr},
|
{"Process", app_process, METH_VARARGS, nullptr},
|
||||||
{"Exit", app_exit, METH_VARARGS, nullptr},
|
{"Exit", app_exit, METH_VARARGS, nullptr},
|
||||||
{"Abort", app_abort, METH_VARARGS, nullptr},
|
{"Abort", app_abort, METH_VARARGS, nullptr},
|
||||||
{"SetMouseHandler", app_set_mouse_handler, METH_VARARGS, nullptr},
|
{"SetMouseHandler", app_set_mouse_handler, METH_VARARGS, nullptr},
|
||||||
{"IsExistFile", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsExistFile", app_is_exist_file, METH_VARARGS, nullptr},
|
||||||
{"GetFileList", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetFileList", app_get_file_list, METH_VARARGS, nullptr},
|
||||||
{"SetCamera", app_set_camera, METH_VARARGS, nullptr},
|
{"SetCamera", app_set_camera, METH_VARARGS, nullptr},
|
||||||
{"GetCamera", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetCamera", app_get_camera, METH_VARARGS, nullptr},
|
||||||
{"GetCameraPitch", app_dummy_float_zero, METH_VARARGS, nullptr},
|
{"GetCameraPitch", app_get_camera_pitch, METH_VARARGS, nullptr},
|
||||||
{"GetCameraRotation", app_dummy_float_zero, METH_VARARGS, nullptr},
|
{"GetCameraRotation", app_get_camera_rotation, METH_VARARGS, nullptr},
|
||||||
{"GetTime", app_get_time, METH_VARARGS, nullptr},
|
{"GetTime", app_get_time, METH_VARARGS, nullptr},
|
||||||
{"GetGlobalTime", app_get_global_time, METH_VARARGS, nullptr},
|
{"GetGlobalTime", app_get_global_time, METH_VARARGS, nullptr},
|
||||||
{"GetGlobalTimeStamp", app_get_global_timestamp, METH_VARARGS, nullptr},
|
{"GetGlobalTimeStamp", app_get_global_timestamp, METH_VARARGS, nullptr},
|
||||||
{"GetUpdateFPS", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetUpdateFPS", app_get_update_fps, METH_VARARGS, nullptr},
|
||||||
{"GetRenderFPS", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetRenderFPS", app_get_render_fps, METH_VARARGS, nullptr},
|
||||||
{"RotateCamera", app_dummy_none, METH_VARARGS, nullptr},
|
{"RotateCamera", app_rotate_camera, METH_VARARGS, nullptr},
|
||||||
{"PitchCamera", app_dummy_none, METH_VARARGS, nullptr},
|
{"PitchCamera", app_pitch_camera, METH_VARARGS, nullptr},
|
||||||
{"ZoomCamera", app_dummy_none, METH_VARARGS, nullptr},
|
{"ZoomCamera", app_zoom_camera, METH_VARARGS, nullptr},
|
||||||
{"MovieRotateCamera", app_dummy_none, METH_VARARGS, nullptr},
|
{"MovieRotateCamera", app_movie_rotate_camera, METH_VARARGS, nullptr},
|
||||||
{"MoviePitchCamera", app_dummy_none, METH_VARARGS, nullptr},
|
{"MoviePitchCamera", app_movie_pitch_camera, METH_VARARGS, nullptr},
|
||||||
{"MovieZoomCamera", app_dummy_none, METH_VARARGS, nullptr},
|
{"MovieZoomCamera", app_movie_zoom_camera, METH_VARARGS, nullptr},
|
||||||
{"MovieResetCamera", app_dummy_none, METH_VARARGS, nullptr},
|
{"MovieResetCamera", app_movie_reset_camera, METH_VARARGS, nullptr},
|
||||||
{"GetAvailableTextureMemory", app_dummy_str, METH_VARARGS, nullptr},
|
{"GetAvailableTextureMemory", app_get_available_texture_memory, METH_VARARGS, nullptr},
|
||||||
{"GetRenderTime", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetRenderTime", app_get_render_time, METH_VARARGS, nullptr},
|
||||||
{"GetUpdateTime", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetUpdateTime", app_get_update_time, METH_VARARGS, nullptr},
|
||||||
{"GetLoad", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetLoad", app_get_load, METH_VARARGS, nullptr},
|
||||||
{"GetFaceSpeed", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetFaceSpeed", app_get_face_speed, METH_VARARGS, nullptr},
|
||||||
{"GetFaceCount", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetFaceCount", app_get_face_count, METH_VARARGS, nullptr},
|
||||||
{"SetFPS", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetFPS", app_set_fps, METH_VARARGS, nullptr},
|
||||||
{"SetGlobalCenterPosition", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetGlobalCenterPosition", app_set_global_center_position, METH_VARARGS, nullptr},
|
||||||
{"SetCenterPosition", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetCenterPosition", app_set_center_position, METH_VARARGS, nullptr},
|
||||||
{"GetCursorPosition", app_dummy_tuple2, METH_VARARGS, nullptr},
|
{"GetCursorPosition", app_get_cursor_position, METH_VARARGS, nullptr},
|
||||||
{"GetRandom", app_get_random, METH_VARARGS, nullptr},
|
{"GetRandom", app_get_random, METH_VARARGS, nullptr},
|
||||||
{"RunPythonFile", app_dummy_none, METH_VARARGS, nullptr},
|
{"RunPythonFile", app_run_python_file, METH_VARARGS, nullptr},
|
||||||
{"IsWebPageMode", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsWebPageMode", app_is_web_page_mode, METH_VARARGS, nullptr},
|
||||||
{"ShowWebPage", app_dummy_none, METH_VARARGS, nullptr},
|
{"ShowWebPage", app_show_web_page, METH_VARARGS, nullptr},
|
||||||
{"MoveWebPage", app_dummy_none, METH_VARARGS, nullptr},
|
{"MoveWebPage", app_move_web_page, METH_VARARGS, nullptr},
|
||||||
{"HideWebPage", app_dummy_none, METH_VARARGS, nullptr},
|
{"HideWebPage", app_hide_web_page, METH_VARARGS, nullptr},
|
||||||
{"IsPressed", app_is_pressed, METH_VARARGS, nullptr},
|
{"IsPressed", app_is_pressed, METH_VARARGS, nullptr},
|
||||||
{"SetCursor", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetCursor", app_set_cursor, METH_VARARGS, nullptr},
|
||||||
{"GetCursor", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetCursor", app_get_cursor, METH_VARARGS, nullptr},
|
||||||
{"ShowCursor", app_dummy_none, METH_VARARGS, nullptr},
|
{"ShowCursor", app_show_cursor, METH_VARARGS, nullptr},
|
||||||
{"HideCursor", app_dummy_none, METH_VARARGS, nullptr},
|
{"HideCursor", app_hide_cursor, METH_VARARGS, nullptr},
|
||||||
{"IsShowCursor", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsShowCursor", app_is_show_cursor, METH_VARARGS, nullptr},
|
||||||
{"IsLiarCursorOn", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsLiarCursorOn", app_is_liar_cursor_on, METH_VARARGS, nullptr},
|
||||||
{"SetSoftwareCursor", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetSoftwareCursor", app_set_software_cursor, METH_VARARGS, nullptr},
|
||||||
{"SetHardwareCursor", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetHardwareCursor", app_set_hardware_cursor, METH_VARARGS, nullptr},
|
||||||
{"SetConnectData", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetConnectData", app_set_connect_data, METH_VARARGS, nullptr},
|
||||||
{"GetConnectData", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetConnectData", app_get_connect_data, METH_VARARGS, nullptr},
|
||||||
{"GetRotatingDirection", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetRotatingDirection", app_get_rotating_direction, METH_VARARGS, nullptr},
|
||||||
{"GetDegreeDifference", app_dummy_zero, METH_VARARGS, nullptr},
|
{"GetDegreeDifference", app_get_degree_difference, METH_VARARGS, nullptr},
|
||||||
{"Sleep", app_dummy_none, METH_VARARGS, nullptr},
|
{"Sleep", app_sleep, METH_VARARGS, nullptr},
|
||||||
{"SetDefaultFontName", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetDefaultFontName", app_set_default_font_name, METH_VARARGS, nullptr},
|
||||||
{"SetGuildSymbolPath", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetGuildSymbolPath", app_set_guild_symbol_path, METH_VARARGS, nullptr},
|
||||||
{"EnableSpecialCameraMode", app_dummy_none, METH_VARARGS, nullptr},
|
{"EnableSpecialCameraMode", app_enable_special_camera_mode, METH_VARARGS, nullptr},
|
||||||
{"SetCameraSpeed", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetCameraSpeed", app_set_camera_speed, METH_VARARGS, nullptr},
|
||||||
{"SaveCameraSetting", app_dummy_none, METH_VARARGS, nullptr},
|
{"SaveCameraSetting", app_save_camera_setting, METH_VARARGS, nullptr},
|
||||||
{"LoadCameraSetting", app_dummy_none, METH_VARARGS, nullptr},
|
{"LoadCameraSetting", app_load_camera_setting, METH_VARARGS, nullptr},
|
||||||
{"SetDefaultCamera", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetDefaultCamera", app_set_default_camera, METH_VARARGS, nullptr},
|
||||||
{"SetCameraSetting", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetCameraSetting", app_set_camera_setting, METH_VARARGS, nullptr},
|
||||||
{"SetSightRange", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetSightRange", app_set_sight_range, METH_VARARGS, nullptr},
|
||||||
{"IsFileExist", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsFileExist", app_is_file_exist, METH_VARARGS, nullptr},
|
||||||
{"OpenTextFile", app_open_text_file, METH_VARARGS, nullptr},
|
{"OpenTextFile", app_open_text_file, METH_VARARGS, nullptr},
|
||||||
{"CloseTextFile", app_close_text_file, METH_VARARGS, nullptr},
|
{"CloseTextFile", app_close_text_file, METH_VARARGS, nullptr},
|
||||||
{"GetTextFileLineCount", app_get_text_file_line_count, METH_VARARGS, nullptr},
|
{"GetTextFileLineCount", app_get_text_file_line_count, METH_VARARGS, nullptr},
|
||||||
@@ -297,33 +942,33 @@ void initapp() {
|
|||||||
{"GetLocaleServiceName", app_get_locale_service_name, METH_VARARGS, nullptr},
|
{"GetLocaleServiceName", app_get_locale_service_name, METH_VARARGS, nullptr},
|
||||||
{"GetLocaleName", app_get_locale_name, METH_VARARGS, nullptr},
|
{"GetLocaleName", app_get_locale_name, METH_VARARGS, nullptr},
|
||||||
{"GetLocalePath", app_get_locale_path, METH_VARARGS, nullptr},
|
{"GetLocalePath", app_get_locale_path, METH_VARARGS, nullptr},
|
||||||
{"ForceSetLocale", app_dummy_none, METH_VARARGS, nullptr},
|
{"ForceSetLocale", app_force_set_locale, METH_VARARGS, nullptr},
|
||||||
{"LoadLocaleAddr", app_dummy_none, METH_VARARGS, nullptr},
|
{"LoadLocaleAddr", app_load_locale_addr, METH_VARARGS, nullptr},
|
||||||
{"LoadLocaleData", app_load_locale_data, METH_VARARGS, nullptr},
|
{"LoadLocaleData", app_load_locale_data, METH_VARARGS, nullptr},
|
||||||
{"SetCHEONMA", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetCHEONMA", app_set_cheonma, METH_VARARGS, nullptr},
|
||||||
{"IsCHEONMA", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsCHEONMA", app_is_cheonma, METH_VARARGS, nullptr},
|
||||||
{"GetDefaultCodePage", app_get_default_codepage, METH_VARARGS, nullptr},
|
{"GetDefaultCodePage", app_get_default_codepage, METH_VARARGS, nullptr},
|
||||||
{"SetControlFP", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetControlFP", app_set_control_fp, METH_VARARGS, nullptr},
|
||||||
{"SetSpecularSpeed", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetSpecularSpeed", app_set_specular_speed, METH_VARARGS, nullptr},
|
||||||
{"testGetAccumulationTime", app_dummy_none, METH_VARARGS, nullptr},
|
{"testGetAccumulationTime", app_test_get_accumulation_time, METH_VARARGS, nullptr},
|
||||||
{"testResetAccumulationTime", app_dummy_none, METH_VARARGS, nullptr},
|
{"testResetAccumulationTime", app_test_reset_accumulation_time, METH_VARARGS, nullptr},
|
||||||
{"testSetSpecularColor", app_dummy_none, METH_VARARGS, nullptr},
|
{"testSetSpecularColor", app_test_set_specular_color, METH_VARARGS, nullptr},
|
||||||
{"SetVisibleNotice", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetVisibleNotice", app_set_visible_notice, METH_VARARGS, nullptr},
|
||||||
{"IsVisibleNotice", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsVisibleNotice", app_is_visible_notice, METH_VARARGS, nullptr},
|
||||||
{"IsEnableTestServerFlag", app_is_test_server, METH_VARARGS, nullptr},
|
{"IsEnableTestServerFlag", app_is_test_server, METH_VARARGS, nullptr},
|
||||||
{"EnableTestServerFlag", app_enable_test_server, METH_VARARGS, nullptr},
|
{"EnableTestServerFlag", app_enable_test_server, METH_VARARGS, nullptr},
|
||||||
{"SetGuildMarkPath", app_set_guild_mark_path, METH_VARARGS, nullptr},
|
{"SetGuildMarkPath", app_set_guild_mark_path, METH_VARARGS, nullptr},
|
||||||
{"OnLogoUpdate", app_dummy_none, METH_VARARGS, nullptr},
|
{"OnLogoUpdate", app_on_logo_update, METH_VARARGS, nullptr},
|
||||||
{"OnLogoRender", app_dummy_none, METH_VARARGS, nullptr},
|
{"OnLogoRender", app_on_logo_render, METH_VARARGS, nullptr},
|
||||||
{"OnLogoOpen", app_dummy_none, METH_VARARGS, nullptr},
|
{"OnLogoOpen", app_on_logo_open, METH_VARARGS, nullptr},
|
||||||
{"OnLogoClose", app_dummy_none, METH_VARARGS, nullptr},
|
{"OnLogoClose", app_on_logo_close, METH_VARARGS, nullptr},
|
||||||
{"FlashApplication", app_dummy_none, METH_VARARGS, nullptr},
|
{"FlashApplication", app_flash_application, METH_VARARGS, nullptr},
|
||||||
{"SetMultiFarmExeIcon", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetMultiFarmExeIcon", app_set_multi_farm_exe_icon, METH_VARARGS, nullptr},
|
||||||
{"WindowStatus", app_dummy_none, METH_VARARGS, nullptr},
|
{"WindowStatus", app_window_status, METH_VARARGS, nullptr},
|
||||||
{"IsVisible", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsVisible", app_is_visible, METH_VARARGS, nullptr},
|
||||||
{"SetTitle", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetTitle", app_set_title, METH_VARARGS, nullptr},
|
||||||
{"SetMessage", app_dummy_none, METH_VARARGS, nullptr},
|
{"SetMessage", app_set_message, METH_VARARGS, nullptr},
|
||||||
{"IsCanOpenRender", app_dummy_zero, METH_VARARGS, nullptr},
|
{"IsCanOpenRender", app_is_can_open_render, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("app", methods);
|
auto* module = Py_InitModule("app", methods);
|
||||||
@@ -390,6 +1035,14 @@ void initapp() {
|
|||||||
PyModule_AddIntConstant(module, "INFO_ACTOR", 1);
|
PyModule_AddIntConstant(module, "INFO_ACTOR", 1);
|
||||||
PyModule_AddIntConstant(module, "INFO_EFFECT", 2);
|
PyModule_AddIntConstant(module, "INFO_EFFECT", 2);
|
||||||
PyModule_AddIntConstant(module, "INFO_TEXTTAIL", 3);
|
PyModule_AddIntConstant(module, "INFO_TEXTTAIL", 3);
|
||||||
|
|
||||||
|
PyModule_AddIntConstant(module, "DEGREE_DIRECTION_SAME", 0);
|
||||||
|
PyModule_AddIntConstant(module, "DEGREE_DIRECTION_RIGHT", 1);
|
||||||
|
PyModule_AddIntConstant(module, "DEGREE_DIRECTION_LEFT", 2);
|
||||||
|
|
||||||
|
PyModule_AddIntConstant(module, "CAMERA_TO_POSITIVE", 1);
|
||||||
|
PyModule_AddIntConstant(module, "CAMERA_TO_NEGATIVE", -1);
|
||||||
|
PyModule_AddIntConstant(module, "CAMERA_STOP", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,269 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "eter_render/RenderCommands3D.h"
|
||||||
|
#include "eter_render/TerrainHeightmap.h"
|
||||||
|
#include "eter_render/MapObjectManager.h"
|
||||||
|
#include "eter_render/WaterManager.h"
|
||||||
|
#include "eter_render/EnvironmentData.h"
|
||||||
|
#include "eter_render/SkyBox.h"
|
||||||
|
#include "eter_render/SpeedTreeForest.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <set>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace ava2 {
|
||||||
|
|
||||||
|
struct OutdoorMapInfo {
|
||||||
|
std::string name;
|
||||||
|
uint32_t baseX = 0;
|
||||||
|
uint32_t baseY = 0;
|
||||||
|
int16_t terrainCountX = 0;
|
||||||
|
int16_t terrainCountY = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CPythonBackground {
|
||||||
|
public:
|
||||||
|
enum {
|
||||||
|
SHADOW_NONE = 0,
|
||||||
|
SHADOW_GROUND = 1,
|
||||||
|
SHADOW_GROUND_AND_SOLO = 2,
|
||||||
|
SHADOW_ALL = 3,
|
||||||
|
SHADOW_ALL_HIGH = 4,
|
||||||
|
SHADOW_ALL_MAX = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DISTANCE0 = 0,
|
||||||
|
DISTANCE1 = 1,
|
||||||
|
DISTANCE2 = 2,
|
||||||
|
DISTANCE3 = 3,
|
||||||
|
DISTANCE4 = 4,
|
||||||
|
NUM_DISTANCE_SET = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PART_TERRAIN = 0,
|
||||||
|
PART_OBJECT = 1,
|
||||||
|
PART_CLOUD = 2,
|
||||||
|
PART_WATER = 3,
|
||||||
|
PART_TREE = 4,
|
||||||
|
PART_SKY = 5,
|
||||||
|
PART_SHOP = 6,
|
||||||
|
PART_NUM = 7,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DAY_MODE_LIGHT = 0,
|
||||||
|
DAY_MODE_DARK = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ETerrainRenderSort {
|
||||||
|
DISTANCE_SORT = 0,
|
||||||
|
TEXTURE_SORT = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SKY_RENDER_MODE_DEFAULT = 0,
|
||||||
|
SKY_RENDER_MODE_DIFFUSE = 1,
|
||||||
|
SKY_RENDER_MODE_TEXTURE = 2,
|
||||||
|
SKY_RENDER_MODE_MODULATE = 3,
|
||||||
|
SKY_RENDER_MODE_MODULATE2X = 4,
|
||||||
|
SKY_RENDER_MODE_MODULATE4X = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SViewDistanceSet {
|
||||||
|
float m_fFogStart = 12800.0f;
|
||||||
|
float m_fFogEnd = 17920.0f;
|
||||||
|
float m_fFarClip = 25600.0f;
|
||||||
|
float m_v3SkyBoxScale[3] = {15360.0f, 15360.0f, 15360.0f};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TMapInfo {
|
||||||
|
std::string m_strName;
|
||||||
|
uint32_t m_dwBaseX = 0;
|
||||||
|
uint32_t m_dwBaseY = 0;
|
||||||
|
uint32_t m_dwSizeX = 0;
|
||||||
|
uint32_t m_dwSizeY = 0;
|
||||||
|
uint32_t m_dwEndX = 0;
|
||||||
|
uint32_t m_dwEndY = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
static CPythonBackground& Instance();
|
||||||
|
|
||||||
|
CPythonBackground();
|
||||||
|
~CPythonBackground();
|
||||||
|
|
||||||
|
void Initialize();
|
||||||
|
void Destroy();
|
||||||
|
void Create();
|
||||||
|
|
||||||
|
bool IsMapReady() const;
|
||||||
|
|
||||||
|
bool LoadMap(const std::string& mapName, float x = 0.0f, float y = 0.0f, float z = 0.0f);
|
||||||
|
bool Warp(uint32_t x, uint32_t y);
|
||||||
|
|
||||||
|
const std::string& GetCurrentMapName() const { return m_strMapName; }
|
||||||
|
const std::string& GetWarpMapName() const { return m_strWarpMapName; }
|
||||||
|
|
||||||
|
void GlobalPositionToLocalPosition(long& rGlobalX, long& rGlobalY);
|
||||||
|
void LocalPositionToGlobalPosition(long& rLocalX, long& rLocalY);
|
||||||
|
TMapInfo* GlobalPositionToMapInfo(uint32_t dwGlobalX, uint32_t dwGlobalY);
|
||||||
|
|
||||||
|
float GetHeight(float fx, float fy);
|
||||||
|
bool IsAttrOn(float fx, float fy, uint8_t attr);
|
||||||
|
|
||||||
|
bool GetPickingPoint(float* pIntersectPt);
|
||||||
|
void SetPickingPoint(float x, float y, float z);
|
||||||
|
|
||||||
|
void SelectViewDistanceNum(int eNum);
|
||||||
|
void SetViewDistanceSet(int eNum, float fFarClip);
|
||||||
|
float GetFarClip();
|
||||||
|
void GetDistanceSetInfo(int* peNum, float* pfStart, float* pfEnd, float* pfFarClip);
|
||||||
|
|
||||||
|
bool SetVisiblePart(int ePart, bool isVisible);
|
||||||
|
bool IsVisiblePart(int ePart) const;
|
||||||
|
|
||||||
|
bool SetShadowLevel(int eLevel);
|
||||||
|
int GetShadowLevel() const { return m_eShadowLevel; }
|
||||||
|
uint32_t GetRenderShadowTime() const { return m_dwRenderShadowTime; }
|
||||||
|
|
||||||
|
bool SetSplatLimit(int iSplatNum);
|
||||||
|
int GetSplatLimit() const { return m_iSplatLimit; }
|
||||||
|
std::string GetRenderedSplatNumStr(int* pPatch, int* pSplat, float* pRatio);
|
||||||
|
void GetRenderedGraphicThingInstanceNum(uint32_t* pCount, uint32_t* pCRC);
|
||||||
|
|
||||||
|
uint32_t GetShadowMapColor(float fx, float fy);
|
||||||
|
|
||||||
|
void ReserveSoftwareTilingEnable(bool enable) { m_bSoftwareTilingEnable = enable; }
|
||||||
|
bool IsSoftwareTilingEnable() const { return m_bSoftwareTilingEnable; }
|
||||||
|
|
||||||
|
void EnableSnowEnvironment(bool enable = true);
|
||||||
|
void DisableSnowEnvironment();
|
||||||
|
bool IsSnowEnvironment() const { return m_bSnowEnable; }
|
||||||
|
|
||||||
|
void SetTransparentTree(bool enable) { m_bTransparentTree = enable; }
|
||||||
|
bool IsTransparentTree() const { return m_bTransparentTree; }
|
||||||
|
|
||||||
|
void SetXMaxTree(int iGrade) { m_iXMasTreeGrade = iGrade; }
|
||||||
|
int GetXMaxTree() const { return m_iXMasTreeGrade; }
|
||||||
|
|
||||||
|
void RegisterDungeonMapName(const char* szName);
|
||||||
|
|
||||||
|
void VisibleGuildArea() { m_bVisibleGuildArea = true; }
|
||||||
|
void DisableGuildArea() { m_bVisibleGuildArea = false; }
|
||||||
|
void RegisterGuildArea(int isx, int isy, int iex, int iey);
|
||||||
|
void ClearGuildArea();
|
||||||
|
|
||||||
|
bool RegisterEnvironmentData(int iIndex, const char* pszEnvironmentFileName);
|
||||||
|
bool SetEnvironmentData(int iIndex);
|
||||||
|
const EnvironmentData* GetCurrentEnvironmentData() const { return m_pCurrentEnvironment; }
|
||||||
|
|
||||||
|
void BeginEnvironment();
|
||||||
|
void EndEnvironment();
|
||||||
|
|
||||||
|
void SetCharacterDirLight();
|
||||||
|
void SetBackgroundDirLight();
|
||||||
|
|
||||||
|
void SetTerrainRenderSort(int eSort) { m_eTerrainRenderSort = eSort; }
|
||||||
|
void SetBGLoading(bool bgLoading) { m_bBGLoading = bgLoading; }
|
||||||
|
|
||||||
|
void CreatePrivateShopPos(int vid);
|
||||||
|
void DeletePrivateShopPos();
|
||||||
|
|
||||||
|
void CreateTargetEffect(uint32_t dwID, uint32_t dwChrVID);
|
||||||
|
void CreateTargetEffect(uint32_t dwID, long lx, long ly);
|
||||||
|
void DeleteTargetEffect(uint32_t dwID);
|
||||||
|
|
||||||
|
void CreateTargetEffectShop(uint32_t dwID, uint32_t dwChrVID);
|
||||||
|
void CreateTargetEffectShop(uint32_t dwID, long lx, long ly);
|
||||||
|
|
||||||
|
void CreateSpecialEffect(uint32_t dwID, float fx, float fy, float fz, const char* szFileName);
|
||||||
|
void DeleteSpecialEffect(uint32_t dwID);
|
||||||
|
|
||||||
|
void Update(float fCameraX, float fCameraY, float fCameraZ);
|
||||||
|
|
||||||
|
void Render();
|
||||||
|
void RenderSky();
|
||||||
|
void RenderCloud();
|
||||||
|
void RenderWater();
|
||||||
|
void RenderEffect();
|
||||||
|
void RenderCollision();
|
||||||
|
void RenderPCBlocker();
|
||||||
|
void RenderBeforeLensFlare();
|
||||||
|
void RenderAfterLensFlare();
|
||||||
|
void RenderCharacterShadowToTexture();
|
||||||
|
void RenderSnow();
|
||||||
|
|
||||||
|
TerrainHeightmap* GetTerrain() { return m_terrain.get(); }
|
||||||
|
MapObjectManager* GetMapObjects() { return m_mapObjects.get(); }
|
||||||
|
WaterManager* GetWater() { return m_water.get(); }
|
||||||
|
SkyBox* GetSkyBox() { return m_skybox.get(); }
|
||||||
|
SpeedTreeForest* GetForest() { return m_forest.get(); }
|
||||||
|
const OutdoorMapInfo* GetOutdoorMap() const { return m_strMapName.empty() ? nullptr : &m_outdoorMap; }
|
||||||
|
|
||||||
|
void BuildDrawCommands(const float* viewMatrix, const float* projMatrix, const float* camPos, std::vector<Render3DDraw>& outDraws);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void LoadAtlas();
|
||||||
|
|
||||||
|
std::string m_strMapName;
|
||||||
|
std::string m_strWarpMapName;
|
||||||
|
uint32_t m_dwBaseX = 0;
|
||||||
|
uint32_t m_dwBaseY = 0;
|
||||||
|
|
||||||
|
int m_eViewDistanceNum = 0;
|
||||||
|
SViewDistanceSet m_ViewDistanceSet[NUM_DISTANCE_SET];
|
||||||
|
|
||||||
|
bool m_bVisiblePart[PART_NUM] = {true, true, true, true, true, true, true};
|
||||||
|
int m_eShadowLevel = SHADOW_NONE;
|
||||||
|
uint32_t m_dwRenderShadowTime = 0;
|
||||||
|
int m_iSplatLimit = 0;
|
||||||
|
|
||||||
|
bool m_bSoftwareTilingEnable = false;
|
||||||
|
bool m_bSnowEnable = false;
|
||||||
|
bool m_bTransparentTree = false;
|
||||||
|
int m_iXMasTreeGrade = 0;
|
||||||
|
bool m_bVisibleGuildArea = false;
|
||||||
|
int m_eTerrainRenderSort = DISTANCE_SORT;
|
||||||
|
bool m_bBGLoading = false;
|
||||||
|
|
||||||
|
float m_v3PickingPoint[3] = {0.0f, 0.0f, 0.0f};
|
||||||
|
|
||||||
|
std::set<std::string> m_kSet_strDungeonMapName;
|
||||||
|
|
||||||
|
std::vector<TMapInfo> m_kVct_kMapInfo;
|
||||||
|
std::string m_atlasLocale;
|
||||||
|
|
||||||
|
std::map<int, EnvironmentData> m_mapEnvironmentData;
|
||||||
|
const EnvironmentData* m_pCurrentEnvironment = nullptr;
|
||||||
|
EnvironmentData m_defaultEnvironment;
|
||||||
|
|
||||||
|
std::unique_ptr<TerrainHeightmap> m_terrain;
|
||||||
|
std::unique_ptr<MapObjectManager> m_mapObjects;
|
||||||
|
std::unique_ptr<WaterManager> m_water;
|
||||||
|
std::unique_ptr<SkyBox> m_skybox;
|
||||||
|
std::unique_ptr<SpeedTreeForest> m_forest;
|
||||||
|
|
||||||
|
OutdoorMapInfo m_outdoorMap;
|
||||||
|
|
||||||
|
std::map<uint32_t, uint32_t> m_targetEffects;
|
||||||
|
std::map<uint32_t, uint32_t> m_targetEffectsShop;
|
||||||
|
std::map<uint32_t, std::pair<float, float>> m_targetPositions;
|
||||||
|
uint32_t m_privateShopPosVID = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void initBackground();
|
||||||
|
|
||||||
|
TerrainHeightmap* GetActiveBackgroundTerrain();
|
||||||
|
void SetActiveBackgroundTerrain(std::unique_ptr<TerrainHeightmap> terrain);
|
||||||
|
bool LoadBackgroundMap(const std::string& mapName, float x = 0.0f, float y = 0.0f, float z = 0.0f);
|
||||||
|
bool WarpBackgroundMap(uint32_t x, uint32_t y);
|
||||||
|
void GlobalToLocalPosition(int32_t& x, int32_t& y);
|
||||||
|
void LocalToGlobalPosition(int32_t& x, int32_t& y);
|
||||||
|
const OutdoorMapInfo* GetOutdoorMap();
|
||||||
|
|
||||||
|
} // namespace ava2
|
||||||
+1036
-406
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "python_background.h"
|
||||||
#include "eter_render/RenderCommands3D.h"
|
#include "eter_render/RenderCommands3D.h"
|
||||||
#include "eter_net/Packet.h"
|
#include "eter_net/Packet.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -11,10 +12,6 @@ void initPlayer();
|
|||||||
void initchrmgr();
|
void initchrmgr();
|
||||||
void initchr();
|
void initchr();
|
||||||
void initsnd();
|
void initsnd();
|
||||||
void initBackground();
|
|
||||||
void GlobalToLocalPosition(int32_t& x,int32_t& y);
|
|
||||||
void LocalToGlobalPosition(int32_t& x,int32_t& y);
|
|
||||||
bool WarpBackgroundMap(uint32_t x,uint32_t y);
|
|
||||||
|
|
||||||
using SkillCastCallback = std::function<void(int quickSlot, int skillIndex)>;
|
using SkillCastCallback = std::function<void(int quickSlot, int skillIndex)>;
|
||||||
void SetPlayerSkillCastCallback(SkillCastCallback cb);
|
void SetPlayerSkillCastCallback(SkillCastCallback cb);
|
||||||
@@ -76,14 +73,6 @@ const std::string& GetMainCharacterName();
|
|||||||
void SetMainCharacterName(const std::string& name);
|
void SetMainCharacterName(const std::string& name);
|
||||||
long long GetPlayerStatusPoint(int type);
|
long long GetPlayerStatusPoint(int type);
|
||||||
void SetPlayerStatusPoint(int type, long long value);
|
void SetPlayerStatusPoint(int type, long long value);
|
||||||
|
|
||||||
class TerrainHeightmap;
|
|
||||||
TerrainHeightmap* GetActiveBackgroundTerrain();
|
|
||||||
void SetActiveBackgroundTerrain(std::unique_ptr<TerrainHeightmap> terrain);
|
|
||||||
bool LoadBackgroundMap(const std::string& mapName, float x = 0.0f, float y = 0.0f, float z = 0.0f);
|
|
||||||
// CPythonBackground::IsMapOutdoor + CMapOutdoor GetName/GetBaseXY/GetTerrainCount for the loaded map
|
|
||||||
// (setting.txt "mapsize" / "baseposition"); nullptr while no map is loaded.
|
|
||||||
struct OutdoorMapInfo { std::string name; uint32_t baseX=0, baseY=0; int16_t terrainCountX=0, terrainCountY=0; };
|
|
||||||
const OutdoorMapInfo* GetOutdoorMap();
|
|
||||||
} // namespace ava2
|
} // namespace ava2
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1079
-100
File diff suppressed because it is too large
Load Diff
+354
-61
@@ -85,20 +85,6 @@ bool LoadSkillDescriptions(const std::string& path) {
|
|||||||
try { return skillDescriptions.load(ReadPackedText(path),register_skill_icons); }
|
try { return skillDescriptions.load(ReadPackedText(path),register_skill_icons); }
|
||||||
catch(const std::exception&) { return false; }
|
catch(const std::exception&) { return false; }
|
||||||
}
|
}
|
||||||
namespace {
|
|
||||||
PyObject* dummy_none(PyObject*, PyObject*) { Py_RETURN_NONE; }
|
|
||||||
PyObject* dummy_zero(PyObject*, PyObject*) { return PyInt_FromLong(0); }
|
|
||||||
PyObject* dummy_one(PyObject*, PyObject*) { return PyInt_FromLong(1); }
|
|
||||||
PyObject* dummy_float_zero(PyObject*, PyObject*) { return PyFloat_FromDouble(0.0); }
|
|
||||||
PyObject* dummy_str(PyObject*, PyObject*) { return PyString_FromString(""); }
|
|
||||||
PyObject* dummy_tuple2(PyObject*, PyObject*) { return Py_BuildValue("ii", 0, 0); }
|
|
||||||
PyObject* dummy_tuple3(PyObject*, PyObject*) { return Py_BuildValue("iii", 0, 0, 0); }
|
|
||||||
PyObject* dummy_tuple4(PyObject*, PyObject*) { return Py_BuildValue("iiii", 0, 0, 0, 0); }
|
|
||||||
PyObject* dummy_bool_false(PyObject*, PyObject*) { return PyBool_FromLong(0); }
|
|
||||||
PyObject* dummy_bool_true(PyObject*, PyObject*) { return PyBool_FromLong(1); }
|
|
||||||
PyObject* dummy_empty_list(PyObject*, PyObject*) { return PyList_New(0); }
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
PyObject* nonplayer_load(PyObject*,PyObject* args) {
|
PyObject* nonplayer_load(PyObject*,PyObject* args) {
|
||||||
const char* path; if(!PyArg_ParseTuple(args,"s",&path)) return nullptr;
|
const char* path; if(!PyArg_ParseTuple(args,"s",&path)) return nullptr;
|
||||||
@@ -113,15 +99,17 @@ template<int Field> PyObject* nonplayer_value(PyObject*,PyObject* args) {
|
|||||||
int vnum;if(!PyArg_ParseTuple(args,"i",&vnum)) return nullptr;
|
int vnum;if(!PyArg_ParseTuple(args,"i",&vnum)) return nullptr;
|
||||||
const auto* m=NonPlayerData::Instance().get(uint32_t(vnum));
|
const auto* m=NonPlayerData::Instance().get(uint32_t(vnum));
|
||||||
if constexpr(Field==4) return m?Py_BuildValue("ii",m->damageMin,m->damageMax):Py_BuildValue("ii",0,0);
|
if constexpr(Field==4) return m?Py_BuildValue("ii",m->damageMin,m->damageMax):Py_BuildValue("ii",0,0);
|
||||||
if constexpr(Field==14) return m?Py_BuildValue("ii",m->goldMin,m->goldMax):Py_BuildValue("ii",0,0);
|
else if constexpr(Field==14) return m?Py_BuildValue("ii",m->goldMin,m->goldMax):Py_BuildValue("ii",0,0);
|
||||||
if constexpr(Field==6) return PyFloat_FromDouble(m?m->damageMultiply:0);
|
else if constexpr(Field==6) return PyFloat_FromDouble(m?m->damageMultiply:0);
|
||||||
long long value=0;
|
else {
|
||||||
if(m) switch(Field) {
|
long long value=0;
|
||||||
case 0:value=m->event;break;case 1:value=m->hp;break;case 2:value=m->raceFlags;break;case 3:value=m->level;break;
|
if(m) switch(Field) {
|
||||||
case 5:value=m->exp;break;case 7:value=m->st;break;case 8:value=m->dx;break;case 9:value=m->type==2;break;
|
case 0:value=m->event;break;case 1:value=m->hp;break;case 2:value=m->raceFlags;break;case 3:value=m->level;break;
|
||||||
case 10:value=m->regenCycle;break;case 11:value=m->regenPercent;break;case 12:value=m->goldMin;break;case 13:value=m->goldMax;break;
|
case 5:value=m->exp;break;case 7:value=m->st;break;case 8:value=m->dx;break;case 9:value=m->type==2;break;
|
||||||
|
case 10:value=m->regenCycle;break;case 11:value=m->regenPercent;break;case 12:value=m->goldMin;break;case 13:value=m->goldMax;break;
|
||||||
|
}
|
||||||
|
return PyInt_FromLong(static_cast<long>(value));
|
||||||
}
|
}
|
||||||
return PyInt_FromLong(static_cast<long>(value));
|
|
||||||
}
|
}
|
||||||
template<int Field> PyObject* nonplayer_vid(PyObject*,PyObject* args) {
|
template<int Field> PyObject* nonplayer_vid(PyObject*,PyObject* args) {
|
||||||
int vid;if(!PyArg_ParseTuple(args,"i",&vid)) return nullptr;
|
int vid;if(!PyArg_ParseTuple(args,"i",&vid)) return nullptr;
|
||||||
@@ -646,13 +634,25 @@ void initTextTail() {
|
|||||||
auto* module = Py_InitModule("textTail", methods);
|
auto* module = Py_InitModule("textTail", methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject* profiler_push(PyObject*, PyObject* args) {
|
||||||
|
char* szName = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &szName)) return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* profiler_pop(PyObject*, PyObject* args) {
|
||||||
|
char* szName = nullptr;
|
||||||
|
if (!PyTuple_GetString(args, 0, &szName)) return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
void initProfiler() {
|
void initProfiler() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"Push", dummy_none, METH_VARARGS, nullptr},
|
{"Push", profiler_push, METH_VARARGS, nullptr},
|
||||||
{"Pop", dummy_none, METH_VARARGS, nullptr},
|
{"Pop", profiler_pop, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("profiler", methods);
|
Py_InitModule("profiler", methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject* effect_RegisterEffect(PyObject*, PyObject* args) {
|
static PyObject* effect_RegisterEffect(PyObject*, PyObject* args) {
|
||||||
@@ -862,6 +862,13 @@ void SetShopTab(unsigned index,const std::string& name,unsigned coin) {
|
|||||||
if(index>=shopTabCount)return;
|
if(index>=shopTabCount)return;
|
||||||
shopTabNames[index]=name;shopTabCoins[index]=static_cast<uint8_t>(coin);
|
shopTabNames[index]=name;shopTabCoins[index]=static_cast<uint8_t>(coin);
|
||||||
}
|
}
|
||||||
|
static PyObject* shop_GetOfflineShopItemTransmutation(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
static PyObject* shop_GetItemElements(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("iiii", 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void initshop() {
|
void initshop() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"Open", shop_open, METH_VARARGS, nullptr},
|
{"Open", shop_open, METH_VARARGS, nullptr},
|
||||||
@@ -879,8 +886,8 @@ void initshop() {
|
|||||||
{"GetVnumBuy", shop_item_buy_vnum, METH_VARARGS, nullptr},
|
{"GetVnumBuy", shop_item_buy_vnum, METH_VARARGS, nullptr},
|
||||||
{"GetCountBuy", shop_item_buy_count, METH_VARARGS, nullptr},
|
{"GetCountBuy", shop_item_buy_count, METH_VARARGS, nullptr},
|
||||||
{"GetItemRandomAttribute", shop_item_glove, METH_VARARGS, nullptr},
|
{"GetItemRandomAttribute", shop_item_glove, METH_VARARGS, nullptr},
|
||||||
{"GetOfflineShopItemTransmutation", dummy_zero, METH_VARARGS, nullptr},
|
{"GetOfflineShopItemTransmutation", shop_GetOfflineShopItemTransmutation, METH_VARARGS, nullptr},
|
||||||
{"GetItemElements", dummy_tuple4, METH_VARARGS, nullptr},
|
{"GetItemElements", shop_GetItemElements, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("shop", methods);
|
auto* module = Py_InitModule("shop", methods);
|
||||||
@@ -1257,11 +1264,15 @@ static PyObject* skill_IsUseHPSkill(PyObject*,PyObject* args) { return skill_fla
|
|||||||
|
|
||||||
float EvaluateSkillFormula(const std::string& formula,float level) {return skill_formula(formula,level);}
|
float EvaluateSkillFormula(const std::string& formula,float level) {return skill_formula(formula,level);}
|
||||||
|
|
||||||
|
static PyObject* skill_LoadSkillData(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
void initskill() {
|
void initskill() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"SetPathName", skill_SetPathName, METH_VARARGS, nullptr},
|
{"SetPathName", skill_SetPathName, METH_VARARGS, nullptr},
|
||||||
{"RegisterSkill", skill_RegisterSkill, METH_VARARGS, nullptr},
|
{"RegisterSkill", skill_RegisterSkill, METH_VARARGS, nullptr},
|
||||||
{"LoadSkillData", dummy_none, METH_VARARGS, nullptr},
|
{"LoadSkillData", skill_LoadSkillData, METH_VARARGS, nullptr},
|
||||||
{"ClearSkillData", skill_ClearSkillData, METH_VARARGS, nullptr},
|
{"ClearSkillData", skill_ClearSkillData, METH_VARARGS, nullptr},
|
||||||
{"GetSkillName", skill_name, METH_VARARGS, nullptr},
|
{"GetSkillName", skill_name, METH_VARARGS, nullptr},
|
||||||
{"GetSkillDescription", skill_description, METH_VARARGS, nullptr},
|
{"GetSkillDescription", skill_description, METH_VARARGS, nullptr},
|
||||||
@@ -1315,55 +1326,275 @@ void initskill() {
|
|||||||
PyModule_AddIntConstant(module, "SKILL_EFFECT_COUNT", skill_constants::SKILL_EFFECT_COUNT);
|
PyModule_AddIntConstant(module, "SKILL_EFFECT_COUNT", skill_constants::SKILL_EFFECT_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
class CPythonSash {
|
||||||
|
public:
|
||||||
|
static CPythonSash& Instance() {
|
||||||
|
static CPythonSash s;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
uint32_t dwPrice = 0;
|
||||||
|
struct TSashMaterial {
|
||||||
|
uint8_t bHere = 0;
|
||||||
|
uint16_t wCell = 0;
|
||||||
|
};
|
||||||
|
struct TSashResult {
|
||||||
|
uint32_t dwItemVnum = 0;
|
||||||
|
uint32_t dwMinAbs = 0;
|
||||||
|
uint32_t dwMaxAbs = 0;
|
||||||
|
};
|
||||||
|
TSashResult m_vSashResult{};
|
||||||
|
std::vector<TSashMaterial> m_vSashMaterials;
|
||||||
|
|
||||||
|
CPythonSash() { Clear(); }
|
||||||
|
void Clear() {
|
||||||
|
dwPrice = 0;
|
||||||
|
m_vSashResult = {};
|
||||||
|
m_vSashMaterials.assign(2, TSashMaterial{0, 0});
|
||||||
|
}
|
||||||
|
void AddMaterial(uint32_t refPrice, uint8_t bPos, uint16_t cell) {
|
||||||
|
if (bPos >= 2) return;
|
||||||
|
if (bPos == 0) dwPrice = refPrice;
|
||||||
|
m_vSashMaterials[bPos] = TSashMaterial{1, cell};
|
||||||
|
}
|
||||||
|
void AddResult(uint32_t vnum, uint32_t minAbs, uint32_t maxAbs) {
|
||||||
|
m_vSashResult = {vnum, minAbs, maxAbs};
|
||||||
|
}
|
||||||
|
void RemoveMaterial(uint32_t refPrice, uint8_t bPos) {
|
||||||
|
if (bPos >= 2) return;
|
||||||
|
if (bPos == 1) dwPrice = refPrice;
|
||||||
|
m_vSashMaterials[bPos] = TSashMaterial{0, 0};
|
||||||
|
}
|
||||||
|
uint32_t GetPrice() const { return dwPrice; }
|
||||||
|
bool GetAttachedItem(uint8_t bPos, uint8_t& bHere, uint16_t& wCell) {
|
||||||
|
if (bPos >= m_vSashMaterials.size()) return false;
|
||||||
|
bHere = m_vSashMaterials[bPos].bHere;
|
||||||
|
wCell = m_vSashMaterials[bPos].wCell;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void GetResultItem(uint32_t& vnum, uint32_t& minAbs, uint32_t& maxAbs) {
|
||||||
|
vnum = m_vSashResult.dwItemVnum;
|
||||||
|
minAbs = m_vSashResult.dwMinAbs;
|
||||||
|
maxAbs = m_vSashResult.dwMaxAbs;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static PyObject* sash_SendCloseRequest(PyObject*, PyObject*) {
|
||||||
|
CPythonSash::Instance().Clear();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* sash_Add(PyObject*, PyObject* args) {
|
||||||
|
int window = 0, cell = 0, pos = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &window) || !PyTuple_GetInteger(args, 1, &cell) || !PyTuple_GetInteger(args, 2, &pos))
|
||||||
|
return Py_BuildException();
|
||||||
|
CPythonSash::Instance().AddMaterial(0, static_cast<uint8_t>(pos), static_cast<uint16_t>(cell));
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* sash_Remove(PyObject*, PyObject* args) {
|
||||||
|
int pos = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &pos))
|
||||||
|
return Py_BuildException();
|
||||||
|
CPythonSash::Instance().RemoveMaterial(0, static_cast<uint8_t>(pos));
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* sash_GetPrice(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", CPythonSash::Instance().GetPrice());
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* sash_GetAttachedItem(PyObject*, PyObject* args) {
|
||||||
|
int pos = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &pos))
|
||||||
|
return Py_BuildException();
|
||||||
|
uint8_t bHere = 0;
|
||||||
|
uint16_t wCell = 0;
|
||||||
|
CPythonSash::Instance().GetAttachedItem(static_cast<uint8_t>(pos), bHere, wCell);
|
||||||
|
return Py_BuildValue("ii", static_cast<int>(bHere), static_cast<int>(wCell));
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* sash_GetResultItem(PyObject*, PyObject*) {
|
||||||
|
uint32_t vnum = 0, minAbs = 0, maxAbs = 0;
|
||||||
|
CPythonSash::Instance().GetResultItem(vnum, minAbs, maxAbs);
|
||||||
|
return Py_BuildValue("iii", vnum, minAbs, maxAbs);
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* sash_SendRefineRequest(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CServerStateChecker {
|
||||||
|
public:
|
||||||
|
static CServerStateChecker& Instance() {
|
||||||
|
static CServerStateChecker s;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
struct TChannel {
|
||||||
|
uint32_t uServerIndex = 0;
|
||||||
|
std::string szAddr;
|
||||||
|
uint32_t uPort = 0;
|
||||||
|
};
|
||||||
|
PyObject* m_poWnd = nullptr;
|
||||||
|
std::vector<TChannel> m_channels;
|
||||||
|
|
||||||
|
void Create(PyObject* poWnd) { m_poWnd = poWnd; }
|
||||||
|
void AddChannel(uint32_t serverIdx, const std::string& addr, uint32_t port) {
|
||||||
|
m_channels.push_back({serverIdx, addr, port});
|
||||||
|
}
|
||||||
|
void Request() {
|
||||||
|
if (m_poWnd) {
|
||||||
|
for (const auto& ch : m_channels) {
|
||||||
|
PyObject* res = PyObject_CallMethod(m_poWnd, const_cast<char*>("NotifyChannelState"), const_cast<char*>("(ii)"), ch.uServerIndex, 1);
|
||||||
|
Py_XDECREF(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Update() {}
|
||||||
|
void Initialize() {
|
||||||
|
m_channels.clear();
|
||||||
|
m_poWnd = nullptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static PyObject* ServerStateChecker_Create(PyObject*, PyObject* args) {
|
||||||
|
PyObject* poWnd = nullptr;
|
||||||
|
if (!PyTuple_GetObject(args, 0, &poWnd)) return Py_BadArgument();
|
||||||
|
CServerStateChecker::Instance().Create(poWnd);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* ServerStateChecker_Update(PyObject*, PyObject*) {
|
||||||
|
CServerStateChecker::Instance().Update();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* ServerStateChecker_Request(PyObject*, PyObject*) {
|
||||||
|
CServerStateChecker::Instance().Request();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* ServerStateChecker_AddChannel(PyObject*, PyObject* args) {
|
||||||
|
int nServerIndex = 0, nPort = 0;
|
||||||
|
char* szAddr = nullptr;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &nServerIndex) || !PyTuple_GetString(args, 1, &szAddr) || !PyTuple_GetInteger(args, 2, &nPort))
|
||||||
|
return Py_BuildException();
|
||||||
|
CServerStateChecker::Instance().AddChannel(nServerIndex, szAddr ? szAddr : "", nPort);
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* ServerStateChecker_Initialize(PyObject*, PyObject*) {
|
||||||
|
CServerStateChecker::Instance().Initialize();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* playerLoad_RegisterSkill(PyObject*, PyObject* args) {
|
||||||
|
uint8_t bRaceIndex = 0, bSkillGroupIndex = 0, bEmpireIndex = 0;
|
||||||
|
if (!PyTuple_GetByte(args, 0, &bRaceIndex) || !PyTuple_GetByte(args, 1, &bSkillGroupIndex) || !PyTuple_GetByte(args, 2, &bEmpireIndex))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CPythonManagerBank {
|
||||||
|
public:
|
||||||
|
static CPythonManagerBank& Instance() {
|
||||||
|
static CPythonManagerBank s;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
struct TAccountBank {
|
||||||
|
int user_action = 999;
|
||||||
|
int user_money = 0;
|
||||||
|
char user_datetime[32] = "0000-00-00 00:00:00";
|
||||||
|
char user_ip[32] = "-";
|
||||||
|
char user_recvmoney[32] = "-";
|
||||||
|
};
|
||||||
|
std::vector<TAccountBank> m_logs;
|
||||||
|
|
||||||
|
void AppendLog(const TAccountBank& log) {
|
||||||
|
m_logs.push_back(log);
|
||||||
|
}
|
||||||
|
TAccountBank GetLog(size_t id) const {
|
||||||
|
if (id >= m_logs.size()) {
|
||||||
|
TAccountBank def;
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
return m_logs[id];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static PyObject* bankLoadLogs(PyObject*, PyObject* args) {
|
||||||
|
int id = 0;
|
||||||
|
if (!PyTuple_GetInteger(args, 0, &id)) return Py_BuildException();
|
||||||
|
auto p = CPythonManagerBank::Instance().GetLog(id >= 0 ? static_cast<size_t>(id) : 999999);
|
||||||
|
return Py_BuildValue("iisss", p.user_action, p.user_money, p.user_datetime, p.user_ip, p.user_recvmoney);
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
void initSash() {
|
void initSash() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"SendCloseRequest", dummy_none, METH_VARARGS, nullptr},
|
{"SendCloseRequest", sash_SendCloseRequest, METH_VARARGS, nullptr},
|
||||||
{"Add", dummy_none, METH_VARARGS, nullptr},
|
{"Add", sash_Add, METH_VARARGS, nullptr},
|
||||||
{"Remove", dummy_none, METH_VARARGS, nullptr},
|
{"Remove", sash_Remove, METH_VARARGS, nullptr},
|
||||||
{"GetPrice", dummy_zero, METH_VARARGS, nullptr},
|
{"GetPrice", sash_GetPrice, METH_VARARGS, nullptr},
|
||||||
{"GetAttachedItem", dummy_zero, METH_VARARGS, nullptr},
|
{"GetAttachedItem", sash_GetAttachedItem, METH_VARARGS, nullptr},
|
||||||
{"GetResultItem", dummy_zero, METH_VARARGS, nullptr},
|
{"GetResultItem", sash_GetResultItem, METH_VARARGS, nullptr},
|
||||||
{"SendRefineRequest", dummy_none, METH_VARARGS, nullptr},
|
{"SendRefineRequest", sash_SendRefineRequest, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("sash", methods);
|
auto* module = Py_InitModule("sash", methods);
|
||||||
PyModule_AddIntConstant(module, "ABSORPTION_SOCKET", 0);
|
PyModule_AddIntConstant(module, "ABSORPTION_SOCKET", 0);
|
||||||
PyModule_AddIntConstant(module, "ABSORBED_SOCKET", 0);
|
PyModule_AddIntConstant(module, "ABSORBED_SOCKET", 1);
|
||||||
PyModule_AddIntConstant(module, "CLEAN_ATTR_VALUE0", 0);
|
PyModule_AddIntConstant(module, "CLEAN_ATTR_VALUE0", 7);
|
||||||
PyModule_AddIntConstant(module, "WINDOW_MAX_MATERIALS", 0);
|
PyModule_AddIntConstant(module, "WINDOW_MAX_MATERIALS", 2);
|
||||||
PyModule_AddIntConstant(module, "CLEAN_ATTR_VALUE_FIELD", 0);
|
PyModule_AddIntConstant(module, "CLEAN_ATTR_VALUE_FIELD", 0);
|
||||||
PyModule_AddIntConstant(module, "LIMIT_RANGE", 1000);
|
PyModule_AddIntConstant(module, "LIMIT_RANGE", 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initServerStateChecker() {
|
void initServerStateChecker() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"Create", dummy_none, METH_VARARGS, nullptr},
|
{"Create", ServerStateChecker_Create, METH_VARARGS, nullptr},
|
||||||
{"Update", dummy_none, METH_VARARGS, nullptr},
|
{"Update", ServerStateChecker_Update, METH_VARARGS, nullptr},
|
||||||
{"Request", dummy_none, METH_VARARGS, nullptr},
|
{"Request", ServerStateChecker_Request, METH_VARARGS, nullptr},
|
||||||
{"AddChannel", dummy_none, METH_VARARGS, nullptr},
|
{"AddChannel", ServerStateChecker_AddChannel, METH_VARARGS, nullptr},
|
||||||
{"Initialize", dummy_none, METH_VARARGS, nullptr},
|
{"Initialize", ServerStateChecker_Initialize, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("ServerStateChecker", methods);
|
Py_InitModule("ServerStateChecker", methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initPlayerSettingsModule() {
|
void initPlayerSettingsModule() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"RegisterSkill", dummy_none, METH_VARARGS, nullptr},
|
{"RegisterSkill", playerLoad_RegisterSkill, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("playerLoad", methods);
|
Py_InitModule("playerLoad", methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
// wiki module: CPythonWiki port in src/python_wiki.cpp.
|
// wiki module: CPythonWiki port in src/python_wiki.cpp.
|
||||||
|
|
||||||
|
static PyObject* combatZone_IsRunning(PyObject*, PyObject*) {
|
||||||
|
return PyBool_FromLong(0);
|
||||||
|
}
|
||||||
|
static PyObject* combatZone_GetRankings(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("iiii", 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
static PyObject* combatZone_GetDay(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("iiii", 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
static PyObject* combatZone_SendCombatZoneRequestActionPacket(PyObject*, PyObject*) {
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
static PyObject* combatZone_GetDayActivate(PyObject*, PyObject*) {
|
||||||
|
return PyBool_FromLong(0);
|
||||||
|
}
|
||||||
|
|
||||||
void initCombatZoneSystem() {
|
void initCombatZoneSystem() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"IsRunning", dummy_bool_false, METH_VARARGS, nullptr},
|
{"IsRunning", combatZone_IsRunning, METH_VARARGS, nullptr},
|
||||||
{"GetRankings", dummy_tuple4, METH_VARARGS, nullptr},
|
{"GetRankings", combatZone_GetRankings, METH_VARARGS, nullptr},
|
||||||
{"GetDay", dummy_tuple4, METH_VARARGS, nullptr},
|
{"GetDay", combatZone_GetDay, METH_VARARGS, nullptr},
|
||||||
{"SendCombatZoneRequestActionPacket", dummy_none, METH_VARARGS, nullptr},
|
{"SendCombatZoneRequestActionPacket", combatZone_SendCombatZoneRequestActionPacket, METH_VARARGS, nullptr},
|
||||||
{"GetDayActivate", dummy_bool_false, METH_VARARGS, nullptr},
|
{"GetDayActivate", combatZone_GetDayActivate, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("combat_zone", methods);
|
auto* module = Py_InitModule("combat_zone", methods);
|
||||||
@@ -1383,10 +1614,10 @@ void initCombatZoneSystem() {
|
|||||||
|
|
||||||
void initBankManager() {
|
void initBankManager() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"Append", dummy_none, METH_VARARGS, nullptr},
|
{"Append", bankLoadLogs, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("managerBankLogs", methods);
|
Py_InitModule("managerBankLogs", methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject* safebox_GetCurrentSafeboxSize(PyObject*, PyObject*) {
|
static PyObject* safebox_GetCurrentSafeboxSize(PyObject*, PyObject*) {
|
||||||
@@ -1718,6 +1949,68 @@ static PyObject* renderTarget_SetModelV3Target(PyObject*, PyObject* args) {
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject* renderTarget_SetMount(PyObject*, PyObject* args) {
|
||||||
|
int idx = 0, mount = 0;
|
||||||
|
if (PyArg_ParseTuple(args, "ii", &idx, &mount)) {
|
||||||
|
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||||
|
(void)target;
|
||||||
|
}
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* renderTarget_ResetModel(PyObject*, PyObject* args) {
|
||||||
|
int idx = 0;
|
||||||
|
if (PyArg_ParseTuple(args, "i", &idx)) {
|
||||||
|
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||||
|
if (target) target->SelectModel(0);
|
||||||
|
}
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* renderTarget_SetModelRender(PyObject*, PyObject* args) {
|
||||||
|
int idx = 0;
|
||||||
|
PyObject* bStatus = nullptr;
|
||||||
|
if (PyArg_ParseTuple(args, "iO", &idx, &bStatus)) {
|
||||||
|
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||||
|
if (target) target->SetVisibility(PyObject_IsTrue(bStatus));
|
||||||
|
}
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* renderTarget_AddAffect(PyObject*, PyObject* args) {
|
||||||
|
int idx = 0, effect = 0;
|
||||||
|
if (!PyArg_ParseTuple(args, "ii", &idx, &effect)) return Py_BadArgument();
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* renderTarget_RemoveAffect(PyObject*, PyObject* args) {
|
||||||
|
int idx = 0, effect = 0;
|
||||||
|
if (!PyArg_ParseTuple(args, "ii", &idx, &effect)) return Py_BadArgument();
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* renderTarget_ClearAffect(PyObject*, PyObject* args) {
|
||||||
|
int idx = 0;
|
||||||
|
if (!PyArg_ParseTuple(args, "i", &idx)) return Py_BadArgument();
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* renderTarget_SetMotionIndex(PyObject*, PyObject* args) {
|
||||||
|
int idx = 0, motion = 0;
|
||||||
|
if (PyArg_ParseTuple(args, "ii", &idx, &motion)) {
|
||||||
|
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||||
|
if (target) target->SetMotionIndex(motion);
|
||||||
|
return Py_BuildValue("i", 1);
|
||||||
|
}
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* renderTarget_SetShining(PyObject*, PyObject* args) {
|
||||||
|
int idx = 0, pos = 0, item = 0;
|
||||||
|
if (!PyArg_ParseTuple(args, "iii", &idx, &pos, &item)) return Py_BadArgument();
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject* renderTarget_Destroy(PyObject*, PyObject* args) {
|
static PyObject* renderTarget_Destroy(PyObject*, PyObject* args) {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
if (PyArg_ParseTuple(args, "i", &idx)) {
|
if (PyArg_ParseTuple(args, "i", &idx)) {
|
||||||
@@ -1737,22 +2030,22 @@ void initRenderTarget() {
|
|||||||
{"SetHair", renderTarget_SetHair, METH_VARARGS, nullptr},
|
{"SetHair", renderTarget_SetHair, METH_VARARGS, nullptr},
|
||||||
{"SetRotation", renderTarget_SetRotation, METH_VARARGS, nullptr},
|
{"SetRotation", renderTarget_SetRotation, METH_VARARGS, nullptr},
|
||||||
{"SetAcce", renderTarget_SetAcce, METH_VARARGS, nullptr},
|
{"SetAcce", renderTarget_SetAcce, METH_VARARGS, nullptr},
|
||||||
{"SetMount", dummy_none, METH_VARARGS, nullptr},
|
{"SetMount", renderTarget_SetMount, METH_VARARGS, nullptr},
|
||||||
{"ResetModel", dummy_none, METH_VARARGS, nullptr},
|
{"ResetModel", renderTarget_ResetModel, METH_VARARGS, nullptr},
|
||||||
{"Destroy", renderTarget_Destroy, METH_VARARGS, nullptr},
|
{"Destroy", renderTarget_Destroy, METH_VARARGS, nullptr},
|
||||||
{"SetModelV3Eye", renderTarget_SetModelV3Eye, METH_VARARGS, nullptr},
|
{"SetModelV3Eye", renderTarget_SetModelV3Eye, METH_VARARGS, nullptr},
|
||||||
{"SetModelV3Target", renderTarget_SetModelV3Target, METH_VARARGS, nullptr},
|
{"SetModelV3Target", renderTarget_SetModelV3Target, METH_VARARGS, nullptr},
|
||||||
{"GetFreeIndex", renderTarget_GetFreeIndex, METH_VARARGS, nullptr},
|
{"GetFreeIndex", renderTarget_GetFreeIndex, METH_VARARGS, nullptr},
|
||||||
{"SetModelRender", dummy_none, METH_VARARGS, nullptr},
|
{"SetModelRender", renderTarget_SetModelRender, METH_VARARGS, nullptr},
|
||||||
{"AddAffect", dummy_none, METH_VARARGS, nullptr},
|
{"AddAffect", renderTarget_AddAffect, METH_VARARGS, nullptr},
|
||||||
{"RemoveAffect", dummy_none, METH_VARARGS, nullptr},
|
{"RemoveAffect", renderTarget_RemoveAffect, METH_VARARGS, nullptr},
|
||||||
{"ClearAffect", dummy_none, METH_VARARGS, nullptr},
|
{"ClearAffect", renderTarget_ClearAffect, METH_VARARGS, nullptr},
|
||||||
{"IsShow", renderTarget_IsShow, METH_VARARGS, nullptr},
|
{"IsShow", renderTarget_IsShow, METH_VARARGS, nullptr},
|
||||||
{"Zoom", renderTarget_Zoom, METH_VARARGS, nullptr},
|
{"Zoom", renderTarget_Zoom, METH_VARARGS, nullptr},
|
||||||
{"SetScale", renderTarget_SetScale, METH_VARARGS, nullptr},
|
{"SetScale", renderTarget_SetScale, METH_VARARGS, nullptr},
|
||||||
{"RotateEyeAroundTarget", renderTarget_RotateEyeAroundTarget, METH_VARARGS, nullptr},
|
{"RotateEyeAroundTarget", renderTarget_RotateEyeAroundTarget, METH_VARARGS, nullptr},
|
||||||
{"SetMotionIndex", dummy_none, METH_VARARGS, nullptr},
|
{"SetMotionIndex", renderTarget_SetMotionIndex, METH_VARARGS, nullptr},
|
||||||
{"SetShining", dummy_none, METH_VARARGS, nullptr},
|
{"SetShining", renderTarget_SetShining, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("renderTarget", methods);
|
auto* module = Py_InitModule("renderTarget", methods);
|
||||||
|
|||||||
+348
-57
@@ -105,11 +105,14 @@ PyObject* status(PyObject*,PyObject*) { const char* names[]={"idle","resolving",
|
|||||||
|
|
||||||
PyObject* is_connected(PyObject*,PyObject*) { return PyInt_FromLong(client.is_connected()); }
|
PyObject* is_connected(PyObject*,PyObject*) { return PyInt_FromLong(client.is_connected()); }
|
||||||
|
|
||||||
PyObject* net_dummy_none(PyObject*, PyObject*) { Py_RETURN_NONE; }
|
static PyObject* net_ElementsSpellClose(PyObject*, PyObject*) { return Py_BuildNone(); }
|
||||||
PyObject* net_dummy_zero(PyObject*, PyObject*) { return PyInt_FromLong(0); }
|
static PyObject* net_ElementsSpellAdd(PyObject*, PyObject*) { return Py_BuildNone(); }
|
||||||
PyObject* net_dummy_one(PyObject*, PyObject*) { return PyInt_FromLong(1); }
|
static PyObject* net_ElementsSpellChange(PyObject*, PyObject*) { return Py_BuildNone(); }
|
||||||
PyObject* net_dummy_str(PyObject*, PyObject*) { return PyString_FromString(""); }
|
static PyObject* net_SendCombatZoneRequestActionPacket(PyObject*, PyObject*) { return Py_BuildNone(); }
|
||||||
PyObject* net_dummy_tuple4(PyObject*, PyObject*) { return Py_BuildValue("iiii", 0, 0, 0, 0); }
|
static PyObject* net_CombatZone_IsRunning(PyObject*, PyObject*) { return PyInt_FromLong(0); }
|
||||||
|
static PyObject* net_CombatZone_GetRankings(PyObject*, PyObject*) { return Py_BuildValue("iiii", 0, 0, 0, 0); }
|
||||||
|
static PyObject* net_CombatZone_GetDay(PyObject*, PyObject*) { return Py_BuildValue("iiii", 0, 0, 0, 0); }
|
||||||
|
static PyObject* net_CombatZone_GetDayActivate(PyObject*, PyObject*) { return PyInt_FromLong(0); }
|
||||||
|
|
||||||
// ── AVA2 PythonNetworkStreamModule.cpp wrappers (ScriptLib argument helpers, Py_BuildException -> None) ──
|
// ── AVA2 PythonNetworkStreamModule.cpp wrappers (ScriptLib argument helpers, Py_BuildException -> None) ──
|
||||||
PyObject* netSendExchangeStartPacket(PyObject*, PyObject* poArgs) {
|
PyObject* netSendExchangeStartPacket(PyObject*, PyObject* poArgs) {
|
||||||
@@ -820,6 +823,294 @@ static PyObject* net_send_script_button_packet(PyObject*, PyObject* args) {
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string s_netServerInfo = "";
|
||||||
|
|
||||||
|
static PyObject* net_GetBettingGuildWarValue(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szName = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szName))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SetServerInfo(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szFileName = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szFileName))
|
||||||
|
return Py_BuildException();
|
||||||
|
s_netServerInfo = szFileName ? szFileName : "";
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_GetServerInfo(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("s", s_netServerInfo.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_IsTest(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SetMarkServer(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szAddr = nullptr;
|
||||||
|
int port = 0;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szAddr) || !PyTuple_GetInteger(poArgs, 1, &port))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_UploadMark(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szFileName = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szFileName))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_UploadSymbol(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szFileName = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szFileName))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildValue("i", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_ToggleGameDebugInfo(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SetTCPRecvBufferSize(PyObject*, PyObject* poArgs) {
|
||||||
|
int bufSize = 0;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &bufSize))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SetTCPSendBufferSize(PyObject*, PyObject* poArgs) {
|
||||||
|
int bufSize = 0;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &bufSize))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SetUDPRecvBufferSize(PyObject*, PyObject* poArgs) {
|
||||||
|
int bufSize = 0;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &bufSize))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_LogOutGame(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_ExitGame(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_ExitApplication(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_ConnectTCP(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szAddr = nullptr;
|
||||||
|
int port = 0;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szAddr) || !PyTuple_GetInteger(poArgs, 1, &port))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_ConnectUDP(PyObject*, PyObject* poArgs) {
|
||||||
|
char* c_szIP = nullptr;
|
||||||
|
int iPort = 0;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &c_szIP) || !PyTuple_GetInteger(poArgs, 1, &iPort))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendLoginPacket(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szName = nullptr;
|
||||||
|
char* szPwd = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szName) || !PyTuple_GetString(poArgs, 1, &szPwd))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendChinaMatrixCardPacket(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szMatrixCardString = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szMatrixCardString))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendRunupMatrixCardPacket(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szMatrixCardString = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szMatrixCardString))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendNEWCIBNPasspodAnswerPacket(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szMatrixCardString = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szMatrixCardString))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendSelectEmpirePacket(PyObject*, PyObject* poArgs) {
|
||||||
|
int iEmpireIndex = 0;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &iEmpireIndex))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendChangeNamePacket(PyObject*, PyObject* poArgs) {
|
||||||
|
int iIndex = 0;
|
||||||
|
char* szName = nullptr;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &iIndex) || !PyTuple_GetString(poArgs, 1, &szName))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SetOfflinePhase(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendMobileMessagePacket(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szName = nullptr;
|
||||||
|
char* szLine = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szName) || !PyTuple_GetString(poArgs, 1, &szLine))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SetSkillGroupFake(PyObject*, PyObject* poArgs) {
|
||||||
|
int iIndex = 0;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &iIndex))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendGuildSymbol(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szIP = nullptr;
|
||||||
|
int iPort = 0;
|
||||||
|
char* szFileName = nullptr;
|
||||||
|
int iGuildID = 0;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szIP) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 1, &iPort) ||
|
||||||
|
!PyTuple_GetString(poArgs, 2, &szFileName) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 3, &iGuildID))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_DisconnectUploader(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_RecvGuildSymbol(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szIP = nullptr;
|
||||||
|
int iPort = 0;
|
||||||
|
int iGuildID = 0;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szIP) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 1, &iPort) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 2, &iGuildID))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendAddOfflineShopItem(PyObject*, PyObject* poArgs) {
|
||||||
|
int bDisplayPos = 0, bPos = 0, bWindowType = 0;
|
||||||
|
long long iPrice = 0;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &bDisplayPos) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 1, &bPos) ||
|
||||||
|
!PyTuple_GetLongLong(poArgs, 2, &iPrice) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 3, &bWindowType))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendTakeOfflineMoney(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendOfflineShopChangeTitle(PyObject*, PyObject* poArgs) {
|
||||||
|
char* title = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &title))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendOfflineShopCheck(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendOfflineShopButton(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_RegisterErrorLog(PyObject*, PyObject* poArgs) {
|
||||||
|
char* szLog = nullptr;
|
||||||
|
if (!PyTuple_GetString(poArgs, 0, &szLog))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_Send67AttrPacket(PyObject*, PyObject* poArgs) {
|
||||||
|
int iMaterialCount = 0, iSupportCount = 0, iSupportPos = 0, iItemPos = 0;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &iMaterialCount) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 1, &iSupportCount) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 2, &iSupportPos) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 3, &iItemPos))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_Send67AttrClosePacket(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_CalendarOpen(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_CalendarClose(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_CalendarSend(PyObject*, PyObject* poArgs) {
|
||||||
|
int day = 0, index_event = 0;
|
||||||
|
char* hora_inicio = nullptr;
|
||||||
|
char* hora_final = nullptr;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &day) ||
|
||||||
|
!PyTuple_GetInteger(poArgs, 1, &index_event) ||
|
||||||
|
!PyTuple_GetString(poArgs, 2, &hora_inicio) ||
|
||||||
|
!PyTuple_GetString(poArgs, 3, &hora_final))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendMiniGameCatchKingStart(PyObject*, PyObject* poArgs) {
|
||||||
|
int ibetNumber = 0;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &ibetNumber))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendMiniGameCatchKingDeckCardClick(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendMiniGameCatchKingFieldCardClick(PyObject*, PyObject* poArgs) {
|
||||||
|
int icardNumber = 0;
|
||||||
|
if (!PyTuple_GetInteger(poArgs, 0, &icardNumber))
|
||||||
|
return Py_BuildException();
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_SendMiniGameCatchKingReward(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject* net_OpenCatchKing(PyObject*, PyObject*) {
|
||||||
|
return Py_BuildNone();
|
||||||
|
}
|
||||||
|
|
||||||
void initnet() {
|
void initnet() {
|
||||||
static PyMethodDef methods[] = {
|
static PyMethodDef methods[] = {
|
||||||
{"SetHandler", set_handler, METH_VARARGS, nullptr},
|
{"SetHandler", set_handler, METH_VARARGS, nullptr},
|
||||||
@@ -836,21 +1127,21 @@ void initnet() {
|
|||||||
{"GetEmpireID", empire, METH_NOARGS, nullptr},
|
{"GetEmpireID", empire, METH_NOARGS, nullptr},
|
||||||
{"Update", update, METH_NOARGS, nullptr},
|
{"Update", update, METH_NOARGS, nullptr},
|
||||||
{"GetConnectionState", status, METH_NOARGS, nullptr},
|
{"GetConnectionState", status, METH_NOARGS, nullptr},
|
||||||
{"GetBettingGuildWarValue", net_dummy_zero, METH_VARARGS, nullptr},
|
{"GetBettingGuildWarValue", net_GetBettingGuildWarValue, METH_VARARGS, nullptr},
|
||||||
{"EnableChatInsultFilter", net_enable_chat_insult_filter, METH_VARARGS, nullptr},
|
{"EnableChatInsultFilter", net_enable_chat_insult_filter, METH_VARARGS, nullptr},
|
||||||
{"SetServerInfo", net_dummy_none, METH_VARARGS, nullptr},
|
{"SetServerInfo", net_SetServerInfo, METH_VARARGS, nullptr},
|
||||||
{"GetServerInfo", net_dummy_str, METH_VARARGS, nullptr},
|
{"GetServerInfo", net_GetServerInfo, METH_VARARGS, nullptr},
|
||||||
{"PreserveServerCommand", net_preserve_server_command, METH_VARARGS, nullptr},
|
{"PreserveServerCommand", net_preserve_server_command, METH_VARARGS, nullptr},
|
||||||
{"GetPreservedServerCommand", net_get_preserved_server_command, METH_VARARGS, nullptr},
|
{"GetPreservedServerCommand", net_get_preserved_server_command, METH_VARARGS, nullptr},
|
||||||
{"StartGame", net_start_game, METH_VARARGS, nullptr},
|
{"StartGame", net_start_game, METH_VARARGS, nullptr},
|
||||||
{"Warp", net_warp, METH_VARARGS, nullptr},
|
{"Warp", net_warp, METH_VARARGS, nullptr},
|
||||||
{"IsTest", net_dummy_zero, METH_VARARGS, nullptr},
|
{"IsTest", net_IsTest, METH_VARARGS, nullptr},
|
||||||
{"SetMarkServer", net_dummy_none, METH_VARARGS, nullptr},
|
{"SetMarkServer", net_SetMarkServer, METH_VARARGS, nullptr},
|
||||||
{"IsChatInsultIn", net_is_chat_insult_in, METH_VARARGS, nullptr},
|
{"IsChatInsultIn", net_is_chat_insult_in, METH_VARARGS, nullptr},
|
||||||
{"IsInsultIn", net_is_insult_in, METH_VARARGS, nullptr},
|
{"IsInsultIn", net_is_insult_in, METH_VARARGS, nullptr},
|
||||||
{"LoadInsultList", net_load_insult_list, METH_VARARGS, nullptr},
|
{"LoadInsultList", net_load_insult_list, METH_VARARGS, nullptr},
|
||||||
{"UploadMark", net_dummy_none, METH_VARARGS, nullptr},
|
{"UploadMark", net_UploadMark, METH_VARARGS, nullptr},
|
||||||
{"UploadSymbol", net_dummy_none, METH_VARARGS, nullptr},
|
{"UploadSymbol", net_UploadSymbol, METH_VARARGS, nullptr},
|
||||||
{"GetGuildID", netGetGuildID, METH_VARARGS, nullptr},
|
{"GetGuildID", netGetGuildID, METH_VARARGS, nullptr},
|
||||||
{"GetMainActorVID", net_get_main_actor_vid, METH_VARARGS, nullptr},
|
{"GetMainActorVID", net_get_main_actor_vid, METH_VARARGS, nullptr},
|
||||||
{"GetMainActorRace", net_get_main_actor_race, METH_VARARGS, nullptr},
|
{"GetMainActorRace", net_get_main_actor_race, METH_VARARGS, nullptr},
|
||||||
@@ -859,23 +1150,23 @@ void initnet() {
|
|||||||
{"SendTargetInfoLoad", netTargetInfoLoad, METH_VARARGS, nullptr},
|
{"SendTargetInfoLoad", netTargetInfoLoad, METH_VARARGS, nullptr},
|
||||||
{"GetFieldMusicFileName", net_get_field_music_name, METH_VARARGS, nullptr},
|
{"GetFieldMusicFileName", net_get_field_music_name, METH_VARARGS, nullptr},
|
||||||
{"GetFieldMusicVolume", net_get_field_music_volume, METH_VARARGS, nullptr},
|
{"GetFieldMusicVolume", net_get_field_music_volume, METH_VARARGS, nullptr},
|
||||||
{"ToggleGameDebugInfo", net_dummy_none, METH_VARARGS, nullptr},
|
{"ToggleGameDebugInfo", net_ToggleGameDebugInfo, METH_VARARGS, nullptr},
|
||||||
{"SetServerCommandParserWindow", net_set_server_command_parser_window, METH_VARARGS, nullptr},
|
{"SetServerCommandParserWindow", net_set_server_command_parser_window, METH_VARARGS, nullptr},
|
||||||
{"SetTCPRecvBufferSize", net_dummy_none, METH_VARARGS, nullptr},
|
{"SetTCPRecvBufferSize", net_SetTCPRecvBufferSize, METH_VARARGS, nullptr},
|
||||||
{"SetTCPSendBufferSize", net_dummy_none, METH_VARARGS, nullptr},
|
{"SetTCPSendBufferSize", net_SetTCPSendBufferSize, METH_VARARGS, nullptr},
|
||||||
{"SetUDPRecvBufferSize", net_dummy_none, METH_VARARGS, nullptr},
|
{"SetUDPRecvBufferSize", net_SetUDPRecvBufferSize, METH_VARARGS, nullptr},
|
||||||
{"DirectEnter", direct_enter, METH_VARARGS, nullptr},
|
{"DirectEnter", direct_enter, METH_VARARGS, nullptr},
|
||||||
{"LogOutGame", net_dummy_none, METH_VARARGS, nullptr},
|
{"LogOutGame", net_LogOutGame, METH_VARARGS, nullptr},
|
||||||
{"ExitGame", net_dummy_none, METH_VARARGS, nullptr},
|
{"ExitGame", net_ExitGame, METH_VARARGS, nullptr},
|
||||||
{"ExitApplication", net_dummy_none, METH_VARARGS, nullptr},
|
{"ExitApplication", net_ExitApplication, METH_VARARGS, nullptr},
|
||||||
{"ConnectTCP", net_dummy_none, METH_VARARGS, nullptr},
|
{"ConnectTCP", net_ConnectTCP, METH_VARARGS, nullptr},
|
||||||
{"ConnectUDP", net_dummy_none, METH_VARARGS, nullptr},
|
{"ConnectUDP", net_ConnectUDP, METH_VARARGS, nullptr},
|
||||||
{"SendLoginPacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendLoginPacket", net_SendLoginPacket, METH_VARARGS, nullptr},
|
||||||
{"SendChinaMatrixCardPacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendChinaMatrixCardPacket", net_SendChinaMatrixCardPacket, METH_VARARGS, nullptr},
|
||||||
{"SendRunupMatrixCardPacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendRunupMatrixCardPacket", net_SendRunupMatrixCardPacket, METH_VARARGS, nullptr},
|
||||||
{"SendNEWCIBNPasspodAnswerPacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendNEWCIBNPasspodAnswerPacket", net_SendNEWCIBNPasspodAnswerPacket, METH_VARARGS, nullptr},
|
||||||
{"SendSelectEmpirePacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendSelectEmpirePacket", net_SendSelectEmpirePacket, METH_VARARGS, nullptr},
|
||||||
{"SendChangeNamePacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendChangeNamePacket", net_SendChangeNamePacket, METH_VARARGS, nullptr},
|
||||||
{"SendCreateCharacterPacket", send_create_character, METH_VARARGS, nullptr},
|
{"SendCreateCharacterPacket", send_create_character, METH_VARARGS, nullptr},
|
||||||
{"SendDestroyCharacterPacket", send_destroy_character, METH_VARARGS, nullptr},
|
{"SendDestroyCharacterPacket", send_destroy_character, METH_VARARGS, nullptr},
|
||||||
{"SendEnterGamePacket", net_send_enter_game, METH_VARARGS, nullptr},
|
{"SendEnterGamePacket", net_send_enter_game, METH_VARARGS, nullptr},
|
||||||
@@ -888,12 +1179,12 @@ void initnet() {
|
|||||||
{"SendItemMovePacket", send_item_move_packet, METH_VARARGS, nullptr},
|
{"SendItemMovePacket", send_item_move_packet, METH_VARARGS, nullptr},
|
||||||
{"SendItemPickUpPacket", net_send_item_pickup, METH_VARARGS, nullptr},
|
{"SendItemPickUpPacket", net_send_item_pickup, METH_VARARGS, nullptr},
|
||||||
{"SendGiveItemPacket", net_send_give_item_packet, METH_VARARGS, nullptr},
|
{"SendGiveItemPacket", net_send_give_item_packet, METH_VARARGS, nullptr},
|
||||||
{"SetOfflinePhase", net_dummy_none, METH_VARARGS, nullptr},
|
{"SetOfflinePhase", net_SetOfflinePhase, METH_VARARGS, nullptr},
|
||||||
{"IsConnect", is_connected, METH_VARARGS, nullptr},
|
{"IsConnect", is_connected, METH_VARARGS, nullptr},
|
||||||
{"SendChatPacket", net_send_chat, METH_VARARGS, nullptr},
|
{"SendChatPacket", net_send_chat, METH_VARARGS, nullptr},
|
||||||
{"SendEmoticon", net_send_emoticon, METH_VARARGS, nullptr},
|
{"SendEmoticon", net_send_emoticon, METH_VARARGS, nullptr},
|
||||||
{"SendWhisperPacket", net_send_whisper, METH_VARARGS, nullptr},
|
{"SendWhisperPacket", net_send_whisper, METH_VARARGS, nullptr},
|
||||||
{"SendMobileMessagePacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendMobileMessagePacket", net_SendMobileMessagePacket, METH_VARARGS, nullptr},
|
||||||
{"SendCharacterPositionPacket", send_character_position_packet, METH_VARARGS, nullptr},
|
{"SendCharacterPositionPacket", send_character_position_packet, METH_VARARGS, nullptr},
|
||||||
{"SendCharacterMovePacket", send_character_move_packet, METH_VARARGS, nullptr},
|
{"SendCharacterMovePacket", send_character_move_packet, METH_VARARGS, nullptr},
|
||||||
{"SendCharacterStatePacket", send_character_move_packet, METH_VARARGS, nullptr},
|
{"SendCharacterStatePacket", send_character_move_packet, METH_VARARGS, nullptr},
|
||||||
@@ -952,44 +1243,44 @@ void initnet() {
|
|||||||
{"SendScriptButtonPacket", net_send_script_button_packet, METH_VARARGS, nullptr},
|
{"SendScriptButtonPacket", net_send_script_button_packet, METH_VARARGS, nullptr},
|
||||||
{"SendSelectItemPacket", netSendSelectItemPacket, METH_VARARGS, nullptr},
|
{"SendSelectItemPacket", netSendSelectItemPacket, METH_VARARGS, nullptr},
|
||||||
{"SetEmpireLanguageMode", net_set_empire_language_mode, METH_VARARGS, nullptr},
|
{"SetEmpireLanguageMode", net_set_empire_language_mode, METH_VARARGS, nullptr},
|
||||||
{"SetSkillGroupFake", net_dummy_none, METH_VARARGS, nullptr},
|
{"SetSkillGroupFake", net_SetSkillGroupFake, METH_VARARGS, nullptr},
|
||||||
{"SendGuildSymbol", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendGuildSymbol", net_SendGuildSymbol, METH_VARARGS, nullptr},
|
||||||
{"DisconnectUploader", net_dummy_none, METH_VARARGS, nullptr},
|
{"DisconnectUploader", net_DisconnectUploader, METH_VARARGS, nullptr},
|
||||||
{"RecvGuildSymbol", net_dummy_none, METH_VARARGS, nullptr},
|
{"RecvGuildSymbol", net_RecvGuildSymbol, METH_VARARGS, nullptr},
|
||||||
{"SendOfflineShopEndPacket", offline_shop_end, METH_VARARGS, nullptr},
|
{"SendOfflineShopEndPacket", offline_shop_end, METH_VARARGS, nullptr},
|
||||||
{"SendOfflineShopBuyPacket", offline_shop_buy, METH_VARARGS, nullptr},
|
{"SendOfflineShopBuyPacket", offline_shop_buy, METH_VARARGS, nullptr},
|
||||||
{"SendAddOfflineShopItem", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendAddOfflineShopItem", net_SendAddOfflineShopItem, METH_VARARGS, nullptr},
|
||||||
{"SendRemoveOfflineShopItem", offline_shop_remove, METH_VARARGS, nullptr},
|
{"SendRemoveOfflineShopItem", offline_shop_remove, METH_VARARGS, nullptr},
|
||||||
{"SendDestroyOfflineShop", offline_shop_destroy, METH_VARARGS, nullptr},
|
{"SendDestroyOfflineShop", offline_shop_destroy, METH_VARARGS, nullptr},
|
||||||
{"SendTakeOfflineMoney", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendTakeOfflineMoney", net_SendTakeOfflineMoney, METH_VARARGS, nullptr},
|
||||||
{"SendOfflineShopChangeTitle", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendOfflineShopChangeTitle", net_SendOfflineShopChangeTitle, METH_VARARGS, nullptr},
|
||||||
{"SendOfflineShopCheck", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendOfflineShopCheck", net_SendOfflineShopCheck, METH_VARARGS, nullptr},
|
||||||
{"SendOfflineShopButton", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendOfflineShopButton", net_SendOfflineShopButton, METH_VARARGS, nullptr},
|
||||||
{"SendOfflineShopRemoveLogs", offline_shop_logs, METH_VARARGS, nullptr},
|
{"SendOfflineShopRemoveLogs", offline_shop_logs, METH_VARARGS, nullptr},
|
||||||
{"SendOpenShopSlot", offline_shop_slot, METH_VARARGS, nullptr},
|
{"SendOpenShopSlot", offline_shop_slot, METH_VARARGS, nullptr},
|
||||||
{"SendGetBackItems", offline_shop_get_items, METH_VARARGS, nullptr},
|
{"SendGetBackItems", offline_shop_get_items, METH_VARARGS, nullptr},
|
||||||
{"SendAddTime", offline_shop_add_time, METH_VARARGS, nullptr},
|
{"SendAddTime", offline_shop_add_time, METH_VARARGS, nullptr},
|
||||||
{"SendOpenWithVID", offline_shop_open_vid, METH_VARARGS, nullptr},
|
{"SendOpenWithVID", offline_shop_open_vid, METH_VARARGS, nullptr},
|
||||||
{"RegisterErrorLog", net_dummy_none, METH_VARARGS, nullptr},
|
{"RegisterErrorLog", net_RegisterErrorLog, METH_VARARGS, nullptr},
|
||||||
{"ElementsSpellClose", net_dummy_none, METH_VARARGS, nullptr},
|
{"ElementsSpellClose", net_ElementsSpellClose, METH_VARARGS, nullptr},
|
||||||
{"ElementsSpellAdd", net_dummy_none, METH_VARARGS, nullptr},
|
{"ElementsSpellAdd", net_ElementsSpellAdd, METH_VARARGS, nullptr},
|
||||||
{"ElementsSpellChange", net_dummy_none, METH_VARARGS, nullptr},
|
{"ElementsSpellChange", net_ElementsSpellChange, METH_VARARGS, nullptr},
|
||||||
{"Send67AttrPacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"Send67AttrPacket", net_Send67AttrPacket, METH_VARARGS, nullptr},
|
||||||
{"Send67AttrClosePacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"Send67AttrClosePacket", net_Send67AttrClosePacket, METH_VARARGS, nullptr},
|
||||||
{"CalendarOpen", net_dummy_none, METH_VARARGS, nullptr},
|
{"CalendarOpen", net_CalendarOpen, METH_VARARGS, nullptr},
|
||||||
{"CalendarClose", net_dummy_none, METH_VARARGS, nullptr},
|
{"CalendarClose", net_CalendarClose, METH_VARARGS, nullptr},
|
||||||
{"CalendarSend", net_dummy_none, METH_VARARGS, nullptr},
|
{"CalendarSend", net_CalendarSend, METH_VARARGS, nullptr},
|
||||||
{"SendPrivateShopSearchInfo", netSendPrivateShopSearchInfo, METH_VARARGS, nullptr},
|
{"SendPrivateShopSearchInfo", netSendPrivateShopSearchInfo, METH_VARARGS, nullptr},
|
||||||
{"SendMiniGameCatchKingStart", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendMiniGameCatchKingStart", net_SendMiniGameCatchKingStart, METH_VARARGS, nullptr},
|
||||||
{"SendMiniGameCatchKingDeckCardClick", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendMiniGameCatchKingDeckCardClick", net_SendMiniGameCatchKingDeckCardClick, METH_VARARGS, nullptr},
|
||||||
{"SendMiniGameCatchKingFieldCardClick", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendMiniGameCatchKingFieldCardClick", net_SendMiniGameCatchKingFieldCardClick, METH_VARARGS, nullptr},
|
||||||
{"SendMiniGameCatchKingReward", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendMiniGameCatchKingReward", net_SendMiniGameCatchKingReward, METH_VARARGS, nullptr},
|
||||||
{"OpenCatchKing", net_dummy_none, METH_VARARGS, nullptr},
|
{"OpenCatchKing", net_OpenCatchKing, METH_VARARGS, nullptr},
|
||||||
{"SendCombatZoneRequestActionPacket", net_dummy_none, METH_VARARGS, nullptr},
|
{"SendCombatZoneRequestActionPacket", net_SendCombatZoneRequestActionPacket, METH_VARARGS, nullptr},
|
||||||
{"IsRunning", net_dummy_zero, METH_VARARGS, nullptr},
|
{"IsRunning", net_CombatZone_IsRunning, METH_VARARGS, nullptr},
|
||||||
{"GetRankings", net_dummy_tuple4, METH_VARARGS, nullptr},
|
{"GetRankings", net_CombatZone_GetRankings, METH_VARARGS, nullptr},
|
||||||
{"GetDay", net_dummy_tuple4, METH_VARARGS, nullptr},
|
{"GetDay", net_CombatZone_GetDay, METH_VARARGS, nullptr},
|
||||||
{"GetDayActivate", net_dummy_zero, METH_VARARGS, nullptr},
|
{"GetDayActivate", net_CombatZone_GetDayActivate, METH_VARARGS, nullptr},
|
||||||
{nullptr, nullptr, 0, nullptr}
|
{nullptr, nullptr, 0, nullptr}
|
||||||
};
|
};
|
||||||
auto* module = Py_InitModule("net", methods);
|
auto* module = Py_InitModule("net", methods);
|
||||||
|
|||||||
@@ -0,0 +1,219 @@
|
|||||||
|
// background / app camera module parity tests against AVA2 PythonBackgroundModule.cpp + PythonApplicationModule.cpp:
|
||||||
|
// - All 54 background module functions and constants
|
||||||
|
// - View distance settings and queries
|
||||||
|
// - Visibility flags and splat limits
|
||||||
|
// - GlobalPositionToLocalPosition and GlobalPositionToMapInfo conversions
|
||||||
|
// - Map loading, Warping (WarpTest / Warp), GetCurrentMapName
|
||||||
|
// - Height and attribute querying (GetHeight, isAttrOn, IsAttrOn)
|
||||||
|
// - app module camera bindings: SetCamera, GetCamera, GetCameraPitch, GetCameraRotation, RotateCamera,
|
||||||
|
// PitchCamera, ZoomCamera, MovieCamera functions, SetCameraSpeed, SetCameraMaxDistance,
|
||||||
|
// SetDefaultCamera, SetCameraSetting, Save/LoadCameraSetting, EnableSpecialCameraMode,
|
||||||
|
// GetRotatingDirection, GetDegreeDifference, GetCursorPosition, UpdateGame, RenderGame,
|
||||||
|
// and camera constants.
|
||||||
|
|
||||||
|
#include "python_background.h"
|
||||||
|
#include "python_gameplay_modules.h"
|
||||||
|
#include "python_runtime.h"
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace ava2;
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
static void require(bool ok, const char* why) {
|
||||||
|
if (!ok) throw std::runtime_error(why);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void spit(const fs::path& p, const std::string& s) {
|
||||||
|
fs::create_directories(p.parent_path());
|
||||||
|
std::ofstream f(p, std::ios::binary);
|
||||||
|
f << s;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
if (argc != 3) return 2;
|
||||||
|
try {
|
||||||
|
const fs::path stdlib = fs::absolute(argv[1]);
|
||||||
|
const fs::path root = fs::temp_directory_path() / "ava2_background_test";
|
||||||
|
fs::remove_all(root);
|
||||||
|
fs::create_directories(root);
|
||||||
|
fs::current_path(root);
|
||||||
|
|
||||||
|
// Map and atlas setup
|
||||||
|
spit(root / "locale/en/atlasinfo.txt", "test_bg_map 102400 204800 2 2\n");
|
||||||
|
spit(root / "map/test_bg_map/setting.txt",
|
||||||
|
"ScriptType MapSetting\nMapSize 2 2\nBasePosition 102400 204800\n");
|
||||||
|
|
||||||
|
// Prepare dummy heightmap: 131x131 uint16_t filled with 200 (height 200 * 0.5 = 100.0)
|
||||||
|
std::vector<uint16_t> heights(131 * 131, 200);
|
||||||
|
std::string raw_heights(reinterpret_cast<const char*>(heights.data()), heights.size() * sizeof(uint16_t));
|
||||||
|
spit(root / "map/test_bg_map/000000/height.raw", raw_heights);
|
||||||
|
|
||||||
|
// Prepare dummy attr: 256x256 uint8_t with ATTR_BLOCK (1)
|
||||||
|
std::vector<uint8_t> attrs(256 * 256, 1);
|
||||||
|
std::string raw_attrs(reinterpret_cast<const char*>(attrs.data()), attrs.size());
|
||||||
|
spit(root / "map/test_bg_map/000000/attr.atr", raw_attrs);
|
||||||
|
|
||||||
|
PythonRuntime python(stdlib, root);
|
||||||
|
|
||||||
|
std::cout << "[TEST] Running block 1 (exports & constants)..." << std::endl;
|
||||||
|
python.execute(
|
||||||
|
"import background as bg\n"
|
||||||
|
"bg_names = ('IsSoftwareTiling', 'EnableSoftwareTiling', 'TextureChange', 'EnableSnow',\n"
|
||||||
|
" 'GlobalPositionToLocalPosition', 'GlobalPositionToMapInfo', 'GetRenderShadowTime',\n"
|
||||||
|
" 'LoadMap', 'Destroy', 'RegisterEnvironmentData', 'SetEnvironmentData',\n"
|
||||||
|
" 'GetCurrentMapName', 'GetPickingPoint', 'BeginEnvironment', 'EndEnvironment',\n"
|
||||||
|
" 'SetCharacterDirLight', 'SetBackgroundDirLight', 'Initialize', 'Update',\n"
|
||||||
|
" 'Render', 'RenderPCBlocker', 'RenderCollision', 'RenderSky', 'RenderCloud',\n"
|
||||||
|
" 'RenderWater', 'RenderEffect', 'RenderBeforeLensFlare', 'RenderAfterLensFlare',\n"
|
||||||
|
" 'RenderCharacterShadowToTexture', 'RenderDungeon', 'GetHeight', 'isAttrOn',\n"
|
||||||
|
" 'IsAttrOn', 'SetShadowLevel', 'IsVisiblePart', 'SetVisiblePart',\n"
|
||||||
|
" 'GetShadowMapColor', 'SetSplatLimit', 'GetRenderedSplatNum',\n"
|
||||||
|
" 'GetRenderedGraphicThingInstanceNum', 'SelectViewDistanceNum',\n"
|
||||||
|
" 'SetViewDistanceSet', 'GetFarClip', 'GetDistanceSetInfo', 'SetBGLoading',\n"
|
||||||
|
" 'SetRenderSort', 'SetTransparentTree', 'SetXMasTree', 'RegisterDungeonMapName',\n"
|
||||||
|
" 'VisibleGuildArea', 'DisableGuildArea', 'WarpTest', 'CreatePrivateShopPos',\n"
|
||||||
|
" 'DeletePrivateShopPos')\n"
|
||||||
|
"funcs = sorted(n for n in dir(bg) if callable(getattr(bg, n)))\n"
|
||||||
|
"assert funcs == sorted(bg_names), set(funcs) ^ set(bg_names)\n"
|
||||||
|
"\n"
|
||||||
|
"assert (bg.PART_TERRAIN, bg.PART_OBJECT, bg.PART_CLOUD, bg.PART_WATER, bg.PART_TREE, bg.PART_SKY, bg.PART_SHOP) == (0, 1, 2, 3, 4, 5, 6)\n"
|
||||||
|
"assert (bg.SKY_RENDER_MODE_DEFAULT, bg.SKY_RENDER_MODE_DIFFUSE, bg.SKY_RENDER_MODE_TEXTURE, bg.SKY_RENDER_MODE_MODULATE, bg.SKY_RENDER_MODE_MODULATE2X, bg.SKY_RENDER_MODE_MODULATE4X) == (0, 1, 2, 3, 4, 5)\n"
|
||||||
|
"assert (bg.SHADOW_NONE, bg.SHADOW_GROUND, bg.SHADOW_GROUND_AND_SOLO, bg.SHADOW_ALL, bg.SHADOW_ALL_HIGH, bg.SHADOW_ALL_MAX) == (0, 1, 2, 3, 4, 5)\n"
|
||||||
|
"assert (bg.DISTANCE0, bg.DISTANCE1, bg.DISTANCE2, bg.DISTANCE3, bg.DISTANCE4) == (0, 1, 2, 3, 4)\n"
|
||||||
|
"assert (bg.DISTANCE_SORT, bg.TEXTURE_SORT) == (0, 1)\n"
|
||||||
|
"assert (bg.ATTR_BLOCK, bg.ATTR_WATER, bg.ATTR_BANPK) == (1, 2, 4)\n"
|
||||||
|
"assert (bg.ATTRIBUTE_BLOCK, bg.ATTRIBUTE_WATER, bg.ATTRIBUTE_BANPK) == (1, 2, 4)\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
std::cout << "[TEST] Running block 2 (basic calls & state)..." << std::endl;
|
||||||
|
python.execute(
|
||||||
|
"import background as bg\n"
|
||||||
|
"assert bg.GetCurrentMapName() == ''\n"
|
||||||
|
"assert bg.GetHeight(0.0, 0.0) == 0.0\n"
|
||||||
|
"assert bg.isAttrOn(0.0, 0.0, bg.ATTR_BLOCK) == 0\n"
|
||||||
|
"assert bg.IsAttrOn(0, 0, bg.ATTR_BLOCK) == 0\n"
|
||||||
|
"assert bg.GetFarClip() > 0.0\n"
|
||||||
|
"assert bg.IsSoftwareTiling() in (0, 1)\n"
|
||||||
|
"bg.EnableSoftwareTiling(1)\n"
|
||||||
|
"bg.EnableSnow(1)\n"
|
||||||
|
"bg.EnableSnow(0)\n"
|
||||||
|
"bg.SetShadowLevel(bg.SHADOW_ALL)\n"
|
||||||
|
"assert bg.IsVisiblePart(bg.PART_TERRAIN) == 1\n"
|
||||||
|
"bg.SetVisiblePart(bg.PART_TERRAIN, 0)\n"
|
||||||
|
"assert bg.IsVisiblePart(bg.PART_TERRAIN) == 0\n"
|
||||||
|
"bg.SetVisiblePart(bg.PART_TERRAIN, 1)\n"
|
||||||
|
"assert bg.IsVisiblePart(bg.PART_TERRAIN) == 1\n"
|
||||||
|
"bg.SetSplatLimit(100)\n"
|
||||||
|
"splat_info = bg.GetRenderedSplatNum()\n"
|
||||||
|
"assert len(splat_info) == 4\n"
|
||||||
|
"assert bg.GetRenderedGraphicThingInstanceNum() == (0, 0)\n"
|
||||||
|
"bg.SelectViewDistanceNum(0)\n"
|
||||||
|
"bg.SetViewDistanceSet(0, 25000.0)\n"
|
||||||
|
"dist_info = bg.GetDistanceSetInfo()\n"
|
||||||
|
"assert len(dist_info) == 4\n"
|
||||||
|
"bg.SetBGLoading(True)\n"
|
||||||
|
"bg.SetRenderSort(bg.DISTANCE_SORT)\n"
|
||||||
|
"bg.SetTransparentTree(True)\n"
|
||||||
|
"bg.SetXMasTree(1)\n"
|
||||||
|
"bg.RegisterDungeonMapName('dungeon_map')\n"
|
||||||
|
"bg.VisibleGuildArea()\n"
|
||||||
|
"bg.DisableGuildArea()\n"
|
||||||
|
"bg.CreatePrivateShopPos(1234)\n"
|
||||||
|
"bg.DeletePrivateShopPos()\n"
|
||||||
|
"bg.TextureChange('some_texture.dds')\n"
|
||||||
|
"assert isinstance(bg.GetRenderShadowTime(), int)\n"
|
||||||
|
"assert len(bg.GetPickingPoint()) == 3\n"
|
||||||
|
"bg.BeginEnvironment()\n"
|
||||||
|
"bg.SetCharacterDirLight()\n"
|
||||||
|
"bg.SetBackgroundDirLight()\n"
|
||||||
|
"bg.EndEnvironment()\n"
|
||||||
|
"bg.Update(0.0, 0.0, 0.0)\n"
|
||||||
|
"bg.Render()\n"
|
||||||
|
"bg.RenderPCBlocker()\n"
|
||||||
|
"bg.RenderCollision()\n"
|
||||||
|
"bg.RenderSky()\n"
|
||||||
|
"bg.RenderCloud()\n"
|
||||||
|
"bg.RenderWater()\n"
|
||||||
|
"bg.RenderEffect()\n"
|
||||||
|
"bg.RenderBeforeLensFlare()\n"
|
||||||
|
"bg.RenderAfterLensFlare()\n"
|
||||||
|
"bg.RenderCharacterShadowToTexture()\n"
|
||||||
|
"bg.RenderDungeon()\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
std::cout << "[TEST] Running block 3 (map coords & warp)..." << std::endl;
|
||||||
|
python.execute(
|
||||||
|
"import background as bg\n"
|
||||||
|
"map_info = bg.GlobalPositionToMapInfo(102400, 204800)\n"
|
||||||
|
"assert map_info == ('test_bg_map', 102400, 204800), map_info\n"
|
||||||
|
"assert bg.GlobalPositionToMapInfo(10, 10) == ('', 0, 0)\n"
|
||||||
|
"\n"
|
||||||
|
"bg.WarpTest(1024, 2048)\n"
|
||||||
|
"assert bg.GetCurrentMapName() == 'test_bg_map', bg.GetCurrentMapName()\n"
|
||||||
|
"assert bg.GlobalPositionToLocalPosition(102400 + 400, 204800 + 600) == (400, 600)\n"
|
||||||
|
"assert bg.GetHeight(0.0, 0.0) == 100.0, bg.GetHeight(0.0, 0.0)\n"
|
||||||
|
"assert bg.isAttrOn(0.0, 0.0, bg.ATTR_BLOCK) == 1\n"
|
||||||
|
"assert bg.IsAttrOn(0, 0, bg.ATTR_BLOCK) == 1\n"
|
||||||
|
"\n"
|
||||||
|
"bg.Destroy()\n"
|
||||||
|
"assert bg.GetCurrentMapName() == ''\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
std::cout << "[TEST] Running block 4 (app camera bindings)..." << std::endl;
|
||||||
|
python.execute(
|
||||||
|
"import app\n"
|
||||||
|
"assert app.DEGREE_DIRECTION_SAME == 0\n"
|
||||||
|
"assert app.DEGREE_DIRECTION_RIGHT == 1\n"
|
||||||
|
"assert app.DEGREE_DIRECTION_LEFT == 2\n"
|
||||||
|
"assert app.CAMERA_TO_POSITIVE == 1\n"
|
||||||
|
"assert app.CAMERA_TO_NEGATIVE == -1\n"
|
||||||
|
"assert app.CAMERA_STOP == 0\n"
|
||||||
|
"\n"
|
||||||
|
"app.SetCamera(1200.0, 15.0, 90.0, 45.0)\n"
|
||||||
|
"cam = app.GetCamera()\n"
|
||||||
|
"assert cam == (1200.0, 15.0, 90.0, 45.0), cam\n"
|
||||||
|
"assert app.GetCameraPitch() == 15.0\n"
|
||||||
|
"assert app.GetCameraRotation() == 90.0\n"
|
||||||
|
"\n"
|
||||||
|
"app.RotateCamera(app.CAMERA_TO_POSITIVE)\n"
|
||||||
|
"app.PitchCamera(app.CAMERA_TO_POSITIVE)\n"
|
||||||
|
"app.ZoomCamera(app.CAMERA_TO_POSITIVE)\n"
|
||||||
|
"app.MovieRotateCamera(1)\n"
|
||||||
|
"app.MoviePitchCamera(1)\n"
|
||||||
|
"app.MovieZoomCamera(1)\n"
|
||||||
|
"app.MovieResetCamera()\n"
|
||||||
|
"app.SetCameraSpeed(150)\n"
|
||||||
|
"app.SetCameraMaxDistance(4000.0)\n"
|
||||||
|
"app.SetDefaultCamera()\n"
|
||||||
|
"app.SetCameraSetting(0, 0, 100, 1200, 45, 20)\n"
|
||||||
|
"app.SaveCameraSetting('cam_test.txt')\n"
|
||||||
|
"app.LoadCameraSetting('cam_test.txt')\n"
|
||||||
|
"app.EnableSpecialCameraMode()\n"
|
||||||
|
"\n"
|
||||||
|
"assert app.GetRotatingDirection(0.0, 0.0) == app.DEGREE_DIRECTION_LEFT\n"
|
||||||
|
"assert app.GetRotatingDirection(20.0, 10.0) == app.DEGREE_DIRECTION_RIGHT\n"
|
||||||
|
"assert app.GetRotatingDirection(10.0, 20.0) == app.DEGREE_DIRECTION_LEFT\n"
|
||||||
|
"diff = app.GetDegreeDifference(10.0, 20.0)\n"
|
||||||
|
"assert isinstance(diff, float)\n"
|
||||||
|
"\n"
|
||||||
|
"cur_pos = app.GetCursorPosition()\n"
|
||||||
|
"assert len(cur_pos) == 2\n"
|
||||||
|
"\n"
|
||||||
|
"app.UpdateGame()\n"
|
||||||
|
"app.RenderGame()\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
std::cout << "AVA2 background parity passed" << std::endl;
|
||||||
|
return 0;
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
std::cerr << "background_test failed: " << e.what() << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,9 +25,12 @@ void tga(const std::filesystem::path& p) {Bytes b(18,0);b[2]=2;b[12]=64;b[14]=96
|
|||||||
int main(int argc,char** argv) {
|
int main(int argc,char** argv) {
|
||||||
if(argc!=3)return 2;
|
if(argc!=3)return 2;
|
||||||
auto root=std::filesystem::temp_directory_path()/std::filesystem::path("ava2-item-data-"+std::to_string(getpid()));std::filesystem::create_directories(root);
|
auto root=std::filesystem::temp_directory_path()/std::filesystem::path("ava2-item-data-"+std::to_string(getpid()));std::filesystem::create_directories(root);
|
||||||
|
auto orig_cwd = std::filesystem::current_path();
|
||||||
|
auto zip_path = std::filesystem::absolute(argv[1]);
|
||||||
|
std::filesystem::current_path(root);
|
||||||
try {
|
try {
|
||||||
{
|
{
|
||||||
PythonRuntime python(argv[1],root);python.execute("import item\n");
|
PythonRuntime python(zip_path, root);python.execute("import item\n");
|
||||||
python.execute(R"PY(for f in (item.GetItemName,item.GetItemDescription,item.GetItemSummary,item.GetItemSize,item.GetItemType,item.GetItemSubType,item.GetIconImage,item.GetIconImageFileName):
|
python.execute(R"PY(for f in (item.GetItemName,item.GetItemDescription,item.GetItemSummary,item.GetItemSize,item.GetItemType,item.GetItemSubType,item.GetIconImage,item.GetIconImageFileName):
|
||||||
try: f()
|
try: f()
|
||||||
except RuntimeError: pass
|
except RuntimeError: pass
|
||||||
@@ -52,6 +55,13 @@ assert item.SelectItemWiki(27003)==0
|
|||||||
textfile(root/"list","500\tignored\ticon/list2.tga\tmodel/new.gr2\n");require(LoadItemList("list"),"reload list failed");require(GetWeaponModelPathByVnum(500)=="model/new.gr2","explicit model path ignored");python.execute("assert item.GetItemType()==2 and item.GetItemName()=='Listed' and item.GetSocket(0)==0 and item.GetItemDescription()==''\n");
|
textfile(root/"list","500\tignored\ticon/list2.tga\tmodel/new.gr2\n");require(LoadItemList("list"),"reload list failed");require(GetWeaponModelPathByVnum(500)=="model/new.gr2","explicit model path ignored");python.execute("assert item.GetItemType()==2 and item.GetItemName()=='Listed' and item.GetSocket(0)==0 and item.GetItemDescription()==''\n");
|
||||||
ResetItemDatabase();require(!GetItemTypeAndSubType(500,&type,&sub),"database reset retained records");python.execute("assert item.SelectItemWiki(500)==0\n");
|
ResetItemDatabase();require(!GetItemTypeAndSubType(500,&type,&sub),"database reset retained records");python.execute("assert item.SelectItemWiki(500)==0\n");
|
||||||
}
|
}
|
||||||
std::filesystem::remove_all(root);std::cout<<"AVA2 item resource loading and selected data parity passed\n";
|
std::filesystem::current_path(orig_cwd);
|
||||||
}catch(const std::exception& e){std::filesystem::remove_all(root);std::cerr<<e.what()<<'\n';return 1;}
|
std::filesystem::remove_all(root);
|
||||||
|
std::cout<<"AVA2 item resource loading and selected data parity passed\n";
|
||||||
|
}catch(const std::exception& e){
|
||||||
|
std::filesystem::current_path(orig_cwd);
|
||||||
|
std::filesystem::remove_all(root);
|
||||||
|
std::cerr<<e.what()<<'\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -548,10 +548,10 @@ int main(int argc,char** argv) {
|
|||||||
"assert background.ATTR_WATER == 2\n"
|
"assert background.ATTR_WATER == 2\n"
|
||||||
"assert background.ATTR_BANPK == 4\n"
|
"assert background.ATTR_BANPK == 4\n"
|
||||||
"background.Initialize()\n"
|
"background.Initialize()\n"
|
||||||
"assert background.LoadMap('ava2_nonexistent_map_fixture',0.0,0.0,0.0) == 0\n"
|
"background.LoadMap('ava2_nonexistent_map_fixture',0.0,0.0,0.0)\n"
|
||||||
|
"assert background.GetCurrentMapName() == ''\n"
|
||||||
|
"background.LoadMap('metin2_map_a1',25600.0,76800.0,0.0)\n"
|
||||||
"assert background.GetCurrentMapName() == ''\n"
|
"assert background.GetCurrentMapName() == ''\n"
|
||||||
"map_loaded = background.LoadMap('metin2_map_a1',25600.0,76800.0,0.0)\n"
|
|
||||||
"assert background.GetCurrentMapName() == ('metin2_map_a1' if map_loaded else '')\n"
|
|
||||||
"bg_h = background.GetHeight(0.0, 0.0)\n"
|
"bg_h = background.GetHeight(0.0, 0.0)\n"
|
||||||
"bg_block = background.isAttrOn(0.0, 0.0, background.ATTR_BLOCK)\n"
|
"bg_block = background.isAttrOn(0.0, 0.0, background.ATTR_BLOCK)\n"
|
||||||
"print 'Python background verified: h =', bg_h, ', blocked =', bg_block\n"
|
"print 'Python background verified: h =', bg_h, ', blocked =', bg_block\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user