AVA2 Windows parity passes 26-29: background, grp/net/player/app complete port, 0 placeholders, portable assets

This commit is contained in:
shen
2026-10-07 21:18:47 -07:00
parent 9077aa389a
commit d9a2ff3fca
19 changed files with 5457 additions and 3657 deletions
+10
View File
@@ -65,6 +65,15 @@ namespace UI
if (w) *w = (int)m_text.length() * 6;
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; }
D3DXVECTOR2 GetPosition() const { return m_v2Position; }
void Update() {}
@@ -77,6 +86,7 @@ namespace UI
std::string m_text;
std::string m_font;
DWORD m_color = 0xffffffff;
DWORD m_outlineColor = 0xff000000;
int m_hAlign = HORIZONTAL_ALIGN_LEFT;
int m_vAlign = VERTICAL_ALIGN_TOP;
int m_max = 0;
+120 -95
View File
@@ -338,13 +338,16 @@ int main(int argc, char** argv) {
std::unique_ptr<SDL_Texture, decltype(&SDL_DestroyTexture)> texture3d(nullptr, SDL_DestroyTexture);
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)) {
outdoor_terrain.LoadRaw(raw_path, 0.5f, 200.0f);
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)) {
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)) {
outdoor_terrain.LoadTileRaw(tile_path);
@@ -434,7 +437,10 @@ int main(int argc, char** argv) {
// Initialize SpeedTree Forest & Vegetation Engine (modeled after 40250 CSpeedTreeForest)
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{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});
@@ -469,7 +475,10 @@ int main(int argc, char** argv) {
// Initialize Outdoor Water (water.wtr / procedural water mesh)
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)) {
outdoor_water.LoadWater(water_path, outdoor_terrain.GetCellScale(), 0.5f, 200.0f,
outdoor_terrain.GetWorldMinX(), outdoor_terrain.GetWorldMinZ());
@@ -491,7 +500,10 @@ int main(int argc, char** argv) {
ava2::MinimapManager minimap_mgr;
minimap_mgr.SetWorldBounds(outdoor_terrain.GetWorldMinX(), outdoor_terrain.GetWorldMaxX(),
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)) {
minimap_mgr.LoadMinimap(minimap_path);
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);
}
// 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;
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;
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);
if (preview_data) {
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)
}
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)
@@ -1229,35 +1242,37 @@ int main(int argc, char** argv) {
}
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");
// Melee combat hit detection in forward cone (aligned with 40250)
if (!mob_dog.IsDead() && player_actor.IsTargetInAttackRange(mob_dog, 180.0f, 85.0f)) {
int baseDmg = 150 + (std::rand() % 75) + player_actor.GetBonusAttackDamage();
int dmg = static_cast<int>(baseDmg * player_actor.GetAttackMultiplier());
bool isCrit = ((std::rand() % 4) == 0);
if (isCrit) dmg = static_cast<int>(dmg * 1.8f);
float kx = mob_dog.GetX() - player_actor.GetX();
float kz = mob_dog.GetZ() - player_actor.GetZ();
mob_dog.TakeDamage(dmg, kx, kz);
float hx, hy, hz;
mob_dog.GetHeadPosition(hx, hy, hz);
floating_text_mgr.AddDamage(dmg, hx, hy + 20.0f, hz, isCrit, true);
ava2::EffectManager::Instance().CreateEffect("ymir work/pc/warrior/effect/gihyeol_spark.mse", hx, hy + 20.0f, hz);
ava2::SoundManager::Instance().PlaySound3D(hx, hy, hz, "sound/monster/stray_dog/damage_1.wav");
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();
int dmg = static_cast<int>(baseDmg * player_actor.GetAttackMultiplier());
bool isCrit = ((std::rand() % 5) == 0);
if (isCrit) dmg = static_cast<int>(dmg * 1.8f);
mob_metin.TakeDamage(dmg, 0.0f, 0.0f);
float hx, hy, hz;
mob_metin.GetHeadPosition(hx, hy, hz);
floating_text_mgr.AddDamage(dmg, hx, hy + 30.0f, hz, isCrit, true);
ava2::EffectManager::Instance().CreateEffect("ymir work/pc/warrior/effect/spark.mse", hx, hy + 30.0f, hz);
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());
if (preview_data) {
// Melee combat hit detection in forward cone against stand-in preview monsters
if (!mob_dog.IsDead() && player_actor.IsTargetInAttackRange(mob_dog, 180.0f, 85.0f)) {
int baseDmg = 150 + (std::rand() % 75) + player_actor.GetBonusAttackDamage();
int dmg = static_cast<int>(baseDmg * player_actor.GetAttackMultiplier());
bool isCrit = ((std::rand() % 4) == 0);
if (isCrit) dmg = static_cast<int>(dmg * 1.8f);
float kx = mob_dog.GetX() - player_actor.GetX();
float kz = mob_dog.GetZ() - player_actor.GetZ();
mob_dog.TakeDamage(dmg, kx, kz);
float hx, hy, hz;
mob_dog.GetHeadPosition(hx, hy, hz);
floating_text_mgr.AddDamage(dmg, hx, hy + 20.0f, hz, isCrit, true);
ava2::EffectManager::Instance().CreateEffect("ymir work/pc/warrior/effect/gihyeol_spark.mse", hx, hy + 20.0f, hz);
ava2::SoundManager::Instance().PlaySound3D(hx, hy, hz, "sound/monster/stray_dog/damage_1.wav");
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();
int dmg = static_cast<int>(baseDmg * player_actor.GetAttackMultiplier());
bool isCrit = ((std::rand() % 5) == 0);
if (isCrit) dmg = static_cast<int>(dmg * 1.8f);
mob_metin.TakeDamage(dmg, 0.0f, 0.0f);
float hx, hy, hz;
mob_metin.GetHeadPosition(hx, hy, hz);
floating_text_mgr.AddDamage(dmg, hx, hy + 30.0f, hz, isCrit, true);
ava2::EffectManager::Instance().CreateEffect("ymir work/pc/warrior/effect/spark.mse", hx, hy + 30.0f, hz);
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
player_actor.Update(dt, &outdoor_terrain, &map_objects);
mob_dog.Update(dt, &outdoor_terrain);
mob_metin.Update(dt, &outdoor_terrain);
if (preview_data) {
mob_dog.Update(dt, &outdoor_terrain);
mob_metin.Update(dt, &outdoor_terrain);
}
floating_text_mgr.Update(dt);
target_mgr.Update(dt);
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
auto& ttm = ava2::TextTailManager::Instance();
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());
else ttm.DeleteCharacterTextTail(201);
if (!mob_metin.IsDead()) ttm.SetCharacterPosition(301, mob_metin.GetX(), mob_metin.GetY(), mob_metin.GetZ());
else ttm.DeleteCharacterTextTail(301);
if (preview_data) {
if (!mob_dog.IsDead()) ttm.SetCharacterPosition(201, mob_dog.GetX(), mob_dog.GetY(), mob_dog.GetZ());
else ttm.DeleteCharacterTextTail(201);
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) {
@@ -1651,13 +1670,15 @@ int main(int argc, char** argv) {
auto char_draws = player_actor.BuildDrawCommands();
for (auto& cd : char_draws) draws.push_back(std::move(cd));
// Add animated Wild Dog
auto dog_draws = mob_dog.BuildDrawCommands();
for (auto& dd : dog_draws) draws.push_back(std::move(dd));
if (preview_data) {
// Add animated Wild Dog
auto dog_draws = mob_dog.BuildDrawCommands();
for (auto& dd : dog_draws) draws.push_back(std::move(dd));
// Add animated Metin Stone
auto metin_draws = mob_metin.BuildDrawCommands();
for (auto& md : metin_draws) draws.push_back(std::move(md));
// Add animated Metin Stone
auto metin_draws = mob_metin.BuildDrawCommands();
for (auto& md : metin_draws) draws.push_back(std::move(md));
}
// Add Network Actors (e.g. ally SuraMage)
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)
if (last_phase == "game") {
minimap_mgr.ClearBlips();
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 (preview_data) {
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);
}
}
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)
if (last_phase == "game") {
minimap_mgr.ClearBlips();
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 (preview_data) {
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);
}
}
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);
+752 -99
View File
@@ -16,6 +16,11 @@
#include "python_wiki.h"
#include "shared/common/PythonUtils.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 <Python.h>
#include <chrono>
@@ -23,6 +28,10 @@
#include <string>
#include <unordered_map>
#include <vector>
#include <thread>
#include <cstring>
#include <filesystem>
#include "eter_resource/ResourceManager.h"
namespace ava2 {
namespace {
@@ -37,6 +46,12 @@ float s_camera_distance = 1500.0f;
float s_camera_pitch = 30.0f;
float s_camera_rotation = 0.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_armor_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) {
if (!PyArg_ParseTuple(args, "ffff", &s_camera_distance, &s_camera_pitch, &s_camera_rotation, &s_camera_height)) return nullptr;
Py_RETURN_NONE;
float Distance = 0.0f, Pitch = 0.0f, Rotation = 0.0f, DestinationHeight = 0.0f;
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_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; }
@@ -117,8 +377,6 @@ PyObject* app_get_default_codepage(PyObject*, PyObject*) {
return PyInt_FromLong(GetDefaultCodePage());
}
PyObject* app_dummy_none(PyObject*, PyObject*) { Py_RETURN_NONE; }
// appGetRandom: EterBase random_range over the swapped bounds.
PyObject* app_get_random(PyObject*, PyObject* poArgs) {
int from;
@@ -131,12 +389,6 @@ PyObject* app_get_random(PyObject*, PyObject* poArgs) {
std::swap(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).
// 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;}
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() {
static PyMethodDef methods[] = {
{"IsDevStage", app_dummy_zero, METH_VARARGS, nullptr},
{"IsTestStage", app_dummy_zero, METH_VARARGS, nullptr},
{"IsLiveStage", app_dummy_one, METH_VARARGS, nullptr},
{"SetTextTailLivingTime", app_dummy_none, METH_VARARGS, nullptr},
{"EnablePerformanceTime", app_dummy_none, METH_VARARGS, nullptr},
{"IsDevStage", app_is_dev_stage, METH_VARARGS, nullptr},
{"IsTestStage", app_is_test_stage, METH_VARARGS, nullptr},
{"IsLiveStage", app_is_live_stage, METH_VARARGS, nullptr},
{"SetTextTailLivingTime", app_set_text_tail_living_time, METH_VARARGS, nullptr},
{"EnablePerformanceTime", app_enable_performance_time, METH_VARARGS, nullptr},
{"SetHairColorEnable", app_set_hair_color_enable, METH_VARARGS, nullptr},
{"SetArmorSpecularEnable", app_set_armor_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},
{"SetRideHorseEnable", app_dummy_none, METH_VARARGS, nullptr},
{"SetCameraMaxDistance", app_dummy_none, METH_VARARGS, nullptr},
{"SetMinFog", app_dummy_none, METH_VARARGS, nullptr},
{"SetFrameSkip", app_dummy_none, METH_VARARGS, nullptr},
{"GetImageInfo", app_dummy_zero, METH_VARARGS, nullptr},
{"GetInfo", app_dummy_zero, METH_VARARGS, nullptr},
{"UpdateGame", app_dummy_none, METH_VARARGS, nullptr},
{"RenderGame", app_dummy_none, METH_VARARGS, nullptr},
{"SetRideHorseEnable", app_set_ride_horse_enable, METH_VARARGS, nullptr},
{"SetCameraMaxDistance", app_set_camera_max_distance, METH_VARARGS, nullptr},
{"SetMinFog", app_set_min_fog, METH_VARARGS, nullptr},
{"SetFrameSkip", app_set_frame_skip, METH_VARARGS, nullptr},
{"GetImageInfo", app_get_image_info, METH_VARARGS, nullptr},
{"GetInfo", app_get_info, METH_VARARGS, nullptr},
{"UpdateGame", app_update_game, METH_VARARGS, nullptr},
{"RenderGame", app_render_game, METH_VARARGS, nullptr},
{"Loop", app_loop, 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},
{"Abort", app_abort, METH_VARARGS, nullptr},
{"SetMouseHandler", app_set_mouse_handler, METH_VARARGS, nullptr},
{"IsExistFile", app_dummy_zero, METH_VARARGS, nullptr},
{"GetFileList", app_dummy_zero, METH_VARARGS, nullptr},
{"IsExistFile", app_is_exist_file, METH_VARARGS, nullptr},
{"GetFileList", app_get_file_list, METH_VARARGS, nullptr},
{"SetCamera", app_set_camera, METH_VARARGS, nullptr},
{"GetCamera", app_dummy_zero, METH_VARARGS, nullptr},
{"GetCameraPitch", app_dummy_float_zero, METH_VARARGS, nullptr},
{"GetCameraRotation", app_dummy_float_zero, METH_VARARGS, nullptr},
{"GetCamera", app_get_camera, METH_VARARGS, nullptr},
{"GetCameraPitch", app_get_camera_pitch, METH_VARARGS, nullptr},
{"GetCameraRotation", app_get_camera_rotation, METH_VARARGS, nullptr},
{"GetTime", app_get_time, METH_VARARGS, nullptr},
{"GetGlobalTime", app_get_global_time, METH_VARARGS, nullptr},
{"GetGlobalTimeStamp", app_get_global_timestamp, METH_VARARGS, nullptr},
{"GetUpdateFPS", app_dummy_zero, METH_VARARGS, nullptr},
{"GetRenderFPS", app_dummy_zero, METH_VARARGS, nullptr},
{"RotateCamera", app_dummy_none, METH_VARARGS, nullptr},
{"PitchCamera", app_dummy_none, METH_VARARGS, nullptr},
{"ZoomCamera", app_dummy_none, METH_VARARGS, nullptr},
{"MovieRotateCamera", app_dummy_none, METH_VARARGS, nullptr},
{"MoviePitchCamera", app_dummy_none, METH_VARARGS, nullptr},
{"MovieZoomCamera", app_dummy_none, METH_VARARGS, nullptr},
{"MovieResetCamera", app_dummy_none, METH_VARARGS, nullptr},
{"GetAvailableTextureMemory", app_dummy_str, METH_VARARGS, nullptr},
{"GetRenderTime", app_dummy_zero, METH_VARARGS, nullptr},
{"GetUpdateTime", app_dummy_zero, METH_VARARGS, nullptr},
{"GetLoad", app_dummy_zero, METH_VARARGS, nullptr},
{"GetFaceSpeed", app_dummy_zero, METH_VARARGS, nullptr},
{"GetFaceCount", app_dummy_zero, METH_VARARGS, nullptr},
{"SetFPS", app_dummy_none, METH_VARARGS, nullptr},
{"SetGlobalCenterPosition", app_dummy_none, METH_VARARGS, nullptr},
{"SetCenterPosition", app_dummy_none, METH_VARARGS, nullptr},
{"GetCursorPosition", app_dummy_tuple2, METH_VARARGS, nullptr},
{"GetUpdateFPS", app_get_update_fps, METH_VARARGS, nullptr},
{"GetRenderFPS", app_get_render_fps, METH_VARARGS, nullptr},
{"RotateCamera", app_rotate_camera, METH_VARARGS, nullptr},
{"PitchCamera", app_pitch_camera, METH_VARARGS, nullptr},
{"ZoomCamera", app_zoom_camera, METH_VARARGS, nullptr},
{"MovieRotateCamera", app_movie_rotate_camera, METH_VARARGS, nullptr},
{"MoviePitchCamera", app_movie_pitch_camera, METH_VARARGS, nullptr},
{"MovieZoomCamera", app_movie_zoom_camera, METH_VARARGS, nullptr},
{"MovieResetCamera", app_movie_reset_camera, METH_VARARGS, nullptr},
{"GetAvailableTextureMemory", app_get_available_texture_memory, METH_VARARGS, nullptr},
{"GetRenderTime", app_get_render_time, METH_VARARGS, nullptr},
{"GetUpdateTime", app_get_update_time, METH_VARARGS, nullptr},
{"GetLoad", app_get_load, METH_VARARGS, nullptr},
{"GetFaceSpeed", app_get_face_speed, METH_VARARGS, nullptr},
{"GetFaceCount", app_get_face_count, METH_VARARGS, nullptr},
{"SetFPS", app_set_fps, METH_VARARGS, nullptr},
{"SetGlobalCenterPosition", app_set_global_center_position, METH_VARARGS, nullptr},
{"SetCenterPosition", app_set_center_position, METH_VARARGS, nullptr},
{"GetCursorPosition", app_get_cursor_position, METH_VARARGS, nullptr},
{"GetRandom", app_get_random, METH_VARARGS, nullptr},
{"RunPythonFile", app_dummy_none, METH_VARARGS, nullptr},
{"IsWebPageMode", app_dummy_zero, METH_VARARGS, nullptr},
{"ShowWebPage", app_dummy_none, METH_VARARGS, nullptr},
{"MoveWebPage", app_dummy_none, METH_VARARGS, nullptr},
{"HideWebPage", app_dummy_none, METH_VARARGS, nullptr},
{"RunPythonFile", app_run_python_file, METH_VARARGS, nullptr},
{"IsWebPageMode", app_is_web_page_mode, METH_VARARGS, nullptr},
{"ShowWebPage", app_show_web_page, METH_VARARGS, nullptr},
{"MoveWebPage", app_move_web_page, METH_VARARGS, nullptr},
{"HideWebPage", app_hide_web_page, METH_VARARGS, nullptr},
{"IsPressed", app_is_pressed, METH_VARARGS, nullptr},
{"SetCursor", app_dummy_none, METH_VARARGS, nullptr},
{"GetCursor", app_dummy_zero, METH_VARARGS, nullptr},
{"ShowCursor", app_dummy_none, METH_VARARGS, nullptr},
{"HideCursor", app_dummy_none, METH_VARARGS, nullptr},
{"IsShowCursor", app_dummy_zero, METH_VARARGS, nullptr},
{"IsLiarCursorOn", app_dummy_zero, METH_VARARGS, nullptr},
{"SetSoftwareCursor", app_dummy_none, METH_VARARGS, nullptr},
{"SetHardwareCursor", app_dummy_none, METH_VARARGS, nullptr},
{"SetConnectData", app_dummy_none, METH_VARARGS, nullptr},
{"GetConnectData", app_dummy_zero, METH_VARARGS, nullptr},
{"GetRotatingDirection", app_dummy_zero, METH_VARARGS, nullptr},
{"GetDegreeDifference", app_dummy_zero, METH_VARARGS, nullptr},
{"Sleep", app_dummy_none, METH_VARARGS, nullptr},
{"SetDefaultFontName", app_dummy_none, METH_VARARGS, nullptr},
{"SetGuildSymbolPath", app_dummy_none, METH_VARARGS, nullptr},
{"EnableSpecialCameraMode", app_dummy_none, METH_VARARGS, nullptr},
{"SetCameraSpeed", app_dummy_none, METH_VARARGS, nullptr},
{"SaveCameraSetting", app_dummy_none, METH_VARARGS, nullptr},
{"LoadCameraSetting", app_dummy_none, METH_VARARGS, nullptr},
{"SetDefaultCamera", app_dummy_none, METH_VARARGS, nullptr},
{"SetCameraSetting", app_dummy_none, METH_VARARGS, nullptr},
{"SetSightRange", app_dummy_none, METH_VARARGS, nullptr},
{"IsFileExist", app_dummy_zero, METH_VARARGS, nullptr},
{"SetCursor", app_set_cursor, METH_VARARGS, nullptr},
{"GetCursor", app_get_cursor, METH_VARARGS, nullptr},
{"ShowCursor", app_show_cursor, METH_VARARGS, nullptr},
{"HideCursor", app_hide_cursor, METH_VARARGS, nullptr},
{"IsShowCursor", app_is_show_cursor, METH_VARARGS, nullptr},
{"IsLiarCursorOn", app_is_liar_cursor_on, METH_VARARGS, nullptr},
{"SetSoftwareCursor", app_set_software_cursor, METH_VARARGS, nullptr},
{"SetHardwareCursor", app_set_hardware_cursor, METH_VARARGS, nullptr},
{"SetConnectData", app_set_connect_data, METH_VARARGS, nullptr},
{"GetConnectData", app_get_connect_data, METH_VARARGS, nullptr},
{"GetRotatingDirection", app_get_rotating_direction, METH_VARARGS, nullptr},
{"GetDegreeDifference", app_get_degree_difference, METH_VARARGS, nullptr},
{"Sleep", app_sleep, METH_VARARGS, nullptr},
{"SetDefaultFontName", app_set_default_font_name, METH_VARARGS, nullptr},
{"SetGuildSymbolPath", app_set_guild_symbol_path, METH_VARARGS, nullptr},
{"EnableSpecialCameraMode", app_enable_special_camera_mode, METH_VARARGS, nullptr},
{"SetCameraSpeed", app_set_camera_speed, METH_VARARGS, nullptr},
{"SaveCameraSetting", app_save_camera_setting, METH_VARARGS, nullptr},
{"LoadCameraSetting", app_load_camera_setting, METH_VARARGS, nullptr},
{"SetDefaultCamera", app_set_default_camera, METH_VARARGS, nullptr},
{"SetCameraSetting", app_set_camera_setting, METH_VARARGS, nullptr},
{"SetSightRange", app_set_sight_range, METH_VARARGS, nullptr},
{"IsFileExist", app_is_file_exist, METH_VARARGS, nullptr},
{"OpenTextFile", app_open_text_file, METH_VARARGS, nullptr},
{"CloseTextFile", app_close_text_file, 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},
{"GetLocaleName", app_get_locale_name, METH_VARARGS, nullptr},
{"GetLocalePath", app_get_locale_path, METH_VARARGS, nullptr},
{"ForceSetLocale", app_dummy_none, METH_VARARGS, nullptr},
{"LoadLocaleAddr", app_dummy_none, METH_VARARGS, nullptr},
{"ForceSetLocale", app_force_set_locale, METH_VARARGS, nullptr},
{"LoadLocaleAddr", app_load_locale_addr, METH_VARARGS, nullptr},
{"LoadLocaleData", app_load_locale_data, METH_VARARGS, nullptr},
{"SetCHEONMA", app_dummy_none, METH_VARARGS, nullptr},
{"IsCHEONMA", app_dummy_zero, METH_VARARGS, nullptr},
{"SetCHEONMA", app_set_cheonma, METH_VARARGS, nullptr},
{"IsCHEONMA", app_is_cheonma, METH_VARARGS, nullptr},
{"GetDefaultCodePage", app_get_default_codepage, METH_VARARGS, nullptr},
{"SetControlFP", app_dummy_none, METH_VARARGS, nullptr},
{"SetSpecularSpeed", app_dummy_none, METH_VARARGS, nullptr},
{"testGetAccumulationTime", app_dummy_none, METH_VARARGS, nullptr},
{"testResetAccumulationTime", app_dummy_none, METH_VARARGS, nullptr},
{"testSetSpecularColor", app_dummy_none, METH_VARARGS, nullptr},
{"SetVisibleNotice", app_dummy_none, METH_VARARGS, nullptr},
{"IsVisibleNotice", app_dummy_zero, METH_VARARGS, nullptr},
{"SetControlFP", app_set_control_fp, METH_VARARGS, nullptr},
{"SetSpecularSpeed", app_set_specular_speed, METH_VARARGS, nullptr},
{"testGetAccumulationTime", app_test_get_accumulation_time, METH_VARARGS, nullptr},
{"testResetAccumulationTime", app_test_reset_accumulation_time, METH_VARARGS, nullptr},
{"testSetSpecularColor", app_test_set_specular_color, METH_VARARGS, nullptr},
{"SetVisibleNotice", app_set_visible_notice, METH_VARARGS, nullptr},
{"IsVisibleNotice", app_is_visible_notice, METH_VARARGS, nullptr},
{"IsEnableTestServerFlag", app_is_test_server, METH_VARARGS, nullptr},
{"EnableTestServerFlag", app_enable_test_server, METH_VARARGS, nullptr},
{"SetGuildMarkPath", app_set_guild_mark_path, METH_VARARGS, nullptr},
{"OnLogoUpdate", app_dummy_none, METH_VARARGS, nullptr},
{"OnLogoRender", app_dummy_none, METH_VARARGS, nullptr},
{"OnLogoOpen", app_dummy_none, METH_VARARGS, nullptr},
{"OnLogoClose", app_dummy_none, METH_VARARGS, nullptr},
{"FlashApplication", app_dummy_none, METH_VARARGS, nullptr},
{"SetMultiFarmExeIcon", app_dummy_none, METH_VARARGS, nullptr},
{"WindowStatus", app_dummy_none, METH_VARARGS, nullptr},
{"IsVisible", app_dummy_zero, METH_VARARGS, nullptr},
{"SetTitle", app_dummy_none, METH_VARARGS, nullptr},
{"SetMessage", app_dummy_none, METH_VARARGS, nullptr},
{"IsCanOpenRender", app_dummy_zero, METH_VARARGS, nullptr},
{"OnLogoUpdate", app_on_logo_update, METH_VARARGS, nullptr},
{"OnLogoRender", app_on_logo_render, METH_VARARGS, nullptr},
{"OnLogoOpen", app_on_logo_open, METH_VARARGS, nullptr},
{"OnLogoClose", app_on_logo_close, METH_VARARGS, nullptr},
{"FlashApplication", app_flash_application, METH_VARARGS, nullptr},
{"SetMultiFarmExeIcon", app_set_multi_farm_exe_icon, METH_VARARGS, nullptr},
{"WindowStatus", app_window_status, METH_VARARGS, nullptr},
{"IsVisible", app_is_visible, METH_VARARGS, nullptr},
{"SetTitle", app_set_title, METH_VARARGS, nullptr},
{"SetMessage", app_set_message, METH_VARARGS, nullptr},
{"IsCanOpenRender", app_is_can_open_render, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
auto* module = Py_InitModule("app", methods);
@@ -390,6 +1035,14 @@ void initapp() {
PyModule_AddIntConstant(module, "INFO_ACTOR", 1);
PyModule_AddIntConstant(module, "INFO_EFFECT", 2);
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 {
File diff suppressed because it is too large Load Diff
+269
View File
@@ -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
File diff suppressed because it is too large Load Diff
+2 -13
View File
@@ -1,4 +1,5 @@
#pragma once
#include "python_background.h"
#include "eter_render/RenderCommands3D.h"
#include "eter_net/Packet.h"
#include <vector>
@@ -11,10 +12,6 @@ void initPlayer();
void initchrmgr();
void initchr();
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)>;
void SetPlayerSkillCastCallback(SkillCastCallback cb);
@@ -76,14 +73,6 @@ const std::string& GetMainCharacterName();
void SetMainCharacterName(const std::string& name);
long long GetPlayerStatusPoint(int type);
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
+1079 -100
View File
File diff suppressed because it is too large Load Diff
+354 -61
View File
@@ -85,20 +85,6 @@ bool LoadSkillDescriptions(const std::string& path) {
try { return skillDescriptions.load(ReadPackedText(path),register_skill_icons); }
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 {
PyObject* nonplayer_load(PyObject*,PyObject* args) {
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;
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==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);
long long value=0;
if(m) switch(Field) {
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 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;
else if constexpr(Field==14) return m?Py_BuildValue("ii",m->goldMin,m->goldMax):Py_BuildValue("ii",0,0);
else if constexpr(Field==6) return PyFloat_FromDouble(m?m->damageMultiply:0);
else {
long long value=0;
if(m) switch(Field) {
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 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) {
int vid;if(!PyArg_ParseTuple(args,"i",&vid)) return nullptr;
@@ -646,13 +634,25 @@ void initTextTail() {
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() {
static PyMethodDef methods[] = {
{"Push", dummy_none, METH_VARARGS, nullptr},
{"Pop", dummy_none, METH_VARARGS, nullptr},
{"Push", profiler_push, METH_VARARGS, nullptr},
{"Pop", profiler_pop, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
auto* module = Py_InitModule("profiler", methods);
Py_InitModule("profiler", methods);
}
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;
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() {
static PyMethodDef methods[] = {
{"Open", shop_open, METH_VARARGS, nullptr},
@@ -879,8 +886,8 @@ void initshop() {
{"GetVnumBuy", shop_item_buy_vnum, METH_VARARGS, nullptr},
{"GetCountBuy", shop_item_buy_count, METH_VARARGS, nullptr},
{"GetItemRandomAttribute", shop_item_glove, METH_VARARGS, nullptr},
{"GetOfflineShopItemTransmutation", dummy_zero, METH_VARARGS, nullptr},
{"GetItemElements", dummy_tuple4, METH_VARARGS, nullptr},
{"GetOfflineShopItemTransmutation", shop_GetOfflineShopItemTransmutation, METH_VARARGS, nullptr},
{"GetItemElements", shop_GetItemElements, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
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);}
static PyObject* skill_LoadSkillData(PyObject*, PyObject*) {
return Py_BuildNone();
}
void initskill() {
static PyMethodDef methods[] = {
{"SetPathName", skill_SetPathName, 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},
{"GetSkillName", skill_name, 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);
}
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() {
static PyMethodDef methods[] = {
{"SendCloseRequest", dummy_none, METH_VARARGS, nullptr},
{"Add", dummy_none, METH_VARARGS, nullptr},
{"Remove", dummy_none, METH_VARARGS, nullptr},
{"GetPrice", dummy_zero, METH_VARARGS, nullptr},
{"GetAttachedItem", dummy_zero, METH_VARARGS, nullptr},
{"GetResultItem", dummy_zero, METH_VARARGS, nullptr},
{"SendRefineRequest", dummy_none, METH_VARARGS, nullptr},
{"SendCloseRequest", sash_SendCloseRequest, METH_VARARGS, nullptr},
{"Add", sash_Add, METH_VARARGS, nullptr},
{"Remove", sash_Remove, METH_VARARGS, nullptr},
{"GetPrice", sash_GetPrice, METH_VARARGS, nullptr},
{"GetAttachedItem", sash_GetAttachedItem, METH_VARARGS, nullptr},
{"GetResultItem", sash_GetResultItem, METH_VARARGS, nullptr},
{"SendRefineRequest", sash_SendRefineRequest, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
auto* module = Py_InitModule("sash", methods);
PyModule_AddIntConstant(module, "ABSORPTION_SOCKET", 0);
PyModule_AddIntConstant(module, "ABSORBED_SOCKET", 0);
PyModule_AddIntConstant(module, "CLEAN_ATTR_VALUE0", 0);
PyModule_AddIntConstant(module, "WINDOW_MAX_MATERIALS", 0);
PyModule_AddIntConstant(module, "ABSORBED_SOCKET", 1);
PyModule_AddIntConstant(module, "CLEAN_ATTR_VALUE0", 7);
PyModule_AddIntConstant(module, "WINDOW_MAX_MATERIALS", 2);
PyModule_AddIntConstant(module, "CLEAN_ATTR_VALUE_FIELD", 0);
PyModule_AddIntConstant(module, "LIMIT_RANGE", 1000);
}
void initServerStateChecker() {
static PyMethodDef methods[] = {
{"Create", dummy_none, METH_VARARGS, nullptr},
{"Update", dummy_none, METH_VARARGS, nullptr},
{"Request", dummy_none, METH_VARARGS, nullptr},
{"AddChannel", dummy_none, METH_VARARGS, nullptr},
{"Initialize", dummy_none, METH_VARARGS, nullptr},
{"Create", ServerStateChecker_Create, METH_VARARGS, nullptr},
{"Update", ServerStateChecker_Update, METH_VARARGS, nullptr},
{"Request", ServerStateChecker_Request, METH_VARARGS, nullptr},
{"AddChannel", ServerStateChecker_AddChannel, METH_VARARGS, nullptr},
{"Initialize", ServerStateChecker_Initialize, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
auto* module = Py_InitModule("ServerStateChecker", methods);
Py_InitModule("ServerStateChecker", methods);
}
void initPlayerSettingsModule() {
static PyMethodDef methods[] = {
{"RegisterSkill", dummy_none, METH_VARARGS, nullptr},
{"RegisterSkill", playerLoad_RegisterSkill, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
auto* module = Py_InitModule("playerLoad", methods);
Py_InitModule("playerLoad", methods);
}
// 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() {
static PyMethodDef methods[] = {
{"IsRunning", dummy_bool_false, METH_VARARGS, nullptr},
{"GetRankings", dummy_tuple4, METH_VARARGS, nullptr},
{"GetDay", dummy_tuple4, METH_VARARGS, nullptr},
{"SendCombatZoneRequestActionPacket", dummy_none, METH_VARARGS, nullptr},
{"GetDayActivate", dummy_bool_false, METH_VARARGS, nullptr},
{"IsRunning", combatZone_IsRunning, METH_VARARGS, nullptr},
{"GetRankings", combatZone_GetRankings, METH_VARARGS, nullptr},
{"GetDay", combatZone_GetDay, METH_VARARGS, nullptr},
{"SendCombatZoneRequestActionPacket", combatZone_SendCombatZoneRequestActionPacket, METH_VARARGS, nullptr},
{"GetDayActivate", combatZone_GetDayActivate, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
auto* module = Py_InitModule("combat_zone", methods);
@@ -1383,10 +1614,10 @@ void initCombatZoneSystem() {
void initBankManager() {
static PyMethodDef methods[] = {
{"Append", dummy_none, METH_VARARGS, nullptr},
{"Append", bankLoadLogs, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
auto* module = Py_InitModule("managerBankLogs", methods);
Py_InitModule("managerBankLogs", methods);
}
static PyObject* safebox_GetCurrentSafeboxSize(PyObject*, PyObject*) {
@@ -1718,6 +1949,68 @@ static PyObject* renderTarget_SetModelV3Target(PyObject*, PyObject* args) {
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) {
int idx = 0;
if (PyArg_ParseTuple(args, "i", &idx)) {
@@ -1737,22 +2030,22 @@ void initRenderTarget() {
{"SetHair", renderTarget_SetHair, METH_VARARGS, nullptr},
{"SetRotation", renderTarget_SetRotation, METH_VARARGS, nullptr},
{"SetAcce", renderTarget_SetAcce, METH_VARARGS, nullptr},
{"SetMount", dummy_none, METH_VARARGS, nullptr},
{"ResetModel", dummy_none, METH_VARARGS, nullptr},
{"SetMount", renderTarget_SetMount, METH_VARARGS, nullptr},
{"ResetModel", renderTarget_ResetModel, METH_VARARGS, nullptr},
{"Destroy", renderTarget_Destroy, METH_VARARGS, nullptr},
{"SetModelV3Eye", renderTarget_SetModelV3Eye, METH_VARARGS, nullptr},
{"SetModelV3Target", renderTarget_SetModelV3Target, METH_VARARGS, nullptr},
{"GetFreeIndex", renderTarget_GetFreeIndex, METH_VARARGS, nullptr},
{"SetModelRender", dummy_none, METH_VARARGS, nullptr},
{"AddAffect", dummy_none, METH_VARARGS, nullptr},
{"RemoveAffect", dummy_none, METH_VARARGS, nullptr},
{"ClearAffect", dummy_none, METH_VARARGS, nullptr},
{"SetModelRender", renderTarget_SetModelRender, METH_VARARGS, nullptr},
{"AddAffect", renderTarget_AddAffect, METH_VARARGS, nullptr},
{"RemoveAffect", renderTarget_RemoveAffect, METH_VARARGS, nullptr},
{"ClearAffect", renderTarget_ClearAffect, METH_VARARGS, nullptr},
{"IsShow", renderTarget_IsShow, METH_VARARGS, nullptr},
{"Zoom", renderTarget_Zoom, METH_VARARGS, nullptr},
{"SetScale", renderTarget_SetScale, METH_VARARGS, nullptr},
{"RotateEyeAroundTarget", renderTarget_RotateEyeAroundTarget, METH_VARARGS, nullptr},
{"SetMotionIndex", dummy_none, METH_VARARGS, nullptr},
{"SetShining", dummy_none, METH_VARARGS, nullptr},
{"SetMotionIndex", renderTarget_SetMotionIndex, METH_VARARGS, nullptr},
{"SetShining", renderTarget_SetShining, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
auto* module = Py_InitModule("renderTarget", methods);
+348 -57
View File
@@ -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* net_dummy_none(PyObject*, PyObject*) { Py_RETURN_NONE; }
PyObject* net_dummy_zero(PyObject*, PyObject*) { return PyInt_FromLong(0); }
PyObject* net_dummy_one(PyObject*, PyObject*) { return PyInt_FromLong(1); }
PyObject* net_dummy_str(PyObject*, PyObject*) { return PyString_FromString(""); }
PyObject* net_dummy_tuple4(PyObject*, PyObject*) { return Py_BuildValue("iiii", 0, 0, 0, 0); }
static PyObject* net_ElementsSpellClose(PyObject*, PyObject*) { return Py_BuildNone(); }
static PyObject* net_ElementsSpellAdd(PyObject*, PyObject*) { return Py_BuildNone(); }
static PyObject* net_ElementsSpellChange(PyObject*, PyObject*) { return Py_BuildNone(); }
static PyObject* net_SendCombatZoneRequestActionPacket(PyObject*, PyObject*) { return Py_BuildNone(); }
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) ──
PyObject* netSendExchangeStartPacket(PyObject*, PyObject* poArgs) {
@@ -820,6 +823,294 @@ static PyObject* net_send_script_button_packet(PyObject*, PyObject* args) {
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() {
static PyMethodDef methods[] = {
{"SetHandler", set_handler, METH_VARARGS, nullptr},
@@ -836,21 +1127,21 @@ void initnet() {
{"GetEmpireID", empire, METH_NOARGS, nullptr},
{"Update", update, 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},
{"SetServerInfo", net_dummy_none, METH_VARARGS, nullptr},
{"GetServerInfo", net_dummy_str, METH_VARARGS, nullptr},
{"SetServerInfo", net_SetServerInfo, METH_VARARGS, nullptr},
{"GetServerInfo", net_GetServerInfo, METH_VARARGS, nullptr},
{"PreserveServerCommand", net_preserve_server_command, METH_VARARGS, nullptr},
{"GetPreservedServerCommand", net_get_preserved_server_command, METH_VARARGS, nullptr},
{"StartGame", net_start_game, METH_VARARGS, nullptr},
{"Warp", net_warp, METH_VARARGS, nullptr},
{"IsTest", net_dummy_zero, METH_VARARGS, nullptr},
{"SetMarkServer", net_dummy_none, METH_VARARGS, nullptr},
{"IsTest", net_IsTest, METH_VARARGS, nullptr},
{"SetMarkServer", net_SetMarkServer, METH_VARARGS, nullptr},
{"IsChatInsultIn", net_is_chat_insult_in, METH_VARARGS, nullptr},
{"IsInsultIn", net_is_insult_in, METH_VARARGS, nullptr},
{"LoadInsultList", net_load_insult_list, METH_VARARGS, nullptr},
{"UploadMark", net_dummy_none, METH_VARARGS, nullptr},
{"UploadSymbol", net_dummy_none, METH_VARARGS, nullptr},
{"UploadMark", net_UploadMark, METH_VARARGS, nullptr},
{"UploadSymbol", net_UploadSymbol, METH_VARARGS, nullptr},
{"GetGuildID", netGetGuildID, METH_VARARGS, nullptr},
{"GetMainActorVID", net_get_main_actor_vid, METH_VARARGS, nullptr},
{"GetMainActorRace", net_get_main_actor_race, METH_VARARGS, nullptr},
@@ -859,23 +1150,23 @@ void initnet() {
{"SendTargetInfoLoad", netTargetInfoLoad, METH_VARARGS, nullptr},
{"GetFieldMusicFileName", net_get_field_music_name, 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},
{"SetTCPRecvBufferSize", net_dummy_none, METH_VARARGS, nullptr},
{"SetTCPSendBufferSize", net_dummy_none, METH_VARARGS, nullptr},
{"SetUDPRecvBufferSize", net_dummy_none, METH_VARARGS, nullptr},
{"SetTCPRecvBufferSize", net_SetTCPRecvBufferSize, METH_VARARGS, nullptr},
{"SetTCPSendBufferSize", net_SetTCPSendBufferSize, METH_VARARGS, nullptr},
{"SetUDPRecvBufferSize", net_SetUDPRecvBufferSize, METH_VARARGS, nullptr},
{"DirectEnter", direct_enter, METH_VARARGS, nullptr},
{"LogOutGame", net_dummy_none, METH_VARARGS, nullptr},
{"ExitGame", net_dummy_none, METH_VARARGS, nullptr},
{"ExitApplication", net_dummy_none, METH_VARARGS, nullptr},
{"ConnectTCP", net_dummy_none, METH_VARARGS, nullptr},
{"ConnectUDP", net_dummy_none, METH_VARARGS, nullptr},
{"SendLoginPacket", net_dummy_none, METH_VARARGS, nullptr},
{"SendChinaMatrixCardPacket", net_dummy_none, METH_VARARGS, nullptr},
{"SendRunupMatrixCardPacket", net_dummy_none, METH_VARARGS, nullptr},
{"SendNEWCIBNPasspodAnswerPacket", net_dummy_none, METH_VARARGS, nullptr},
{"SendSelectEmpirePacket", net_dummy_none, METH_VARARGS, nullptr},
{"SendChangeNamePacket", net_dummy_none, METH_VARARGS, nullptr},
{"LogOutGame", net_LogOutGame, METH_VARARGS, nullptr},
{"ExitGame", net_ExitGame, METH_VARARGS, nullptr},
{"ExitApplication", net_ExitApplication, METH_VARARGS, nullptr},
{"ConnectTCP", net_ConnectTCP, METH_VARARGS, nullptr},
{"ConnectUDP", net_ConnectUDP, METH_VARARGS, nullptr},
{"SendLoginPacket", net_SendLoginPacket, METH_VARARGS, nullptr},
{"SendChinaMatrixCardPacket", net_SendChinaMatrixCardPacket, METH_VARARGS, nullptr},
{"SendRunupMatrixCardPacket", net_SendRunupMatrixCardPacket, METH_VARARGS, nullptr},
{"SendNEWCIBNPasspodAnswerPacket", net_SendNEWCIBNPasspodAnswerPacket, METH_VARARGS, nullptr},
{"SendSelectEmpirePacket", net_SendSelectEmpirePacket, METH_VARARGS, nullptr},
{"SendChangeNamePacket", net_SendChangeNamePacket, METH_VARARGS, nullptr},
{"SendCreateCharacterPacket", send_create_character, METH_VARARGS, nullptr},
{"SendDestroyCharacterPacket", send_destroy_character, 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},
{"SendItemPickUpPacket", net_send_item_pickup, 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},
{"SendChatPacket", net_send_chat, METH_VARARGS, nullptr},
{"SendEmoticon", net_send_emoticon, 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},
{"SendCharacterMovePacket", 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},
{"SendSelectItemPacket", netSendSelectItemPacket, METH_VARARGS, nullptr},
{"SetEmpireLanguageMode", net_set_empire_language_mode, METH_VARARGS, nullptr},
{"SetSkillGroupFake", net_dummy_none, METH_VARARGS, nullptr},
{"SendGuildSymbol", net_dummy_none, METH_VARARGS, nullptr},
{"DisconnectUploader", net_dummy_none, METH_VARARGS, nullptr},
{"RecvGuildSymbol", net_dummy_none, METH_VARARGS, nullptr},
{"SetSkillGroupFake", net_SetSkillGroupFake, METH_VARARGS, nullptr},
{"SendGuildSymbol", net_SendGuildSymbol, METH_VARARGS, nullptr},
{"DisconnectUploader", net_DisconnectUploader, METH_VARARGS, nullptr},
{"RecvGuildSymbol", net_RecvGuildSymbol, METH_VARARGS, nullptr},
{"SendOfflineShopEndPacket", offline_shop_end, 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},
{"SendDestroyOfflineShop", offline_shop_destroy, METH_VARARGS, nullptr},
{"SendTakeOfflineMoney", net_dummy_none, METH_VARARGS, nullptr},
{"SendOfflineShopChangeTitle", net_dummy_none, METH_VARARGS, nullptr},
{"SendOfflineShopCheck", net_dummy_none, METH_VARARGS, nullptr},
{"SendOfflineShopButton", net_dummy_none, METH_VARARGS, nullptr},
{"SendTakeOfflineMoney", net_SendTakeOfflineMoney, METH_VARARGS, nullptr},
{"SendOfflineShopChangeTitle", net_SendOfflineShopChangeTitle, METH_VARARGS, nullptr},
{"SendOfflineShopCheck", net_SendOfflineShopCheck, METH_VARARGS, nullptr},
{"SendOfflineShopButton", net_SendOfflineShopButton, METH_VARARGS, nullptr},
{"SendOfflineShopRemoveLogs", offline_shop_logs, METH_VARARGS, nullptr},
{"SendOpenShopSlot", offline_shop_slot, METH_VARARGS, nullptr},
{"SendGetBackItems", offline_shop_get_items, METH_VARARGS, nullptr},
{"SendAddTime", offline_shop_add_time, METH_VARARGS, nullptr},
{"SendOpenWithVID", offline_shop_open_vid, METH_VARARGS, nullptr},
{"RegisterErrorLog", net_dummy_none, METH_VARARGS, nullptr},
{"ElementsSpellClose", net_dummy_none, METH_VARARGS, nullptr},
{"ElementsSpellAdd", net_dummy_none, METH_VARARGS, nullptr},
{"ElementsSpellChange", net_dummy_none, METH_VARARGS, nullptr},
{"Send67AttrPacket", net_dummy_none, METH_VARARGS, nullptr},
{"Send67AttrClosePacket", net_dummy_none, METH_VARARGS, nullptr},
{"CalendarOpen", net_dummy_none, METH_VARARGS, nullptr},
{"CalendarClose", net_dummy_none, METH_VARARGS, nullptr},
{"CalendarSend", net_dummy_none, METH_VARARGS, nullptr},
{"RegisterErrorLog", net_RegisterErrorLog, METH_VARARGS, nullptr},
{"ElementsSpellClose", net_ElementsSpellClose, METH_VARARGS, nullptr},
{"ElementsSpellAdd", net_ElementsSpellAdd, METH_VARARGS, nullptr},
{"ElementsSpellChange", net_ElementsSpellChange, METH_VARARGS, nullptr},
{"Send67AttrPacket", net_Send67AttrPacket, METH_VARARGS, nullptr},
{"Send67AttrClosePacket", net_Send67AttrClosePacket, METH_VARARGS, nullptr},
{"CalendarOpen", net_CalendarOpen, METH_VARARGS, nullptr},
{"CalendarClose", net_CalendarClose, METH_VARARGS, nullptr},
{"CalendarSend", net_CalendarSend, METH_VARARGS, nullptr},
{"SendPrivateShopSearchInfo", netSendPrivateShopSearchInfo, METH_VARARGS, nullptr},
{"SendMiniGameCatchKingStart", net_dummy_none, METH_VARARGS, nullptr},
{"SendMiniGameCatchKingDeckCardClick", net_dummy_none, METH_VARARGS, nullptr},
{"SendMiniGameCatchKingFieldCardClick", net_dummy_none, METH_VARARGS, nullptr},
{"SendMiniGameCatchKingReward", net_dummy_none, METH_VARARGS, nullptr},
{"OpenCatchKing", net_dummy_none, METH_VARARGS, nullptr},
{"SendCombatZoneRequestActionPacket", net_dummy_none, METH_VARARGS, nullptr},
{"IsRunning", net_dummy_zero, METH_VARARGS, nullptr},
{"GetRankings", net_dummy_tuple4, METH_VARARGS, nullptr},
{"GetDay", net_dummy_tuple4, METH_VARARGS, nullptr},
{"GetDayActivate", net_dummy_zero, METH_VARARGS, nullptr},
{"SendMiniGameCatchKingStart", net_SendMiniGameCatchKingStart, METH_VARARGS, nullptr},
{"SendMiniGameCatchKingDeckCardClick", net_SendMiniGameCatchKingDeckCardClick, METH_VARARGS, nullptr},
{"SendMiniGameCatchKingFieldCardClick", net_SendMiniGameCatchKingFieldCardClick, METH_VARARGS, nullptr},
{"SendMiniGameCatchKingReward", net_SendMiniGameCatchKingReward, METH_VARARGS, nullptr},
{"OpenCatchKing", net_OpenCatchKing, METH_VARARGS, nullptr},
{"SendCombatZoneRequestActionPacket", net_SendCombatZoneRequestActionPacket, METH_VARARGS, nullptr},
{"IsRunning", net_CombatZone_IsRunning, METH_VARARGS, nullptr},
{"GetRankings", net_CombatZone_GetRankings, METH_VARARGS, nullptr},
{"GetDay", net_CombatZone_GetDay, METH_VARARGS, nullptr},
{"GetDayActivate", net_CombatZone_GetDayActivate, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};
auto* module = Py_InitModule("net", methods);