From a9911ec429d406a78d9f471368ff88243888b126 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 3 May 2009 11:50:12 -0500 Subject: [PATCH 1/7] *Fix broken chain spells. --HG-- branch : trunk --- src/game/Spell.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index ca822db570..91d6622425 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1929,9 +1929,9 @@ void Spell::SetTargetMap(uint32 i, uint32 cur) m_damageMultipliers[i] = 1.0f; m_applyMultiplierMask |= 1 << i; - float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + float range = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); if(modOwner) - modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this); + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); std::list unitList; @@ -1940,13 +1940,13 @@ void Spell::SetTargetMap(uint32 i, uint32 cur) case TARGET_UNIT_NEARBY_ENEMY: case TARGET_UNIT_TARGET_ENEMY: case TARGET_UNIT_NEARBY_ENTRY: // fix me - SearchChainTarget(unitList, radius, maxTargets, SPELL_TARGETS_ENEMY); + SearchChainTarget(unitList, range, maxTargets, SPELL_TARGETS_ENEMY); break; case TARGET_UNIT_CHAINHEAL: case TARGET_UNIT_NEARBY_ALLY: // fix me case TARGET_UNIT_NEARBY_ALLY_UNK: case TARGET_UNIT_NEARBY_RAID: - SearchChainTarget(unitList, radius, maxTargets, SPELL_TARGETS_CHAINHEAL); + SearchChainTarget(unitList, range, maxTargets, SPELL_TARGETS_CHAINHEAL); break; } From 04d5acb24e96cbf73bb3a127a32ada9f0c176403 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 3 May 2009 15:17:19 -0500 Subject: [PATCH 2/7] *Fix a typo that break some charge spells. --HG-- branch : trunk --- src/game/SpellMgr.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 4682faf1ab..8e01742587 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2194,6 +2194,7 @@ void SpellMgr::LoadSpellCustomAttr() if(!spellInfo->speed && !spellInfo->SpellFamilyName) spellInfo->speed = SPEED_CHARGE; mSpellCustomAttr[i] |= SPELL_ATTR_CU_CHARGE; + break; case SPELL_EFFECT_TRIGGER_SPELL: if(spellInfo->Targets & (TARGET_FLAG_SOURCE_LOCATION|TARGET_FLAG_DEST_LOCATION)) spellInfo->Effect[j] = SPELL_EFFECT_TRIGGER_MISSILE; From 4dbaab09e5583a548f1558bb1cbda8b53cf7c09c Mon Sep 17 00:00:00 2001 From: Anubisss Date: Sun, 3 May 2009 22:24:52 +0200 Subject: [PATCH 3/7] *Fix a typo in Brutallus. --HG-- branch : trunk --- .../scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp index 6fb5c6d074..e6f3caf0ae 100644 --- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp @@ -295,7 +295,7 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI if(BurnTimer < diff) { if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_BURN, true); + target->CastSpell(target, SPELL_BURN, true); BurnTimer = 60000; }else BurnTimer -= diff; From 03737048515b0bd0bed130887716c45a98ecd686 Mon Sep 17 00:00:00 2001 From: Anubisss Date: Mon, 4 May 2009 20:21:14 +0200 Subject: [PATCH 4/7] *Fix Healing Way stack counting in Healing Wave's script. --HG-- branch : trunk --- src/game/Unit.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c9769cf89f..6c4e171e4f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9033,8 +9033,13 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, int32 pctMod = 0; Unit::AuraList const& auraDummy = pVictim->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr!=auraDummy.end(); ++itr) + { if((*itr)->GetId() == 29203) - pctMod += (*itr)->GetModifier()->m_amount; + { + pctMod = (*itr)->GetModifier()->m_amount * (*itr)->GetStackAmount(); + break; + } + } // Apply bonus if (pctMod) heal = heal * (100 + pctMod) / 100; From 280a2ac54e44fea7fa84ec89ec8519f8648dc2e1 Mon Sep 17 00:00:00 2001 From: Chaz Brown Date: Tue, 5 May 2009 09:24:50 -0400 Subject: [PATCH 5/7] Added tag stable for changeset 4145ad4cc511 --HG-- branch : trunk --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .hgtags diff --git a/.hgtags b/.hgtags new file mode 100644 index 0000000000..e704ed6249 --- /dev/null +++ b/.hgtags @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 stable +4145ad4cc511c5e45a1add770aa6548ea2e94d9e stable From 6ff7d30004ce18107f17516fec915f6cc7231e8d Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 6 May 2009 09:32:24 -0500 Subject: [PATCH 6/7] *Use correct indent for aubot. --HG-- branch : trunk --- src/game/AuctionHouseBot.cpp | 530 +++++++++++++++++------------------ 1 file changed, 250 insertions(+), 280 deletions(-) diff --git a/src/game/AuctionHouseBot.cpp b/src/game/AuctionHouseBot.cpp index a212feb826..c15014c653 100644 --- a/src/game/AuctionHouseBot.cpp +++ b/src/game/AuctionHouseBot.cpp @@ -478,300 +478,270 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World if (!AHBBuyer) return; - // Fetches content of selected AH - AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID()); - AuctionHouseObject::AuctionEntryMap::iterator itr; + // Fetches content of selected AH + AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID()); + AuctionHouseObject::AuctionEntryMap::iterator itr; - itr = auctionHouse->GetAuctionsBegin(); - vector possibleBids; + itr = auctionHouse->GetAuctionsBegin(); + vector possibleBids; - while (itr != auctionHouse->GetAuctionsEnd()) - { - AuctionHouseObject::AuctionEntryMap::iterator tmp = itr; - ++itr; - // Check if the auction is ours - // if it is, we skip this iteration. - if(tmp->second->owner == AHBplayerGUID) - { - continue; - } - // Check that we haven't bidded in this auction already. - if(tmp->second->bidder != AHBplayerGUID) - { - uint32 tmpdata = tmp->second->Id; - possibleBids.push_back(tmpdata); - } - } - - uint32 bids = config->GetBidsPerInterval(); - for (uint32 count = 1;count <= bids;count++) - { - - // Do we have anything to bid? If not, stop here. - if(possibleBids.empty()) - { - count = bids + 1; - return; - } - - // Choose random auction from possible auctions - uint32 vectorPos = urand(0, possibleBids.size() - 1); - uint32 auctionID = possibleBids[vectorPos]; - - // Erase the auction from the vector to prevent bidding on item in next itteration. - vector::iterator iter = possibleBids.begin(); - advance(iter, vectorPos); - possibleBids.erase(iter); - - // from auctionhousehandler.cpp, creates auction pointer & player pointer - AuctionEntry* auction = auctionHouse->GetAuction(auctionID); - - // get exact item information - Item *pItem = auctionmgr.GetAItem(auction->item_guidlow); - if (!pItem) - { - sLog.outError("Item doesn't exists, perhaps bought already?"); - return; - } - - // get item prototype - ItemPrototype const* prototype = objmgr.GetItemPrototype(auction->item_template); - - // check which price we have to use, startbid or if it is bidded already - if(debug_Out) - { - sLog.outError("Auction Number: %u", auction->Id); - sLog.outError("Item Template: %u", auction->item_template); - sLog.outError("Buy Price: %u", prototype->BuyPrice); - sLog.outError("Sell Price: %u", prototype->SellPrice); - sLog.outError("Quality: %u", prototype->Quality); - } - uint32 currentprice; - if(auction->bid) - { - currentprice = auction->bid; - if(debug_Out) - {sLog.outError("Current Price: %u", auction->bid);} - } - else - { - currentprice = auction->startbid; - if(debug_Out) - {sLog.outError("Current Price: %u", auction->startbid);} - } - uint32 bidprice; - - // Prepare portion from maximum bid - uint32 tmprate2 = urand(0, 100); - double tmprate = static_cast(tmprate2); - if(debug_Out) - {sLog.outError("tmprate: %f", tmprate);} - double bidrate = tmprate / 100; - if(debug_Out) - {sLog.outError("bidrate: %f", bidrate);} - long double bidMax = 0; - - // check that bid has acceptable value and take bid based on vendorprice, stacksize and quality - switch (BuyMethod) - { - case 0: - switch (prototype->Quality) - { - case 0: - if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY)) - { - bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY); - } - break; - case 1: - if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE)) - { - bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE); - } - break; - case 2: - if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN)) - { - bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN); - } - break; - case 3: - if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE)) - { - bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE); - } - break; - case 4: - if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE)) - { - bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE); - } - case 5: - if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE)) - { - bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE); - } - case 6: - if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW)) - { - bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW); - } - break; - default: - // quality is something it shouldn't be, let's get out of here - if(debug_Out) - {sLog.outError("bidMax(fail): %f", bidMax);} - return; - break; - } - break; - case 1: - switch (prototype->Quality) - { - case 0: - if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY)) - { - bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY); - } - break; - case 1: - if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE)) - { - bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE); - } - break; - case 2: - if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN)) - { - bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN); - } - break; - case 3: - if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE)) - { - bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE); - } - break; - case 4: - if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE)) - { - bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE); - } - case 5: - if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE)) - { - bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE); - } - case 6: - if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW)) - { - bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW); - } - break; - default: - // quality is something it shouldn't be, let's get out of here - if(debug_Out) - {sLog.outError("bidMax(fail): %f", bidMax);} - return; - break; - } - break; - default: - bidMax = 0; - break; - } - if(debug_Out) - {sLog.outError("bidMax(succeed): %f", bidMax);} - - // check some special items, and do recalculating to their prices - switch (prototype->Class) + while (itr != auctionHouse->GetAuctionsEnd()) { - // ammo - case 6: - bidMax = 0; - break; - default: - break; + AuctionHouseObject::AuctionEntryMap::iterator tmp = itr; + ++itr; + // Check if the auction is ours + // if it is, we skip this iteration. + if(tmp->second->owner == AHBplayerGUID) + { + continue; + } + // Check that we haven't bidded in this auction already. + if(tmp->second->bidder != AHBplayerGUID) + { + uint32 tmpdata = tmp->second->Id; + possibleBids.push_back(tmpdata); + } } - if(bidMax == 0) - { - // quality check failed to get bidmax, let's get out of here - return; - } + uint32 bids = config->GetBidsPerInterval(); + for (uint32 count = 0; count < bids; ++count) + { + // Do we have anything to bid? If not, stop here. + if(possibleBids.empty()) + return; - // Calculate our bid - long double bidvalue = currentprice + ( (bidMax - currentprice) * bidrate); - if(debug_Out) - {sLog.outError("bidvalue: %f", bidvalue);} - // Convert to uint32 - bidprice = static_cast(bidvalue); - if(debug_Out) - {sLog.outError("bidprice: %u", bidprice);} + // Choose random auction from possible auctions + uint32 vectorPos = urand(0, possibleBids.size() - 1); + vector::iterator iter = possibleBids.begin(); + advance(iter, vectorPos); + // from auctionhousehandler.cpp, creates auction pointer & player pointer + AuctionEntry* auction = auctionHouse->GetAuction(*iter); + // Erase the auction from the vector to prevent bidding on item in next itteration. + possibleBids.erase(iter); - // Check our bid is high enough to be valid. If not, correct it to minimum. - if((currentprice + auction->GetAuctionOutBid()) > bidprice) - { - bidprice = currentprice + auction->GetAuctionOutBid(); + // get exact item information + Item *pItem = auctionmgr.GetAItem(auction->item_guidlow); + if (!pItem) + { + sLog.outError("Item doesn't exists, perhaps bought already?"); + return; + } + + // get item prototype + ItemPrototype const* prototype = objmgr.GetItemPrototype(auction->item_template); + + // check which price we have to use, startbid or if it is bidded already if(debug_Out) - {sLog.outError("bidprice(>): %u", bidprice);} - } + { + sLog.outError("Auction Number: %u", auction->Id); + sLog.outError("Item Template: %u", auction->item_template); + sLog.outError("Buy Price: %u", prototype->BuyPrice); + sLog.outError("Sell Price: %u", prototype->SellPrice); + sLog.outError("Quality: %u", prototype->Quality); + } - // Check wether we do normal bid, or buyout - if ((bidprice < auction->buyout) || (auction->buyout == 0)) - { + uint32 currentprice; + if(auction->bid) + { + currentprice = auction->bid; + if(debug_Out) + {sLog.outError("Current Price: %u", auction->bid);} + } + else + { + currentprice = auction->startbid; + if(debug_Out) + {sLog.outError("Current Price: %u", auction->startbid);} + } - if (auction->bidder > 0) - { - if ( auction->bidder == AHBplayer->GetGUIDLow() ) - { - //pl->ModifyMoney( -int32(price - auction->bid)); - } - else - { - // mail to last bidder and return money - session->SendAuctionOutbiddedMail( auction , bidprice ); - //pl->ModifyMoney( -int32(price) ); - } - } + // Prepare portion from maximum bid + uint32 tmprate2 = urand(0, 100); + double tmprate = static_cast(tmprate2); + double bidrate = tmprate / 100; + long double bidMax = 0; + if(debug_Out) + { + sLog.outError("tmprate: %f", tmprate); + sLog.outError("bidrate: %f", bidrate); + } - auction->bidder = AHBplayer->GetGUIDLow(); - auction->bid = bidprice; + // check that bid has acceptable value and take bid based on vendorprice, stacksize and quality + switch (BuyMethod) + { + case 0: + { + switch (prototype->Quality) + { + case 0: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY)) + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY); + break; + case 1: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE)) + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE); + break; + case 2: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN)) + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN); + break; + case 3: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE)) + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE); + break; + case 4: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE)) + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE); + case 5: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE)) + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE); + case 6: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW)) + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW); + break; + default: + // quality is something it shouldn't be, let's get out of here + if(debug_Out) + sLog.outError("bidMax(fail): %f", bidMax); + return; + } + break; + } + case 1: + { + switch (prototype->Quality) + { + case 0: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY)) + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY); + break; + case 1: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE)) + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE); + break; + case 2: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN)) + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN); + break; + case 3: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE)) + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE); + break; + case 4: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE)) + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE); + case 5: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE)) + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE); + case 6: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW)) + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW); + break; + default: + // quality is something it shouldn't be, let's get out of here + if(debug_Out) + sLog.outError("bidMax(fail): %f", bidMax); + return; + } + break; + } + default: + bidMax = 0; + break; + } - // Saving auction into database - CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id); - } - else - { - //buyout - if (AHBplayer->GetGUIDLow() == auction->bidder ) - { - //pl->ModifyMoney(-int32(auction->buyout - auction->bid)); - } - else - { - //pl->ModifyMoney(-int32(auction->buyout)); - if ( auction->bidder ) - { - session->SendAuctionOutbiddedMail( auction, auction->buyout ); - } - } - auction->bidder = AHBplayer->GetGUIDLow(); - auction->bid = auction->buyout; + if(debug_Out) + sLog.outError("bidMax(succeed): %f", bidMax); - // Send mails to buyer & seller - auctionmgr.SendAuctionSuccessfulMail( auction ); - auctionmgr.SendAuctionWonMail( auction ); + // check some special items, and do recalculating to their prices + switch (prototype->Class) + { + // ammo + case 6: + bidMax = 0; + break; + default: + break; + } - // Remove item from auctionhouse - auctionmgr.RemoveAItem(auction->item_guidlow); - // Remove auction - auctionHouse->RemoveAuction(auction->Id); - // Remove from database - auction->DeleteFromDB(); - } - delete auction; - } + if(bidMax == 0) + { + // quality check failed to get bidmax, let's get out of here + return; + } + + // Calculate our bid + long double bidvalue = currentprice + ( (bidMax - currentprice) * bidrate); + // Convert to uint32 + uint32 bidprice = static_cast(bidvalue); + if(debug_Out) + { + sLog.outError("bidprice: %u", bidprice); + sLog.outError("bidvalue: %f", bidvalue); + } + + // Check our bid is high enough to be valid. If not, correct it to minimum. + if((currentprice + auction->GetAuctionOutBid()) > bidprice) + { + bidprice = currentprice + auction->GetAuctionOutBid(); + if(debug_Out) + sLog.outError("bidprice(>): %u", bidprice); + } + + // Check wether we do normal bid, or buyout + if ((bidprice < auction->buyout) || (auction->buyout == 0)) + { + + if (auction->bidder > 0) + { + if ( auction->bidder == AHBplayer->GetGUIDLow() ) + { + //pl->ModifyMoney( -int32(price - auction->bid)); + } + else + { + // mail to last bidder and return money + session->SendAuctionOutbiddedMail( auction , bidprice ); + //pl->ModifyMoney( -int32(price) ); + } + } + + auction->bidder = AHBplayer->GetGUIDLow(); + auction->bid = bidprice; + + // Saving auction into database + CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id); + } + else + { + //buyout + if (AHBplayer->GetGUIDLow() == auction->bidder ) + { + //pl->ModifyMoney(-int32(auction->buyout - auction->bid)); + } + else + { + //pl->ModifyMoney(-int32(auction->buyout)); + if ( auction->bidder ) + { + session->SendAuctionOutbiddedMail( auction, auction->buyout ); + } + } + auction->bidder = AHBplayer->GetGUIDLow(); + auction->bid = auction->buyout; + + // Send mails to buyer & seller + auctionmgr.SendAuctionSuccessfulMail( auction ); + auctionmgr.SendAuctionWonMail( auction ); + + // Remove item from auctionhouse + auctionmgr.RemoveAItem(auction->item_guidlow); + // Remove auction + auctionHouse->RemoveAuction(auction->Id); + // Remove from database + auction->DeleteFromDB(); + } + delete auction; + } } /////////////////////////////////////////////////////////////////////////////// // From 9bbde48afbe5568f75df24ea0b0aad3d8660c54b Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 6 May 2009 09:33:34 -0500 Subject: [PATCH 7/7] *Fix a memory leak of aubot. But this should not cause crash. --HG-- branch : trunk --- src/game/AuctionHouseBot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/AuctionHouseBot.cpp b/src/game/AuctionHouseBot.cpp index c15014c653..b139358b74 100644 --- a/src/game/AuctionHouseBot.cpp +++ b/src/game/AuctionHouseBot.cpp @@ -739,8 +739,8 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World auctionHouse->RemoveAuction(auction->Id); // Remove from database auction->DeleteFromDB(); + delete auction; } - delete auction; } } ///////////////////////////////////////////////////////////////////////////////