Merge branch 'master' into DBQuery

This commit is contained in:
KimLS 2014-08-16 14:12:33 -07:00
commit 8b08f19628
26 changed files with 1181 additions and 506 deletions

View File

@ -1,5 +1,53 @@
EQEmu - Custom Game Implementation for EverQuest EQEmu
===
Dependencies can be obtained at http://eqemu.github.io [![Build Status](https://travis-ci.org/EQEmu/Server.svg?branch=master)](https://travis-ci.org/EQEmu/Server)
Overview
---
EQEmu is a custom server implementation for EverQuest
Dependencies
---
For Windows: http://eqemu.github.io
Login Server dependencies for Windows/Linux/OSX: http://eqemu.github.io
For Debian based distros (adjust to your local flavor):
- libmysqlclient-dev
- libperl-dev
- liblua5.1-0-dev (5.2 should work as well)
- libboost-dev
Further instructions on building the source can be found on the
[wiki](http://wiki.eqemulator.org/i?M=Wiki).
Bug reports
---
Please use the [issue tracker](https://github.com/EQEmu/Server/issues) provided by GitHub to send us bug
reports or feature requests.
The [EQEmu Forums](http://www.eqemulator.org/forums/) also have forums to submit
bugs/get help with bugs.
Contributions
---
The preferred way to contribute is to fork the repo and submit a pull request on
GitHub. If you need help with your changes, you can always post on the forums or
try IRC. You can also post unified diffs (`git diff` should do the trick) on the
[Server Code Submissions](http://www.eqemulator.org/forums/forumdisplay.php?f=669)
forum, although pull requests will be much quicker and easier on all parties.
Contact
---
- **User IRC Channel**: `#eqemu` on `irc.eqemulator.net`
- **Developer IRC Channel**: `#eqemucoders` on `irc.eqemulator.net`
- [EQEmulator Forums](http://www.eqemulator.org/forums)
- [EQEmulator Wiki](http://wiki.eqemulator.org/i?M=Wiki)
More Information: https://github.com/EQEmu/Server/wiki

View File

@ -1,5 +1,11 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 08/15/2014 ==
Uleat: Reactivated the Bot::Spawn() code for sending post-spawn wear change updates..temporary until I can sort out the proper usage.
== 08/13/2014 ==
Uleat (Kingly_Krab): Fix for bot chest armor graphic glitch. (fix also caused RoF #wc to work properly)
== 08/02/2014 == == 08/02/2014 ==
Kayen: Implemented spell_news fields Kayen: Implemented spell_news fields
- npc_no_los (check if LOS is required for spells) - npc_no_los (check if LOS is required for spells)

View File

@ -70,7 +70,7 @@ void ExportSpells(SharedDatabase *db) {
} }
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
char *query = "SELECT * FROM spells_new ORDER BY id"; const char *query = "SELECT * FROM spells_new ORDER BY id";
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
if(db->RunQuery(query, strlen(query), errbuf, &result)) { if(db->RunQuery(query, strlen(query), errbuf, &result)) {
@ -176,7 +176,7 @@ void ExportBaseData(SharedDatabase *db) {
} }
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
char *query = "SELECT * FROM base_data ORDER BY level, class"; const char *query = "SELECT * FROM base_data ORDER BY level, class";
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
if(db->RunQuery(query, strlen(query), errbuf, &result)) { if(db->RunQuery(query, strlen(query), errbuf, &result)) {

View File

@ -61,7 +61,7 @@ int main(int argc, char **argv) {
int GetSpellColumns(SharedDatabase *db) { int GetSpellColumns(SharedDatabase *db) {
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
char *query = "DESCRIBE spells_new"; const char *query = "DESCRIBE spells_new";
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
int res = 0; int res = 0;

View File

@ -76,6 +76,7 @@ RULE_BOOL ( Character, SharedBankPlat, false) //off by default to prevent duping
RULE_BOOL ( Character, BindAnywhere, false) RULE_BOOL ( Character, BindAnywhere, false)
RULE_INT ( Character, RestRegenPercent, 0) // Set to >0 to enable rest state bonus HP and mana regen. RULE_INT ( Character, RestRegenPercent, 0) // Set to >0 to enable rest state bonus HP and mana regen.
RULE_INT ( Character, RestRegenTimeToActivate, 30) // Time in seconds for rest state regen to kick in. RULE_INT ( Character, RestRegenTimeToActivate, 30) // Time in seconds for rest state regen to kick in.
RULE_INT ( Character, RestRegenRaidTimeToActivate, 300) // Time in seconds for rest state regen to kick in with a raid target.
RULE_BOOL ( Character, RestRegenEndurance, false) // Whether rest regen will work for endurance or not. RULE_BOOL ( Character, RestRegenEndurance, false) // Whether rest regen will work for endurance or not.
RULE_INT ( Character, KillsPerGroupLeadershipAA, 250) // Number of dark blues or above per Group Leadership AA RULE_INT ( Character, KillsPerGroupLeadershipAA, 250) // Number of dark blues or above per Group Leadership AA
RULE_INT ( Character, KillsPerRaidLeadershipAA, 250) // Number of dark blues or above per Raid Leadership AA RULE_INT ( Character, KillsPerRaidLeadershipAA, 250) // Number of dark blues or above per Raid Leadership AA

View File

@ -1775,7 +1775,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
int SharedDatabase::GetMaxBaseDataLevel() { int SharedDatabase::GetMaxBaseDataLevel() {
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
char *query = "SELECT MAX(level) FROM base_data"; const char *query = "SELECT MAX(level) FROM base_data";
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
int32 ret = 0; int32 ret = 0;
@ -1826,7 +1826,7 @@ bool SharedDatabase::LoadBaseData() {
void SharedDatabase::LoadBaseData(void *data, int max_level) { void SharedDatabase::LoadBaseData(void *data, int max_level) {
char *base_ptr = reinterpret_cast<char*>(data); char *base_ptr = reinterpret_cast<char*>(data);
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
char *query = "SELECT * FROM base_data ORDER BY level, class ASC"; const char *query = "SELECT * FROM base_data ORDER BY level, class ASC";
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;

View File

@ -131,10 +131,10 @@ typedef enum {
/* 41 */ ST_Group = 0x29, /* 41 */ ST_Group = 0x29,
/* 42 */ ST_Directional = 0x2a, //ae around this target between two angles /* 42 */ ST_Directional = 0x2a, //ae around this target between two angles
/* 43 */ ST_GroupClientAndPet = 0x2b, /* 43 */ ST_GroupClientAndPet = 0x2b,
/* 44 */ ST_Beam = 0x2c, //like directional but facing in front of you always /* 44 */ //ST_Beam = 0x2c, //like directional but facing in front of you always
/* 45 */ //ST_Ring = 0x2d, // Like a mix of PB ae + rain spell(has ae duration) /* 45 */ //ST_Ring = 0x2d, // Like a mix of PB ae + rain spell(has ae duration)
/* 46 */ ST_TargetsTarget = 0x2e, // uses the target of your target /* 46 */ ST_TargetsTarget = 0x2e, // uses the target of your target
/* 47 */ //ST_PetMaster = 0x2e, // uses the master as target /* 47 */ ST_PetMaster = 0x2f, // uses the master as target
} SpellTargetType; } SpellTargetType;
typedef enum { typedef enum {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Character:RestRegenRaidTimeToActivate', 300, 'Time in seconds for rest state regen to kick in with a raid target.');

View File

@ -0,0 +1 @@
ALTER TABLE `npc_types` ADD `raid_target` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `no_target_hotkey`;

View File

@ -311,7 +311,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database
if(skillinuse == SkillArchery) if(skillinuse == SkillArchery)
hitBonus -= hitBonus*(RuleR(Combat, ArcheryHitPenalty)*100.0f); hitBonus -= hitBonus*RuleR(Combat, ArcheryHitPenalty);
//Calculate final chance to hit //Calculate final chance to hit
chancetohit += ((chancetohit * (hitBonus - avoidanceBonus)) / 100.0f); chancetohit += ((chancetohit * (hitBonus - avoidanceBonus)) / 100.0f);

View File

@ -4303,8 +4303,9 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
// Get the zone id this bot spawned in // Get the zone id this bot spawned in
_lastZoneId = GetZoneID(); _lastZoneId = GetZoneID();
this->helmtexture = 0xFF; // this change propagates to Bot::FillSpawnStruct()
this->texture = 0xFF; this->helmtexture = 0; //0xFF;
this->texture = 0; //0xFF;
if(this->Save()) if(this->Save())
this->GetBotOwner()->CastToClient()->Message(0, "%s saved.", this->GetCleanName()); this->GetBotOwner()->CastToClient()->Message(0, "%s saved.", this->GetCleanName());
@ -4329,18 +4330,18 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
this->SendPosition(); this->SendPosition();
/* // fillspawnstruct now properly handles this -U // there is something askew with spawn struct appearance fields...
// I re-enabled this until I can sort it out -U
uint32 itemID = 0; uint32 itemID = 0;
uint8 materialFromSlot = 0xFF; uint8 materialFromSlot = 0xFF;
for(int i=EmuConstants::EQUIPMENT_BEGIN; i<=EmuConstants::EQUIPMENT_END; ++i) { for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) {
itemID = GetBotItemBySlot(i); itemID = GetBotItemBySlot(i);
if(itemID != 0) { if(itemID != 0) {
materialFromSlot = Inventory::CalcMaterialFromSlot(i); materialFromSlot = Inventory::CalcMaterialFromSlot(i);
if(materialFromSlot != 0xFF) { if(materialFromSlot != 0xFF)
this->SendWearChange(materialFromSlot); this->SendWearChange(materialFromSlot);
}
} }
}*/ }
} }
} }
@ -4586,8 +4587,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
ns->spawn.size = 0; ns->spawn.size = 0;
ns->spawn.NPC = 0; // 0=player,1=npc,2=pc corpse,3=npc corpse ns->spawn.NPC = 0; // 0=player,1=npc,2=pc corpse,3=npc corpse
ns->spawn.helm = 0xFF; ns->spawn.helm = helmtexture; //0xFF;
ns->spawn.equip_chest2 = 0xFF; ns->spawn.equip_chest2 = texture; //0xFF;
const Item_Struct* item = 0; const Item_Struct* item = 0;
const ItemInst* inst = 0; const ItemInst* inst = 0;

View File

@ -324,6 +324,9 @@ Client::Client(EQStreamInterface* ieqs)
initial_respawn_selection = 0; initial_respawn_selection = 0;
alternate_currency_loaded = false; alternate_currency_loaded = false;
EngagedRaidTarget = false;
SavedRaidRestTimer = 0;
} }
Client::~Client() { Client::~Client() {
@ -4337,6 +4340,10 @@ void Client::IncrementAggroCount() {
if(AggroCount > 1) if(AggroCount > 1)
return; return;
// Pause the rest timer
if (AggroCount == 1)
SavedRaidRestTimer = rest_timer.GetRemainingTime();
if(GetClientVersion() >= EQClientSoF) { if(GetClientVersion() >= EQClientSoF) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 1); EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 1);
@ -4367,14 +4374,27 @@ void Client::DecrementAggroCount() {
// Something else is still aggro on us, can't rest yet. // Something else is still aggro on us, can't rest yet.
if(AggroCount) return; if(AggroCount) return;
rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000); uint32 time_until_rest;
if (GetEngagedRaidTarget()) {
time_until_rest = RuleI(Character, RestRegenRaidTimeToActivate) * 1000;
SetEngagedRaidTarget(false);
} else {
if (SavedRaidRestTimer > (RuleI(Character, RestRegenTimeToActivate) * 1000)) {
time_until_rest = SavedRaidRestTimer;
SavedRaidRestTimer = 0;
} else {
time_until_rest = RuleI(Character, RestRegenTimeToActivate) * 1000;
}
}
rest_timer.Start(time_until_rest);
if(GetClientVersion() >= EQClientSoF) { if(GetClientVersion() >= EQClientSoF) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 5); EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 5);
char *Buffer = (char *)outapp->pBuffer; char *Buffer = (char *)outapp->pBuffer;
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0x00); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0x00);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, RuleI(Character, RestRegenTimeToActivate)); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, (uint32)(time_until_rest / 1000));
QueuePacket(outapp); QueuePacket(outapp);
safe_delete(outapp); safe_delete(outapp);
} }

View File

@ -789,8 +789,8 @@ public:
void SetTint(int16 slot_id, Color_Struct& color); void SetTint(int16 slot_id, Color_Struct& color);
void SetMaterial(int16 slot_id, uint32 item_id); void SetMaterial(int16 slot_id, uint32 item_id);
void Undye(); void Undye();
uint32 GetItemIDAt(int16 slot_id); int32 GetItemIDAt(int16 slot_id);
uint32 GetAugmentIDAt(int16 slot_id, uint8 augslot); int32 GetAugmentIDAt(int16 slot_id, uint8 augslot);
bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false);
bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); bool PushItemOnCursor(const ItemInst& inst, bool client_update = false);
void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true);
@ -1198,6 +1198,9 @@ public:
int mod_food_value(const Item_Struct *item, int change); int mod_food_value(const Item_Struct *item, int change);
int mod_drink_value(const Item_Struct *item, int change); int mod_drink_value(const Item_Struct *item, int change);
void SetEngagedRaidTarget(bool value) { EngagedRaidTarget = value; }
bool GetEngagedRaidTarget() const { return EngagedRaidTarget; }
protected: protected:
friend class Mob; friend class Mob;
void CalcItemBonuses(StatBonuses* newbon); void CalcItemBonuses(StatBonuses* newbon);
@ -1443,6 +1446,9 @@ private:
unsigned int RestRegenMana; unsigned int RestRegenMana;
unsigned int RestRegenEndurance; unsigned int RestRegenEndurance;
bool EngagedRaidTarget;
uint32 SavedRaidRestTimer;
std::set<uint32> zone_flags; std::set<uint32> zone_flags;
ClientTaskState *taskstate; ClientTaskState *taskstate;

View File

@ -9140,7 +9140,8 @@ bool Client::FinishConnState2(DBAsyncWork* dbaw) {
m_pp.timeentitledonaccount = database.GetTotalTimeEntitledOnAccount(AccountID()) / 1440; m_pp.timeentitledonaccount = database.GetTotalTimeEntitledOnAccount(AccountID()) / 1440;
if(m_pp.RestTimer > RuleI(Character, RestRegenTimeToActivate)) // Reset rest timer if the durations have been lowered in the database
if ((m_pp.RestTimer > RuleI(Character, RestRegenTimeToActivate)) && (m_pp.RestTimer > RuleI(Character, RestRegenRaidTimeToActivate)))
m_pp.RestTimer = 0; m_pp.RestTimer = 0;
//This checksum should disappear once dynamic structs are in... each struct strategy will do it //This checksum should disappear once dynamic structs are in... each struct strategy will do it

View File

@ -198,8 +198,11 @@ void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAd
list.push_back(p); list.push_back(p);
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0); parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0);
if(ent->IsClient()) if (ent->IsClient()) {
if (owner->CastToNPC()->IsRaidTarget())
ent->CastToClient()->SetEngagedRaidTarget(true);
ent->CastToClient()->IncrementAggroCount(); ent->CastToClient()->IncrementAggroCount();
}
} }
} }

