mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Merge branch 'luamod'
This commit is contained in:
@@ -51,6 +51,7 @@ SET(zone_sources
|
||||
lua_item.cpp
|
||||
lua_iteminst.cpp
|
||||
lua_mob.cpp
|
||||
lua_mod.cpp
|
||||
lua_npc.cpp
|
||||
lua_object.cpp
|
||||
lua_packet.cpp
|
||||
@@ -59,6 +60,7 @@ SET(zone_sources
|
||||
lua_raid.cpp
|
||||
lua_spawn.cpp
|
||||
lua_spell.cpp
|
||||
lua_stat_bonuses.cpp
|
||||
embperl.cpp
|
||||
embxs.cpp
|
||||
entity.cpp
|
||||
@@ -173,6 +175,7 @@ SET(zone_headers
|
||||
lua_item.h
|
||||
lua_iteminst.h
|
||||
lua_mob.h
|
||||
lua_mod.h
|
||||
lua_npc.h
|
||||
lua_object.h
|
||||
lua_packet.h
|
||||
@@ -182,6 +185,7 @@ SET(zone_headers
|
||||
lua_raid.h
|
||||
lua_spawn.h
|
||||
lua_spell.h
|
||||
lua_stat_bonuses.h
|
||||
map.h
|
||||
masterentity.h
|
||||
maxskill.h
|
||||
|
||||
+1
-1
@@ -916,7 +916,7 @@ void Client::SendAlternateAdvancementRank(int aa_id, int level) {
|
||||
void Client::SendAlternateAdvancementStats() {
|
||||
auto outapp = new EQApplicationPacket(OP_AAExpUpdate, sizeof(AltAdvStats_Struct));
|
||||
AltAdvStats_Struct *aps = (AltAdvStats_Struct *)outapp->pBuffer;
|
||||
aps->experience = (uint32)(((float)330.0f * (float)m_pp.expAA) / (float)max_AAXP);
|
||||
aps->experience = (uint32)(((float)330.0f * (float)m_pp.expAA) / (float)GetRequiredAAExperience());
|
||||
aps->unspent = m_pp.aapoints;
|
||||
aps->percentage = m_epp.perAA;
|
||||
QueuePacket(outapp);
|
||||
|
||||
+73
-8
@@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "water_map.h"
|
||||
#include "worldserver.h"
|
||||
#include "zone.h"
|
||||
#include "lua_parser.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
@@ -52,8 +53,9 @@ extern WorldServer worldserver;
|
||||
extern EntityList entity_list;
|
||||
extern Zone* zone;
|
||||
|
||||
bool Mob::AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const EQEmu::ItemInstance* weapon)
|
||||
EQEmu::skills::SkillType Mob::AttackAnimation(int Hand, const EQEmu::ItemInstance* weapon)
|
||||
{
|
||||
EQEmu::skills::SkillType skillinuse = EQEmu::skills::Skill1HBlunt;
|
||||
// Determine animation
|
||||
int type = 0;
|
||||
if (weapon && weapon->IsClassCommon()) {
|
||||
@@ -137,7 +139,7 @@ bool Mob::AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const
|
||||
type = animDualWield;
|
||||
|
||||
DoAnim(type, 0, false);
|
||||
return true;
|
||||
return skillinuse;
|
||||
}
|
||||
|
||||
int Mob::compute_tohit(EQEmu::skills::SkillType skillinuse)
|
||||
@@ -271,6 +273,16 @@ int Mob::GetTotalDefense()
|
||||
// and does other mitigation checks. 'this' is the mob being attacked.
|
||||
bool Mob::CheckHitChance(Mob* other, DamageHitInfo &hit)
|
||||
{
|
||||
#ifdef LUA_EQEMU
|
||||
bool lua_ret = false;
|
||||
bool ignoreDefault = false;
|
||||
lua_ret = LuaParser::Instance()->CheckHitChance(this, other, hit, ignoreDefault);
|
||||
|
||||
if(ignoreDefault) {
|
||||
return lua_ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
Mob *attacker = other;
|
||||
Mob *defender = this;
|
||||
Log(Logs::Detail, Logs::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName());
|
||||
@@ -301,6 +313,16 @@ bool Mob::CheckHitChance(Mob* other, DamageHitInfo &hit)
|
||||
|
||||
bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
|
||||
{
|
||||
#ifdef LUA_EQEMU
|
||||
bool lua_ret = false;
|
||||
bool ignoreDefault = false;
|
||||
lua_ret = LuaParser::Instance()->AvoidDamage(this, other, hit, ignoreDefault);
|
||||
|
||||
if (ignoreDefault) {
|
||||
return lua_ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* called when a mob is attacked, does the checks to see if it's a hit
|
||||
* and does other mitigation checks. 'this' is the mob being attacked.
|
||||
*
|
||||
@@ -871,6 +893,15 @@ double Mob::RollD20(int offense, int mitigation)
|
||||
|
||||
void Mob::MeleeMitigation(Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
||||
{
|
||||
#ifdef LUA_EQEMU
|
||||
bool ignoreDefault = false;
|
||||
LuaParser::Instance()->MeleeMitigation(this, attacker, hit, opts, ignoreDefault);
|
||||
|
||||
if (ignoreDefault) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (hit.damage_done < 0 || hit.base_damage == 0)
|
||||
return;
|
||||
|
||||
@@ -1237,6 +1268,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
||||
return;
|
||||
Log(Logs::Detail, Logs::Combat, "%s::DoAttack vs %s base %d min %d offense %d tohit %d skill %d", GetName(),
|
||||
other->GetName(), hit.base_damage, hit.min_damage, hit.offense, hit.tohit, hit.skill);
|
||||
|
||||
// check to see if we hit..
|
||||
if (other->AvoidDamage(this, hit)) {
|
||||
int strike_through = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough;
|
||||
@@ -1331,7 +1363,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
|
||||
DamageHitInfo my_hit;
|
||||
// calculate attack_skill and skillinuse depending on hand and weapon
|
||||
// also send Packet to near clients
|
||||
AttackAnimation(my_hit.skill, Hand, weapon);
|
||||
my_hit.skill = AttackAnimation(Hand, weapon);
|
||||
Log(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon ? weapon->GetItem()->Name : "Fist", Hand, my_hit.skill);
|
||||
|
||||
// Now figure out damage
|
||||
@@ -1892,7 +1924,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
//do attack animation regardless of whether or not we can hit below
|
||||
int16 charges = 0;
|
||||
EQEmu::ItemInstance weapon_inst(weapon, charges);
|
||||
AttackAnimation(my_hit.skill, Hand, &weapon_inst);
|
||||
my_hit.skill = AttackAnimation(Hand, &weapon_inst);
|
||||
|
||||
//basically "if not immune" then do the attack
|
||||
if (weapon_damage > 0) {
|
||||
@@ -2190,7 +2222,7 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::Skil
|
||||
Group *kg = entity_list.GetGroupByClient(give_exp_client);
|
||||
Raid *kr = entity_list.GetRaidByClient(give_exp_client);
|
||||
|
||||
int32 finalxp = EXP_FORMULA;
|
||||
int32 finalxp = give_exp_client->GetExperienceForKill(this);
|
||||
finalxp = give_exp_client->mod_client_xp(finalxp, this);
|
||||
|
||||
if (kr) {
|
||||
@@ -2801,6 +2833,8 @@ uint8 Mob::GetWeaponDamageBonus(const EQEmu::ItemData *weapon, bool offhand)
|
||||
}
|
||||
return damage_bonus;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Mob::GetHandToHandDamage(void)
|
||||
@@ -4064,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;
|
||||
|
||||
@@ -4085,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;
|
||||
|
||||
@@ -4193,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,
|
||||
@@ -4254,7 +4301,7 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
|
||||
// Crippling blows also have a chance to stun
|
||||
// Kayen: Crippling Blow would cause a chance to interrupt for npcs < 55, with a
|
||||
// staggers message.
|
||||
if (defender->GetLevel() <= 55 && !defender->GetSpecialAbility(IMMUNE_STUN)) {
|
||||
if (defender->GetLevel() <= 55 && !defender->GetSpecialAbility(UNSTUNABLE)) {
|
||||
defender->Emote("staggers.");
|
||||
defender->Stun(2000);
|
||||
}
|
||||
@@ -4535,6 +4582,15 @@ const DamageTable &Mob::GetDamageTable() const
|
||||
|
||||
void Mob::ApplyDamageTable(DamageHitInfo &hit)
|
||||
{
|
||||
#ifdef LUA_EQEMU
|
||||
bool ignoreDefault = false;
|
||||
LuaParser::Instance()->ApplyDamageTable(this, hit, ignoreDefault);
|
||||
|
||||
if (ignoreDefault) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// someone may want to add this to custom servers, can remove this if that's the case
|
||||
if (!IsClient()
|
||||
#ifdef BOTS
|
||||
@@ -4870,6 +4926,15 @@ void Mob::CommonOutgoingHitSuccess(Mob* defender, DamageHitInfo &hit, ExtraAttac
|
||||
if (!defender)
|
||||
return;
|
||||
|
||||
#ifdef LUA_EQEMU
|
||||
bool ignoreDefault = false;
|
||||
LuaParser::Instance()->CommonOutgoingHitSuccess(this, defender, hit, opts, ignoreDefault);
|
||||
|
||||
if (ignoreDefault) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// BER weren't parsing the halving
|
||||
if (hit.skill == EQEmu::skills::SkillArchery ||
|
||||
(hit.skill == EQEmu::skills::SkillThrowing && GetClass() != BERSERKER))
|
||||
|
||||
+7
-7
@@ -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;
|
||||
}
|
||||
|
||||
+3
-2
@@ -22,6 +22,7 @@
|
||||
#include "object.h"
|
||||
#include "doors.h"
|
||||
#include "quest_parser_collection.h"
|
||||
#include "lua_parser.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/say_link.h"
|
||||
|
||||
@@ -3856,7 +3857,7 @@ void Bot::AddToHateList(Mob* other, uint32 hate, int32 damage, bool iYellForHelp
|
||||
Mob::AddToHateList(other, hate, damage, iYellForHelp, bFrenzy, iBuffTic, pet_command);
|
||||
}
|
||||
|
||||
bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts) {
|
||||
bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts) {
|
||||
if (!other) {
|
||||
SetTarget(nullptr);
|
||||
Log(Logs::General, Logs::Error, "A null Mob object was passed to Bot::Attack for evaluation!");
|
||||
@@ -3919,7 +3920,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
|
||||
// calculate attack_skill and skillinuse depending on hand and weapon
|
||||
// also send Packet to near clients
|
||||
DamageHitInfo my_hit;
|
||||
AttackAnimation(my_hit.skill, Hand, weapon);
|
||||
my_hit.skill = AttackAnimation(Hand, weapon);
|
||||
Log(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, my_hit.skill);
|
||||
|
||||
// Now figure out damage
|
||||
|
||||
@@ -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
|
||||
|
||||
+5
-3
@@ -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();
|
||||
@@ -570,6 +571,7 @@ public:
|
||||
void AddCrystals(uint32 Radiant, uint32 Ebon);
|
||||
void SendCrystalCounts();
|
||||
|
||||
uint32 GetExperienceForKill(Mob *against);
|
||||
void AddEXP(uint32 in_add_exp, uint8 conlevel = 0xFF, bool resexp = false);
|
||||
uint32 CalcEXP(uint8 conlevel = 0xFF);
|
||||
void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp=false);
|
||||
@@ -795,12 +797,12 @@ public:
|
||||
void AddAAPoints(uint32 points) { m_pp.aapoints += points; SendAlternateAdvancementStats(); }
|
||||
int GetAAPoints() { return m_pp.aapoints; }
|
||||
int GetSpentAA() { return m_pp.aapoints_spent; }
|
||||
uint32 GetRequiredAAExperience();
|
||||
|
||||
//old AA methods that we still use
|
||||
void ResetAA();
|
||||
void RefundAA();
|
||||
void SendClearAA();
|
||||
inline uint32 GetMaxAAXP(void) const { return max_AAXP; }
|
||||
inline uint32 GetAAXP() const { return m_pp.expAA; }
|
||||
inline uint32 GetAAPercent() const { return m_epp.perAA; }
|
||||
int16 CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id);
|
||||
@@ -1261,6 +1263,8 @@ public:
|
||||
|
||||
void CheckRegionTypeChanges();
|
||||
|
||||
int32 CalcATK();
|
||||
|
||||
protected:
|
||||
friend class Mob;
|
||||
void CalcItemBonuses(StatBonuses* newbon);
|
||||
@@ -1320,7 +1324,6 @@ private:
|
||||
|
||||
void HandleTraderPriceUpdate(const EQApplicationPacket *app);
|
||||
|
||||
int32 CalcATK();
|
||||
int32 CalcItemATKCap();
|
||||
int32 CalcHaste();
|
||||
|
||||
@@ -1491,7 +1494,6 @@ private:
|
||||
|
||||
uint32 tribute_master_id;
|
||||
|
||||
uint32 max_AAXP;
|
||||
bool npcflag;
|
||||
uint8 npclevel;
|
||||
bool feigned;
|
||||
|
||||
@@ -1355,8 +1355,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
|
||||
/* Set Total Seconds Played */
|
||||
TotalSecondsPlayed = m_pp.timePlayedMin * 60;
|
||||
/* Set Max AA XP */
|
||||
max_AAXP = RuleI(AA, ExpPerPoint);
|
||||
|
||||
/* If we can maintain intoxication across zones, check for it */
|
||||
if (!RuleB(Character, MaintainIntoxicationAcrossZones))
|
||||
m_pp.intoxication = 0;
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
+2
-1
@@ -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);
|
||||
|
||||
+56
-10
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "queryserv.h"
|
||||
#include "quest_parser_collection.h"
|
||||
#include "lua_parser.h"
|
||||
#include "string_ids.h"
|
||||
|
||||
#ifdef BOTS
|
||||
@@ -153,6 +154,26 @@ uint32 Client::CalcEXP(uint8 conlevel) {
|
||||
return in_add_exp;
|
||||
}
|
||||
|
||||
uint32 Client::GetExperienceForKill(Mob *against)
|
||||
{
|
||||
#ifdef LUA_EQEMU
|
||||
uint32 lua_ret = 0;
|
||||
bool ignoreDefault = false;
|
||||
lua_ret = LuaParser::Instance()->GetExperienceForKill(this, against, ignoreDefault);
|
||||
|
||||
if (ignoreDefault) {
|
||||
return lua_ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (against && against->IsNPC()) {
|
||||
uint32 level = (uint32)against->GetLevel();
|
||||
return EXP_FORMULA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
||||
|
||||
this->EVENT_ITEM_ScriptStopReturn();
|
||||
@@ -339,8 +360,8 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
||||
|
||||
void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
Log(Logs::Detail, Logs::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false");
|
||||
//max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51); //GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients
|
||||
max_AAXP = RuleI(AA, ExpPerPoint); //this may be redundant since we're doing this in Client::FinishConnState2()
|
||||
|
||||
auto max_AAXP = GetRequiredAAExperience();
|
||||
if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) {
|
||||
Message(13, "Error in Client::SetEXP. EXP not set.");
|
||||
return; // Must be invalid class/race
|
||||
@@ -377,19 +398,23 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
}
|
||||
|
||||
if (isrezzexp) {
|
||||
if (RuleI(Character, ShowExpValues) > 0) Message(MT_Experience, "You regain %s experience from resurrection. %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
if (RuleI(Character, ShowExpValues) > 0)
|
||||
Message(MT_Experience, "You regain %s experience from resurrection. %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else Message_StringID(MT_Experience, REZ_REGAIN);
|
||||
} else {
|
||||
if (membercount > 1) {
|
||||
if (RuleI(Character, ShowExpValues) > 0) Message(MT_Experience, "You have gained %s party experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
if (RuleI(Character, ShowExpValues) > 0)
|
||||
Message(MT_Experience, "You have gained %s party experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else Message_StringID(MT_Experience, GAIN_GROUPXP);
|
||||
}
|
||||
else if (IsRaidGrouped()) {
|
||||
if (RuleI(Character, ShowExpValues) > 0) Message(MT_Experience, "You have gained %s raid experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
if (RuleI(Character, ShowExpValues) > 0)
|
||||
Message(MT_Experience, "You have gained %s raid experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else Message_StringID(MT_Experience, GAIN_RAIDEXP);
|
||||
}
|
||||
else {
|
||||
if (RuleI(Character, ShowExpValues) > 0) Message(MT_Experience, "You have gained %s experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
if (RuleI(Character, ShowExpValues) > 0)
|
||||
Message(MT_Experience, "You have gained %s experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else Message_StringID(MT_Experience, GAIN_XP);
|
||||
}
|
||||
}
|
||||
@@ -460,14 +485,13 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
|
||||
//add in how many points we had
|
||||
m_pp.aapoints += last_unspentAA;
|
||||
//set_aaxp = m_pp.expAA % max_AAXP;
|
||||
|
||||
//figure out how many points were actually gained
|
||||
/*uint32 gained = m_pp.aapoints - last_unspentAA;*/ //unused
|
||||
|
||||
//Message(15, "You have gained %d skill points!!", m_pp.aapoints - last_unspentAA);
|
||||
char val1[20]={0};
|
||||
Message_StringID(MT_Experience, GAIN_ABILITY_POINT,ConvertArray(m_pp.aapoints, val1),m_pp.aapoints == 1 ? "" : "(s)"); //You have gained an ability point! You now have %1 ability point%2.
|
||||
Message_StringID(MT_Experience, GAIN_ABILITY_POINT, ConvertArray(m_pp.aapoints, val1),m_pp.aapoints == 1 ? "" : "(s)"); //You have gained an ability point! You now have %1 ability point%2.
|
||||
|
||||
/* QS: PlayerLogAARate */
|
||||
if (RuleB(QueryServ, PlayerLogAARate)){
|
||||
@@ -571,8 +595,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
char val1[20]={0};
|
||||
char val2[20]={0};
|
||||
char val3[20]={0};
|
||||
Message_StringID(MT_Experience, GM_GAINXP,ConvertArray(set_aaxp,val1),ConvertArray(set_exp,val2),ConvertArray(GetEXPForLevel(GetLevel()+1),val3)); //[GM] You have gained %1 AXP and %2 EXP (%3).
|
||||
//Message(15, "[GM] You now have %d / %d EXP and %d / %d AA exp.", set_exp, GetEXPForLevel(GetLevel()+1), set_aaxp, max_AAXP);
|
||||
Message_StringID(MT_Experience, GM_GAINXP, ConvertArray(set_aaxp,val1),ConvertArray(set_exp,val2),ConvertArray(GetEXPForLevel(GetLevel()+1),val3)); //[GM] You have gained %1 AXP and %2 EXP (%3).
|
||||
}
|
||||
}
|
||||
|
||||
@@ -664,6 +687,15 @@ void Client::SetLevel(uint8 set_level, bool command)
|
||||
// Add: You can set the values you want now, client will be always sync :) - Merkur
|
||||
uint32 Client::GetEXPForLevel(uint16 check_level)
|
||||
{
|
||||
#ifdef LUA_EQEMU
|
||||
uint32 lua_ret = 0;
|
||||
bool ignoreDefault = false;
|
||||
lua_ret = LuaParser::Instance()->GetEXPForLevel(this, check_level, ignoreDefault);
|
||||
|
||||
if (ignoreDefault) {
|
||||
return lua_ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint16 check_levelm1 = check_level-1;
|
||||
float mod;
|
||||
@@ -933,3 +965,17 @@ uint32 Client::GetCharMaxLevelFromQGlobal() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 Client::GetRequiredAAExperience() {
|
||||
#ifdef LUA_EQEMU
|
||||
uint32 lua_ret = 0;
|
||||
bool ignoreDefault = false;
|
||||
lua_ret = LuaParser::Instance()->GetRequiredAAExperience(this, ignoreDefault);
|
||||
|
||||
if (ignoreDefault) {
|
||||
return lua_ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return RuleI(AA, ExpPerPoint);
|
||||
}
|
||||
|
||||
+28
-3
@@ -1172,6 +1172,11 @@ uint64 Lua_Client::GetAllMoney() {
|
||||
return self->GetAllMoney();
|
||||
}
|
||||
|
||||
uint32 Lua_Client::GetMoney(uint8 type, uint8 subtype) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetMoney(type, subtype);
|
||||
}
|
||||
|
||||
void Lua_Client::OpenLFGuildWindow() {
|
||||
Lua_Safe_Call_Void();
|
||||
self->OpenLFGuildWindow();
|
||||
@@ -1414,9 +1419,25 @@ void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) {
|
||||
self->QuestReward(target, copper, silver, gold, platinum, itemid, exp, faction);
|
||||
}
|
||||
|
||||
uint32 Lua_Client::GetMoney(uint8 type, uint8 subtype) {
|
||||
bool Lua_Client::IsDead() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsDead();
|
||||
}
|
||||
|
||||
int Lua_Client::CalcCurrentWeight() {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetMoney(type, subtype);
|
||||
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() {
|
||||
@@ -1653,6 +1674,7 @@ luabind::scope lua_register_client() {
|
||||
.def("GetAggroCount", (int(Lua_Client::*)(void))&Lua_Client::GetAggroCount)
|
||||
.def("GetCarriedMoney", (uint64(Lua_Client::*)(void))&Lua_Client::GetCarriedMoney)
|
||||
.def("GetAllMoney", (uint64(Lua_Client::*)(void))&Lua_Client::GetAllMoney)
|
||||
.def("GetMoney", (uint32(Lua_Client::*)(uint8, uint8))&Lua_Client::GetMoney)
|
||||
.def("OpenLFGuildWindow", (void(Lua_Client::*)(void))&Lua_Client::OpenLFGuildWindow)
|
||||
.def("Signal", (void(Lua_Client::*)(uint32))&Lua_Client::Signal)
|
||||
.def("AddAlternateCurrencyValue", (void(Lua_Client::*)(uint32,int))&Lua_Client::AddAlternateCurrencyValue)
|
||||
@@ -1687,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("GetMoney", (uint32(Lua_Client::*)(uint8, uint8))&Lua_Client::GetMoney);
|
||||
.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() {
|
||||
|
||||
@@ -297,6 +297,10 @@ public:
|
||||
void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp);
|
||||
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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
bool IsDoor();
|
||||
bool IsTrap();
|
||||
bool IsBeacon();
|
||||
bool IsEncounter();
|
||||
bool IsBot();
|
||||
int GetID();
|
||||
|
||||
Lua_Client CastToClient();
|
||||
|
||||
+18
-11
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
+406
-2
@@ -7,6 +7,10 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include "../common/timer.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/classes.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "lua_parser.h"
|
||||
#include "lua_item.h"
|
||||
#include "lua_iteminst.h"
|
||||
@@ -16,8 +20,6 @@
|
||||
#include "quest_parser_collection.h"
|
||||
#include "questmgr.h"
|
||||
#include "qglobals.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "encounter.h"
|
||||
#include "lua_encounter.h"
|
||||
|
||||
@@ -27,6 +29,12 @@ struct Slots { };
|
||||
struct Materials { };
|
||||
struct ClientVersions { };
|
||||
struct Appearances { };
|
||||
struct Classes { };
|
||||
struct Skills { };
|
||||
struct BodyTypes { };
|
||||
struct Filters { };
|
||||
struct MessageTypes { };
|
||||
struct Rule { };
|
||||
|
||||
struct lua_registered_event {
|
||||
std::string encounter_name;
|
||||
@@ -1462,6 +1470,39 @@ void lua_create_npc(luabind::adl::object table, float x, float y, float z, float
|
||||
npc->GiveNPCTypeData(npc_type);
|
||||
entity_list.AddNPC(npc);
|
||||
}
|
||||
|
||||
int random_int(int low, int high) {
|
||||
return zone->random.Int(low, high);
|
||||
}
|
||||
|
||||
double random_real(double low, double high) {
|
||||
return zone->random.Real(low, high);
|
||||
}
|
||||
|
||||
bool random_roll_int(int required) {
|
||||
return zone->random.Roll(required);
|
||||
}
|
||||
|
||||
bool random_roll_real(double required) {
|
||||
return zone->random.Roll(required);
|
||||
}
|
||||
|
||||
int random_roll0(int max) {
|
||||
return zone->random.Roll0(max);
|
||||
}
|
||||
|
||||
int get_rulei(int rule) {
|
||||
return RuleManager::Instance()->GetIntRule((RuleManager::IntType)rule);
|
||||
}
|
||||
|
||||
float get_ruler(int rule) {
|
||||
return RuleManager::Instance()->GetRealRule((RuleManager::RealType)rule);
|
||||
}
|
||||
|
||||
bool get_ruleb(int rule) {
|
||||
return RuleManager::Instance()->GetBoolRule((RuleManager::BoolType)rule);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_general() {
|
||||
return luabind::namespace_("eq")
|
||||
[
|
||||
@@ -1663,6 +1704,18 @@ luabind::scope lua_register_general() {
|
||||
];
|
||||
}
|
||||
|
||||
luabind::scope lua_register_random() {
|
||||
return luabind::namespace_("Random")
|
||||
[
|
||||
luabind::def("Int", &random_int),
|
||||
luabind::def("Real", &random_real),
|
||||
luabind::def("Roll", &random_roll_int),
|
||||
luabind::def("RollReal", &random_roll_real),
|
||||
luabind::def("Roll0", &random_roll0)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
luabind::scope lua_register_events() {
|
||||
return luabind::class_<Events>("Event")
|
||||
.enum_("constants")
|
||||
@@ -1863,4 +1916,355 @@ luabind::scope lua_register_appearance() {
|
||||
];
|
||||
}
|
||||
|
||||
luabind::scope lua_register_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("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)
|
||||
];
|
||||
}
|
||||
|
||||
luabind::scope lua_register_rules_const() {
|
||||
return luabind::class_<Rule>("Rule")
|
||||
.enum_("constants")
|
||||
[
|
||||
#define RULE_INT(cat, rule, default_value) \
|
||||
luabind::value(#rule, RuleManager::Int__##rule),
|
||||
#include "../common/ruletypes.h"
|
||||
luabind::value("_IntRuleCount", RuleManager::_IntRuleCount),
|
||||
#undef RULE_INT
|
||||
#define RULE_REAL(cat, rule, default_value) \
|
||||
luabind::value(#rule, RuleManager::Real__##rule),
|
||||
#include "../common/ruletypes.h"
|
||||
luabind::value("_RealRuleCount", RuleManager::_RealRuleCount),
|
||||
#undef RULE_REAL
|
||||
#define RULE_BOOL(cat, rule, default_value) \
|
||||
luabind::value(#rule, RuleManager::Bool__##rule),
|
||||
#include "../common/ruletypes.h"
|
||||
luabind::value("_BoolRuleCount", RuleManager::_BoolRuleCount)
|
||||
];
|
||||
}
|
||||
|
||||
luabind::scope lua_register_rulei() {
|
||||
return luabind::namespace_("RuleI")
|
||||
[
|
||||
luabind::def("Get", &get_rulei)
|
||||
];
|
||||
}
|
||||
|
||||
luabind::scope lua_register_ruler() {
|
||||
return luabind::namespace_("RuleR")
|
||||
[
|
||||
luabind::def("Get", &get_ruler)
|
||||
];
|
||||
}
|
||||
|
||||
luabind::scope lua_register_ruleb() {
|
||||
return luabind::namespace_("RuleB")
|
||||
[
|
||||
luabind::def("Get", &get_ruleb)
|
||||
];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+11
-1
@@ -3,12 +3,22 @@
|
||||
#ifdef LUA_EQEMU
|
||||
|
||||
luabind::scope lua_register_general();
|
||||
luabind::scope lua_register_random();
|
||||
luabind::scope lua_register_events();
|
||||
luabind::scope lua_register_faction();
|
||||
luabind::scope lua_register_slot();
|
||||
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();
|
||||
luabind::scope lua_register_rules_const();
|
||||
luabind::scope lua_register_rulei();
|
||||
luabind::scope lua_register_ruler();
|
||||
luabind::scope lua_register_ruleb();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+114
-1
@@ -10,6 +10,7 @@
|
||||
#include "lua_mob.h"
|
||||
#include "lua_hate_list.h"
|
||||
#include "lua_client.h"
|
||||
#include "lua_stat_bonuses.h"
|
||||
|
||||
struct SpecialAbilities { };
|
||||
|
||||
@@ -1725,6 +1726,18 @@ int Lua_Mob::GetSkillDmgTaken(int skill) {
|
||||
return self->GetSkillDmgTaken(static_cast<EQEmu::skills::SkillType>(skill));
|
||||
}
|
||||
|
||||
int Lua_Mob::GetFcDamageAmtIncoming(Lua_Mob caster, uint32 spell_id, bool use_skill, uint16 skill)
|
||||
{
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetFcDamageAmtIncoming(caster, spell_id, use_skill, skill);
|
||||
}
|
||||
|
||||
int Lua_Mob::GetSkillDmgAmt(uint16 skill)
|
||||
{
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetSkillDmgAmt(skill);
|
||||
}
|
||||
|
||||
void Lua_Mob::SetAllowBeneficial(bool value) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetAllowBeneficial(value);
|
||||
@@ -1985,6 +1998,89 @@ int32 Lua_Mob::GetMeleeMitigation() {
|
||||
return self->GetMeleeMitigation();
|
||||
}
|
||||
|
||||
int Lua_Mob::GetWeaponDamageBonus(Lua_Item weapon, bool offhand) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetWeaponDamageBonus(weapon, offhand);
|
||||
}
|
||||
|
||||
Lua_StatBonuses Lua_Mob::GetItemBonuses()
|
||||
{
|
||||
Lua_Safe_Call_Class(Lua_StatBonuses);
|
||||
return self->GetItemBonusesPtr();
|
||||
}
|
||||
|
||||
Lua_StatBonuses Lua_Mob::GetSpellBonuses()
|
||||
{
|
||||
Lua_Safe_Call_Class(Lua_StatBonuses);
|
||||
return self->GetSpellBonusesPtr();
|
||||
}
|
||||
|
||||
Lua_StatBonuses Lua_Mob::GetAABonuses()
|
||||
{
|
||||
Lua_Safe_Call_Class(Lua_StatBonuses);
|
||||
return self->GetAABonusesPtr();
|
||||
}
|
||||
|
||||
int16 Lua_Mob::GetMeleeDamageMod_SE(uint16 skill)
|
||||
{
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetMeleeDamageMod_SE(skill);
|
||||
}
|
||||
|
||||
int16 Lua_Mob::GetMeleeMinDamageMod_SE(uint16 skill)
|
||||
{
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetMeleeMinDamageMod_SE(skill);
|
||||
}
|
||||
|
||||
bool Lua_Mob::IsAttackAllowed(Lua_Mob target, bool isSpellAttack) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsAttackAllowed(target, isSpellAttack);
|
||||
}
|
||||
|
||||
bool Lua_Mob::IsCasting() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsCasting();
|
||||
}
|
||||
|
||||
int Lua_Mob::AttackAnimation(int Hand, Lua_ItemInst weapon) {
|
||||
Lua_Safe_Call_Int();
|
||||
return (int)self->AttackAnimation(Hand, weapon);
|
||||
}
|
||||
|
||||
int Lua_Mob::GetWeaponDamage(Lua_Mob against, Lua_ItemInst weapon) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetWeaponDamage(against, weapon);
|
||||
}
|
||||
|
||||
bool Lua_Mob::IsBerserk() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsBerserk();
|
||||
}
|
||||
|
||||
bool Lua_Mob::TryFinishingBlow(Lua_Mob defender, int &damage) {
|
||||
Lua_Safe_Call_Bool();
|
||||
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();
|
||||
}
|
||||
|
||||
void Lua_Mob::CheckNumHitsRemaining(int type, int32 buff_slot, uint16 spell_id)
|
||||
{
|
||||
Lua_Safe_Call_Void();
|
||||
self->CheckNumHitsRemaining((NumHit)type, buff_slot, spell_id);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_mob() {
|
||||
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
|
||||
.def(luabind::constructor<>())
|
||||
@@ -2281,6 +2377,8 @@ luabind::scope lua_register_mob() {
|
||||
.def("ModSkillDmgTaken", (void(Lua_Mob::*)(int,int))&Lua_Mob::ModSkillDmgTaken)
|
||||
.def("GetModSkillDmgTaken", (int(Lua_Mob::*)(int))&Lua_Mob::GetModSkillDmgTaken)
|
||||
.def("GetSkillDmgTaken", (int(Lua_Mob::*)(int))&Lua_Mob::GetSkillDmgTaken)
|
||||
.def("GetFcDamageAmtIncoming", &Lua_Mob::GetFcDamageAmtIncoming)
|
||||
.def("GetSkillDmgAmt", (int(Lua_Mob::*)(int))&Lua_Mob::GetSkillDmgAmt)
|
||||
.def("SetAllowBeneficial", (void(Lua_Mob::*)(bool))&Lua_Mob::SetAllowBeneficial)
|
||||
.def("GetAllowBeneficial", (bool(Lua_Mob::*)(void))&Lua_Mob::GetAllowBeneficial)
|
||||
.def("IsBeneficialAllowed", (bool(Lua_Mob::*)(Lua_Mob))&Lua_Mob::IsBeneficialAllowed)
|
||||
@@ -2330,7 +2428,22 @@ luabind::scope lua_register_mob() {
|
||||
.def("HasPet", (bool(Lua_Mob::*)(void))&Lua_Mob::HasPet)
|
||||
.def("IsSilenced", (bool(Lua_Mob::*)(void))&Lua_Mob::IsSilenced)
|
||||
.def("IsAmnesiad", (bool(Lua_Mob::*)(void))&Lua_Mob::IsAmnesiad)
|
||||
.def("GetMeleeMitigation", (int32(Lua_Mob::*)(void))&Lua_Mob::GetMeleeMitigation);
|
||||
.def("GetMeleeMitigation", (int32(Lua_Mob::*)(void))&Lua_Mob::GetMeleeMitigation)
|
||||
.def("GetWeaponDamageBonus", &Lua_Mob::GetWeaponDamageBonus)
|
||||
.def("GetItemBonuses", &Lua_Mob::GetItemBonuses)
|
||||
.def("GetSpellBonuses", &Lua_Mob::GetSpellBonuses)
|
||||
.def("GetAABonuses", &Lua_Mob::GetAABonuses)
|
||||
.def("GetMeleeDamageMod_SE", &Lua_Mob::GetMeleeDamageMod_SE)
|
||||
.def("GetMeleeMinDamageMod_SE", &Lua_Mob::GetMeleeMinDamageMod_SE)
|
||||
.def("IsAttackAllowed", &Lua_Mob::IsAttackAllowed)
|
||||
.def("IsCasting", &Lua_Mob::IsCasting)
|
||||
.def("AttackAnimation", &Lua_Mob::AttackAnimation)
|
||||
.def("GetWeaponDamage", &Lua_Mob::GetWeaponDamage)
|
||||
.def("IsBerserk", &Lua_Mob::IsBerserk)
|
||||
.def("TryFinishingBlow", &Lua_Mob::TryFinishingBlow)
|
||||
.def("GetBodyType", &Lua_Mob::GetBodyType)
|
||||
.def("GetOrigBodyType", &Lua_Mob::GetOrigBodyType)
|
||||
.def("CheckNumHitsRemaining", &Lua_Mob::CheckNumHitsRemaining);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_special_abilities() {
|
||||
|
||||
+18
-1
@@ -8,6 +8,7 @@ class Mob;
|
||||
struct Lua_HateList;
|
||||
class Lua_Item;
|
||||
class Lua_ItemInst;
|
||||
class Lua_StatBonuses;
|
||||
|
||||
namespace luabind {
|
||||
struct scope;
|
||||
@@ -330,6 +331,8 @@ public:
|
||||
void ModSkillDmgTaken(int skill, int value);
|
||||
int GetModSkillDmgTaken(int skill);
|
||||
int GetSkillDmgTaken(int skill);
|
||||
int GetFcDamageAmtIncoming(Lua_Mob caster, uint32 spell_id, bool use_skill, uint16 skill);
|
||||
int GetSkillDmgAmt(uint16 skill);
|
||||
void SetAllowBeneficial(bool value);
|
||||
bool GetAllowBeneficial();
|
||||
bool IsBeneficialAllowed(Lua_Mob target);
|
||||
@@ -340,7 +343,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);
|
||||
@@ -381,6 +383,21 @@ public:
|
||||
bool IsSilenced();
|
||||
bool IsAmnesiad();
|
||||
int32 GetMeleeMitigation();
|
||||
int GetWeaponDamageBonus(Lua_Item weapon, bool offhand);
|
||||
Lua_StatBonuses GetItemBonuses();
|
||||
Lua_StatBonuses GetSpellBonuses();
|
||||
Lua_StatBonuses GetAABonuses();
|
||||
int16 GetMeleeDamageMod_SE(uint16 skill);
|
||||
int16 GetMeleeMinDamageMod_SE(uint16 skill);
|
||||
bool IsAttackAllowed(Lua_Mob target, bool isSpellAttack);
|
||||
bool IsCasting();
|
||||
int AttackAnimation(int Hand, Lua_ItemInst weapon);
|
||||
int GetWeaponDamage(Lua_Mob against, Lua_ItemInst weapon);
|
||||
bool IsBerserk();
|
||||
bool TryFinishingBlow(Lua_Mob defender, int &damage);
|
||||
int GetBodyType();
|
||||
int GetOrigBodyType();
|
||||
void CheckNumHitsRemaining(int type, int32 buff_slot, uint16 spell_id);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,631 @@
|
||||
#include "lua.hpp"
|
||||
#include <luabind/luabind.hpp>
|
||||
#include <luabind/object.hpp>
|
||||
|
||||
#include "../common/spdat.h"
|
||||
#include "masterentity.h"
|
||||
#include "questmgr.h"
|
||||
#include "zone.h"
|
||||
#include "zone_config.h"
|
||||
|
||||
#include "lua_parser.h"
|
||||
#include "lua_mod.h"
|
||||
#include "lua_bit.h"
|
||||
#include "lua_entity.h"
|
||||
#include "lua_item.h"
|
||||
#include "lua_iteminst.h"
|
||||
#include "lua_mob.h"
|
||||
#include "lua_hate_list.h"
|
||||
#include "lua_client.h"
|
||||
#include "lua_inventory.h"
|
||||
#include "lua_npc.h"
|
||||
#include "lua_spell.h"
|
||||
#include "lua_entity_list.h"
|
||||
#include "lua_group.h"
|
||||
#include "lua_raid.h"
|
||||
#include "lua_corpse.h"
|
||||
#include "lua_object.h"
|
||||
#include "lua_door.h"
|
||||
#include "lua_spawn.h"
|
||||
#include "lua_packet.h"
|
||||
#include "lua_general.h"
|
||||
#include "lua_encounter.h"
|
||||
#include "lua_stat_bonuses.h"
|
||||
|
||||
void LuaMod::Init()
|
||||
{
|
||||
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_try_critical_hit = parser_->HasFunction("TryCriticalHit", package_name_);
|
||||
m_has_get_required_aa_experience = parser_->HasFunction("GetRequiredAAExperience", package_name_);
|
||||
m_has_get_exp_for_level = parser_->HasFunction("GetEXPForLevel", package_name_);
|
||||
m_has_get_experience_for_kill = parser_->HasFunction("GetExperienceForKill", package_name_);
|
||||
m_has_common_outgoing_hit_success = parser_->HasFunction("CommonOutgoingHitSuccess", package_name_);
|
||||
}
|
||||
|
||||
void PutDamageHitInfo(lua_State *L, luabind::adl::object &e, DamageHitInfo &hit) {
|
||||
luabind::adl::object lua_hit = luabind::newtable(L);
|
||||
lua_hit["base_damage"] = hit.base_damage;
|
||||
lua_hit["min_damage"] = hit.min_damage;
|
||||
lua_hit["damage_done"] = hit.damage_done;
|
||||
lua_hit["offense"] = hit.offense;
|
||||
lua_hit["tohit"] = hit.tohit;
|
||||
lua_hit["hand"] = hit.hand;
|
||||
lua_hit["skill"] = (int)hit.skill;
|
||||
e["hit"] = lua_hit;
|
||||
}
|
||||
|
||||
void GetDamageHitInfo(luabind::adl::object &ret, DamageHitInfo &hit) {
|
||||
auto luaHitTable = ret["hit"];
|
||||
if (luabind::type(luaHitTable) == LUA_TTABLE) {
|
||||
auto base_damage = luaHitTable["base_damage"];
|
||||
auto min_damage = luaHitTable["min_damage"];
|
||||
auto damage_done = luaHitTable["damage_done"];
|
||||
auto offense = luaHitTable["offense"];
|
||||
auto tohit = luaHitTable["tohit"];
|
||||
auto hand = luaHitTable["hand"];
|
||||
auto skill = luaHitTable["skill"];
|
||||
|
||||
if (luabind::type(base_damage) == LUA_TNUMBER) {
|
||||
hit.base_damage = luabind::object_cast<int>(base_damage);
|
||||
}
|
||||
|
||||
if (luabind::type(min_damage) == LUA_TNUMBER) {
|
||||
hit.min_damage = luabind::object_cast<int>(min_damage);
|
||||
}
|
||||
|
||||
if (luabind::type(damage_done) == LUA_TNUMBER) {
|
||||
hit.damage_done = luabind::object_cast<int>(damage_done);
|
||||
}
|
||||
|
||||
if (luabind::type(offense) == LUA_TNUMBER) {
|
||||
hit.offense = luabind::object_cast<int>(offense);
|
||||
}
|
||||
|
||||
if (luabind::type(tohit) == LUA_TNUMBER) {
|
||||
hit.tohit = luabind::object_cast<int>(tohit);
|
||||
}
|
||||
|
||||
if (luabind::type(hand) == LUA_TNUMBER) {
|
||||
hit.hand = luabind::object_cast<int>(hand);
|
||||
}
|
||||
|
||||
if (luabind::type(skill) == LUA_TNUMBER) {
|
||||
hit.skill = (EQEmu::skills::SkillType)luabind::object_cast<int>(skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PutExtraAttackOptions(lua_State *L, luabind::adl::object &e, ExtraAttackOptions *opts) {
|
||||
if (opts) {
|
||||
luabind::adl::object lua_opts = luabind::newtable(L);
|
||||
lua_opts["damage_percent"] = opts->damage_percent;
|
||||
lua_opts["damage_flat"] = opts->damage_flat;
|
||||
lua_opts["armor_pen_percent"] = opts->armor_pen_percent;
|
||||
lua_opts["armor_pen_flat"] = opts->armor_pen_flat;
|
||||
lua_opts["crit_percent"] = opts->crit_percent;
|
||||
lua_opts["crit_flat"] = opts->crit_flat;
|
||||
lua_opts["hate_percent"] = opts->hate_percent;
|
||||
lua_opts["hate_flat"] = opts->hate_flat;
|
||||
lua_opts["hit_chance"] = opts->hit_chance;
|
||||
lua_opts["melee_damage_bonus_flat"] = opts->melee_damage_bonus_flat;
|
||||
lua_opts["skilldmgtaken_bonus_flat"] = opts->skilldmgtaken_bonus_flat;
|
||||
e["opts"] = lua_opts;
|
||||
}
|
||||
}
|
||||
|
||||
void GetExtraAttackOptions(luabind::adl::object &ret, ExtraAttackOptions *opts) {
|
||||
if (opts) {
|
||||
auto luaOptsTable = ret["opts"];
|
||||
if (luabind::type(luaOptsTable) == LUA_TTABLE) {
|
||||
auto damage_percent = luaOptsTable["damage_percent"];
|
||||
auto damage_flat = luaOptsTable["damage_flat"];
|
||||
auto armor_pen_percent = luaOptsTable["armor_pen_percent"];
|
||||
auto armor_pen_flat = luaOptsTable["armor_pen_flat"];
|
||||
auto crit_percent = luaOptsTable["crit_percent"];
|
||||
auto crit_flat = luaOptsTable["crit_flat"];
|
||||
auto hate_percent = luaOptsTable["hate_percent"];
|
||||
auto hate_flat = luaOptsTable["hate_flat"];
|
||||
auto hit_chance = luaOptsTable["hit_chance"];
|
||||
auto melee_damage_bonus_flat = luaOptsTable["melee_damage_bonus_flat"];
|
||||
auto skilldmgtaken_bonus_flat = luaOptsTable["skilldmgtaken_bonus_flat"];
|
||||
|
||||
if (luabind::type(damage_percent) == LUA_TNUMBER) {
|
||||
opts->damage_percent = luabind::object_cast<float>(damage_percent);
|
||||
}
|
||||
|
||||
if (luabind::type(damage_flat) == LUA_TNUMBER) {
|
||||
opts->damage_flat = luabind::object_cast<int>(damage_flat);
|
||||
}
|
||||
|
||||
if (luabind::type(armor_pen_percent) == LUA_TNUMBER) {
|
||||
opts->armor_pen_percent = luabind::object_cast<float>(armor_pen_percent);
|
||||
}
|
||||
|
||||
if (luabind::type(armor_pen_flat) == LUA_TNUMBER) {
|
||||
opts->armor_pen_flat = luabind::object_cast<int>(armor_pen_flat);
|
||||
}
|
||||
|
||||
if (luabind::type(crit_percent) == LUA_TNUMBER) {
|
||||
opts->crit_percent = luabind::object_cast<float>(crit_percent);
|
||||
}
|
||||
|
||||
if (luabind::type(crit_flat) == LUA_TNUMBER) {
|
||||
opts->crit_flat = luabind::object_cast<float>(crit_flat);
|
||||
}
|
||||
|
||||
if (luabind::type(hate_percent) == LUA_TNUMBER) {
|
||||
opts->hate_percent = luabind::object_cast<float>(hate_percent);
|
||||
}
|
||||
|
||||
if (luabind::type(hate_flat) == LUA_TNUMBER) {
|
||||
opts->hate_flat = luabind::object_cast<int>(hate_flat);
|
||||
}
|
||||
|
||||
if (luabind::type(hit_chance) == LUA_TNUMBER) {
|
||||
opts->hit_chance = luabind::object_cast<int>(hit_chance);
|
||||
}
|
||||
|
||||
if (luabind::type(melee_damage_bonus_flat) == LUA_TNUMBER) {
|
||||
opts->melee_damage_bonus_flat = luabind::object_cast<int>(melee_damage_bonus_flat);
|
||||
}
|
||||
|
||||
if (luabind::type(skilldmgtaken_bonus_flat) == LUA_TNUMBER) {
|
||||
opts->skilldmgtaken_bonus_flat = luabind::object_cast<int>(skilldmgtaken_bonus_flat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LuaMod::MeleeMitigation(Mob *self, Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault) {
|
||||
int start = lua_gettop(L);
|
||||
|
||||
try {
|
||||
if (!m_has_melee_mitigation) {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
|
||||
lua_getfield(L, -1, "MeleeMitigation");
|
||||
|
||||
Lua_Mob l_self(self);
|
||||
Lua_Mob l_other(attacker);
|
||||
luabind::adl::object e = luabind::newtable(L);
|
||||
e["self"] = l_self;
|
||||
e["other"] = l_other;
|
||||
|
||||
PutDamageHitInfo(L, e, hit);
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
GetDamageHitInfo(ret, hit);
|
||||
GetExtraAttackOptions(ret, opts);
|
||||
}
|
||||
}
|
||||
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::ApplyDamageTable(Mob *self, DamageHitInfo &hit, bool &ignoreDefault) {
|
||||
int start = lua_gettop(L);
|
||||
|
||||
try {
|
||||
if (!m_has_apply_damage_table) {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
|
||||
lua_getfield(L, -1, "ApplyDamageTable");
|
||||
|
||||
Lua_Mob l_self(self);
|
||||
luabind::adl::object e = luabind::newtable(L);
|
||||
e["self"] = l_self;
|
||||
|
||||
PutDamageHitInfo(L, e, hit);
|
||||
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);
|
||||
}
|
||||
|
||||
GetDamageHitInfo(ret, hit);
|
||||
}
|
||||
}
|
||||
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::AvoidDamage(Mob *self, Mob *other, DamageHitInfo &hit, bool &returnValue, bool &ignoreDefault) {
|
||||
int start = lua_gettop(L);
|
||||
|
||||
try {
|
||||
if (!m_has_avoid_damage) {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
|
||||
lua_getfield(L, -1, "AvoidDamage");
|
||||
|
||||
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;
|
||||
|
||||
PutDamageHitInfo(L, e, hit);
|
||||
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);
|
||||
}
|
||||
|
||||
auto returnValueObj = ret["ReturnValue"];
|
||||
if (luabind::type(returnValueObj) == LUA_TBOOLEAN) {
|
||||
returnValue = luabind::object_cast<bool>(returnValueObj);
|
||||
}
|
||||
|
||||
GetDamageHitInfo(ret, hit);
|
||||
}
|
||||
}
|
||||
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::CheckHitChance(Mob *self, Mob* other, DamageHitInfo &hit, bool &returnValue, bool &ignoreDefault) {
|
||||
int start = lua_gettop(L);
|
||||
|
||||
try {
|
||||
if (!m_has_check_hit_chance) {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
|
||||
lua_getfield(L, -1, "CheckHitChance");
|
||||
|
||||
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;
|
||||
|
||||
PutDamageHitInfo(L, e, hit);
|
||||
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);
|
||||
}
|
||||
|
||||
auto returnValueObj = ret["ReturnValue"];
|
||||
if (luabind::type(returnValueObj) == LUA_TBOOLEAN) {
|
||||
returnValue = luabind::object_cast<bool>(returnValueObj);
|
||||
}
|
||||
|
||||
GetDamageHitInfo(ret, hit);
|
||||
}
|
||||
}
|
||||
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::CommonOutgoingHitSuccess(Mob *self, Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
|
||||
{
|
||||
int start = lua_gettop(L);
|
||||
|
||||
try {
|
||||
if (!m_has_common_outgoing_hit_success) {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
|
||||
lua_getfield(L, -1, "CommonOutgoingHitSuccess");
|
||||
|
||||
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;
|
||||
|
||||
PutDamageHitInfo(L, e, hit);
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
GetDamageHitInfo(ret, hit);
|
||||
GetExtraAttackOptions(ret, opts);
|
||||
}
|
||||
}
|
||||
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::TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault) {
|
||||
int start = lua_gettop(L);
|
||||
|
||||
try {
|
||||
if (!m_has_try_critical_hit) {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
|
||||
lua_getfield(L, -1, "TryCriticalHit");
|
||||
|
||||
Lua_Mob l_self(self);
|
||||
Lua_Mob l_other(defender);
|
||||
luabind::adl::object e = luabind::newtable(L);
|
||||
e["self"] = l_self;
|
||||
e["other"] = l_other;
|
||||
|
||||
PutDamageHitInfo(L, e, hit);
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
GetDamageHitInfo(ret, hit);
|
||||
GetExtraAttackOptions(ret, opts);
|
||||
}
|
||||
}
|
||||
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::GetRequiredAAExperience(Client *self, uint32 &returnValue, bool &ignoreDefault)
|
||||
{
|
||||
int start = lua_gettop(L);
|
||||
|
||||
try {
|
||||
if (!m_has_get_required_aa_experience) {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
|
||||
lua_getfield(L, -1, "GetRequiredAAExperience");
|
||||
|
||||
Lua_Client l_self(self);
|
||||
luabind::adl::object e = luabind::newtable(L);
|
||||
e["self"] = l_self;
|
||||
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);
|
||||
}
|
||||
|
||||
auto returnValueObj = ret["ReturnValue"];
|
||||
if (luabind::type(returnValueObj) == LUA_TNUMBER) {
|
||||
returnValue = luabind::object_cast<uint32>(returnValueObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
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::GetEXPForLevel(Client *self, uint16 level, uint32 &returnValue, bool &ignoreDefault) {
|
||||
int start = lua_gettop(L);
|
||||
|
||||
try {
|
||||
if (!m_has_get_exp_for_level) {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
|
||||
lua_getfield(L, -1, "GetEXPForLevel");
|
||||
|
||||
Lua_Client l_self(self);
|
||||
luabind::adl::object e = luabind::newtable(L);
|
||||
e["self"] = l_self;
|
||||
e["level"] = level;
|
||||
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);
|
||||
}
|
||||
|
||||
auto returnValueObj = ret["ReturnValue"];
|
||||
if (luabind::type(returnValueObj) == LUA_TNUMBER) {
|
||||
returnValue = luabind::object_cast<uint32>(returnValueObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
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::GetExperienceForKill(Client *self, Mob *against, uint32 &returnValue, bool &ignoreDefault)
|
||||
{
|
||||
int start = lua_gettop(L);
|
||||
uint32 retval = 0;
|
||||
|
||||
try {
|
||||
if (!m_has_get_experience_for_kill) {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, package_name_.c_str());
|
||||
lua_getfield(L, -1, "GetExperienceForKill");
|
||||
|
||||
Lua_Client l_self(self);
|
||||
Lua_Mob l_other(against);
|
||||
luabind::adl::object e = luabind::newtable(L);
|
||||
e["self"] = l_self;
|
||||
e["other"] = l_other;
|
||||
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);
|
||||
}
|
||||
|
||||
auto returnValueObj = ret["ReturnValue"];
|
||||
if (luabind::type(returnValueObj) == LUA_TNUMBER) {
|
||||
returnValue = luabind::object_cast<uint32>(returnValueObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception &ex) {
|
||||
parser_->AddError(ex.what());
|
||||
}
|
||||
|
||||
int end = lua_gettop(L);
|
||||
int n = end - start;
|
||||
if (n > 0) {
|
||||
lua_pop(L, n);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
struct lua_State;
|
||||
|
||||
class LuaParser;
|
||||
class LuaMod
|
||||
{
|
||||
public:
|
||||
LuaMod(lua_State *ls, LuaParser *lp, const std::string &package_name) {
|
||||
L = ls;
|
||||
parser_ = lp;
|
||||
package_name_ = package_name;
|
||||
Init();
|
||||
}
|
||||
~LuaMod() { }
|
||||
void Init();
|
||||
|
||||
void MeleeMitigation(Mob *self, Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
|
||||
void ApplyDamageTable(Mob *self, DamageHitInfo &hit, bool &ignoreDefault);
|
||||
void AvoidDamage(Mob *self, Mob *other, DamageHitInfo &hit, bool &returnValue, bool &ignoreDefault);
|
||||
void CheckHitChance(Mob *self, Mob* other, DamageHitInfo &hit, bool &returnValue, bool &ignoreDefault);
|
||||
void CommonOutgoingHitSuccess(Mob *self, Mob* other, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
|
||||
void TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
|
||||
void GetRequiredAAExperience(Client *self, uint32 &returnValue, bool &ignoreDefault);
|
||||
void GetEXPForLevel(Client *self, uint16 level, uint32 &returnValue, bool &ignoreDefault);
|
||||
void GetExperienceForKill(Client *self, Mob *against, uint32 &returnValue, bool &ignoreDefault);
|
||||
private:
|
||||
LuaParser *parser_;
|
||||
lua_State *L;
|
||||
std::string package_name_;
|
||||
|
||||
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_common_outgoing_hit_success;
|
||||
bool m_has_try_critical_hit;
|
||||
bool m_has_get_required_aa_experience;
|
||||
bool m_has_get_exp_for_level;
|
||||
bool m_has_get_experience_for_kill;
|
||||
};
|
||||
+14
-1
@@ -498,6 +498,17 @@ uint8 Lua_NPC::GetMerchantProbability() {
|
||||
return self->GetMerchantProbability();
|
||||
}
|
||||
|
||||
int Lua_NPC::GetRawAC() {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetRawAC();
|
||||
}
|
||||
|
||||
int Lua_NPC::GetAvoidanceRating()
|
||||
{
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetAvoidanceRating();
|
||||
}
|
||||
|
||||
luabind::scope lua_register_npc() {
|
||||
return luabind::class_<Lua_NPC, Lua_Mob>("NPC")
|
||||
.def(luabind::constructor<>())
|
||||
@@ -598,7 +609,9 @@ 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)
|
||||
.def("GetAvoidanceRating", &Lua_NPC::GetAvoidanceRating);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -125,6 +125,8 @@ public:
|
||||
void MerchantCloseShop();
|
||||
void SetMerchantProbability(uint8 amt);
|
||||
uint8 GetMerchantProbability();
|
||||
int GetRawAC();
|
||||
int GetAvoidanceRating();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+144
-23
@@ -10,8 +10,13 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "masterentity.h"
|
||||
#include "../common/spdat.h"
|
||||
#include "masterentity.h"
|
||||
#include "questmgr.h"
|
||||
#include "zone.h"
|
||||
#include "zone_config.h"
|
||||
|
||||
#include "lua_parser.h"
|
||||
#include "lua_bit.h"
|
||||
#include "lua_entity.h"
|
||||
#include "lua_item.h"
|
||||
@@ -31,11 +36,8 @@
|
||||
#include "lua_spawn.h"
|
||||
#include "lua_packet.h"
|
||||
#include "lua_general.h"
|
||||
#include "questmgr.h"
|
||||
#include "zone.h"
|
||||
#include "zone_config.h"
|
||||
#include "lua_parser.h"
|
||||
#include "lua_encounter.h"
|
||||
#include "lua_stat_bonuses.h"
|
||||
|
||||
const char *LuaEvents[_LargestEventID] = {
|
||||
"event_say",
|
||||
@@ -799,12 +801,14 @@ void LuaParser::Init() {
|
||||
void LuaParser::ReloadQuests() {
|
||||
loaded_.clear();
|
||||
errors_.clear();
|
||||
mods_.clear();
|
||||
lua_encounter_events_registered.clear();
|
||||
lua_encounters_loaded.clear();
|
||||
|
||||
for (auto encounter : lua_encounters) {
|
||||
encounter.second->Depop();
|
||||
}
|
||||
|
||||
lua_encounters.clear();
|
||||
// so the Depop function above depends on the Process being called again so ...
|
||||
// And there is situations where it wouldn't be :P
|
||||
@@ -817,6 +821,8 @@ void LuaParser::ReloadQuests() {
|
||||
L = luaL_newstate();
|
||||
luaL_openlibs(L);
|
||||
|
||||
auto top = lua_gettop(L);
|
||||
|
||||
if(luaopen_bit(L) != 1) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
AddError(error);
|
||||
@@ -830,7 +836,7 @@ void LuaParser::ReloadQuests() {
|
||||
#ifdef SANITIZE_LUA_LIBS
|
||||
//io
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L, "io");
|
||||
//lua_setglobal(L, "io");
|
||||
|
||||
//some os/debug are okay some are not
|
||||
lua_getglobal(L, "os");
|
||||
@@ -933,24 +939,48 @@ void LuaParser::ReloadQuests() {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
AddError(error);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
zone_script = Config->QuestDir;
|
||||
zone_script += "/";
|
||||
zone_script += zone->GetShortName();
|
||||
zone_script += "/script_init.lua";
|
||||
f = fopen(zone_script.c_str(), "r");
|
||||
if (f) {
|
||||
fclose(f);
|
||||
|
||||
zone_script = Config->QuestDir;
|
||||
zone_script += "/";
|
||||
zone_script += zone->GetShortName();
|
||||
zone_script += "/script_init.lua";
|
||||
f = fopen(zone_script.c_str(), "r");
|
||||
if(f) {
|
||||
fclose(f);
|
||||
|
||||
if(luaL_dofile(L, zone_script.c_str())) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
AddError(error);
|
||||
if (luaL_dofile(L, zone_script.c_str())) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
AddError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FILE *load_order = fopen("mods/load_order.txt", "r");
|
||||
if (load_order) {
|
||||
char file_name[256] = { 0 };
|
||||
while (fgets(file_name, 256, load_order) != nullptr) {
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
auto c = file_name[i];
|
||||
if (c == '\n' || c == '\r' || c == ' ') {
|
||||
file_name[i] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LoadScript("mods/" + std::string(file_name), file_name);
|
||||
mods_.push_back(LuaMod(L, this, file_name));
|
||||
}
|
||||
|
||||
fclose(load_order);
|
||||
}
|
||||
|
||||
auto end = lua_gettop(L);
|
||||
int n = end - top;
|
||||
if (n > 0) {
|
||||
lua_pop(L, n);
|
||||
}
|
||||
}
|
||||
|
||||
void LuaParser::LoadScript(std::string filename, std::string package_name) {
|
||||
@@ -959,6 +989,7 @@ void LuaParser::LoadScript(std::string filename, std::string package_name) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto top = lua_gettop(L);
|
||||
if(luaL_loadfile(L, filename.c_str())) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
AddError(error);
|
||||
@@ -986,14 +1017,20 @@ void LuaParser::LoadScript(std::string filename, std::string package_name) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
AddError(error);
|
||||
lua_pop(L, 1);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
loaded_[package_name] = true;
|
||||
}
|
||||
|
||||
loaded_[package_name] = true;
|
||||
auto end = lua_gettop(L);
|
||||
int n = end - top;
|
||||
if (n > 0) {
|
||||
lua_pop(L, n);
|
||||
}
|
||||
}
|
||||
|
||||
bool LuaParser::HasFunction(std::string subname, std::string package_name) {
|
||||
std::transform(subname.begin(), subname.end(), subname.begin(), ::tolower);
|
||||
//std::transform(subname.begin(), subname.end(), subname.begin(), ::tolower);
|
||||
|
||||
auto iter = loaded_.find(package_name);
|
||||
if(iter == loaded_.end()) {
|
||||
@@ -1020,12 +1057,18 @@ void LuaParser::MapFunctions(lua_State *L) {
|
||||
luabind::module(L)
|
||||
[
|
||||
lua_register_general(),
|
||||
lua_register_random(),
|
||||
lua_register_events(),
|
||||
lua_register_faction(),
|
||||
lua_register_slot(),
|
||||
lua_register_material(),
|
||||
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(),
|
||||
@@ -1054,7 +1097,12 @@ void LuaParser::MapFunctions(lua_State *L) {
|
||||
lua_register_door(),
|
||||
lua_register_object(),
|
||||
lua_register_packet(),
|
||||
lua_register_packet_opcodes()
|
||||
lua_register_packet_opcodes(),
|
||||
lua_register_stat_bonuses(),
|
||||
lua_register_rules_const(),
|
||||
lua_register_rulei(),
|
||||
lua_register_ruler(),
|
||||
lua_register_ruleb()
|
||||
];
|
||||
|
||||
} catch(std::exception &ex) {
|
||||
@@ -1251,3 +1299,76 @@ QuestEventID LuaParser::ConvertLuaEvent(QuestEventID evt) {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void LuaParser::MeleeMitigation(Mob *self, Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
|
||||
{
|
||||
for (auto &mod : mods_) {
|
||||
mod.MeleeMitigation(self, attacker, hit, opts, ignoreDefault);
|
||||
}
|
||||
}
|
||||
|
||||
void LuaParser::ApplyDamageTable(Mob *self, DamageHitInfo &hit, bool &ignoreDefault)
|
||||
{
|
||||
for (auto &mod : mods_) {
|
||||
mod.ApplyDamageTable(self, hit, ignoreDefault);
|
||||
}
|
||||
}
|
||||
|
||||
bool LuaParser::AvoidDamage(Mob *self, Mob *other, DamageHitInfo &hit, bool & ignoreDefault)
|
||||
{
|
||||
bool retval = false;
|
||||
for (auto &mod : mods_) {
|
||||
mod.AvoidDamage(self, other, hit, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool LuaParser::CheckHitChance(Mob *self, Mob *other, DamageHitInfo &hit, bool &ignoreDefault)
|
||||
{
|
||||
bool retval = false;
|
||||
for (auto &mod : mods_) {
|
||||
mod.CheckHitChance(self, other, hit, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
void LuaParser::TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
|
||||
{
|
||||
for (auto &mod : mods_) {
|
||||
mod.TryCriticalHit(self, defender, hit, opts, ignoreDefault);
|
||||
}
|
||||
}
|
||||
|
||||
void LuaParser::CommonOutgoingHitSuccess(Mob *self, Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
|
||||
{
|
||||
for (auto &mod : mods_) {
|
||||
mod.CommonOutgoingHitSuccess(self, other, hit, opts, ignoreDefault);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 LuaParser::GetRequiredAAExperience(Client *self, bool &ignoreDefault)
|
||||
{
|
||||
uint32 retval = 0;
|
||||
for (auto &mod : mods_) {
|
||||
mod.GetRequiredAAExperience(self, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint32 LuaParser::GetEXPForLevel(Client *self, uint16 level, bool &ignoreDefault)
|
||||
{
|
||||
uint32 retval = 0;
|
||||
for (auto &mod : mods_) {
|
||||
mod.GetEXPForLevel(self, level, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint32 LuaParser::GetExperienceForKill(Client *self, Mob *against, bool &ignoreDefault)
|
||||
{
|
||||
uint32 retval = 0;
|
||||
for (auto &mod : mods_) {
|
||||
mod.GetExperienceForKill(self, against, retval, ignoreDefault);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
+25
-3
@@ -7,8 +7,10 @@
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <exception>
|
||||
|
||||
#include "zone_config.h"
|
||||
#include "lua_mod.h"
|
||||
|
||||
extern const ZoneConfig *Config;
|
||||
|
||||
@@ -32,7 +34,6 @@ namespace luabind {
|
||||
|
||||
class LuaParser : public QuestInterface {
|
||||
public:
|
||||
LuaParser();
|
||||
~LuaParser();
|
||||
|
||||
virtual int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
@@ -81,7 +82,29 @@ public:
|
||||
virtual int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<EQEmu::Any> *extra_pointers);
|
||||
|
||||
static LuaParser* Instance() {
|
||||
static LuaParser inst;
|
||||
return &inst;
|
||||
}
|
||||
|
||||
bool HasFunction(std::string function, std::string package_name);
|
||||
|
||||
//Mod Extensions
|
||||
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 TryCriticalHit(Mob *self, Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
|
||||
void CommonOutgoingHitSuccess(Mob *self, Mob* other, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault);
|
||||
uint32 GetRequiredAAExperience(Client *self, bool &ignoreDefault);
|
||||
uint32 GetEXPForLevel(Client *self, uint16 level, bool &ignoreDefault);
|
||||
uint32 GetExperienceForKill(Client *self, Mob *against, bool &ignoreDefault);
|
||||
|
||||
private:
|
||||
LuaParser();
|
||||
LuaParser(const LuaParser&);
|
||||
LuaParser& operator=(const LuaParser&);
|
||||
|
||||
int _EventNPC(std::string package_name, QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<EQEmu::Any> *extra_pointers, luabind::adl::object *l_func = nullptr);
|
||||
int _EventPlayer(std::string package_name, QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
@@ -94,13 +117,12 @@ private:
|
||||
std::vector<EQEmu::Any> *extra_pointers);
|
||||
|
||||
void LoadScript(std::string filename, std::string package_name);
|
||||
bool HasFunction(std::string function, std::string package_name);
|
||||
void ClearStates();
|
||||
void MapFunctions(lua_State *L);
|
||||
QuestEventID ConvertLuaEvent(QuestEventID evt);
|
||||
|
||||
std::map<std::string, std::string> vars_;
|
||||
std::map<std::string, bool> loaded_;
|
||||
std::vector<LuaMod> mods_;
|
||||
lua_State *L;
|
||||
|
||||
NPCArgumentHandler NPCArgumentDispatch[_LargestEventID];
|
||||
|
||||
+9
-1
@@ -2,13 +2,21 @@
|
||||
#define EQEMU_LUA_PTR_H
|
||||
#ifdef LUA_EQEMU
|
||||
|
||||
//TODO: Remove the error checking by a flag since this adds significant overhead to each c call
|
||||
#ifndef EQEMU_UNSAFE_LUA
|
||||
#define Lua_Safe_Call_Void() if(!d_) { return; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Bool() if(!d_) { return false; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Int() if(!d_) { return 0; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Real() if(!d_) { return 0.0; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_String() if(!d_) { return ""; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Class(type) if(!d_) { return type(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#else
|
||||
#define Lua_Safe_Call_Void() NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Bool() NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Int() NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Real() NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_String() NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Class(type) NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
class Lua_Ptr
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,285 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef LUA_EQEMU
|
||||
|
||||
#include "lua_ptr.h"
|
||||
#include "common.h"
|
||||
|
||||
struct StatBonuses;
|
||||
|
||||
namespace luabind {
|
||||
struct scope;
|
||||
}
|
||||
|
||||
luabind::scope lua_register_stat_bonuses();
|
||||
|
||||
class Lua_StatBonuses : public Lua_Ptr<StatBonuses>
|
||||
{
|
||||
typedef StatBonuses NativeType;
|
||||
public:
|
||||
Lua_StatBonuses() : Lua_Ptr(nullptr) { }
|
||||
Lua_StatBonuses(StatBonuses *d) : Lua_Ptr(d) { }
|
||||
virtual ~Lua_StatBonuses() { }
|
||||
|
||||
operator StatBonuses*() {
|
||||
return reinterpret_cast<StatBonuses*>(GetLuaPtrData());
|
||||
}
|
||||
|
||||
int32 GetAC() const;
|
||||
int32 GetHP() const;
|
||||
int32 GetHPRegen() const;
|
||||
int32 GetMaxHP() const;
|
||||
int32 GetManaRegen() const;
|
||||
int32 GetEnduranceRegen() const;
|
||||
int32 GetMana() const;
|
||||
int32 GetEndurance() const;
|
||||
int32 GetATK() const;
|
||||
int32 GetSTR() const;
|
||||
int32 GetSTRCapMod() const;
|
||||
int32 GetHeroicSTR() const;
|
||||
int32 GetSTA() const;
|
||||
int32 GetSTACapMod() const;
|
||||
int32 GetHeroicSTA() const;
|
||||
int32 GetDEX() const;
|
||||
int32 GetDEXCapMod() const;
|
||||
int32 GetHeroicDEX() const;
|
||||
int32 GetAGI() const;
|
||||
int32 GetAGICapMod() const;
|
||||
int32 GetHeroicAGI() const;
|
||||
int32 GetINT() const;
|
||||
int32 GetINTCapMod() const;
|
||||
int32 GetHeroicINT() const;
|
||||
int32 GetWIS() const;
|
||||
int32 GetWISCapMod() const;
|
||||
int32 GetHeroicWIS() const;
|
||||
int32 GetCHA() const;
|
||||
int32 GetCHACapMod() const;
|
||||
int32 GetHeroicCHA() const;
|
||||
int32 GetMR() const;
|
||||
int32 GetMRCapMod() const;
|
||||
int32 GetHeroicMR() const;
|
||||
int32 GetFR() const;
|
||||
int32 GetFRCapMod() const;
|
||||
int32 GetHeroicFR() const;
|
||||
int32 GetCR() const;
|
||||
int32 GetCRCapMod() const;
|
||||
int32 GetHeroicCR() const;
|
||||
int32 GetPR() const;
|
||||
int32 GetPRCapMod() const;
|
||||
int32 GetHeroicPR() const;
|
||||
int32 GetDR() const;
|
||||
int32 GetDRCapMod() const;
|
||||
int32 GetHeroicDR() const;
|
||||
int32 GetCorrup() const;
|
||||
int32 GetCorrupCapMod() const;
|
||||
int32 GetHeroicCorrup() const;
|
||||
uint16 GetDamageShieldSpellID() const;
|
||||
int GetDamageShield() const;
|
||||
int GetDamageShieldType() const;
|
||||
int GetSpellDamageShield() const;
|
||||
int GetSpellShield() const;
|
||||
int GetReverseDamageShield() const;
|
||||
uint16 GetReverseDamageShieldSpellID() const;
|
||||
int GetReverseDamageShieldType() const;
|
||||
int Getmovementspeed() const;
|
||||
int32 Gethaste() const;
|
||||
int32 Gethastetype2() const;
|
||||
int32 Gethastetype3() const;
|
||||
int32 Getinhibitmelee() const;
|
||||
float GetAggroRange() const;
|
||||
float GetAssistRange() const;
|
||||
int32 Getskillmod(int idx) const;
|
||||
int32 Getskillmodmax(int idx) const;
|
||||
int Geteffective_casting_level() const;
|
||||
int Getreflect_chance() const;
|
||||
uint32 GetsingingMod() const;
|
||||
uint32 GetAmplification() const;
|
||||
uint32 GetbrassMod() const;
|
||||
uint32 GetpercussionMod() const;
|
||||
uint32 GetwindMod() const;
|
||||
uint32 GetstringedMod() const;
|
||||
uint32 GetsongModCap() const;
|
||||
int8 Gethatemod() const;
|
||||
int32 GetEnduranceReduction() const;
|
||||
int32 GetStrikeThrough() const;
|
||||
int32 GetMeleeMitigation() const;
|
||||
int32 GetMeleeMitigationEffect() const;
|
||||
int32 GetCriticalHitChance(int idx) const;
|
||||
int32 GetCriticalSpellChance() const;
|
||||
int32 GetSpellCritDmgIncrease() const;
|
||||
int32 GetSpellCritDmgIncNoStack() const;
|
||||
int32 GetDotCritDmgIncrease() const;
|
||||
int32 GetCriticalHealChance() const;
|
||||
int32 GetCriticalHealOverTime() const;
|
||||
int32 GetCriticalDoTChance() const;
|
||||
int32 GetCrippBlowChance() const;
|
||||
int32 GetAvoidMeleeChance() const;
|
||||
int32 GetAvoidMeleeChanceEffect() const;
|
||||
int32 GetRiposteChance() const;
|
||||
int32 GetDodgeChance() const;
|
||||
int32 GetParryChance() const;
|
||||
int32 GetDualWieldChance() const;
|
||||
int32 GetDoubleAttackChance() const;
|
||||
int32 GetTripleAttackChance() const;
|
||||
int32 GetDoubleRangedAttack() const;
|
||||
int32 GetResistSpellChance() const;
|
||||
int32 GetResistFearChance() const;
|
||||
bool GetFearless() const;
|
||||
bool GetIsFeared() const;
|
||||
bool GetIsBlind() const;
|
||||
int32 GetStunResist() const;
|
||||
int32 GetMeleeSkillCheck() const;
|
||||
uint8 GetMeleeSkillCheckSkill() const;
|
||||
int32 GetHitChance() const;
|
||||
int32 GetHitChanceEffect(int idx) const;
|
||||
int32 GetDamageModifier(int idx) const;
|
||||
int32 GetDamageModifier2(int idx) const;
|
||||
int32 GetMinDamageModifier(int idx) const;
|
||||
int32 GetProcChance() const;
|
||||
int32 GetProcChanceSPA() const;
|
||||
int32 GetExtraAttackChance() const;
|
||||
int32 GetDoTShielding() const;
|
||||
int32 GetFlurryChance() const;
|
||||
int32 GetHundredHands() const;
|
||||
int32 GetMeleeLifetap() const;
|
||||
int32 GetVampirism() const;
|
||||
int32 GetHealRate() const;
|
||||
int32 GetMaxHPChange() const;
|
||||
int32 GetHealAmt() const;
|
||||
int32 GetSpellDmg() const;
|
||||
int32 GetClairvoyance() const;
|
||||
int32 GetDSMitigation() const;
|
||||
int32 GetDSMitigationOffHand() const;
|
||||
int32 GetTwoHandBluntBlock() const;
|
||||
uint32 GetItemManaRegenCap() const;
|
||||
int32 GetGravityEffect() const;
|
||||
bool GetAntiGate() const;
|
||||
bool GetMagicWeapon() const;
|
||||
int32 GetIncreaseBlockChance() const;
|
||||
uint32 GetPersistantCasting() const;
|
||||
int GetXPRateMod() const;
|
||||
bool GetBlockNextSpell() const;
|
||||
bool GetImmuneToFlee() const;
|
||||
uint32 GetVoiceGraft() const;
|
||||
int32 GetSpellProcChance() const;
|
||||
int32 GetCharmBreakChance() const;
|
||||
int32 GetSongRange() const;
|
||||
uint32 GetHPToManaConvert() const;
|
||||
bool GetNegateEffects() const;
|
||||
bool GetTriggerMeleeThreshold() const;
|
||||
bool GetTriggerSpellThreshold() const;
|
||||
int32 GetShieldBlock() const;
|
||||
int32 GetBlockBehind() const;
|
||||
bool GetCriticalRegenDecay() const;
|
||||
bool GetCriticalHealDecay() const;
|
||||
bool GetCriticalDotDecay() const;
|
||||
bool GetDivineAura() const;
|
||||
bool GetDistanceRemoval() const;
|
||||
int32 GetFrenziedDevastation() const;
|
||||
bool GetNegateIfCombat() const;
|
||||
int8 GetScreech() const;
|
||||
int32 GetAlterNPCLevel() const;
|
||||
bool GetBerserkSPA() const;
|
||||
int32 GetMetabolism() const;
|
||||
bool GetSanctuary() const;
|
||||
int32 GetFactionModPct() const;
|
||||
uint32 GetPC_Pet_Flurry() const;
|
||||
int8 GetPackrat() const;
|
||||
uint8 GetBuffSlotIncrease() const;
|
||||
uint32 GetDelayDeath() const;
|
||||
int8 GetBaseMovementSpeed() const;
|
||||
uint8 GetIncreaseRunSpeedCap() const;
|
||||
int32 GetDoubleSpecialAttack() const;
|
||||
uint8 GetFrontalStunResist() const;
|
||||
int32 GetBindWound() const;
|
||||
int32 GetMaxBindWound() const;
|
||||
int32 GetChannelChanceSpells() const;
|
||||
int32 GetChannelChanceItems() const;
|
||||
uint8 GetSeeInvis() const;
|
||||
uint8 GetTripleBackstab() const;
|
||||
bool GetFrontalBackstabMinDmg() const;
|
||||
uint8 GetFrontalBackstabChance() const;
|
||||
uint8 GetConsumeProjectile() const;
|
||||
uint8 GetForageAdditionalItems() const;
|
||||
uint8 GetSalvageChance() const;
|
||||
uint32 GetArcheryDamageModifier() const;
|
||||
bool GetSecondaryDmgInc() const;
|
||||
uint32 GetGiveDoubleAttack() const;
|
||||
int32 GetPetCriticalHit() const;
|
||||
int32 GetPetAvoidance() const;
|
||||
int32 GetCombatStability() const;
|
||||
int32 GetDoubleRiposte() const;
|
||||
int32 GetAmbidexterity() const;
|
||||
int32 GetPetMaxHP() const;
|
||||
int32 GetPetFlurry() const;
|
||||
uint8 GetMasteryofPast() const;
|
||||
bool GetGivePetGroupTarget() const;
|
||||
int32 GetRootBreakChance() const;
|
||||
int32 GetUnfailingDivinity() const;
|
||||
int32 GetItemHPRegenCap() const;
|
||||
int32 GetOffhandRiposteFail() const;
|
||||
int32 GetItemATKCap() const;
|
||||
int32 GetShieldEquipDmgMod() const;
|
||||
bool GetTriggerOnValueAmount() const;
|
||||
int8 GetStunBashChance() const;
|
||||
int8 GetIncreaseChanceMemwipe() const;
|
||||
int8 GetCriticalMend() const;
|
||||
int32 GetImprovedReclaimEnergy() const;
|
||||
int32 GetPetMeleeMitigation() const;
|
||||
bool GetIllusionPersistence() const;
|
||||
uint16 Getextra_xtargets() const;
|
||||
bool GetShroudofStealth() const;
|
||||
uint16 GetReduceFallDamage() const;
|
||||
uint8 GetTradeSkillMastery() const;
|
||||
int16 GetNoBreakAESneak() const;
|
||||
int16 GetFeignedCastOnChance() const;
|
||||
int32 GetDivineSaveChance(int idx) const;
|
||||
uint32 GetDeathSave(int idx) const;
|
||||
int32 GetAccuracy(int idx) const;
|
||||
int16 GetSkillDmgTaken(int idx) const;
|
||||
uint32 GetSpellTriggers(int idx) const;
|
||||
uint32 GetSpellOnKill(int idx) const;
|
||||
uint32 GetSpellOnDeath(int idx) const;
|
||||
int32 GetCritDmgMod(int idx) const;
|
||||
int32 GetSkillReuseTime(int idx) const;
|
||||
int32 GetSkillDamageAmount(int idx) const;
|
||||
int GetHPPercCap(int idx) const;
|
||||
int GetManaPercCap(int idx) const;
|
||||
int GetEndPercCap(int idx) const;
|
||||
uint8 GetFocusEffects(int idx) const;
|
||||
int16 GetFocusEffectsWorn(int idx) const;
|
||||
int32 GetSkillDamageAmount2(int idx) const;
|
||||
uint32 GetNegateAttacks(int idx) const;
|
||||
uint32 GetMitigateMeleeRune(int idx) const;
|
||||
uint32 GetMeleeThresholdGuard(int idx) const;
|
||||
uint32 GetSpellThresholdGuard(int idx) const;
|
||||
uint32 GetMitigateSpellRune(int idx) const;
|
||||
uint32 GetMitigateDotRune(int idx) const;
|
||||
uint32 GetManaAbsorbPercentDamage(int idx) const;
|
||||
int32 GetImprovedTaunt(int idx) const;
|
||||
int8 GetRoot(int idx) const;
|
||||
uint32 GetAbsorbMagicAtt(int idx) const;
|
||||
uint32 GetMeleeRune(int idx) const;
|
||||
int32 GetAStacker(int idx) const;
|
||||
int32 GetBStacker(int idx) const;
|
||||
int32 GetCStacker(int idx) const;
|
||||
int32 GetDStacker(int idx) const;
|
||||
bool GetLimitToSkill(int idx) const;
|
||||
uint32 GetSkillProc(int idx) const;
|
||||
uint32 GetSkillProcSuccess(int idx) const;
|
||||
uint32 GetPC_Pet_Rampage(int idx) const;
|
||||
int32 GetSkillAttackProc(int idx) const;
|
||||
int32 GetSlayUndead(int idx) const;
|
||||
int32 GetGiveDoubleRiposte(int idx) const;
|
||||
uint32 GetRaiseSkillCap(int idx) const;
|
||||
int32 GetSEResist(int idx) const;
|
||||
int32 GetFinishingBlow(int idx) const;
|
||||
uint32 GetFinishingBlowLvl(int idx) const;
|
||||
uint32 GetHeadShot(int idx) const;
|
||||
uint8 GetHSLevel(int idx) const;
|
||||
uint32 GetAssassinate(int idx) const;
|
||||
uint8 GetAssassinateLevel(int idx) const;
|
||||
int32 GetReduceTradeskillFail(int idx) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
+3
-6
@@ -4677,16 +4677,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;
|
||||
}
|
||||
|
||||
+7
-4
@@ -233,7 +233,7 @@ public:
|
||||
inline bool SeeImprovedHide() const { return see_improved_hide; }
|
||||
bool IsInvisible(Mob* other = 0) const;
|
||||
void SetInvisible(uint8 state);
|
||||
bool AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const EQEmu::ItemInstance* weapon);
|
||||
EQEmu::skills::SkillType AttackAnimation(int Hand, const EQEmu::ItemInstance* weapon);
|
||||
|
||||
//Song
|
||||
bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1);
|
||||
@@ -446,6 +446,9 @@ public:
|
||||
inline StatBonuses GetItemBonuses() const { return itembonuses; }
|
||||
inline StatBonuses GetSpellBonuses() const { return spellbonuses; }
|
||||
inline StatBonuses GetAABonuses() const { return aabonuses; }
|
||||
inline StatBonuses* GetItemBonusesPtr() { return &itembonuses; }
|
||||
inline StatBonuses* GetSpellBonusesPtr() { return &spellbonuses; }
|
||||
inline StatBonuses* GetAABonusesPtr() { return &aabonuses; }
|
||||
inline virtual int32 GetMaxSTR() const { return GetSTR(); }
|
||||
inline virtual int32 GetMaxSTA() const { return GetSTA(); }
|
||||
inline virtual int32 GetMaxDEX() const { return GetDEX(); }
|
||||
@@ -694,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();
|
||||
@@ -1060,6 +1063,8 @@ public:
|
||||
void AddAssistCap() { ++npc_assist_cap; }
|
||||
void DelAssistCap() { --npc_assist_cap; }
|
||||
void ResetAssistCap() { npc_assist_cap = 0; }
|
||||
int GetWeaponDamage(Mob *against, const EQEmu::ItemData *weapon_item);
|
||||
int GetWeaponDamage(Mob *against, const EQEmu::ItemInstance *weapon_item, uint32 *hate = nullptr);
|
||||
|
||||
// Bots HealRotation methods
|
||||
#ifdef BOTS
|
||||
@@ -1209,8 +1214,6 @@ protected:
|
||||
virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = EQEmu::inventory::slotPrimary, Mob *on = nullptr);
|
||||
virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0); // hand = MainCharm?
|
||||
uint16 GetWeaponSpeedbyHand(uint16 hand);
|
||||
int GetWeaponDamage(Mob *against, const EQEmu::ItemData *weapon_item);
|
||||
int GetWeaponDamage(Mob *against, const EQEmu::ItemInstance *weapon_item, uint32 *hate = nullptr);
|
||||
#ifdef BOTS
|
||||
virtual
|
||||
#endif
|
||||
|
||||
+1
-6
@@ -391,8 +391,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
parse = new QuestParserCollection();
|
||||
#ifdef LUA_EQEMU
|
||||
auto lua_parser = new LuaParser();
|
||||
parse->RegisterQuestInterface(lua_parser, "lua");
|
||||
parse->RegisterQuestInterface(LuaParser::Instance(), "lua");
|
||||
#endif
|
||||
|
||||
#ifdef EMBPERL
|
||||
@@ -565,10 +564,6 @@ int main(int argc, char** argv) {
|
||||
safe_delete(perl_parser);
|
||||
#endif
|
||||
|
||||
#ifdef LUA_EQEMU
|
||||
safe_delete(lua_parser);
|
||||
#endif
|
||||
|
||||
safe_delete(Config);
|
||||
|
||||
if (zone != 0)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "entity.h"
|
||||
#include "mob.h"
|
||||
#include "string_ids.h"
|
||||
#include "lua_parser.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -758,7 +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)
|
||||
{
|
||||
|
||||
if ((other == nullptr ||
|
||||
((IsClient() && CastToClient()->dead) || (other->IsClient() && other->CastToClient()->dead)) ||
|
||||
HasDied() || (!IsAttackAllowed(other)) || (other->GetInvul() || other->GetSpecialAbility(IMMUNE_MELEE)))) {
|
||||
|
||||
+7
-8
@@ -596,8 +596,7 @@ int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage)
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::skills::SkillType skillinuse;
|
||||
AttackAnimation(skillinuse, Hand, weapon);
|
||||
EQEmu::skills::SkillType skillinuse = AttackAnimation(Hand, weapon);
|
||||
|
||||
int damage = 0;
|
||||
uint8 mylevel = GetLevel() ? GetLevel() : 1;
|
||||
@@ -665,16 +664,16 @@ void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_ch
|
||||
weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary);
|
||||
|
||||
if(weapon && weapon->IsWeapon()){
|
||||
attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotPrimary, weapon);
|
||||
skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotPrimary, weapon);
|
||||
}
|
||||
else {
|
||||
weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary);
|
||||
if (weapon && weapon->IsWeapon())
|
||||
attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotSecondary, weapon);
|
||||
skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotSecondary, weapon);
|
||||
else {
|
||||
weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotRange);
|
||||
if (weapon && weapon->IsWeapon())
|
||||
attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotRange, weapon);
|
||||
skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotRange, weapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -745,16 +744,16 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_
|
||||
weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary);
|
||||
|
||||
if(weapon && weapon->IsWeapon()){
|
||||
attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotPrimary, weapon);
|
||||
skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotPrimary, weapon);
|
||||
}
|
||||
else {
|
||||
weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary);
|
||||
if (weapon && weapon->IsWeapon())
|
||||
attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotSecondary, weapon);
|
||||
skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotSecondary, weapon);
|
||||
else {
|
||||
weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotRange);
|
||||
if (weapon && weapon->IsWeapon())
|
||||
attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotRange, weapon);
|
||||
skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotRange, weapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user