Many lua things many many things

This commit is contained in:
KimLS 2017-05-19 22:50:08 -07:00
parent 4067397697
commit 7189994b78
28 changed files with 500 additions and 599 deletions

View File

@ -1307,16 +1307,6 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
// IsFromSpell added to allow spell effects to use Attack. (Mainly for the Rampage AA right now.)
bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts)
{
#ifdef LUA_EQEMU
bool lua_ret = false;
bool ignoreDefault = false;
lua_ret = LuaParser::Instance()->ClientAttack(this, other, Hand, bRiposte, IsStrikethrough, IsFromSpell, opts, ignoreDefault);
if (ignoreDefault) {
return lua_ret;
}
#endif
if (!other) {
SetTarget(nullptr);
Log(Logs::General, Logs::Error, "A null Mob object was passed to Client::Attack() for evaluation!");
@ -1840,16 +1830,6 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::Sk
bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts)
{
#ifdef LUA_EQEMU
bool lua_ret = false;
bool ignoreDefault = false;
lua_ret = LuaParser::Instance()->NPCAttack(this, other, Hand, bRiposte, IsStrikethrough, IsFromSpell, opts, ignoreDefault);
if (ignoreDefault) {
return lua_ret;
}
#endif
if (!other) {
SetTarget(nullptr);
Log(Logs::General, Logs::Error, "A null Mob object was passed to NPC::Attack() for evaluation!");
@ -4118,7 +4098,7 @@ void Mob::TryPetCriticalHit(Mob *defender, DamageHitInfo &hit)
if (critChance > 0) {
if (zone->random.Roll(critChance)) {
critMod += GetCritDmgMob(hit.skill);
critMod += GetCritDmgMod(hit.skill);
hit.damage_done += 5;
hit.damage_done = (hit.damage_done * critMod) / 100;
@ -4139,6 +4119,15 @@ void Mob::TryPetCriticalHit(Mob *defender, DamageHitInfo &hit)
void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts)
{
#ifdef LUA_EQEMU
bool ignoreDefault = false;
LuaParser::Instance()->TryCriticalHit(this, defender, hit, opts, ignoreDefault);
if (ignoreDefault) {
return;
}
#endif
if (hit.damage_done < 1 || !defender)
return;
@ -4247,7 +4236,11 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
// step 2: calculate damage
hit.damage_done = std::max(hit.damage_done, hit.base_damage) + 5;
int og_damage = hit.damage_done;
int crit_mod = 170 + GetCritDmgMob(hit.skill);
int crit_mod = 170 + GetCritDmgMod(hit.skill);
if (crit_mod < 100) {
crit_mod = 100;
}
hit.damage_done = hit.damage_done * crit_mod / 100;
Log(Logs::Detail, Logs::Combat,
"Crit success roll %d dex chance %d og dmg %d crit_mod %d new dmg %d", roll, dex_bonus,

View File

@ -1084,9 +1084,9 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
break;
// base1 = effect value, base2 = skill restrictions(-1 for all)
if (base2 == ALL_SKILLS)
newbon->CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] += base1;
newbon->CritDmgMod[EQEmu::skills::HIGHEST_SKILL + 1] += base1;
else
newbon->CritDmgMob[base2] += base1;
newbon->CritDmgMod[base2] += base1;
break;
}
@ -2441,9 +2441,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
if (base2 > EQEmu::skills::HIGHEST_SKILL)
break;
if(base2 == ALL_SKILLS)
new_bonus->CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] += effect_value;
new_bonus->CritDmgMod[EQEmu::skills::HIGHEST_SKILL + 1] += effect_value;
else
new_bonus->CritDmgMob[base2] += effect_value;
new_bonus->CritDmgMod[base2] += effect_value;
break;
}
@ -4203,9 +4203,9 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
{
for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++)
{
spellbonuses.CritDmgMob[e] = effect_value;
aabonuses.CritDmgMob[e] = effect_value;
itembonuses.CritDmgMob[e] = effect_value;
spellbonuses.CritDmgMod[e] = effect_value;
aabonuses.CritDmgMod[e] = effect_value;
itembonuses.CritDmgMod[e] = effect_value;
}
break;
}

View File

@ -1255,6 +1255,37 @@ void Client::Message(uint32 type, const char* message, ...) {
safe_delete_array(buffer);
}
void Client::FilteredMessage(Mob *sender, uint32 type, eqFilterType filter, const char* message, ...) {
if (!FilteredMessageCheck(sender, filter))
return;
va_list argptr;
auto buffer = new char[4096];
va_start(argptr, message);
vsnprintf(buffer, 4096, message, argptr);
va_end(argptr);
size_t len = strlen(buffer);
//client dosent like our packet all the time unless
//we make it really big, then it seems to not care that
//our header is malformed.
//len = 4096 - sizeof(SpecialMesg_Struct);
uint32 len_packet = sizeof(SpecialMesg_Struct) + len;
auto app = new EQApplicationPacket(OP_SpecialMesg, len_packet);
SpecialMesg_Struct* sm = (SpecialMesg_Struct*)app->pBuffer;
sm->header[0] = 0x00; // Header used for #emote style messages..
sm->header[1] = 0x00; // Play around with these to see other types
sm->header[2] = 0x00;
sm->msg_type = type;
memcpy(sm->message, buffer, len + 1);
FastQueuePacket(&app);
safe_delete_array(buffer);
}
void Client::QuestJournalledMessage(const char *npcname, const char* message) {
// npcnames longer than 60 characters crash the client when they log back in

View File

@ -308,6 +308,7 @@ public:
void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...);
void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...);
void Message(uint32 type, const char* message, ...);
void FilteredMessage(Mob *sender, uint32 type, eqFilterType filter, const char* message, ...);
void QuestJournalledMessage(const char *npcname, const char* message);
void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber);
void SendSound();
@ -1260,6 +1261,8 @@ public:
void CheckRegionTypeChanges();
int32 CalcATK();
protected:
friend class Mob;
void CalcItemBonuses(StatBonuses* newbon);
@ -1319,7 +1322,6 @@ private:
void HandleTraderPriceUpdate(const EQApplicationPacket *app);
int32 CalcATK();
int32 CalcItemATKCap();
int32 CalcHaste();

View File

@ -408,7 +408,7 @@ struct StatBonuses {
uint32 SpellTriggers[MAX_SPELL_TRIGGER]; // Innate/Spell/Item Spells that trigger when you cast
uint32 SpellOnKill[MAX_SPELL_TRIGGER*3]; // Chance to proc after killing a mob
uint32 SpellOnDeath[MAX_SPELL_TRIGGER*2]; // Chance to have effect cast when you die
int32 CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 2]; // All Skills + -1
int32 CritDmgMod[EQEmu::skills::HIGHEST_SKILL + 2]; // All Skills + -1
int32 SkillReuseTime[EQEmu::skills::HIGHEST_SKILL + 1]; // Reduces skill timers
int32 SkillDamageAmount[EQEmu::skills::HIGHEST_SKILL + 2]; // All Skills + -1
int32 TwoHandBluntBlock; // chance to block when wielding two hand blunt weapon

View File

@ -2135,6 +2135,25 @@ void EntityList::MessageClose(Mob* sender, bool skipsender, float dist, uint32 t
}
}
void EntityList::FilteredMessageClose(Mob *sender, bool skipsender, float dist, uint32 type, eqFilterType filter, const char *message, ...)
{
va_list argptr;
char buffer[4096];
va_start(argptr, message);
vsnprintf(buffer, 4095, message, argptr);
va_end(argptr);
float dist2 = dist * dist;
auto it = client_list.begin();
while (it != client_list.end()) {
if (DistanceSquared(it->second->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || it->second != sender))
it->second->FilteredMessage(sender, type, filter, buffer);
++it;
}
}
void EntityList::RemoveAllMobs()
{
auto it = mob_list.begin();

View File

@ -79,6 +79,7 @@ public:
virtual bool IsTrap() const { return false; }
virtual bool IsBeacon() const { return false; }
virtual bool IsEncounter() const { return false; }
virtual bool IsBot() const { return false; }
virtual bool Process() { return false; }
virtual bool Save() { return true; }
@ -113,7 +114,6 @@ public:
bool CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z, float trg_x, float trg_y, float trg_z, float perwalk=1);
#ifdef BOTS
virtual bool IsBot() const { return false; }
Bot* CastToBot();
#endif
@ -315,6 +315,7 @@ public:
void Message(uint32 to_guilddbid, uint32 type, const char* message, ...);
void MessageStatus(uint32 to_guilddbid, int to_minstatus, uint32 type, const char* message, ...);
void MessageClose(Mob* sender, bool skipsender, float dist, uint32 type, const char* message, ...);
void FilteredMessageClose(Mob* sender, bool skipsender, float dist, uint32 type, eqFilterType filter, const char* message, ...);
void Message_StringID(Mob *sender, bool skipsender, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
void FilteredMessage_StringID(Mob *sender, bool skipsender, uint32 type, eqFilterType filter, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
void MessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);

View File

@ -1424,6 +1424,22 @@ bool Lua_Client::IsDead() {
return self->IsDead();
}
int Lua_Client::CalcCurrentWeight() {
Lua_Safe_Call_Int();
return self->CalcCurrentWeight();
}
int Lua_Client::CalcATK() {
Lua_Safe_Call_Int();
return self->CalcATK();
}
void Lua_Client::FilteredMessage(Mob *sender, uint32 type, int filter, const char *message)
{
Lua_Safe_Call_Void();
self->FilteredMessage(sender, type, (eqFilterType)filter, message);
}
luabind::scope lua_register_client() {
return luabind::class_<Lua_Client, Lua_Mob>("Client")
.def(luabind::constructor<>())
@ -1693,7 +1709,10 @@ luabind::scope lua_register_client() {
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32, bool))&Lua_Client::QuestReward)
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, luabind::adl::object))&Lua_Client::QuestReward)
.def("IsDead", &Lua_Client::IsDead);
.def("IsDead", &Lua_Client::IsDead)
.def("CalcCurrentWeight", &Lua_Client::CalcCurrentWeight)
.def("CalcATK", &Lua_Client::CalcATK)
.def("FilteredMessage", &Lua_Client::FilteredMessage);
}
luabind::scope lua_register_inventory_where() {

View File

@ -298,6 +298,9 @@ public:
void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, bool faction);
void QuestReward(Lua_Mob target, luabind::adl::object reward);
bool IsDead();
int CalcCurrentWeight();
int CalcATK();
void FilteredMessage(Mob *sender, uint32 type, int filter, const char* message);
};
#endif

