diff options
author | Brian <runningnak3d@gmail.com> | 2009-12-21 14:48:30 -0700 |
---|---|---|
committer | Brian <runningnak3d@gmail.com> | 2009-12-21 14:48:30 -0700 |
commit | 36d30faabf6716e585ebbbfce30577bb143a0481 (patch) | |
tree | 890174d89153a18fcc10b916592e3c3644e02e48 /src | |
parent | 6b9d05c315c23d37eb41580805465394b3378b99 (diff) |
* Add support for RewSpellCast=-1. If -1 remove all auras applied to player at
* quest start.
* Patch by Kudlaty -- THANK YOU!
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/AuctionHouseMgr.cpp | 2 | ||||
-rw-r--r-- | src/game/Creature.cpp | 2 | ||||
-rw-r--r-- | src/game/Creature.h | 6 | ||||
-rw-r--r-- | src/game/GameEventMgr.cpp | 2 | ||||
-rw-r--r-- | src/game/GameEventMgr.h | 2 | ||||
-rw-r--r-- | src/game/GossipDef.cpp | 6 | ||||
-rw-r--r-- | src/game/Guild.cpp | 2 | ||||
-rw-r--r-- | src/game/Item.cpp | 2 | ||||
-rw-r--r-- | src/game/ItemHandler.cpp | 4 | ||||
-rw-r--r-- | src/game/ItemPrototype.h | 6 | ||||
-rw-r--r-- | src/game/LootMgr.cpp | 4 | ||||
-rw-r--r-- | src/game/Mail.cpp | 2 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 6 | ||||
-rw-r--r-- | src/game/ObjectMgr.h | 4 | ||||
-rw-r--r-- | src/game/Player.cpp | 18 | ||||
-rw-r--r-- | src/game/QuestDef.cpp | 2 | ||||
-rw-r--r-- | src/game/QuestDef.h | 4 | ||||
-rw-r--r-- | src/game/TradeHandler.cpp | 2 |
18 files changed, 42 insertions, 34 deletions
diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index dbade5b329d..b2b5d250b28 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -673,7 +673,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const data << uint32(pItem->GetEnchantmentCharges(EnchantmentSlot(i))); } - data << uint32(pItem->GetItemRandomPropertyId()); //random item property id + data << int32(pItem->GetItemRandomPropertyId()); //random item property id data << uint32(pItem->GetItemSuffixFactor()); //SuffixFactor data << uint32(pItem->GetCount()); //item->count data << uint32(pItem->GetSpellCharges()); //item->charge FFFFFFF diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index e89ed26ce29..05f2c7e1ec6 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -2238,7 +2238,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us if(itr == m_vendorItemCounts.end()) { - uint32 new_count = vItem->maxcount > used_count ? vItem->maxcount-used_count : 0; + int32 new_count = vItem->maxcount > used_count ? vItem->maxcount-used_count : 0; m_vendorItemCounts.push_back(VendorItemCount(vItem->item,new_count)); return new_count; } diff --git a/src/game/Creature.h b/src/game/Creature.h index 3743539d86a..6470af4bb71 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -309,11 +309,11 @@ enum AttackingTarget // Vendors struct VendorItem { - VendorItem(uint32 _item, uint32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost) + VendorItem(uint32 _item, int32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost) : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost) {} uint32 item; - uint32 maxcount; // 0 for infinity item amount + int32 maxcount; // 0 for infinity item amount uint32 incrtime; // time for restore items amount if maxcount != 0 uint32 ExtendedCost; }; @@ -330,7 +330,7 @@ struct VendorItemData } bool Empty() const { return m_items.empty(); } uint8 GetItemCount() const { return m_items.size(); } - void AddItem( uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost) + void AddItem( uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost) { m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost)); } diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index eed46cfc1e3..c48a0f3f892 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -832,7 +832,7 @@ void GameEventMgr::LoadFromDB() NPCVendorEntry newEntry; uint32 guid = fields[1].GetUInt32(); newEntry.item = fields[2].GetUInt32(); - newEntry.maxcount = fields[3].GetUInt32(); + newEntry.maxcount = fields[3].GetInt32(); newEntry.incrtime = fields[4].GetUInt32(); newEntry.ExtendedCost = fields[5].GetUInt32(); // get the event npc flag for checking if the npc will be vendor during the event or not diff --git a/src/game/GameEventMgr.h b/src/game/GameEventMgr.h index 7f5e92b723d..88b71b79665 100644 --- a/src/game/GameEventMgr.h +++ b/src/game/GameEventMgr.h @@ -82,7 +82,7 @@ struct NPCVendorEntry { uint32 entry; // creature entry uint32 item; // item id - uint32 maxcount; // 0 for infinite + int32 maxcount; // 0 for infinite uint32 incrtime; // time for restore items amount if maxcount != 0 uint32 ExtendedCost; }; diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index d3b6f7880b9..009360283ca 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -511,7 +511,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID // rewarded honor points. Multiply with 10 to satisfy client data << uint32(10*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0) - data << uint32(pQuest->GetRewSpellCast()); // casted spell + data << int32(pQuest->GetRewSpellCast()); // casted spell data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) data << uint32(pQuest->GetBonusTalents()); // bonus talents @@ -583,7 +583,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) data << uint32(pQuest->GetRewMoneyMaxLevel()); // used in XP calculation at client data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0) - data << uint32(pQuest->GetRewSpellCast()); // casted spell + data << int32(pQuest->GetRewSpellCast()); // casted spell // rewarded honor points data << uint32(Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); @@ -732,7 +732,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, data << uint32(10*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); data << uint32(0x08); // unused by client? data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0) - data << uint32(pQuest->GetRewSpellCast()); // casted spell + data << int32(pQuest->GetRewSpellCast()); // casted spell data << uint32(0); // unknown data << uint32(pQuest->GetBonusTalents()); // bonus talents pSession->SendPacket( &data ); diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 9f6a0b62055..9359fbf5487 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -1695,7 +1695,7 @@ void Guild::AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *t data << uint32(entry); if (entry) { - data << (uint32) pItem->GetItemRandomPropertyId(); // random item property id +8 + data << (int32) pItem->GetItemRandomPropertyId(); // random item property id +8 if (pItem->GetItemRandomPropertyId()) data << (uint32) pItem->GetItemSuffixFactor(); // SuffixFactor +4 diff --git a/src/game/Item.cpp b/src/game/Item.cpp index d00e4d535d3..0197de1d3ff 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -552,7 +552,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) // RandomProperty case if(itemProto->RandomProperty) { - uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty); + int32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty); ItemRandomPropertiesEntry const *random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); if(!random_id) { diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 35fdadfb029..7b8113f0bbd 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -750,12 +750,12 @@ void WorldSession::SendListInventory( uint64 vendorguid ) ++count; // reputation discount - uint32 price = uint32(floor(pProto->BuyPrice * discountMod)); + int32 price = uint32(floor(pProto->BuyPrice * discountMod)); data << uint32(count); data << uint32(crItem->item); data << uint32(pProto->DisplayInfoID); - data << uint32(crItem->maxcount <= 0 ? 0xFFFFFFFF : pCreature->GetVendorItemCurrentCount(crItem)); + data << int32(crItem->maxcount <= 0 ? 0xFFFFFFFF : pCreature->GetVendorItemCurrentCount(crItem)); data << uint32(price); data << uint32(pProto->MaxDurability); data << uint32(pProto->BuyCount); diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 4a2ab112538..51874be3787 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -523,10 +523,10 @@ struct ItemPrototype char* Name1; uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc uint32 Quality; - uint32 Flags; + int32 Flags; uint32 Faction; uint32 BuyCount; - uint32 BuyPrice; + int32 BuyPrice; uint32 SellPrice; uint32 InventoryType; uint32 AllowableClass; @@ -568,7 +568,7 @@ struct ItemPrototype uint32 LockID; int32 Material; // id from Material.dbc uint32 Sheath; - uint32 RandomProperty; // id from ItemRandomProperties.dbc + int32 RandomProperty; // id from ItemRandomProperties.dbc uint32 RandomSuffix; // id from ItemRandomSuffix.dbc uint32 Block; uint32 ItemSet; // id from ItemSet.dbc diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 809df7e9e51..13996cd3e96 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -117,7 +117,7 @@ void LootStore::LoadLootTable() uint16 lootmode = fields[3].GetUInt16(); uint8 group = fields[4].GetUInt8(); int32 mincountOrRef = fields[5].GetInt32(); - uint32 maxcount = fields[6].GetUInt32(); + int32 maxcount = fields[6].GetInt32(); ConditionType condition = (ConditionType)fields[7].GetUInt8(); uint32 cond_value1 = fields[8].GetUInt32(); uint32 cond_value2 = fields[9].GetUInt32(); @@ -293,7 +293,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const if( maxcount < mincountOrRef) // wrong max count { - sLog.outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, uint32(maxcount), mincountOrRef); + sLog.outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef); return false; } diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 3791ea75ace..961a12332e9 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -612,7 +612,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data ) data << uint32((item ? item->GetEnchantmentId((EnchantmentSlot)j) : 0)); } // can be negative - data << uint32((item ? item->GetItemRandomPropertyId() : 0)); + data << int32((item ? item->GetItemRandomPropertyId() : 0)); // unk data << uint32((item ? item->GetItemSuffixFactor() : 0)); // stack count diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index fad7b3248f0..1e081c901ba 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -8238,7 +8238,7 @@ void ObjectMgr::LoadVendors() uint32 entry = fields[0].GetUInt32(); uint32 item_id = fields[1].GetUInt32(); - uint32 maxcount = fields[2].GetUInt32(); + int32 maxcount = fields[2].GetInt32(); uint32 incrtime = fields[3].GetUInt32(); uint32 ExtendedCost = fields[4].GetUInt32(); @@ -8515,7 +8515,7 @@ void ObjectMgr::LoadGossipMenuItems() sLog.outString(">> Loaded %u gossip_menu_option entries", count); } -void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb) +void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb) { VendorItemData& vList = m_mCacheVendorItemMap[entry]; vList.AddItem(item,maxcount,incrtime,extendedcost); @@ -8537,7 +8537,7 @@ bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item, bool savetodb) return true; } -bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag ) const +bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag ) const { CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry); if(!cInfo) diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index e329da754e4..0dd7087a4e2 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -870,9 +870,9 @@ class ObjectMgr return &iter->second; } - void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event + void AddVendorItem(uint32 entry,uint32 item, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true); // for event - bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0 ) const; + bool IsVendorItemValid( uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0 ) const; void LoadScriptNames(); ScriptNameMap &GetScriptNames() { return m_scriptNames; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index c7cbcbd05c3..b84336079a1 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12719,7 +12719,7 @@ void Player::SendNewItem(Item *item, uint32 count, bool received, bool created, data << uint32((item->GetCount() == count) ? item->GetSlot() : -1); data << uint32(item->GetEntry()); // item id data << uint32(item->GetItemSuffixFactor()); // SuffixFactor - data << uint32(item->GetItemRandomPropertyId()); // random item property id + data << int32(item->GetItemRandomPropertyId()); // random item property id data << uint32(count); // count of items data << uint32(GetItemCount(item->GetEntry())); // count of items in inventory @@ -18847,7 +18847,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint } } - uint32 price = pProto->BuyPrice * count; + int32 price = pProto->BuyPrice * count; // reputation discount price = uint32(floor(price * GetReputationPriceDiscount(pCreature))); @@ -18905,7 +18905,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4)); data << uint64(pCreature->GetGUID()); data << uint32(vendor_slot+1); // numbered from 1 at client - data << uint32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); + data << int32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); data << uint32(count); GetSession()->SendPacket(&data); SendNewItem(it, pProto->BuyCount*count, true, false, false); @@ -18959,7 +18959,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4)); data << uint64(pCreature->GetGUID()); data << uint32(vendor_slot + 1); // numbered from 1 at client - data << uint32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); + data << int32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); data << uint32(count); GetSession()->SendPacket(&data); @@ -20197,12 +20197,20 @@ void Player::learnDefaultSpells() void Player::learnQuestRewardedSpells(Quest const* quest) { - uint32 spell_id = quest->GetRewSpellCast(); + int32 spell_id = quest->GetRewSpellCast(); + uint32 src_spell_id = quest->GetSrcSpell(); // skip quests without rewarded spell if( !spell_id ) return; + // if RewSpellCast = -1 we remove aura do to SrcSpell from player. + if (spell_id == -1 && src_spell_id) + { + this->RemoveAurasDueToSpell(src_spell_id); + return; + } + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); if(!spellInfo) return; diff --git a/src/game/QuestDef.cpp b/src/game/QuestDef.cpp index d9f7c6b25d5..5349f2d94b6 100644 --- a/src/game/QuestDef.cpp +++ b/src/game/QuestDef.cpp @@ -108,7 +108,7 @@ Quest::Quest(Field * questRecord) RewOrReqMoney = questRecord[104].GetInt32(); RewMoneyMaxLevel = questRecord[105].GetUInt32(); RewSpell = questRecord[106].GetUInt32(); - RewSpellCast = questRecord[107].GetUInt32(); + RewSpellCast = questRecord[107].GetInt32(); RewMailTemplateId = questRecord[108].GetUInt32(); RewMailDelaySecs = questRecord[109].GetUInt32(); PointMapId = questRecord[110].GetUInt32(); diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index 180ec4c5091..31b17505fe9 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -216,7 +216,7 @@ class Quest uint32 GetRewMoneyMaxLevel() const { return RewMoneyMaxLevel; } // use in XP calculation at client uint32 GetRewSpell() const { return RewSpell; } - uint32 GetRewSpellCast() const { return RewSpellCast; } + int32 GetRewSpellCast() const { return RewSpellCast; } uint32 GetRewMailTemplateId() const { return RewMailTemplateId; } uint32 GetRewMailDelaySecs() const { return RewMailDelaySecs; } uint32 GetPointMapId() const { return PointMapId; } @@ -311,7 +311,7 @@ class Quest int32 RewOrReqMoney; uint32 RewMoneyMaxLevel; uint32 RewSpell; - uint32 RewSpellCast; + int32 RewSpellCast; uint32 RewMailTemplateId; uint32 RewMailDelaySecs; uint32 PointMapId; diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index e09e1abb812..6b6bc445b70 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -158,7 +158,7 @@ void WorldSession::SendUpdateTrade() data << (uint32) item->GetSpellCharges(); // charges data << (uint32) item->GetItemSuffixFactor(); // SuffixFactor // random properties id - data << (uint32) item->GetItemRandomPropertyId(); + data << (int32) item->GetItemRandomPropertyId(); data << (uint32) item->GetProto()->LockID; // lock id // max durability data << (uint32) item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY); |