Files
AVA2/src/scripting/python_gameplay_modules.h
T
shenleiandClaude Opus 5.5 260d421bde Wire attack and combo execution (mobile step 3b)
Port the ActorInstanceBattle combo state machine, CRaceMotionData attack
data, player motion/combo tables, NEW_Attack + OnAttack/OnHit packets and
remote FUNC_ATTACK/FUNC_COMBO playback so keyboard and touch attacks swing
and hit on the real-server path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 20:30:57 +09:00

114 lines
5.0 KiB
C++

#pragma once
#include "python_background.h"
#include "eter_render/RenderCommands3D.h"
#include "eter_net/Packet.h"
#include <vector>
#include <functional>
#include <string>
namespace ava2 {
void initItem();
void initPlayer();
void initchrmgr();
void initchr();
void initsnd();
using SkillCastCallback = std::function<void(int quickSlot, int skillIndex)>;
void SetPlayerSkillCastCallback(SkillCastCallback cb);
void SetSkillCoolTime(int skillIndex, float coolTime);
void SetSkillCoolTimeAt(int skillIndex,float coolTime,float now);
void EndSkillCoolTime(uint32_t skillIndex);
void ClickSkillSlot(int skillSlot);
void UseGuildSkill(int skillSlot);
void SetPlayerAffect(uint32_t affect);
void ResetPlayerAffect(uint32_t affect);
void SetComboSkillFlag(bool bFlag);
int AffectIndexToSkillIndex(int affect);
struct PlayerItemSlot {
uint32_t vnum = 0;
int count = 0;
std::array<long, 8> sockets{};
std::array<std::pair<int, int>, 15> attrs{};
};
PlayerItemSlot GetPlayerItem(int slot);
void SetPlayerItem(int slot, uint32_t vnum, int count);
void ResetPlayerState();
void AppendPartyMember(uint32_t pid,const std::string& name);
void LinkPartyMember(uint32_t pid,uint32_t vid);
void UnlinkPartyMember(uint32_t pid);
void UpdatePartyMemberInfo(uint32_t pid,uint8_t state,uint8_t hp);
void UpdatePartyMemberAffect(uint32_t pid,uint8_t slot,int16_t affect);
bool GetPartyMemberState(uint32_t pid,uint8_t* state);
bool PartyMemberPIDToVID(uint32_t pid,uint32_t* vid);
bool PartyMemberVIDToPID(uint32_t vid,uint32_t* pid);
bool IsPartyMemberByVID(uint32_t vid);
void ClearChestDropInfo(uint32_t chestVnum);
void AddChestDropItem(uint32_t chestVnum, uint32_t itemVnum, uint32_t count);
void RememberChallengeInstance(uint32_t vid);
void RememberRevengeInstance(uint32_t vid);
void RememberCantFightInstance(uint32_t vid);
void ForgetInstance(uint32_t vid);
void SetKillLOG(const int32_t* log);
void NEW_ClearSkillData(bool all);
void ResetItemDatabase();
bool LoadItemList(const std::string& path);
bool LoadItemDescriptions(const std::string& path);
bool LoadItemTable(const std::string& path);
struct ItemScaleInfo { float scaleX=0,scaleY=0,scaleZ=0,positionX=0,positionY=0,positionZ=0; };
bool LoadItemScale(const std::string& path);
bool GetItemScale(uint32_t vnum,uint32_t pos,ItemScaleInfo* out);
bool GetItemNameAndType(uint32_t vnum,std::string* name,int* type);
bool IsPlayerEquipmentItem(uint8_t window,uint16_t cell);
bool GetItemTypeAndSubType(uint32_t vnum,int* type,int* subType);
bool GetItemValue(uint32_t vnum, size_t index, long* outValue);
void ClearPlayerPythonWindow();
void SetPlayerSkill(int slot,int index);
void SetPlayerSkillLevel(int index,int grade,int level);
void SetPlayerLegacySkillLevel(int index,int level);
void AddPlayerQuickSlot(int index,uint8_t type,uint8_t pos);
void DeletePlayerQuickSlot(int index);
void SwapPlayerQuickSlots(int source,int target);
void SetPlayerItemCount(uint8_t window,uint16_t cell,uint32_t count);
void SetPlayerItemData(uint8_t window, uint16_t cell, const TItemData& data);
TItemData GetPlayerItemData(uint8_t window, uint16_t cell);
bool UsePlayerItem(int window, int slot, std::string& outEquippedWeaponModel, std::string& outActionMessage);
bool MovePlayerItem(int srcWindow, int srcSlot, int dstWindow, int dstSlot, int count, std::string& outEquippedWeaponModel);
std::string GetWeaponModelPathByVnum(uint32_t vnum);
std::vector<Render3DDraw> GetAllActiveChrDraws();
void SetMainCharacterPosition(float x, float y, float z);
void GetMainCharacterPosition(float& x, float& y, float& z);
const std::string& GetMainCharacterName();
void SetMainCharacterName(const std::string& name);
long long GetPlayerStatusPoint(int type);
void SetPlayerStatusPoint(int type, long long value);
bool GetPlayerMovementYaw(float cameraYaw, float& movementYaw);
bool IsPlayerMouseMoving();
bool IsPlayerCameraDragging();
void CancelPlayerMovement();
// Touch joystick (screen axes, x right / y down, length 0..1); replaces the movement keys while active.
void SetPlayerJoystick(bool active, float x, float y);
// player.SetAttackKeyState for native input (touch attack button).
void SetPlayerAttackKey(bool pressed);
// Per frame, before movement: combo pre-input, held attack key (CPythonPlayer::NEW_Attack), FUNC_COMBO
// state packets for started attack motions, and the attack hit test (SendAttackPacket). wasMoving:
// a walk is in progress on the server; its stop packet is sent first. Returns true when it sent it.
bool ProcessPlayerAttack(float cameraYaw, float frameDt, bool wasMoving);
// The main actor is playing an attack motion (movement input is ignored meanwhile).
bool IsPlayerAttacking();
// True when handler is the window passed to player.SetGameWindow (game.GameWindow).
bool IsPlayerGameWindow(const void* handler);
void SetWeaponPower(uint32_t dwMinPower, uint32_t dwMaxPower, uint32_t dwMinMagicPower, uint32_t dwMaxMagicPower, uint32_t dwAddPower);
void UpdateEquippedWeaponPower();
bool HasEnoughArrow();
void SetPlayerRace(uint32_t race);
uint32_t GetPlayerRace();
bool CheckBossSafeRange();
bool LoadNewRegen();
} // namespace ava2