View File

@ -67,6 +67,16 @@ bool Lua_Entity::IsBeacon() {
return self->IsBeacon();
}
bool Lua_Entity::IsEncounter() {
Lua_Safe_Call_Bool();
return self->IsEncounter();
}
bool Lua_Entity::IsBot() {
Lua_Safe_Call_Bool();
return self->IsBot();
}
int Lua_Entity::GetID() {
Lua_Safe_Call_Bool();
return self->GetID();
@ -124,6 +134,8 @@ luabind::scope lua_register_entity() {
.def("IsDoor", &Lua_Entity::IsDoor)
.def("IsTrap", &Lua_Entity::IsTrap)
.def("IsBeacon", &Lua_Entity::IsBeacon)
.def("IsEncounter", &Lua_Entity::IsEncounter)
.def("IsBot", &Lua_Entity::IsBot)
.def("GetID", &Lua_Entity::GetID)
.def("CastToClient", &Lua_Entity::CastToClient)
.def("CastToNPC", &Lua_Entity::CastToNPC)

View File

@ -44,6 +44,8 @@ public:
bool IsDoor();
bool IsTrap();
bool IsBeacon();
bool IsEncounter();
bool IsBot();
int GetID();
Lua_Client CastToClient();

View File

@ -210,6 +210,12 @@ void Lua_EntityList::MessageClose(Lua_Mob sender, bool skip_sender, float dist,
self->MessageClose(sender, skip_sender, dist, type, message);
}
void Lua_EntityList::FilteredMessageClose(Lua_Mob sender, bool skip_sender, float dist, uint32 type, int filter, const char *message)
{
Lua_Safe_Call_Void();
self->FilteredMessageClose(sender, skip_sender, dist, type, (eqFilterType)filter, message);
}
void Lua_EntityList::RemoveFromTargets(Lua_Mob mob) {
Lua_Safe_Call_Void();
self->RemoveFromTargets(mob);
@ -450,16 +456,17 @@ luabind::scope lua_register_entity_list() {
.def("GetSpawnByID", (Lua_Spawn(Lua_EntityList::*)(uint32))&Lua_EntityList::GetSpawnByID)
.def("ClearClientPetitionQueue", (void(Lua_EntityList::*)(void))&Lua_EntityList::ClearClientPetitionQueue)
.def("CanAddHateForMob", (bool(Lua_EntityList::*)(Lua_Mob))&Lua_EntityList::CanAddHateForMob)
.def("Message", (void(Lua_EntityList::*)(uint32,uint32,const char*))&Lua_EntityList::Message)
.def("MessageStatus", (void(Lua_EntityList::*)(uint32,uint32,uint32,const char*))&Lua_EntityList::MessageStatus)
.def("MessageClose", (void(Lua_EntityList::*)(Lua_Mob,bool,float,uint32,const char*))&Lua_EntityList::MessageClose)
.def("Message", (void(Lua_EntityList::*)(uint32, uint32, const char*))&Lua_EntityList::Message)
.def("MessageStatus", (void(Lua_EntityList::*)(uint32, uint32, uint32, const char*))&Lua_EntityList::MessageStatus)
.def("MessageClose", (void(Lua_EntityList::*)(Lua_Mob, bool, float, uint32, const char*))&Lua_EntityList::MessageClose)
.def("FilteredMessageClose", &Lua_EntityList::FilteredMessageClose)
.def("RemoveFromTargets", (void(Lua_EntityList::*)(Lua_Mob))&Lua_EntityList::RemoveFromTargets)
.def("RemoveFromTargets", (void(Lua_EntityList::*)(Lua_Mob,bool))&Lua_EntityList::RemoveFromTargets)
.def("ReplaceWithTarget", (void(Lua_EntityList::*)(Lua_Mob,Lua_Mob))&Lua_EntityList::ReplaceWithTarget)
.def("RemoveFromTargets", (void(Lua_EntityList::*)(Lua_Mob, bool))&Lua_EntityList::RemoveFromTargets)
.def("ReplaceWithTarget", (void(Lua_EntityList::*)(Lua_Mob, Lua_Mob))&Lua_EntityList::ReplaceWithTarget)
.def("OpenDoorsNear", (void(Lua_EntityList::*)(Lua_NPC))&Lua_EntityList::OpenDoorsNear)
.def("MakeNameUnique", (std::string(Lua_EntityList::*)(const char*))&Lua_EntityList::MakeNameUnique)
.def("RemoveNumbers", (std::string(Lua_EntityList::*)(const char*))&Lua_EntityList::RemoveNumbers)
.def("SignalMobsByNPCID", (void(Lua_EntityList::*)(uint32,int))&Lua_EntityList::SignalMobsByNPCID)
.def("SignalMobsByNPCID", (void(Lua_EntityList::*)(uint32, int))&Lua_EntityList::SignalMobsByNPCID)
.def("DeleteNPCCorpses", (int(Lua_EntityList::*)(void))&Lua_EntityList::DeleteNPCCorpses)
.def("DeletePlayerCorpses", (int(Lua_EntityList::*)(void))&Lua_EntityList::DeletePlayerCorpses)
.def("HalveAggro", (void(Lua_EntityList::*)(Lua_Mob))&Lua_EntityList::HalveAggro)
@ -467,10 +474,10 @@ luabind::scope lua_register_entity_list() {
.def("ClearFeignAggro", (void(Lua_EntityList::*)(Lua_Mob))&Lua_EntityList::ClearFeignAggro)
.def("Fighting", (bool(Lua_EntityList::*)(Lua_Mob))&Lua_EntityList::Fighting)
.def("RemoveFromHateLists", (void(Lua_EntityList::*)(Lua_Mob))&Lua_EntityList::RemoveFromHateLists)
.def("RemoveFromHateLists", (void(Lua_EntityList::*)(Lua_Mob,bool))&Lua_EntityList::RemoveFromHateLists)
.def("MessageGroup", (void(Lua_EntityList::*)(Lua_Mob,bool,uint32,const char*))&Lua_EntityList::MessageGroup)
.def("GetRandomClient", (Lua_Client(Lua_EntityList::*)(float,float,float,float))&Lua_EntityList::GetRandomClient)
.def("GetRandomClient", (Lua_Client(Lua_EntityList::*)(float,float,float,float,Lua_Client))&Lua_EntityList::GetRandomClient)
.def("RemoveFromHateLists", (void(Lua_EntityList::*)(Lua_Mob, bool))&Lua_EntityList::RemoveFromHateLists)
.def("MessageGroup", (void(Lua_EntityList::*)(Lua_Mob, bool, uint32, const char*))&Lua_EntityList::MessageGroup)
.def("GetRandomClient", (Lua_Client(Lua_EntityList::*)(float, float, float, float))&Lua_EntityList::GetRandomClient)
.def("GetRandomClient", (Lua_Client(Lua_EntityList::*)(float, float, float, float, Lua_Client))&Lua_EntityList::GetRandomClient)
.def("GetMobList", (Lua_Mob_List(Lua_EntityList::*)(void))&Lua_EntityList::GetMobList)
.def("GetClientList", (Lua_Client_List(Lua_EntityList::*)(void))&Lua_EntityList::GetClientList)
.def("GetNPCList", (Lua_NPC_List(Lua_EntityList::*)(void))&Lua_EntityList::GetNPCList)
@ -479,7 +486,7 @@ luabind::scope lua_register_entity_list() {
.def("GetDoorsList", (Lua_Doors_List(Lua_EntityList::*)(void))&Lua_EntityList::GetDoorsList)
.def("GetSpawnList", (Lua_Spawn_List(Lua_EntityList::*)(void))&Lua_EntityList::GetSpawnList)
.def("SignalAllClients", (void(Lua_EntityList::*)(int))&Lua_EntityList::SignalAllClients)
.def("ChannelMessage", (void(Lua_EntityList::*)(Lua_Mob,int,int,const char*))&Lua_EntityList::ChannelMessage);
.def("ChannelMessage", (void(Lua_EntityList::*)(Lua_Mob, int, int, const char*))&Lua_EntityList::ChannelMessage);
}
luabind::scope lua_register_mob_list() {

View File

@ -80,6 +80,7 @@ public:
void Message(uint32 guild_dbid, uint32 type, const char *message);
void MessageStatus(uint32 guild_dbid, int min_status, uint32 type, const char *message);
void MessageClose(Lua_Mob sender, bool skip_sender, float dist, uint32 type, const char *message);
void FilteredMessageClose(Lua_Mob sender, bool skip_sender, float dist, uint32 type, int filter, const char *message);
void RemoveFromTargets(Lua_Mob mob);
void RemoveFromTargets(Lua_Mob mob, bool RemoveFromXTargets);
void ReplaceWithTarget(Lua_Mob target, Lua_Mob new_target);

View File

@ -29,6 +29,10 @@ struct Materials { };
struct ClientVersions { };
struct Appearances { };
struct Classes { };
struct Skills { };
struct BodyTypes { };
struct Filters { };
struct MessageTypes { };
struct lua_registered_event {
std::string encounter_name;
@ -1893,55 +1897,311 @@ luabind::scope lua_register_appearance() {
}
luabind::scope lua_register_classes() {
return luabind::class_<Classes>("Classes")
return luabind::class_<Classes>("Class")
.enum_("constants")
[
luabind::value("Warrior", WARRIOR),
luabind::value("Cleric", CLERIC),
luabind::value("Paladin", PALADIN),
luabind::value("Ranger", RANGER),
luabind::value("ShadowKnight", SHADOWKNIGHT),
luabind::value("Druid", DRUID),
luabind::value("Monk", MONK),
luabind::value("Bard", BARD),
luabind::value("Rogue", ROGUE),
luabind::value("Shaman", SHAMAN),
luabind::value("Necromancer", NECROMANCER),
luabind::value("Wizard", WIZARD),
luabind::value("Magician", MAGICIAN),
luabind::value("Enchanter", ENCHANTER),
luabind::value("Beastlord", BEASTLORD),
luabind::value("Berserker", BERSERKER),
luabind::value("WarriorGM", WARRIORGM),
luabind::value("ClericGM", CLERICGM),
luabind::value("PaladinGM", PALADINGM),
luabind::value("RangerGM", RANGERGM),
luabind::value("ShadowKnightGM", SHADOWKNIGHTGM),
luabind::value("DruidGM", DRUIDGM),
luabind::value("MonkGM", MONKGM),
luabind::value("BardGM", BARDGM),
luabind::value("RogueGM", ROGUEGM),
luabind::value("ShamanGM", SHAMANGM),
luabind::value("NecromancerGM", NECROMANCERGM),
luabind::value("WizardGM", WIZARDGM),
luabind::value("MagicianGM", MAGICIANGM),
luabind::value("EnchanterGM", ENCHANTERGM),
luabind::value("BeastlordGM", BEASTLORDGM),
luabind::value("BerserkerGM", BERSERKERGM),
luabind::value("Banker", BANKER),
luabind::value("Merchant", MERCHANT),
luabind::value("DiscordMerchant", DISCORD_MERCHANT),
luabind::value("AdventureRecruiter", ADVENTURERECRUITER),
luabind::value("AdventureMerchant", ADVENTUREMERCHANT),
luabind::value("LDONTreasure", LDON_TREASURE),
luabind::value("CorpseClass", CORPSE_CLASS),
luabind::value("TributeMaster", TRIBUTE_MASTER),
luabind::value("GuildTributeMaster", GUILD_TRIBUTE_MASTER),
luabind::value("NorrathsKeeperMerchant", NORRATHS_KEEPERS_MERCHANT),
luabind::value("DarkReignMerchant", DARK_REIGN_MERCHANT),
luabind::value("FellowshipMaster", FELLOWSHIP_MASTER),
luabind::value("AltCurrencyMerchant", ALT_CURRENCY_MERCHANT),
luabind::value("MercenaryMaster", MERCERNARY_MASTER)
luabind::value("WARRIOR", WARRIOR),
luabind::value("CLERIC", CLERIC),
luabind::value("PALADIN", PALADIN),
luabind::value("RANGER", RANGER),
luabind::value("SHADOWKNIGHT", SHADOWKNIGHT),
luabind::value("DRUID", DRUID),
luabind::value("MONK", MONK),
luabind::value("BARD", BARD),
luabind::value("ROGUE", ROGUE),
luabind::value("SHAMAN", SHAMAN),
luabind::value("NECROMANCER", NECROMANCER),
luabind::value("WIZARD", WIZARD),
luabind::value("MAGICIAN", MAGICIAN),
luabind::value("ENCHANTER", ENCHANTER),
luabind::value("BEASTLORD", BEASTLORD),
luabind::value("BERSERKER", BERSERKER),
luabind::value("WARRIORGM", WARRIORGM),
luabind::value("CLERICGM", CLERICGM),
luabind::value("PALADINGM", PALADINGM),
luabind::value("RANGERGM", RANGERGM),
luabind::value("SHADOWKNIGHTGM", SHADOWKNIGHTGM),
luabind::value("DRUIDGM", DRUIDGM),
luabind::value("MONKGM", MONKGM),
luabind::value("BARDGM", BARDGM),
luabind::value("ROGUEGM", ROGUEGM),
luabind::value("SHAMANGM", SHAMANGM),
luabind::value("NECROMANCERGM", NECROMANCERGM),
luabind::value("WIZARDGM", WIZARDGM),
luabind::value("MAGICIANGM", MAGICIANGM),
luabind::value("ENCHANTERGM", ENCHANTERGM),
luabind::value("BEASTLORDGM", BEASTLORDGM),
luabind::value("BERSERKERGM", BERSERKERGM),
luabind::value("BANKER", BANKER),
luabind::value("MERCHANT", MERCHANT),
luabind::value("DISCORD_MERCHANT", DISCORD_MERCHANT),
luabind::value("ADVENTURERECRUITER", ADVENTURERECRUITER),
luabind::value("ADVENTUREMERCHANT", ADVENTUREMERCHANT),
luabind::value("LDON_TREASURE", LDON_TREASURE),
luabind::value("CORPSE_CLASS", CORPSE_CLASS),
luabind::value("TRIBUTE_MASTER", TRIBUTE_MASTER),
luabind::value("GUILD_TRIBUTE_MASTER", GUILD_TRIBUTE_MASTER),
luabind::value("NORRATHS_KEEPERS_MERCHANT", NORRATHS_KEEPERS_MERCHANT),
luabind::value("DARK_REIGN_MERCHANT", DARK_REIGN_MERCHANT),
luabind::value("FELLOWSHIP_MASTER", FELLOWSHIP_MASTER),
luabind::value("ALT_CURRENCY_MERCHANT", ALT_CURRENCY_MERCHANT),
luabind::value("MERCERNARY_MASTER", MERCERNARY_MASTER)
];
}
luabind::scope lua_register_skills() {
return luabind::class_<Skills>("Skill")
.enum_("constants")
[
luabind::value("1HBlunt", EQEmu::skills::Skill1HBlunt),
luabind::value("1HSlashing", EQEmu::skills::Skill1HSlashing),
luabind::value("2HBlunt", EQEmu::skills::Skill2HBlunt),
luabind::value("2HSlashing", EQEmu::skills::Skill2HSlashing),
luabind::value("Abjuration", EQEmu::skills::SkillAbjuration),
luabind::value("Alteration", EQEmu::skills::SkillAlteration),
luabind::value("ApplyPoison", EQEmu::skills::SkillApplyPoison),
luabind::value("Archery", EQEmu::skills::SkillArchery),
luabind::value("Backstab", EQEmu::skills::SkillBackstab),
luabind::value("BindWound", EQEmu::skills::SkillBindWound),
luabind::value("Bash", EQEmu::skills::SkillBash),
luabind::value("Block", EQEmu::skills::SkillBlock),
luabind::value("BrassInstruments", EQEmu::skills::SkillBrassInstruments),
luabind::value("Channeling", EQEmu::skills::SkillChanneling),
luabind::value("Conjuration", EQEmu::skills::SkillConjuration),
luabind::value("Defense", EQEmu::skills::SkillDefense),
luabind::value("Disarm", EQEmu::skills::SkillDisarm),
luabind::value("DisarmTraps", EQEmu::skills::SkillDisarmTraps),
luabind::value("Divination", EQEmu::skills::SkillDivination),
luabind::value("Dodge", EQEmu::skills::SkillDodge),
luabind::value("DoubleAttack", EQEmu::skills::SkillDoubleAttack),
luabind::value("DragonPunch", EQEmu::skills::SkillDragonPunch),
luabind::value("TailRake", EQEmu::skills::SkillTailRake),
luabind::value("DualWield", EQEmu::skills::SkillDualWield),
luabind::value("EagleStrike", EQEmu::skills::SkillEagleStrike),
luabind::value("Evocation", EQEmu::skills::SkillEvocation),
luabind::value("FeignDeath", EQEmu::skills::SkillFeignDeath),
luabind::value("FlyingKick", EQEmu::skills::SkillFlyingKick),
luabind::value("Forage", EQEmu::skills::SkillForage),
luabind::value("HandtoHand", EQEmu::skills::SkillHandtoHand),
luabind::value("Hide", EQEmu::skills::SkillHide),
luabind::value("Kick", EQEmu::skills::SkillKick),
luabind::value("Meditate", EQEmu::skills::SkillMeditate),
luabind::value("Mend", EQEmu::skills::SkillMend),
luabind::value("Offense", EQEmu::skills::SkillOffense),
luabind::value("Parry", EQEmu::skills::SkillParry),
luabind::value("PickLock", EQEmu::skills::SkillPickLock),
luabind::value("1HPiercing", EQEmu::skills::Skill1HPiercing),
luabind::value("Riposte", EQEmu::skills::SkillRiposte),
luabind::value("RoundKick", EQEmu::skills::SkillRoundKick),
luabind::value("SafeFall", EQEmu::skills::SkillSafeFall),
luabind::value("SenseHeading", EQEmu::skills::SkillSenseHeading),
luabind::value("Singing", EQEmu::skills::SkillSinging),
luabind::value("Sneak", EQEmu::skills::SkillSneak),
luabind::value("SpecializeAbjure", EQEmu::skills::SkillSpecializeAbjure),
luabind::value("SpecializeAlteration", EQEmu::skills::SkillSpecializeAlteration),
luabind::value("SpecializeConjuration", EQEmu::skills::SkillSpecializeConjuration),
luabind::value("SpecializeDivination", EQEmu::skills::SkillSpecializeDivination),
luabind::value("SpecializeEvocation", EQEmu::skills::SkillSpecializeEvocation),
luabind::value("PickPockets", EQEmu::skills::SkillPickPockets),
luabind::value("StringedInstruments", EQEmu::skills::SkillStringedInstruments),
luabind::value("Swimming", EQEmu::skills::SkillSwimming),
luabind::value("Throwing", EQEmu::skills::SkillThrowing),
luabind::value("TigerClaw", EQEmu::skills::SkillTigerClaw),
luabind::value("Tracking", EQEmu::skills::SkillTracking),
luabind::value("WindInstruments", EQEmu::skills::SkillWindInstruments),
luabind::value("Fishing", EQEmu::skills::SkillFishing),
luabind::value("MakePoison", EQEmu::skills::SkillMakePoison),
luabind::value("Tinkering", EQEmu::skills::SkillTinkering),
luabind::value("Research", EQEmu::skills::SkillResearch),
luabind::value("Alchemy", EQEmu::skills::SkillAlchemy),
luabind::value("Baking", EQEmu::skills::SkillBaking),
luabind::value("Tailoring", EQEmu::skills::SkillTailoring),
luabind::value("SenseTraps", EQEmu::skills::SkillSenseTraps),
luabind::value("Blacksmithing", EQEmu::skills::SkillBlacksmithing),
luabind::value("Fletching", EQEmu::skills::SkillFletching),
luabind::value("Brewing", EQEmu::skills::SkillBrewing),
luabind::value("AlcoholTolerance", EQEmu::skills::SkillAlcoholTolerance),
luabind::value("Begging", EQEmu::skills::SkillBegging),
luabind::value("JewelryMaking", EQEmu::skills::SkillJewelryMaking),
luabind::value("Pottery", EQEmu::skills::SkillPottery),
luabind::value("PercussionInstruments", EQEmu::skills::SkillPercussionInstruments),
luabind::value("Intimidation", EQEmu::skills::SkillIntimidation),
luabind::value("Berserking", EQEmu::skills::SkillBerserking),
luabind::value("Taunt", EQEmu::skills::SkillTaunt),
luabind::value("Frenzy", EQEmu::skills::SkillFrenzy),
luabind::value("RemoveTraps", EQEmu::skills::SkillRemoveTraps),
luabind::value("TripleAttack", EQEmu::skills::SkillTripleAttack),
luabind::value("2HPiercing", EQEmu::skills::Skill2HPiercing),
luabind::value("HIGHEST_SKILL", EQEmu::skills::HIGHEST_SKILL)
];
}
luabind::scope lua_register_bodytypes() {
return luabind::class_<BodyTypes>("BT")
.enum_("constants")
[
luabind::value("Humanoid", 1),
luabind::value("Lycanthrope", 2),
luabind::value("Undead", 3),
luabind::value("Giant", 4),
luabind::value("Construct", 5),
luabind::value("Extraplanar", 6),
luabind::value("Magical", 7),
luabind::value("SummonedUndead", 8),
luabind::value("RaidGiant", 9),
luabind::value("NoTarget", 11),
luabind::value("Vampire", 12),
luabind::value("Atenha_Ra", 13),
luabind::value("Greater_Akheva", 14),
luabind::value("Khati_Sha", 15),
luabind::value("Seru", 16),
luabind::value("Draz_Nurakk", 18),
luabind::value("Zek", 19),
luabind::value("Luggald", 20),
luabind::value("Animal", 21),
luabind::value("Insect", 22),
luabind::value("Monster", 23),
luabind::value("Summoned", 24),
luabind::value("Plant", 25),
luabind::value("Dragon", 26),
luabind::value("Summoned2", 27),
luabind::value("Summoned3", 28),
luabind::value("VeliousDragon", 30),
luabind::value("Dragon3", 32),
luabind::value("Boxes", 33),
luabind::value("Muramite", 34),
luabind::value("NoTarget2", 60),
luabind::value("SwarmPet", 63),
luabind::value("InvisMan", 66),
luabind::value("Special", 67)
];
}
luabind::scope lua_register_filters() {
return luabind::class_<Filters>("Filter")
.enum_("constants")
[
luabind::value("None", FilterNone),
luabind::value("GuildChat", FilterGuildChat),
luabind::value("Socials", FilterSocials),
luabind::value("GroupChat", FilterGroupChat),
luabind::value("Shouts", FilterShouts),
luabind::value("Auctions", FilterAuctions),
luabind::value("OOC", FilterOOC),
luabind::value("BadWords", FilterBadWords),
luabind::value("PCSpells", FilterPCSpells),
luabind::value("NPCSpells", FilterNPCSpells),
luabind::value("BardSongs", FilterBardSongs),
luabind::value("SpellCrits", FilterSpellCrits),
luabind::value("MeleeCrits", FilterMeleeCrits),
luabind::value("SpellDamage", FilterSpellDamage),
luabind::value("MyMisses", FilterMyMisses),
luabind::value("OthersMiss", FilterOthersMiss),
luabind::value("OthersHit", FilterOthersHit),
luabind::value("MissedMe", FilterMissedMe),
luabind::value("DamageShields", FilterDamageShields),
luabind::value("DOT", FilterDOT),
luabind::value("PetHits", FilterPetHits),
luabind::value("PetMisses", FilterPetMisses),
luabind::value("FocusEffects", FilterFocusEffects),
luabind::value("PetSpells", FilterPetSpells),
luabind::value("HealOverTime", FilterHealOverTime),
luabind::value("Unknown25", FilterUnknown25),
luabind::value("Unknown26", FilterUnknown26),
luabind::value("Unknown27", FilterUnknown27),
luabind::value("Unknown28", FilterUnknown28)
];
}
luabind::scope lua_register_message_types() {
return luabind::class_<MessageTypes>("MT")
.enum_("constants")
[
luabind::value("Say", MT_Say),
luabind::value("Tell", MT_Tell),
luabind::value("Group", MT_Group),
luabind::value("Guild", MT_Guild),
luabind::value("OOC", MT_OOC),
luabind::value("Auction", MT_Auction),
luabind::value("Shout", MT_Shout),
luabind::value("Emote", MT_Emote),
luabind::value("Spells", MT_Spells),
luabind::value("YouHitOther", MT_YouHitOther),
luabind::value("OtherHitsYou", MT_OtherHitsYou),
luabind::value("YouMissOther", MT_YouMissOther),
luabind::value("OtherMissesYou", MT_OtherMissesYou),
luabind::value("Broadcasts", MT_Broadcasts),
luabind::value("Skills", MT_Skills),
luabind::value("Disciplines", MT_Disciplines),
luabind::value("Unused1", MT_Unused1),
luabind::value("DefaultText", MT_DefaultText),
luabind::value("Unused2", MT_Unused2),
luabind::value("MerchantOffer", MT_MerchantOffer),
luabind::value("MerchantBuySell", MT_MerchantBuySell),
luabind::value("YourDeath", MT_YourDeath),
luabind::value("OtherDeath", MT_OtherDeath),
luabind::value("OtherHits", MT_OtherHits),
luabind::value("OtherMisses", MT_OtherMisses),
luabind::value("Who", MT_Who),
luabind::value("YellForHelp", MT_YellForHelp),
luabind::value("NonMelee", MT_NonMelee),
luabind::value("WornOff", MT_WornOff),
luabind::value("MoneySplit", MT_MoneySplit),
luabind::value("LootMessages", MT_LootMessages),
luabind::value("DiceRoll", MT_DiceRoll),
luabind::value("OtherSpells", MT_OtherSpells),
luabind::value("SpellFailure", MT_SpellFailure),
luabind::value("Chat", MT_Chat),
luabind::value("Channel1", MT_Channel1),
luabind::value("Channel2", MT_Channel2),
luabind::value("Channel3", MT_Channel3),
luabind::value("Channel4", MT_Channel4),
luabind::value("Channel5", MT_Channel5),
luabind::value("Channel6", MT_Channel6),
luabind::value("Channel7", MT_Channel7),
luabind::value("Channel8", MT_Channel8),
luabind::value("Channel9", MT_Channel9),
luabind::value("Channel10", MT_Channel10),
luabind::value("CritMelee", MT_CritMelee),
luabind::value("SpellCrits", MT_SpellCrits),
luabind::value("TooFarAway", MT_TooFarAway),
luabind::value("NPCRampage", MT_NPCRampage),
luabind::value("NPCFlurry", MT_NPCFlurry),
luabind::value("NPCEnrage", MT_NPCEnrage),
luabind::value("SayEcho", MT_SayEcho),
luabind::value("TellEcho", MT_TellEcho),
luabind::value("GroupEcho", MT_GroupEcho),
luabind::value("GuildEcho", MT_GuildEcho),
luabind::value("OOCEcho", MT_OOCEcho),
luabind::value("AuctionEcho", MT_AuctionEcho),
luabind::value("ShoutECho", MT_ShoutECho),
luabind::value("EmoteEcho", MT_EmoteEcho),
luabind::value("Chat1Echo", MT_Chat1Echo),
luabind::value("Chat2Echo", MT_Chat2Echo),
luabind::value("Chat3Echo", MT_Chat3Echo),
luabind::value("Chat4Echo", MT_Chat4Echo),
luabind::value("Chat5Echo", MT_Chat5Echo),
luabind::value("Chat6Echo", MT_Chat6Echo),
luabind::value("Chat7Echo", MT_Chat7Echo),
luabind::value("Chat8Echo", MT_Chat8Echo),
luabind::value("Chat9Echo", MT_Chat9Echo),
luabind::value("Chat10Echo", MT_Chat10Echo),
luabind::value("DoTDamage", MT_DoTDamage),
luabind::value("ItemLink", MT_ItemLink),
luabind::value("RaidSay", MT_RaidSay),
luabind::value("MyPet", MT_MyPet),
luabind::value("DS", MT_DS),
luabind::value("Leadership", MT_Leadership),
luabind::value("PetFlurry", MT_PetFlurry),
luabind::value("PetCrit", MT_PetCrit),
luabind::value("FocusEffect", MT_FocusEffect),
luabind::value("Experience", MT_Experience),
luabind::value("System", MT_System),
luabind::value("PetSpell", MT_PetSpell),
luabind::value("PetResponse", MT_PetResponse),
luabind::value("ItemSpeech", MT_ItemSpeech),
luabind::value("StrikeThrough", MT_StrikeThrough),
luabind::value("Stun", MT_Stun)
];
}

View File

@ -11,6 +11,10 @@ luabind::scope lua_register_material();
luabind::scope lua_register_client_version();
luabind::scope lua_register_appearance();
luabind::scope lua_register_classes();
luabind::scope lua_register_skills();
luabind::scope lua_register_bodytypes();
luabind::scope lua_register_filters();
luabind::scope lua_register_message_types();
#endif
#endif

View File

@ -2051,6 +2051,18 @@ bool Lua_Mob::TryFinishingBlow(Lua_Mob defender, int &damage) {
return self->TryFinishingBlow(defender, damage);
}
int Lua_Mob::GetBodyType()
{
Lua_Safe_Call_Int();
return (int)self->GetBodyType();
}
int Lua_Mob::GetOrigBodyType()
{
Lua_Safe_Call_Int();
return (int)self->GetOrigBodyType();
}
luabind::scope lua_register_mob() {
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
.def(luabind::constructor<>())
@ -2408,7 +2420,9 @@ luabind::scope lua_register_mob() {
.def("AttackAnimation", &Lua_Mob::AttackAnimation)
.def("GetWeaponDamage", &Lua_Mob::GetWeaponDamage)
.def("IsBerserk", &Lua_Mob::IsBerserk)
.def("TryFinishingBlow", &Lua_Mob::TryFinishingBlow);
.def("TryFinishingBlow", &Lua_Mob::TryFinishingBlow)
.def("GetBodyType", &Lua_Mob::GetBodyType)
.def("GetOrigBodyType", &Lua_Mob::GetOrigBodyType);
}
luabind::scope lua_register_special_abilities() {

View File

@ -341,7 +341,6 @@ public:
void SetFlurryChance(int value);
int GetFlurryChance();
int GetSkill(int skill_id);
void CalcBonuses();
int GetSpecialAbility(int ability);
int GetSpecialAbilityParam(int ability, int param);
void SetSpecialAbility(int ability, int level);
@ -394,6 +393,8 @@ public:
int GetWeaponDamage(Lua_Mob against, Lua_ItemInst weapon);
bool IsBerserk();
bool TryFinishingBlow(Lua_Mob defender, int &damage);
int GetBodyType();
int GetOrigBodyType();
};
#endif

View File

@ -34,18 +34,11 @@
void LuaMod::Init()
{
m_has_client_attack = parser_->HasFunction("ClientAttack", package_name_);
m_has_npc_attack = parser_->HasFunction("NPCAttack", package_name_);
m_has_bot_attack = parser_->HasFunction("BotAttack", package_name_);
m_has_melee_mitigation = parser_->HasFunction("MeleeMitigation", package_name_);
m_has_apply_damage_table = parser_->HasFunction("ApplyDamageTable", package_name_);
m_has_avoid_damage = parser_->HasFunction("AvoidDamage", package_name_);
m_has_check_hit_chance = parser_->HasFunction("CheckHitChance", package_name_);
m_has_do_special_attack_damage = parser_->HasFunction("DoSpecialAttackDamage", package_name_);
m_has_do_ranged_attack_dmg = parser_->HasFunction("DoRangedAttackDmg", package_name_);
m_has_do_archery_attack_dmg = parser_->HasFunction("DoArcheryAttackDmg", package_name_);
m_has_do_throwing_attack_dmg = parser_->HasFunction("DoThrowingAttackDmg", package_name_);
m_has_do_melee_skill_attack_dmg = parser_->HasFunction("DoMeleeSkillAttackDmg", package_name_);
m_has_try_critical_hit = parser_->HasFunction("TryCriticalHit", package_name_);
}
void PutDamageHitInfo(lua_State *L, luabind::adl::object &e, DamageHitInfo &hit) {
@ -182,114 +175,6 @@ void GetExtraAttackOptions(luabind::adl::object &ret, ExtraAttackOptions *opts)
}
}
bool LuaMod::ClientAttack(Mob *self, Mob *other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault)
{
int start = lua_gettop(L);
ignoreDefault = false;
bool retval = false;
if (!m_has_client_attack) {
return retval;
}
retval = CommonAttack("ClientAttack", self, other, Hand, bRiposte, IsStrikethrough, IsFromSpell, opts, ignoreDefault);
int end = lua_gettop(L);
int n = end - start;
if (n > 0) {
lua_pop(L, n);
}
return retval;
}
bool LuaMod::NPCAttack(Mob *self, Mob *other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault)
{
int start = lua_gettop(L);
ignoreDefault = false;
bool retval = false;
if (!m_has_npc_attack) {
return retval;
}
retval = CommonAttack("NPCAttack", self, other, Hand, bRiposte, IsStrikethrough, IsFromSpell, opts, ignoreDefault);
int end = lua_gettop(L);
int n = end - start;
if (n > 0) {
lua_pop(L, n);
}
return retval;
}
bool LuaMod::BotAttack(Mob *self, Mob *other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault)
{
int start = lua_gettop(L);
ignoreDefault = false;
bool retval = false;
if (!m_has_bot_attack) {
return retval;
}
retval = CommonAttack("BotAttack", self, other, Hand, bRiposte, IsStrikethrough, IsFromSpell, opts, ignoreDefault);
int end = lua_gettop(L);
int n = end - start;
if (n > 0) {
lua_pop(L, n);
}
return retval;
}
bool LuaMod::CommonAttack(const std::string &fn, Mob *self, Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault) {
bool retval = false;
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
lua_getfield(L, -1, fn.c_str());
Lua_Mob l_self(self);
Lua_Mob l_other(other);
luabind::adl::object e = luabind::newtable(L);
e["self"] = l_self;
e["other"] = l_other;
e["Hand"] = Hand;
e["bRiposte"] = bRiposte;
e["IsStrikethrough"] = IsStrikethrough;
e["IsFromSpell"] = IsFromSpell;
PutExtraAttackOptions(L, e, opts);
e.push(L);
if (lua_pcall(L, 1, 1, 0)) {
std::string error = lua_tostring(L, -1);
parser_->AddError(error);
lua_pop(L, 1);
return retval;
}
if (lua_type(L, -1) == LUA_TTABLE) {
luabind::adl::object ret(luabind::from_stack(L, -1));
auto IgnoreDefaultObj = ret["IgnoreDefault"];
if (luabind::type(IgnoreDefaultObj) == LUA_TBOOLEAN) {
ignoreDefault = ignoreDefault || luabind::object_cast<bool>(IgnoreDefaultObj);
}
auto returnValueObj = ret["ReturnValue"];
if (luabind::type(returnValueObj) == LUA_TBOOLEAN) {
retval = luabind::object_cast<bool>(returnValueObj);
}
GetExtraAttackOptions(ret, opts);
}
return retval;
}
void LuaMod::MeleeMitigation(Mob *self, Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault) {
int start = lua_gettop(L);
ignoreDefault = false;
@ -503,30 +388,28 @@ bool LuaMod::CheckHitChance(Mob *self, Mob* other, DamageHitInfo &hit, bool &ign
return retval;
}
void LuaMod::DoSpecialAttackDamage(Mob *self, Mob *who, EQEmu::skills::SkillType skill, int32 base_damage, int32 min_damage, int32 hate_override, int ReuseTime, bool &ignoreDefault)
{
//void TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
void LuaMod::TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault) {
int start = lua_gettop(L);
ignoreDefault = false;
try {
if (!m_has_do_special_attack_damage) {
if (!m_has_try_critical_hit) {
return;
}
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
lua_getfield(L, -1, "DoSpecialAttackDamage");
lua_getfield(L, -1, "TryCriticalHit");
Lua_Mob l_self(self);
Lua_Mob l_other(who);
Lua_Mob l_other(defender);
luabind::adl::object e = luabind::newtable(L);
e["self"] = l_self;
e["other"] = l_other;
e["skill"] = (int)skill;
e["base_damage"] = base_damage;
e["min_damage"] = min_damage;
e["hate_override"] = hate_override;
e["ReuseTime"] = ReuseTime;
PutDamageHitInfo(L, e, hit);
PutExtraAttackOptions(L, e, opts);
e.push(L);
if (lua_pcall(L, 1, 1, 0)) {
@ -542,6 +425,9 @@ void LuaMod::DoSpecialAttackDamage(Mob *self, Mob *who, EQEmu::skills::SkillType
if (luabind::type(IgnoreDefaultObj) == LUA_TBOOLEAN) {
ignoreDefault = ignoreDefault || luabind::object_cast<bool>(IgnoreDefaultObj);
}
GetDamageHitInfo(ret, hit);
GetExtraAttackOptions(ret, opts);
}
}
catch (std::exception &ex) {
@ -554,231 +440,3 @@ void LuaMod::DoSpecialAttackDamage(Mob *self, Mob *who, EQEmu::skills::SkillType
lua_pop(L, n);
}
}
void LuaMod::DoRangedAttackDmg(Mob *self, Mob *other, bool Launch, int16 damage_mod, int16 chance_mod, EQEmu::skills::SkillType skill, float speed, const char *IDFile, bool &ignoreDefault)
{
int start = lua_gettop(L);
ignoreDefault = false;
try {
if (!m_has_do_ranged_attack_dmg) {
return;
}
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
lua_getfield(L, -1, "DoRangedAttackDmg");
Lua_Mob l_self(self);
Lua_Mob l_other(other);
luabind::adl::object e = luabind::newtable(L);
e["self"] = l_self;
e["other"] = l_other;
e["Launch"] = Launch;
e["damage_mod"] = damage_mod;
e["chance_mod"] = chance_mod;
e["skill"] = (int)skill;
e["speed"] = speed;
e["IDFile"] = IDFile ? IDFile : "";
e.push(L);
if (lua_pcall(L, 1, 1, 0)) {
std::string error = lua_tostring(L, -1);
parser_->AddError(error);
lua_pop(L, 1);
return;
}
if (lua_type(L, -1) == LUA_TTABLE) {
luabind::adl::object ret(luabind::from_stack(L, -1));
auto IgnoreDefaultObj = ret["IgnoreDefault"];
if (luabind::type(IgnoreDefaultObj) == LUA_TBOOLEAN) {
ignoreDefault = ignoreDefault || luabind::object_cast<bool>(IgnoreDefaultObj);
}
}
}
catch (std::exception &ex) {
parser_->AddError(ex.what());
}
int end = lua_gettop(L);
int n = end - start;
if (n > 0) {
lua_pop(L, n);
}
}
void LuaMod::DoArcheryAttackDmg(Mob *self, Mob *other, const EQEmu::ItemInstance *RangeWeapon, const EQEmu::ItemInstance *Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus,
int ReuseTime, uint32 range_id, uint32 ammo_id, const EQEmu::ItemData *AmmoItem, int AmmoSlot, float speed, bool &ignoreDefault)
{
int start = lua_gettop(L);
ignoreDefault = false;
try {
if (!m_has_do_archery_attack_dmg) {
return;
}
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
lua_getfield(L, -1, "DoArcheryAttackDmg");
Lua_Mob l_self(self);
Lua_Mob l_other(other);
Lua_ItemInst l_RangeWeapon(const_cast<EQEmu::ItemInstance*>(RangeWeapon));
Lua_ItemInst l_Ammo(const_cast<EQEmu::ItemInstance*>(Ammo));
Lua_Item l_AmmoItem(const_cast<EQEmu::ItemData*>(AmmoItem));
luabind::adl::object e = luabind::newtable(L);
e["self"] = l_self;
e["other"] = l_other;
e["RangeWeapon"] = l_RangeWeapon;
e["Ammo"] = l_Ammo;
e["weapon_damage"] = weapon_damage;
e["chance_mod"] = chance_mod;
e["focus"] = focus;
e["ReuseTime"] = ReuseTime;
e["range_id"] = range_id;
e["ammo_id"] = ammo_id;
e["AmmoItem"] = l_AmmoItem;
e["AmmoSlot"] = AmmoSlot;
e["speed"] = speed;
e.push(L);
if (lua_pcall(L, 1, 1, 0)) {
std::string error = lua_tostring(L, -1);
parser_->AddError(error);
lua_pop(L, 1);
return;
}
if (lua_type(L, -1) == LUA_TTABLE) {
luabind::adl::object ret(luabind::from_stack(L, -1));
auto IgnoreDefaultObj = ret["IgnoreDefault"];
if (luabind::type(IgnoreDefaultObj) == LUA_TBOOLEAN) {
ignoreDefault = ignoreDefault || luabind::object_cast<bool>(IgnoreDefaultObj);
}
}
}
catch (std::exception &ex) {
parser_->AddError(ex.what());
}
int end = lua_gettop(L);
int n = end - start;
if (n > 0) {
lua_pop(L, n);
}
}
void LuaMod::DoThrowingAttackDmg(Mob *self, Mob *other, const EQEmu::ItemInstance *RangeWeapon, const EQEmu::ItemData *AmmoItem, uint16 weapon_damage, int16 chance_mod, int16 focus,
int ReuseTime, uint32 range_id, int AmmoSlot, float speed, bool &ignoreDefault)
{
int start = lua_gettop(L);
ignoreDefault = false;
try {
if (!m_has_do_throwing_attack_dmg) {
return;
}
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
lua_getfield(L, -1, "DoThrowingAttackDmg");
Lua_Mob l_self(self);
Lua_Mob l_other(other);
Lua_ItemInst l_RangeWeapon(const_cast<EQEmu::ItemInstance*>(RangeWeapon));
Lua_Item l_AmmoItem(const_cast<EQEmu::ItemData*>(AmmoItem));
luabind::adl::object e = luabind::newtable(L);
e["self"] = l_self;
e["other"] = l_other;
e["RangeWeapon"] = l_RangeWeapon;
e["weapon_damage"] = weapon_damage;
e["chance_mod"] = chance_mod;
e["focus"] = focus;
e["ReuseTime"] = ReuseTime;
e["range_id"] = range_id;
e["AmmoItem"] = l_AmmoItem;
e["AmmoSlot"] = AmmoSlot;
e["speed"] = speed;
e.push(L);
if (lua_pcall(L, 1, 1, 0)) {
std::string error = lua_tostring(L, -1);
parser_->AddError(error);
lua_pop(L, 1);
return;
}
if (lua_type(L, -1) == LUA_TTABLE) {
luabind::adl::object ret(luabind::from_stack(L, -1));
auto IgnoreDefaultObj = ret["IgnoreDefault"];
if (luabind::type(IgnoreDefaultObj) == LUA_TBOOLEAN) {
ignoreDefault = ignoreDefault || luabind::object_cast<bool>(IgnoreDefaultObj);
}
}
}
catch (std::exception &ex) {
parser_->AddError(ex.what());
}
int end = lua_gettop(L);
int n = end - start;
if (n > 0) {
lua_pop(L, n);
}
}
void LuaMod::DoMeleeSkillAttackDmg(Mob *self, Mob *other, uint16 weapon_damage, EQEmu::skills::SkillType skillinuse, int16 chance_mod, int16 focus, bool CanRiposte, int ReuseTime,
bool &ignoreDefault)
{
int start = lua_gettop(L);
ignoreDefault = false;
try {
if (!m_has_do_melee_skill_attack_dmg) {
return;
}
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
lua_getfield(L, -1, "DoMeleeSkillAttackDmg");
Lua_Mob l_self(self);
Lua_Mob l_other(other);
luabind::adl::object e = luabind::newtable(L);
e["self"] = l_self;
e["other"] = l_other;
e["weapon_damage"] = weapon_damage;
e["skillinuse"] = (int)skillinuse;
e["chance_mod"] = chance_mod;
e["focus"] = focus;
e["CanRiposte"] = CanRiposte;
e["ReuseTime"] = ReuseTime;
e.push(L);
if (lua_pcall(L, 1, 1, 0)) {
std::string error = lua_tostring(L, -1);
parser_->AddError(error);
lua_pop(L, 1);
return;
}
if (lua_type(L, -1) == LUA_TTABLE) {
luabind::adl::object ret(luabind::from_stack(L, -1));
auto IgnoreDefaultObj = ret["IgnoreDefault"];
if (luabind::type(IgnoreDefaultObj) == LUA_TBOOLEAN) {
ignoreDefault = ignoreDefault || luabind::object_cast<bool>(IgnoreDefaultObj);
}
}
}
catch (std::exception &ex) {
parser_->AddError(ex.what());
}
int end = lua_gettop(L);
int n = end - start;
if (n > 0) {
lua_pop(L, n);
}
}

View File

@ -17,37 +17,20 @@ public:
~LuaMod() { }
void Init();
bool ClientAttack(Mob *self, Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault);
bool NPCAttack(Mob *self, Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault);
bool BotAttack(Mob *self, Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault);
bool CommonAttack(const std::string &fn, Mob *self, Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault);
void MeleeMitigation(Mob *self, Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
void ApplyDamageTable(Mob *self, DamageHitInfo &hit, bool &ignoreDefault);
bool AvoidDamage(Mob *self, Mob *other, DamageHitInfo &hit, bool &ignoreDefault);
bool CheckHitChance(Mob *self, Mob* other, DamageHitInfo &hit, bool &ignoreDefault);
void DoSpecialAttackDamage(Mob *self, Mob *who, EQEmu::skills::SkillType skill, int32 base_damage, int32 min_damage, int32 hate_override, int ReuseTime, bool &ignoreDefault);
void DoRangedAttackDmg(Mob *self, Mob* other, bool Launch, int16 damage_mod, int16 chance_mod, EQEmu::skills::SkillType skill, float speed, const char *IDFile, bool &ignoreDefault);
void DoArcheryAttackDmg(Mob *self, Mob *other, const EQEmu::ItemInstance *RangeWeapon, const EQEmu::ItemInstance *Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus,
int ReuseTime, uint32 range_id, uint32 ammo_id, const EQEmu::ItemData *AmmoItem, int AmmoSlot, float speed, bool &ignoreDefault);
void DoThrowingAttackDmg(Mob *self, Mob *other, const EQEmu::ItemInstance *RangeWeapon, const EQEmu::ItemData *AmmoItem, uint16 weapon_damage, int16 chance_mod, int16 focus,
int ReuseTime, uint32 range_id, int AmmoSlot, float speed, bool &ignoreDefault);
void DoMeleeSkillAttackDmg(Mob *self, Mob *other, uint16 weapon_damage, EQEmu::skills::SkillType skillinuse, int16 chance_mod, int16 focus, bool CanRiposte, int ReuseTime,
bool &ignoreDefault);
void TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
private:
LuaParser *parser_;
lua_State *L;
std::string package_name_;
bool m_has_client_attack;
bool m_has_npc_attack;
bool m_has_bot_attack;
bool m_has_melee_mitigation;
bool m_has_apply_damage_table;
bool m_has_avoid_damage;
bool m_has_check_hit_chance;
bool m_has_do_special_attack_damage;
bool m_has_do_ranged_attack_dmg;
bool m_has_do_archery_attack_dmg;
bool m_has_do_throwing_attack_dmg;
bool m_has_do_melee_skill_attack_dmg;
bool m_has_try_critical_hit;
};

View File

@ -498,6 +498,11 @@ uint8 Lua_NPC::GetMerchantProbability() {
return self->GetMerchantProbability();
}
int Lua_NPC::GetRawAC() {
Lua_Safe_Call_Int();
return self->GetRawAC();
}
luabind::scope lua_register_npc() {
return luabind::class_<Lua_NPC, Lua_Mob>("NPC")
.def(luabind::constructor<>())
@ -598,7 +603,8 @@ luabind::scope lua_register_npc() {
.def("MerchantOpenShop", (void(Lua_NPC::*)(void))&Lua_NPC::MerchantOpenShop)
.def("MerchantCloseShop", (void(Lua_NPC::*)(void))&Lua_NPC::MerchantCloseShop)
.def("SetMerchantProbability", (void(Lua_NPC::*)(void))&Lua_NPC::SetMerchantProbability)
.def("GetMerchantProbability", (uint8(Lua_NPC::*)(void))&Lua_NPC::GetMerchantProbability);
.def("GetMerchantProbability", (uint8(Lua_NPC::*)(void))&Lua_NPC::GetMerchantProbability)
.def("GetRawAC", (int(Lua_NPC::*)(void))&Lua_NPC::GetRawAC);
}
#endif

View File

@ -125,6 +125,7 @@ public:
void MerchantCloseShop();
void SetMerchantProbability(uint8 amt);
uint8 GetMerchantProbability();
int GetRawAC();
};
#endif

View File

@ -1055,6 +1055,10 @@ void LuaParser::MapFunctions(lua_State *L) {
lua_register_client_version(),
lua_register_appearance(),
lua_register_classes(),
lua_register_skills(),
lua_register_bodytypes(),
lua_register_filters(),
lua_register_message_types(),
lua_register_entity(),
lua_register_encounter(),
lua_register_mob(),
@ -1282,36 +1286,6 @@ QuestEventID LuaParser::ConvertLuaEvent(QuestEventID evt) {
#endif
bool LuaParser::ClientAttack(Mob *self, Mob *other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault)
{
bool retval = false;
for (auto &mod : mods_) {
retval = mod.ClientAttack(self, other, Hand, bRiposte, IsStrikethrough, IsFromSpell, opts, ignoreDefault);
}
return retval;
}
bool LuaParser::NPCAttack(Mob *self, Mob *other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault)
{
bool retval = false;
for (auto &mod : mods_) {
retval = mod.NPCAttack(self, other, Hand, bRiposte, IsStrikethrough, IsFromSpell, opts, ignoreDefault);
}
return retval;
}
bool LuaParser::BotAttack(Mob *self, Mob *other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault)
{
bool retval = false;
for (auto &mod : mods_) {
retval = mod.BotAttack(self, other, Hand, bRiposte, IsStrikethrough, IsFromSpell, opts, ignoreDefault);
}
return retval;
}
void LuaParser::MeleeMitigation(Mob *self, Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
{
for (auto &mod : mods_) {
@ -1344,40 +1318,9 @@ bool LuaParser::CheckHitChance(Mob *self, Mob *other, DamageHitInfo &hit, bool &
return retval;
}
void LuaParser::DoSpecialAttackDamage(Mob *self, Mob *who, EQEmu::skills::SkillType skill, int32 base_damage, int32 min_damage, int32 hate_override, int ReuseTime, bool &ignoreDefault)
void LuaParser::TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
{
for (auto &mod : mods_) {
mod.DoSpecialAttackDamage(self, who, skill, base_damage, min_damage, hate_override, ReuseTime, ignoreDefault);
}
}
void LuaParser::DoRangedAttackDmg(Mob *self, Mob *other, bool Launch, int16 damage_mod, int16 chance_mod, EQEmu::skills::SkillType skill, float speed, const char *IDFile, bool &ignoreDefault)
{
for (auto &mod : mods_) {
mod.DoRangedAttackDmg(self, other, Launch, damage_mod, chance_mod, skill, speed, IDFile, ignoreDefault);
}
}
void LuaParser::DoArcheryAttackDmg(Mob *self, Mob *other, const EQEmu::ItemInstance *RangeWeapon, const EQEmu::ItemInstance *Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus,
int ReuseTime, uint32 range_id, uint32 ammo_id, const EQEmu::ItemData *AmmoItem, int AmmoSlot, float speed, bool &ignoreDefault)
{
for (auto &mod : mods_) {
mod.DoArcheryAttackDmg(self, other, RangeWeapon, Ammo, weapon_damage, chance_mod, focus, ReuseTime, range_id, ammo_id, AmmoItem, AmmoSlot, speed, ignoreDefault);
}
}
void LuaParser::DoThrowingAttackDmg(Mob *self, Mob *other, const EQEmu::ItemInstance *RangeWeapon, const EQEmu::ItemData *AmmoItem, uint16 weapon_damage, int16 chance_mod, int16 focus,
int ReuseTime, uint32 range_id, int AmmoSlot, float speed, bool &ignoreDefault)
{
for (auto &mod : mods_) {
mod.DoThrowingAttackDmg(self, other, RangeWeapon, AmmoItem, weapon_damage, chance_mod, focus, ReuseTime, range_id, AmmoSlot, speed, ignoreDefault);
}
}
void LuaParser::DoMeleeSkillAttackDmg(Mob *self, Mob *other, uint16 weapon_damage, EQEmu::skills::SkillType skillinuse, int16 chance_mod, int16 focus, bool CanRiposte,
int ReuseTime, bool &ignoreDefault)
{
for (auto &mod : mods_) {
mod.DoMeleeSkillAttackDmg(self, other, weapon_damage, skillinuse, chance_mod, focus, CanRiposte, ReuseTime, ignoreDefault);
mod.TryCriticalHit(self, defender, hit, opts, ignoreDefault);
}
}

View File

@ -90,21 +90,11 @@ public:
bool HasFunction(std::string function, std::string package_name);
//Mod Extensions
bool ClientAttack(Mob *self, Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault);
bool NPCAttack(Mob *self, Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault);
bool BotAttack(Mob *self, Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts, bool &ignoreDefault);
void MeleeMitigation(Mob *self, Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
void ApplyDamageTable(Mob *self, DamageHitInfo &hit, bool &ignoreDefault);
bool AvoidDamage(Mob *self, Mob *other, DamageHitInfo &hit, bool &ignoreDefault);
bool CheckHitChance(Mob *self, Mob* other, DamageHitInfo &hit, bool &ignoreDefault);
void DoSpecialAttackDamage(Mob *self, Mob *who, EQEmu::skills::SkillType skill, int32 base_damage, int32 min_damage, int32 hate_override, int ReuseTime, bool &ignoreDefault);
void DoRangedAttackDmg(Mob *self, Mob* other, bool Launch, int16 damage_mod, int16 chance_mod, EQEmu::skills::SkillType skill, float speed, const char *IDFile, bool &ignoreDefault);
void DoArcheryAttackDmg(Mob *self, Mob *other, const EQEmu::ItemInstance *RangeWeapon, const EQEmu::ItemInstance *Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus,
int ReuseTime, uint32 range_id, uint32 ammo_id, const EQEmu::ItemData *AmmoItem, int AmmoSlot, float speed, bool &ignoreDefault);
void DoThrowingAttackDmg(Mob *self, Mob *other, const EQEmu::ItemInstance *RangeWeapon, const EQEmu::ItemData *AmmoItem, uint16 weapon_damage, int16 chance_mod, int16 focus,
int ReuseTime, uint32 range_id, int AmmoSlot, float speed, bool &ignoreDefault);
void DoMeleeSkillAttackDmg(Mob *self, Mob *other, uint16 weapon_damage, EQEmu::skills::SkillType skillinuse, int16 chance_mod, int16 focus, bool CanRiposte, int ReuseTime,
bool &ignoreDefault);
void TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
private:
LuaParser();

View File

@ -1078,9 +1078,9 @@ uint32 Lua_StatBonuses::GetSpellOnDeath(int idx) const {
return self->SpellOnDeath[idx];
}
int32 Lua_StatBonuses::GetCritDmgMob(int idx) const {
int32 Lua_StatBonuses::GetCritDmgMod(int idx) const {
Lua_Safe_Call_Int();
return self->CritDmgMob[idx];
return self->CritDmgMod[idx];
}
int32 Lua_StatBonuses::GetSkillReuseTime(int idx) const {
@ -1496,7 +1496,7 @@ luabind::scope lua_register_stat_bonuses() {
.def("SpellTriggers", &Lua_StatBonuses::GetSpellTriggers)
.def("SpellOnKill", &Lua_StatBonuses::GetSpellOnKill)
.def("SpellOnDeath", &Lua_StatBonuses::GetSpellOnDeath)
.def("CritDmgMob", &Lua_StatBonuses::GetCritDmgMob)
.def("CritDmgMod", &Lua_StatBonuses::GetCritDmgMod)
.def("SkillReuseTime", &Lua_StatBonuses::GetSkillReuseTime)
.def("SkillDamageAmount", &Lua_StatBonuses::GetSkillDamageAmount)
.def("HPPercCap", &Lua_StatBonuses::GetHPPercCap)

View File

@ -240,7 +240,7 @@ public:
uint32 GetSpellTriggers(int idx) const;
uint32 GetSpellOnKill(int idx) const;
uint32 GetSpellOnDeath(int idx) const;
int32 GetCritDmgMob(int idx) const;
int32 GetCritDmgMod(int idx) const;
int32 GetSkillReuseTime(int idx) const;
int32 GetSkillDamageAmount(int idx) const;
int GetHPPercCap(int idx) const;

View File

@ -4675,16 +4675,13 @@ bool Mob::TrySpellOnDeath()
//in death because the heal will not register before the script kills you.
}
int16 Mob::GetCritDmgMob(uint16 skill)
int16 Mob::GetCritDmgMod(uint16 skill)
{
int critDmg_mod = 0;
// All skill dmg mod + Skill specific
critDmg_mod += itembonuses.CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] + spellbonuses.CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] + aabonuses.CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] +
itembonuses.CritDmgMob[skill] + spellbonuses.CritDmgMob[skill] + aabonuses.CritDmgMob[skill];
if(critDmg_mod < -100)
critDmg_mod = -100;
critDmg_mod += itembonuses.CritDmgMod[EQEmu::skills::HIGHEST_SKILL + 1] + spellbonuses.CritDmgMod[EQEmu::skills::HIGHEST_SKILL + 1] + aabonuses.CritDmgMod[EQEmu::skills::HIGHEST_SKILL + 1] +
itembonuses.CritDmgMod[skill] + spellbonuses.CritDmgMod[skill] + aabonuses.CritDmgMod[skill];
return critDmg_mod;
}

View File

@ -697,7 +697,7 @@ public:
void CastOnCure(uint32 spell_id);
void CastOnNumHitFade(uint32 spell_id);
void SlowMitigation(Mob* caster);
int16 GetCritDmgMob(uint16 skill);
int16 GetCritDmgMod(uint16 skill);
int16 GetMeleeDamageMod_SE(uint16 skill);
int16 GetMeleeMinDamageMod_SE(uint16 skill);
int16 GetCrippBlowChance();

View File

@ -138,15 +138,6 @@ int Mob::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target)
void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 base_damage, int32 min_damage,
int32 hate_override, int ReuseTime)
{
#ifdef LUA_EQEMU
bool ignoreDefault = false;
LuaParser::Instance()->DoSpecialAttackDamage(this, who, skill, base_damage, min_damage, hate_override, ReuseTime, ignoreDefault);
if (ignoreDefault) {
return;
}
#endif
// this really should go through the same code as normal melee damage to
// pick up all the special behavior there
@ -768,16 +759,6 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon,
uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, uint32 range_id,
uint32 ammo_id, const EQEmu::ItemData *AmmoItem, int AmmoSlot, float speed)
{
#ifdef LUA_EQEMU
bool ignoreDefault = false;
LuaParser::Instance()->DoArcheryAttackDmg(this, other, RangeWeapon, Ammo, weapon_damage, chance_mod, focus, ReuseTime, range_id, ammo_id, AmmoItem, AmmoSlot, speed, ignoreDefault);
if (ignoreDefault) {
return;
}
#endif
if ((other == nullptr ||
((IsClient() && CastToClient()->dead) || (other->IsClient() && other->CastToClient()->dead)) ||
HasDied() || (!IsAttackAllowed(other)) || (other->GetInvul() || other->GetSpecialAbility(IMMUNE_MELEE)))) {
@ -1157,15 +1138,6 @@ void NPC::RangedAttack(Mob* other)
void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 chance_mod, EQEmu::skills::SkillType skill, float speed, const char *IDFile)
{
#ifdef LUA_EQEMU
bool ignoreDefault = false;
LuaParser::Instance()->DoRangedAttackDmg(this, other, Launch, damage_mod, chance_mod, skill, speed, IDFile, ignoreDefault);
if (ignoreDefault) {
return;
}
#endif
if ((other == nullptr ||
(other->HasDied())) ||
HasDied() ||
@ -1330,15 +1302,6 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon
uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, uint32 range_id,
int AmmoSlot, float speed)
{
#ifdef LUA_EQEMU
bool ignoreDefault = false;
LuaParser::Instance()->DoThrowingAttackDmg(this, other, RangeWeapon, AmmoItem, weapon_damage, chance_mod, focus, ReuseTime, range_id, AmmoSlot, speed, ignoreDefault);
if (ignoreDefault) {
return;
}
#endif
if ((other == nullptr ||
((IsClient() && CastToClient()->dead) || (other->IsClient() && other->CastToClient()->dead)) ||
HasDied() || (!IsAttackAllowed(other)) || (other->GetInvul() || other->GetSpecialAbility(IMMUNE_MELEE)))) {
@ -2123,15 +2086,6 @@ int Mob::TryAssassinate(Mob *defender, EQEmu::skills::SkillType skillInUse)
void Mob::DoMeleeSkillAttackDmg(Mob *other, uint16 weapon_damage, EQEmu::skills::SkillType skillinuse, int16 chance_mod,
int16 focus, bool CanRiposte, int ReuseTime)
{
#ifdef LUA_EQEMU
bool ignoreDefault = false;
LuaParser::Instance()->DoMeleeSkillAttackDmg(this, other, weapon_damage, skillinuse, chance_mod, focus, CanRiposte, ReuseTime, ignoreDefault);
if (ignoreDefault) {
return;
}
#endif
if (!CanDoSpecialAttack(other))
return;