mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 12:31:31 +00:00
Add HasDisciplineLearned() to Perl/Lua.
This commit is contained in:
parent
7c69400618
commit
c481d52064
@ -975,6 +975,7 @@ public:
|
|||||||
void SendDisciplineUpdate();
|
void SendDisciplineUpdate();
|
||||||
void SendDisciplineTimer(uint32 timer_id, uint32 duration);
|
void SendDisciplineTimer(uint32 timer_id, uint32 duration);
|
||||||
bool UseDiscipline(uint32 spell_id, uint32 target);
|
bool UseDiscipline(uint32 spell_id, uint32 target);
|
||||||
|
bool HasDisciplineLearned(uint16 spell_id);
|
||||||
|
|
||||||
void SetLinkedSpellReuseTimer(uint32 timer_id, uint32 duration);
|
void SetLinkedSpellReuseTimer(uint32 timer_id, uint32 duration);
|
||||||
bool IsLinkedSpellReuseTimerReady(uint32 timer_id);
|
bool IsLinkedSpellReuseTimerReady(uint32 timer_id);
|
||||||
|
|||||||
@ -678,6 +678,17 @@ void Client::ResetDisciplineTimer(uint32 timer_id) {
|
|||||||
SendDisciplineTimer(timer_id, 0);
|
SendDisciplineTimer(timer_id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Client::HasDisciplineLearned(uint16 spell_id) {
|
||||||
|
bool has_learned = false;
|
||||||
|
for (auto index = 0; index < MAX_PP_DISCIPLINES; ++index) {
|
||||||
|
if (GetPP().disciplines.values[index] == spell_id) {
|
||||||
|
has_learned = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return has_learned;
|
||||||
|
}
|
||||||
|
|
||||||
void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration)
|
void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration)
|
||||||
{
|
{
|
||||||
if (timer_id < MAX_DISCIPLINE_TIMERS)
|
if (timer_id < MAX_DISCIPLINE_TIMERS)
|
||||||
|
|||||||
@ -929,6 +929,11 @@ bool Lua_Client::UseDiscipline(int spell_id, int target_id) {
|
|||||||
return self->UseDiscipline(spell_id, target_id);
|
return self->UseDiscipline(spell_id, target_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Lua_Client::HasDisciplineLearned(uint16 spell_id) {
|
||||||
|
Lua_Safe_Call_Bool();
|
||||||
|
return self->HasDisciplineLearned(spell_id);
|
||||||
|
}
|
||||||
|
|
||||||
int Lua_Client::GetCharacterFactionLevel(int faction_id) {
|
int Lua_Client::GetCharacterFactionLevel(int faction_id) {
|
||||||
Lua_Safe_Call_Int();
|
Lua_Safe_Call_Int();
|
||||||
return self->GetCharacterFactionLevel(faction_id);
|
return self->GetCharacterFactionLevel(faction_id);
|
||||||
@ -2104,6 +2109,7 @@ luabind::scope lua_register_client() {
|
|||||||
.def("GetDisciplineTimer", (uint32(Lua_Client::*)(uint32))&Lua_Client::GetDisciplineTimer)
|
.def("GetDisciplineTimer", (uint32(Lua_Client::*)(uint32))&Lua_Client::GetDisciplineTimer)
|
||||||
.def("ResetDisciplineTimer", (void(Lua_Client::*)(uint32))&Lua_Client::ResetDisciplineTimer)
|
.def("ResetDisciplineTimer", (void(Lua_Client::*)(uint32))&Lua_Client::ResetDisciplineTimer)
|
||||||
.def("UseDiscipline", (bool(Lua_Client::*)(int,int))&Lua_Client::UseDiscipline)
|
.def("UseDiscipline", (bool(Lua_Client::*)(int,int))&Lua_Client::UseDiscipline)
|
||||||
|
.def("HasDisciplineLearned", (bool(Lua_Client::*)(uint16))&Lua_Client::HasDisciplineLearned)
|
||||||
.def("GetCharacterFactionLevel", (int(Lua_Client::*)(int))&Lua_Client::GetCharacterFactionLevel)
|
.def("GetCharacterFactionLevel", (int(Lua_Client::*)(int))&Lua_Client::GetCharacterFactionLevel)
|
||||||
.def("SetZoneFlag", (void(Lua_Client::*)(int))&Lua_Client::SetZoneFlag)
|
.def("SetZoneFlag", (void(Lua_Client::*)(int))&Lua_Client::SetZoneFlag)
|
||||||
.def("ClearZoneFlag", (void(Lua_Client::*)(int))&Lua_Client::ClearZoneFlag)
|
.def("ClearZoneFlag", (void(Lua_Client::*)(int))&Lua_Client::ClearZoneFlag)
|
||||||
|
|||||||
@ -213,6 +213,7 @@ public:
|
|||||||
uint32 GetDisciplineTimer(uint32 timer_id);
|
uint32 GetDisciplineTimer(uint32 timer_id);
|
||||||
void ResetDisciplineTimer(uint32 timer_id);
|
void ResetDisciplineTimer(uint32 timer_id);
|
||||||
bool UseDiscipline(int spell_id, int target_id);
|
bool UseDiscipline(int spell_id, int target_id);
|
||||||
|
bool HasDisciplineLearned(uint16 spell_id);
|
||||||
int GetCharacterFactionLevel(int faction_id);
|
int GetCharacterFactionLevel(int faction_id);
|
||||||
void SetZoneFlag(int zone_id);
|
void SetZoneFlag(int zone_id);
|
||||||
void ClearZoneFlag(int zone_id);
|
void ClearZoneFlag(int zone_id);
|
||||||
|
|||||||
@ -7086,6 +7086,32 @@ XS(XS_Client_Fling) {
|
|||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XS(XS_Client_HasDisciplineLearned); /* prototype to pass -Wmissing-prototypes */
|
||||||
|
XS(XS_Client_HasDisciplineLearned) {
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 2)
|
||||||
|
Perl_croak(aTHX_ "Usage: Client::HasDisciplineLearned(THIS, uint16 spell_id)");
|
||||||
|
{
|
||||||
|
Client *THIS;
|
||||||
|
bool has_learned;
|
||||||
|
uint16 spell_id = (uint16) SvUV(ST(1));
|
||||||
|
|
||||||
|
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.");
|
||||||
|
|
||||||
|
has_learned = THIS->HasDisciplineLearned(spell_id);
|
||||||
|
ST(0) = boolSV(has_learned);
|
||||||
|
sv_2mortal(ST(0));
|
||||||
|
}
|
||||||
|
XSRETURN(1);
|
||||||
|
}
|
||||||
|
|
||||||
XS(XS_Client_GetClassBitmask);
|
XS(XS_Client_GetClassBitmask);
|
||||||
XS(XS_Client_GetClassBitmask) {
|
XS(XS_Client_GetClassBitmask) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
@ -7294,6 +7320,7 @@ XS(boot_Client) {
|
|||||||
newXSproto(strcpy(buf, "GrantAlternateAdvancementAbility"), XS_Client_GrantAlternateAdvancementAbility, file, "$$$;$");
|
newXSproto(strcpy(buf, "GrantAlternateAdvancementAbility"), XS_Client_GrantAlternateAdvancementAbility, file, "$$$;$");
|
||||||
newXSproto(strcpy(buf, "GuildID"), XS_Client_GuildID, file, "$");
|
newXSproto(strcpy(buf, "GuildID"), XS_Client_GuildID, file, "$");
|
||||||
newXSproto(strcpy(buf, "GuildRank"), XS_Client_GuildRank, file, "$");
|
newXSproto(strcpy(buf, "GuildRank"), XS_Client_GuildRank, file, "$");
|
||||||
|
newXSproto(strcpy(buf, "HasDisciplineLearned"), XS_Client_HasDisciplineLearned, file, "$$");
|
||||||
newXSproto(strcpy(buf, "HasExpeditionLockout"), XS_Client_HasExpeditionLockout, file, "$$$");
|
newXSproto(strcpy(buf, "HasExpeditionLockout"), XS_Client_HasExpeditionLockout, file, "$$$");
|
||||||
newXSproto(strcpy(buf, "HasSkill"), XS_Client_HasSkill, file, "$$");
|
newXSproto(strcpy(buf, "HasSkill"), XS_Client_HasSkill, file, "$$");
|
||||||
newXSproto(strcpy(buf, "HasSpellScribed"), XS_Client_HasSkill, file, "$$");
|
newXSproto(strcpy(buf, "HasSpellScribed"), XS_Client_HasSkill, file, "$$");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user