mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-14 20:12:26 +00:00
Added ability to manipulate disciplines for perl and lua. Also ability to remove spells from spell bar with spellID.
This commit is contained in:
parent
ee644f7b3e
commit
baaf5801ff
@ -712,6 +712,7 @@ public:
|
|||||||
// use this one instead
|
// use this one instead
|
||||||
void MemSpell(uint16 spell_id, int slot, bool update_client = true);
|
void MemSpell(uint16 spell_id, int slot, bool update_client = true);
|
||||||
void UnmemSpell(int slot, bool update_client = true);
|
void UnmemSpell(int slot, bool update_client = true);
|
||||||
|
void UnmemSpellBySpellID(int32 spell_id);
|
||||||
void UnmemSpellAll(bool update_client = true);
|
void UnmemSpellAll(bool update_client = true);
|
||||||
void ScribeSpell(uint16 spell_id, int slot, bool update_client = true);
|
void ScribeSpell(uint16 spell_id, int slot, bool update_client = true);
|
||||||
void UnscribeSpell(int slot, bool update_client = true);
|
void UnscribeSpell(int slot, bool update_client = true);
|
||||||
@ -925,6 +926,8 @@ public:
|
|||||||
void ResetTrade();
|
void ResetTrade();
|
||||||
void DropInst(const ItemInst* inst);
|
void DropInst(const ItemInst* inst);
|
||||||
bool TrainDiscipline(uint32 itemid);
|
bool TrainDiscipline(uint32 itemid);
|
||||||
|
void TrainDiscBySpellID(int32 spell_id);
|
||||||
|
int GetDiscSlotBySpellID(int32 spellid);
|
||||||
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);
|
||||||
|
|||||||
@ -571,6 +571,33 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
|||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::TrainDiscBySpellID(int32 spell_id)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < MAX_PP_DISCIPLINES; i++) {
|
||||||
|
if(m_pp.disciplines.values[i] == 0) {
|
||||||
|
m_pp.disciplines.values[i] = spell_id;
|
||||||
|
database.SaveCharacterDisc(this->CharacterID(), i, spell_id);
|
||||||
|
SendDisciplineUpdate();
|
||||||
|
Message(15, "You have learned a new combat ability!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Client::GetDiscSlotBySpellID(int32 spellid)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0; i < MAX_PP_DISCIPLINES; i++)
|
||||||
|
{
|
||||||
|
if(m_pp.disciplines.values[i] == spellid)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void Client::SendDisciplineUpdate() {
|
void Client::SendDisciplineUpdate() {
|
||||||
EQApplicationPacket app(OP_DisciplineUpdate, sizeof(Disciplines_Struct));
|
EQApplicationPacket app(OP_DisciplineUpdate, sizeof(Disciplines_Struct));
|
||||||
Disciplines_Struct *d = (Disciplines_Struct*)app.pBuffer;
|
Disciplines_Struct *d = (Disciplines_Struct*)app.pBuffer;
|
||||||
|
|||||||
@ -530,6 +530,11 @@ void Lua_Client::UnmemSpell(int slot, bool update_client) {
|
|||||||
self->UnmemSpell(slot, update_client);
|
self->UnmemSpell(slot, update_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Lua_Client::UnmemSpellBySpellID(int32 spell_id) {
|
||||||
|
Lua_Safe_Call_Void();
|
||||||
|
self->UnmemSpellBySpellID(spell_id);
|
||||||
|
}
|
||||||
|
|
||||||
void Lua_Client::UnmemSpellAll() {
|
void Lua_Client::UnmemSpellAll() {
|
||||||
Lua_Safe_Call_Void();
|
Lua_Safe_Call_Void();
|
||||||
self->UnmemSpellAll();
|
self->UnmemSpellAll();
|
||||||
@ -575,6 +580,16 @@ void Lua_Client::TrainDisc(int itemid) {
|
|||||||
self->TrainDiscipline(itemid);
|
self->TrainDiscipline(itemid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Lua_Client::TrainDiscBySpellID(int32 spell_id) {
|
||||||
|
Lua_Safe_Call_Void();
|
||||||
|
self->TrainDiscBySpellID(spell_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Lua_Client::GetDiscSlotBySpellID(int32 spell_id) {
|
||||||
|
Lua_Safe_Call_Int();
|
||||||
|
return self->GetDiscSlotBySpellID(spell_id);
|
||||||
|
}
|
||||||
|
|
||||||
void Lua_Client::UntrainDisc(int slot) {
|
void Lua_Client::UntrainDisc(int slot) {
|
||||||
Lua_Safe_Call_Void();
|
Lua_Safe_Call_Void();
|
||||||
self->UntrainDisc(slot);
|
self->UntrainDisc(slot);
|
||||||
@ -1426,6 +1441,7 @@ luabind::scope lua_register_client() {
|
|||||||
.def("MemSpell", (void(Lua_Client::*)(int,int,bool))&Lua_Client::MemSpell)
|
.def("MemSpell", (void(Lua_Client::*)(int,int,bool))&Lua_Client::MemSpell)
|
||||||
.def("UnmemSpell", (void(Lua_Client::*)(int))&Lua_Client::UnmemSpell)
|
.def("UnmemSpell", (void(Lua_Client::*)(int))&Lua_Client::UnmemSpell)
|
||||||
.def("UnmemSpell", (void(Lua_Client::*)(int,bool))&Lua_Client::UnmemSpell)
|
.def("UnmemSpell", (void(Lua_Client::*)(int,bool))&Lua_Client::UnmemSpell)
|
||||||
|
.def("UnmemSpellBySpellID", (void(Lua_Client::*)(int32))&Lua_Client::UnmemSpellBySpellID)
|
||||||
.def("UnmemSpellAll", (void(Lua_Client::*)(void))&Lua_Client::UnmemSpellAll)
|
.def("UnmemSpellAll", (void(Lua_Client::*)(void))&Lua_Client::UnmemSpellAll)
|
||||||
.def("UnmemSpellAll", (void(Lua_Client::*)(bool))&Lua_Client::UnmemSpellAll)
|
.def("UnmemSpellAll", (void(Lua_Client::*)(bool))&Lua_Client::UnmemSpellAll)
|
||||||
.def("ScribeSpell", (void(Lua_Client::*)(int,int))&Lua_Client::ScribeSpell)
|
.def("ScribeSpell", (void(Lua_Client::*)(int,int))&Lua_Client::ScribeSpell)
|
||||||
@ -1435,6 +1451,8 @@ luabind::scope lua_register_client() {
|
|||||||
.def("UnscribeSpellAll", (void(Lua_Client::*)(void))&Lua_Client::UnscribeSpellAll)
|
.def("UnscribeSpellAll", (void(Lua_Client::*)(void))&Lua_Client::UnscribeSpellAll)
|
||||||
.def("UnscribeSpellAll", (void(Lua_Client::*)(bool))&Lua_Client::UnscribeSpellAll)
|
.def("UnscribeSpellAll", (void(Lua_Client::*)(bool))&Lua_Client::UnscribeSpellAll)
|
||||||
.def("TrainDisc", (void(Lua_Client::*)(int))&Lua_Client::TrainDisc)
|
.def("TrainDisc", (void(Lua_Client::*)(int))&Lua_Client::TrainDisc)
|
||||||
|
.def("TrainDiscBySpellID", (void(Lua_Client::*)(int32))&Lua_Client::TrainDiscBySpellID)
|
||||||
|
.def("GetDiscSlotBySpellID", (int(Lua_Client::*)(int32))&Lua_Client::GetDiscSlotBySpellID)
|
||||||
.def("UntrainDisc", (void(Lua_Client::*)(int))&Lua_Client::UntrainDisc)
|
.def("UntrainDisc", (void(Lua_Client::*)(int))&Lua_Client::UntrainDisc)
|
||||||
.def("UntrainDisc", (void(Lua_Client::*)(int,bool))&Lua_Client::UntrainDisc)
|
.def("UntrainDisc", (void(Lua_Client::*)(int,bool))&Lua_Client::UntrainDisc)
|
||||||
.def("UntrainDiscAll", (void(Lua_Client::*)(void))&Lua_Client::UntrainDiscAll)
|
.def("UntrainDiscAll", (void(Lua_Client::*)(void))&Lua_Client::UntrainDiscAll)
|
||||||
|
|||||||
@ -131,6 +131,7 @@ public:
|
|||||||
void MemSpell(int spell_id, int slot, bool update_client);
|
void MemSpell(int spell_id, int slot, bool update_client);
|
||||||
void UnmemSpell(int slot);
|
void UnmemSpell(int slot);
|
||||||
void UnmemSpell(int slot, bool update_client);
|
void UnmemSpell(int slot, bool update_client);
|
||||||
|
void UnmemSpellBySpellID(int32 spell_id);
|
||||||
void UnmemSpellAll();
|
void UnmemSpellAll();
|
||||||
void UnmemSpellAll(bool update_client);
|
void UnmemSpellAll(bool update_client);
|
||||||
void ScribeSpell(int spell_id, int slot);
|
void ScribeSpell(int spell_id, int slot);
|
||||||
@ -140,6 +141,8 @@ public:
|
|||||||
void UnscribeSpellAll();
|
void UnscribeSpellAll();
|
||||||
void UnscribeSpellAll(bool update_client);
|
void UnscribeSpellAll(bool update_client);
|
||||||
void TrainDisc(int itemid);
|
void TrainDisc(int itemid);
|
||||||
|
void TrainDiscBySpellID(int32 spell_id);
|
||||||
|
int GetDiscSlotBySpellID(int32 spell_id);
|
||||||
void UntrainDisc(int slot);
|
void UntrainDisc(int slot);
|
||||||
void UntrainDisc(int slot, bool update_client);
|
void UntrainDisc(int slot, bool update_client);
|
||||||
void UntrainDiscAll();
|
void UntrainDiscAll();
|
||||||
|
|||||||
@ -2445,6 +2445,30 @@ XS(XS_Client_UnmemSpell)
|
|||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XS(XS_Client_UnmemSpellBySpellID); /* prototype to pass -Wmissing-prototypes */
|
||||||
|
XS(XS_Client_UnmemSpellBySpellID)
|
||||||
|
{
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 2)
|
||||||
|
Perl_croak(aTHX_ "Usage: Client::UnmemSpellBySpellID(THIS, spell_id)");
|
||||||
|
{
|
||||||
|
Client * THIS;
|
||||||
|
int32 spell_id = (int32)SvIV(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.");
|
||||||
|
|
||||||
|
THIS->UnmemSpellBySpellID(spell_id);
|
||||||
|
}
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
XS(XS_Client_UnmemSpellAll); /* prototype to pass -Wmissing-prototypes */
|
XS(XS_Client_UnmemSpellAll); /* prototype to pass -Wmissing-prototypes */
|
||||||
XS(XS_Client_UnmemSpellAll)
|
XS(XS_Client_UnmemSpellAll)
|
||||||
{
|
{
|
||||||
@ -2568,6 +2592,57 @@ XS(XS_Client_UnscribeSpellAll)
|
|||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XS(XS_Client_TrainDiscBySpellID); /* prototype to pass -Wmissing-prototypes */
|
||||||
|
XS(XS_Client_TrainDiscBySpellID)
|
||||||
|
{
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 2)
|
||||||
|
Perl_croak(aTHX_ "Usage: Client::TrainDiscBySpellID(THIS, spell_id)");
|
||||||
|
{
|
||||||
|
Client * THIS;
|
||||||
|
int32 spell_id = (int32)SvIV(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.");
|
||||||
|
|
||||||
|
THIS->TrainDiscBySpellID(spell_id);
|
||||||
|
}
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
XS(XS_Client_GetDiscSlotBySpellID); /* prototype to pass -Wmissing-prototypes */
|
||||||
|
XS(XS_Client_GetDiscSlotBySpellID)
|
||||||
|
{
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 2)
|
||||||
|
Perl_croak(aTHX_ "Usage: Client::GetDiscSlotBySpellID(THIS, spell_id)");
|
||||||
|
{
|
||||||
|
Client * THIS;
|
||||||
|
int RETVAL;
|
||||||
|
int32 spell_id = (int32)SvIV(ST(1));
|
||||||
|
dXSTARG;
|
||||||
|
|
||||||
|
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.");
|
||||||
|
|
||||||
|
RETVAL = THIS->GetDiscSlotBySpellID(spell_id);
|
||||||
|
XSprePUSH; PUSHi((IV)RETVAL);
|
||||||
|
}
|
||||||
|
XSRETURN(1);
|
||||||
|
}
|
||||||
|
|
||||||
XS(XS_Client_UntrainDisc); /* prototype to pass -Wmissing-prototypes */
|
XS(XS_Client_UntrainDisc); /* prototype to pass -Wmissing-prototypes */
|
||||||
XS(XS_Client_UntrainDisc)
|
XS(XS_Client_UntrainDisc)
|
||||||
{
|
{
|
||||||
@ -6443,10 +6518,13 @@ XS(boot_Client)
|
|||||||
newXSproto(strcpy(buf, "ResetAA"), XS_Client_ResetAA, file, "$");
|
newXSproto(strcpy(buf, "ResetAA"), XS_Client_ResetAA, file, "$");
|
||||||
newXSproto(strcpy(buf, "MemSpell"), XS_Client_MemSpell, file, "$$$;$");
|
newXSproto(strcpy(buf, "MemSpell"), XS_Client_MemSpell, file, "$$$;$");
|
||||||
newXSproto(strcpy(buf, "UnmemSpell"), XS_Client_UnmemSpell, file, "$$;$");
|
newXSproto(strcpy(buf, "UnmemSpell"), XS_Client_UnmemSpell, file, "$$;$");
|
||||||
|
newXSproto(strcpy(buf, "UnmemSpellBySpellID"), XS_Client_UnmemSpellBySpellID, file, "$$");
|
||||||
newXSproto(strcpy(buf, "UnmemSpellAll"), XS_Client_UnmemSpellAll, file, "$;$");
|
newXSproto(strcpy(buf, "UnmemSpellAll"), XS_Client_UnmemSpellAll, file, "$;$");
|
||||||
newXSproto(strcpy(buf, "ScribeSpell"), XS_Client_ScribeSpell, file, "$$$;$");
|
newXSproto(strcpy(buf, "ScribeSpell"), XS_Client_ScribeSpell, file, "$$$;$");
|
||||||
newXSproto(strcpy(buf, "UnscribeSpell"), XS_Client_UnscribeSpell, file, "$$;$");
|
newXSproto(strcpy(buf, "UnscribeSpell"), XS_Client_UnscribeSpell, file, "$$;$");
|
||||||
newXSproto(strcpy(buf, "UnscribeSpellAll"), XS_Client_UnscribeSpellAll, file, "$;$");
|
newXSproto(strcpy(buf, "UnscribeSpellAll"), XS_Client_UnscribeSpellAll, file, "$;$");
|
||||||
|
newXSproto(strcpy(buf, "TrainDiscBySpellID"), XS_Client_TrainDiscBySpellID, file, "$$");
|
||||||
|
newXSproto(strcpy(buf, "GetDiscSlotBySpellID"), XS_Client_GetDiscSlotBySpellID, file, "$$");
|
||||||
newXSproto(strcpy(buf, "UntrainDisc"), XS_Client_UntrainDisc, file, "$$;$");
|
newXSproto(strcpy(buf, "UntrainDisc"), XS_Client_UntrainDisc, file, "$$;$");
|
||||||
newXSproto(strcpy(buf, "UntrainDiscAll"), XS_Client_UntrainDiscAll, file, "$;$");
|
newXSproto(strcpy(buf, "UntrainDiscAll"), XS_Client_UntrainDiscAll, file, "$;$");
|
||||||
newXSproto(strcpy(buf, "IsSitting"), XS_Client_IsSitting, file, "$");
|
newXSproto(strcpy(buf, "IsSitting"), XS_Client_IsSitting, file, "$");
|
||||||
|
|||||||
@ -4910,6 +4910,16 @@ void Client::UnmemSpell(int slot, bool update_client)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::UnmemSpellBySpellID(int32 spell_id)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < MAX_PP_MEMSPELL; i++) {
|
||||||
|
if(m_pp.mem_spells[i] == spell_id) {
|
||||||
|
UnmemSpell(i, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Client::UnmemSpellAll(bool update_client)
|
void Client::UnmemSpellAll(bool update_client)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user