View File

@ -659,7 +659,7 @@ void Client::DropInst(const ItemInst* inst)
} }
// Returns a slot's item ID (returns INVALID_ID if not found) // Returns a slot's item ID (returns INVALID_ID if not found)
uint32 Client::GetItemIDAt(int16 slot_id) { int32 Client::GetItemIDAt(int16 slot_id) {
const ItemInst* inst = m_inv[slot_id]; const ItemInst* inst = m_inv[slot_id];
if (inst) if (inst)
return inst->GetItem()->ID; return inst->GetItem()->ID;
@ -670,7 +670,7 @@ uint32 Client::GetItemIDAt(int16 slot_id) {
// Returns an augment's ID that's in an item (returns INVALID_ID if not found) // Returns an augment's ID that's in an item (returns INVALID_ID if not found)
// Pass in the slot ID of the item and which augslot you want to check (0-4) // Pass in the slot ID of the item and which augslot you want to check (0-4)
uint32 Client::GetAugmentIDAt(int16 slot_id, uint8 augslot) { int32 Client::GetAugmentIDAt(int16 slot_id, uint8 augslot) {
const ItemInst* inst = m_inv[slot_id]; const ItemInst* inst = m_inv[slot_id];
if (inst) if (inst)
if (inst->GetAugmentItemID(augslot)) if (inst->GetAugmentItemID(augslot))

View File

@ -3537,7 +3537,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id)
} }
} }
uint32 Mob::GetItemStat(uint32 itemid, const char *identifier) int32 Mob::GetItemStat(uint32 itemid, const char *identifier)
{ {
const ItemInst* inst = database.CreateItem(itemid); const ItemInst* inst = database.CreateItem(itemid);
if (!inst) if (!inst)
@ -3550,7 +3550,7 @@ uint32 Mob::GetItemStat(uint32 itemid, const char *identifier)
if (!identifier) if (!identifier)
return 0; return 0;
uint32 stat = 0; int32 stat = 0;
std::string id = identifier; std::string id = identifier;
for(int i = 0; i < id.length(); ++i) for(int i = 0; i < id.length(); ++i)
@ -3559,316 +3559,318 @@ uint32 Mob::GetItemStat(uint32 itemid, const char *identifier)
} }
if (id == "itemclass") if (id == "itemclass")
stat = uint32(item->ItemClass); stat = int32(item->ItemClass);
if (id == "id") if (id == "id")
stat = uint32(item->ID); stat = int32(item->ID);
if (id == "idfile")
stat = atoi(&item->IDFile[2]);
if (id == "weight") if (id == "weight")
stat = uint32(item->Weight); stat = int32(item->Weight);
if (id == "norent") if (id == "norent")
stat = uint32(item->NoRent); stat = int32(item->NoRent);
if (id == "nodrop") if (id == "nodrop")
stat = uint32(item->NoDrop); stat = int32(item->NoDrop);
if (id == "size") if (id == "size")
stat = uint32(item->Size); stat = int32(item->Size);
if (id == "slots") if (id == "slots")
stat = uint32(item->Slots); stat = int32(item->Slots);
if (id == "price") if (id == "price")
stat = uint32(item->Price); stat = int32(item->Price);
if (id == "icon") if (id == "icon")
stat = uint32(item->Icon); stat = int32(item->Icon);
if (id == "loregroup") if (id == "loregroup")
stat = uint32(item->LoreGroup); stat = int32(item->LoreGroup);
if (id == "loreflag") if (id == "loreflag")
stat = uint32(item->LoreFlag); stat = int32(item->LoreFlag);
if (id == "pendingloreflag") if (id == "pendingloreflag")
stat = uint32(item->PendingLoreFlag); stat = int32(item->PendingLoreFlag);
if (id == "artifactflag") if (id == "artifactflag")
stat = uint32(item->ArtifactFlag); stat = int32(item->ArtifactFlag);
if (id == "summonedflag") if (id == "summonedflag")
stat = uint32(item->SummonedFlag); stat = int32(item->SummonedFlag);
if (id == "fvnodrop") if (id == "fvnodrop")
stat = uint32(item->FVNoDrop); stat = int32(item->FVNoDrop);
if (id == "favor") if (id == "favor")
stat = uint32(item->Favor); stat = int32(item->Favor);
if (id == "guildfavor") if (id == "guildfavor")
stat = uint32(item->GuildFavor); stat = int32(item->GuildFavor);
if (id == "pointtype") if (id == "pointtype")
stat = uint32(item->PointType); stat = int32(item->PointType);
if (id == "bagtype") if (id == "bagtype")
stat = uint32(item->BagType); stat = int32(item->BagType);
if (id == "bagslots") if (id == "bagslots")
stat = uint32(item->BagSlots); stat = int32(item->BagSlots);
if (id == "bagsize") if (id == "bagsize")
stat = uint32(item->BagSize); stat = int32(item->BagSize);
if (id == "bagwr") if (id == "bagwr")
stat = uint32(item->BagWR); stat = int32(item->BagWR);
if (id == "benefitflag") if (id == "benefitflag")
stat = uint32(item->BenefitFlag); stat = int32(item->BenefitFlag);
if (id == "tradeskills") if (id == "tradeskills")
stat = uint32(item->Tradeskills); stat = int32(item->Tradeskills);
if (id == "cr") if (id == "cr")
stat = uint32(item->CR); stat = int32(item->CR);
if (id == "dr") if (id == "dr")
stat = uint32(item->DR); stat = int32(item->DR);
if (id == "pr") if (id == "pr")
stat = uint32(item->PR); stat = int32(item->PR);
if (id == "mr") if (id == "mr")
stat = uint32(item->MR); stat = int32(item->MR);
if (id == "fr") if (id == "fr")
stat = uint32(item->FR); stat = int32(item->FR);
if (id == "astr") if (id == "astr")
stat = uint32(item->AStr); stat = int32(item->AStr);
if (id == "asta") if (id == "asta")
stat = uint32(item->ASta); stat = int32(item->ASta);
if (id == "aagi") if (id == "aagi")
stat = uint32(item->AAgi); stat = int32(item->AAgi);
if (id == "adex") if (id == "adex")
stat = uint32(item->ADex); stat = int32(item->ADex);
if (id == "acha") if (id == "acha")
stat = uint32(item->ACha); stat = int32(item->ACha);
if (id == "aint") if (id == "aint")
stat = uint32(item->AInt); stat = int32(item->AInt);
if (id == "awis") if (id == "awis")
stat = uint32(item->AWis); stat = int32(item->AWis);
if (id == "hp") if (id == "hp")
stat = uint32(item->HP); stat = int32(item->HP);
if (id == "mana") if (id == "mana")
stat = uint32(item->Mana); stat = int32(item->Mana);
if (id == "ac") if (id == "ac")
stat = uint32(item->AC); stat = int32(item->AC);
if (id == "deity") if (id == "deity")
stat = uint32(item->Deity); stat = int32(item->Deity);
if (id == "skillmodvalue") if (id == "skillmodvalue")
stat = uint32(item->SkillModValue); stat = int32(item->SkillModValue);
if (id == "skillmodtype") if (id == "skillmodtype")
stat = uint32(item->SkillModType); stat = int32(item->SkillModType);
if (id == "banedmgrace") if (id == "banedmgrace")
stat = uint32(item->BaneDmgRace); stat = int32(item->BaneDmgRace);
if (id == "banedmgamt") if (id == "banedmgamt")
stat = uint32(item->BaneDmgAmt); stat = int32(item->BaneDmgAmt);
if (id == "banedmgbody") if (id == "banedmgbody")
stat = uint32(item->BaneDmgBody); stat = int32(item->BaneDmgBody);
if (id == "magic") if (id == "magic")
stat = uint32(item->Magic); stat = int32(item->Magic);
if (id == "casttime_") if (id == "casttime_")
stat = uint32(item->CastTime_); stat = int32(item->CastTime_);
if (id == "reqlevel") if (id == "reqlevel")
stat = uint32(item->ReqLevel); stat = int32(item->ReqLevel);
if (id == "bardtype") if (id == "bardtype")
stat = uint32(item->BardType); stat = int32(item->BardType);
if (id == "bardvalue") if (id == "bardvalue")
stat = uint32(item->BardValue); stat = int32(item->BardValue);
if (id == "light") if (id == "light")
stat = uint32(item->Light); stat = int32(item->Light);
if (id == "delay") if (id == "delay")
stat = uint32(item->Delay); stat = int32(item->Delay);
if (id == "reclevel") if (id == "reclevel")
stat = uint32(item->RecLevel); stat = int32(item->RecLevel);
if (id == "recskill") if (id == "recskill")
stat = uint32(item->RecSkill); stat = int32(item->RecSkill);
if (id == "elemdmgtype") if (id == "elemdmgtype")
stat = uint32(item->ElemDmgType); stat = int32(item->ElemDmgType);
if (id == "elemdmgamt") if (id == "elemdmgamt")
stat = uint32(item->ElemDmgAmt); stat = int32(item->ElemDmgAmt);
if (id == "range") if (id == "range")
stat = uint32(item->Range); stat = int32(item->Range);
if (id == "damage") if (id == "damage")
stat = uint32(item->Damage); stat = int32(item->Damage);
if (id == "color") if (id == "color")
stat = uint32(item->Color); stat = int32(item->Color);
if (id == "classes") if (id == "classes")
stat = uint32(item->Classes); stat = int32(item->Classes);
if (id == "races") if (id == "races")
stat = uint32(item->Races); stat = int32(item->Races);
if (id == "maxcharges") if (id == "maxcharges")
stat = uint32(item->MaxCharges); stat = int32(item->MaxCharges);
if (id == "itemtype") if (id == "itemtype")
stat = uint32(item->ItemType); stat = int32(item->ItemType);
if (id == "material") if (id == "material")
stat = uint32(item->Material); stat = int32(item->Material);
if (id == "casttime") if (id == "casttime")
stat = uint32(item->CastTime); stat = int32(item->CastTime);
if (id == "elitematerial") if (id == "elitematerial")
stat = uint32(item->EliteMaterial); stat = int32(item->EliteMaterial);
if (id == "procrate") if (id == "procrate")
stat = uint32(item->ProcRate); stat = int32(item->ProcRate);
if (id == "combateffects") if (id == "combateffects")
stat = uint32(item->CombatEffects); stat = int32(item->CombatEffects);
if (id == "shielding") if (id == "shielding")
stat = uint32(item->Shielding); stat = int32(item->Shielding);
if (id == "stunresist") if (id == "stunresist")
stat = uint32(item->StunResist); stat = int32(item->StunResist);
if (id == "strikethrough") if (id == "strikethrough")
stat = uint32(item->StrikeThrough); stat = int32(item->StrikeThrough);
if (id == "extradmgskill") if (id == "extradmgskill")
stat = uint32(item->ExtraDmgSkill); stat = int32(item->ExtraDmgSkill);
if (id == "extradmgamt") if (id == "extradmgamt")
stat = uint32(item->ExtraDmgAmt); stat = int32(item->ExtraDmgAmt);
if (id == "spellshield") if (id == "spellshield")
stat = uint32(item->SpellShield); stat = int32(item->SpellShield);
if (id == "avoidance") if (id == "avoidance")
stat = uint32(item->Avoidance); stat = int32(item->Avoidance);
if (id == "accuracy") if (id == "accuracy")
stat = uint32(item->Accuracy); stat = int32(item->Accuracy);
if (id == "charmfileid") if (id == "charmfileid")
stat = uint32(item->CharmFileID); stat = int32(item->CharmFileID);
if (id == "factionmod1") if (id == "factionmod1")
stat = uint32(item->FactionMod1); stat = int32(item->FactionMod1);
if (id == "factionmod2") if (id == "factionmod2")
stat = uint32(item->FactionMod2); stat = int32(item->FactionMod2);
if (id == "factionmod3") if (id == "factionmod3")
stat = uint32(item->FactionMod3); stat = int32(item->FactionMod3);
if (id == "factionmod4") if (id == "factionmod4")
stat = uint32(item->FactionMod4); stat = int32(item->FactionMod4);
if (id == "factionamt1") if (id == "factionamt1")
stat = uint32(item->FactionAmt1); stat = int32(item->FactionAmt1);
if (id == "factionamt2") if (id == "factionamt2")
stat = uint32(item->FactionAmt2); stat = int32(item->FactionAmt2);
if (id == "factionamt3") if (id == "factionamt3")
stat = uint32(item->FactionAmt3); stat = int32(item->FactionAmt3);
if (id == "factionamt4") if (id == "factionamt4")
stat = uint32(item->FactionAmt4); stat = int32(item->FactionAmt4);
if (id == "augtype") if (id == "augtype")
stat = uint32(item->AugType); stat = int32(item->AugType);
if (id == "ldontheme") if (id == "ldontheme")
stat = uint32(item->LDoNTheme); stat = int32(item->LDoNTheme);
if (id == "ldonprice") if (id == "ldonprice")
stat = uint32(item->LDoNPrice); stat = int32(item->LDoNPrice);
if (id == "ldonsold") if (id == "ldonsold")
stat = uint32(item->LDoNSold); stat = int32(item->LDoNSold);
if (id == "banedmgraceamt") if (id == "banedmgraceamt")
stat = uint32(item->BaneDmgRaceAmt); stat = int32(item->BaneDmgRaceAmt);
if (id == "augrestrict") if (id == "augrestrict")
stat = uint32(item->AugRestrict); stat = int32(item->AugRestrict);
if (id == "endur") if (id == "endur")
stat = uint32(item->Endur); stat = int32(item->Endur);
if (id == "dotshielding") if (id == "dotshielding")
stat = uint32(item->DotShielding); stat = int32(item->DotShielding);
if (id == "attack") if (id == "attack")
stat = uint32(item->Attack); stat = int32(item->Attack);
if (id == "regen") if (id == "regen")
stat = uint32(item->Regen); stat = int32(item->Regen);
if (id == "manaregen") if (id == "manaregen")
stat = uint32(item->ManaRegen); stat = int32(item->ManaRegen);
if (id == "enduranceregen") if (id == "enduranceregen")
stat = uint32(item->EnduranceRegen); stat = int32(item->EnduranceRegen);
if (id == "haste") if (id == "haste")
stat = uint32(item->Haste); stat = int32(item->Haste);
if (id == "damageshield") if (id == "damageshield")
stat = uint32(item->DamageShield); stat = int32(item->DamageShield);
if (id == "recastdelay") if (id == "recastdelay")
stat = uint32(item->RecastDelay); stat = int32(item->RecastDelay);
if (id == "recasttype") if (id == "recasttype")
stat = uint32(item->RecastType); stat = int32(item->RecastType);
if (id == "augdistiller") if (id == "augdistiller")
stat = uint32(item->AugDistiller); stat = int32(item->AugDistiller);
if (id == "attuneable") if (id == "attuneable")
stat = uint32(item->Attuneable); stat = int32(item->Attuneable);
if (id == "nopet") if (id == "nopet")
stat = uint32(item->NoPet); stat = int32(item->NoPet);
if (id == "potionbelt") if (id == "potionbelt")
stat = uint32(item->PotionBelt); stat = int32(item->PotionBelt);
if (id == "stackable") if (id == "stackable")
stat = uint32(item->Stackable); stat = int32(item->Stackable);
if (id == "notransfer") if (id == "notransfer")
stat = uint32(item->NoTransfer); stat = int32(item->NoTransfer);
if (id == "questitemflag") if (id == "questitemflag")
stat = uint32(item->QuestItemFlag); stat = int32(item->QuestItemFlag);
if (id == "stacksize") if (id == "stacksize")
stat = uint32(item->StackSize); stat = int32(item->StackSize);
if (id == "potionbeltslots") if (id == "potionbeltslots")
stat = uint32(item->PotionBeltSlots); stat = int32(item->PotionBeltSlots);
if (id == "book") if (id == "book")
stat = uint32(item->Book); stat = int32(item->Book);
if (id == "booktype") if (id == "booktype")
stat = uint32(item->BookType); stat = int32(item->BookType);
if (id == "svcorruption") if (id == "svcorruption")
stat = uint32(item->SVCorruption); stat = int32(item->SVCorruption);
if (id == "purity") if (id == "purity")
stat = uint32(item->Purity); stat = int32(item->Purity);
if (id == "backstabdmg") if (id == "backstabdmg")
stat = uint32(item->BackstabDmg); stat = int32(item->BackstabDmg);
if (id == "dsmitigation") if (id == "dsmitigation")
stat = uint32(item->DSMitigation); stat = int32(item->DSMitigation);
if (id == "heroicstr") if (id == "heroicstr")
stat = uint32(item->HeroicStr); stat = int32(item->HeroicStr);
if (id == "heroicint") if (id == "heroicint")
stat = uint32(item->HeroicInt); stat = int32(item->HeroicInt);
if (id == "heroicwis") if (id == "heroicwis")
stat = uint32(item->HeroicWis); stat = int32(item->HeroicWis);
if (id == "heroicagi") if (id == "heroicagi")
stat = uint32(item->HeroicAgi); stat = int32(item->HeroicAgi);
if (id == "heroicdex") if (id == "heroicdex")
stat = uint32(item->HeroicDex); stat = int32(item->HeroicDex);
if (id == "heroicsta") if (id == "heroicsta")
stat = uint32(item->HeroicSta); stat = int32(item->HeroicSta);
if (id == "heroiccha") if (id == "heroiccha")
stat = uint32(item->HeroicCha); stat = int32(item->HeroicCha);
if (id == "heroicmr") if (id == "heroicmr")
stat = uint32(item->HeroicMR); stat = int32(item->HeroicMR);
if (id == "heroicfr") if (id == "heroicfr")
stat = uint32(item->HeroicFR); stat = int32(item->HeroicFR);
if (id == "heroiccr") if (id == "heroiccr")
stat = uint32(item->HeroicCR); stat = int32(item->HeroicCR);
if (id == "heroicdr") if (id == "heroicdr")
stat = uint32(item->HeroicDR); stat = int32(item->HeroicDR);
if (id == "heroicpr") if (id == "heroicpr")
stat = uint32(item->HeroicPR); stat = int32(item->HeroicPR);
if (id == "heroicsvcorrup") if (id == "heroicsvcorrup")
stat = uint32(item->HeroicSVCorrup); stat = int32(item->HeroicSVCorrup);
if (id == "healamt") if (id == "healamt")
stat = uint32(item->HealAmt); stat = int32(item->HealAmt);
if (id == "spelldmg") if (id == "spelldmg")
stat = uint32(item->SpellDmg); stat = int32(item->SpellDmg);
if (id == "ldonsellbackrate") if (id == "ldonsellbackrate")
stat = uint32(item->LDoNSellBackRate); stat = int32(item->LDoNSellBackRate);
if (id == "scriptfileid") if (id == "scriptfileid")
stat = uint32(item->ScriptFileID); stat = int32(item->ScriptFileID);
if (id == "expendablearrow") if (id == "expendablearrow")
stat = uint32(item->ExpendableArrow); stat = int32(item->ExpendableArrow);
if (id == "clairvoyance") if (id == "clairvoyance")
stat = uint32(item->Clairvoyance); stat = int32(item->Clairvoyance);
// Begin Effects // Begin Effects
if (id == "clickeffect") if (id == "clickeffect")
stat = uint32(item->Click.Effect); stat = int32(item->Click.Effect);
if (id == "clicktype") if (id == "clicktype")
stat = uint32(item->Click.Type); stat = int32(item->Click.Type);
if (id == "clicklevel") if (id == "clicklevel")
stat = uint32(item->Click.Level); stat = int32(item->Click.Level);
if (id == "clicklevel2") if (id == "clicklevel2")
stat = uint32(item->Click.Level2); stat = int32(item->Click.Level2);
if (id == "proceffect") if (id == "proceffect")
stat = uint32(item->Proc.Effect); stat = int32(item->Proc.Effect);
if (id == "proctype") if (id == "proctype")
stat = uint32(item->Proc.Type); stat = int32(item->Proc.Type);
if (id == "proclevel") if (id == "proclevel")
stat = uint32(item->Proc.Level); stat = int32(item->Proc.Level);
if (id == "proclevel2") if (id == "proclevel2")
stat = uint32(item->Proc.Level2); stat = int32(item->Proc.Level2);
if (id == "worneffect") if (id == "worneffect")
stat = uint32(item->Worn.Effect); stat = int32(item->Worn.Effect);
if (id == "worntype") if (id == "worntype")
stat = uint32(item->Worn.Type); stat = int32(item->Worn.Type);
if (id == "wornlevel") if (id == "wornlevel")
stat = uint32(item->Worn.Level); stat = int32(item->Worn.Level);
if (id == "wornlevel2") if (id == "wornlevel2")
stat = uint32(item->Worn.Level2); stat = int32(item->Worn.Level2);
if (id == "focuseffect") if (id == "focuseffect")
stat = uint32(item->Focus.Effect); stat = int32(item->Focus.Effect);
if (id == "focustype") if (id == "focustype")
stat = uint32(item->Focus.Type); stat = int32(item->Focus.Type);
if (id == "focuslevel") if (id == "focuslevel")
stat = uint32(item->Focus.Level); stat = int32(item->Focus.Level);
if (id == "focuslevel2") if (id == "focuslevel2")
stat = uint32(item->Focus.Level2); stat = int32(item->Focus.Level2);
if (id == "scrolleffect") if (id == "scrolleffect")
stat = uint32(item->Scroll.Effect); stat = int32(item->Scroll.Effect);
if (id == "scrolltype") if (id == "scrolltype")
stat = uint32(item->Scroll.Type); stat = int32(item->Scroll.Type);
if (id == "scrolllevel") if (id == "scrolllevel")
stat = uint32(item->Scroll.Level); stat = int32(item->Scroll.Level);
if (id == "scrolllevel2") if (id == "scrolllevel2")
stat = uint32(item->Scroll.Level2); stat = int32(item->Scroll.Level2);
safe_delete(inst); safe_delete(inst);
return stat; return stat;

