Initial check-in of bard bot in combat song code.
This commit is contained in:
badcaptain 2013-10-11 23:43:38 -04:00
commit 8ac4845930
20 changed files with 86 additions and 73 deletions

View File

@ -2,6 +2,21 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 10/11/2013 ==
Bad_Captain: Fixed merc crash issue by updating special_abilities & vwMercNpcTypes (Sorvani).
JJ: (demonstar55) Allow use of Go Home button when Tutorial still selected in RoF.
== 10/10/2013 ==
Secrets: Fixed zone shutdown (or #reloadqst) reinitalization of Perl. This should allow for Perl 5.14 and later to work on Windows under the new quest system.
demonstar55: Beneficial single target buffs shouldn't have their mana/timers set if they fail to cast after the Mob::SpellOnTarget call in Mob::SpellFinished
JJ: Revert change to EnterWorldPacket introduced on 22 April 2013 to fix inability to enter Tutorial or Go Home from character select screen.
== 10/09/2013 ==
demonstar55: Fixed some more instances of the AA timer being eaten
== 10/08/2013 ==
demonstar55: Added IsBuffSpell(spell_id) that will return true if the spell has a duration, so would end up in effects/song/discs etc windows on the client
demonstar55: Replaced instances of using CalcBuffDuration to determine if a spell was a buff with IsBuffSpell
demonstar55: Removed Mob::HasBuffIcon since it was doing what IsBuffSpell does in a more convoluted way with a rather misleading name
demonstar55: Fixed issues that arose from the 10/03/2013 change
== 10/05/2013 ==
Sorvani: fixed issue with stackable items being created with 0 charges cause by fix to SummonItems

View File

@ -987,6 +987,13 @@ bool IsSelfConversionSpell(uint16 spell_id) {
return false;
}
// returns true for both detrimental and beneficial buffs
bool IsBuffSpell(uint16 spell_id) {
if(IsValidSpell(spell_id) && (spells[spell_id].buffduration || spells[spell_id].buffdurationformula))
return true;
return false;
}
uint32 GetMorphTrigger(uint32 spell_id)
{
for(int i = 0; i < EFFECT_COUNT; ++i)

View File

@ -792,6 +792,7 @@ bool IsGroupHealOverTimeSpell(uint16 spell_id);
bool IsDebuffSpell(uint16 spell_id);
bool IsResistDebuffSpell(uint16 spell_id);
bool IsSelfConversionSpell(uint16 spell_id);
bool IsBuffSpell(uint16 spell_id);
uint32 GetMorphTrigger(uint32 spell_id);
uint32 GetPartialMeleeRuneReduction(uint32 spell_id);
uint32 GetPartialMagicRuneReduction(uint32 spell_id);

View File

@ -27,9 +27,7 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(eqlaunch "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(eqlaunch "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(eqlaunch "z")
TARGET_LINK_LIBRARIES(eqlaunch "m")
TARGET_LINK_LIBRARIES(eqlaunch "rt")

View File

@ -55,9 +55,7 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(loginserver "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(loginserver "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(loginserver "z")
TARGET_LINK_LIBRARIES(loginserver "m")
TARGET_LINK_LIBRARIES(loginserver "rt")

View File

@ -33,9 +33,7 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(queryserv "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(queryserv "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(queryserv "z")
TARGET_LINK_LIBRARIES(queryserv "m")
TARGET_LINK_LIBRARIES(queryserv "rt")

View File

@ -33,9 +33,7 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(shared_memory "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(shared_memory "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(shared_memory "z")
TARGET_LINK_LIBRARIES(shared_memory "m")
TARGET_LINK_LIBRARIES(shared_memory "rt")

View File

@ -27,7 +27,7 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(tests "dl")
TARGET_LINK_LIBRARIES(tests "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(tests "z")
TARGET_LINK_LIBRARIES(tests "m")
TARGET_LINK_LIBRARIES(tests "rt")

View File

@ -35,10 +35,7 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(ucs "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(ucs "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(ucs "z")
TARGET_LINK_LIBRARIES(ucs "m")
TARGET_LINK_LIBRARIES(ucs "rt")

View File

@ -81,10 +81,7 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(world "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(world "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(world "z")
TARGET_LINK_LIBRARIES(world "m")
TARGET_LINK_LIBRARIES(world "rt")

View File

@ -709,7 +709,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
return true;
}
if(!pZoning && ew->return_home)
if(!pZoning && ew->return_home && !ew->tutorial)
{
CharacterSelect_Struct* cs = new CharacterSelect_Struct;
memset(cs, 0, sizeof(CharacterSelect_Struct));
@ -723,7 +723,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if(cs->gohome[x] == 1)
{
home_enabled = true;
return true;
break;
}
}
}
@ -755,7 +755,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if(cs->tutorial[x] == 1)
{
tutorial_enabled = true;
return true;
break;
}
}
}

View File

@ -262,7 +262,6 @@ void Client::ActivateAA(aaID activate){
}
SetMana(GetMana() - caa->mana_cost);
}
HandleAAAction(aaid);
if(caa->reuse_time > 0)
{
uint32 timer_base = CalcAAReuseTimer(caa);
@ -273,6 +272,7 @@ void Client::ActivateAA(aaID activate){
p_timers.Start(AATimerID + pTimerAAStart, timer_base);
SendAATimer(AATimerID, 0, 0);
}
HandleAAAction(aaid);
}
//cast the spell, if we have one
@ -531,10 +531,14 @@ void Client::HandleAAAction(aaID activate) {
}
//cast the spell, if we have one
if(spell_id > 0 && spell_id < SPDAT_RECORDS) {
//I dont know when we need to mem and when we do not, if ever...
//MemorizeSpell(8, spell_id, 3);
CastSpell(spell_id, target_id);
if(IsValidSpell(spell_id)) {
int aatid = GetAATimerID(activate);
if(!CastSpell(spell_id, target_id , 10, -1, -1, 0, -1, pTimerAAStart + aatid , CalcAAReuseTimer(caa), 1)) {
SendAATimer(aatid, 0, 0xFFFFFF);
Message_StringID(15,ABILITY_FAILED);
p_timers.Clear(&database, pTimerAAStart + aatid);
return;
}
}
//handle the duration timer if we have one.

View File

@ -223,9 +223,7 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(zone "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(zone "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(zone "z")
TARGET_LINK_LIBRARIES(zone "m")
TARGET_LINK_LIBRARIES(zone "rt")

View File

@ -9329,7 +9329,7 @@ int32 Bot::GetActSpellCasttime(uint16 spell_id, int32 casttime) {
|| botclass == PALADIN || botclass == BEASTLORD ))
cast_reducer += (GetLevel()-50)*3;
if((casttime >= 4000) && BeneficialSpell(spell_id) && ((CalcBuffDuration(this,this,spell_id)-1) > 0)) {
if((casttime >= 4000) && BeneficialSpell(spell_id) && IsBuffSpell(spell_id)) {
switch (GetAA(aaSpellCastingDeftness)) {
case 1:
cast_reducer += 5;

View File

@ -43,6 +43,17 @@ EXTERN_C XS(boot_PerlPacket);
XS(XS_EQEmuIO_PRINT);
#endif //EMBPERL_IO_CAPTURE
const char *argv_eqemu[] = { "",
#ifdef EMBPERL_IO_CAPTURE
"-w", "-W",
#endif
"-e", "0;", nullptr };
#ifdef EMBPERL_IO_CAPTURE
int argc = 5;
#else
int argc = 3;
#endif
//so embedded scripts can use xs extensions (ala 'use socket;')
EXTERN_C void boot_DynaLoader(pTHX_ CV* cv);
EXTERN_C void xs_init(pTHX)
@ -85,38 +96,25 @@ EXTERN_C void xs_init(pTHX)
Embperl::Embperl()
{
char **argv = (char **)argv_eqemu;
char **env = { nullptr };
in_use = true; //in case one of these files generates an event
//setup perl...
my_perl = perl_alloc();
if(!my_perl)
throw "Failed to init Perl (perl_alloc)";
PERL_SYS_INIT3(&argc, &argv, &env);
DoInit();
}
void Embperl::DoInit() {
const char *argv_eqemu[] = { "",
#ifdef EMBPERL_IO_CAPTURE
"-w", "-W",
#endif
"-e", "0;", nullptr };
int argc = 3;
#ifdef EMBPERL_IO_CAPTURE
argc = 5;
#endif
char **argv = (char **)argv_eqemu;
char **env = { nullptr };
my_perl = perl_alloc();
//setup perl...
if(!my_perl)
throw "Failed to init Perl (perl_alloc)";
PERL_SET_CONTEXT(my_perl);
PERL_SET_INTERP(my_perl);
PL_perl_destruct_level = 1;
perl_construct(my_perl);
PERL_SYS_INIT3(&argc, &argv, &env);
perl_parse(my_perl, xs_init, argc, argv, env);
perl_parse(my_perl, xs_init, argc, argv, nullptr);
perl_run(my_perl);
//a little routine we use a lot.
@ -213,12 +211,19 @@ Embperl::~Embperl()
,FALSE);
#endif
perl_free(my_perl);
PERL_SYS_TERM();
my_perl = NULL;
}
void Embperl::Reinit() {
in_use = true;
PERL_SET_CONTEXT(my_perl);
PERL_SET_INTERP(my_perl);
PL_perl_destruct_level = 1;
perl_destruct(my_perl);
perl_free(my_perl);
my_perl = NULL;
//Now reinit...
DoInit();
in_use = false;
}

View File

@ -3033,15 +3033,6 @@ void Mob::SetDeltas(float dx, float dy, float dz, float dh) {
delta_heading = static_cast<int>(dh);
}
bool Mob::HasBuffIcon(Mob *caster, Mob *target, uint16 spell_id)
{
if((caster->CalcBuffDuration(caster, target, spell_id)-1) > 0)
return true;
else
return false;
}
void Mob::SetEntityVariable(const char *id, const char *m_var)
{
std::string n_m_var = m_var;

View File

@ -241,7 +241,6 @@ public:
int16 GetBuffSlotFromType(uint16 type);
uint16 GetSpellIDFromSlot(uint8 slot);
int CountDispellableBuffs();
bool HasBuffIcon(Mob* caster, Mob* target, uint16 spell_id);
bool CheckHitsRemaining(uint32 buff_slot, bool when_spell_done=false, bool negate=false,uint16 type=0,
uint16 spell_id=0, bool use_skill=false,uint16 skill=0);
void SpreadVirus(uint16 spell_id, uint16 casterID);

View File

@ -82,7 +82,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
if(c_override)
{
int durat = CalcBuffDuration(caster, this, spell_id, caster_level);
if((durat-1) > 0)
if(durat > 0)
{
buffslot = AddBuff(caster, spell_id, durat, caster_level);
if(buffslot == -1) // stacking failure
@ -95,7 +95,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
}
else
{
if((CalcBuffDuration(caster,this,spell_id)-1) > 0){
if(IsBuffSpell(spell_id)){
if(IsEffectInSpell(spell_id, SE_BindSight))
{
if(caster)

View File

@ -1818,7 +1818,13 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
if (isproc) {
SpellOnTarget(spell_id, spell_target, false, true, resist_adjust, true);
} else {
SpellOnTarget(spell_id, spell_target, false, true, resist_adjust, false);
if(!SpellOnTarget(spell_id, spell_target, false, true, resist_adjust, false)) {
if(IsBuffSpell(spell_id) && IsBeneficialSpell(spell_id)) {
// Prevent mana usage/timers being set for beneficial buffs
InterruptSpell();
return false;
}
}
}
if(IsPlayerIllusionSpell(spell_id)
&& IsClient()
@ -2257,7 +2263,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) {
{
if(IsClient())
{
if(HasBuffIcon(caster, this, spell_id) == false)
if(!IsBuffSpell(spell_id))
{
CastToClient()->SetKnockBackExemption(true);
@ -3478,7 +3484,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
// if SpellEffect returned false there's a problem applying the
// spell. It's most likely a buff that can't stack.
mlog(SPELLS__CASTING_ERR, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName());
Message_StringID(MT_Shout, SPELL_NO_HOLD);
if(casting_spell_type != 1) // AA is handled differently
Message_StringID(MT_Shout, SPELL_NO_HOLD);
safe_delete(action_packet);
return false;
}
@ -3497,7 +3504,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
{
if(spelltar->IsClient())
{
if(HasBuffIcon(this, spelltar, spell_id) == false)
if(!IsBuffSpell(spell_id))
{
spelltar->CastToClient()->SetKnockBackExemption(true);

View File

@ -217,7 +217,7 @@ public:
bool GetAccountInfoForLogin(uint32 account_id, int16* admin = 0, char* account_name = 0,
uint32* lsaccountid = 0, uint8* gmspeed = 0, bool* revoked = 0, bool* gmhideme = 0);
bool GetAccountInfoForLogin_result(MYSQL_RES* result, int16* admin = 0, char* account_name = 0,
uint32* lsaccountid = 0, uint8* gmspeed = 0, bool* revoked = 0, bool* gmhideme = false,
uint32* lsaccountid = 0, uint8* gmspeed = 0, bool* revoked = 0, bool* gmhideme = nullptr,
uint32* account_creation = 0);
bool GetCharacterInfoForLogin_result(MYSQL_RES* result, uint32* character_id = 0, char* current_zone = 0,
PlayerProfile_Struct* pp = 0, Inventory* inv = 0, ExtendedProfile_Struct *ext = 0, uint32* pplen = 0,