mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +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:
+167
-226
@@ -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;
|
||||
|
||||
+43
-53
@@ -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;
|
||||
|
||||
+1
-8
@@ -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)
|
||||
|
||||
+3
-4
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user