View File

@ -524,6 +524,7 @@ public:
//More stuff to sort: //More stuff to sort:
virtual bool IsRaidTarget() { return false; };
virtual bool IsAttackAllowed(Mob *target, bool isSpellAttack = false); virtual bool IsAttackAllowed(Mob *target, bool isSpellAttack = false);
bool IsTargeted() const { return (targeted > 0); } bool IsTargeted() const { return (targeted > 0); }
inline void IsTargeted(int in_tar) { targeted += in_tar; if(targeted < 0) targeted = 0;} inline void IsTargeted(int in_tar) { targeted += in_tar; if(targeted < 0) targeted = 0;}
@ -552,7 +553,7 @@ public:
void Shout(const char *format, ...); void Shout(const char *format, ...);
void Emote(const char *format, ...); void Emote(const char *format, ...);
void QuestJournalledSay(Client *QuestInitiator, const char *str); void QuestJournalledSay(Client *QuestInitiator, const char *str);
uint32 GetItemStat(uint32 itemid, const char *identifier); int32 GetItemStat(uint32 itemid, const char *identifier);
int16 CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, bool best_focus=false); int16 CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, bool best_focus=false);
uint8 IsFocusEffect(uint16 spellid, int effect_index, bool AA=false,uint32 aa_effect=0); uint8 IsFocusEffect(uint16 spellid, int effect_index, bool AA=false,uint32 aa_effect=0);

