mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 04:11:30 +00:00
Add client->Fling() to Perl/Lua.
- $client->Fling(value, target_x, target_y, target_z, ignore_los, clipping) in Perl. - client:Fling(value, target_x, target_y, target_z, ignore_los, clipping) in Lua.
This commit is contained in:
parent
de5b7f472d
commit
3fa236c2bb
@ -9988,3 +9988,25 @@ void Client::MovePCDynamicZone(const std::string& zone_name, int zone_version, b
|
||||
auto zone_id = ZoneID(zone_name.c_str());
|
||||
MovePCDynamicZone(zone_id, zone_version, msg_if_invalid);
|
||||
}
|
||||
|
||||
void Client::Fling(float value, float target_x, float target_y, float target_z, bool ignore_los, bool clipping) {
|
||||
BuffFadeByEffect(SE_Levitate);
|
||||
if (CheckLosFN(target_x, target_y, target_z, 6.0f) || ignore_los) {
|
||||
auto outapp_fling = new EQApplicationPacket(OP_Fling, sizeof(fling_struct));
|
||||
fling_struct* flingTo = (fling_struct*)outapp_fling->pBuffer;
|
||||
if(clipping)
|
||||
flingTo->collision = 0;
|
||||
else
|
||||
flingTo->collision = -1;
|
||||
|
||||
flingTo->travel_time = -1;
|
||||
flingTo->unk3 = 1;
|
||||
flingTo->disable_fall_damage = 1;
|
||||
flingTo->speed_z = value;
|
||||
flingTo->new_y = target_y;
|
||||
flingTo->new_x = target_x;
|
||||
flingTo->new_z = target_z;
|
||||
outapp_fling->priority = 6;
|
||||
FastQueuePacket(&outapp_fling);
|
||||
}
|
||||
}
|
||||
@ -794,6 +794,8 @@ public:
|
||||
uint32 GetCharMaxLevelFromQGlobal();
|
||||
uint32 GetCharMaxLevelFromBucket();
|
||||
|
||||
void Fling(float value, float target_x, float target_y, float target_z, bool ignore_los = false, bool clipping = false);
|
||||
|
||||
inline bool IsStanding() const {return (playeraction == 0);}
|
||||
inline bool IsSitting() const {return (playeraction == 1);}
|
||||
inline bool IsCrouching() const {return (playeraction == 2);}
|
||||
|
||||
@ -1877,6 +1877,21 @@ void Lua_Client::MovePCDynamicZone(std::string zone_name, int zone_version, bool
|
||||
return self->MovePCDynamicZone(zone_name, zone_version, msg_if_invalid);
|
||||
}
|
||||
|
||||
void Lua_Client::Fling(float value, float target_x, float target_y, float target_z) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->Fling(value, target_x, target_y, target_z);
|
||||
}
|
||||
|
||||
void Lua_Client::Fling(float value, float target_x, float target_y, float target_z, bool ignore_los) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->Fling(value, target_x, target_y, target_z, ignore_los);
|
||||
}
|
||||
|
||||
void Lua_Client::Fling(float value, float target_x, float target_y, float target_z, bool ignore_los, bool clipping) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->Fling(value, target_x, target_y, target_z, ignore_los, clipping);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_client() {
|
||||
return luabind::class_<Lua_Client, Lua_Mob>("Client")
|
||||
.def(luabind::constructor<>())
|
||||
@ -2204,7 +2219,10 @@ luabind::scope lua_register_client() {
|
||||
.def("MovePCDynamicZone", (void(Lua_Client::*)(uint32, int, bool))&Lua_Client::MovePCDynamicZone)
|
||||
.def("MovePCDynamicZone", (void(Lua_Client::*)(std::string))&Lua_Client::MovePCDynamicZone)
|
||||
.def("MovePCDynamicZone", (void(Lua_Client::*)(std::string, int))&Lua_Client::MovePCDynamicZone)
|
||||
.def("MovePCDynamicZone", (void(Lua_Client::*)(std::string, int, bool))&Lua_Client::MovePCDynamicZone);
|
||||
.def("MovePCDynamicZone", (void(Lua_Client::*)(std::string, int, bool))&Lua_Client::MovePCDynamicZone)
|
||||
.def("Fling", (void(Lua_Client::*)(float,float,float,float))&Lua_Client::Fling)
|
||||
.def("Fling", (void(Lua_Client::*)(float,float,float,float,bool))&Lua_Client::Fling)
|
||||
.def("Fling", (void(Lua_Client::*)(float,float,float,float,bool,bool))&Lua_Client::Fling);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_inventory_where() {
|
||||
|
||||
@ -360,6 +360,9 @@ public:
|
||||
void MovePCDynamicZone(std::string zone_name);
|
||||
void MovePCDynamicZone(std::string zone_name, int zone_version);
|
||||
void MovePCDynamicZone(std::string zone_name, int zone_version, bool msg_if_invalid);
|
||||
void Fling(float value, float target_x, float target_y, float target_z);
|
||||
void Fling(float value, float target_x, float target_y, float target_z, bool ignore_los);
|
||||
void Fling(float value, float target_x, float target_y, float target_z, bool ignore_los, bool clipping);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -7051,6 +7051,41 @@ XS(XS_Client_MovePCDynamicZone) {
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_Fling); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_Fling) {
|
||||
dXSARGS;
|
||||
if (items < 5 || items > 7)
|
||||
Perl_croak(aTHX_ "Usage: Client::Fling(THIS, value, target_x, target_y, target_z, ignore_los, clipping)");
|
||||
{
|
||||
Client* THIS;
|
||||
float value = (float) SvNV(ST(1));
|
||||
float target_x = (float) SvNV(ST(2));
|
||||
float target_y = (float) SvNV(ST(3));
|
||||
float target_z = (float) SvNV(ST(4));
|
||||
bool ignore_los = false;
|
||||
bool clipping = false;
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
if (items > 5)
|
||||
ignore_los = (bool) SvTRUE(ST(5));
|
||||
|
||||
if (items > 6)
|
||||
clipping = (bool) SvTRUE(ST(6));
|
||||
|
||||
THIS->Fling(value, target_x, target_y, target_z, ignore_los, clipping);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
@ -7108,6 +7143,7 @@ XS(boot_Client) {
|
||||
newXSproto(strcpy(buf, "Escape"), XS_Client_Escape, file, "$");
|
||||
newXSproto(strcpy(buf, "ExpeditionMessage"), XS_Client_ExpeditionMessage, file, "$$$");
|
||||
newXSproto(strcpy(buf, "FailTask"), XS_Client_FailTask, file, "$$");
|
||||
newXSproto(strcpy(buf, "Fling"), XS_Client_Fling, file, "$$$$$;$$");
|
||||
newXSproto(strcpy(buf, "ForageItem"), XS_Client_ForageItem, file, "$");
|
||||
newXSproto(strcpy(buf, "Freeze"), XS_Client_Freeze, file, "$");
|
||||
newXSproto(strcpy(buf, "GetAAExp"), XS_Client_GetAAExp, file, "$");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user