mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
Fix for luabind not compiling (jumbers), bunch of api upgrades for lua, changed where spells and items load quests from, removed some old code. etc etc.
This commit is contained in:
parent
7af04798fb
commit
2529a7700e
393
common/Item.cpp
393
common/Item.cpp
@ -65,6 +65,13 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) {
|
||||
m_color = 0;
|
||||
m_merchantcount = 1;
|
||||
m_SerialNumber = GetNextItemInstSerialNumber();
|
||||
|
||||
m_exp = 0;
|
||||
m_evolveLvl = 0;
|
||||
m_activated = false;
|
||||
m_scaledItem = nullptr;
|
||||
m_evolveInfo = nullptr;
|
||||
m_scaling = false;
|
||||
}
|
||||
|
||||
ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
|
||||
@ -80,6 +87,13 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
|
||||
m_color = 0;
|
||||
m_merchantcount = 1;
|
||||
m_SerialNumber = GetNextItemInstSerialNumber();
|
||||
|
||||
m_exp = 0;
|
||||
m_evolveLvl = 0;
|
||||
m_activated = false;
|
||||
m_scaledItem = nullptr;
|
||||
m_evolveInfo = nullptr;
|
||||
m_scaling = false;
|
||||
}
|
||||
|
||||
ItemInstQueue::~ItemInstQueue() {
|
||||
@ -171,12 +185,29 @@ ItemInst::ItemInst(const ItemInst& copy)
|
||||
m_SerialNumber = copy.m_SerialNumber;
|
||||
m_custom_data = copy.m_custom_data;
|
||||
m_timers = copy.m_timers;
|
||||
|
||||
m_exp = copy.m_exp;
|
||||
m_evolveLvl = copy.m_evolveLvl;
|
||||
m_activated = copy.m_activated;
|
||||
if (copy.m_scaledItem)
|
||||
m_scaledItem = new Item_Struct(*copy.m_scaledItem);
|
||||
else
|
||||
m_scaledItem = nullptr;
|
||||
|
||||
if(copy.m_evolveInfo)
|
||||
m_evolveInfo = new EvolveInfo(*copy.m_evolveInfo);
|
||||
else
|
||||
m_evolveInfo = nullptr;
|
||||
|
||||
m_scaling = copy.m_scaling;
|
||||
}
|
||||
|
||||
// Clean up container contents
|
||||
ItemInst::~ItemInst()
|
||||
{
|
||||
Clear();
|
||||
safe_delete(m_scaledItem);
|
||||
safe_delete(m_evolveInfo);
|
||||
}
|
||||
|
||||
// Clone a type of ItemInst object
|
||||
@ -649,6 +680,136 @@ void ItemInst::ClearTimers() {
|
||||
m_timers.clear();
|
||||
}
|
||||
|
||||
const Item_Struct* ItemInst::GetItem() const {
|
||||
if(!m_scaledItem)
|
||||
return m_item;
|
||||
else
|
||||
return m_scaledItem;
|
||||
}
|
||||
|
||||
const Item_Struct* ItemInst::GetUnscaledItem() const {
|
||||
return m_item;
|
||||
}
|
||||
|
||||
void ItemInst::Initialize(SharedDatabase *db) {
|
||||
// if there's no actual item, don't do anything
|
||||
if(!m_item)
|
||||
return;
|
||||
|
||||
// initialize scaling items
|
||||
if (m_item->CharmFileID != 0) {
|
||||
m_scaling = true;
|
||||
ScaleItem();
|
||||
}
|
||||
|
||||
// initialize evolving items
|
||||
else if ((db) && m_item->LoreGroup >= 1000 && m_item->LoreGroup != -1) {
|
||||
// not complete yet
|
||||
}
|
||||
}
|
||||
|
||||
void ItemInst::ScaleItem() {
|
||||
if(m_scaledItem) {
|
||||
memcpy(m_scaledItem, m_item, sizeof(Item_Struct));
|
||||
} else {
|
||||
m_scaledItem = new Item_Struct(*m_item);
|
||||
}
|
||||
|
||||
float Mult = (float)(GetExp())/10000; // scaling is determined by exp, with 10,000 being full stats
|
||||
|
||||
m_scaledItem->AStr = (int8)((float)m_item->AStr*Mult);
|
||||
m_scaledItem->ASta = (int8)((float)m_item->ASta*Mult);
|
||||
m_scaledItem->AAgi = (int8)((float)m_item->AAgi*Mult);
|
||||
m_scaledItem->ADex = (int8)((float)m_item->ADex*Mult);
|
||||
m_scaledItem->AInt = (int8)((float)m_item->AInt*Mult);
|
||||
m_scaledItem->AWis = (int8)((float)m_item->AWis*Mult);
|
||||
m_scaledItem->ACha = (int8)((float)m_item->ACha*Mult);
|
||||
|
||||
m_scaledItem->MR = (int8)((float)m_item->MR*Mult);
|
||||
m_scaledItem->PR = (int8)((float)m_item->PR*Mult);
|
||||
m_scaledItem->DR = (int8)((float)m_item->DR*Mult);
|
||||
m_scaledItem->CR = (int8)((float)m_item->CR*Mult);
|
||||
m_scaledItem->FR = (int8)((float)m_item->FR*Mult);
|
||||
|
||||
m_scaledItem->HP = (int32)((float)m_item->HP*Mult);
|
||||
m_scaledItem->Mana = (int32)((float)m_item->Mana*Mult);
|
||||
m_scaledItem->AC = (int32)((float)m_item->AC*Mult);
|
||||
|
||||
m_scaledItem->SkillModValue = (int32)((float)m_item->SkillModValue*Mult);
|
||||
m_scaledItem->BaneDmgAmt = (int8)((float)m_item->BaneDmgAmt*Mult);
|
||||
m_scaledItem->BardValue = (int32)((float)m_item->BardValue*Mult);
|
||||
m_scaledItem->ElemDmgAmt = (uint8)((float)m_item->ElemDmgAmt*Mult);
|
||||
m_scaledItem->Damage = (uint32)((float)m_item->Damage*Mult);
|
||||
|
||||
m_scaledItem->CombatEffects = (int8)((float)m_item->CombatEffects*Mult);
|
||||
m_scaledItem->Shielding = (int8)((float)m_item->Shielding*Mult);
|
||||
m_scaledItem->StunResist = (int8)((float)m_item->StunResist*Mult);
|
||||
m_scaledItem->StrikeThrough = (int8)((float)m_item->StrikeThrough*Mult);
|
||||
m_scaledItem->ExtraDmgAmt = (uint32)((float)m_item->ExtraDmgAmt*Mult);
|
||||
m_scaledItem->SpellShield = (int8)((float)m_item->SpellShield*Mult);
|
||||
m_scaledItem->Avoidance = (int8)((float)m_item->Avoidance*Mult);
|
||||
m_scaledItem->Accuracy = (int8)((float)m_item->Accuracy*Mult);
|
||||
|
||||
m_scaledItem->FactionAmt1 = (int32)((float)m_item->FactionAmt1*Mult);
|
||||
m_scaledItem->FactionAmt2 = (int32)((float)m_item->FactionAmt2*Mult);
|
||||
m_scaledItem->FactionAmt3 = (int32)((float)m_item->FactionAmt3*Mult);
|
||||
m_scaledItem->FactionAmt4 = (int32)((float)m_item->FactionAmt4*Mult);
|
||||
|
||||
m_scaledItem->Endur = (uint32)((float)m_item->Endur*Mult);
|
||||
m_scaledItem->DotShielding = (uint32)((float)m_item->DotShielding*Mult);
|
||||
m_scaledItem->Attack = (uint32)((float)m_item->Attack*Mult);
|
||||
m_scaledItem->Regen = (uint32)((float)m_item->Regen*Mult);
|
||||
m_scaledItem->ManaRegen = (uint32)((float)m_item->ManaRegen*Mult);
|
||||
m_scaledItem->EnduranceRegen = (uint32)((float)m_item->EnduranceRegen*Mult);
|
||||
m_scaledItem->Haste = (uint32)((float)m_item->Haste*Mult);
|
||||
m_scaledItem->DamageShield = (uint32)((float)m_item->DamageShield*Mult);
|
||||
|
||||
m_scaledItem->Purity = (uint32)((float)m_item->Purity*Mult);
|
||||
m_scaledItem->BackstabDmg = (uint32)((float)m_item->BackstabDmg*Mult);
|
||||
m_scaledItem->DSMitigation = (uint32)((float)m_item->DSMitigation*Mult);
|
||||
m_scaledItem->HeroicStr = (int32)((float)m_item->HeroicStr*Mult);
|
||||
m_scaledItem->HeroicInt = (int32)((float)m_item->HeroicInt*Mult);
|
||||
m_scaledItem->HeroicWis = (int32)((float)m_item->HeroicWis*Mult);
|
||||
m_scaledItem->HeroicAgi = (int32)((float)m_item->HeroicAgi*Mult);
|
||||
m_scaledItem->HeroicDex = (int32)((float)m_item->HeroicDex*Mult);
|
||||
m_scaledItem->HeroicSta = (int32)((float)m_item->HeroicSta*Mult);
|
||||
m_scaledItem->HeroicCha = (int32)((float)m_item->HeroicCha*Mult);
|
||||
m_scaledItem->HeroicMR = (int32)((float)m_item->HeroicMR*Mult);
|
||||
m_scaledItem->HeroicFR = (int32)((float)m_item->HeroicFR*Mult);
|
||||
m_scaledItem->HeroicCR = (int32)((float)m_item->HeroicCR*Mult);
|
||||
m_scaledItem->HeroicDR = (int32)((float)m_item->HeroicDR*Mult);
|
||||
m_scaledItem->HeroicPR = (int32)((float)m_item->HeroicPR*Mult);
|
||||
m_scaledItem->HeroicSVCorrup = (int32)((float)m_item->HeroicSVCorrup*Mult);
|
||||
m_scaledItem->HealAmt = (int32)((float)m_item->HealAmt*Mult);
|
||||
m_scaledItem->SpellDmg = (int32)((float)m_item->SpellDmg*Mult);
|
||||
m_scaledItem->Clairvoyance = (uint32)((float)m_item->Clairvoyance*Mult);
|
||||
|
||||
m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself.
|
||||
}
|
||||
|
||||
bool ItemInst::EvolveOnAllKills() const {
|
||||
return (m_evolveInfo && m_evolveInfo->AllKills);
|
||||
}
|
||||
|
||||
int8 ItemInst::GetMaxEvolveLvl() const {
|
||||
if(m_evolveInfo)
|
||||
return m_evolveInfo->MaxLvl;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 ItemInst::GetKillsNeeded(uint8 currentlevel) {
|
||||
uint32 kills = -1; // default to -1 (max uint32 value) because this value is usually divided by, so we don't want to ever return zero.
|
||||
if (m_evolveInfo)
|
||||
if (currentlevel != m_evolveInfo->MaxLvl)
|
||||
kills = m_evolveInfo->LvlKills[currentlevel-1];
|
||||
|
||||
if (kills == 0)
|
||||
kills = -1;
|
||||
|
||||
return kills;
|
||||
}
|
||||
|
||||
// Retrieve item at specified position within bag
|
||||
ItemInst* Inventory::GetItem(int16 slot_id, uint8 bagidx) const
|
||||
{
|
||||
@ -1119,14 +1280,10 @@ int Inventory::GetSlotByItemInst(ItemInst *inst) {
|
||||
return i;
|
||||
}
|
||||
|
||||
auto iter = m_cursor.begin();
|
||||
while(iter != m_cursor.end()) {
|
||||
if((*iter) == inst) {
|
||||
return SLOT_CURSOR;
|
||||
}
|
||||
++iter;
|
||||
if(m_cursor.peek_front() == inst) {
|
||||
return SLOT_CURSOR;
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1714,225 +1871,6 @@ bool Inventory::CanItemFitInContainer(const Item_Struct *ItemToTry, const Item_S
|
||||
return true;
|
||||
}
|
||||
|
||||
// Methods for EvoItemInst, the extended ItemInst for evolving/scaling items
|
||||
// Copy constructors
|
||||
EvoItemInst::EvoItemInst(const EvoItemInst ©) {
|
||||
m_use_type=copy.m_use_type;
|
||||
m_item=copy.m_item;
|
||||
m_charges=copy.m_charges;
|
||||
m_price=copy.m_price;
|
||||
m_color=copy.m_color;
|
||||
m_merchantslot=copy.m_merchantslot;
|
||||
m_currentslot=copy.m_currentslot;
|
||||
m_instnodrop=copy.m_instnodrop;
|
||||
m_merchantcount=copy.m_merchantcount;
|
||||
// Copy container contents
|
||||
iter_contents it;
|
||||
for (it=copy.m_contents.begin(); it!=copy.m_contents.end(); it++) {
|
||||
ItemInst* inst_old = it->second;
|
||||
ItemInst* inst_new = nullptr;
|
||||
|
||||
if (inst_old) {
|
||||
inst_new = inst_old->Clone();
|
||||
}
|
||||
|
||||
if (inst_new != nullptr) {
|
||||
m_contents[it->first] = inst_new;
|
||||
}
|
||||
}
|
||||
std::map<std::string, std::string>::const_iterator iter;
|
||||
for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); iter++) {
|
||||
m_custom_data[iter->first] = iter->second;
|
||||
}
|
||||
m_SerialNumber = copy.m_SerialNumber;
|
||||
m_exp = copy.m_exp;
|
||||
m_evolveLvl = copy.m_evolveLvl;
|
||||
m_activated = copy.m_activated;
|
||||
m_evolveInfo = nullptr;
|
||||
if (copy.m_scaledItem)
|
||||
m_scaledItem = new Item_Struct(*copy.m_scaledItem);
|
||||
else
|
||||
m_scaledItem = nullptr;
|
||||
|
||||
m_timers = copy.m_timers;
|
||||
}
|
||||
|
||||
EvoItemInst::EvoItemInst(const ItemInst &basecopy) {
|
||||
EvoItemInst* copy = (EvoItemInst*)&basecopy;
|
||||
|
||||
m_use_type=copy->m_use_type;
|
||||
m_item=copy->m_item;
|
||||
m_charges=copy->m_charges;
|
||||
m_price=copy->m_price;
|
||||
m_color=copy->m_color;
|
||||
m_merchantslot=copy->m_merchantslot;
|
||||
m_currentslot=copy->m_currentslot;
|
||||
m_instnodrop=copy->m_instnodrop;
|
||||
m_merchantcount=copy->m_merchantcount;
|
||||
// Copy container contents
|
||||
iter_contents it;
|
||||
for (it=copy->m_contents.begin(); it!=copy->m_contents.end(); it++) {
|
||||
ItemInst* inst_old = it->second;
|
||||
ItemInst* inst_new = nullptr;
|
||||
|
||||
if (inst_old) {
|
||||
inst_new = inst_old->Clone();
|
||||
}
|
||||
|
||||
if (inst_new != nullptr) {
|
||||
m_contents[it->first] = inst_new;
|
||||
}
|
||||
}
|
||||
|
||||
std::map<std::string, std::string>::const_iterator iter;
|
||||
for (iter = copy->m_custom_data.begin(); iter != copy->m_custom_data.end(); iter++) {
|
||||
m_custom_data[iter->first] = iter->second;
|
||||
}
|
||||
m_SerialNumber = copy->m_SerialNumber;
|
||||
m_exp = 0;
|
||||
m_evolveLvl = 0;
|
||||
m_activated = false;
|
||||
m_evolveInfo = nullptr;
|
||||
m_scaledItem = nullptr;
|
||||
m_timers = copy->m_timers;
|
||||
}
|
||||
|
||||
EvoItemInst::EvoItemInst(const Item_Struct* item, int16 charges) {
|
||||
m_use_type = ItemUseNormal;
|
||||
m_item = item;
|
||||
m_charges = charges;
|
||||
m_price = 0;
|
||||
m_instnodrop = false;
|
||||
m_merchantslot = 0;
|
||||
if(m_item &&m_item->ItemClass == ItemClassCommon)
|
||||
m_color = m_item->Color;
|
||||
else
|
||||
m_color = 0;
|
||||
m_merchantcount = 1;
|
||||
m_SerialNumber = GetNextItemInstSerialNumber();
|
||||
m_exp = 0;
|
||||
m_evolveLvl = 0;
|
||||
m_activated = false;
|
||||
m_evolveInfo = nullptr;
|
||||
m_scaledItem = nullptr;
|
||||
}
|
||||
|
||||
EvoItemInst::~EvoItemInst() {
|
||||
safe_delete(m_scaledItem);
|
||||
}
|
||||
|
||||
EvoItemInst* EvoItemInst::Clone() const {
|
||||
return new EvoItemInst(*this);
|
||||
}
|
||||
|
||||
const Item_Struct* EvoItemInst::GetItem() const {
|
||||
if(!m_scaledItem)
|
||||
return m_item;
|
||||
else
|
||||
return m_scaledItem;
|
||||
}
|
||||
|
||||
const Item_Struct* EvoItemInst::GetUnscaledItem() const {
|
||||
return m_item;
|
||||
}
|
||||
|
||||
void EvoItemInst::Initialize(SharedDatabase *db) {
|
||||
// if there's no actual item, don't do anything
|
||||
if(!m_item) return;
|
||||
|
||||
// initialize scaling items
|
||||
if (m_item->CharmFileID != 0) {
|
||||
m_evolveLvl = -1;
|
||||
this->ScaleItem();
|
||||
}
|
||||
|
||||
// initialize evolving items
|
||||
else if ((db) && m_item->LoreGroup >= 1000 && m_item->LoreGroup != -1) {
|
||||
// not complete yet
|
||||
}
|
||||
}
|
||||
|
||||
void EvoItemInst::ScaleItem() {
|
||||
// free memory from any previously scaled item data
|
||||
safe_delete(m_scaledItem);
|
||||
|
||||
m_scaledItem = new Item_Struct(*m_item);
|
||||
float Mult = (float)(GetExp())/10000; // scaling is determined by exp, with 10,000 being full stats
|
||||
|
||||
m_scaledItem->AStr = (int8)((float)m_item->AStr*Mult);
|
||||
m_scaledItem->ASta = (int8)((float)m_item->ASta*Mult);
|
||||
m_scaledItem->AAgi = (int8)((float)m_item->AAgi*Mult);
|
||||
m_scaledItem->ADex = (int8)((float)m_item->ADex*Mult);
|
||||
m_scaledItem->AInt = (int8)((float)m_item->AInt*Mult);
|
||||
m_scaledItem->AWis = (int8)((float)m_item->AWis*Mult);
|
||||
m_scaledItem->ACha = (int8)((float)m_item->ACha*Mult);
|
||||
|
||||
m_scaledItem->MR = (int8)((float)m_item->MR*Mult);
|
||||
m_scaledItem->PR = (int8)((float)m_item->PR*Mult);
|
||||
m_scaledItem->DR = (int8)((float)m_item->DR*Mult);
|
||||
m_scaledItem->CR = (int8)((float)m_item->CR*Mult);
|
||||
m_scaledItem->FR = (int8)((float)m_item->FR*Mult);
|
||||
|
||||
m_scaledItem->HP = (int32)((float)m_item->HP*Mult);
|
||||
m_scaledItem->Mana = (int32)((float)m_item->Mana*Mult);
|
||||
m_scaledItem->AC = (int32)((float)m_item->AC*Mult);
|
||||
|
||||
m_scaledItem->SkillModValue = (int32)((float)m_item->SkillModValue*Mult);
|
||||
m_scaledItem->BaneDmgAmt = (int8)((float)m_item->BaneDmgAmt*Mult);
|
||||
m_scaledItem->BardValue = (int32)((float)m_item->BardValue*Mult);
|
||||
m_scaledItem->ElemDmgAmt = (uint8)((float)m_item->ElemDmgAmt*Mult);
|
||||
m_scaledItem->Damage = (uint32)((float)m_item->Damage*Mult);
|
||||
|
||||
m_scaledItem->CombatEffects = (int8)((float)m_item->CombatEffects*Mult);
|
||||
m_scaledItem->Shielding = (int8)((float)m_item->Shielding*Mult);
|
||||
m_scaledItem->StunResist = (int8)((float)m_item->StunResist*Mult);
|
||||
m_scaledItem->StrikeThrough = (int8)((float)m_item->StrikeThrough*Mult);
|
||||
m_scaledItem->ExtraDmgAmt = (uint32)((float)m_item->ExtraDmgAmt*Mult);
|
||||
m_scaledItem->SpellShield = (int8)((float)m_item->SpellShield*Mult);
|
||||
m_scaledItem->Avoidance = (int8)((float)m_item->Avoidance*Mult);
|
||||
m_scaledItem->Accuracy = (int8)((float)m_item->Accuracy*Mult);
|
||||
|
||||
m_scaledItem->FactionAmt1 = (int32)((float)m_item->FactionAmt1*Mult);
|
||||
m_scaledItem->FactionAmt2 = (int32)((float)m_item->FactionAmt2*Mult);
|
||||
m_scaledItem->FactionAmt3 = (int32)((float)m_item->FactionAmt3*Mult);
|
||||
m_scaledItem->FactionAmt4 = (int32)((float)m_item->FactionAmt4*Mult);
|
||||
|
||||
m_scaledItem->Endur = (uint32)((float)m_item->Endur*Mult);
|
||||
m_scaledItem->DotShielding = (uint32)((float)m_item->DotShielding*Mult);
|
||||
m_scaledItem->Attack = (uint32)((float)m_item->Attack*Mult);
|
||||
m_scaledItem->Regen = (uint32)((float)m_item->Regen*Mult);
|
||||
m_scaledItem->ManaRegen = (uint32)((float)m_item->ManaRegen*Mult);
|
||||
m_scaledItem->EnduranceRegen = (uint32)((float)m_item->EnduranceRegen*Mult);
|
||||
m_scaledItem->Haste = (uint32)((float)m_item->Haste*Mult);
|
||||
m_scaledItem->DamageShield = (uint32)((float)m_item->DamageShield*Mult);
|
||||
|
||||
|
||||
m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself.
|
||||
}
|
||||
|
||||
bool EvoItemInst::EvolveOnAllKills() const {
|
||||
return (m_evolveInfo && m_evolveInfo->AllKills);
|
||||
}
|
||||
|
||||
int8 EvoItemInst::GetMaxEvolveLvl() const {
|
||||
if(m_evolveInfo)
|
||||
return m_evolveInfo->MaxLvl;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 EvoItemInst::GetKillsNeeded(uint8 currentlevel) {
|
||||
uint32 kills = -1; // default to -1 (max uint32 value) because this value is usually divided by, so we don't want to ever return zero.
|
||||
if (m_evolveInfo)
|
||||
if (currentlevel != m_evolveInfo->MaxLvl)
|
||||
kills = m_evolveInfo->LvlKills[currentlevel-1];
|
||||
|
||||
if (kills == 0)
|
||||
kills = -1;
|
||||
|
||||
return kills;
|
||||
}
|
||||
|
||||
EvolveInfo::EvolveInfo() {
|
||||
// nothing here yet
|
||||
}
|
||||
@ -1952,6 +1890,9 @@ EvolveInfo::EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32
|
||||
LvlKills[8] = L10;
|
||||
}
|
||||
|
||||
EvolveInfo::~EvolveInfo() {
|
||||
}
|
||||
|
||||
bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const
|
||||
{
|
||||
bool IsRace = false;
|
||||
|
||||
@ -27,7 +27,6 @@ class ItemInst; // Item belonging to a client (contains info on item, dye, au
|
||||
class ItemInstQueue; // Queue of ItemInst objects (i.e., cursor)
|
||||
class Inventory; // Character inventory
|
||||
class ItemParse; // Parses item packets
|
||||
class EvoItemInst; // Extended item inst, for use with scaling/evolving items
|
||||
class EvolveInfo; // Stores information about an evolving item family
|
||||
|
||||
#include <string>
|
||||
@ -135,7 +134,7 @@ public:
|
||||
// Public Methods
|
||||
///////////////////////////////
|
||||
|
||||
virtual ~Inventory();
|
||||
~Inventory();
|
||||
|
||||
// Retrieve a writeable item at specified slot
|
||||
ItemInst* GetItem(int16 slot_id) const;
|
||||
@ -269,21 +268,28 @@ public:
|
||||
m_instnodrop = false;
|
||||
m_merchantslot = 0;
|
||||
m_color = 0;
|
||||
|
||||
m_exp = 0;
|
||||
m_evolveLvl = 0;
|
||||
m_activated = false;
|
||||
m_scaledItem = nullptr;
|
||||
m_evolveInfo = nullptr;
|
||||
m_scaling = false;
|
||||
}
|
||||
|
||||
ItemInst(const ItemInst& copy);
|
||||
|
||||
virtual ~ItemInst();
|
||||
~ItemInst();
|
||||
|
||||
// Query item type
|
||||
virtual bool IsType(ItemClass item_class) const;
|
||||
bool IsType(ItemClass item_class) const;
|
||||
|
||||
// Can item be stacked?
|
||||
virtual bool IsStackable() const;
|
||||
bool IsStackable() const;
|
||||
|
||||
// Can item be equipped by/at?
|
||||
virtual bool IsEquipable(uint16 race, uint16 class_) const;
|
||||
virtual bool IsEquipable(int16 slot_id) const;
|
||||
bool IsEquipable(uint16 race, uint16 class_) const;
|
||||
bool IsEquipable(int16 slot_id) const;
|
||||
|
||||
//
|
||||
// Augements
|
||||
@ -299,7 +305,7 @@ public:
|
||||
// Contents
|
||||
//
|
||||
ItemInst* GetItem(uint8 slot) const;
|
||||
virtual uint32 GetItemID(uint8 slot) const;
|
||||
uint32 GetItemID(uint8 slot) const;
|
||||
inline const ItemInst* operator[](uint8 slot) const { return GetItem(slot); }
|
||||
void PutItem(uint8 slot, const ItemInst& inst);
|
||||
void PutItem(SharedDatabase *db, uint8 slot, uint32 item_id);
|
||||
@ -316,7 +322,7 @@ public:
|
||||
// Augments
|
||||
//
|
||||
ItemInst* GetAugment(uint8 slot) const;
|
||||
virtual uint32 GetAugmentItemID(uint8 slot) const;
|
||||
uint32 GetAugmentItemID(uint8 slot) const;
|
||||
void PutAugment(uint8 slot, const ItemInst& inst);
|
||||
void PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id);
|
||||
void DeleteAugment(uint8 slot);
|
||||
@ -324,14 +330,14 @@ public:
|
||||
bool IsAugmented();
|
||||
|
||||
// Has attack/delay?
|
||||
virtual bool IsWeapon() const;
|
||||
virtual bool IsAmmo() const;
|
||||
bool IsWeapon() const;
|
||||
bool IsAmmo() const;
|
||||
|
||||
// Accessors
|
||||
const uint32 GetID() const { return m_item->ID; }
|
||||
const uint32 GetItemScriptID() const { return m_item->ScriptFileID; }
|
||||
virtual const Item_Struct* GetItem() const { return m_item; }
|
||||
void SetItem(const Item_Struct* item) { m_item = item; }
|
||||
const Item_Struct* GetItem() const;
|
||||
const Item_Struct* GetUnscaledItem() const;
|
||||
|
||||
int16 GetCharges() const { return m_charges; }
|
||||
void SetCharges(int16 charges) { m_charges = charges; }
|
||||
@ -371,12 +377,25 @@ public:
|
||||
bool operator!=(const ItemInst& right) const { return (this->m_item != right.m_item); }
|
||||
|
||||
// Clone current item
|
||||
virtual ItemInst* Clone() const;
|
||||
ItemInst* Clone() const;
|
||||
|
||||
bool IsSlotAllowed(int16 slot_id) const;
|
||||
|
||||
virtual bool IsScaling() const { return false; }
|
||||
virtual bool IsEvolving() const { return false; }
|
||||
bool IsScaling() const { return m_scaling; }
|
||||
bool IsEvolving() const { return (m_evolveLvl >= 1); }
|
||||
uint32 GetExp() const { return m_exp; }
|
||||
void SetExp(uint32 exp) { m_exp = exp; }
|
||||
void AddExp(uint32 exp) { m_exp += exp; }
|
||||
bool IsActivated() { return m_activated; }
|
||||
void SetActivated(bool activated) { m_activated = activated; }
|
||||
int8 GetEvolveLvl() const { return m_evolveLvl; }
|
||||
void SetScaling(bool v) { m_scaling = v; }
|
||||
|
||||
void Initialize(SharedDatabase *db = nullptr);
|
||||
void ScaleItem();
|
||||
bool EvolveOnAllKills() const;
|
||||
int8 GetMaxEvolveLvl() const;
|
||||
uint32 GetKillsNeeded(uint8 currentlevel);
|
||||
|
||||
std::string Serialize(int16 slot_id) const { InternalSerializedItem_Struct s; s.slot_id=slot_id; s.inst=(const void *)this; std::string ser; ser.assign((char *)&s,sizeof(InternalSerializedItem_Struct)); return ser; }
|
||||
inline int32 GetSerialNumber() const { return m_SerialNumber; }
|
||||
@ -409,6 +428,13 @@ protected:
|
||||
bool m_instnodrop;
|
||||
int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited
|
||||
int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar.
|
||||
uint32 m_exp;
|
||||
int8 m_evolveLvl;
|
||||
bool m_activated;
|
||||
Item_Struct* m_scaledItem;
|
||||
EvolveInfo* m_evolveInfo;
|
||||
bool m_scaling;
|
||||
|
||||
//
|
||||
// Items inside of this item (augs or contents);
|
||||
std::map<uint8, ItemInst*> m_contents; // Zero-based index: min=0, max=9
|
||||
@ -416,45 +442,9 @@ protected:
|
||||
std::map<std::string, Timer> m_timers;
|
||||
};
|
||||
|
||||
class EvoItemInst: public ItemInst {
|
||||
public:
|
||||
// constructor and destructor
|
||||
EvoItemInst(const EvoItemInst& copy);
|
||||
EvoItemInst(const ItemInst& copy);
|
||||
EvoItemInst(const Item_Struct* item = nullptr, int16 charges = 0);
|
||||
~EvoItemInst();
|
||||
|
||||
// accessors... a lot of these are for evolving items (not complete yet)
|
||||
bool IsScaling() const { return (m_evolveLvl == -1); }
|
||||
bool IsEvolving() const { return (m_evolveLvl >= 1); }
|
||||
uint32 GetExp() const { return m_exp; }
|
||||
void SetExp(uint32 exp) { m_exp = exp; }
|
||||
void AddExp(uint32 exp) { m_exp += exp; }
|
||||
bool IsActivated() { return m_activated; }
|
||||
void SetActivated(bool activated) { m_activated = activated; }
|
||||
int8 GetEvolveLvl() const { return m_evolveLvl; }
|
||||
|
||||
EvoItemInst* Clone() const;
|
||||
const Item_Struct* GetItem() const;
|
||||
const Item_Struct* GetUnscaledItem() const;
|
||||
void Initialize(SharedDatabase *db = nullptr);
|
||||
void ScaleItem();
|
||||
bool EvolveOnAllKills() const;
|
||||
int8 GetMaxEvolveLvl() const;
|
||||
uint32 GetKillsNeeded(uint8 currentlevel);
|
||||
|
||||
|
||||
private:
|
||||
uint32 m_exp;
|
||||
int8 m_evolveLvl;
|
||||
bool m_activated;
|
||||
Item_Struct* m_scaledItem;
|
||||
const EvolveInfo* m_evolveInfo;
|
||||
};
|
||||
|
||||
class EvolveInfo {
|
||||
public:
|
||||
friend class EvoItemInst;
|
||||
friend class ItemInst;
|
||||
//temporary
|
||||
uint16 LvlKills[9];
|
||||
uint32 FirstItem;
|
||||
|
||||
@ -117,18 +117,11 @@ Zone extensions and features
|
||||
//New aggro system to reduce overhead.
|
||||
#define REVERSE_AGGRO
|
||||
|
||||
//Enable spacial queue to manage NPC update packets
|
||||
//#define PACKET_UPDATE_MANAGER
|
||||
//#define MANAGE_HP_UPDATES
|
||||
|
||||
//The highest you can #setskill / #setallskill
|
||||
#define HIGHEST_CAN_SET_SKILL 400
|
||||
|
||||
#define SKILL_MAX_LEVEL 75
|
||||
|
||||
//#define MIN_RANGED_ATK_RANGE 25
|
||||
//replaced the above define with RuleI(Combat, MinRangedAttackDist)
|
||||
|
||||
/*
|
||||
|
||||
Zone Numerical configuration
|
||||
@ -169,7 +162,7 @@ enum { //timer settings, all in milliseconds
|
||||
AItarget_check_duration = 500,
|
||||
AIClientScanarea_delay = 750, //used in REVERSE_AGGRO
|
||||
AIassistcheck_delay = 3000, //now often a fighting NPC will yell for help
|
||||
ClientProximity_interval = 1000,
|
||||
ClientProximity_interval = 150,
|
||||
CombatEventTimer_expire = 12000,
|
||||
Tribute_duration = 600000,
|
||||
ZoneTimerResolution = 3, //sleep time between zone main loop runs (milliseconds)
|
||||
|
||||
@ -1343,12 +1343,11 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges)
|
||||
if (charges == 0 && item->MaxCharges == -1)
|
||||
charges = 1;
|
||||
|
||||
inst = new ItemInst(item, charges);
|
||||
|
||||
if(item->CharmFileID != 0 || (item->LoreGroup >= 1000 && item->LoreGroup != -1)) {
|
||||
inst = new EvoItemInst(item, charges);
|
||||
((EvoItemInst*)inst)->Initialize(this);
|
||||
inst->Initialize(this);
|
||||
}
|
||||
else
|
||||
inst = new ItemInst(item, charges);
|
||||
}
|
||||
return inst;
|
||||
}
|
||||
|
||||
@ -323,7 +323,8 @@ namespace luabind
|
||||
|
||||
#endif // LUABIND_CALL_FUNCTION_HPP_INCLUDED
|
||||
|
||||
#elif BOOST_PP_ITERATION_FLAGS() == 1
|
||||
#else
|
||||
#if BOOST_PP_ITERATION_FLAGS() == 1
|
||||
|
||||
#define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
|
||||
#define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
|
||||
@ -438,6 +439,6 @@ namespace luabind
|
||||
#undef LUABIND_OPERATOR_PARAMS
|
||||
#undef LUABIND_TUPLE_PARAMS
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -316,7 +316,8 @@ namespace luabind
|
||||
|
||||
#endif // LUABIND_CALL_MEMBER_HPP_INCLUDED
|
||||
|
||||
#elif BOOST_PP_ITERATION_FLAGS() == 1
|
||||
#else
|
||||
#if BOOST_PP_ITERATION_FLAGS() == 1
|
||||
|
||||
#define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
|
||||
#define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
|
||||
@ -360,4 +361,5 @@ namespace luabind
|
||||
#undef LUABIND_TUPLE_PARAMS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -89,7 +89,8 @@ namespace luabind
|
||||
|
||||
#endif // LUABIND_WRAPPER_BASE_HPP_INCLUDED
|
||||
|
||||
#elif BOOST_PP_ITERATION_FLAGS() == 1
|
||||
#else
|
||||
#if BOOST_PP_ITERATION_FLAGS() == 1
|
||||
|
||||
#define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
|
||||
#define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
|
||||
@ -188,3 +189,4 @@ namespace luabind
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -104,7 +104,6 @@ SET(zone_sources
|
||||
trading.cpp
|
||||
trap.cpp
|
||||
tribute.cpp
|
||||
updatemgr.cpp
|
||||
watermap.cpp
|
||||
waypoints.cpp
|
||||
worldserver.cpp
|
||||
@ -187,7 +186,6 @@ SET(zone_headers
|
||||
tasks.h
|
||||
titles.h
|
||||
trap.h
|
||||
updatemgr.h
|
||||
watermap.h
|
||||
worldserver.h
|
||||
zone.h
|
||||
|
||||
@ -732,8 +732,10 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
|
||||
iter++;
|
||||
}
|
||||
|
||||
//second look for /quests/spells/spell_id.ext (precedence)
|
||||
filename = "quests/spells/";
|
||||
//second look for /quests/global/spells/spell_id.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/spells/";
|
||||
filename += itoa(spell_id);
|
||||
|
||||
iter = _load_precedence.begin();
|
||||
@ -750,7 +752,49 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
|
||||
}
|
||||
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
//third look for /quests/zone/spells/default.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename += zone->GetShortName();
|
||||
filename += "/spells/default";
|
||||
|
||||
iter = _load_precedence.begin();
|
||||
while(iter != _load_precedence.end()) {
|
||||
tmp = filename;
|
||||
std::map<uint32, std::string>::iterator ext = _extensions.find((*iter)->GetIdentifier());
|
||||
tmp += ".";
|
||||
tmp += ext->second;
|
||||
f = fopen(tmp.c_str(), "r");
|
||||
if(f) {
|
||||
fclose(f);
|
||||
filename = tmp;
|
||||
return (*iter);
|
||||
}
|
||||
|
||||
iter++;
|
||||
}
|
||||
|
||||
//last look for /quests/global/spells/default.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/spells/default";
|
||||
|
||||
iter = _load_precedence.begin();
|
||||
while(iter != _load_precedence.end()) {
|
||||
tmp = filename;
|
||||
std::map<uint32, std::string>::iterator ext = _extensions.find((*iter)->GetIdentifier());
|
||||
tmp += ".";
|
||||
tmp += ext->second;
|
||||
f = fopen(tmp.c_str(), "r");
|
||||
if(f) {
|
||||
fclose(f);
|
||||
filename = tmp;
|
||||
return (*iter);
|
||||
}
|
||||
|
||||
iter++;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@ -780,8 +824,10 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
||||
iter++;
|
||||
}
|
||||
|
||||
//second look for /quests/items/item_script.ext (precedence)
|
||||
filename = "quests/items/";
|
||||
//second look for /quests/global/items/item_script.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/items/";
|
||||
filename += item_script;
|
||||
|
||||
iter = _load_precedence.begin();
|
||||
@ -800,6 +846,48 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
||||
iter++;
|
||||
}
|
||||
|
||||
//third look for /quests/zone/items/default.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename += zone->GetShortName();
|
||||
filename += "/items/default";
|
||||
|
||||
iter = _load_precedence.begin();
|
||||
while(iter != _load_precedence.end()) {
|
||||
tmp = filename;
|
||||
std::map<uint32, std::string>::iterator ext = _extensions.find((*iter)->GetIdentifier());
|
||||
tmp += ".";
|
||||
tmp += ext->second;
|
||||
f = fopen(tmp.c_str(), "r");
|
||||
if(f) {
|
||||
fclose(f);
|
||||
filename = tmp;
|
||||
return (*iter);
|
||||
}
|
||||
|
||||
iter++;
|
||||
}
|
||||
|
||||
//last look for /quests/global/items/default.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/items/default";
|
||||
|
||||
iter = _load_precedence.begin();
|
||||
while(iter != _load_precedence.end()) {
|
||||
tmp = filename;
|
||||
std::map<uint32, std::string>::iterator ext = _extensions.find((*iter)->GetIdentifier());
|
||||
tmp += ".";
|
||||
tmp += ext->second;
|
||||
f = fopen(tmp.c_str(), "r");
|
||||
if(f) {
|
||||
fclose(f);
|
||||
filename = tmp;
|
||||
return (*iter);
|
||||
}
|
||||
|
||||
iter++;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -828,8 +916,10 @@ QuestInterface *QuestParserCollection::GetQIByEncounterQuest(std::string encount
|
||||
++iter;
|
||||
}
|
||||
|
||||
//second look for /quests/encounters/encounter_name.ext (precedence)
|
||||
filename = "quests/encounters/";
|
||||
//second look for /quests/global/encounters/encounter_name.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/encounters/";
|
||||
filename += encounter_name;
|
||||
|
||||
iter = _load_precedence.begin();
|
||||
|
||||
@ -2432,19 +2432,18 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
|
||||
bool changed = false;
|
||||
int i;
|
||||
for (i = slot_x; i < slot_y; i++) {
|
||||
const ItemInst* inst = m_inv[i];
|
||||
ItemInst* inst = m_inv.GetItem(i);
|
||||
if(inst == 0)
|
||||
continue;
|
||||
|
||||
bool update_slot = false;
|
||||
if(inst->IsScaling())
|
||||
{
|
||||
EvoItemInst* e_inst = (EvoItemInst*)inst;
|
||||
uint16 oldexp = e_inst->GetExp();
|
||||
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, nullptr, "", 0);
|
||||
uint16 oldexp = inst->GetExp();
|
||||
parse->EventItem(EVENT_SCALE_CALC, this, inst, nullptr, "", 0);
|
||||
|
||||
if (e_inst->GetExp() != oldexp) { // if the scaling factor changed, rescale the item and update the client
|
||||
e_inst->ScaleItem();
|
||||
if (inst->GetExp() != oldexp) { // if the scaling factor changed, rescale the item and update the client
|
||||
inst->ScaleItem();
|
||||
changed = true;
|
||||
update_slot = true;
|
||||
}
|
||||
@ -2459,13 +2458,12 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
|
||||
|
||||
if(a_inst->IsScaling())
|
||||
{
|
||||
EvoItemInst* e_inst = (EvoItemInst*)a_inst;
|
||||
uint16 oldexp = e_inst->GetExp();
|
||||
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, nullptr, "", 0);
|
||||
uint16 oldexp = a_inst->GetExp();
|
||||
parse->EventItem(EVENT_SCALE_CALC, this, a_inst, nullptr, "", 0);
|
||||
|
||||
if (e_inst->GetExp() != oldexp)
|
||||
if (a_inst->GetExp() != oldexp)
|
||||
{
|
||||
e_inst->ScaleItem();
|
||||
a_inst->ScaleItem();
|
||||
changed = true;
|
||||
update_slot = true;
|
||||
}
|
||||
@ -2518,16 +2516,15 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
|
||||
bool update_slot = false;
|
||||
if(inst->IsScaling())
|
||||
{
|
||||
EvoItemInst* e_inst = (EvoItemInst*)inst;
|
||||
uint16 oldexp = e_inst->GetExp();
|
||||
uint16 oldexp = inst->GetExp();
|
||||
|
||||
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, e_inst, nullptr, "", 0);
|
||||
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, inst, nullptr, "", 0);
|
||||
if(i < 22 || i == 9999) {
|
||||
parse->EventItem(EVENT_EQUIP_ITEM, this, e_inst, nullptr, "", i);
|
||||
parse->EventItem(EVENT_EQUIP_ITEM, this, inst, nullptr, "", i);
|
||||
}
|
||||
|
||||
if (e_inst->GetExp() != oldexp) { // if the scaling factor changed, rescale the item and update the client
|
||||
e_inst->ScaleItem();
|
||||
if (inst->GetExp() != oldexp) { // if the scaling factor changed, rescale the item and update the client
|
||||
inst->ScaleItem();
|
||||
changed = true;
|
||||
update_slot = true;
|
||||
}
|
||||
@ -2548,14 +2545,13 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
|
||||
|
||||
if(a_inst->IsScaling())
|
||||
{
|
||||
EvoItemInst* e_inst = (EvoItemInst*)a_inst;
|
||||
uint16 oldexp = e_inst->GetExp();
|
||||
uint16 oldexp = a_inst->GetExp();
|
||||
|
||||
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, e_inst, nullptr, "", 0);
|
||||
parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, a_inst, nullptr, "", 0);
|
||||
|
||||
if (e_inst->GetExp() != oldexp)
|
||||
if (a_inst->GetExp() != oldexp)
|
||||
{
|
||||
e_inst->ScaleItem();
|
||||
a_inst->ScaleItem();
|
||||
changed = true;
|
||||
update_slot = true;
|
||||
}
|
||||
|
||||
@ -146,9 +146,6 @@ Client::Client(EQStreamInterface* ieqs)
|
||||
scanarea_timer(AIClientScanarea_delay),
|
||||
#endif
|
||||
tribute_timer(Tribute_duration),
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
update_manager(ieqs),
|
||||
#endif
|
||||
proximity_timer(ClientProximity_interval),
|
||||
TaskPeriodic_Timer(RuleI(TaskSystem, PeriodicCheckTimer) * 1000),
|
||||
charm_update_timer(6000),
|
||||
@ -7828,3 +7825,12 @@ void Client::IncrementAA(int aa_id) {
|
||||
SendAAStats();
|
||||
CalcBonuses();
|
||||
}
|
||||
|
||||
void Client::SendItemScale(ItemInst *inst) {
|
||||
int slot = m_inv.GetSlotByItemInst(inst);
|
||||
if(slot != -1) {
|
||||
inst->ScaleItem();
|
||||
SendItemPacket(slot, inst, ItemPacketCharmUpdate);
|
||||
CalcBonuses();
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,6 @@ class Client;
|
||||
#include "merc.h"
|
||||
#include "zone.h"
|
||||
#include "AA.h"
|
||||
#include "updatemgr.h"
|
||||
#include "questmgr.h"
|
||||
#include "QGlobals.h"
|
||||
|
||||
@ -838,9 +837,6 @@ public:
|
||||
void EnableTitle(int titleset);
|
||||
void RemoveTitle(int titleset);
|
||||
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
inline UpdateManager *GetUpdateManager() { return(&update_manager); }
|
||||
#endif
|
||||
void EnteringMessages(Client* client);
|
||||
void SendRules(Client* client);
|
||||
std::list<std::string> consent_list;
|
||||
@ -1124,6 +1120,7 @@ public:
|
||||
void TryItemTick(int slot);
|
||||
void ItemTimerCheck();
|
||||
void TryItemTimer(int slot);
|
||||
void SendItemScale(ItemInst *inst);
|
||||
|
||||
int16 GetActSTR() { return( std::min(GetMaxSTR(), GetSTR()) ); }
|
||||
int16 GetActSTA() { return( std::min(GetMaxSTA(), GetSTA()) ); }
|
||||
@ -1356,10 +1353,6 @@ private:
|
||||
#endif
|
||||
Timer tribute_timer;
|
||||
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
UpdateManager update_manager;
|
||||
#endif
|
||||
|
||||
Timer proximity_timer;
|
||||
Timer TaskPeriodic_Timer;
|
||||
Timer charm_update_timer;
|
||||
|
||||
@ -1269,11 +1269,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
|
||||
if (gmhideme)
|
||||
entity_list.QueueClientsStatus(this,outapp,true,Admin(),250);
|
||||
else
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
entity_list.QueueManaged(this,outapp,true,false);
|
||||
#else
|
||||
entity_list.QueueCloseClients(this,outapp,true,300,nullptr,false);
|
||||
#endif
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
|
||||
@ -82,10 +82,6 @@ bool Client::Process() {
|
||||
SendAllPackets();
|
||||
}
|
||||
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
update_manager.Process();
|
||||
#endif
|
||||
|
||||
if(adventure_request_timer)
|
||||
{
|
||||
if(adventure_request_timer->Check())
|
||||
|
||||
145
zone/entity.cpp
145
zone/entity.cpp
@ -1681,124 +1681,6 @@ void EntityList::QueueClients(Mob* sender, const EQApplicationPacket* app, bool
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
rewrite of all the queue close methods to use the update manager
|
||||
void EntityList::FilterQueueCloseClients(uint8 filter, uint8 required, Mob* sender, const EQApplicationPacket* app, bool ignore_sender, float dist, Mob* SkipThisMob, bool ackreq){
|
||||
if(dist <= 0) {
|
||||
dist = 600;
|
||||
}
|
||||
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
EQApplicationPacket* tmp_app = app->Copy();
|
||||
#else
|
||||
float dist2 = dist * dist; //pow(dist, 2);
|
||||
#endif
|
||||
|
||||
LinkedListIterator<Client*> iterator(client_list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
|
||||
Client* ent = iterator.GetData();
|
||||
uint8 filterval=ent->GetFilter(filter);
|
||||
if(required==0)
|
||||
required=1;
|
||||
if(filterval==required){
|
||||
if ((!ignore_sender || ent != sender) && (ent != SkipThisMob)
|
||||
) {
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
if(ent->Connected()) {
|
||||
ent->GetUpdateManager()->QueuePacket(tmp_app, ackreq, sender, ent->DistNoRoot(*sender));
|
||||
}
|
||||
#else
|
||||
if(ent->Connected() && (ent->DistNoRoot(*sender) <= dist2 || dist == 0)) {
|
||||
ent->QueuePacket(app, ackreq);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
EQApplicationPacket::PacketUsed(&tmp_app);
|
||||
#endif
|
||||
}
|
||||
|
||||
void EntityList::QueueCloseClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender, float dist, Mob* SkipThisMob, bool ackreq,uint8 filter) {
|
||||
if (sender == 0) {
|
||||
QueueClients(sender, app, ignore_sender);
|
||||
return;
|
||||
}
|
||||
if(dist <= 0) {
|
||||
dist = 600;
|
||||
}
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
EQApplicationPacket* tmp_app = app->Copy();
|
||||
#else
|
||||
float dist2 = dist * dist; //pow(dist, 2);
|
||||
#endif
|
||||
|
||||
|
||||
LinkedListIterator<Client*> iterator(client_list);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
|
||||
Client* ent = iterator.GetData();
|
||||
|
||||
if ((!ignore_sender || ent != sender) && (ent != SkipThisMob)) {
|
||||
uint8 filter2=ent->GetFilter(filter);
|
||||
if(ent->Connected() &&
|
||||
(filter==0 || (filter2==1 ||
|
||||
(filter2==99 && entity_list.GetGroupByClient(ent)!=0 &&
|
||||
entity_list.GetGroupByClient(ent)->IsGroupMember(sender))
|
||||
|| (filter2==98 && ent==sender)))
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
) {
|
||||
ent->GetUpdateManager()->QueuePacket(tmp_app, ackreq, sender, ent->DistNoRoot(*sender));
|
||||
}
|
||||
#else
|
||||
&& (ent->DistNoRoot(*sender) <= dist2 || dist == 0)) {
|
||||
ent->QueuePacket(app, ackreq, Client::CLIENT_CONNECTED);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
EQApplicationPacket::PacketUsed(&tmp_app);
|
||||
#endif
|
||||
}
|
||||
|
||||
void EntityList::QueueClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender, bool ackreq) {
|
||||
LinkedListIterator<Client*> iterator(client_list);
|
||||
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
EQApplicationPacket* tmp_app = app->Copy();
|
||||
#endif
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements())
|
||||
{
|
||||
Client* ent = iterator.GetData();
|
||||
|
||||
if ((!ignore_sender || ent != sender))
|
||||
{
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
ent->GetUpdateManager()->QueuePacket(tmp_app, ackreq, sender, ent->DistNoRoot(*sender));
|
||||
#else
|
||||
ent->QueuePacket(app, ackreq, Client::CLIENT_CONNECTED);
|
||||
#endif
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
EQApplicationPacket::PacketUsed(&tmp_app);
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
void EntityList::QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender, bool ackreq) {
|
||||
LinkedListIterator<Client*> iterator(client_list);
|
||||
|
||||
@ -1813,33 +1695,6 @@ void EntityList::QueueManaged(Mob* sender, const EQApplicationPacket* app, bool
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
}*/
|
||||
|
||||
void EntityList::QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender, bool ackreq) {
|
||||
LinkedListIterator<Client*> iterator(client_list);
|
||||
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
EQApplicationPacket* tmp_app = app->Copy();
|
||||
#endif
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements())
|
||||
{
|
||||
Client* ent = iterator.GetData();
|
||||
|
||||
if ((!ignore_sender || ent != sender))
|
||||
{
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
ent->GetUpdateManager()->QueuePacket(tmp_app, ackreq, sender, ent->DistNoRoot(*sender));
|
||||
#else
|
||||
ent->QueuePacket(app, ackreq, Client::CLIENT_CONNECTED);
|
||||
#endif
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
EQApplicationPacket::PacketUsed(&tmp_app);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1173,6 +1173,11 @@ Lua_Inventory Lua_Client::GetInventory() {
|
||||
return &self->GetInv();
|
||||
}
|
||||
|
||||
void Lua_Client::SendItemScale(Lua_ItemInst inst) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SendItemScale(inst);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_client() {
|
||||
return luabind::class_<Lua_Client, Lua_Mob>("Client")
|
||||
.def(luabind::constructor<>())
|
||||
@ -1406,7 +1411,8 @@ luabind::scope lua_register_client() {
|
||||
.def("GetRaid", (Lua_Raid(Lua_Client::*)(void))&Lua_Client::GetRaid)
|
||||
.def("PutItemInInventory", (bool(Lua_Client::*)(int,Lua_ItemInst))&Lua_Client::PutItemInInventory)
|
||||
.def("PushItemOnCursor", (bool(Lua_Client::*)(Lua_ItemInst))&Lua_Client::PushItemOnCursor)
|
||||
.def("GetInventory", (Lua_Inventory(Lua_Client::*)(void))&Lua_Client::GetInventory);
|
||||
.def("GetInventory", (Lua_Inventory(Lua_Client::*)(void))&Lua_Client::GetInventory)
|
||||
.def("SendItemScale", (void(Lua_Client::*)(Lua_ItemInst))&Lua_Client::SendItemScale);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_inventory_where() {
|
||||
|
||||
@ -21,7 +21,7 @@ class Lua_Client : public Lua_Mob
|
||||
typedef Client NativeType;
|
||||
public:
|
||||
Lua_Client() { SetLuaPtrData(nullptr); }
|
||||
Lua_Client(Client *d) { SetLuaPtrData(d); }
|
||||
Lua_Client(Client *d) { SetLuaPtrData(reinterpret_cast<Entity*>(d)); }
|
||||
virtual ~Lua_Client() { }
|
||||
|
||||
operator Client*() {
|
||||
@ -261,6 +261,7 @@ public:
|
||||
bool PutItemInInventory(int slot_id, Lua_ItemInst inst);
|
||||
bool PushItemOnCursor(Lua_ItemInst inst);
|
||||
Lua_Inventory GetInventory();
|
||||
void SendItemScale(Lua_ItemInst inst);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -18,7 +18,7 @@ class Lua_Corpse : public Lua_Mob
|
||||
typedef Corpse NativeType;
|
||||
public:
|
||||
Lua_Corpse() { SetLuaPtrData(nullptr); }
|
||||
Lua_Corpse(Corpse *d) { SetLuaPtrData(d); }
|
||||
Lua_Corpse(Corpse *d) { SetLuaPtrData(reinterpret_cast<Entity*>(d)); }
|
||||
virtual ~Lua_Corpse() { }
|
||||
|
||||
operator Corpse*() {
|
||||
|
||||
@ -17,7 +17,7 @@ class Lua_Door : public Lua_Entity
|
||||
typedef Doors NativeType;
|
||||
public:
|
||||
Lua_Door() { }
|
||||
Lua_Door(Doors *d) { SetLuaPtrData(d); }
|
||||
Lua_Door(Doors *d) { SetLuaPtrData(reinterpret_cast<Entity*>(d)); }
|
||||
virtual ~Lua_Door() { }
|
||||
|
||||
operator Doors*() {
|
||||
|
||||
@ -21,7 +21,7 @@ namespace luabind {
|
||||
|
||||
luabind::scope lua_register_entity();
|
||||
|
||||
class Lua_Entity : public Lua_Ptr<void>
|
||||
class Lua_Entity : public Lua_Ptr<Entity>
|
||||
{
|
||||
typedef Entity NativeType;
|
||||
public:
|
||||
|
||||
@ -32,7 +32,7 @@ luabind::scope lua_register_corpse_list();
|
||||
luabind::scope lua_register_object_list();
|
||||
luabind::scope lua_register_door_list();
|
||||
|
||||
class Lua_EntityList : public Lua_Ptr<void>
|
||||
class Lua_EntityList : public Lua_Ptr<EntityList>
|
||||
{
|
||||
typedef EntityList NativeType;
|
||||
public:
|
||||
|
||||
@ -14,7 +14,7 @@ namespace luabind {
|
||||
|
||||
luabind::scope lua_register_group();
|
||||
|
||||
class Lua_Group : public Lua_Ptr<void>
|
||||
class Lua_Group : public Lua_Ptr<Group>
|
||||
{
|
||||
typedef Group NativeType;
|
||||
public:
|
||||
|
||||
@ -10,7 +10,7 @@ struct tHateEntry;
|
||||
luabind::scope lua_register_hate_entry();
|
||||
luabind::scope lua_register_hate_list();
|
||||
|
||||
class Lua_HateEntry : public Lua_Ptr<void>
|
||||
class Lua_HateEntry : public Lua_Ptr<tHateEntry>
|
||||
{
|
||||
typedef tHateEntry NativeType;
|
||||
public:
|
||||
|
||||
@ -14,7 +14,7 @@ namespace luabind {
|
||||
|
||||
luabind::scope lua_register_inventory();
|
||||
|
||||
class Lua_Inventory : public Lua_Ptr<void>
|
||||
class Lua_Inventory : public Lua_Ptr<Inventory>
|
||||
{
|
||||
typedef Inventory NativeType;
|
||||
public:
|
||||
|
||||
@ -12,7 +12,7 @@ namespace luabind {
|
||||
|
||||
luabind::scope lua_register_item();
|
||||
|
||||
class Lua_Item : public Lua_Ptr<const void>
|
||||
class Lua_Item : public Lua_Ptr<const Item_Struct>
|
||||
{
|
||||
typedef const Item_Struct NativeType;
|
||||
public:
|
||||
|
||||
@ -63,18 +63,9 @@ Lua_Item Lua_ItemInst::GetItem() {
|
||||
return Lua_Item(self->GetItem());
|
||||
}
|
||||
|
||||
void Lua_ItemInst::SetItem(Lua_Item item) {
|
||||
Lua_Safe_Call_Void();
|
||||
return self->SetItem(item);
|
||||
}
|
||||
|
||||
Lua_Item Lua_ItemInst::GetUnscaledItem(int slot) {
|
||||
Lua_Safe_Call_Class(Lua_Item);
|
||||
if(self->IsScaling()) {
|
||||
const EvoItemInst *ev = reinterpret_cast<const EvoItemInst*>(self);
|
||||
return Lua_Item(ev->GetUnscaledItem());
|
||||
}
|
||||
return Lua_Item(self->GetItem());
|
||||
return self->GetUnscaledItem();
|
||||
}
|
||||
|
||||
uint32 Lua_ItemInst::GetItemID(int slot) {
|
||||
@ -199,53 +190,37 @@ void Lua_ItemInst::DeleteCustomData(std::string identifier) {
|
||||
|
||||
void Lua_ItemInst::SetScale(double scale_factor) {
|
||||
Lua_Safe_Call_Void();
|
||||
if(self->IsScaling()) {
|
||||
EvoItemInst *ev = reinterpret_cast<EvoItemInst*>(self);
|
||||
ev->SetExp(static_cast<uint32>(scale_factor * 10000.0 + 0.5));
|
||||
}
|
||||
self->SetExp((int)(scale_factor*10000+.5));
|
||||
}
|
||||
|
||||
void Lua_ItemInst::SetScaling(bool v) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetScaling(v);
|
||||
}
|
||||
|
||||
uint32 Lua_ItemInst::GetExp() {
|
||||
Lua_Safe_Call_Int();
|
||||
if(self->IsScaling()) {
|
||||
EvoItemInst *ev = reinterpret_cast<EvoItemInst*>(self);
|
||||
return ev->GetExp();
|
||||
}
|
||||
return 0;
|
||||
return self->GetExp();
|
||||
}
|
||||
|
||||
void Lua_ItemInst::SetExp(uint32 exp) {
|
||||
Lua_Safe_Call_Void();
|
||||
if(self->IsScaling()) {
|
||||
EvoItemInst *ev = reinterpret_cast<EvoItemInst*>(self);
|
||||
ev->SetExp(exp);
|
||||
}
|
||||
self->SetExp(exp);
|
||||
}
|
||||
|
||||
void Lua_ItemInst::AddExp(uint32 exp) {
|
||||
Lua_Safe_Call_Void();
|
||||
if(self->IsScaling()) {
|
||||
EvoItemInst *ev = reinterpret_cast<EvoItemInst*>(self);
|
||||
ev->AddExp(exp);
|
||||
}
|
||||
self->AddExp(exp);
|
||||
}
|
||||
|
||||
int Lua_ItemInst::GetMaxEvolveLvl() {
|
||||
Lua_Safe_Call_Int();
|
||||
if(self->IsScaling()) {
|
||||
EvoItemInst *ev = reinterpret_cast<EvoItemInst*>(self);
|
||||
return ev->GetMaxEvolveLvl();
|
||||
}
|
||||
return 0;
|
||||
return self->GetMaxEvolveLvl();
|
||||
}
|
||||
|
||||
uint32 Lua_ItemInst::GetKillsNeeded(int current_level) {
|
||||
Lua_Safe_Call_Int();
|
||||
if(self->IsScaling()) {
|
||||
EvoItemInst *ev = reinterpret_cast<EvoItemInst*>(self);
|
||||
return ev->GetKillsNeeded(current_level);
|
||||
}
|
||||
return 0;
|
||||
return self->GetKillsNeeded(current_level);
|
||||
}
|
||||
|
||||
Lua_ItemInst Lua_ItemInst::Clone() {
|
||||
@ -294,7 +269,6 @@ luabind::scope lua_register_iteminst() {
|
||||
.def("GetID", (uint32(Lua_ItemInst::*)(void))&Lua_ItemInst::GetID)
|
||||
.def("GetItemScriptID", (uint32(Lua_ItemInst::*)(void))&Lua_ItemInst::GetItemScriptID)
|
||||
.def("GetItem", (Lua_Item(Lua_ItemInst::*)(void))&Lua_ItemInst::GetItem)
|
||||
.def("SetItem", (void(Lua_ItemInst::*)(Lua_Item))&Lua_ItemInst::SetItem)
|
||||
.def("GetCharges", (int(Lua_ItemInst::*)(void))&Lua_ItemInst::GetCharges)
|
||||
.def("SetCharges", (void(Lua_ItemInst::*)(int))&Lua_ItemInst::SetCharges)
|
||||
.def("GetPrice", (uint32(Lua_ItemInst::*)(void))&Lua_ItemInst::GetPrice)
|
||||
@ -310,7 +284,8 @@ luabind::scope lua_register_iteminst() {
|
||||
.def("SetCustomData", (void(Lua_ItemInst::*)(std::string,bool))&Lua_ItemInst::SetCustomData)
|
||||
.def("GetCustomData", (std::string(Lua_ItemInst::*)(std::string))&Lua_ItemInst::GetCustomData)
|
||||
.def("DeleteCustomData", (void(Lua_ItemInst::*)(std::string))&Lua_ItemInst::DeleteCustomData)
|
||||
.def("SetScale", (void(Lua_ItemInst::*)(void))&Lua_ItemInst::SetScale)
|
||||
.def("SetScaling", (void(Lua_ItemInst::*)(bool))&Lua_ItemInst::SetScaling)
|
||||
.def("SetScale", (void(Lua_ItemInst::*)(double))&Lua_ItemInst::SetScale)
|
||||
.def("GetExp", (uint32(Lua_ItemInst::*)(void))&Lua_ItemInst::GetExp)
|
||||
.def("SetExp", (void(Lua_ItemInst::*)(uint32))&Lua_ItemInst::SetExp)
|
||||
.def("AddExp", (void(Lua_ItemInst::*)(uint32))&Lua_ItemInst::AddExp)
|
||||
|
||||
@ -13,7 +13,7 @@ namespace luabind {
|
||||
|
||||
luabind::scope lua_register_iteminst();
|
||||
|
||||
class Lua_ItemInst : public Lua_Ptr<void>
|
||||
class Lua_ItemInst : public Lua_Ptr<ItemInst>
|
||||
{
|
||||
typedef ItemInst NativeType;
|
||||
public:
|
||||
@ -22,7 +22,7 @@ public:
|
||||
Lua_ItemInst() : Lua_Ptr(nullptr), cloned_(false) { }
|
||||
Lua_ItemInst(ItemInst *d) : Lua_Ptr(d), cloned_(false) { }
|
||||
Lua_ItemInst(ItemInst *d, bool cloned) : Lua_Ptr(d), cloned_(cloned) { }
|
||||
virtual ~Lua_ItemInst() { if(cloned_) { void *ptr = GetLuaPtrData(); if(ptr) { delete ptr; } } }
|
||||
virtual ~Lua_ItemInst() { if(cloned_) { ItemInst *ptr = GetLuaPtrData(); if(ptr) { delete ptr; } } }
|
||||
|
||||
operator ItemInst*() {
|
||||
return reinterpret_cast<ItemInst*>(GetLuaPtrData());
|
||||
@ -63,6 +63,7 @@ public:
|
||||
void SetCustomData(std::string identifier, bool value);
|
||||
std::string GetCustomData(std::string identifier);
|
||||
void DeleteCustomData(std::string identifier);
|
||||
void SetScaling(bool v);
|
||||
void SetScale(double scale_factor);
|
||||
uint32 GetExp();
|
||||
void SetExp(uint32 exp);
|
||||
|
||||
@ -21,7 +21,7 @@ class Lua_Mob : public Lua_Entity
|
||||
typedef Mob NativeType;
|
||||
public:
|
||||
Lua_Mob() { SetLuaPtrData(nullptr); }
|
||||
Lua_Mob(Mob *d) { SetLuaPtrData(d); }
|
||||
Lua_Mob(Mob *d) { SetLuaPtrData(reinterpret_cast<Entity*>(d)); }
|
||||
virtual ~Lua_Mob() { }
|
||||
|
||||
operator Mob*() {
|
||||
@ -331,6 +331,7 @@ public:
|
||||
void SetFlurryChance(int value);
|
||||
int GetFlurryChance();
|
||||
int GetSkill(int skill_id);
|
||||
void CalcBonuses();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -20,7 +20,7 @@ class Lua_NPC : public Lua_Mob
|
||||
typedef NPC NativeType;
|
||||
public:
|
||||
Lua_NPC() { SetLuaPtrData(nullptr); }
|
||||
Lua_NPC(NPC *d) { SetLuaPtrData(d); }
|
||||
Lua_NPC(NPC *d) { SetLuaPtrData(reinterpret_cast<Entity*>(d)); }
|
||||
virtual ~Lua_NPC() { }
|
||||
|
||||
operator NPC*() {
|
||||
|
||||
@ -17,7 +17,7 @@ class Lua_Object : public Lua_Entity
|
||||
typedef Object NativeType;
|
||||
public:
|
||||
Lua_Object() { SetLuaPtrData(nullptr); }
|
||||
Lua_Object(Object *d) { SetLuaPtrData(d); }
|
||||
Lua_Object(Object *d) { SetLuaPtrData(reinterpret_cast<Entity*>(d)); }
|
||||
virtual ~Lua_Object() { }
|
||||
|
||||
operator Object*() {
|
||||
|
||||
@ -186,8 +186,8 @@ LuaParser::LuaParser() {
|
||||
ItemArgumentDispatch[EVENT_UNEQUIP_ITEM] = handle_item_equip;
|
||||
ItemArgumentDispatch[EVENT_AUGMENT_ITEM] = handle_item_augment;
|
||||
ItemArgumentDispatch[EVENT_UNAUGMENT_ITEM] = handle_item_augment;
|
||||
ItemArgumentDispatch[EVENT_AUGMENT_INSERT] = handle_item_augment_reverse;
|
||||
ItemArgumentDispatch[EVENT_AUGMENT_REMOVE] = handle_item_augment_reverse;
|
||||
ItemArgumentDispatch[EVENT_AUGMENT_INSERT] = handle_item_augment_insert;
|
||||
ItemArgumentDispatch[EVENT_AUGMENT_REMOVE] = handle_item_augment_remove;
|
||||
|
||||
SpellArgumentDispatch[EVENT_SPELL_EFFECT_CLIENT] = handle_spell_effect;
|
||||
SpellArgumentDispatch[EVENT_SPELL_BUFF_TIC_CLIENT] = handle_spell_tic;
|
||||
|
||||
@ -505,14 +505,34 @@ void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, It
|
||||
luabind::object l_item_o = luabind::object(L, l_item);
|
||||
l_item_o.push(L);
|
||||
lua_setfield(L, -2, "aug");
|
||||
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "slot_id");
|
||||
}
|
||||
|
||||
void handle_item_augment_reverse(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data,
|
||||
void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_ItemInst l_item(reinterpret_cast<ItemInst*>(extra_pointers->at(0)));
|
||||
luabind::object l_item_o = luabind::object(L, l_item);
|
||||
l_item_o.push(L);
|
||||
lua_setfield(L, -2, "item");
|
||||
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "slot_id");
|
||||
}
|
||||
|
||||
void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_ItemInst l_item(reinterpret_cast<ItemInst*>(extra_pointers->at(0)));
|
||||
luabind::object l_item_o = luabind::object(L, l_item);
|
||||
l_item_o.push(L);
|
||||
lua_setfield(L, -2, "item");
|
||||
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "slot_id");
|
||||
|
||||
lua_pushboolean(L, *reinterpret_cast<bool*>(extra_pointers->at(1)));
|
||||
lua_setfield(L, -2, "destroyed");
|
||||
}
|
||||
|
||||
void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data,
|
||||
|
||||
@ -98,7 +98,9 @@ void handle_item_equip(QuestInterface *parse, lua_State* L, Client* client, Item
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_item_augment_reverse(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data,
|
||||
void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
@ -14,7 +14,7 @@ namespace luabind {
|
||||
|
||||
luabind::scope lua_register_raid();
|
||||
|
||||
class Lua_Raid : public Lua_Ptr<void>
|
||||
class Lua_Raid : public Lua_Ptr<Raid>
|
||||
{
|
||||
typedef Raid NativeType;
|
||||
public:
|
||||
|
||||
@ -12,7 +12,7 @@ namespace luabind {
|
||||
|
||||
luabind::scope lua_register_spell();
|
||||
|
||||
class Lua_Spell : public Lua_Ptr<const void>
|
||||
class Lua_Spell : public Lua_Ptr<const SPDat_Spell_Struct>
|
||||
{
|
||||
typedef const SPDat_Spell_Struct NativeType;
|
||||
public:
|
||||
|
||||
14
zone/mob.cpp
14
zone/mob.cpp
@ -1075,9 +1075,6 @@ void Mob::SendHPUpdate()
|
||||
// destructor will free the pBuffer
|
||||
CreateHPPacket(&hp_app);
|
||||
|
||||
#ifdef MANAGE_HP_UPDATES
|
||||
entity_list.QueueManaged(this, &hp_app, true);
|
||||
#else
|
||||
// send to people who have us targeted
|
||||
entity_list.QueueClientsByTarget(this, &hp_app, false, 0, false, true, BIT_AllClients);
|
||||
entity_list.QueueClientsByXTarget(this, &hp_app, false);
|
||||
@ -1115,7 +1112,6 @@ void Mob::SendHPUpdate()
|
||||
{
|
||||
GetPet()->CastToClient()->QueuePacket(&hp_app, false);
|
||||
}
|
||||
#endif //MANAGE_HP_PACKETS
|
||||
|
||||
// Update the damage state of destructible objects
|
||||
if(IsNPC() && IsDestructibleObject())
|
||||
@ -1195,9 +1191,6 @@ void Mob::SendPosUpdate(uint8 iSendToSelf) {
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
entity_list.QueueManaged(this, app, (iSendToSelf==0),false);
|
||||
#else
|
||||
if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount))
|
||||
{
|
||||
entity_list.QueueClients(this, app, (iSendToSelf==0), false);
|
||||
@ -1208,7 +1201,6 @@ void Mob::SendPosUpdate(uint8 iSendToSelf) {
|
||||
entity_list.QueueCloseClients(this, app, (iSendToSelf==0), 800, nullptr, false);
|
||||
move_tic_count++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
safe_delete(app);
|
||||
}
|
||||
@ -1372,12 +1364,6 @@ void Mob::GMMove(float x, float y, float z, float heading, bool SendUpdate) {
|
||||
CastToNPC()->SaveGuardSpot(true);
|
||||
if(SendUpdate)
|
||||
SendPosition();
|
||||
//SendPosUpdate(1);
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
if(IsClient()) {
|
||||
CastToClient()->GetUpdateManager()->FlushQueues();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, uint8 in_helmtexture, uint8 in_haircolor, uint8 in_beardcolor, uint8 in_eyecolor1, uint8 in_eyecolor2, uint8 in_hairstyle, uint8 in_luclinface, uint8 in_beard, uint8 in_aa_title, uint32 in_drakkin_heritage, uint32 in_drakkin_tattoo, uint32 in_drakkin_details, float in_size) {
|
||||
|
||||
@ -79,7 +79,7 @@ XS(XS_QuestItem_SetScale)
|
||||
Mult = (float)SvNV(ST(1));
|
||||
|
||||
if(THIS->IsScaling()) {
|
||||
((EvoItemInst*)THIS)->SetExp((int)(Mult*10000+.5));
|
||||
THIS->SetExp((int)(Mult*10000+.5));
|
||||
}
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
|
||||
@ -3472,15 +3472,6 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
|
||||
TrySpellTrigger(spelltar, spell_id);
|
||||
TryApplyEffect(spelltar, spell_id);
|
||||
|
||||
|
||||
if(spell_id == 982) // Cazic Touch, hehe =P
|
||||
{
|
||||
char target_name[64];
|
||||
strcpy(target_name, spelltar->GetCleanName());
|
||||
strupr(target_name);
|
||||
Shout("%s!", target_name);
|
||||
}
|
||||
|
||||
if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id) && !IsHarmonySpell(spell_id)) {
|
||||
int32 aggro_amount = CheckAggroAmount(spell_id, isproc);
|
||||
mlog(SPELLS__CASTING, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount);
|
||||
|
||||
@ -164,6 +164,8 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemInst *old_aug = nullptr;
|
||||
const uint32 id = auged_with->GetID();
|
||||
ItemInst *aug = tobe_auged->GetAugment(in_augment->augment_slot);
|
||||
if(aug) {
|
||||
std::vector<void*> args;
|
||||
@ -171,15 +173,20 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
|
||||
parse->EventItem(EVENT_UNAUGMENT_ITEM, user, tobe_auged, nullptr, "", slot, &args);
|
||||
|
||||
args.assign(1, tobe_auged);
|
||||
bool destroyed = false;
|
||||
if(id == 40408 || id == 40409 || id == 40410) {
|
||||
destroyed = true;
|
||||
}
|
||||
|
||||
args.push_back(&destroyed);
|
||||
|
||||
parse->EventItem(EVENT_AUGMENT_REMOVE, user, aug, nullptr, "", slot, &args);
|
||||
}
|
||||
|
||||
ItemInst *old_aug=nullptr;
|
||||
const uint32 id=auged_with->GetID();
|
||||
if (id==40408 || id==40409 || id==40410)
|
||||
if(id == 40408 || id == 40409 || id == 40410)
|
||||
tobe_auged->DeleteAugment(in_augment->augment_slot);
|
||||
else
|
||||
old_aug=tobe_auged->RemoveAugment(in_augment->augment_slot);
|
||||
old_aug = tobe_auged->RemoveAugment(in_augment->augment_slot);
|
||||
|
||||
itemOneToPush = tobe_auged->Clone();
|
||||
if (old_aug)
|
||||
|
||||
@ -1,187 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "../common/debug.h"
|
||||
#include "../common/features.h"
|
||||
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
#include "updatemgr.h"
|
||||
#include "mob.h"
|
||||
#include "../common/EQStream.h"
|
||||
|
||||
//squared distances for each level
|
||||
//these values are pulled out of my ass, should be tuned some day
|
||||
const float UpdateManager::level_distances2[UPDATE_LEVELS]
|
||||
= { 50*50, 250*250, 500*500, 800*800 };
|
||||
|
||||
//delay between sending packets in each level, in ms
|
||||
//its best if they are all multiples of UPDATE_RESOLUTION
|
||||
//these values are pulled out of my ass, should be tuned some day
|
||||
const uint32 UpdateManager::level_timers[UPDATE_LEVELS+1] = { UPDATE_RESOLUTION, //.3s
|
||||
2*UPDATE_RESOLUTION, //.6s
|
||||
3*UPDATE_RESOLUTION, //.9s
|
||||
9*UPDATE_RESOLUTION, //~2s
|
||||
34*UPDATE_RESOLUTION //~10s
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
This system assumes that two packets sent by a mob with the same
|
||||
opcodes contain the same info at different times, and will prefer
|
||||
to send only the most recent packet. If this is bad, then this
|
||||
thing needs a redesign.
|
||||
|
||||
*/
|
||||
|
||||
//build a unique ID based on opcode and mob id..
|
||||
#define MakeUpdateID(mob, app) (((mob->GetID())<<12) | (app->GetOpcode()&0xFFF))
|
||||
|
||||
UpdateManager::UpdateManager(EQStream *c)
|
||||
: limiter(UPDATE_RESOLUTION)
|
||||
{
|
||||
net = c;
|
||||
int r;
|
||||
for(r = 0; r <= UPDATE_LEVELS; r++) {
|
||||
timers[r] = new Timer(level_timers[r]);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateManager::~UpdateManager() {
|
||||
int r;
|
||||
UMMap::iterator cur,end;
|
||||
for(r = 0; r <= UPDATE_LEVELS; r++) {
|
||||
safe_delete(timers[r]);
|
||||
cur = levels[r].begin();
|
||||
end = levels[r].end();
|
||||
for(; cur != end; cur++) {
|
||||
EQApplicationPacket *tmp = cur->second.app;
|
||||
EQApplicationPacket::PacketUsed(&tmp);
|
||||
}
|
||||
levels[r].clear();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Puts a packet into its proper spacial queue
|
||||
*/
|
||||
void UpdateManager::QueuePacket(EQApplicationPacket *app, bool ack_req, Mob *from, float range2) {
|
||||
int r = UPDATE_LEVELS;
|
||||
UMMap *cur = levels;
|
||||
const float *cur_d = level_distances2;
|
||||
cur += UPDATE_LEVELS; //move to the end.
|
||||
cur_d += UPDATE_LEVELS - 1;
|
||||
//work backwards since mobs are more likely to be further away
|
||||
for(r = UPDATE_LEVELS; r >= 0; r--, cur--, cur_d--) {
|
||||
if(range2 < *cur_d)
|
||||
continue;
|
||||
//this packet falls into this queue...
|
||||
uint32 id = MakeUpdateID(from, app);
|
||||
// if(r < 2)
|
||||
// net->QueuePacket(app, ack_req);
|
||||
//LogFile->write(EQEMuLog::Debug, "Queueing packet from %s (0x%.4x) id=0x%x at level %d\n", from->GetName(), app->GetOpcode(), id, r);
|
||||
app->PacketReferenced();
|
||||
//reference decrementing is taken care of my UMType destructor
|
||||
//if anything is overwritten
|
||||
(*cur)[id] = UMType(app, ack_req);
|
||||
// (*cur)[id] = UMType(app->Copy(), ack_req);
|
||||
return;
|
||||
}
|
||||
//if we get here, were in trouble...
|
||||
}
|
||||
|
||||
void UpdateManager::Process() {
|
||||
if(!limiter.Check())
|
||||
return;
|
||||
Timer **curt = timers;
|
||||
int r;
|
||||
for(r = 0; r <= UPDATE_LEVELS; r++, curt++) {
|
||||
if(!(*curt)->Check())
|
||||
continue;
|
||||
_SendLevel(r);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateManager::FlushQueues() {
|
||||
limiter.Start();
|
||||
Timer **curt = timers;
|
||||
int r;
|
||||
for(r = 0; r <= UPDATE_LEVELS; r++, curt++) {
|
||||
(*curt)->Start();
|
||||
_SendLevel(r);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateManager::_SendLevel(int level) {
|
||||
/*LogFile->write(EQEMuLog::Error, "Sending for level %d", level);
|
||||
if(level > 0)
|
||||
{
|
||||
int r;
|
||||
for(r = 0; r <= UPDATE_LEVELS; r++) {
|
||||
LogFile->write(EQEMuLog::Error, "Level %d: %d", r, levels[r].size());
|
||||
}
|
||||
{
|
||||
float range2 = 5;
|
||||
int r = UPDATE_LEVELS;
|
||||
UMMap *cur = levels;
|
||||
const float *cur_d = level_distances2;
|
||||
cur += UPDATE_LEVELS; //move to the end.
|
||||
cur_d += UPDATE_LEVELS - 1;
|
||||
//work backwards since mobs are more likely to be further away
|
||||
for(r = UPDATE_LEVELS; r >= 0; r--, cur--, cur_d--) {
|
||||
LogFile->write(EQEMuLog::Error, "If they are less than %f away, they dont go in level %d", *cur_d, r);
|
||||
if(range2 < *cur_d)
|
||||
continue;
|
||||
LogFile->write(EQEMuLog::Error, "A mob %f away gets put into level %d", range2, r);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
UMMap::iterator cur,end;
|
||||
UMMap *curm;
|
||||
UMMap *om = levels + level;
|
||||
cur = om->begin();
|
||||
end = om->end();
|
||||
uint32 key;
|
||||
int r;
|
||||
|
||||
while(cur != end) {
|
||||
key = cur->first;
|
||||
//relies on fast queue setting .app to null if it eats it
|
||||
//LogFile->write(EQEMuLog::Debug, "Sending id 0x%x for level %d\n", key, level);
|
||||
net->FastQueuePacket(&cur->second.app, cur->second.ack);
|
||||
//EQApplicationPacket::PacketUsed(&cur->second.app);
|
||||
cur++;
|
||||
om->erase(key);
|
||||
|
||||
//need to clear our any updates in slower levels
|
||||
//so mobs dont jump backwards from old updates
|
||||
curm = om + 1;
|
||||
for(r = level+1; r <= UPDATE_LEVELS; r++, curm++) {
|
||||
//do we need this count check?
|
||||
if(curm->count(key) != 0) {
|
||||
//reference decrementing is taken care of my UMType destructor
|
||||
EQApplicationPacket *tmp = (*curm)[key].app;
|
||||
curm->erase(key);
|
||||
EQApplicationPacket::PacketUsed(&tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif //PACKET_UPDATE_MANAGER
|
||||
|
||||
@ -1,89 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef UPDATE_MANAGER_H
|
||||
#define UPDATE_MANAGER_H
|
||||
|
||||
#include "../common/features.h"
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
|
||||
#include "../common/timer.h"
|
||||
#include <map>
|
||||
|
||||
/*typedef enum {
|
||||
updateMobPOS = 1,
|
||||
updateMobHP
|
||||
} updateType;*/
|
||||
|
||||
//the number of different queue levels to use
|
||||
#define UPDATE_LEVELS 4
|
||||
#define UPDATE_RESOLUTION 300
|
||||
#define UPDATE_DROP_RANGE 800
|
||||
|
||||
//if the player moves more than this ammount, all queues are flushed.
|
||||
#define UPDATE_JUMP_FLUSH 200 //
|
||||
|
||||
class EQStream;
|
||||
class EQApplicationPacket;
|
||||
class Mob;
|
||||
|
||||
class UMType {
|
||||
public:
|
||||
UMType() {
|
||||
app = nullptr; ack = false;
|
||||
}
|
||||
UMType(EQApplicationPacket *_app, bool _ack) {
|
||||
app = _app; ack = _ack;
|
||||
}
|
||||
|
||||
EQApplicationPacket *app;
|
||||
bool ack;
|
||||
};
|
||||
|
||||
typedef std::map<uint32, UMType > UMMap;
|
||||
|
||||
class UpdateManager {
|
||||
protected:
|
||||
//squared distances for each level
|
||||
static const float level_distances2[UPDATE_LEVELS];
|
||||
|
||||
//delay between sending packets in each level, in ms
|
||||
static const uint32 level_timers[UPDATE_LEVELS+1];
|
||||
|
||||
public:
|
||||
UpdateManager(EQStream *c);
|
||||
~UpdateManager();
|
||||
|
||||
//range2 is the range of 'from' to this client, squared
|
||||
void QueuePacket(EQApplicationPacket *app, bool ack_req, Mob *from, float range2);
|
||||
void Process();
|
||||
void FlushQueues();
|
||||
|
||||
protected:
|
||||
void _SendLevel(int level);
|
||||
|
||||
EQStream *net;
|
||||
|
||||
UMMap levels[UPDATE_LEVELS+1];
|
||||
Timer *timers[UPDATE_LEVELS+1];
|
||||
Timer limiter;
|
||||
};
|
||||
|
||||
#endif //PACKET_UPDATE_MANAGER
|
||||
|
||||
#endif
|
||||
|
||||
@ -625,11 +625,6 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
|
||||
|
||||
//send out updates to people in zone.
|
||||
SendPosition();
|
||||
|
||||
#ifdef PACKET_UPDATE_MANAGER
|
||||
//flush our position queues because we dont know where we will end up
|
||||
update_manager.FlushQueues();
|
||||
#endif
|
||||
}
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_RequestClientZoneChange, sizeof(RequestClientZoneChange_Struct));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user