View File

@ -358,6 +358,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float
SetEmoteID(d->emoteid); SetEmoteID(d->emoteid);
InitializeBuffSlots(); InitializeBuffSlots();
CalcBonuses(); CalcBonuses();
raid_target = d->raid_target;
} }
NPC::~NPC() NPC::~NPC()

View File

@ -396,6 +396,8 @@ public:
void mod_npc_killed(Mob* oos); void mod_npc_killed(Mob* oos);
void AISpellsList(Client *c); void AISpellsList(Client *c);
bool IsRaidTarget() const { return raid_target; };
protected: protected:
const NPCType* NPCTypedata; const NPCType* NPCTypedata;
@ -501,6 +503,8 @@ protected:
std::list<MercType> mercTypeList; std::list<MercType> mercTypeList;
std::list<MercData> mercDataList; std::list<MercData> mercDataList;
bool raid_target;
private: private:
uint32 loottable_id; uint32 loottable_id;
bool p_depop; bool p_depop;

View File

@ -2955,7 +2955,7 @@ XS(XS_Client_GetItemIDAt)
Perl_croak(aTHX_ "Usage: Client::GetItemIDAt(THIS, slot_id)"); Perl_croak(aTHX_ "Usage: Client::GetItemIDAt(THIS, slot_id)");
{ {
Client * THIS; Client * THIS;
uint32 RETVAL; int32 RETVAL;
dXSTARG; dXSTARG;
int16 slot_id = (int16)SvIV(ST(1)); int16 slot_id = (int16)SvIV(ST(1));
@ -2969,7 +2969,7 @@ XS(XS_Client_GetItemIDAt)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItemIDAt(slot_id); RETVAL = THIS->GetItemIDAt(slot_id);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH; PUSHi((IV)RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }
@ -2982,7 +2982,7 @@ XS(XS_Client_GetAugmentIDAt)
Perl_croak(aTHX_ "Usage: Client::GetAugmentIDAt(THIS, slot_id, augslot)"); Perl_croak(aTHX_ "Usage: Client::GetAugmentIDAt(THIS, slot_id, augslot)");
{ {
Client * THIS; Client * THIS;
uint32 RETVAL; int32 RETVAL;
dXSTARG; dXSTARG;
int16 slot_id = (int16)SvIV(ST(1)); int16 slot_id = (int16)SvIV(ST(1));
int16 augslot = (uint8)SvIV(ST(2)); int16 augslot = (uint8)SvIV(ST(2));
@ -2997,7 +2997,7 @@ XS(XS_Client_GetAugmentIDAt)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetAugmentIDAt(slot_id, augslot); RETVAL = THIS->GetAugmentIDAt(slot_id, augslot);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH; PUSHi((IV)RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }

View File

@ -7298,7 +7298,7 @@ XS(XS_Mob_GetItemStat)
Perl_croak(aTHX_ "Usage: Mob::GetItemStat(THIS, itemid, stat)"); Perl_croak(aTHX_ "Usage: Mob::GetItemStat(THIS, itemid, stat)");
{ {
Mob * THIS; Mob * THIS;
uint32 RETVAL; int32 RETVAL;
uint32 itemid = (uint32)SvUV(ST(1)); uint32 itemid = (uint32)SvUV(ST(1));
Const_char * stat = (Const_char *)SvPV_nolen(ST(2)); Const_char * stat = (Const_char *)SvPV_nolen(ST(2));
dXSTARG; dXSTARG;
@ -7313,7 +7313,7 @@ XS(XS_Mob_GetItemStat)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetItemStat(itemid, stat); RETVAL = THIS->GetItemStat(itemid, stat);
XSprePUSH; PUSHu((UV)RETVAL); XSprePUSH; PUSHi((IV)RETVAL);
} }
XSRETURN(1); XSRETURN(1);
} }

View File

@ -1780,6 +1780,24 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
break; break;
} }
case ST_PetMaster:
{
Mob *owner = nullptr;
if (IsPet())
owner = GetOwner();
else if ((IsNPC() && CastToNPC()->GetSwarmOwner()))
owner = entity_list.GetMobID(CastToNPC()->GetSwarmOwner());
if (!owner)
return false;
spell_target = owner;
CastAction = SingleTarget;
break;
}
default: default:
{ {
mlog(SPELLS__CASTING_ERR, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); mlog(SPELLS__CASTING_ERR, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name);

View File

@ -1115,7 +1115,8 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
"npc_types.emoteid," "npc_types.emoteid,"
"npc_types.spellscale," "npc_types.spellscale,"
"npc_types.healscale," "npc_types.healscale,"
"npc_types.no_target_hotkey"; "npc_types.no_target_hotkey,"
"npc_types.raid_target";
MakeAnyLenString(&query, "%s FROM npc_types WHERE id=%d", basic_query, id); MakeAnyLenString(&query, "%s FROM npc_types WHERE id=%d", basic_query, id);
@ -1302,6 +1303,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
tmpNPCType->spellscale = atoi(row[r++]); tmpNPCType->spellscale = atoi(row[r++]);
tmpNPCType->healscale = atoi(row[r++]); tmpNPCType->healscale = atoi(row[r++]);
tmpNPCType->no_target_hotkey = atoi(row[r++]) == 1 ? true : false; tmpNPCType->no_target_hotkey = atoi(row[r++]) == 1 ? true : false;
tmpNPCType->raid_target = atoi(row[r++]) == 0 ? false : true;
// If NPC with duplicate NPC id already in table, // If NPC with duplicate NPC id already in table,
// free item we attempted to add. // free item we attempted to add.

View File

@ -125,6 +125,7 @@ struct NPCType
float spellscale; float spellscale;
float healscale; float healscale;
bool no_target_hotkey; bool no_target_hotkey;
bool raid_target;
}; };
/* /*