Initial check-in of bard bot in combat song code.
This commit is contained in:
badcaptain
2013-10-11 23:43:38 -04:00
20 changed files with 86 additions and 73 deletions
+9 -5
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.
+1 -3
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")
+1 -1
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;
+28 -23
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;
}
-9
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;
-1
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);
+2 -2
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)
+11 -4
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);
+1 -1
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,