Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps
Conflicts: src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
SET @exists = (SELECT 1 FROM `creature_loot_template` WHERE `entry`=100002);
|
||||
DELETE FROM `creature_loot_template` WHERE `entry`=100002 AND @exists = 1;
|
||||
DELETE FROM `creature_loot_template` WHERE `mincountOrRef`=-35069 AND @exists = 1;
|
||||
INSERT INTO `creature_loot_template`(`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) SELECT `entry`,1,100,1,0,-35069,2 FROM `creature_template` WHERE `lootid` = 100002 AND @exists = 1; -- 2 selection from reference
|
||||
UPDATE `creature_template` SET `lootid`=`entry` WHERE `lootid` = 100002 AND @exists = 1;
|
||||
@@ -0,0 +1,12 @@
|
||||
-- AzjolNerub/Ahnkahet/Herald Volazj
|
||||
DELETE FROM `script_texts` WHERE `entry` BETWEEN -1619036 AND -1619030;
|
||||
DELETE FROM `creature_text` WHERE `entry`=29311;
|
||||
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
|
||||
(29311,0,0, 'Shgla''yos plahf mh''naus.', 14,0,100,0,0,14043, 'SAY_AGGRO_1'),
|
||||
(29311,0,1, 'They who dine on lost souls know only hunger.', 15, 0, 100, 0, 0, 14043, 'SAY_AGGRO_2'),
|
||||
(29311,1,0, 'Ywaq puul skshgn: on''ma yeh''glu zuq.', 14,0,100,0,0,14045, 'SAY_SLAY_1'),
|
||||
(29311,1,1, 'Ywaq ma phgwa''cul hnakf.',14,0,100,0,0,14046, 'SAY_SLAY_2'),
|
||||
(29311,1,2, 'Ywaq maq oou; ywaq maq ssaggh. Ywaq ma shg''fhn.',14,0,100,0,0,14047, 'SAY_SLAY_3'),
|
||||
(29311,2,0, 'Iilth vwah, uhn''agth fhssh za.', 14, 0, 100, 0, 0, 14048, 'SAY_DEATH_1'),
|
||||
(29311,2,1, 'Where one falls, many shall take its place.', 15, 0, 100, 0, 0, 14048, 'SAY_DEATH_2'),
|
||||
(29311,3,0, 'Gul''kafh an''shel. Yoq''al shn ky ywaq nuul.', 14, 0, 100, 0, 0, 14044, 'SAY_PHASE');
|
||||
@@ -0,0 +1,18 @@
|
||||
-- AzjolNerub/Ahnkahet/Jedoga Shadowseeker
|
||||
DELETE FROM `script_texts` WHERE `entry` BETWEEN -1619013 AND -1619000;
|
||||
DELETE FROM `creature_text` WHERE `entry`=29310;
|
||||
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
|
||||
(29310, 0, 0, 'These are sacred halls! Your intrusion will be met with death!', 14, 0, 100, 0, 0, 14343, 'SAY_AGGRO'),
|
||||
(29310, 1, 0, 'Who among you is devoted?', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_1_1'),
|
||||
(29310, 1, 1, 'You there! Step forward!', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_1_2'),
|
||||
(29310, 2, 0, 'Yogg-Saron, grant me your power!', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_2_1'),
|
||||
(29310, 2, 1, 'Master, a gift for you!', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_2_2'),
|
||||
(29310, 3, 0, 'Glory to Yogg-Saron!', 14, 0, 100, 0, 0, 0, 'SAY_SLAY_1'),
|
||||
(29310, 3, 1, 'You are unworthy!', 14, 0, 100, 0, 0, 0, 'SAY_SLAY_2'),
|
||||
(29310, 3, 2, 'Get up! You haven''t suffered enough.', 14, 0, 100, 0, 0, 14350, 'SAY_SLAY_3'),
|
||||
(29310, 4, 0, 'Do not expect your sacrilege... to go unpunished.', 14, 0, 100, 0, 0, 0, 'SAY_DEATH'),
|
||||
(29310, 5, 0, 'The elements themselves will rise up against the civilized world! Only the faithful will be spared!', 14, 0, 100, 0, 0, 14352, 'SAY_PREACHING_1'),
|
||||
(29310, 5, 1, 'Immortality can be yours, but only if you pledge yourself fully to Yogg-Saron!', 14, 0, 100, 0, 0, 14353, 'SAY_PREACHING_2'),
|
||||
(29310, 5, 2, 'Here, on the very borders of his domain, you will experience power you could have never imagined!', 14, 0, 100, 0, 0, 0, 'SAY_PREACHING_3'),
|
||||
(29310, 5, 3, 'You have traveled long and risked much to be here! Your devotion shall be rewarded.', 14, 0, 100, 0, 0, 0, 'SAY_PREACHING_4'),
|
||||
(29310, 5, 4, 'The faithful shall be exalted! But there is more work to be done. We will press on until all of Azeroth lies beneath his shadow!', 14, 0, 100, 0, 0, 0, 'SAY_PREACHING_5');
|
||||
@@ -0,0 +1,80 @@
|
||||
-- Addon data based on sniff fixed by Vincent-Michael
|
||||
DELETE FROM `creature_template_addon` WHERE `entry` IN (27692,27755,27756);
|
||||
INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
|
||||
(27692,0,0,0x3000000,0x1,0,'50296 50325'), -- Emerald Drake
|
||||
(27755,0,0,0x3000000,0x1,0,'50296 50325'), -- Amber Drake
|
||||
(27756,0,0,0x3000000,0x1,0,'50296 50248 50325'); -- Ruby Drake // Evasive aura should be here from the start
|
||||
-- Change InhabitType to prevent drakes falling on summon
|
||||
UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry` IN (27692,27755,27756);
|
||||
-- Change script name for gossip npcs and drakes and set npc_flag to 0, since only after Ist boss is dead, they should acquire gossip flag
|
||||
UPDATE `creature_template` SET `npcflag`=2,`ScriptName`='npc_verdisa_beglaristrasz_eternos' WHERE `entry` IN (27657,27658,27659);
|
||||
UPDATE `creature_template` SET `spell2`=50240,`spell3`=50253,`spell4`=0 WHERE `entry`=27756; -- Remove Evasive Aura and set Evasive Manouvres since it is an aura always applied, also set Martyr as 3rd
|
||||
UPDATE `creature_template` SET `spell6`=53389,`ScriptName`='npc_ruby_emerald_amber_drake' WHERE `entry` IN (27692,27755,27756); -- Add GPS spell for all drakes and script names for drakes
|
||||
-- Add spell_script name for Call Ruby/Emerald/Amber Drake spells
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` IN (49462,49345,49461);
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(49462,'spell_call_ruby_emerald_amber_drake'), -- Ruby
|
||||
(49345,'spell_call_ruby_emerald_amber_drake'), -- Emerald
|
||||
(49461,'spell_call_ruby_emerald_amber_drake'); -- Amber
|
||||
-- Remove wrong use of npc_spellclick_spell, the drake should auto do all on summon
|
||||
DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (27692,27755,27756);
|
||||
-- Add conditions
|
||||
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (49464,49346,49460,66667,49838);
|
||||
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry` IN (49840,49592,50328,50341,50232);
|
||||
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
|
||||
(13,1|4,49464,0,0,33,0,1,5,0,0,0,'','Ruby Drake Saddle control vehicle aura can hit only created unit'),
|
||||
(13,1|4,49346,0,0,33,0,1,5,0,0,0,'','Emerald Drake Saddle control vehicle aura can hit only created unit'),
|
||||
(13,1|4,49460,0,0,33,0,1,5,0,0,0,'','Amber Drake Saddle control vehicle aura can hit only created unit'),
|
||||
(13,1|2|4,66667,0,0,33,1,0,0,0,0,0,'','Gear scaling for Oculus drakes can only be casted on self'),
|
||||
(17,0,49840,0,1,31,1,3,28236,0,0,0,'','Shock Lance target can be Azure Ring Captain'),
|
||||
(17,0,49840,0,2,31,1,3,27638,0,0,0,'','Shock Lance target can be Azure Ring Guardian'),
|
||||
(17,0,49840,0,3,31,1,3,28276,0,0,0,'','Shock Lance target can be Greater Lay Whelp'),
|
||||
(17,0,49840,0,4,31,1,3,27656,0,0,0,'','Shock Lance target can be Eregos'),
|
||||
(13,1,49838,0,1,31,0,3,28236,0,0,0,'','Stop Time can hit Azure Ring Captain'),
|
||||
(13,1,49838,0,2,31,0,3,27638,0,0,0,'','Stop Time can hit Azure Ring Guardian'),
|
||||
(13,1,49838,0,3,31,0,3,28276,0,0,0,'','Stop Time can hit Greater Lay Whelp'),
|
||||
(13,1,49838,0,4,31,0,3,27656,0,0,0,'','Stop Time can hit Eregos'),
|
||||
(17,0,49592,0,1,31,1,3,28236,0,0,0,'','Temporal Rift target can be Azure Ring Captain'),
|
||||
(17,0,49592,0,2,31,1,3,27638,0,0,0,'','Temporal Rift target can be Azure Ring Guardian'),
|
||||
(17,0,49592,0,3,31,1,3,28276,0,0,0,'','Temporal Rift target can be Greater Lay Whelp'),
|
||||
(17,0,49592,0,4,31,1,3,27656,0,0,0,'','Temporal Rift target can be Eregos'),
|
||||
(17,0,50328,0,1,31,1,3,28236,0,0,0,'','Leeching Poison target can be Azure Ring Captain'),
|
||||
(17,0,50328,0,2,31,1,3,27638,0,0,0,'','Leeching Poison target can be Azure Ring Guardian'),
|
||||
(17,0,50328,0,3,31,1,3,28276,0,0,0,'','Leeching Poison target can be Greater Lay Whelp'),
|
||||
(17,0,50328,0,4,31,1,3,27656,0,0,0,'','Leeching Poison target can be Eregos'),
|
||||
(17,0,50341,0,1,31,1,3,28236,0,0,0,'','Touch the Nightmare target can be Azure Ring Captain'),
|
||||
(17,0,50341,0,2,31,1,3,27638,0,0,0,'','Touch the Nightmare target can be Azure Ring Guardian'),
|
||||
(17,0,50341,0,3,31,1,3,28276,0,0,0,'','Touch the Nightmare target can be Greater Lay Whelp'),
|
||||
(17,0,50341,0,4,31,1,3,27656,0,0,0,'','Touch the Nightmare target can be Eregos'),
|
||||
(17,0,50232,0,1,31,1,3,28236,0,0,0,'','Searing Wrath target can be Azure Ring Captain'),
|
||||
(17,0,50232,0,2,31,1,3,27638,0,0,0,'','Searing Wrath target can be Azure Ring Guardian'),
|
||||
(17,0,50232,0,3,31,1,3,28276,0,0,0,'','Searing Wrath target can be Greater Lay Whelp'),
|
||||
(17,0,50232,0,4,31,1,3,27656,0,0,0,'','Searing Wrath target can be Eregos');
|
||||
-- Add text for Belgaristrasz
|
||||
SET @Belgaristrasz := 27658;
|
||||
DELETE FROM `creature_text` WHERE `entry`=@Belgaristrasz;
|
||||
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
|
||||
(@Belgaristrasz,0,0,'Thank you for freeing us, mortals. Beware, the blue flight is alerted to your presence. Even now, Malygos sends Varos Cloudstrider and his ring guardians to defend the Oculus. You will need our help to stand a chance.',12,0,100,1,3500,0,'Belgaristrasz - On freed');
|
||||
-- Add text for Ruby, Amber and Emerald drakes
|
||||
SET @Ruby := 27756;
|
||||
SET @Emerald := 27692;
|
||||
SET @Amber := 27755;
|
||||
DELETE FROM `creature_text` WHERE `entry` IN (@Ruby,@Emerald,@Amber);
|
||||
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
|
||||
(@Ruby,0,0,'Ruby Drake flies away.',16,0,100,1,0,2858,'Ruby - On take off'),
|
||||
(@Ruby,1,0,'Welcome Friend. Keep your head down and hold on tight!',15,0,100,1,0,0,'Ruby - On welcome'),
|
||||
(@Ruby,2,0,'Use Searing Wrath to damage enemies and Evasive Maneuvers if I start taking damage. Remember I need to build up Evasive Charges by taking damage to perform Evasive Maneuvers!',15,0,100,1,0,0,'Ruby - On explaining abilities'),
|
||||
(@Ruby,3,0,'Now that I am at my full power I can perform Martyr. You can use it to protect other drakes, but I will take lots of damage, so make sure you''re using Evasive Maneuvers too!',15,0,100,1,0,0,'Ruby - On ultimate ability unlocked'),
|
||||
(@Ruby,4,0,'I''m badly injured! I can''t take much more of this!',15,0,100,1,0,0,'Ruby - On below 40%'),
|
||||
(@Emerald,0,0,'Emerald Drake flies away.',16,0,100,1,0,2858,'Emerald - On take off'),
|
||||
(@Emerald,1,0,'Welcome Friend. Keep your head down and hold on tight!',15,0,100,1,0,0,'Emerald - On welcome'),
|
||||
(@Emerald,2,0,'Use Leeching Poison to damage enemies and keep me healed. Touch the Nightmare is very powerful, but it hurts me, so only use it when I have a lot of health!',15,0,100,1,0,0,'Emerald - On explaining abilities'),
|
||||
(@Emerald,3,0,'Now that I am at my full power I can perform Dream Funnel. You can use it to heal other drakes, but it drains my health, so make sure you''re using Leeching Poison too!',15,0,100,1,0,0,'Emerald - On ultimate ability unlocked'),
|
||||
(@Emerald,4,0,'I''m badly injured! I can''t take much more of this!',15,0,100,1,0,0,'Emerald - On below 40%'),
|
||||
(@Amber,0,0,'Amber Drake flies away.',16,0,100,1,0,2858,'Amber - On take off'),
|
||||
(@Amber,1,0,'Welcome Friend. Keep your head down and hold on tight!',15,0,100,1,0,0,'Amber - On welcome'),
|
||||
(@Amber,2,0,'Use Shock Lance to damage enemies. If we get in trouble, Stop Time to freeze all enemies in place, then hit them with Shock Lance for massive damage!',15,0,100,1,0,0,'Amber - On explaining abilities'),
|
||||
(@Amber,3,0,'Now that I am at my full power I can perform Temporal Rift. You can use it to make enemies take extra damage and to get Shock Charges. Save up Shock Charges and then Shock Lance for huge damage!',15,0,100,1,0,0,'Amber - On ultimate ability unlocked'),
|
||||
(@Amber,4,0,'I''m badly injured! I can''t take much more of this!',15,0,100,1,0,0,'Amber - On below 40%');
|
||||
-- Fix Oculus phasing db side, all listed get changed only on specific isntance data
|
||||
UPDATE `creature` SET `phaseMask`=2 WHERE `id` IN (27447,27655,28276,27656);
|
||||
@@ -0,0 +1,5 @@
|
||||
-- Boss Anubarak Move Heroic Spell in spelldifficulty
|
||||
DELETE FROM `spelldifficulty_dbc` WHERE `id` IN (53472,53454);
|
||||
INSERT INTO `spelldifficulty_dbc`(`id`,`spellid0`,`spellid1`) VALUES
|
||||
(53472,53472,59433), -- Spell Pound
|
||||
(53454,53454,59446); -- Spell Impale Damage
|
||||
@@ -0,0 +1,11 @@
|
||||
DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000649 AND -1000641;
|
||||
INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES
|
||||
(4979,-1000641,'Hey, thanks.','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0, 'Theramore Guard - SAY_QUEST1'),
|
||||
(4979,-1000642,'...receive 50 percent off deserter undergarments? What is this garbage?','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST2'),
|
||||
(4979,-1000643,'...to establish a fund for the purchase of hair gel? I like my hair the way it is, thanks!','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST3'),
|
||||
(4979,-1000644,'...the deserters seek a Theramore where citizens will be free to juggle at all hours of the day? What is this nonsense?','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST4'),
|
||||
(4979,-1000645,'...to establish the chicken as the official symbol of Theramore?! These guys are nuts!','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST5'),
|
||||
(4979,-1000646,"...as a deserter, you'll enjoy activities like tethered swimming and dog grooming? How ridiculous!",'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST6'),
|
||||
(4979,-1000647,'This... this is a joke, right?','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST7'),
|
||||
(4979,-1000648,"I'd never join anything like this. Better keep this, though. It'll come in handy in the privy...",'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST8'),
|
||||
(4979,-1000649,'What a bunch of lunatics! You actually believe this stuff?','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST9');
|
||||
@@ -15,7 +15,13 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file main.cpp
|
||||
* @brief Authentication Server main program
|
||||
*
|
||||
* This file contains the main program for the
|
||||
* authentication server
|
||||
*/
|
||||
#include <ace/Dev_Poll_Reactor.h>
|
||||
#include <ace/TP_Reactor.h>
|
||||
#include <ace/ACE.h>
|
||||
@@ -44,7 +50,7 @@ bool stopEvent = false; // Setting it to tru
|
||||
|
||||
LoginDatabaseWorkerPool LoginDatabase; // Accessor to the auth server database
|
||||
|
||||
// Handle authserver's termination signals
|
||||
/// Handle authserver's termination signals
|
||||
class AuthServerSignalHandler : public Trinity::SignalHandler
|
||||
{
|
||||
public:
|
||||
@@ -68,7 +74,7 @@ void usage(const char *prog)
|
||||
prog);
|
||||
}
|
||||
|
||||
// Launch the auth server
|
||||
/// Launch the auth server
|
||||
extern int main(int argc, char **argv)
|
||||
{
|
||||
// Command line parsing to get the configuration file name
|
||||
@@ -232,7 +238,7 @@ extern int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Initialize connection to the database
|
||||
/// Initialize connection to the database
|
||||
bool StartDB()
|
||||
{
|
||||
MySQL::Library_Init();
|
||||
@@ -270,6 +276,7 @@ bool StartDB()
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Close the connection to the database
|
||||
void StopDB()
|
||||
{
|
||||
LoginDatabase.Close();
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
#define TRINITY_UNITAI_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <list>
|
||||
#include "Unit.h"
|
||||
#include "Containers.h"
|
||||
#include <list>
|
||||
|
||||
class Unit;
|
||||
class Player;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
@@ -274,10 +274,7 @@ std::string CalculateShaPassHash(std::string& name, std::string& password)
|
||||
sha.UpdateData(password);
|
||||
sha.Finalize();
|
||||
|
||||
std::string encoded;
|
||||
hexEncodeByteArray(sha.GetDigest(), sha.GetLength(), encoded);
|
||||
|
||||
return encoded;
|
||||
return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength());
|
||||
}
|
||||
|
||||
bool IsPlayerAccount(uint32 gmlevel)
|
||||
|
||||
@@ -376,7 +376,9 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
|
||||
Battleground* bg = source->GetBattleground();
|
||||
if (!bg)
|
||||
return false;
|
||||
return bg->IsTeamScoreInRange(source->GetTeam() == ALLIANCE ? HORDE : ALLIANCE, bg_loss_team_score.min_score, bg_loss_team_score.max_score);
|
||||
|
||||
uint32 score = bg->GetTeamScore(source->GetTeamId() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
return score >= bg_loss_team_score.min_score && score <= bg_loss_team_score.max_score;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT:
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
|
||||
if (MSV <= 0)
|
||||
return AH_MINIMUM_DEPOSIT;
|
||||
|
||||
float multiplier = CalculatePctN(float(entry->depositPercent), 3);
|
||||
float multiplier = CalculatePct(float(entry->depositPercent), 3);
|
||||
uint32 timeHr = (((time / 60) / 60) / 12);
|
||||
uint32 deposit = uint32(((multiplier * MSV * count / 3) * timeHr * 3) * sWorld->getRate(RATE_AUCTION_DEPOSIT));
|
||||
|
||||
@@ -635,14 +635,14 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
|
||||
|
||||
uint32 AuctionEntry::GetAuctionCut() const
|
||||
{
|
||||
int32 cut = int32(CalculatePctU(bid, auctionHouseEntry->cutPercent) * sWorld->getRate(RATE_AUCTION_CUT));
|
||||
int32 cut = int32(CalculatePct(bid, auctionHouseEntry->cutPercent) * sWorld->getRate(RATE_AUCTION_CUT));
|
||||
return std::max(cut, 0);
|
||||
}
|
||||
|
||||
/// the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
|
||||
uint32 AuctionEntry::GetAuctionOutBid() const
|
||||
{
|
||||
uint32 outbid = CalculatePctN(bid, 5);
|
||||
uint32 outbid = CalculatePct(bid, 5);
|
||||
return outbid ? outbid : 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,35 +162,34 @@ Battleground::Battleground()
|
||||
|
||||
m_MapId = 0;
|
||||
m_Map = NULL;
|
||||
m_StartMaxDist = 0.0f;
|
||||
|
||||
m_TeamStartLocX[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamStartLocX[BG_TEAM_HORDE] = 0;
|
||||
m_TeamStartLocX[TEAM_ALLIANCE] = 0;
|
||||
m_TeamStartLocX[TEAM_HORDE] = 0;
|
||||
|
||||
m_TeamStartLocY[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamStartLocY[BG_TEAM_HORDE] = 0;
|
||||
m_TeamStartLocY[TEAM_ALLIANCE] = 0;
|
||||
m_TeamStartLocY[TEAM_HORDE] = 0;
|
||||
|
||||
m_TeamStartLocZ[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamStartLocZ[BG_TEAM_HORDE] = 0;
|
||||
m_TeamStartLocZ[TEAM_ALLIANCE] = 0;
|
||||
m_TeamStartLocZ[TEAM_HORDE] = 0;
|
||||
|
||||
m_TeamStartLocO[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamStartLocO[BG_TEAM_HORDE] = 0;
|
||||
m_TeamStartLocO[TEAM_ALLIANCE] = 0;
|
||||
m_TeamStartLocO[TEAM_HORDE] = 0;
|
||||
|
||||
m_ArenaTeamIds[BG_TEAM_ALLIANCE] = 0;
|
||||
m_ArenaTeamIds[BG_TEAM_HORDE] = 0;
|
||||
m_ArenaTeamIds[TEAM_ALLIANCE] = 0;
|
||||
m_ArenaTeamIds[TEAM_HORDE] = 0;
|
||||
|
||||
m_StartMaxDist = 0.0f;
|
||||
m_ArenaTeamRatingChanges[TEAM_ALLIANCE] = 0;
|
||||
m_ArenaTeamRatingChanges[TEAM_HORDE] = 0;
|
||||
|
||||
m_ArenaTeamRatingChanges[BG_TEAM_ALLIANCE] = 0;
|
||||
m_ArenaTeamRatingChanges[BG_TEAM_HORDE] = 0;
|
||||
m_BgRaids[TEAM_ALLIANCE] = NULL;
|
||||
m_BgRaids[TEAM_HORDE] = NULL;
|
||||
|
||||
m_BgRaids[BG_TEAM_ALLIANCE] = NULL;
|
||||
m_BgRaids[BG_TEAM_HORDE] = NULL;
|
||||
m_PlayersCount[TEAM_ALLIANCE] = 0;
|
||||
m_PlayersCount[TEAM_HORDE] = 0;
|
||||
|
||||
m_PlayersCount[BG_TEAM_ALLIANCE] = 0;
|
||||
m_PlayersCount[BG_TEAM_HORDE] = 0;
|
||||
|
||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||
m_TeamScores[TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[TEAM_HORDE] = 0;
|
||||
|
||||
m_PrematureCountDown = false;
|
||||
|
||||
@@ -219,7 +218,7 @@ Battleground::~Battleground()
|
||||
for (uint32 i = 0; i < size; ++i)
|
||||
DelObject(i);
|
||||
|
||||
sBattlegroundMgr->RemoveBattleground(GetInstanceID(), GetTypeID());
|
||||
sBattlegroundMgr->RemoveBattleground(GetTypeID(), GetInstanceID());
|
||||
// unload map
|
||||
if (m_Map)
|
||||
{
|
||||
@@ -261,7 +260,10 @@ void Battleground::Update(uint32 diff)
|
||||
{
|
||||
case STATUS_WAIT_JOIN:
|
||||
if (GetPlayersSize())
|
||||
{
|
||||
_ProcessJoin(diff);
|
||||
_CheckSafePositions(diff);
|
||||
}
|
||||
break;
|
||||
case STATUS_IN_PROGRESS:
|
||||
_ProcessOfflineQueue();
|
||||
@@ -294,11 +296,37 @@ void Battleground::Update(uint32 diff)
|
||||
// Update start time and reset stats timer
|
||||
m_StartTime += diff;
|
||||
m_ResetStatTimer += diff;
|
||||
m_ValidStartPositionTimer += diff;
|
||||
|
||||
PostUpdateImpl(diff);
|
||||
}
|
||||
|
||||
inline void Battleground::_CheckSafePositions(uint32 diff)
|
||||
{
|
||||
float maxDist = GetStartMaxDist();
|
||||
if (!maxDist)
|
||||
return;
|
||||
|
||||
m_ValidStartPositionTimer += diff;
|
||||
if (m_ValidStartPositionTimer >= CHECK_PLAYER_POSITION_INVERVAL)
|
||||
{
|
||||
m_ValidStartPositionTimer = 0;
|
||||
|
||||
Position pos;
|
||||
float x, y, z, o;
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
|
||||
{
|
||||
player->GetPosition(&pos);
|
||||
GetTeamStartLoc(player->GetBGTeam(), x, y, z, o);
|
||||
if (pos.GetExactDistSq(x, y, z) > maxDist)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", player->GetName(), GetMapId());
|
||||
player->TeleportTo(GetMapId(), x, y, z, o);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void Battleground::_ProcessOfflineQueue()
|
||||
{
|
||||
// remove offline players from bg after 5 minutes
|
||||
@@ -315,7 +343,6 @@ inline void Battleground::_ProcessOfflineQueue()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline void Battleground::_ProcessRessurect(uint32 diff)
|
||||
@@ -530,33 +557,6 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
sWorld->SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel());
|
||||
}
|
||||
}
|
||||
|
||||
// Find if the player left our start zone; if so, teleport it back
|
||||
if (m_ValidStartPositionTimer > 1000)
|
||||
{
|
||||
m_ValidStartPositionTimer = 0;
|
||||
float maxDist = GetStartMaxDist();
|
||||
if (maxDist > 0.0f)
|
||||
{
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
{
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(itr->first))
|
||||
{
|
||||
float x, y, z, o;
|
||||
uint32 team = plr->GetBGTeam();
|
||||
GetTeamStartLoc(team, x, y, z, o);
|
||||
|
||||
float dist = plr->GetDistance(x, y, z);
|
||||
|
||||
if (dist >= maxDist)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", plr->GetName(), GetMapId());
|
||||
plr->TeleportTo(GetMapId(), x, y, z, o);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void Battleground::_ProcessLeave(uint32 diff)
|
||||
@@ -581,7 +581,7 @@ inline void Battleground::_ProcessLeave(uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
inline Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, const char* context) const
|
||||
inline Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, char const* context) const
|
||||
{
|
||||
Player* player = NULL;
|
||||
if (!offlineRemove)
|
||||
@@ -594,17 +594,17 @@ inline Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, const c
|
||||
return player;
|
||||
}
|
||||
|
||||
inline Player* Battleground::_GetPlayer(BattlegroundPlayerMap::iterator itr, const char* context)
|
||||
inline Player* Battleground::_GetPlayer(BattlegroundPlayerMap::iterator itr, char const* context)
|
||||
{
|
||||
return _GetPlayer(itr->first, itr->second.OfflineRemoveTime, context);
|
||||
}
|
||||
|
||||
inline Player* Battleground::_GetPlayer(BattlegroundPlayerMap::const_iterator itr, const char* context) const
|
||||
inline Player* Battleground::_GetPlayer(BattlegroundPlayerMap::const_iterator itr, char const* context) const
|
||||
{
|
||||
return _GetPlayer(itr->first, itr->second.OfflineRemoveTime, context);
|
||||
}
|
||||
|
||||
inline Player* Battleground::_GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char* context) const
|
||||
inline Player* Battleground::_GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, char const* context) const
|
||||
{
|
||||
Player* player = _GetPlayer(itr, context);
|
||||
if (player)
|
||||
@@ -620,7 +620,7 @@ inline Player* Battleground::_GetPlayerForTeam(uint32 teamId, BattlegroundPlayer
|
||||
|
||||
void Battleground::SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O)
|
||||
{
|
||||
BattlegroundTeamId idx = GetTeamIndexByTeamId(TeamID);
|
||||
TeamId idx = GetTeamIndexByTeamId(TeamID);
|
||||
m_TeamStartLocX[idx] = X;
|
||||
m_TeamStartLocY[idx] = Y;
|
||||
m_TeamStartLocZ[idx] = Z;
|
||||
@@ -674,7 +674,7 @@ void Battleground::RemoveAuraOnTeam(uint32 SpellID, uint32 TeamID)
|
||||
player->RemoveAura(SpellID);
|
||||
}
|
||||
|
||||
void Battleground::YellToAll(Creature* creature, const char* text, uint32 language)
|
||||
void Battleground::YellToAll(Creature* creature, char const* text, uint32 language)
|
||||
{
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player* player = _GetPlayer(itr, "YellToAll"))
|
||||
@@ -718,17 +718,18 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
{
|
||||
RemoveFromBGFreeSlotQueue();
|
||||
|
||||
ArenaTeam* winner_arena_team = NULL;
|
||||
ArenaTeam* loser_arena_team = NULL;
|
||||
uint32 loser_team_rating = 0;
|
||||
uint32 loser_matchmaker_rating = 0;
|
||||
int32 loser_change = 0;
|
||||
int32 loser_matchmaker_change = 0;
|
||||
uint32 winner_team_rating = 0;
|
||||
uint32 winner_matchmaker_rating = 0;
|
||||
int32 winner_change = 0;
|
||||
int32 winner_matchmaker_change = 0;
|
||||
WorldPacket data;
|
||||
ArenaTeam* winnerArenaTeam = NULL;
|
||||
ArenaTeam* loserArenaTeam = NULL;
|
||||
|
||||
uint32 loserTeamRating = 0;
|
||||
uint32 loserMatchmakerRating = 0;
|
||||
int32 loserChange = 0;
|
||||
int32 loserMatchmakerChange = 0;
|
||||
uint32 winnerTeamRating = 0;
|
||||
uint32 winnerMatchmakerRating = 0;
|
||||
int32 winnerChange = 0;
|
||||
int32 winnerMatchmakerChange = 0;
|
||||
|
||||
int32 winmsg_id = 0;
|
||||
|
||||
if (winner == ALLIANCE)
|
||||
@@ -759,25 +760,26 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
// arena rating calculation
|
||||
if (isArena() && isRated())
|
||||
{
|
||||
winner_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner));
|
||||
loser_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));
|
||||
if (winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
|
||||
winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner));
|
||||
loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));
|
||||
|
||||
if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
|
||||
{
|
||||
if (winner != WINNER_NONE)
|
||||
{
|
||||
loser_team_rating = loser_arena_team->GetRating();
|
||||
loser_matchmaker_rating = GetArenaMatchmakerRating(GetOtherTeam(winner));
|
||||
winner_team_rating = winner_arena_team->GetRating();
|
||||
winner_matchmaker_rating = GetArenaMatchmakerRating(winner);
|
||||
winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change);
|
||||
loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change);
|
||||
sLog->outDebug(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating,
|
||||
winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change);
|
||||
SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change);
|
||||
SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change);
|
||||
SetArenaTeamRatingChangeForTeam(winner, winner_change);
|
||||
SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change);
|
||||
sLog->outDebug(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
|
||||
loserTeamRating = loserArenaTeam->GetRating();
|
||||
loserMatchmakerRating = GetArenaMatchmakerRating(GetOtherTeam(winner));
|
||||
winnerTeamRating = winnerArenaTeam->GetRating();
|
||||
winnerMatchmakerRating = GetArenaMatchmakerRating(winner);
|
||||
winnerMatchmakerChange = winnerArenaTeam->WonAgainst(winnerMatchmakerRating, loserMatchmakerRating, winnerChange);
|
||||
loserMatchmakerChange = loserArenaTeam->LostAgainst(loserMatchmakerRating, winnerMatchmakerRating, loserChange);
|
||||
sLog->outDebug(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winnerTeamRating, winnerChange, winnerMatchmakerRating,
|
||||
winnerMatchmakerChange, loserTeamRating, loserChange, loserMatchmakerRating, loserMatchmakerChange);
|
||||
SetArenaMatchmakerRating(winner, winnerMatchmakerRating + winnerMatchmakerChange);
|
||||
SetArenaMatchmakerRating(GetOtherTeam(winner), loserMatchmakerRating + loserMatchmakerChange);
|
||||
SetArenaTeamRatingChangeForTeam(winner, winnerChange);
|
||||
SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loserChange);
|
||||
sLog->outDebug(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE], winnerArenaTeam->GetId(), winnerChange, loserChange);
|
||||
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
|
||||
for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
|
||||
@@ -788,8 +790,8 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
{
|
||||
SetArenaTeamRatingChangeForTeam(ALLIANCE, ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
SetArenaTeamRatingChangeForTeam(HORDE, ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
winner_arena_team->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
loser_arena_team->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
winnerArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -799,6 +801,11 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
}
|
||||
}
|
||||
|
||||
WorldPacket pvpLogData;
|
||||
sBattlegroundMgr->BuildPvpLogDataPacket(&pvpLogData, this);
|
||||
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
|
||||
uint8 aliveWinners = GetAlivePlayersCountByTeam(winner);
|
||||
for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
@@ -807,12 +814,12 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
{
|
||||
//if rated arena match - make member lost!
|
||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
|
||||
if (isArena() && isRated() && winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
|
||||
{
|
||||
if (team == winner)
|
||||
winner_arena_team->OfflineMemberLost(itr->first, loser_matchmaker_rating, winner_matchmaker_change);
|
||||
winnerArenaTeam->OfflineMemberLost(itr->first, loserMatchmakerRating, winnerMatchmakerChange);
|
||||
else
|
||||
loser_arena_team->OfflineMemberLost(itr->first, winner_matchmaker_rating, loser_matchmaker_change);
|
||||
loserArenaTeam->OfflineMemberLost(itr->first, winnerMatchmakerRating, loserMatchmakerChange);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -841,23 +848,20 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
player->getHostileRefManager().deleteReferences();
|
||||
}
|
||||
|
||||
//this line is obsolete - team is set ALWAYS
|
||||
//if (!team) team = player->GetTeam();
|
||||
|
||||
// per player calculation
|
||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
|
||||
if (isArena() && isRated() && winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
|
||||
{
|
||||
if (team == winner)
|
||||
{
|
||||
// update achievement BEFORE personal rating update
|
||||
uint32 rating = player->GetArenaPersonalRating(winner_arena_team->GetSlot());
|
||||
uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
|
||||
|
||||
winner_arena_team->MemberWon(player, loser_matchmaker_rating, winner_matchmaker_change);
|
||||
winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
loser_arena_team->MemberLost(player, winner_matchmaker_rating, loser_matchmaker_change);
|
||||
loserArenaTeam->MemberLost(player, winnerMatchmakerRating, loserMatchmakerChange);
|
||||
|
||||
// Arena lost => reset the win_rated_arena having the "no_lose" condition
|
||||
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE);
|
||||
@@ -893,27 +897,23 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
|
||||
BlockMovement(player);
|
||||
|
||||
sBattlegroundMgr->BuildPvpLogDataPacket(&data, this);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->GetSession()->SendPacket(&pvpLogData);
|
||||
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType());
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
|
||||
}
|
||||
|
||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
|
||||
if (isArena() && isRated() && winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
|
||||
{
|
||||
// update arena points only after increasing the player's match count!
|
||||
//obsolete: winner_arena_team->UpdateArenaPointsHelper();
|
||||
//obsolete: loser_arena_team->UpdateArenaPointsHelper();
|
||||
// save the stat changes
|
||||
winner_arena_team->SaveToDB();
|
||||
loser_arena_team->SaveToDB();
|
||||
winnerArenaTeam->SaveToDB();
|
||||
loserArenaTeam->SaveToDB();
|
||||
// send updated arena team stats to players
|
||||
// this way all arena team members will get notified, not only the ones who participated in this match
|
||||
winner_arena_team->NotifyStatsChanged();
|
||||
loser_arena_team->NotifyStatsChanged();
|
||||
winnerArenaTeam->NotifyStatsChanged();
|
||||
loserArenaTeam->NotifyStatsChanged();
|
||||
}
|
||||
|
||||
if (winmsg_id)
|
||||
@@ -923,7 +923,7 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const
|
||||
{
|
||||
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
|
||||
uint32 maxLevel = std::min(GetMaxLevel(), 80U);
|
||||
uint32 maxLevel = std::min<uint32>(GetMaxLevel(), 80U);
|
||||
return Trinity::Honor::hk_honor_at_level(maxLevel, float(kills));
|
||||
}
|
||||
|
||||
@@ -994,10 +994,10 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
//left a rated match while the encounter was in progress, consider as loser
|
||||
ArenaTeam* winner_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam* loser_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if (winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
|
||||
loser_arena_team->MemberLost(player, GetArenaMatchmakerRating(GetOtherTeam(team)));
|
||||
ArenaTeam* winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam* loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
|
||||
loserArenaTeam->MemberLost(player, GetArenaMatchmakerRating(GetOtherTeam(team)));
|
||||
}
|
||||
}
|
||||
if (SendPacket)
|
||||
@@ -1101,9 +1101,10 @@ void Battleground::StartBattleground()
|
||||
// add bg to update list
|
||||
// This must be done here, because we need to have already invited some players when first BG::Update() method is executed
|
||||
// and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes
|
||||
sBattlegroundMgr->AddBattleground(GetInstanceID(), GetTypeID(), this);
|
||||
sBattlegroundMgr->AddBattleground(this);
|
||||
|
||||
if (m_IsRated)
|
||||
sLog->outDebug(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
|
||||
sLog->outDebug(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE]);
|
||||
}
|
||||
|
||||
void Battleground::AddPlayer(Player* player)
|
||||
@@ -1166,6 +1167,7 @@ void Battleground::AddPlayer(Player* player)
|
||||
player->CastSpell(player, SPELL_ARENA_PREPARATION, true);
|
||||
player->ResetAllPowers();
|
||||
}
|
||||
|
||||
WorldPacket teammate;
|
||||
teammate.Initialize(SMSG_ARENA_OPPONENT_UPDATE, 8);
|
||||
teammate << uint64(player->GetGUID());
|
||||
@@ -1269,27 +1271,20 @@ void Battleground::EventPlayerLoggedOut(Player* player)
|
||||
// This method should be called only once ... it adds pointer to queue
|
||||
void Battleground::AddToBGFreeSlotQueue()
|
||||
{
|
||||
// make sure to add only once
|
||||
if (!m_InBGFreeSlotQueue && isBattleground())
|
||||
{
|
||||
sBattlegroundMgr->BGFreeSlotQueue[m_TypeID].push_front(this);
|
||||
sBattlegroundMgr->AddToBGFreeSlotQueue(m_TypeID, this);
|
||||
m_InBGFreeSlotQueue = true;
|
||||
}
|
||||
}
|
||||
|
||||
// This method removes this battleground from free queue - it must be called when deleting battleground - not used now
|
||||
// This method removes this battleground from free queue - it must be called when deleting battleground
|
||||
void Battleground::RemoveFromBGFreeSlotQueue()
|
||||
{
|
||||
// set to be able to re-add if needed
|
||||
m_InBGFreeSlotQueue = false;
|
||||
// uncomment this code when battlegrounds will work like instances
|
||||
for (BGFreeSlotQueueType::iterator itr = sBattlegroundMgr->BGFreeSlotQueue[m_TypeID].begin(); itr != sBattlegroundMgr->BGFreeSlotQueue[m_TypeID].end(); ++itr)
|
||||
if (m_InBGFreeSlotQueue)
|
||||
{
|
||||
if ((*itr)->GetInstanceID() == m_InstanceID)
|
||||
{
|
||||
sBattlegroundMgr->BGFreeSlotQueue[m_TypeID].erase(itr);
|
||||
return;
|
||||
}
|
||||
sBattlegroundMgr->RemoveFromBGFreeSlotQueue(m_TypeID, m_InstanceID);
|
||||
m_InBGFreeSlotQueue = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1682,7 +1677,7 @@ void Battleground::SendWarningToAll(int32 entry, ...)
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
const char *format = sObjectMgr->GetTrinityStringForDBCLocale(entry);
|
||||
char const *format = sObjectMgr->GetTrinityStringForDBCLocale(entry);
|
||||
|
||||
char str[1024];
|
||||
va_list ap;
|
||||
@@ -1724,7 +1719,7 @@ void Battleground::EndNow()
|
||||
}
|
||||
|
||||
// To be removed
|
||||
const char* Battleground::GetTrinityString(int32 entry)
|
||||
char const* Battleground::GetTrinityString(int32 entry)
|
||||
{
|
||||
// FIXME: now we have different DBC locales and need localized message for each target client
|
||||
return sObjectMgr->GetTrinityStringForDBCLocale(entry);
|
||||
@@ -1899,7 +1894,7 @@ void Battleground::UpdateArenaWorldState()
|
||||
|
||||
void Battleground::SetBgRaid(uint32 TeamID, Group* bg_raid)
|
||||
{
|
||||
Group*& old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE];
|
||||
Group*& old_raid = TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE];
|
||||
if (old_raid)
|
||||
old_raid->SetBattlegroundGroup(NULL);
|
||||
if (bg_raid)
|
||||
@@ -1912,13 +1907,6 @@ WorldSafeLocsEntry const* Battleground::GetClosestGraveYard(Player* player)
|
||||
return sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam());
|
||||
}
|
||||
|
||||
bool Battleground::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const
|
||||
{
|
||||
BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(team);
|
||||
uint32 score = std::max(m_TeamScores[teamIndex], 0);
|
||||
return score >= minScore && score <= maxScore;
|
||||
}
|
||||
|
||||
void Battleground::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
|
||||
{
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
@@ -1938,6 +1926,15 @@ void Battleground::RewardXPAtKill(Player* killer, Player* victim)
|
||||
killer->RewardPlayerAndGroupAtKill(victim, true);
|
||||
}
|
||||
|
||||
uint32 Battleground::GetTeamScore(uint32 teamId) const
|
||||
{
|
||||
if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE)
|
||||
return m_TeamScores[teamId];
|
||||
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "GetTeamScore with wrong Team %u for BG %u", teamId, GetTypeID());
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Battleground::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Unhandled AreaTrigger %u in Battleground %u. Player coords (x: %f, y: %f, z: %f)",
|
||||
|
||||
@@ -104,6 +104,7 @@ enum BattlegroundSpells
|
||||
|
||||
enum BattlegroundTimeIntervals
|
||||
{
|
||||
CHECK_PLAYER_POSITION_INVERVAL = 1000, // ms
|
||||
RESURRECTION_INTERVAL = 30000, // ms
|
||||
//REMIND_INTERVAL = 10000, // ms
|
||||
INVITATION_REMIND_TIME = 20000, // ms
|
||||
@@ -232,11 +233,6 @@ enum BattlegroundWinner
|
||||
WINNER_NONE = 2
|
||||
};
|
||||
|
||||
enum BattlegroundTeamId
|
||||
{
|
||||
BG_TEAM_ALLIANCE = 0,
|
||||
BG_TEAM_HORDE = 1
|
||||
};
|
||||
#define BG_TEAMS_COUNT 2
|
||||
|
||||
enum BattlegroundStartingEvents
|
||||
@@ -278,20 +274,20 @@ enum GroupJoinBattlegroundResult
|
||||
ERR_IN_NON_RANDOM_BG = -15 // Can't queue for Random Battleground while in another Battleground queue.
|
||||
};
|
||||
|
||||
class BattlegroundScore
|
||||
struct BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0),
|
||||
BonusHonor(0), DamageDone(0), HealingDone(0)
|
||||
{}
|
||||
virtual ~BattlegroundScore() {} //virtual destructor is used when deleting score from scores map
|
||||
BattlegroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0),
|
||||
DamageDone(0), HealingDone(0)
|
||||
{ }
|
||||
|
||||
uint32 KillingBlows;
|
||||
uint32 Deaths;
|
||||
uint32 HonorableKills;
|
||||
uint32 BonusHonor;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
virtual ~BattlegroundScore() { } //virtual destructor is used when deleting score from scores map
|
||||
|
||||
uint32 KillingBlows;
|
||||
uint32 Deaths;
|
||||
uint32 HonorableKills;
|
||||
uint32 BonusHonor;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
};
|
||||
|
||||
enum BGHonorMode
|
||||
@@ -324,17 +320,14 @@ class Battleground
|
||||
return true;
|
||||
}
|
||||
virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass
|
||||
virtual void StartingEventCloseDoors() {}
|
||||
virtual void StartingEventOpenDoors() {}
|
||||
virtual void ResetBGSubclass() // must be implemented in BG subclass
|
||||
{
|
||||
}
|
||||
virtual void StartingEventCloseDoors() { }
|
||||
virtual void StartingEventOpenDoors() { }
|
||||
virtual void ResetBGSubclass() { } // must be implemented in BG subclass
|
||||
|
||||
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) {}
|
||||
|
||||
/* achievement req. */
|
||||
virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; }
|
||||
bool IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const;
|
||||
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
|
||||
|
||||
/* Battleground */
|
||||
@@ -437,12 +430,13 @@ class Battleground
|
||||
void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O);
|
||||
void GetTeamStartLoc(uint32 TeamID, float &X, float &Y, float &Z, float &O) const
|
||||
{
|
||||
BattlegroundTeamId idx = GetTeamIndexByTeamId(TeamID);
|
||||
TeamId idx = GetTeamIndexByTeamId(TeamID);
|
||||
X = m_TeamStartLocX[idx];
|
||||
Y = m_TeamStartLocY[idx];
|
||||
Z = m_TeamStartLocZ[idx];
|
||||
O = m_TeamStartLocO[idx];
|
||||
}
|
||||
|
||||
void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
|
||||
float GetStartMaxDist() const { return m_StartMaxDist; }
|
||||
|
||||
@@ -475,12 +469,12 @@ class Battleground
|
||||
void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0);
|
||||
|
||||
// Raid Group
|
||||
Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; }
|
||||
Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; }
|
||||
void SetBgRaid(uint32 TeamID, Group* bg_raid);
|
||||
|
||||
virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
static BattlegroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; }
|
||||
static TeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
|
||||
uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; }
|
||||
uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
|
||||
void UpdatePlayersCountByTeam(uint32 Team, bool remove)
|
||||
@@ -566,13 +560,12 @@ class Battleground
|
||||
bool ToBeDeleted() const { return m_SetDeleteThis; }
|
||||
void SetDeleteThis() { m_SetDeleteThis = true; }
|
||||
|
||||
// virtual score-array - get's used in bg-subclasses
|
||||
int32 m_TeamScores[BG_TEAMS_COUNT];
|
||||
|
||||
void RewardXPAtKill(Player* killer, Player* victim);
|
||||
bool CanAwardArenaPoints() const { return m_LevelMin >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; }
|
||||
|
||||
virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; }
|
||||
virtual void SetDroppedFlagGUID(uint64 /*guid*/, int32 /*team*/ = -1) {}
|
||||
uint32 GetTeamScore(uint32 TeamID) const;
|
||||
|
||||
protected:
|
||||
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
|
||||
@@ -589,6 +582,7 @@ class Battleground
|
||||
void _ProcessProgress(uint32 diff);
|
||||
void _ProcessLeave(uint32 diff);
|
||||
void _ProcessJoin(uint32 diff);
|
||||
void _CheckSafePositions(uint32 diff);
|
||||
|
||||
// Scorekeeping
|
||||
BattlegroundScoreMap PlayerScores; // Player scores
|
||||
@@ -610,6 +604,8 @@ class Battleground
|
||||
bool m_IsRandom;
|
||||
|
||||
BGHonorMode m_HonorMode;
|
||||
int32 m_TeamScores[BG_TEAMS_COUNT];
|
||||
|
||||
private:
|
||||
// Battleground
|
||||
BattlegroundTypeId m_TypeID;
|
||||
@@ -649,7 +645,7 @@ class Battleground
|
||||
*
|
||||
* @see Update(), PostUpdateImpl().
|
||||
*/
|
||||
virtual bool PreUpdateImpl(uint32 /* diff */) { return true; };
|
||||
virtual bool PreUpdateImpl(uint32 /* diff */) { return true; }
|
||||
|
||||
/**
|
||||
* @brief Post-update hook.
|
||||
@@ -662,7 +658,7 @@ class Battleground
|
||||
*
|
||||
* @see Update(), PreUpdateImpl().
|
||||
*/
|
||||
virtual void PostUpdateImpl(uint32 /* diff */) { };
|
||||
virtual void PostUpdateImpl(uint32 /* diff */) { }
|
||||
|
||||
// Player lists
|
||||
std::vector<uint64> m_ResurrectQueue; // Player GUID
|
||||
@@ -705,4 +701,3 @@ class Battleground
|
||||
uint32 ScriptId;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -30,13 +30,11 @@
|
||||
#include "BattlegroundWS.h"
|
||||
#include "BattlegroundNA.h"
|
||||
#include "BattlegroundBE.h"
|
||||
#include "BattlegroundAA.h"
|
||||
#include "BattlegroundRL.h"
|
||||
#include "BattlegroundSA.h"
|
||||
#include "BattlegroundDS.h"
|
||||
#include "BattlegroundRV.h"
|
||||
#include "BattlegroundIC.h"
|
||||
#include "BattlegroundRB.h"
|
||||
#include "Chat.h"
|
||||
#include "Map.h"
|
||||
#include "MapInstanced.h"
|
||||
@@ -51,13 +49,10 @@
|
||||
/*** BATTLEGROUND MANAGER ***/
|
||||
/*********************************************************/
|
||||
|
||||
BattlegroundMgr::BattlegroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
|
||||
{
|
||||
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
m_Battlegrounds[i].clear();
|
||||
m_NextRatedArenaUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER);
|
||||
m_Testing=false;
|
||||
}
|
||||
BattlegroundMgr::BattlegroundMgr() :
|
||||
m_NextRatedArenaUpdate(sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER)),
|
||||
m_AutoDistributionTimeChecker(0), m_ArenaTesting(false), m_Testing(false)
|
||||
{ }
|
||||
|
||||
BattlegroundMgr::~BattlegroundMgr()
|
||||
{
|
||||
@@ -66,50 +61,42 @@ BattlegroundMgr::~BattlegroundMgr()
|
||||
|
||||
void BattlegroundMgr::DeleteAllBattlegrounds()
|
||||
{
|
||||
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
|
||||
for (BattlegroundDataContainer::iterator itr1 = bgDataStore.begin(); itr1 != bgDataStore.end(); ++itr1)
|
||||
{
|
||||
for (BattlegroundSet::iterator itr = m_Battlegrounds[i].begin(); itr != m_Battlegrounds[i].end();)
|
||||
{
|
||||
Battleground* bg = itr->second;
|
||||
m_Battlegrounds[i].erase(itr++);
|
||||
if (!m_ClientBattlegroundIds[i][bg->GetBracketId()].empty())
|
||||
m_ClientBattlegroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID());
|
||||
delete bg;
|
||||
}
|
||||
BattlegroundData& data = itr1->second;
|
||||
|
||||
while (!data.m_Battlegrounds.empty())
|
||||
delete data.m_Battlegrounds.begin()->second;
|
||||
data.m_Battlegrounds.clear();
|
||||
|
||||
while (!data.BGFreeSlotQueue.empty())
|
||||
delete data.BGFreeSlotQueue.front();
|
||||
}
|
||||
|
||||
// destroy template battlegrounds that listed only in queues (other already terminated)
|
||||
for (uint32 bgTypeId = 0; bgTypeId < MAX_BATTLEGROUND_TYPE_ID; ++bgTypeId)
|
||||
{
|
||||
// ~Battleground call unregistring BG from queue
|
||||
while (!BGFreeSlotQueue[bgTypeId].empty())
|
||||
delete BGFreeSlotQueue[bgTypeId].front();
|
||||
}
|
||||
bgDataStore.clear();
|
||||
}
|
||||
|
||||
// used to update running battlegrounds, and delete finished ones
|
||||
void BattlegroundMgr::Update(uint32 diff)
|
||||
{
|
||||
BattlegroundSet::iterator itr, next;
|
||||
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
|
||||
for (BattlegroundDataContainer::iterator itr1 = bgDataStore.begin(); itr1 != bgDataStore.end(); ++itr1)
|
||||
{
|
||||
itr = m_Battlegrounds[i].begin();
|
||||
// skip updating battleground template
|
||||
if (itr != m_Battlegrounds[i].end())
|
||||
++itr;
|
||||
for (; itr != m_Battlegrounds[i].end(); itr = next)
|
||||
BattlegroundContainer& bgs = itr1->second.m_Battlegrounds;
|
||||
BattlegroundContainer::iterator itrDelete = bgs.begin();
|
||||
// first one is template and should not be deleted
|
||||
for (BattlegroundContainer::iterator itr = ++itrDelete; itr != bgs.end();)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
itr->second->Update(diff);
|
||||
// use the SetDeleteThis variable
|
||||
// direct deletion caused crashes
|
||||
if (itr->second->ToBeDeleted())
|
||||
itrDelete = itr++;
|
||||
Battleground* bg = itrDelete->second;
|
||||
|
||||
bg->Update(diff);
|
||||
if (bg->ToBeDeleted())
|
||||
{
|
||||
Battleground* bg = itr->second;
|
||||
m_Battlegrounds[i].erase(itr);
|
||||
if (!m_ClientBattlegroundIds[i][bg->GetBracketId()].empty())
|
||||
m_ClientBattlegroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID());
|
||||
itrDelete->second = NULL;
|
||||
bgs.erase(itrDelete);
|
||||
BattlegroundClientIdsContainer& clients = itr1->second.m_ClientBattlegroundIds[bg->GetBracketId()];
|
||||
if (!clients.empty())
|
||||
clients.erase(bg->GetClientInstanceID());
|
||||
|
||||
delete bg;
|
||||
}
|
||||
@@ -124,12 +111,7 @@ void BattlegroundMgr::Update(uint32 diff)
|
||||
if (!m_QueueUpdateScheduler.empty())
|
||||
{
|
||||
std::vector<uint64> scheduled;
|
||||
{
|
||||
//copy vector and clear the other
|
||||
scheduled = std::vector<uint64>(m_QueueUpdateScheduler);
|
||||
m_QueueUpdateScheduler.clear();
|
||||
//release lock
|
||||
}
|
||||
std::swap(scheduled, m_QueueUpdateScheduler);
|
||||
|
||||
for (uint8 i = 0; i < scheduled.size(); i++)
|
||||
{
|
||||
@@ -161,6 +143,7 @@ void BattlegroundMgr::Update(uint32 diff)
|
||||
else
|
||||
m_NextRatedArenaUpdate -= diff;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
if (m_AutoDistributionTimeChecker < diff)
|
||||
@@ -234,13 +217,13 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
|
||||
void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
||||
{
|
||||
uint8 type = (bg->isArena() ? 1 : 0);
|
||||
// last check on 3.0.3
|
||||
|
||||
data->Initialize(MSG_PVP_LOG_DATA, (1+1+4+40*bg->GetPlayerScoresSize()));
|
||||
*data << uint8(type); // type (battleground=0/arena=1)
|
||||
|
||||
if (type) // arena
|
||||
if (type) // arena
|
||||
{
|
||||
// it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H
|
||||
// it seems this must be according to BG_WINNER_A/H and _NOT_ TEAM_A/H
|
||||
for (int8 i = 1; i >= 0; --i)
|
||||
{
|
||||
int32 rating_change = bg->GetArenaTeamRatingChangeByIndex(i);
|
||||
@@ -303,7 +286,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
||||
}
|
||||
*data << uint32(itr2->second->DamageDone); // damage done
|
||||
*data << uint32(itr2->second->HealingDone); // healing done
|
||||
switch (bg->GetTypeID(true)) // battleground specific things
|
||||
switch (bg->GetTypeID(true)) // battleground specific things
|
||||
{
|
||||
case BATTLEGROUND_RB:
|
||||
switch (bg->GetMapId())
|
||||
@@ -358,7 +341,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
||||
break;
|
||||
case BATTLEGROUND_AB:
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases asssulted
|
||||
*data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases assaulted
|
||||
*data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended
|
||||
break;
|
||||
case BATTLEGROUND_EY:
|
||||
@@ -370,17 +353,17 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
||||
*data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed);
|
||||
*data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed);
|
||||
break;
|
||||
case BATTLEGROUND_IC: // wotlk
|
||||
case BATTLEGROUND_IC:
|
||||
*data << uint32(0x00000002); // count of next fields
|
||||
*data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases asssulted
|
||||
*data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases assaulted
|
||||
*data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended
|
||||
break;
|
||||
case BATTLEGROUND_NA:
|
||||
case BATTLEGROUND_BE:
|
||||
case BATTLEGROUND_AA:
|
||||
case BATTLEGROUND_RL:
|
||||
case BATTLEGROUND_DS: // wotlk
|
||||
case BATTLEGROUND_RV: // wotlk
|
||||
case BATTLEGROUND_DS:
|
||||
case BATTLEGROUND_RV:
|
||||
*data << uint32(0);
|
||||
break;
|
||||
default:
|
||||
@@ -443,38 +426,59 @@ Battleground* BattlegroundMgr::GetBattlegroundThroughClientInstance(uint32 insta
|
||||
if (bg->isArena())
|
||||
return GetBattleground(instanceId, bgTypeId);
|
||||
|
||||
for (BattlegroundSet::iterator itr = m_Battlegrounds[bgTypeId].begin(); itr != m_Battlegrounds[bgTypeId].end(); ++itr)
|
||||
BattlegroundDataContainer::const_iterator it = bgDataStore.find(bgTypeId);
|
||||
if (it == bgDataStore.end())
|
||||
return NULL;
|
||||
|
||||
for (BattlegroundContainer::const_iterator itr = it->second.m_Battlegrounds.begin(); itr != it->second.m_Battlegrounds.end(); ++itr)
|
||||
{
|
||||
if (itr->second->GetClientInstanceID() == instanceId)
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Battleground* BattlegroundMgr::GetBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId)
|
||||
Battleground* BattlegroundMgr::GetBattleground(uint32 instanceId, BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
if (!InstanceID)
|
||||
if (!instanceId)
|
||||
return NULL;
|
||||
//search if needed
|
||||
BattlegroundSet::iterator itr;
|
||||
|
||||
BattlegroundDataContainer::const_iterator begin, end;
|
||||
|
||||
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
|
||||
{
|
||||
for (uint32 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; i++)
|
||||
{
|
||||
itr = m_Battlegrounds[i].find(InstanceID);
|
||||
if (itr != m_Battlegrounds[i].end())
|
||||
return itr->second;
|
||||
}
|
||||
return NULL;
|
||||
begin = bgDataStore.begin();
|
||||
end = bgDataStore.end();
|
||||
}
|
||||
itr = m_Battlegrounds[bgTypeId].find(InstanceID);
|
||||
return ((itr != m_Battlegrounds[bgTypeId].end()) ? itr->second : NULL);
|
||||
else
|
||||
{
|
||||
end = bgDataStore.find(bgTypeId);
|
||||
if (end == bgDataStore.end())
|
||||
return NULL;
|
||||
begin = end++;
|
||||
}
|
||||
|
||||
for (BattlegroundDataContainer::const_iterator it = begin; it != end; ++it)
|
||||
{
|
||||
BattlegroundContainer const& bgs = it->second.m_Battlegrounds;
|
||||
BattlegroundContainer::const_iterator itr = bgs.find(instanceId);
|
||||
if (itr != bgs.end())
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Battleground* BattlegroundMgr::GetBattlegroundTemplate(BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
BattlegroundDataContainer::const_iterator itr = bgDataStore.find(bgTypeId);
|
||||
if (itr == bgDataStore.end())
|
||||
return NULL;
|
||||
|
||||
BattlegroundContainer const& bgs = itr->second.m_Battlegrounds;
|
||||
//map is sorted and we can be sure that lowest instance id has only BG template
|
||||
return m_Battlegrounds[bgTypeId].empty() ? NULL : m_Battlegrounds[bgTypeId].begin()->second;
|
||||
return bgs.empty() ? NULL : bgs.begin()->second;
|
||||
}
|
||||
|
||||
uint32 BattlegroundMgr::CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id)
|
||||
@@ -488,72 +492,45 @@ uint32 BattlegroundMgr::CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeI
|
||||
// the instance-id just needs to be as low as possible, beginning with 1
|
||||
// the following works, because std::set is default ordered with "<"
|
||||
// the optimalization would be to use as bitmask std::vector<uint32> - but that would only make code unreadable
|
||||
|
||||
BattlegroundClientIdsContainer& clientIds = bgDataStore[bgTypeId].m_ClientBattlegroundIds[bracket_id];
|
||||
uint32 lastId = 0;
|
||||
for (std::set<uint32>::iterator itr = m_ClientBattlegroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattlegroundIds[bgTypeId][bracket_id].end();)
|
||||
for (BattlegroundClientIdsContainer::const_iterator itr = clientIds.begin(); itr != clientIds.end();)
|
||||
{
|
||||
if ((++lastId) != *itr) //if there is a gap between the ids, we will break..
|
||||
break;
|
||||
lastId = *itr;
|
||||
}
|
||||
m_ClientBattlegroundIds[bgTypeId][bracket_id].insert(lastId + 1);
|
||||
return lastId + 1;
|
||||
|
||||
clientIds.insert(++lastId);
|
||||
return lastId;
|
||||
}
|
||||
|
||||
// create a new battleground that will really be used to play
|
||||
Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated)
|
||||
Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId originalBgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated)
|
||||
{
|
||||
BattlegroundTypeId bgTypeId = originalBgTypeId;
|
||||
bool isRandom = false;
|
||||
|
||||
switch (originalBgTypeId)
|
||||
{
|
||||
case BATTLEGROUND_RB:
|
||||
isRandom = true;
|
||||
case BATTLEGROUND_AA:
|
||||
bgTypeId = GetRandomBG(originalBgTypeId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// get the template BG
|
||||
Battleground* bg_template = GetBattlegroundTemplate(bgTypeId);
|
||||
BattlegroundSelectionWeightMap* selectionWeights = NULL;
|
||||
|
||||
if (!bg_template)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
|
||||
return NULL;
|
||||
}
|
||||
bool isRandom = false;
|
||||
|
||||
if (bg_template->isArena())
|
||||
selectionWeights = &m_ArenaSelectionWeights;
|
||||
else if (bgTypeId == BATTLEGROUND_RB)
|
||||
{
|
||||
selectionWeights = &m_BGSelectionWeights;
|
||||
isRandom = true;
|
||||
}
|
||||
|
||||
if (selectionWeights)
|
||||
{
|
||||
if (selectionWeights->empty())
|
||||
return NULL;
|
||||
uint32 Weight = 0;
|
||||
uint32 selectedWeight = 0;
|
||||
bgTypeId = BATTLEGROUND_TYPE_NONE;
|
||||
// Get sum of all weights
|
||||
for (BattlegroundSelectionWeightMap::const_iterator it = selectionWeights->begin(); it != selectionWeights->end(); ++it)
|
||||
Weight += it->second;
|
||||
if (!Weight)
|
||||
return NULL;
|
||||
// Select a random value
|
||||
selectedWeight = urand(0, Weight-1);
|
||||
|
||||
// Select the correct bg (if we have in DB A(10), B(20), C(10), D(15) --> [0---A---9|10---B---29|30---C---39|40---D---54])
|
||||
Weight = 0;
|
||||
for (BattlegroundSelectionWeightMap::const_iterator it = selectionWeights->begin(); it != selectionWeights->end(); ++it)
|
||||
{
|
||||
Weight += it->second;
|
||||
if (selectedWeight < Weight)
|
||||
{
|
||||
bgTypeId = it->first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bg_template = GetBattlegroundTemplate(bgTypeId);
|
||||
if (!bg_template)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Battleground* bg = NULL;
|
||||
// create a copy of the BG template
|
||||
@@ -574,9 +551,6 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId
|
||||
case BATTLEGROUND_BE:
|
||||
bg = new BattlegroundBE(*(BattlegroundBE*)bg_template);
|
||||
break;
|
||||
case BATTLEGROUND_AA:
|
||||
bg = new BattlegroundAA(*(BattlegroundAA*)bg_template);
|
||||
break;
|
||||
case BATTLEGROUND_EY:
|
||||
bg = new BattlegroundEY(*(BattlegroundEY*)bg_template);
|
||||
break;
|
||||
@@ -596,57 +570,76 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId
|
||||
bg = new BattlegroundIC(*(BattlegroundIC*)bg_template);
|
||||
break;
|
||||
case BATTLEGROUND_RB:
|
||||
bg = new BattlegroundRB(*(BattlegroundRB*)bg_template);
|
||||
case BATTLEGROUND_AA:
|
||||
bg = new Battleground(*bg_template);
|
||||
break;
|
||||
default:
|
||||
//error, but it is handled few lines above
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// set battelground difficulty before initialization
|
||||
bg->SetBracket(bracketEntry);
|
||||
|
||||
// generate a new instance id
|
||||
bg->SetInstanceID(sMapMgr->GenerateInstanceId()); // set instance id
|
||||
bg->SetInstanceID(sMapMgr->GenerateInstanceId());
|
||||
bg->SetClientInstanceID(CreateClientVisibleInstanceId(isRandom ? BATTLEGROUND_RB : bgTypeId, bracketEntry->GetBracketId()));
|
||||
|
||||
// reset the new bg (set status to status_wait_queue from status_none)
|
||||
bg->Reset();
|
||||
|
||||
// start the joining of the bg
|
||||
bg->SetStatus(STATUS_WAIT_JOIN);
|
||||
bg->Reset(); // reset the new bg (set status to status_wait_queue from status_none)
|
||||
bg->SetStatus(STATUS_WAIT_JOIN); // start the joining of the bg
|
||||
bg->SetArenaType(arenaType);
|
||||
bg->SetTypeID(originalBgTypeId);
|
||||
bg->SetRandomTypeID(bgTypeId);
|
||||
bg->SetRated(isRated);
|
||||
bg->SetRandom(isRandom);
|
||||
bg->SetTypeID(isRandom ? BATTLEGROUND_RB : bgTypeId);
|
||||
bg->SetRandomTypeID(bgTypeId);
|
||||
|
||||
return bg;
|
||||
}
|
||||
|
||||
// used to create the BG templates
|
||||
uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
|
||||
bool BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
|
||||
{
|
||||
// Create the BG
|
||||
Battleground* bg = NULL;
|
||||
switch (data.bgTypeId)
|
||||
{
|
||||
case BATTLEGROUND_AV: bg = new BattlegroundAV; break;
|
||||
case BATTLEGROUND_WS: bg = new BattlegroundWS; break;
|
||||
case BATTLEGROUND_AB: bg = new BattlegroundAB; break;
|
||||
case BATTLEGROUND_NA: bg = new BattlegroundNA; break;
|
||||
case BATTLEGROUND_BE: bg = new BattlegroundBE; break;
|
||||
case BATTLEGROUND_AA: bg = new BattlegroundAA; break;
|
||||
case BATTLEGROUND_EY: bg = new BattlegroundEY; break;
|
||||
case BATTLEGROUND_RL: bg = new BattlegroundRL; break;
|
||||
case BATTLEGROUND_SA: bg = new BattlegroundSA; break;
|
||||
case BATTLEGROUND_DS: bg = new BattlegroundDS; break;
|
||||
case BATTLEGROUND_RV: bg = new BattlegroundRV; break;
|
||||
case BATTLEGROUND_IC: bg = new BattlegroundIC; break;
|
||||
case BATTLEGROUND_RB: bg = new BattlegroundRB; break;
|
||||
default:
|
||||
case BATTLEGROUND_AV:
|
||||
bg = new BattlegroundAV;
|
||||
break;
|
||||
case BATTLEGROUND_WS:
|
||||
bg = new BattlegroundWS;
|
||||
break;
|
||||
case BATTLEGROUND_AB:
|
||||
bg = new BattlegroundAB;
|
||||
break;
|
||||
case BATTLEGROUND_NA:
|
||||
bg = new BattlegroundNA;
|
||||
break;
|
||||
case BATTLEGROUND_BE:
|
||||
bg = new BattlegroundBE;
|
||||
break;
|
||||
case BATTLEGROUND_EY:
|
||||
bg = new BattlegroundEY;
|
||||
break;
|
||||
case BATTLEGROUND_RL:
|
||||
bg = new BattlegroundRL;
|
||||
break;
|
||||
case BATTLEGROUND_SA:
|
||||
bg = new BattlegroundSA;
|
||||
break;
|
||||
case BATTLEGROUND_DS:
|
||||
bg = new BattlegroundDS;
|
||||
break;
|
||||
case BATTLEGROUND_RV:
|
||||
bg = new BattlegroundRV;
|
||||
break;
|
||||
case BATTLEGROUND_IC:
|
||||
bg = new BattlegroundIC;
|
||||
break;
|
||||
case BATTLEGROUND_AA:
|
||||
bg = new Battleground;
|
||||
break;
|
||||
case BATTLEGROUND_RB:
|
||||
bg = new Battleground;
|
||||
bg->SetRandom(true);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
bg->SetMapId(data.MapID);
|
||||
@@ -664,20 +657,14 @@ uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
|
||||
bg->SetLevelRange(data.LevelMin, data.LevelMax);
|
||||
bg->SetScriptId(data.scriptId);
|
||||
|
||||
// add bg to update list
|
||||
AddBattleground(bg->GetInstanceID(), bg->GetTypeID(), bg);
|
||||
AddBattleground(bg);
|
||||
|
||||
// return some not-null value, bgTypeId is good enough for me
|
||||
return data.bgTypeId;
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
uint8 selectionWeight;
|
||||
BattlemasterListEntry const* bl;
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, StartMaxDist, Weight, ScriptName FROM battleground_template");
|
||||
|
||||
@@ -687,33 +674,38 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 count = 0, startId;
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 bgTypeID_ = fields[0].GetUInt32();
|
||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeID_, NULL))
|
||||
uint32 bgTypeId = fields[0].GetUInt32();
|
||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId, NULL))
|
||||
continue;
|
||||
|
||||
// can be overwrite by values from DB
|
||||
bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
if (!bl)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeId);
|
||||
continue;
|
||||
}
|
||||
|
||||
CreateBattlegroundData data;
|
||||
data.bgTypeId = BattlegroundTypeId(bgTypeID_);
|
||||
data.bgTypeId = BattlegroundTypeId(bgTypeId);
|
||||
data.IsArena = (bl->type == TYPE_ARENA);
|
||||
data.MinPlayersPerTeam = fields[1].GetUInt16();
|
||||
data.MaxPlayersPerTeam = fields[2].GetUInt16();
|
||||
data.LevelMin = fields[3].GetUInt8();
|
||||
data.LevelMax = fields[4].GetUInt8();
|
||||
uint8 spawn = fields[9].GetUInt8();
|
||||
data.StartMaxDist = float(spawn * spawn);
|
||||
|
||||
data.scriptId = sObjectMgr->GetScriptId(fields[11].GetCString());
|
||||
data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()];
|
||||
data.MapID = bl->mapid[0];
|
||||
|
||||
// check values from DB
|
||||
if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)",
|
||||
@@ -728,37 +720,12 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
continue;
|
||||
}
|
||||
|
||||
startId = fields[5].GetUInt32();
|
||||
if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
|
||||
{
|
||||
data.Team1StartLocX = start->x;
|
||||
data.Team1StartLocY = start->y;
|
||||
data.Team1StartLocZ = start->z;
|
||||
data.Team1StartLocO = fields[6].GetFloat();
|
||||
}
|
||||
else if (data.bgTypeId == BATTLEGROUND_AA || data.bgTypeId == BATTLEGROUND_RB)
|
||||
if (data.bgTypeId == BATTLEGROUND_AA || data.bgTypeId == BATTLEGROUND_RB)
|
||||
{
|
||||
data.Team1StartLocX = 0;
|
||||
data.Team1StartLocY = 0;
|
||||
data.Team1StartLocZ = 0;
|
||||
data.Team1StartLocO = fields[6].GetFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
|
||||
continue;
|
||||
}
|
||||
|
||||
startId = fields[7].GetUInt32();
|
||||
if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
|
||||
{
|
||||
data.Team2StartLocX = start->x;
|
||||
data.Team2StartLocY = start->y;
|
||||
data.Team2StartLocZ = start->z;
|
||||
data.Team2StartLocO = fields[8].GetFloat();
|
||||
}
|
||||
else if (data.bgTypeId == BATTLEGROUND_AA || data.bgTypeId == BATTLEGROUND_RB)
|
||||
{
|
||||
data.Team2StartLocX = 0;
|
||||
data.Team2StartLocY = 0;
|
||||
data.Team2StartLocZ = 0;
|
||||
@@ -766,27 +733,46 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
|
||||
continue;
|
||||
uint32 startId = fields[5].GetUInt32();
|
||||
if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
|
||||
{
|
||||
data.Team1StartLocX = start->x;
|
||||
data.Team1StartLocY = start->y;
|
||||
data.Team1StartLocZ = start->z;
|
||||
data.Team1StartLocO = fields[6].GetFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
|
||||
continue;
|
||||
}
|
||||
|
||||
startId = fields[7].GetUInt32();
|
||||
if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
|
||||
{
|
||||
data.Team2StartLocX = start->x;
|
||||
data.Team2StartLocY = start->y;
|
||||
data.Team2StartLocZ = start->z;
|
||||
data.Team2StartLocO = fields[8].GetFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
data.StartMaxDist = fields[9].GetFloat();
|
||||
|
||||
selectionWeight = fields[10].GetUInt8();
|
||||
data.scriptId = sObjectMgr->GetScriptId(fields[11].GetCString());
|
||||
data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()];
|
||||
data.MapID = bl->mapid[0];
|
||||
|
||||
if (!CreateBattleground(data))
|
||||
continue;
|
||||
|
||||
if (data.IsArena)
|
||||
{
|
||||
if (data.bgTypeId != BATTLEGROUND_AA)
|
||||
m_ArenaSelectionWeights[data.bgTypeId] = selectionWeight;
|
||||
m_ArenaSelectionWeights[data.bgTypeId] = fields[10].GetUInt8();
|
||||
}
|
||||
else if (data.bgTypeId != BATTLEGROUND_RB)
|
||||
m_BGSelectionWeights[data.bgTypeId] = selectionWeight;
|
||||
m_BGSelectionWeights[data.bgTypeId] = fields[10].GetUInt8();
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
@@ -832,10 +818,10 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
|
||||
*data << uint8(0); // unk
|
||||
|
||||
// Rewards
|
||||
*data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin
|
||||
*data << uint32(winner_kills); // 3.3.3 winHonor
|
||||
*data << uint32(winner_arena); // 3.3.3 winArena
|
||||
*data << uint32(loser_kills); // 3.3.3 lossHonor
|
||||
*data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin
|
||||
*data << uint32(winner_kills); // 3.3.3 winHonor
|
||||
*data << uint32(winner_arena); // 3.3.3 winArena
|
||||
*data << uint32(loser_kills); // 3.3.3 lossHonor
|
||||
|
||||
uint8 isRandom = bgTypeId == BATTLEGROUND_RB;
|
||||
|
||||
@@ -843,29 +829,29 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
|
||||
if (isRandom)
|
||||
{
|
||||
// Rewards (random)
|
||||
*data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin_Random
|
||||
*data << uint32(winner_kills); // 3.3.3 winHonor_Random
|
||||
*data << uint32(winner_arena); // 3.3.3 winArena_Random
|
||||
*data << uint32(loser_kills); // 3.3.3 lossHonor_Random
|
||||
*data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin_Random
|
||||
*data << uint32(winner_kills); // 3.3.3 winHonor_Random
|
||||
*data << uint32(winner_arena); // 3.3.3 winArena_Random
|
||||
*data << uint32(loser_kills); // 3.3.3 lossHonor_Random
|
||||
}
|
||||
|
||||
if (bgTypeId == BATTLEGROUND_AA) // arena
|
||||
{
|
||||
if (bgTypeId == BATTLEGROUND_AA) // arena
|
||||
*data << uint32(0); // unk (count?)
|
||||
}
|
||||
else // battleground
|
||||
{
|
||||
size_t count_pos = data->wpos();
|
||||
*data << uint32(0); // number of bg instances
|
||||
|
||||
if (Battleground* bgTemplate = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId))
|
||||
BattlegroundDataContainer::iterator it = bgDataStore.find(bgTypeId);
|
||||
if (it != bgDataStore.end())
|
||||
{
|
||||
// expected bracket entry
|
||||
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), player->getLevel()))
|
||||
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(it->second.m_Battlegrounds.begin()->second->GetMapId(), player->getLevel()))
|
||||
{
|
||||
uint32 count = 0;
|
||||
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
|
||||
for (std::set<uint32>::iterator itr = m_ClientBattlegroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattlegroundIds[bgTypeId][bracketId].end();++itr)
|
||||
BattlegroundClientIdsContainer& clientIds = it->second.m_ClientBattlegroundIds[bracketId];
|
||||
for (BattlegroundClientIdsContainer::const_iterator itr = clientIds.begin(); itr != clientIds.end(); ++itr)
|
||||
{
|
||||
*data << uint32(*itr);
|
||||
++count;
|
||||
@@ -878,23 +864,20 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
|
||||
|
||||
void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
Battleground* bg = GetBattleground(instanceId, bgTypeId);
|
||||
if (bg)
|
||||
if (Battleground* bg = GetBattleground(instanceId, bgTypeId))
|
||||
{
|
||||
uint32 mapid = bg->GetMapId();
|
||||
float x, y, z, O;
|
||||
uint32 mapid = bg->GetMapId();
|
||||
uint32 team = player->GetBGTeam();
|
||||
if (team == 0)
|
||||
team = player->GetTeam();
|
||||
bg->GetTeamStartLoc(team, x, y, z, O);
|
||||
|
||||
sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", player->GetName(), mapid, x, y, z, O);
|
||||
bg->GetTeamStartLoc(team, x, y, z, O);
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Sending %s to map %u, X %f, Y %f, Z %f, O %f (bgType %u)", player->GetName(), mapid, x, y, z, O, bgTypeId);
|
||||
player->TeleportTo(mapid, x, y, z, O);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "player %u is trying to port to non-existent bg instance %u", player->GetGUIDLow(), instanceId);
|
||||
}
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Instance %u (bgType %u) not found while trying to teleport player %s", instanceId, bgTypeId, player->GetName());
|
||||
}
|
||||
|
||||
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid)
|
||||
@@ -909,12 +892,12 @@ void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battlegrou
|
||||
|
||||
bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
return (bgTypeId == BATTLEGROUND_AA ||
|
||||
bgTypeId == BATTLEGROUND_BE ||
|
||||
bgTypeId == BATTLEGROUND_NA ||
|
||||
bgTypeId == BATTLEGROUND_DS ||
|
||||
bgTypeId == BATTLEGROUND_RV ||
|
||||
bgTypeId == BATTLEGROUND_RL);
|
||||
return bgTypeId == BATTLEGROUND_AA
|
||||
|| bgTypeId == BATTLEGROUND_BE
|
||||
|| bgTypeId == BATTLEGROUND_NA
|
||||
|| bgTypeId == BATTLEGROUND_DS
|
||||
|| bgTypeId == BATTLEGROUND_RV
|
||||
|| bgTypeId == BATTLEGROUND_RL;
|
||||
}
|
||||
|
||||
BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
|
||||
@@ -1002,19 +985,13 @@ uint8 BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId bgQueueTypeId)
|
||||
void BattlegroundMgr::ToggleTesting()
|
||||
{
|
||||
m_Testing = !m_Testing;
|
||||
if (m_Testing)
|
||||
sWorld->SendWorldText(LANG_DEBUG_BG_ON);
|
||||
else
|
||||
sWorld->SendWorldText(LANG_DEBUG_BG_OFF);
|
||||
sWorld->SendWorldText(m_Testing ? LANG_DEBUG_BG_ON : LANG_DEBUG_BG_OFF);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::ToggleArenaTesting()
|
||||
{
|
||||
m_ArenaTesting = !m_ArenaTesting;
|
||||
if (m_ArenaTesting)
|
||||
sWorld->SendWorldText(LANG_DEBUG_ARENA_ON);
|
||||
else
|
||||
sWorld->SendWorldText(LANG_DEBUG_ARENA_OFF);
|
||||
sWorld->SendWorldText(m_ArenaTesting ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::SetHolidayWeekends(uint32 mask)
|
||||
@@ -1032,18 +1009,9 @@ void BattlegroundMgr::ScheduleQueueUpdate(uint32 arenaMatchmakerRating, uint8 ar
|
||||
{
|
||||
//This method must be atomic, TODO add mutex
|
||||
//we will use only 1 number created of bgTypeId and bracket_id
|
||||
uint64 schedule_id = ((uint64)arenaMatchmakerRating << 32) | (arenaType << 24) | (bgQueueTypeId << 16) | (bgTypeId << 8) | bracket_id;
|
||||
bool found = false;
|
||||
for (uint8 i = 0; i < m_QueueUpdateScheduler.size(); i++)
|
||||
{
|
||||
if (m_QueueUpdateScheduler[i] == schedule_id)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
m_QueueUpdateScheduler.push_back(schedule_id);
|
||||
uint64 const scheduleId = ((uint64)arenaMatchmakerRating << 32) | (arenaType << 24) | (bgQueueTypeId << 16) | (bgTypeId << 8) | bracket_id;
|
||||
if (std::find(m_QueueUpdateScheduler.begin(), m_QueueUpdateScheduler.end(), scheduleId) == m_QueueUpdateScheduler.end())
|
||||
m_QueueUpdateScheduler.push_back(scheduleId);
|
||||
}
|
||||
|
||||
uint32 BattlegroundMgr::GetMaxRatingDifference() const
|
||||
@@ -1134,3 +1102,86 @@ bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId));
|
||||
}
|
||||
|
||||
BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
uint32 weight = 0;
|
||||
BattlegroundTypeId returnBgTypeId = BATTLEGROUND_TYPE_NONE;
|
||||
BattlegroundSelectionWeightMap selectionWeights;
|
||||
|
||||
if (bgTypeId == BATTLEGROUND_AA)
|
||||
{
|
||||
for (BattlegroundSelectionWeightMap::const_iterator it = m_ArenaSelectionWeights.begin(); it != m_ArenaSelectionWeights.end(); ++it)
|
||||
{
|
||||
if (it->second)
|
||||
{
|
||||
weight += it->second;
|
||||
selectionWeights[it->first] = it->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bgTypeId == BATTLEGROUND_RB)
|
||||
{
|
||||
for (BattlegroundSelectionWeightMap::const_iterator it = m_BGSelectionWeights.begin(); it != m_BGSelectionWeights.end(); ++it)
|
||||
{
|
||||
if (it->second)
|
||||
{
|
||||
weight += it->second;
|
||||
selectionWeights[it->first] = it->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (weight)
|
||||
{
|
||||
uint32 selectedWeight = 0;
|
||||
// Select a random value
|
||||
selectedWeight = urand(0, weight - 1);
|
||||
// Select the correct bg (if we have in DB A(10), B(20), C(10), D(15) --> [0---A---9|10---B---29|30---C---39|40---D---54])
|
||||
weight = 0;
|
||||
for (BattlegroundSelectionWeightMap::const_iterator it = selectionWeights.begin(); it != selectionWeights.end(); ++it)
|
||||
{
|
||||
weight += it->second;
|
||||
if (selectedWeight < weight)
|
||||
{
|
||||
returnBgTypeId = it->first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnBgTypeId;
|
||||
}
|
||||
|
||||
BGFreeSlotQueueContainer& BattlegroundMgr::GetBGFreeSlotQueueStore(BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
return bgDataStore[bgTypeId].BGFreeSlotQueue;
|
||||
}
|
||||
|
||||
void BattlegroundMgr::AddToBGFreeSlotQueue(BattlegroundTypeId bgTypeId, Battleground* bg)
|
||||
{
|
||||
bgDataStore[bgTypeId].BGFreeSlotQueue.push_front(bg);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::RemoveFromBGFreeSlotQueue(BattlegroundTypeId bgTypeId, uint32 instanceId)
|
||||
{
|
||||
BGFreeSlotQueueContainer& queues = bgDataStore[bgTypeId].BGFreeSlotQueue;
|
||||
for (BGFreeSlotQueueContainer::iterator itr = queues.begin(); itr != queues.end(); ++itr)
|
||||
if ((*itr)->GetInstanceID() == instanceId)
|
||||
{
|
||||
queues.erase(itr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundMgr::AddBattleground(Battleground* bg)
|
||||
{
|
||||
if (bg)
|
||||
bgDataStore[bg->GetTypeID()].m_Battlegrounds[bg->GetInstanceID()] = bg;
|
||||
}
|
||||
|
||||
void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId)
|
||||
{
|
||||
bgDataStore[bgTypeId].m_Battlegrounds.erase(instanceId);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
#include "BattlegroundQueue.h"
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
typedef std::map<uint32, Battleground*> BattlegroundSet;
|
||||
typedef std::map<uint32, Battleground*> BattlegroundContainer;
|
||||
typedef std::set<uint32> BattlegroundClientIdsContainer;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, BattlegroundTypeId> BattleMastersMap;
|
||||
|
||||
@@ -54,6 +55,13 @@ struct CreateBattlegroundData
|
||||
uint32 scriptId;
|
||||
};
|
||||
|
||||
struct BattlegroundData
|
||||
{
|
||||
BattlegroundContainer m_Battlegrounds;
|
||||
BattlegroundClientIdsContainer m_ClientBattlegroundIds[MAX_BATTLEGROUND_BRACKETS];
|
||||
BGFreeSlotQueueContainer BGFreeSlotQueue;
|
||||
};
|
||||
|
||||
class BattlegroundMgr
|
||||
{
|
||||
friend class ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>;
|
||||
@@ -78,16 +86,15 @@ class BattlegroundMgr
|
||||
|
||||
/* Battlegrounds */
|
||||
Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId);
|
||||
Battleground* GetBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
|
||||
|
||||
Battleground* GetBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId);
|
||||
Battleground* GetBattlegroundTemplate(BattlegroundTypeId bgTypeId);
|
||||
Battleground* CreateNewBattleground(BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated);
|
||||
|
||||
uint32 CreateBattleground(CreateBattlegroundData& data);
|
||||
|
||||
void AddBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId, Battleground* BG) { m_Battlegrounds[bgTypeId][InstanceID] = BG; };
|
||||
void RemoveBattleground(uint32 instanceID, BattlegroundTypeId bgTypeId) { m_Battlegrounds[bgTypeId].erase(instanceID); }
|
||||
uint32 CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id);
|
||||
void AddBattleground(Battleground* bg);
|
||||
void RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId);
|
||||
void AddToBGFreeSlotQueue(BattlegroundTypeId bgTypeId, Battleground* bg);
|
||||
void RemoveFromBGFreeSlotQueue(BattlegroundTypeId bgTypeId, uint32 instanceId);
|
||||
BGFreeSlotQueueContainer& GetBGFreeSlotQueueStore(BattlegroundTypeId bgTypeId);
|
||||
|
||||
void CreateInitialBattlegrounds();
|
||||
void DeleteAllBattlegrounds();
|
||||
@@ -95,21 +102,29 @@ class BattlegroundMgr
|
||||
void SendToBattleground(Player* player, uint32 InstanceID, BattlegroundTypeId bgTypeId);
|
||||
|
||||
/* Battleground queues */
|
||||
//these queues are instantiated when creating BattlegroundMrg
|
||||
BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; // public, because we need to access them in BG handler code
|
||||
|
||||
BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID];
|
||||
|
||||
BattlegroundQueue& GetBattlegroundQueue(BattlegroundQueueTypeId bgQueueTypeId) { return m_BattlegroundQueues[bgQueueTypeId]; }
|
||||
void ScheduleQueueUpdate(uint32 arenaMatchmakerRating, uint8 arenaType, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id);
|
||||
uint32 GetMaxRatingDifference() const;
|
||||
uint32 GetRatingDiscardTimer() const;
|
||||
uint32 GetPrematureFinishTime() const;
|
||||
|
||||
void InitAutomaticArenaPointDistribution();
|
||||
void ToggleArenaTesting();
|
||||
void ToggleTesting();
|
||||
|
||||
void SetHolidayWeekends(uint32 mask);
|
||||
|
||||
bool isArenaTesting() const { return m_ArenaTesting; }
|
||||
bool isTesting() const { return m_Testing; }
|
||||
|
||||
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType);
|
||||
static BattlegroundTypeId BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId);
|
||||
static uint8 BGArenaType(BattlegroundQueueTypeId bgQueueTypeId);
|
||||
|
||||
static HolidayIds BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId);
|
||||
static BattlegroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
|
||||
static bool IsBGWeekend(BattlegroundTypeId bgTypeId);
|
||||
|
||||
uint32 GetMaxRatingDifference() const;
|
||||
uint32 GetRatingDiscardTimer() const;
|
||||
void InitAutomaticArenaPointDistribution();
|
||||
void LoadBattleMastersEntry();
|
||||
BattlegroundTypeId GetBattleMasterBG(uint32 entry) const
|
||||
{
|
||||
@@ -119,35 +134,28 @@ class BattlegroundMgr
|
||||
return BATTLEGROUND_WS;
|
||||
}
|
||||
|
||||
bool isArenaTesting() const { return m_ArenaTesting; }
|
||||
bool isTesting() const { return m_Testing; }
|
||||
|
||||
static bool IsArenaType(BattlegroundTypeId bgTypeId);
|
||||
static bool IsBattlegroundType(BattlegroundTypeId bgTypeId) { return !IsArenaType(bgTypeId); }
|
||||
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType);
|
||||
static BattlegroundTypeId BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId);
|
||||
static uint8 BGArenaType(BattlegroundQueueTypeId bgQueueTypeId);
|
||||
|
||||
static HolidayIds BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId);
|
||||
static BattlegroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
|
||||
static bool IsBGWeekend(BattlegroundTypeId bgTypeId);
|
||||
private:
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
bool CreateBattleground(CreateBattlegroundData& data);
|
||||
uint32 CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id);
|
||||
static bool IsArenaType(BattlegroundTypeId bgTypeId);
|
||||
BattlegroundTypeId GetRandomBG(BattlegroundTypeId id);
|
||||
|
||||
typedef std::map<BattlegroundTypeId, BattlegroundData> BattlegroundDataContainer;
|
||||
BattlegroundDataContainer bgDataStore;
|
||||
|
||||
BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES];
|
||||
|
||||
typedef std::map<BattlegroundTypeId, uint8> BattlegroundSelectionWeightMap; // TypeId and its selectionWeight
|
||||
/* Battlegrounds */
|
||||
BattlegroundSet m_Battlegrounds[MAX_BATTLEGROUND_TYPE_ID];
|
||||
BattlegroundSelectionWeightMap m_ArenaSelectionWeights;
|
||||
BattlegroundSelectionWeightMap m_BGSelectionWeights;
|
||||
std::vector<uint64> m_QueueUpdateScheduler;
|
||||
std::set<uint32> m_ClientBattlegroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client
|
||||
uint32 m_NextRatedArenaUpdate;
|
||||
time_t m_NextAutoDistributionTime;
|
||||
uint32 m_AutoDistributionTimeChecker;
|
||||
bool m_ArenaTesting;
|
||||
bool m_Testing;
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
};
|
||||
|
||||
#define sBattlegroundMgr ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>::instance()
|
||||
#endif
|
||||
|
||||
|
||||
@@ -167,31 +167,31 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr
|
||||
}
|
||||
|
||||
//add players from group to ginfo
|
||||
if (grp)
|
||||
{
|
||||
//ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
|
||||
if (grp)
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* member = itr->getSource();
|
||||
if (!member)
|
||||
continue; // this should never happen
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()];
|
||||
pl_info.LastOnlineTime = lastOnlineTime;
|
||||
pl_info.GroupInfo = ginfo;
|
||||
// add the pinfo to ginfo's list
|
||||
ginfo->Players[member->GetGUID()] = &pl_info;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetGUID()];
|
||||
Player* member = itr->getSource();
|
||||
if (!member)
|
||||
continue; // this should never happen
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()];
|
||||
pl_info.LastOnlineTime = lastOnlineTime;
|
||||
pl_info.GroupInfo = ginfo;
|
||||
ginfo->Players[leader->GetGUID()] = &pl_info;
|
||||
// add the pinfo to ginfo's list
|
||||
ginfo->Players[member->GetGUID()] = &pl_info;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetGUID()];
|
||||
pl_info.LastOnlineTime = lastOnlineTime;
|
||||
pl_info.GroupInfo = ginfo;
|
||||
ginfo->Players[leader->GetGUID()] = &pl_info;
|
||||
}
|
||||
|
||||
//add GroupInfo to m_QueuedGroups
|
||||
//add GroupInfo to m_QueuedGroups
|
||||
{
|
||||
//ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
|
||||
m_QueuedGroups[bracketId][index].push_back(ginfo);
|
||||
|
||||
//announce to world, this code needs mutex
|
||||
@@ -236,16 +236,16 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr
|
||||
void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id)
|
||||
{
|
||||
uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, getMSTime());
|
||||
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
|
||||
uint8 team_index = TEAM_ALLIANCE; //default set to TEAM_ALLIANCE - or non rated arenas!
|
||||
if (!ginfo->ArenaType)
|
||||
{
|
||||
if (ginfo->Team == HORDE)
|
||||
team_index = BG_TEAM_HORDE;
|
||||
team_index = TEAM_HORDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ginfo->IsRated)
|
||||
team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
|
||||
team_index = TEAM_HORDE; //for rated arenas use TEAM_HORDE
|
||||
}
|
||||
|
||||
//store pointer to arrayindex of player that was added first
|
||||
@@ -263,16 +263,16 @@ void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
|
||||
|
||||
uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id) const
|
||||
{
|
||||
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
|
||||
uint8 team_index = TEAM_ALLIANCE; //default set to TEAM_ALLIANCE - or non rated arenas!
|
||||
if (!ginfo->ArenaType)
|
||||
{
|
||||
if (ginfo->Team == HORDE)
|
||||
team_index = BG_TEAM_HORDE;
|
||||
team_index = TEAM_HORDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ginfo->IsRated)
|
||||
team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
|
||||
team_index = TEAM_HORDE; //for rated arenas use TEAM_HORDE
|
||||
}
|
||||
//check if there is enought values(we always add values > 0)
|
||||
if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1])
|
||||
@@ -299,11 +299,11 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
|
||||
}
|
||||
|
||||
GroupQueueInfo* group = itr->second.GroupInfo;
|
||||
GroupsQueueType::iterator group_itr, group_itr_tmp;
|
||||
GroupsQueueType::iterator group_itr;
|
||||
// mostly people with the highest levels are in battlegrounds, thats why
|
||||
// we count from MAX_BATTLEGROUND_QUEUES - 1 to 0
|
||||
// variable index removes useless searching in other team's queue
|
||||
uint32 index = (group->Team == HORDE) ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE;
|
||||
|
||||
uint32 index = (group->Team == HORDE) ? BG_QUEUE_PREMADE_HORDE : BG_QUEUE_PREMADE_ALLIANCE;
|
||||
|
||||
for (int32 bracket_id_tmp = MAX_BATTLEGROUND_BRACKETS - 1; bracket_id_tmp >= 0 && bracket_id == -1; --bracket_id_tmp)
|
||||
{
|
||||
@@ -311,12 +311,13 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
|
||||
//they leave groupinfo so we can't use its players size to find out index
|
||||
for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_TEAMS_COUNT)
|
||||
{
|
||||
for (group_itr_tmp = m_QueuedGroups[bracket_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[bracket_id_tmp][j].end(); ++group_itr_tmp)
|
||||
GroupsQueueType::iterator k = m_QueuedGroups[bracket_id_tmp][j].begin();
|
||||
for (; k != m_QueuedGroups[bracket_id_tmp][j].end(); ++k)
|
||||
{
|
||||
if ((*group_itr_tmp) == group)
|
||||
if ((*k) == group)
|
||||
{
|
||||
bracket_id = bracket_id_tmp;
|
||||
group_itr = group_itr_tmp;
|
||||
group_itr = k;
|
||||
//we must store index to be able to erase iterator
|
||||
index = j;
|
||||
break;
|
||||
@@ -345,7 +346,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
|
||||
|
||||
// if invited to bg, and should decrease invited count, then do it
|
||||
if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID)
|
||||
if (Battleground* bg = sBattlegroundMgr->GetBattleground(group->IsInvitedToBGInstanceGUID, group->BgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : group->BgTypeId))
|
||||
if (Battleground* bg = sBattlegroundMgr->GetBattleground(group->IsInvitedToBGInstanceGUID, group->BgTypeId))
|
||||
bg->DecreaseInvitedCount(group->Team);
|
||||
|
||||
// remove player queue info
|
||||
@@ -375,11 +376,13 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
|
||||
{
|
||||
m_QueuedGroups[bracket_id][index].erase(group_itr);
|
||||
delete group;
|
||||
return;
|
||||
}
|
||||
|
||||
// if group wasn't empty, so it wasn't deleted, and player have left a rated
|
||||
// queue -> everyone from the group should leave too
|
||||
// don't remove recursively if already invited to bg!
|
||||
else if (!group->IsInvitedToBGInstanceGUID && group->IsRated)
|
||||
if (!group->IsInvitedToBGInstanceGUID && group->IsRated)
|
||||
{
|
||||
// remove next player, this is recursive
|
||||
// first send removal information
|
||||
@@ -417,6 +420,11 @@ bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginf
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 BattlegroundQueue::GetPlayersInQueue(TeamId id)
|
||||
{
|
||||
return m_SelectionPools[id].GetPlayerCount();
|
||||
}
|
||||
|
||||
bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side)
|
||||
{
|
||||
// set side if needed
|
||||
@@ -467,7 +475,8 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg,
|
||||
|
||||
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", player->GetName(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.",
|
||||
player->GetName(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
|
||||
|
||||
// send status packet
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
|
||||
@@ -495,13 +504,13 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, BattlegroundBracketId
|
||||
uint32 aliCount = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].size();
|
||||
//index to queue which group is current
|
||||
uint32 aliIndex = 0;
|
||||
for (; aliIndex < aliCount && m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree); aliIndex++)
|
||||
for (; aliIndex < aliCount && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree); aliIndex++)
|
||||
++Ali_itr;
|
||||
//the same thing for horde
|
||||
GroupsQueueType::const_iterator Horde_itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].begin();
|
||||
uint32 hordeCount = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].size();
|
||||
uint32 hordeIndex = 0;
|
||||
for (; hordeIndex < hordeCount && m_SelectionPools[BG_TEAM_HORDE].AddGroup((*Horde_itr), hordeFree); hordeIndex++)
|
||||
for (; hordeIndex < hordeCount && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), hordeFree); hordeIndex++)
|
||||
++Horde_itr;
|
||||
|
||||
//if ofc like BG queue invitation is set in config, then we are happy
|
||||
@@ -517,45 +526,45 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, BattlegroundBracketId
|
||||
*/
|
||||
|
||||
// At first we need to compare free space in bg and our selection pool
|
||||
int32 diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount());
|
||||
int32 diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
|
||||
while (abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
int32 diffAli = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
|
||||
int32 diffHorde = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
while (abs(diffAli - diffHorde) > 1 && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
|
||||
{
|
||||
//each cycle execution we need to kick at least 1 group
|
||||
if (diffAli < diffHorde)
|
||||
{
|
||||
//kick alliance group, add to pool new group if needed
|
||||
if (m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffHorde - diffAli))
|
||||
if (m_SelectionPools[TEAM_ALLIANCE].KickGroup(diffHorde - diffAli))
|
||||
{
|
||||
for (; aliIndex < aliCount && m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*Ali_itr), (aliFree >= diffHorde) ? aliFree - diffHorde : 0); aliIndex++)
|
||||
for (; aliIndex < aliCount && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), (aliFree >= diffHorde) ? aliFree - diffHorde : 0); aliIndex++)
|
||||
++Ali_itr;
|
||||
}
|
||||
//if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break;
|
||||
if (!m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
|
||||
if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())
|
||||
{
|
||||
if (aliFree <= diffHorde + 1)
|
||||
break;
|
||||
m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffHorde - diffAli);
|
||||
m_SelectionPools[TEAM_HORDE].KickGroup(diffHorde - diffAli);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//kick horde group, add to pool new group if needed
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffAli - diffHorde))
|
||||
if (m_SelectionPools[TEAM_HORDE].KickGroup(diffAli - diffHorde))
|
||||
{
|
||||
for (; hordeIndex < hordeCount && m_SelectionPools[BG_TEAM_HORDE].AddGroup((*Horde_itr), (hordeFree >= diffAli) ? hordeFree - diffAli : 0); hordeIndex++)
|
||||
for (; hordeIndex < hordeCount && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), (hordeFree >= diffAli) ? hordeFree - diffAli : 0); hordeIndex++)
|
||||
++Horde_itr;
|
||||
}
|
||||
if (!m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
|
||||
if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount())
|
||||
{
|
||||
if (hordeFree <= diffAli + 1)
|
||||
break;
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffAli - diffHorde);
|
||||
m_SelectionPools[TEAM_ALLIANCE].KickGroup(diffAli - diffHorde);
|
||||
}
|
||||
}
|
||||
//count diffs after small update
|
||||
diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount());
|
||||
diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
|
||||
diffAli = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
|
||||
diffHorde = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,10 +588,10 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint
|
||||
|
||||
if (ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end())
|
||||
{
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*ali_group), MaxPlayersPerTeam);
|
||||
m_SelectionPools[BG_TEAM_HORDE].AddGroup((*horde_group), MaxPlayersPerTeam);
|
||||
m_SelectionPools[TEAM_ALLIANCE].AddGroup((*ali_group), MaxPlayersPerTeam);
|
||||
m_SelectionPools[TEAM_HORDE].AddGroup((*horde_group), MaxPlayersPerTeam);
|
||||
//add groups/players from normal queue to size of bigger group
|
||||
uint32 maxPlayers = std::min(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount(), m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
|
||||
uint32 maxPlayers = std::min(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount(), m_SelectionPools[TEAM_HORDE].GetPlayerCount());
|
||||
GroupsQueueType::const_iterator itr;
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
{
|
||||
@@ -637,11 +646,11 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground* bg_template, Battleground
|
||||
}
|
||||
}
|
||||
//try to invite same number of players - this cycle may cause longer wait time even if there are enough players in queue, but we want ballanced bg
|
||||
uint32 j = BG_TEAM_ALLIANCE;
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
|
||||
j = BG_TEAM_HORDE;
|
||||
uint32 j = TEAM_ALLIANCE;
|
||||
if (m_SelectionPools[TEAM_HORDE].GetPlayerCount() < m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())
|
||||
j = TEAM_HORDE;
|
||||
if (sWorld->getIntConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
|
||||
&& m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers)
|
||||
&& m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers)
|
||||
{
|
||||
//we will try to invite more groups to team with less players indexed by j
|
||||
++(itr_team[j]); //this will not cause a crash, because for cycle above reached break;
|
||||
@@ -652,28 +661,28 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground* bg_template, Battleground
|
||||
break;
|
||||
}
|
||||
// do not allow to start bg with more than 2 players more on 1 faction
|
||||
if (abs((int32)(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())) > 2)
|
||||
if (abs((int32)(m_SelectionPools[TEAM_HORDE].GetPlayerCount() - m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())) > 2)
|
||||
return false;
|
||||
}
|
||||
//allow 1v0 if debug bg
|
||||
if (sBattlegroundMgr->isTesting() && bg_template->isBattleground() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()))
|
||||
if (sBattlegroundMgr->isTesting() && bg_template->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount()))
|
||||
return true;
|
||||
//return true if there are enough players in selection pools - enable to work .debug bg command correctly
|
||||
return m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
|
||||
}
|
||||
|
||||
// this method will check if we can invite players to same faction skirmish match
|
||||
bool BattlegroundQueue::CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam)
|
||||
{
|
||||
if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam)
|
||||
if (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam)
|
||||
return false;
|
||||
uint32 teamIndex = BG_TEAM_ALLIANCE;
|
||||
uint32 otherTeam = BG_TEAM_HORDE;
|
||||
uint32 teamIndex = TEAM_ALLIANCE;
|
||||
uint32 otherTeam = TEAM_HORDE;
|
||||
uint32 otherTeamId = HORDE;
|
||||
if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam)
|
||||
if (m_SelectionPools[TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam)
|
||||
{
|
||||
teamIndex = BG_TEAM_HORDE;
|
||||
otherTeam = BG_TEAM_ALLIANCE;
|
||||
teamIndex = TEAM_HORDE;
|
||||
otherTeam = TEAM_ALLIANCE;
|
||||
otherTeamId = ALLIANCE;
|
||||
}
|
||||
//clear other team's selection
|
||||
@@ -740,38 +749,32 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
||||
return;
|
||||
|
||||
//battleground with free slot for player should be always in the beggining of the queue
|
||||
// battleground with free slot for player should be always in the beggining of the queue
|
||||
// maybe it would be better to create bgfreeslotqueue for each bracket_id
|
||||
BGFreeSlotQueueType::iterator itr, next;
|
||||
for (itr = sBattlegroundMgr->BGFreeSlotQueue[bgTypeId].begin(); itr != sBattlegroundMgr->BGFreeSlotQueue[bgTypeId].end(); itr = next)
|
||||
BGFreeSlotQueueContainer& bgQueues = sBattlegroundMgr->GetBGFreeSlotQueueStore(bgTypeId);
|
||||
for (BGFreeSlotQueueContainer::iterator itr = bgQueues.begin(); itr != bgQueues.end();)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
// DO NOT allow queue manager to invite new player to arena
|
||||
if ((*itr)->isBattleground() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
|
||||
(*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
|
||||
Battleground* bg = *itr; ++itr;
|
||||
// DO NOT allow queue manager to invite new player to rated games
|
||||
if (!bg->isRated() && bg->GetTypeID() == bgTypeId && bg->GetBracketId() == bracket_id &&
|
||||
bg->GetStatus() > STATUS_WAIT_QUEUE && bg->GetStatus() < STATUS_WAIT_LEAVE)
|
||||
{
|
||||
Battleground* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
|
||||
// and iterator is invalid
|
||||
|
||||
// clear selection pools
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[BG_TEAM_HORDE].Init();
|
||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[TEAM_HORDE].Init();
|
||||
|
||||
// call a function that does the job for us
|
||||
FillPlayersToBG(bg, bracket_id);
|
||||
|
||||
// now everything is set, invite players
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++citr)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg, (*citr)->Team);
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++citr)
|
||||
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_HORDE].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg, (*citr)->Team);
|
||||
|
||||
if (!bg->HasFreeSlots())
|
||||
{
|
||||
// remove BG from BGFreeSlotQueue
|
||||
bg->RemoveFromBGFreeSlotQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -794,62 +797,38 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
|
||||
// get the min. players per team, properly for larger arenas as well. (must have full teams for arena matches!)
|
||||
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
|
||||
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
|
||||
if (sBattlegroundMgr->isTesting())
|
||||
MinPlayersPerTeam = 1;
|
||||
|
||||
if (bg_template->isArena())
|
||||
{
|
||||
if (sBattlegroundMgr->isArenaTesting())
|
||||
{
|
||||
MaxPlayersPerTeam = 1;
|
||||
MinPlayersPerTeam = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//this switch can be much shorter
|
||||
MaxPlayersPerTeam = arenaType;
|
||||
MinPlayersPerTeam = arenaType;
|
||||
/*switch (arenaType)
|
||||
{
|
||||
case ARENA_TYPE_2v2:
|
||||
MaxPlayersPerTeam = 2;
|
||||
MinPlayersPerTeam = 2;
|
||||
break;
|
||||
case ARENA_TYPE_3v3:
|
||||
MaxPlayersPerTeam = 3;
|
||||
MinPlayersPerTeam = 3;
|
||||
break;
|
||||
case ARENA_TYPE_5v5:
|
||||
MaxPlayersPerTeam = 5;
|
||||
MinPlayersPerTeam = 5;
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
MaxPlayersPerTeam = arenaType;
|
||||
MinPlayersPerTeam = sBattlegroundMgr->isArenaTesting() ? 1 : arenaType;
|
||||
}
|
||||
else if (sBattlegroundMgr->isTesting())
|
||||
MinPlayersPerTeam = 1;
|
||||
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[BG_TEAM_HORDE].Init();
|
||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[TEAM_HORDE].Init();
|
||||
|
||||
if (bg_template->isBattleground())
|
||||
{
|
||||
//check if there is premade against premade match
|
||||
if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam))
|
||||
{
|
||||
//create new battleground
|
||||
// create new battleground
|
||||
Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, 0, false);
|
||||
if (!bg2)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
|
||||
return;
|
||||
}
|
||||
//invite those selection pools
|
||||
// invite those selection pools
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg2, (*citr)->Team);
|
||||
//start bg
|
||||
|
||||
bg2->StartBattleground();
|
||||
//clear structures
|
||||
m_SelectionPools[BG_TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[BG_TEAM_HORDE].Init();
|
||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||
m_SelectionPools[TEAM_HORDE].Init();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +849,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
|
||||
|
||||
// invite those selection pools
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
||||
InviteGroupToBG((*citr), bg2, (*citr)->Team);
|
||||
// start bg
|
||||
bg2->StartBattleground();
|
||||
@@ -957,8 +936,8 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
|
||||
//if we have 2 teams, then start new arena and invite players!
|
||||
if (found == 2)
|
||||
{
|
||||
GroupQueueInfo* aTeam = *itr_teams[BG_TEAM_ALLIANCE];
|
||||
GroupQueueInfo* hTeam = *itr_teams[BG_TEAM_HORDE];
|
||||
GroupQueueInfo* aTeam = *itr_teams[TEAM_ALLIANCE];
|
||||
GroupQueueInfo* hTeam = *itr_teams[TEAM_HORDE];
|
||||
Battleground* arena = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, true);
|
||||
if (!arena)
|
||||
{
|
||||
@@ -977,12 +956,12 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
|
||||
if (aTeam->Team != ALLIANCE)
|
||||
{
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(aTeam);
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_teams[BG_TEAM_ALLIANCE]);
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_teams[TEAM_ALLIANCE]);
|
||||
}
|
||||
if (hTeam->Team != HORDE)
|
||||
{
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(hTeam);
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[BG_TEAM_HORDE]);
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[TEAM_HORDE]);
|
||||
}
|
||||
|
||||
arena->SetArenaMatchmakerRating(ALLIANCE, aTeam->ArenaMatchmakerRating);
|
||||
@@ -1017,7 +996,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue or in battleground
|
||||
{
|
||||
// check if player is invited to this bg
|
||||
BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
|
||||
BattlegroundQueue &bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
|
||||
{
|
||||
WorldPacket data;
|
||||
@@ -1058,7 +1037,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground
|
||||
{
|
||||
// check if player is in queue for this BG and if we are removing his invite event
|
||||
BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[m_BgQueueTypeId];
|
||||
BattlegroundQueue &bgQueue = sBattlegroundMgr->GetBattlegroundQueue(m_BgQueueTypeId);
|
||||
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", player->GetGUIDLow(), m_BgInstanceGUID);
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
#include "Battleground.h"
|
||||
#include "EventProcessor.h"
|
||||
|
||||
#include <deque>
|
||||
|
||||
//this container can't be deque, because deque doesn't like removing the last element - if you remove it, it invalidates next iterator and crash appears
|
||||
typedef std::list<Battleground*> BGFreeSlotQueueType;
|
||||
typedef std::list<Battleground*> BGFreeSlotQueueContainer;
|
||||
|
||||
#define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10
|
||||
|
||||
@@ -87,7 +89,7 @@ class BattlegroundQueue
|
||||
QueuedPlayersMap m_QueuedPlayers;
|
||||
|
||||
//we need constant add to begin and constant remove / add from the end, therefore deque suits our problem well
|
||||
typedef std::list<GroupQueueInfo*> GroupsQueueType;
|
||||
typedef std::deque<GroupQueueInfo*> GroupsQueueType;
|
||||
|
||||
/*
|
||||
This two dimensional array is used to store All queued groups
|
||||
@@ -117,7 +119,7 @@ class BattlegroundQueue
|
||||
|
||||
//one selection pool for horde, other one for alliance
|
||||
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
|
||||
|
||||
uint32 GetPlayersInQueue(TeamId id);
|
||||
private:
|
||||
|
||||
bool InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side);
|
||||
@@ -138,9 +140,8 @@ class BGQueueInviteEvent : public BasicEvent
|
||||
public:
|
||||
BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
|
||||
{
|
||||
};
|
||||
virtual ~BGQueueInviteEvent() {};
|
||||
{ }
|
||||
virtual ~BGQueueInviteEvent() { }
|
||||
|
||||
virtual bool Execute(uint64 e_time, uint32 p_time);
|
||||
virtual void Abort(uint64 e_time);
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundAA.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
|
||||
BattlegroundAA::BattlegroundAA()
|
||||
{
|
||||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundAA::~BattlegroundAA()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattlegroundAA::StartingEventCloseDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundAA::StartingEventOpenDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundAA::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattlegroundAAScore* sc = new BattlegroundAAScore;
|
||||
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattlegroundAA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundAA::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
void BattlegroundAA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
}
|
||||
|
||||
bool BattlegroundAA::SetupBattleground()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __BATTLEGROUNDAA_H
|
||||
#define __BATTLEGROUNDAA_H
|
||||
|
||||
class Battleground;
|
||||
|
||||
class BattlegroundAAScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundAAScore() {};
|
||||
virtual ~BattlegroundAAScore() {};
|
||||
//TODO fix me
|
||||
};
|
||||
|
||||
class BattlegroundAA : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundAA();
|
||||
~BattlegroundAA();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
};
|
||||
#endif
|
||||
@@ -16,12 +16,11 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "BattlegroundAB.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundAB.h"
|
||||
#include "Creature.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
@@ -119,17 +118,17 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
|
||||
if (m_ReputationScoreTics[team] >= m_ReputationTics)
|
||||
{
|
||||
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
|
||||
(team == TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
|
||||
m_ReputationScoreTics[team] -= m_ReputationTics;
|
||||
}
|
||||
if (m_HonorScoreTics[team] >= m_HonorTics)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == TEAM_ALLIANCE) ? ALLIANCE : HORDE);
|
||||
m_HonorScoreTics[team] -= m_HonorTics;
|
||||
}
|
||||
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
|
||||
{
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
if (team == TEAM_ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
@@ -139,9 +138,9 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
|
||||
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
|
||||
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
if (team == TEAM_ALLIANCE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
|
||||
if (team == BG_TEAM_HORDE)
|
||||
if (team == TEAM_HORDE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
|
||||
// update achievement flags
|
||||
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
||||
@@ -152,9 +151,9 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
}
|
||||
|
||||
// Test win condition
|
||||
if (m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
if (m_TeamScores[TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleground(ALLIANCE);
|
||||
if (m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
if (m_TeamScores[TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleground(HORDE);
|
||||
}
|
||||
}
|
||||
@@ -322,8 +321,8 @@ void BattlegroundAB::FillInitialWorldStates(WorldPacket& data)
|
||||
// Team scores
|
||||
data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE);
|
||||
data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE);
|
||||
data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[BG_TEAM_ALLIANCE]);
|
||||
data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[BG_TEAM_HORDE]);
|
||||
data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[TEAM_ALLIANCE]);
|
||||
data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[TEAM_HORDE]);
|
||||
|
||||
// other unknown
|
||||
data << uint32(0x745) << uint32(0x2); // 37 1861 unk
|
||||
@@ -364,6 +363,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
|
||||
if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
|
||||
++capturedNodes;
|
||||
}
|
||||
|
||||
if (capturedNodes >= 5)
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
|
||||
if (capturedNodes >= 4)
|
||||
@@ -440,7 +440,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
|
||||
return;
|
||||
}
|
||||
|
||||
BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam());
|
||||
TeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam());
|
||||
|
||||
// Check if player really could use this banner, not cheated
|
||||
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
|
||||
@@ -486,7 +486,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
|
||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: node names not localized
|
||||
if (teamIndex == BG_TEAM_ALLIANCE)
|
||||
if (teamIndex == TEAM_ALLIANCE)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
@@ -503,15 +503,15 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
|
||||
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
|
||||
_SendNodeUpdate(node);
|
||||
m_NodeTimers[node] = 0;
|
||||
_NodeOccupied(node, (teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE:HORDE);
|
||||
_NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE:HORDE);
|
||||
|
||||
// FIXME: node names not localized
|
||||
if (teamIndex == BG_TEAM_ALLIANCE)
|
||||
if (teamIndex == TEAM_ALLIANCE)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
}
|
||||
sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
}
|
||||
// If node is occupied, change to enemy-contested
|
||||
else
|
||||
@@ -528,19 +528,19 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
|
||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: node names not localized
|
||||
if (teamIndex == BG_TEAM_ALLIANCE)
|
||||
if (teamIndex == TEAM_ALLIANCE)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
|
||||
sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
}
|
||||
|
||||
// If node is occupied again, send "X has taken the Y" msg.
|
||||
if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
|
||||
{
|
||||
// FIXME: team and node names not localized
|
||||
if (teamIndex == BG_TEAM_ALLIANCE)
|
||||
if (teamIndex == TEAM_ALLIANCE)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node));
|
||||
@@ -552,14 +552,14 @@ bool BattlegroundAB::SetupBattleground()
|
||||
{
|
||||
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn some object Battleground not created!");
|
||||
@@ -576,9 +576,9 @@ bool BattlegroundAB::SetupBattleground()
|
||||
//buffs
|
||||
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
)
|
||||
sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn buff object!");
|
||||
}
|
||||
@@ -591,20 +591,20 @@ void BattlegroundAB::Reset()
|
||||
//call parent's class reset
|
||||
Battleground::Reset();
|
||||
|
||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||
m_lastTick[BG_TEAM_ALLIANCE] = 0;
|
||||
m_lastTick[BG_TEAM_HORDE] = 0;
|
||||
m_HonorScoreTics[BG_TEAM_ALLIANCE] = 0;
|
||||
m_HonorScoreTics[BG_TEAM_HORDE] = 0;
|
||||
m_ReputationScoreTics[BG_TEAM_ALLIANCE] = 0;
|
||||
m_ReputationScoreTics[BG_TEAM_HORDE] = 0;
|
||||
m_TeamScores[TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[TEAM_HORDE] = 0;
|
||||
m_lastTick[TEAM_ALLIANCE] = 0;
|
||||
m_lastTick[TEAM_HORDE] = 0;
|
||||
m_HonorScoreTics[TEAM_ALLIANCE] = 0;
|
||||
m_HonorScoreTics[TEAM_HORDE] = 0;
|
||||
m_ReputationScoreTics[TEAM_ALLIANCE] = 0;
|
||||
m_ReputationScoreTics[TEAM_HORDE] = 0;
|
||||
m_IsInformedNearVictory = false;
|
||||
bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
|
||||
m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks;
|
||||
m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks;
|
||||
m_TeamScores500Disadvantage[BG_TEAM_ALLIANCE] = false;
|
||||
m_TeamScores500Disadvantage[BG_TEAM_HORDE] = false;
|
||||
m_TeamScores500Disadvantage[TEAM_ALLIANCE] = false;
|
||||
m_TeamScores500Disadvantage[TEAM_HORDE] = false;
|
||||
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
@@ -621,12 +621,12 @@ void BattlegroundAB::Reset()
|
||||
|
||||
void BattlegroundAB::EndBattleground(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
// Win reward
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
// Complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
|
||||
@@ -635,7 +635,7 @@ void BattlegroundAB::EndBattleground(uint32 winner)
|
||||
|
||||
WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
|
||||
TeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
|
||||
|
||||
// Is there any occupied node for this team?
|
||||
std::vector<uint8> nodes;
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __BATTLEGROUNDAB_H
|
||||
#define __BATTLEGROUNDAB_H
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
enum BG_AB_WorldStates
|
||||
{
|
||||
@@ -236,13 +237,12 @@ struct BG_AB_BannerTimer
|
||||
uint8 teamIndex;
|
||||
};
|
||||
|
||||
class BattlegroundABScore : public BattlegroundScore
|
||||
struct BattlegroundABScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundABScore(): BasesAssaulted(0), BasesDefended(0) {};
|
||||
virtual ~BattlegroundABScore() {};
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
BattlegroundABScore(): BasesAssaulted(0), BasesDefended(0) { }
|
||||
~BattlegroundABScore() { }
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
};
|
||||
|
||||
class BattlegroundAB : public Battleground
|
||||
@@ -252,28 +252,28 @@ class BattlegroundAB : public Battleground
|
||||
~BattlegroundAB();
|
||||
|
||||
void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
virtual bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
bool SetupBattleground();
|
||||
void Reset();
|
||||
void EndBattleground(uint32 winner);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
/* Scorekeeping */
|
||||
virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
|
||||
/* Nodes occupying */
|
||||
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||
|
||||
/* achievement req. */
|
||||
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
|
||||
bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
|
||||
private:
|
||||
virtual void PostUpdateImpl(uint32 diff);
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
/* Gameobject spawning/despawning */
|
||||
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay);
|
||||
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex);
|
||||
@@ -306,4 +306,3 @@ class BattlegroundAB : public Battleground
|
||||
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT];
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "BattlegroundAV.h"
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundAV.h"
|
||||
#include "Miscellaneous/Formulas.h"
|
||||
#include "GameObject.h"
|
||||
#include "Miscellaneous/Language.h"
|
||||
@@ -242,17 +242,17 @@ void BattlegroundAV::UpdateScore(uint16 team, int16 points)
|
||||
uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde
|
||||
m_Team_Scores[teamindex] += points;
|
||||
|
||||
UpdateWorldState(((teamindex == BG_TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]);
|
||||
UpdateWorldState(((teamindex == TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]);
|
||||
if (points < 0)
|
||||
{
|
||||
if (m_Team_Scores[teamindex] < 1)
|
||||
{
|
||||
m_Team_Scores[teamindex]=0;
|
||||
EndBattleground(((teamindex == BG_TEAM_HORDE)?ALLIANCE:HORDE));
|
||||
EndBattleground(((teamindex == TEAM_HORDE)?ALLIANCE:HORDE));
|
||||
}
|
||||
else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
|
||||
{
|
||||
SendMessageToAll(teamindex == BG_TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamindex == BG_TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
SendMessageToAll(teamindex == TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamindex == TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
|
||||
PlaySoundToAll(AV_SOUND_NEAR_VICTORY);
|
||||
m_IsInformedNearVictory[teamindex] = true;
|
||||
}
|
||||
@@ -269,14 +269,30 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
|
||||
{
|
||||
type -= AV_CPLACE_MAX;
|
||||
cinfoid=uint16(BG_AV_StaticCreaturePos[type][4]);
|
||||
creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid][0], (type+AV_CPLACE_MAX), BG_AV_StaticCreatureInfo[cinfoid][1], BG_AV_StaticCreaturePos[type][0], BG_AV_StaticCreaturePos[type][1], BG_AV_StaticCreaturePos[type][2], BG_AV_StaticCreaturePos[type][3]);
|
||||
level = (BG_AV_StaticCreatureInfo[cinfoid][2] == BG_AV_StaticCreatureInfo[cinfoid][3]) ? BG_AV_StaticCreatureInfo[cinfoid][2] : urand(BG_AV_StaticCreatureInfo[cinfoid][2], BG_AV_StaticCreatureInfo[cinfoid][3]);
|
||||
creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid][0],
|
||||
(type+AV_CPLACE_MAX),
|
||||
BG_AV_StaticCreatureInfo[cinfoid][1],
|
||||
BG_AV_StaticCreaturePos[type][0],
|
||||
BG_AV_StaticCreaturePos[type][1],
|
||||
BG_AV_StaticCreaturePos[type][2],
|
||||
BG_AV_StaticCreaturePos[type][3]);
|
||||
level = (BG_AV_StaticCreatureInfo[cinfoid][2] == BG_AV_StaticCreatureInfo[cinfoid][3])
|
||||
? BG_AV_StaticCreatureInfo[cinfoid][2]
|
||||
: urand(BG_AV_StaticCreatureInfo[cinfoid][2], BG_AV_StaticCreatureInfo[cinfoid][3]);
|
||||
isStatic = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
creature = AddCreature(BG_AV_CreatureInfo[cinfoid][0], type, BG_AV_CreatureInfo[cinfoid][1], BG_AV_CreaturePos[type][0], BG_AV_CreaturePos[type][1], BG_AV_CreaturePos[type][2], BG_AV_CreaturePos[type][3]);
|
||||
level = (BG_AV_CreatureInfo[cinfoid][2] == BG_AV_CreatureInfo[cinfoid][3]) ? BG_AV_CreatureInfo[cinfoid][2] : urand(BG_AV_CreatureInfo[cinfoid][2], BG_AV_CreatureInfo[cinfoid][3]);
|
||||
creature = AddCreature(BG_AV_CreatureInfo[cinfoid][0],
|
||||
type,
|
||||
BG_AV_CreatureInfo[cinfoid][1],
|
||||
BG_AV_CreaturePos[type][0],
|
||||
BG_AV_CreaturePos[type][1],
|
||||
BG_AV_CreaturePos[type][2],
|
||||
BG_AV_CreaturePos[type][3]);
|
||||
level = (BG_AV_CreatureInfo[cinfoid][2] == BG_AV_CreatureInfo[cinfoid][3])
|
||||
? BG_AV_CreatureInfo[cinfoid][2]
|
||||
: urand(BG_AV_CreatureInfo[cinfoid][2], BG_AV_CreatureInfo[cinfoid][3]);
|
||||
}
|
||||
if (!creature)
|
||||
return NULL;
|
||||
@@ -329,7 +345,13 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
|
||||
}
|
||||
if (triggerSpawnID && newFaction)
|
||||
{
|
||||
if (Creature* trigger = AddCreature(WORLD_TRIGGER, triggerSpawnID, BG_AV_CreatureInfo[creature->GetEntry()][1], BG_AV_CreaturePos[triggerSpawnID][0], BG_AV_CreaturePos[triggerSpawnID][1], BG_AV_CreaturePos[triggerSpawnID][2], BG_AV_CreaturePos[triggerSpawnID][3]))
|
||||
if (Creature* trigger = AddCreature(WORLD_TRIGGER,
|
||||
triggerSpawnID,
|
||||
BG_AV_CreatureInfo[creature->GetEntry()][1],
|
||||
BG_AV_CreaturePos[triggerSpawnID][0],
|
||||
BG_AV_CreaturePos[triggerSpawnID][1],
|
||||
BG_AV_CreaturePos[triggerSpawnID][2],
|
||||
BG_AV_CreaturePos[triggerSpawnID][3]))
|
||||
{
|
||||
trigger->setFaction(newFaction);
|
||||
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
|
||||
@@ -433,15 +455,14 @@ void BattlegroundAV::AddPlayer(Player* player)
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
if (m_MaxLevel == 0)
|
||||
m_MaxLevel=(player->getLevel()%10 == 0)? player->getLevel() : (player->getLevel()-(player->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
|
||||
|
||||
}
|
||||
|
||||
void BattlegroundAV::EndBattleground(uint32 winner)
|
||||
{
|
||||
//calculate bonuskills for both teams:
|
||||
//first towers:
|
||||
uint8 kills[2]={0, 0}; //0=ally 1=horde
|
||||
uint8 rep[2]={0, 0}; //0=ally 1=horde
|
||||
uint8 kills[2] = {0, 0}; // 0 = Alliance 1 = Horde
|
||||
uint8 rep[2] = {0, 0}; // 0 = Alliance 1 = Horde
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
|
||||
{
|
||||
if (m_Nodes[i].State == POINT_CONTROLED)
|
||||
@@ -459,7 +480,7 @@ void BattlegroundAV::EndBattleground(uint32 winner)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i <= 1; i++) //0=ally 1=horde
|
||||
for (int i = TEAM_ALLIANCE; i <= TEAM_HORDE; ++i)
|
||||
{
|
||||
if (m_CaptainAlive[i])
|
||||
{
|
||||
@@ -467,9 +488,9 @@ void BattlegroundAV::EndBattleground(uint32 winner)
|
||||
rep[i] += BG_AV_REP_SURVIVING_CAPTAIN;
|
||||
}
|
||||
if (rep[i] != 0)
|
||||
RewardReputationToTeam((i == 0)?730:729, rep[i], (i == 0)?ALLIANCE:HORDE);
|
||||
RewardReputationToTeam(i == 0 ? 730 : 729, rep[i], i == 0 ? ALLIANCE : HORDE);
|
||||
if (kills[i] != 0)
|
||||
RewardHonorToTeam(GetBonusHonor(kills[i]), (i == 0)?ALLIANCE:HORDE);
|
||||
RewardHonorToTeam(GetBonusHonor(kills[i]), i == 0 ? ALLIANCE : HORDE);
|
||||
}
|
||||
|
||||
//TODO add enterevademode for all attacking creatures
|
||||
@@ -525,7 +546,6 @@ void BattlegroundAV::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
|
||||
void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
|
||||
if (itr == PlayerScores.end()) // player not found...
|
||||
return;
|
||||
@@ -565,7 +585,6 @@ void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
||||
|
||||
void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
||||
{
|
||||
|
||||
uint32 object = GetObjectThroughNode(node);
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av: player destroyed point node %i object %i", node, object);
|
||||
|
||||
@@ -587,8 +606,8 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
||||
for (uint8 i=0; i <= 9; i++)
|
||||
SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY);
|
||||
|
||||
UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, (-1)*BG_AV_RES_TOWER);
|
||||
RewardReputationToTeam((owner == ALLIANCE)?730:729, BG_AV_REP_TOWER, owner);
|
||||
UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, -1 * BG_AV_RES_TOWER);
|
||||
RewardReputationToTeam(owner == ALLIANCE ? 730 : 729, BG_AV_REP_TOWER, owner);
|
||||
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_TOWER), owner);
|
||||
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp), RESPAWN_ONE_DAY);
|
||||
@@ -625,8 +644,10 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
||||
}
|
||||
|
||||
void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
|
||||
{ //mine=0 northmine mine=1 southmin
|
||||
//changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
|
||||
{
|
||||
// mine=0 northmine mine=1 southmin
|
||||
// changing the owner results in setting respawntim to infinite for current creatures,
|
||||
// spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
|
||||
ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
|
||||
if (team != ALLIANCE && team != HORDE)
|
||||
team = AV_NEUTRAL_TEAM;
|
||||
@@ -689,16 +710,13 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
|
||||
for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MIN:AV_CPLACE_MINE_S_2_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MAX:AV_CPLACE_MINE_S_2_MAX); i++)
|
||||
AddAVCreature(miner+(urand(1, 2)), i);
|
||||
AddAVCreature(miner+3, (mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3);
|
||||
//because the gameobjects in this mine have changed, update all surrounding players:
|
||||
// for (uint16 i = ((mine == AV_NORTH_MINE)?BG_AV_OBJECT_MINE_SUPPLY_N_MIN:BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i <= ((mine == AV_NORTH_MINE)?BG_AV_OBJECT_MINE_SUPPLY_N_MAX:BG_AV_OBJECT_MINE_SUPPLY_N_MAX); i++)
|
||||
// {
|
||||
//TODO: add gameobject-update code
|
||||
// }
|
||||
|
||||
if (team == ALLIANCE || team == HORDE)
|
||||
{
|
||||
m_Mine_Reclaim_Timer[mine]=AV_MINE_RECLAIM_TIMER;
|
||||
char buf[256];
|
||||
sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
|
||||
sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH),
|
||||
(team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
|
||||
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
|
||||
if (creature)
|
||||
YellToAll(creature, buf, LANG_UNIVERSAL);
|
||||
@@ -748,7 +766,6 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
|
||||
DelCreature(node);
|
||||
if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "AV: couldn't spawn spiritguide at node %i", node);
|
||||
|
||||
}
|
||||
for (uint8 i=0; i<4; i++)
|
||||
AddAVCreature(creatureid, c_place+i);
|
||||
@@ -757,7 +774,15 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
|
||||
return;
|
||||
Creature* trigger = GetBGCreature(node + 302);//0-302 other creatures
|
||||
if (!trigger)
|
||||
trigger = AddCreature(WORLD_TRIGGER, node + 302, owner, BG_AV_CreaturePos[node + 302][0], BG_AV_CreaturePos[node + 302][1], BG_AV_CreaturePos[node + 302][2], BG_AV_CreaturePos[node + 302][3]);
|
||||
{
|
||||
trigger = AddCreature(WORLD_TRIGGER,
|
||||
node + 302,
|
||||
owner,
|
||||
BG_AV_CreaturePos[node + 302][0],
|
||||
BG_AV_CreaturePos[node + 302][1],
|
||||
BG_AV_CreaturePos[node + 302][2],
|
||||
BG_AV_CreaturePos[node + 302][3]);
|
||||
}
|
||||
|
||||
//add bonus honor aura trigger creature when node is accupied
|
||||
//cast bonus aura (+50% honor in 25yards)
|
||||
@@ -937,7 +962,8 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
||||
}
|
||||
//send a nice message to all :)
|
||||
char buf[256];
|
||||
sprintf(buf, GetTrinityString((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
|
||||
sprintf(buf, GetTrinityString((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),
|
||||
(team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
|
||||
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
|
||||
if (creature)
|
||||
YellToAll(creature, buf, LANG_UNIVERSAL);
|
||||
@@ -1051,7 +1077,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
|
||||
//send a nice message to all :)
|
||||
char buf[256];
|
||||
sprintf(buf, (IsTower(node)) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
|
||||
sprintf(buf, (IsTower(node)) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node),
|
||||
(team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
|
||||
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
|
||||
if (creature)
|
||||
YellToAll(creature, buf, LANG_UNIVERSAL);
|
||||
@@ -1193,9 +1220,13 @@ bool BattlegroundAV::SetupBattleground()
|
||||
// Create starting objects
|
||||
if (
|
||||
// alliance gates
|
||||
!AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, sin(BG_AV_DoorPositons[0][3]/2), cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY)
|
||||
!AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A,
|
||||
BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3],
|
||||
0, 0, std::sin(BG_AV_DoorPositons[0][3]/2), std::cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY)
|
||||
// horde gates
|
||||
|| !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3]/2), cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY))
|
||||
|| !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H,
|
||||
BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3],
|
||||
0, 0, std::sin(BG_AV_DoorPositons[1][3]/2), std::cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "BatteGroundAV: Failed to spawn some object Battleground not created!1");
|
||||
return false;
|
||||
@@ -1206,14 +1237,28 @@ bool BattlegroundAV::SetupBattleground()
|
||||
{
|
||||
if (i <= BG_AV_NODES_FROSTWOLF_HUT)
|
||||
{
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
//aura
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY))
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!2");
|
||||
return false;
|
||||
@@ -1223,12 +1268,24 @@ bool BattlegroundAV::SetupBattleground()
|
||||
{
|
||||
if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers
|
||||
{
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(i, BG_AV_OBJECTID_BANNER_A,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A,
|
||||
BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N,
|
||||
BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A,
|
||||
BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH,
|
||||
BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!3");
|
||||
return false;
|
||||
@@ -1236,12 +1293,24 @@ bool BattlegroundAV::SetupBattleground()
|
||||
}
|
||||
else //horde towers
|
||||
{
|
||||
if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(i+29, BG_AV_OBJECTID_BANNER_H,
|
||||
BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N,
|
||||
BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H,
|
||||
BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA,
|
||||
BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H,
|
||||
BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!4");
|
||||
return false;
|
||||
@@ -1249,7 +1318,17 @@ bool BattlegroundAV::SetupBattleground()
|
||||
}
|
||||
for (uint8 j=0; j <= 9; j++) //burning aura
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j,
|
||||
BG_AV_OBJECTID_FIRE,
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0],
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1],
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2],
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3],
|
||||
0,
|
||||
0,
|
||||
std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),
|
||||
std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),
|
||||
RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
|
||||
return false;
|
||||
@@ -1263,7 +1342,17 @@ bool BattlegroundAV::SetupBattleground()
|
||||
{
|
||||
if (j<5)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,
|
||||
BG_AV_OBJECTID_SMOKE,
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3],
|
||||
0,
|
||||
0,
|
||||
std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),
|
||||
std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),
|
||||
RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
|
||||
return false;
|
||||
@@ -1271,7 +1360,17 @@ bool BattlegroundAV::SetupBattleground()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,
|
||||
BG_AV_OBJECTID_FIRE,
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],
|
||||
BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3],
|
||||
0,
|
||||
0,
|
||||
std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),
|
||||
std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),
|
||||
RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
|
||||
return false;
|
||||
@@ -1281,7 +1380,17 @@ bool BattlegroundAV::SetupBattleground()
|
||||
}
|
||||
for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_N_MAX-BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i,
|
||||
BG_AV_OBJECTID_MINE_N,
|
||||
BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0],
|
||||
BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1],
|
||||
BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2],
|
||||
BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3],
|
||||
0,
|
||||
0,
|
||||
std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),
|
||||
std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),
|
||||
RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
|
||||
return false;
|
||||
@@ -1289,24 +1398,52 @@ bool BattlegroundAV::SetupBattleground()
|
||||
}
|
||||
for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i,
|
||||
BG_AV_OBJECTID_MINE_S,
|
||||
BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0],
|
||||
BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1],
|
||||
BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2],
|
||||
BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3],
|
||||
0,
|
||||
0,
|
||||
std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),
|
||||
std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),
|
||||
RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE,
|
||||
BG_AV_OBJECTID_BANNER_SNOWFALL_N,
|
||||
BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],
|
||||
BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],
|
||||
BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],
|
||||
BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],
|
||||
0,
|
||||
0,
|
||||
std::sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2),
|
||||
std::cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2),
|
||||
RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!8");
|
||||
return false;
|
||||
}
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A,
|
||||
BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA,
|
||||
BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H,
|
||||
BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH,
|
||||
BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],
|
||||
0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
|
||||
return false;
|
||||
@@ -1355,10 +1492,10 @@ bool BattlegroundAV::SetupBattleground()
|
||||
|
||||
//creatures
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes");
|
||||
for (i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
{
|
||||
if (m_Nodes[i].Owner)
|
||||
PopulateNode(BG_AV_Nodes(i));
|
||||
PopulateNode(i);
|
||||
}
|
||||
//all creatures which don't get despawned through the script are static
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning static creatures");
|
||||
@@ -1376,7 +1513,7 @@ bool BattlegroundAV::SetupBattleground()
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
|
||||
char const* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
|
||||
{
|
||||
switch (node)
|
||||
{
|
||||
@@ -1408,22 +1545,22 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, uint16 team)
|
||||
if (m_Nodes[node].TotalOwner == team)
|
||||
{
|
||||
sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is TotalOwner of node");
|
||||
ASSERT (false);
|
||||
ASSERT(false);
|
||||
}
|
||||
if (m_Nodes[node].Owner == team)
|
||||
{
|
||||
sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is owner of node");
|
||||
ASSERT (false);
|
||||
ASSERT(false);
|
||||
}
|
||||
if (m_Nodes[node].State == POINT_DESTROYED)
|
||||
{
|
||||
sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Destroyed node is being assaulted");
|
||||
ASSERT (false);
|
||||
ASSERT(false);
|
||||
}
|
||||
if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists
|
||||
{
|
||||
sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assault on an not assaulted node with total owner");
|
||||
ASSERT (false);
|
||||
ASSERT(false);
|
||||
}
|
||||
//the timer gets another time, if the previous owner was 0 == Neutral
|
||||
m_Nodes[node].Timer = (m_Nodes[node].PrevOwner)? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP;
|
||||
@@ -1471,6 +1608,7 @@ void BattlegroundAV::DefendNode(BG_AV_Nodes node, uint16 team)
|
||||
void BattlegroundAV::ResetBGSubclass()
|
||||
{
|
||||
m_MaxLevel=0;
|
||||
|
||||
for (uint8 i=0; i<2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south
|
||||
{
|
||||
for (uint8 j=0; j<9; j++)
|
||||
@@ -1482,6 +1620,7 @@ void BattlegroundAV::ResetBGSubclass()
|
||||
m_Mine_Owner[i] = AV_NEUTRAL_TEAM;
|
||||
m_Mine_PrevOwner[i] = m_Mine_Owner[i];
|
||||
}
|
||||
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves
|
||||
InitNode(i, ALLIANCE, false);
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef __BATTLEGROUNDAV_H
|
||||
#define __BATTLEGROUNDAV_H
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
#define LANG_BG_AV_A_CAPTAIN_BUFF "Begone. Uncouth scum! The Alliance shall prevail in Alterac Valley!"
|
||||
#define LANG_BG_AV_H_CAPTAIN_BUFF "Now is the time to attack! For the Horde!"
|
||||
@@ -96,7 +96,6 @@ horde:
|
||||
|
||||
AV_SOUND_ALLIANCE_CAPTAIN = 8232, //gets called when someone attacks them and at the beginning after 3min+rand(x)*10sec (maybe buff)
|
||||
AV_SOUND_HORDE_CAPTAIN = 8333
|
||||
|
||||
};
|
||||
|
||||
enum BG_AV_OTHER_VALUES
|
||||
@@ -986,7 +985,6 @@ const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] =
|
||||
|
||||
enum BG_AV_CreatureIds
|
||||
{
|
||||
|
||||
AV_NPC_A_TOWERDEFENSE = 0, // stormpike bowman
|
||||
AV_NPC_A_GRAVEDEFENSE0 = 1, // stormpike Defender
|
||||
AV_NPC_A_GRAVEDEFENSE1 = 2, // seasoned defender
|
||||
@@ -1038,7 +1036,6 @@ enum BG_AV_CreatureIds
|
||||
AV_NPC_S_MINE_H_4 = 46,
|
||||
AV_NPC_HERALD = 47,
|
||||
AV_NPC_INFO_MAX = 48
|
||||
|
||||
};
|
||||
|
||||
//entry, team, minlevel, maxlevel
|
||||
@@ -1100,7 +1097,6 @@ const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] =
|
||||
{13089, 67, 54, 55}, //guard
|
||||
{13088, 67, 58, 58},
|
||||
{14848, 67, 58, 58} //Herald
|
||||
|
||||
};
|
||||
|
||||
//x, y, z, o, static_creature_info-id
|
||||
@@ -1230,7 +1226,6 @@ const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] =
|
||||
{773.651f, -497.482f, 99.0408f, 2.11185f, 46 }, //14284 - Stormpike Battleguard
|
||||
{949.1f, -506.913f, 95.4237f, 3.31613f, 46 }, //14284 - Stormpike Battleguard
|
||||
{-1370.9f, -219.793f, 98.4258f, 5.04381f, 47}, //drek thar
|
||||
|
||||
};
|
||||
|
||||
const uint32 BG_AV_StaticCreatureInfo[51][4] =
|
||||
@@ -1439,7 +1434,6 @@ enum BG_AV_WorldStates
|
||||
AV_FROSTWOLFE_UNUSED = 1393,
|
||||
AV_FROSTWOLFW_UNUSED = 1392
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
//alliance_control neutral_control horde_control
|
||||
@@ -1531,18 +1525,17 @@ struct BG_AV_NodeInfo
|
||||
|
||||
inline BG_AV_Nodes &operator++(BG_AV_Nodes &i){ return i = BG_AV_Nodes(i + 1); }
|
||||
|
||||
class BattlegroundAVScore : public BattlegroundScore
|
||||
struct BattlegroundAVScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) {};
|
||||
virtual ~BattlegroundAVScore() {};
|
||||
uint32 GraveyardsAssaulted;
|
||||
uint32 GraveyardsDefended;
|
||||
uint32 TowersAssaulted;
|
||||
uint32 TowersDefended;
|
||||
uint32 MinesCaptured;
|
||||
uint32 LeadersKilled;
|
||||
uint32 SecondaryObjectives;
|
||||
BattlegroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) { }
|
||||
~BattlegroundAVScore() { }
|
||||
uint32 GraveyardsAssaulted;
|
||||
uint32 GraveyardsDefended;
|
||||
uint32 TowersAssaulted;
|
||||
uint32 TowersDefended;
|
||||
uint32 MinesCaptured;
|
||||
uint32 LeadersKilled;
|
||||
uint32 SecondaryObjectives;
|
||||
};
|
||||
|
||||
class BattlegroundAV : public Battleground
|
||||
@@ -1552,21 +1545,21 @@ class BattlegroundAV : public Battleground
|
||||
~BattlegroundAV();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
virtual void ResetBGSubclass();
|
||||
void ResetBGSubclass();
|
||||
|
||||
/*general stuff*/
|
||||
void UpdateScore(uint16 team, int16 points);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
/*handlestuff*/ //these are functions which get called from extern
|
||||
virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
void HandleKillUnit(Creature* unit, Player* killer);
|
||||
void HandleQuestComplete(uint32 questid, Player* player);
|
||||
@@ -1574,14 +1567,14 @@ class BattlegroundAV : public Battleground
|
||||
|
||||
void EndBattleground(uint32 winner);
|
||||
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
/* achievement req. */
|
||||
bool IsBothMinesControlledByTeam(uint32 team) const;
|
||||
bool IsAllTowersControlledAndCaptainAlive(uint32 team) const;
|
||||
|
||||
private:
|
||||
virtual void PostUpdateImpl(uint32 diff);
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
|
||||
/* Nodes occupying */
|
||||
void EventPlayerAssaultsPoint(Player* player, uint32 object);
|
||||
@@ -1598,7 +1591,7 @@ class BattlegroundAV : public Battleground
|
||||
|
||||
BG_AV_Nodes GetNodeThroughObject(uint32 object);
|
||||
uint32 GetObjectThroughNode(BG_AV_Nodes node);
|
||||
const char* GetNodeName(BG_AV_Nodes node);
|
||||
char const* GetNodeName(BG_AV_Nodes node);
|
||||
bool IsTower(BG_AV_Nodes node) { return m_Nodes[node].Tower; }
|
||||
|
||||
/*mine*/
|
||||
@@ -1629,8 +1622,6 @@ class BattlegroundAV : public Battleground
|
||||
|
||||
uint8 m_MaxLevel; //TODO remove this when battleground-getmaxlevel() returns something usefull
|
||||
bool m_IsInformedNearVictory[2];
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundBE.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
@@ -65,11 +64,7 @@ void BattlegroundBE::StartingEventOpenDoors()
|
||||
void BattlegroundBE::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattlegroundBEScore* sc = new BattlegroundBEScore;
|
||||
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore;
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __BATTLEGROUNDBE_H
|
||||
#define __BATTLEGROUNDBE_H
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
enum BattlegroundBEObjectTypes
|
||||
{
|
||||
@@ -41,13 +42,6 @@ enum BattlegroundBEObjects
|
||||
BG_BE_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
class BattlegroundBEScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundBEScore() {};
|
||||
virtual ~BattlegroundBEScore() {};
|
||||
};
|
||||
|
||||
class BattlegroundBE : public Battleground
|
||||
{
|
||||
public:
|
||||
@@ -55,15 +49,15 @@ class BattlegroundBE : public Battleground
|
||||
~BattlegroundBE();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
void Reset();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
|
||||
|
||||
@@ -16,13 +16,12 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundDS.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "GameObject.h"
|
||||
|
||||
BattlegroundDS::BattlegroundDS()
|
||||
{
|
||||
@@ -147,11 +146,7 @@ void BattlegroundDS::StartingEventOpenDoors()
|
||||
void BattlegroundDS::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattlegroundDSScore* score = new BattlegroundDSScore;
|
||||
|
||||
PlayerScores[player->GetGUID()] = score;
|
||||
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore;
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef __BATTLEGROUNDDS_H
|
||||
#define __BATTLEGROUNDDS_H
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
enum BattlegroundDSObjectTypes
|
||||
{
|
||||
@@ -79,14 +79,6 @@ enum BattlegroundDSData
|
||||
BG_DS_WATERFALL_STATUS_OFF = 3
|
||||
};
|
||||
|
||||
class BattlegroundDSScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundDSScore() {};
|
||||
virtual ~BattlegroundDSScore() {};
|
||||
//TODO fix me
|
||||
};
|
||||
|
||||
class BattlegroundDS : public Battleground
|
||||
{
|
||||
public:
|
||||
@@ -94,15 +86,15 @@ class BattlegroundDS : public Battleground
|
||||
~BattlegroundDS();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
void Reset();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
private:
|
||||
@@ -112,7 +104,7 @@ class BattlegroundDS : public Battleground
|
||||
uint32 _pipeKnockBackTimer;
|
||||
uint8 _pipeKnockBackCount;
|
||||
|
||||
virtual void PostUpdateImpl(uint32 diff);
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
protected:
|
||||
uint32 getWaterFallStatus() { return _waterfallStatus; };
|
||||
void setWaterFallStatus(uint8 status) { _waterfallStatus = status; };
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "BattlegroundEY.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundEY.h"
|
||||
#include "Creature.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
@@ -63,10 +62,10 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff)
|
||||
if (m_PointAddingTimer <= 0)
|
||||
{
|
||||
m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME;
|
||||
if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0)
|
||||
AddPoints(ALLIANCE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_ALLIANCE] - 1]);
|
||||
if (m_TeamPointsCount[BG_TEAM_HORDE] > 0)
|
||||
AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]);
|
||||
if (m_TeamPointsCount[TEAM_ALLIANCE] > 0)
|
||||
AddPoints(ALLIANCE, BG_EY_TickPoints[m_TeamPointsCount[TEAM_ALLIANCE] - 1]);
|
||||
if (m_TeamPointsCount[TEAM_HORDE] > 0)
|
||||
AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[TEAM_HORDE] - 1]);
|
||||
}
|
||||
|
||||
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
|
||||
@@ -128,7 +127,7 @@ void BattlegroundEY::StartingEventOpenDoors()
|
||||
|
||||
void BattlegroundEY::AddPoints(uint32 Team, uint32 Points)
|
||||
{
|
||||
BattlegroundTeamId team_index = GetTeamIndexByTeamId(Team);
|
||||
TeamId team_index = GetTeamIndexByTeamId(Team);
|
||||
m_TeamScores[team_index] += Points;
|
||||
m_HonorScoreTics[team_index] += Points;
|
||||
if (m_HonorScoreTics[team_index] >= m_HonorTics)
|
||||
@@ -136,7 +135,7 @@ void BattlegroundEY::AddPoints(uint32 Team, uint32 Points)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), Team);
|
||||
m_HonorScoreTics[team_index] -= m_HonorTics;
|
||||
}
|
||||
UpdateTeamScore(Team);
|
||||
UpdateTeamScore(team_index);
|
||||
}
|
||||
|
||||
void BattlegroundEY::CheckSomeoneJoinedPoint()
|
||||
@@ -281,10 +280,13 @@ void BattlegroundEY::UpdateTeamScore(uint32 Team)
|
||||
if (score >= BG_EY_MAX_TEAM_SCORE)
|
||||
{
|
||||
score = BG_EY_MAX_TEAM_SCORE;
|
||||
EndBattleground(Team);
|
||||
if (Team == TEAM_ALLIANCE)
|
||||
EndBattleground(ALLIANCE);
|
||||
else
|
||||
EndBattleground(HORDE);
|
||||
}
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
if (Team == TEAM_ALLIANCE)
|
||||
UpdateWorldState(EY_ALLIANCE_RESOURCES, score);
|
||||
else
|
||||
UpdateWorldState(EY_HORDE_RESOURCES, score);
|
||||
@@ -292,12 +294,12 @@ void BattlegroundEY::UpdateTeamScore(uint32 Team)
|
||||
|
||||
void BattlegroundEY::EndBattleground(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
// Win reward
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map reward
|
||||
// Complete map reward
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
|
||||
@@ -307,9 +309,9 @@ void BattlegroundEY::EndBattleground(uint32 winner)
|
||||
void BattlegroundEY::UpdatePointsCount(uint32 Team)
|
||||
{
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[BG_TEAM_ALLIANCE]);
|
||||
UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[TEAM_ALLIANCE]);
|
||||
else
|
||||
UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]);
|
||||
UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[TEAM_HORDE]);
|
||||
}
|
||||
|
||||
void BattlegroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
|
||||
@@ -516,12 +518,12 @@ void BattlegroundEY::Reset()
|
||||
//call parent's class reset
|
||||
Battleground::Reset();
|
||||
|
||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||
m_TeamPointsCount[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamPointsCount[BG_TEAM_HORDE] = 0;
|
||||
m_HonorScoreTics[BG_TEAM_ALLIANCE] = 0;
|
||||
m_HonorScoreTics[BG_TEAM_HORDE] = 0;
|
||||
m_TeamScores[TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[TEAM_HORDE] = 0;
|
||||
m_TeamPointsCount[TEAM_ALLIANCE] = 0;
|
||||
m_TeamPointsCount[TEAM_HORDE] = 0;
|
||||
m_HonorScoreTics[TEAM_ALLIANCE] = 0;
|
||||
m_HonorScoreTics[TEAM_HORDE] = 0;
|
||||
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
m_FlagCapturedBgObjectType = 0;
|
||||
m_FlagKeeper = 0;
|
||||
@@ -664,14 +666,14 @@ void BattlegroundEY::EventTeamLostPoint(Player* Source, uint32 Point)
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
{
|
||||
m_TeamPointsCount[BG_TEAM_ALLIANCE]--;
|
||||
m_TeamPointsCount[TEAM_ALLIANCE]--;
|
||||
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeAlliance, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeAlliance + 1, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeAlliance + 2, RESPAWN_ONE_DAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TeamPointsCount[BG_TEAM_HORDE]--;
|
||||
m_TeamPointsCount[TEAM_HORDE]--;
|
||||
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeHorde, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeHorde + 1, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeHorde + 2, RESPAWN_ONE_DAY);
|
||||
@@ -712,14 +714,14 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
{
|
||||
m_TeamPointsCount[BG_TEAM_ALLIANCE]++;
|
||||
m_TeamPointsCount[TEAM_ALLIANCE]++;
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 1, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 2, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TeamPointsCount[BG_TEAM_HORDE]++;
|
||||
m_TeamPointsCount[TEAM_HORDE]++;
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 1, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 2, RESPAWN_IMMEDIATELY);
|
||||
@@ -790,12 +792,12 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType
|
||||
uint8 team_id = 0;
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
team_id = BG_TEAM_ALLIANCE;
|
||||
team_id = TEAM_ALLIANCE;
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
}
|
||||
else
|
||||
{
|
||||
team_id = BG_TEAM_HORDE;
|
||||
team_id = TEAM_HORDE;
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
}
|
||||
|
||||
@@ -825,8 +827,8 @@ void BattlegroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
||||
|
||||
void BattlegroundEY::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_HORDE]);
|
||||
data << uint32(EY_ALLIANCE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_ALLIANCE]);
|
||||
data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[TEAM_HORDE]);
|
||||
data << uint32(EY_ALLIANCE_BASE) << uint32(m_TeamPointsCount[TEAM_ALLIANCE]);
|
||||
data << uint32(0xab6) << uint32(0x0);
|
||||
data << uint32(0xab5) << uint32(0x0);
|
||||
data << uint32(0xab4) << uint32(0x0);
|
||||
@@ -864,8 +866,8 @@ void BattlegroundEY::FillInitialWorldStates(WorldPacket& data)
|
||||
|
||||
data << uint32(0xad2) << uint32(0x1);
|
||||
data << uint32(0xad1) << uint32(0x1);
|
||||
data << uint32(0xabe) << uint32(GetTeamScore(HORDE));
|
||||
data << uint32(0xabd) << uint32(GetTeamScore(ALLIANCE));
|
||||
data << uint32(0xabe) << uint32(GetTeamScore(TEAM_HORDE));
|
||||
data << uint32(0xabd) << uint32(GetTeamScore(TEAM_ALLIANCE));
|
||||
data << uint32(0xa05) << uint32(0x8e);
|
||||
data << uint32(0xaa0) << uint32(0x0);
|
||||
data << uint32(0xa9f) << uint32(0x0);
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
#define __BATTLEGROUNDEY_H
|
||||
|
||||
#include "Language.h"
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
enum BG_EY_Misc
|
||||
{
|
||||
@@ -324,12 +323,11 @@ const BattlegroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] =
|
||||
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER)
|
||||
};
|
||||
|
||||
class BattlegroundEYScore : public BattlegroundScore
|
||||
struct BattlegroundEYScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundEYScore() : FlagCaptures(0) {};
|
||||
virtual ~BattlegroundEYScore() {};
|
||||
uint32 FlagCaptures;
|
||||
BattlegroundEYScore() : FlagCaptures(0) { }
|
||||
~BattlegroundEYScore() { }
|
||||
uint32 FlagCaptures;
|
||||
};
|
||||
|
||||
class BattlegroundEY : public Battleground
|
||||
@@ -339,9 +337,9 @@ class BattlegroundEY : public Battleground
|
||||
~BattlegroundEY();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
/* BG Flags */
|
||||
uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return m_FlagKeeper; }
|
||||
@@ -355,24 +353,24 @@ class BattlegroundEY : public Battleground
|
||||
void HandleBuffUse(uint64 buff_guid);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
virtual bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
bool SetupBattleground();
|
||||
void Reset();
|
||||
void UpdateTeamScore(uint32 Team);
|
||||
void EndBattleground(uint32 winner);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||
void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;}
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
void SetDroppedFlagGUID(uint64 guid, int32 /*TeamID*/ = -1) { m_DroppedFlagGUID = guid;}
|
||||
uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;}
|
||||
|
||||
/* Battleground Events */
|
||||
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||
virtual void EventPlayerDroppedFlag(Player* Source);
|
||||
void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||
void EventPlayerDroppedFlag(Player* Source);
|
||||
|
||||
/* achievement req. */
|
||||
bool IsAllNodesConrolledByTeam(uint32 team) const;
|
||||
private:
|
||||
virtual void PostUpdateImpl(uint32 diff);
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
|
||||
void EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType);
|
||||
void EventTeamCapturedPoint(Player* Source, uint32 Point);
|
||||
@@ -386,7 +384,6 @@ class BattlegroundEY : public Battleground
|
||||
void UpdatePointStatuses();
|
||||
|
||||
/* Scorekeeping */
|
||||
uint32 GetTeamScore(uint32 Team) const { return m_TeamScores[GetTeamIndexByTeamId(Team)]; }
|
||||
void AddPoints(uint32 Team, uint32 Points);
|
||||
|
||||
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
|
||||
|
||||
@@ -36,17 +36,17 @@ BattlegroundIC::BattlegroundIC()
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_IC_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_IC_HAS_BEGUN;
|
||||
|
||||
for (uint8 i = 0; i < 2; i++)
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
factionReinforcements[i] = MAX_REINFORCEMENTS;
|
||||
|
||||
for (uint8 i = 0; i < BG_IC_MAXDOOR; i++)
|
||||
for (uint8 i = 0; i < BG_IC_MAXDOOR; ++i)
|
||||
GateStatus[i] = BG_IC_GATE_OK;
|
||||
|
||||
closeFortressDoorsTimer = CLOSE_DOORS_TIME; // the doors are closed again... in a special way
|
||||
doorsClosed = false;
|
||||
resourceTimer = IC_RESOURCE_TIME;
|
||||
|
||||
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++)
|
||||
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; ++i)
|
||||
nodePoint[i] = nodePointInitial[i];
|
||||
|
||||
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
|
||||
@@ -91,13 +91,12 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var)
|
||||
if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT)
|
||||
return;
|
||||
|
||||
Player* player = ObjectAccessor::FindPlayer(var);
|
||||
|
||||
if (!player || !gunshipAlliance || !gunshipHorde)
|
||||
if (!gunshipAlliance || !gunshipHorde)
|
||||
return;
|
||||
|
||||
player->CastSpell(player, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell.
|
||||
player->CastSpell(player, SPELL_SLOW_FALL, true);
|
||||
Player* player = ObjectAccessor::FindPlayer(var);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
player->SetTransport(player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
|
||||
|
||||
@@ -106,7 +105,15 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var)
|
||||
player->m_movementInfo.t_pos.m_positionZ = TransportMovementInfo.GetPositionZ();
|
||||
player->m_movementInfo.t_guid = (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
|
||||
|
||||
player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(), TeleportToTransportPosition.GetPositionY(), TeleportToTransportPosition.GetPositionZ(), TeleportToTransportPosition.GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
|
||||
if (player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(),
|
||||
TeleportToTransportPosition.GetPositionY(),
|
||||
TeleportToTransportPosition.GetPositionZ(),
|
||||
TeleportToTransportPosition.GetOrientation(),
|
||||
TELE_TO_NOT_LEAVE_TRANSPORT))
|
||||
{
|
||||
player->CastSpell(player, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell.
|
||||
player->CastSpell(player, SPELL_SLOW_FALL, true);
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
@@ -129,7 +136,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
} else closeFortressDoorsTimer -= diff;
|
||||
}
|
||||
|
||||
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++)
|
||||
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; ++i)
|
||||
{
|
||||
if (nodePoint[i].nodeType == NODE_TYPE_DOCKS)
|
||||
{
|
||||
@@ -139,7 +146,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
if (docksTimer <= diff)
|
||||
{
|
||||
// we need to confirm this, i am not sure if this every 3 minutes
|
||||
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); u++)
|
||||
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); ++u)
|
||||
{
|
||||
if (Creature* catapult = GetBGCreature(u))
|
||||
{
|
||||
@@ -149,7 +156,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
}
|
||||
|
||||
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
|
||||
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); u++)
|
||||
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); ++u)
|
||||
{
|
||||
if (Creature* glaiveThrower = GetBGCreature(u))
|
||||
{
|
||||
@@ -187,7 +194,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
}
|
||||
|
||||
// we need to confirm if it is every 3 minutes
|
||||
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); u++)
|
||||
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); ++u)
|
||||
{
|
||||
if (Creature* demolisher = GetBGCreature(u))
|
||||
{
|
||||
@@ -236,7 +243,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
|
||||
if (resourceTimer <= diff)
|
||||
{
|
||||
for (uint8 i = 0; i < NODE_TYPE_DOCKS; i++)
|
||||
for (uint8 i = 0; i < NODE_TYPE_DOCKS; ++i)
|
||||
{
|
||||
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
|
||||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
|
||||
@@ -270,13 +277,15 @@ void BattlegroundIC::StartingEventOpenDoors()
|
||||
DoorOpen(BG_IC_GO_DOODAD_VR_PORTCULLIS01_1);
|
||||
DoorOpen(BG_IC_GO_DOODAD_VR_PORTCULLIS01_2);
|
||||
|
||||
for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; i++)
|
||||
for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; ++i)
|
||||
{
|
||||
if (!AddObject(BG_IC_Teleporters[i].type, BG_IC_Teleporters[i].entry,
|
||||
BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y,
|
||||
BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o,
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y,
|
||||
BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o,
|
||||
0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +296,7 @@ bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const
|
||||
for (int i = 0; i < NODE_TYPE_WORKSHOP; ++i)
|
||||
{
|
||||
if (nodePoint[i].nodeState == controlledState)
|
||||
count++;
|
||||
++count;
|
||||
}
|
||||
|
||||
return count == NODE_TYPE_WORKSHOP;
|
||||
@@ -296,10 +305,7 @@ bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const
|
||||
void BattlegroundIC::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattlegroundICScore* sc = new BattlegroundICScore;
|
||||
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundICScore;
|
||||
|
||||
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
|
||||
player->CastSpell(player, SPELL_QUARRY, true);
|
||||
@@ -354,19 +360,19 @@ void BattlegroundIC::FillInitialWorldStates(WorldPacket& data)
|
||||
data << uint32(BG_IC_ALLIANCE_RENFORT) << uint32(factionReinforcements[TEAM_ALLIANCE]);
|
||||
data << uint32(BG_IC_HORDE_RENFORT) << uint32(factionReinforcements[TEAM_HORDE]);
|
||||
|
||||
for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; i++)
|
||||
for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; ++i)
|
||||
{
|
||||
uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED ? true : false));
|
||||
data << uint32(uws) << uint32(1);
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_NODE_TYPES; i++)
|
||||
for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
|
||||
data << uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]) << uint32(1);
|
||||
}
|
||||
|
||||
bool BattlegroundIC::SetupBattleground()
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; i++)
|
||||
for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; ++i)
|
||||
{
|
||||
if (!AddObject(BG_IC_ObjSpawnlocs[i].type, BG_IC_ObjSpawnlocs[i].entry,
|
||||
BG_IC_ObjSpawnlocs[i].x, BG_IC_ObjSpawnlocs[i].y,
|
||||
@@ -378,7 +384,7 @@ bool BattlegroundIC::SetupBattleground()
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_NORMAL_NPCS_SPAWNS; i++)
|
||||
for (uint8 i = 2; i < MAX_NORMAL_NPCS_SPAWNS; ++i)
|
||||
{
|
||||
if (!AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].team,
|
||||
BG_IC_NpcSpawnlocs[i].x, BG_IC_NpcSpawnlocs[i].y,
|
||||
@@ -416,13 +422,13 @@ bool BattlegroundIC::SetupBattleground()
|
||||
}
|
||||
|
||||
// setting correct factions for Keep Cannons
|
||||
for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i < BG_IC_NPC_KEEP_CANNON_12; i++)
|
||||
for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i < BG_IC_NPC_KEEP_CANNON_12; ++i)
|
||||
GetBGCreature(i)->setFaction(BG_IC_Factions[0]);
|
||||
for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i < BG_IC_NPC_KEEP_CANNON_25; i++)
|
||||
for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i < BG_IC_NPC_KEEP_CANNON_25; ++i)
|
||||
GetBGCreature(i)->setFaction(BG_IC_Factions[1]);
|
||||
|
||||
// correcting spawn time for keeps bombs
|
||||
for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; i++)
|
||||
for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; ++i)
|
||||
GetBGObject(i)->SetRespawnTime(10);
|
||||
|
||||
return true;
|
||||
@@ -502,7 +508,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
|
||||
return;
|
||||
|
||||
// All the node points are iterated to find the clicked one
|
||||
for (uint8 i = 0; i < MAX_NODE_TYPES; i++)
|
||||
for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
|
||||
{
|
||||
if (nodePoint[i].gameobject_entry == target_obj->GetEntry())
|
||||
{
|
||||
@@ -589,7 +595,7 @@ void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* nodePoint)
|
||||
uint32 worldstate = nodePoint->worldStates[nodePoint->nodeState];
|
||||
|
||||
// with this we are sure we dont bug the client
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
UpdateWorldState(nodePoint->worldStates[i], 0);
|
||||
|
||||
UpdateWorldState(worldstate, 1);
|
||||
@@ -627,7 +633,7 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
|
||||
if (gunshipAlliance && gunshipHorde)
|
||||
(nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap());
|
||||
|
||||
for (uint8 u = BG_IC_GO_HANGAR_TELEPORTER_1; u < BG_IC_GO_HANGAR_TELEPORTER_3; u++)
|
||||
for (uint8 u = BG_IC_GO_HANGAR_TELEPORTER_1; u < BG_IC_GO_HANGAR_TELEPORTER_3; ++u)
|
||||
DelObject(u);
|
||||
}
|
||||
}
|
||||
@@ -650,7 +656,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
if (!gunshipAlliance || !gunshipHorde)
|
||||
break;
|
||||
|
||||
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; u++)
|
||||
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1+u;
|
||||
AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL),
|
||||
@@ -682,7 +688,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
docksTimer = DOCKS_UPDATE_TIME;
|
||||
|
||||
// we must del opposing faction vehicles when the node is captured (unused ones)
|
||||
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); i++)
|
||||
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); ++i)
|
||||
{
|
||||
if (Creature* glaiveThrower = GetBGCreature(i))
|
||||
{
|
||||
@@ -694,7 +700,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); i++)
|
||||
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); ++i)
|
||||
{
|
||||
if (Creature* catapult = GetBGCreature(i))
|
||||
{
|
||||
@@ -707,7 +713,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
}
|
||||
|
||||
// spawning glaive throwers
|
||||
for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; i++)
|
||||
for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++i)
|
||||
{
|
||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
|
||||
|
||||
@@ -722,7 +728,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
}
|
||||
|
||||
// spawning catapults
|
||||
for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; i++)
|
||||
for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++i)
|
||||
{
|
||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
|
||||
|
||||
@@ -744,7 +750,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
if (!recapture)
|
||||
{
|
||||
// we must del opposing faction vehicles when the node is captured (unused ones)
|
||||
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); i++)
|
||||
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); ++i)
|
||||
{
|
||||
if (Creature* demolisher = GetBGCreature(i))
|
||||
{
|
||||
@@ -757,7 +763,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; i++)
|
||||
for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++i)
|
||||
{
|
||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
|
||||
|
||||
@@ -800,7 +806,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; i++)
|
||||
for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; ++i)
|
||||
{
|
||||
AddObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i, GO_SEAFORIUM_BOMBS,
|
||||
workshopBombs[i].GetPositionX(), workshopBombs[i].GetPositionY(),
|
||||
@@ -837,6 +843,12 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case GO_HORDE_GATE_1:
|
||||
if (!AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].team,
|
||||
BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].o,
|
||||
RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry);
|
||||
}
|
||||
lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED;
|
||||
break;
|
||||
case GO_HORDE_GATE_2:
|
||||
@@ -848,6 +860,12 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
|
||||
lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_3:
|
||||
if (!AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].team,
|
||||
BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].o,
|
||||
RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry);
|
||||
}
|
||||
lang_entry = LANG_BG_IC_SOUTH_GATE_DESTROYED;
|
||||
break;
|
||||
default:
|
||||
@@ -864,7 +882,7 @@ void BattlegroundIC::EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/
|
||||
|
||||
WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
|
||||
TeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
|
||||
|
||||
// Is there any occupied node for this team?
|
||||
std::vector<uint8> nodes;
|
||||
@@ -941,7 +959,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
|
||||
//If we someday decide to use the grid to track transports, here:
|
||||
t->SetMap(GetBgMap());
|
||||
|
||||
for (uint8 i = 0; i < 5; i++)
|
||||
for (uint8 i = 0; i < 5; ++i)
|
||||
t->AddNPCPassenger(0, (goEntry == GO_HORDE_GUNSHIP ? NPC_HORDE_GUNSHIP_CANNON : NPC_ALLIANCE_GUNSHIP_CANNON), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionX() : allianceGunshipPassengers[i].GetPositionX()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionY() : allianceGunshipPassengers[i].GetPositionY()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionZ() : allianceGunshipPassengers[i].GetPositionZ()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetOrientation() : allianceGunshipPassengers[i].GetOrientation()));
|
||||
|
||||
return t;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef __BATTLEGROUNDIC_H
|
||||
#define __BATTLEGROUNDIC_H
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
const uint32 BG_IC_Factions[2] =
|
||||
{
|
||||
@@ -185,12 +185,12 @@ enum gameobjectsIC
|
||||
|
||||
enum Times
|
||||
{
|
||||
WORKSHOP_UPDATE_TIME = 180000, // 3 minutes
|
||||
DOCKS_UPDATE_TIME = 180000, // not sure if it is 3 minutes
|
||||
IC_RESOURCE_TIME = 45000, // not sure, need more research
|
||||
CLOSE_DOORS_TIME = 20000,
|
||||
WORKSHOP_UPDATE_TIME = 180000, // 3 minutes
|
||||
DOCKS_UPDATE_TIME = 180000, // not sure if it is 3 minutes
|
||||
IC_RESOURCE_TIME = 45000, // not sure, need more research
|
||||
CLOSE_DOORS_TIME = 20000,
|
||||
BANNER_STATE_CHANGE_TIME = 60000,
|
||||
TRANSPORT_PERIOD_TIME = 120000
|
||||
TRANSPORT_PERIOD_TIME = 120000
|
||||
};
|
||||
|
||||
enum Actions
|
||||
@@ -654,18 +654,15 @@ const Position workshopBombs[2] =
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_OIL_REFINERY = 68719,
|
||||
SPELL_QUARRY = 68720,
|
||||
|
||||
SPELL_PARACHUTE = 66656,
|
||||
SPELL_SLOW_FALL = 12438,
|
||||
|
||||
SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357,
|
||||
|
||||
SPELL_DRIVING_CREDIT_DEMOLISHER = 68365,
|
||||
SPELL_DRIVING_CREDIT_GLAIVE = 68363,
|
||||
SPELL_DRIVING_CREDIT_SIEGE = 68364,
|
||||
SPELL_DRIVING_CREDIT_CATAPULT = 68362
|
||||
SPELL_OIL_REFINERY = 68719,
|
||||
SPELL_QUARRY = 68720,
|
||||
SPELL_PARACHUTE = 66656,
|
||||
SPELL_SLOW_FALL = 12438,
|
||||
SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357,
|
||||
SPELL_DRIVING_CREDIT_DEMOLISHER = 68365,
|
||||
SPELL_DRIVING_CREDIT_GLAIVE = 68363,
|
||||
SPELL_DRIVING_CREDIT_SIEGE = 68364,
|
||||
SPELL_DRIVING_CREDIT_CATAPULT = 68362,
|
||||
};
|
||||
|
||||
enum BG_IC_Objectives
|
||||
@@ -847,13 +844,12 @@ enum HonorRewards
|
||||
WINNER_HONOR_AMOUNT = 500
|
||||
};
|
||||
|
||||
class BattlegroundICScore : public BattlegroundScore
|
||||
struct BattlegroundICScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundICScore() : BasesAssaulted(0), BasesDefended(0) {};
|
||||
virtual ~BattlegroundICScore() {};
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
BattlegroundICScore() : BasesAssaulted(0), BasesDefended(0) { }
|
||||
~BattlegroundICScore() { }
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
};
|
||||
|
||||
class BattlegroundIC : public Battleground
|
||||
@@ -863,10 +859,10 @@ class BattlegroundIC : public Battleground
|
||||
~BattlegroundIC();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
virtual void PostUpdateImpl(uint32 diff);
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
@@ -880,7 +876,7 @@ class BattlegroundIC : public Battleground
|
||||
void EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType);
|
||||
void DestroyGate(Player* player, GameObject* go);
|
||||
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
@@ -889,11 +885,11 @@ class BattlegroundIC : public Battleground
|
||||
|
||||
void DoAction(uint32 action, uint64 var);
|
||||
|
||||
virtual void HandlePlayerResurrect(Player* player);
|
||||
void HandlePlayerResurrect(Player* player);
|
||||
|
||||
uint32 GetNodeState(uint8 nodeType) { return (uint8)nodePoint[nodeType].nodeState; }
|
||||
uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; }
|
||||
|
||||
virtual bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
|
||||
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
|
||||
private:
|
||||
uint32 closeFortressDoorsTimer;
|
||||
bool doorsClosed;
|
||||
@@ -959,4 +955,5 @@ class BattlegroundIC : public Battleground
|
||||
Transport* CreateTransport(uint32 goEntry, uint32 period);
|
||||
void SendTransportInit(Player* player);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundNA.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
@@ -62,11 +61,7 @@ void BattlegroundNA::StartingEventOpenDoors()
|
||||
void BattlegroundNA::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattlegroundNAScore* sc = new BattlegroundNAScore;
|
||||
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore;
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
@@ -147,13 +142,3 @@ bool BattlegroundNA::SetupBattleground()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
20:12:14 id:036668 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86
|
||||
0000: 2f 02 00 00 72 0e 00 00 00 00 00 00 09 00 11 0a | /...r...........
|
||||
0010: 00 00 01 00 00 00 0f 0a 00 00 00 00 00 00 10 0a | ................
|
||||
0020: 00 00 00 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................
|
||||
0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................
|
||||
0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................
|
||||
0050: 00 00 00 00 00 00 | ......
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef __BATTLEGROUNDNA_H
|
||||
#define __BATTLEGROUNDNA_H
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
enum BattlegroundNAObjectTypes
|
||||
{
|
||||
@@ -41,14 +41,6 @@ enum BattlegroundNAObjects
|
||||
BG_NA_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
class BattlegroundNAScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundNAScore() {};
|
||||
virtual ~BattlegroundNAScore() {};
|
||||
//TODO fix me
|
||||
};
|
||||
|
||||
class BattlegroundNA : public Battleground
|
||||
{
|
||||
public:
|
||||
@@ -56,15 +48,15 @@ class BattlegroundNA : public Battleground
|
||||
~BattlegroundNA();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
void Reset();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool HandlePlayerUnderMap(Player* player);
|
||||
};
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Player.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundRB.h"
|
||||
#include "Language.h"
|
||||
|
||||
BattlegroundRB::BattlegroundRB()
|
||||
{
|
||||
//TODO FIX ME!
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundRB::~BattlegroundRB()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattlegroundRB::StartingEventCloseDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundRB::StartingEventOpenDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundRB::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattlegroundRBScore* sc = new BattlegroundRBScore;
|
||||
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattlegroundRB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
|
||||
{
|
||||
}
|
||||
|
||||
void BattlegroundRB::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
}
|
||||
|
||||
void BattlegroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
std::map<uint64, BattlegroundScore*>::iterator itr = PlayerScores.find(Source->GetGUID());
|
||||
|
||||
if (itr == PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __BATTLEGROUNDRB_H
|
||||
#define __BATTLEGROUNDRB_H
|
||||
|
||||
class Battleground;
|
||||
|
||||
class BattlegroundRBScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundRBScore() {};
|
||||
virtual ~BattlegroundRBScore() {};
|
||||
};
|
||||
|
||||
class BattlegroundRB : public Battleground
|
||||
{
|
||||
public:
|
||||
BattlegroundRB();
|
||||
~BattlegroundRB();
|
||||
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
@@ -16,7 +16,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundRL.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
@@ -62,11 +61,7 @@ void BattlegroundRL::StartingEventOpenDoors()
|
||||
void BattlegroundRL::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattlegroundRLScore* sc = new BattlegroundRLScore;
|
||||
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore;
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
@@ -145,13 +140,3 @@ bool BattlegroundRL::SetupBattleground()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Packet S->C, id 600, SMSG_INIT_WORLD_STATES (706), len 86
|
||||
0000: 3C 02 00 00 80 0F 00 00 00 00 00 00 09 00 BA 0B | <...............
|
||||
0010: 00 00 01 00 00 00 B9 0B 00 00 02 00 00 00 B8 0B | ................
|
||||
0020: 00 00 00 00 00 00 D8 08 00 00 00 00 00 00 D7 08 | ................
|
||||
0030: 00 00 00 00 00 00 D6 08 00 00 00 00 00 00 D5 08 | ................
|
||||
0040: 00 00 00 00 00 00 D3 08 00 00 00 00 00 00 D4 08 | ................
|
||||
0050: 00 00 00 00 00 00 | ......
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef __BATTLEGROUNDRL_H
|
||||
#define __BATTLEGROUNDRL_H
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
enum BattlegroundRLObjectTypes
|
||||
{
|
||||
@@ -37,14 +37,6 @@ enum BattlegroundRLObjects
|
||||
BG_RL_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
class BattlegroundRLScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundRLScore() {};
|
||||
virtual ~BattlegroundRLScore() {};
|
||||
//TODO fix me
|
||||
};
|
||||
|
||||
class BattlegroundRL : public Battleground
|
||||
{
|
||||
public:
|
||||
@@ -52,11 +44,11 @@ class BattlegroundRL : public Battleground
|
||||
~BattlegroundRL();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void AddPlayer(Player* player);
|
||||
void Reset();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
|
||||
@@ -32,17 +32,13 @@ BattlegroundRV::BattlegroundRV()
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
// we must set messageIds
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattlegroundRV::~BattlegroundRV()
|
||||
{
|
||||
|
||||
}
|
||||
BattlegroundRV::~BattlegroundRV() { }
|
||||
|
||||
void BattlegroundRV::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
@@ -103,10 +99,7 @@ void BattlegroundRV::StartingEventOpenDoors()
|
||||
void BattlegroundRV::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattlegroundRVScore* sc = new BattlegroundRVScore;
|
||||
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore;
|
||||
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef __BATTLEGROUNDRV_H
|
||||
#define __BATTLEGROUNDRV_H
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
enum BattlegroundRVObjectTypes
|
||||
{
|
||||
@@ -91,13 +91,6 @@ enum BattlegroundRVData
|
||||
BG_RV_WORLD_STATE = 0xe1a
|
||||
};
|
||||
|
||||
class BattlegroundRVScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundRVScore() {};
|
||||
virtual ~BattlegroundRVScore() {};
|
||||
};
|
||||
|
||||
class BattlegroundRV : public Battleground
|
||||
{
|
||||
public:
|
||||
@@ -105,11 +98,11 @@ class BattlegroundRV : public Battleground
|
||||
~BattlegroundRV();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
void Reset();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
@@ -122,7 +115,7 @@ class BattlegroundRV : public Battleground
|
||||
uint32 State;
|
||||
bool PillarCollision;
|
||||
|
||||
virtual void PostUpdateImpl(uint32 diff);
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
|
||||
protected:
|
||||
uint32 getTimer() { return Timer; };
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundSA.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
@@ -56,8 +55,8 @@ void BattlegroundSA::Reset()
|
||||
GateStatus[i] = BG_SA_GATE_OK;
|
||||
ShipsStarted = false;
|
||||
gateDestroyed = false;
|
||||
_notEvenAScratch[BG_TEAM_ALLIANCE] = true;
|
||||
_notEvenAScratch[BG_TEAM_HORDE] = true;
|
||||
_notEvenAScratch[TEAM_ALLIANCE] = true;
|
||||
_notEvenAScratch[TEAM_HORDE] = true;
|
||||
Status = BG_SA_WARMUP;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,12 @@
|
||||
#ifndef __BATTLEGROUNDSA_H
|
||||
#define __BATTLEGROUNDSA_H
|
||||
|
||||
class Battleground;
|
||||
#include "Battleground.h"
|
||||
|
||||
class BattlegroundSAScore : public BattlegroundScore
|
||||
struct BattlegroundSAScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) {};
|
||||
virtual ~BattlegroundSAScore() {};
|
||||
BattlegroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) { }
|
||||
~BattlegroundSAScore() { }
|
||||
uint8 demolishers_destroyed;
|
||||
uint8 gates_destroyed;
|
||||
};
|
||||
@@ -444,25 +443,25 @@ class BattlegroundSA : public Battleground
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
/// Called when a player join battle
|
||||
virtual void AddPlayer(Player* player);
|
||||
void AddPlayer(Player* player);
|
||||
/// Called when battle start
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
/// Called for ini battleground, after that the first player be entered
|
||||
virtual bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
bool SetupBattleground();
|
||||
void Reset();
|
||||
/// Called for generate packet contain worldstate data
|
||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
/// Called when a player deal damage to building (door)
|
||||
virtual void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType);
|
||||
void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType);
|
||||
/// Called when a player kill a unit in bg
|
||||
virtual void HandleKillUnit(Creature* creature, Player* killer);
|
||||
void HandleKillUnit(Creature* creature, Player* killer);
|
||||
/// Return the nearest graveyard where player can respawn
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
/// Called when a player click on flag (graveyard flag)
|
||||
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||
void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||
/// Called when a player use a gamobject (relic)
|
||||
virtual void EventPlayerUsedGO(Player* Source, GameObject* object);
|
||||
void EventPlayerUsedGO(Player* Source, GameObject* object);
|
||||
/// Return gate id, relative to bg data, according to gameobject id
|
||||
uint32 getGateIdFromDamagedOrDestroyEventId(uint32 id)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundWS.h"
|
||||
#include "Creature.h"
|
||||
#include "GameObject.h"
|
||||
@@ -67,18 +66,18 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
if (GetStartTime() >= 27*MINUTE*IN_MILLISECONDS)
|
||||
{
|
||||
if (GetTeamScore(ALLIANCE) == 0)
|
||||
if (GetTeamScore(TEAM_ALLIANCE) == 0)
|
||||
{
|
||||
if (GetTeamScore(HORDE) == 0) // No one scored - result is tie
|
||||
EndBattleground(0);
|
||||
if (GetTeamScore(TEAM_HORDE) == 0) // No one scored - result is tie
|
||||
EndBattleground(WINNER_NONE);
|
||||
else // Horde has more points and thus wins
|
||||
EndBattleground(HORDE);
|
||||
}
|
||||
else if (GetTeamScore(HORDE) == 0)
|
||||
else if (GetTeamScore(TEAM_HORDE) == 0)
|
||||
EndBattleground(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
|
||||
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag
|
||||
else if (GetTeamScore(TEAM_HORDE) == GetTeamScore(TEAM_ALLIANCE)) // Team score equal, winner is team that scored the last flag
|
||||
EndBattleground(_lastFlagCaptureTeam);
|
||||
else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
|
||||
else if (GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE)) // Last but not least, check who has the higher score
|
||||
EndBattleground(HORDE);
|
||||
else
|
||||
EndBattleground(ALLIANCE);
|
||||
@@ -90,48 +89,52 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, 25 - _minutesElapsed);
|
||||
}
|
||||
|
||||
if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
_flagsTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
_flagsTimer[TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if (_flagsTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
if (_flagsTimer[TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
_flagsTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
_flagsTimer[TEAM_ALLIANCE] = 0;
|
||||
RespawnFlag(ALLIANCE, true);
|
||||
}
|
||||
}
|
||||
if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
_flagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if (_flagsDropTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
_flagsDropTimer[TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if (_flagsDropTimer[TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
_flagsDropTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
_flagsDropTimer[TEAM_ALLIANCE] = 0;
|
||||
RespawnFlagAfterDrop(ALLIANCE);
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
}
|
||||
if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
_flagsTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if (_flagsTimer[BG_TEAM_HORDE] < 0)
|
||||
if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
_flagsTimer[TEAM_HORDE] -= diff;
|
||||
|
||||
if (_flagsTimer[TEAM_HORDE] < 0)
|
||||
{
|
||||
_flagsTimer[BG_TEAM_HORDE] = 0;
|
||||
_flagsTimer[TEAM_HORDE] = 0;
|
||||
RespawnFlag(HORDE, true);
|
||||
}
|
||||
}
|
||||
if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
_flagsDropTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if (_flagsDropTimer[BG_TEAM_HORDE] < 0)
|
||||
if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
_flagsDropTimer[TEAM_HORDE] -= diff;
|
||||
|
||||
if (_flagsDropTimer[TEAM_HORDE] < 0)
|
||||
{
|
||||
_flagsDropTimer[BG_TEAM_HORDE] = 0;
|
||||
_flagsDropTimer[TEAM_HORDE] = 0;
|
||||
RespawnFlagAfterDrop(HORDE);
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_bothFlagsKept)
|
||||
{
|
||||
_flagSpellForceTimer += diff;
|
||||
@@ -224,12 +227,12 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
|
||||
if (Team == ALLIANCE)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Alliance flag");
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Horde flag");
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
}
|
||||
|
||||
if (captured)
|
||||
@@ -267,7 +270,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
|
||||
else
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
|
||||
|
||||
SetDroppedFlagGUID(0, team);
|
||||
SetDroppedFlagGUID(0, GetTeamIndexByTeamId(team));
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
|
||||
@@ -281,36 +284,36 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!this->IsHordeFlagPickedup())
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// horde flag in base (but not respawned yet)
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Horde Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(TEAM_ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(ALLIANCE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this->IsAllianceFlagPickedup())
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// alliance flag in base (but not respawned yet)
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Alliance Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(TEAM_HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(HORDE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
|
||||
@@ -327,17 +330,17 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
|
||||
UpdateFlagState(Source->GetTeam(), 1); // flag state none
|
||||
UpdateTeamScore(Source->GetTeam());
|
||||
UpdateTeamScore(Source->GetTeamId());
|
||||
// only flag capture should be updated
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
|
||||
// update last flag capture to be used if teamscore is equal
|
||||
SetLastFlagCapture(Source->GetTeam());
|
||||
|
||||
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(TEAM_ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = ALLIANCE;
|
||||
|
||||
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = HORDE;
|
||||
|
||||
if (winner)
|
||||
@@ -365,9 +368,9 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
// just take off the aura
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!this->IsHordeFlagPickedup())
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
|
||||
if (GetFlagPickerGUID(TEAM_HORDE) == Source->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
@@ -375,9 +378,9 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this->IsAllianceFlagPickedup())
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
|
||||
if (GetFlagPickerGUID(TEAM_ALLIANCE) == Source->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
@@ -392,7 +395,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
|
||||
if (GetFlagPickerGUID(TEAM_HORDE) == Source->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
@@ -400,7 +403,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
|
||||
set = true;
|
||||
}
|
||||
@@ -409,7 +412,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
{
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
|
||||
if (GetFlagPickerGUID(TEAM_ALLIANCE) == Source->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
@@ -417,7 +420,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
|
||||
set = true;
|
||||
}
|
||||
@@ -460,7 +463,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
|
||||
SetAllianceFlagPicker(Source->GetGUID());
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
|
||||
@@ -479,7 +482,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
|
||||
SetHordeFlagPicker(Source->GetGUID());
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
|
||||
@@ -490,7 +493,8 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
}
|
||||
|
||||
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
|
||||
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
|
||||
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)
|
||||
&& target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
|
||||
{
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
@@ -511,7 +515,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
|
||||
SetAllianceFlagPicker(Source->GetGUID());
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
@@ -524,7 +528,8 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
}
|
||||
|
||||
//Horde flag on ground(not in base) (returned or picked up again)
|
||||
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
|
||||
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)
|
||||
&& target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
|
||||
{
|
||||
if (Source->GetTeam() == HORDE)
|
||||
{
|
||||
@@ -545,7 +550,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
|
||||
SetHordeFlagPicker(Source->GetGUID());
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
@@ -567,27 +572,27 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
|
||||
{
|
||||
// sometimes flag aura not removed :(
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[TEAM_ALLIANCE] == guid)
|
||||
{
|
||||
if (!player)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!");
|
||||
this->SetAllianceFlagPicker(0);
|
||||
this->RespawnFlag(ALLIANCE, false);
|
||||
SetAllianceFlagPicker(0);
|
||||
RespawnFlag(ALLIANCE, false);
|
||||
}
|
||||
else
|
||||
this->EventPlayerDroppedFlag(player);
|
||||
EventPlayerDroppedFlag(player);
|
||||
}
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[TEAM_HORDE] == guid)
|
||||
{
|
||||
if (!player)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!");
|
||||
this->SetHordeFlagPicker(0);
|
||||
this->RespawnFlag(HORDE, false);
|
||||
SetHordeFlagPicker(0);
|
||||
RespawnFlag(HORDE, false);
|
||||
}
|
||||
else
|
||||
this->EventPlayerDroppedFlag(player);
|
||||
EventPlayerDroppedFlag(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,7 +606,7 @@ void BattlegroundWS::UpdateFlagState(uint32 team, uint32 value)
|
||||
|
||||
void BattlegroundWS::UpdateTeamScore(uint32 team)
|
||||
{
|
||||
if (team == ALLIANCE)
|
||||
if (team == TEAM_ALLIANCE)
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team));
|
||||
else
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
|
||||
@@ -635,13 +640,13 @@ void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
//buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
||||
break;
|
||||
case 3646: // Alliance Flag spawn
|
||||
if (_flagState[BG_TEAM_HORDE] && !_flagState[BG_TEAM_ALLIANCE])
|
||||
if (GetFlagPickerGUID(BG_TEAM_HORDE) == player->GetGUID())
|
||||
if (_flagState[TEAM_HORDE] && !_flagState[TEAM_ALLIANCE])
|
||||
if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID())
|
||||
EventPlayerCapturedFlag(player);
|
||||
break;
|
||||
case 3647: // Horde Flag spawn
|
||||
if (_flagState[BG_TEAM_ALLIANCE] && !_flagState[BG_TEAM_HORDE])
|
||||
if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == player->GetGUID())
|
||||
if (_flagState[TEAM_ALLIANCE] && !_flagState[TEAM_HORDE])
|
||||
if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID())
|
||||
EventPlayerCapturedFlag(player);
|
||||
break;
|
||||
case 3649: // unk1
|
||||
@@ -712,17 +717,14 @@ void BattlegroundWS::Reset()
|
||||
//call parent's class reset
|
||||
Battleground::Reset();
|
||||
|
||||
m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
|
||||
m_FlagKeepers[BG_TEAM_HORDE] = 0;
|
||||
|
||||
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
|
||||
m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
|
||||
|
||||
_flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
|
||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||
m_FlagKeepers[TEAM_ALLIANCE] = 0;
|
||||
m_FlagKeepers[TEAM_HORDE] = 0;
|
||||
m_DroppedFlagGUID[TEAM_ALLIANCE] = 0;
|
||||
m_DroppedFlagGUID[TEAM_HORDE] = 0;
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
m_TeamScores[TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[TEAM_HORDE] = 0;
|
||||
|
||||
if (sBattlegroundMgr->IsBGWeekend(GetTypeID()))
|
||||
{
|
||||
@@ -736,25 +738,25 @@ void BattlegroundWS::Reset()
|
||||
m_HonorWinKills = 1;
|
||||
m_HonorEndKills = 2;
|
||||
}
|
||||
_minutesElapsed = 0;
|
||||
_lastFlagCaptureTeam = 0;
|
||||
_bothFlagsKept = false;
|
||||
_flagDebuffState = 0;
|
||||
_flagSpellForceTimer = 0;
|
||||
_flagsDropTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
_flagsDropTimer[BG_TEAM_HORDE] = 0;
|
||||
_flagsTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
_flagsTimer[BG_TEAM_HORDE] = 0;
|
||||
_minutesElapsed = 0;
|
||||
_lastFlagCaptureTeam = 0;
|
||||
_bothFlagsKept = false;
|
||||
_flagDebuffState = 0;
|
||||
_flagSpellForceTimer = 0;
|
||||
_flagsDropTimer[TEAM_ALLIANCE] = 0;
|
||||
_flagsDropTimer[TEAM_HORDE] = 0;
|
||||
_flagsTimer[TEAM_ALLIANCE] = 0;
|
||||
_flagsTimer[TEAM_HORDE] = 0;
|
||||
}
|
||||
|
||||
void BattlegroundWS::EndBattleground(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
// Win reward
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
// Complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
|
||||
|
||||
@@ -773,7 +775,6 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer)
|
||||
|
||||
void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
|
||||
if (itr == PlayerScores.end()) // player not found
|
||||
return;
|
||||
@@ -819,36 +820,41 @@ WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveYard(Player* player)
|
||||
|
||||
void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(TEAM_ALLIANCE));
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(TEAM_HORDE));
|
||||
|
||||
if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1);
|
||||
else if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
else if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0);
|
||||
|
||||
if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1);
|
||||
else if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
else if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0);
|
||||
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(BG_WS_MAX_TEAM_SCORE);
|
||||
|
||||
if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1);
|
||||
data << uint32(BG_WS_STATE_TIMER) << uint32(25-_minutesElapsed);
|
||||
}
|
||||
else
|
||||
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0);
|
||||
|
||||
if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1);
|
||||
|
||||
if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1);
|
||||
|
||||
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1);
|
||||
data << uint32(BG_WS_STATE_TIMER) << uint32(25 - _minutesElapsed);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,13 +146,12 @@ enum BG_WS_Objectives
|
||||
|
||||
#define WS_EVENT_START_BATTLE 8563
|
||||
|
||||
class BattlegroundWGScore : public BattlegroundScore
|
||||
struct BattlegroundWGScore : public BattlegroundScore
|
||||
{
|
||||
public:
|
||||
BattlegroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
|
||||
virtual ~BattlegroundWGScore() {};
|
||||
uint32 FlagCaptures;
|
||||
uint32 FlagReturns;
|
||||
BattlegroundWGScore() : FlagCaptures(0), FlagReturns(0) { }
|
||||
~BattlegroundWGScore() { }
|
||||
uint32 FlagCaptures;
|
||||
uint32 FlagReturns;
|
||||
};
|
||||
|
||||
class BattlegroundWS : public Battleground
|
||||
@@ -163,48 +162,52 @@ class BattlegroundWS : public Battleground
|
||||
~BattlegroundWS();
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player* player);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void AddPlayer(Player* player);
|
||||
void StartingEventCloseDoors();
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
/* BG Flags */
|
||||
uint64 GetFlagPickerGUID(int32 team) const
|
||||
{
|
||||
if (team == BG_TEAM_ALLIANCE || team == BG_TEAM_HORDE)
|
||||
if (team == TEAM_ALLIANCE || team == TEAM_HORDE)
|
||||
return m_FlagKeepers[team];
|
||||
return 0;
|
||||
}
|
||||
void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; }
|
||||
void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_HORDE] = guid; }
|
||||
bool IsAllianceFlagPickedup() const { return m_FlagKeepers[BG_TEAM_ALLIANCE] != 0; }
|
||||
bool IsHordeFlagPickedup() const { return m_FlagKeepers[BG_TEAM_HORDE] != 0; }
|
||||
void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_ALLIANCE] = guid; }
|
||||
void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_HORDE] = guid; }
|
||||
bool IsAllianceFlagPickedup() const { return m_FlagKeepers[TEAM_ALLIANCE] != 0; }
|
||||
bool IsHordeFlagPickedup() const { return m_FlagKeepers[TEAM_HORDE] != 0; }
|
||||
void RespawnFlag(uint32 Team, bool captured);
|
||||
void RespawnFlagAfterDrop(uint32 Team);
|
||||
uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; }
|
||||
|
||||
/* Battleground Events */
|
||||
virtual void EventPlayerDroppedFlag(Player* Source);
|
||||
virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||
virtual void EventPlayerCapturedFlag(Player* Source);
|
||||
void EventPlayerDroppedFlag(Player* Source);
|
||||
void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||
void EventPlayerCapturedFlag(Player* Source);
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool SetupBattleground();
|
||||
virtual void Reset();
|
||||
void Reset();
|
||||
void EndBattleground(uint32 winner);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
void UpdateFlagState(uint32 team, uint32 value);
|
||||
void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; }
|
||||
void UpdateTeamScore(uint32 team);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
|
||||
void SetDroppedFlagGUID(uint64 guid, int32 team = -1)
|
||||
{
|
||||
if (team == TEAM_ALLIANCE || team == TEAM_HORDE)
|
||||
m_DroppedFlagGUID[team] = guid;
|
||||
}
|
||||
|
||||
uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];}
|
||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
|
||||
/* Scorekeeping */
|
||||
uint32 GetTeamScore(uint32 TeamID) const { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; }
|
||||
void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; }
|
||||
void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; }
|
||||
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
|
||||
@@ -224,7 +227,6 @@ class BattlegroundWS : public Battleground
|
||||
uint8 _flagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault
|
||||
uint8 _minutesElapsed;
|
||||
|
||||
virtual void PostUpdateImpl(uint32 diff);
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
|
||||
if (db_BannedList)
|
||||
{
|
||||
Tokens tokens(db_BannedList, ' ');
|
||||
Tokens::iterator iter;
|
||||
Tokenizer tokens(db_BannedList, ' ');
|
||||
Tokenizer::const_iterator iter;
|
||||
for (iter = tokens.begin(); iter != tokens.end(); ++iter)
|
||||
{
|
||||
uint64 banned_guid = atol(*iter);
|
||||
|
||||
@@ -158,7 +158,7 @@ void HostileReference::addThreat(float modThreat)
|
||||
void HostileReference::addThreatPercent(int32 percent)
|
||||
{
|
||||
float tmpThreat = iThreat;
|
||||
AddPctN(tmpThreat, percent);
|
||||
AddPct(tmpThreat, percent);
|
||||
addThreat(tmpThreat - iThreat);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,14 +100,14 @@ void LoadDisables()
|
||||
|
||||
if (flags & SPELL_DISABLE_MAP)
|
||||
{
|
||||
Tokens tokens(params_0, ',');
|
||||
Tokenizer tokens(params_0, ',');
|
||||
for (uint8 i = 0; i < tokens.size(); )
|
||||
data.params[0].insert(atoi(tokens[i++]));
|
||||
}
|
||||
|
||||
if (flags & SPELL_DISABLE_AREA)
|
||||
{
|
||||
Tokens tokens(params_1, ',');
|
||||
Tokenizer tokens(params_1, ',');
|
||||
for (uint8 i = 0; i < tokens.size(); )
|
||||
data.params[1].insert(atoi(tokens[i++]));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "DBCStores.h"
|
||||
|
||||
#include "Containers.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SocialMgr.h"
|
||||
|
||||
@@ -630,7 +630,7 @@ void Creature::RegenerateMana()
|
||||
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
if ((*i)->GetMiscValue() == POWER_MANA)
|
||||
AddPctN(addvalue, (*i)->GetAmount());
|
||||
AddPct(addvalue, (*i)->GetAmount());
|
||||
|
||||
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
|
||||
|
||||
@@ -667,7 +667,7 @@ void Creature::RegenerateHealth()
|
||||
// Apply modifiers (if any).
|
||||
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
AddPctN(addvalue, (*i)->GetAmount());
|
||||
AddPct(addvalue, (*i)->GetAmount());
|
||||
|
||||
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
|
||||
|
||||
|
||||
@@ -225,8 +225,8 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
|
||||
float angle = itr->second->follow_angle;
|
||||
float dist = itr->second->follow_dist;
|
||||
|
||||
float dx = x + cos(angle + pathangle) * dist;
|
||||
float dy = y + sin(angle + pathangle) * dist;
|
||||
float dx = x + std::cos(angle + pathangle) * dist;
|
||||
float dy = y + std::sin(angle + pathangle) * dist;
|
||||
float dz = z;
|
||||
|
||||
Trinity::NormalizeMapCoord(dx);
|
||||
|
||||
@@ -1153,8 +1153,8 @@ void GameObject::Use(Unit* user)
|
||||
// the distance between this slot and the center of the go - imagine a 1D space
|
||||
float relativeDistance = (info->size*itr->first)-(info->size*(info->chair.slots-1)/2.0f);
|
||||
|
||||
float x_i = GetPositionX() + relativeDistance * cos(orthogonalOrientation);
|
||||
float y_i = GetPositionY() + relativeDistance * sin(orthogonalOrientation);
|
||||
float x_i = GetPositionX() + relativeDistance * std::cos(orthogonalOrientation);
|
||||
float y_i = GetPositionY() + relativeDistance * std::sin(orthogonalOrientation);
|
||||
|
||||
if (itr->second)
|
||||
{
|
||||
@@ -1701,8 +1701,8 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const
|
||||
if (!info)
|
||||
return IsWithinDist3d(x, y, z, radius);
|
||||
|
||||
float sinA = sin(GetOrientation());
|
||||
float cosA = cos(GetOrientation());
|
||||
float sinA = std::sin(GetOrientation());
|
||||
float cosA = std::cos(GetOrientation());
|
||||
float dx = x - GetPositionX();
|
||||
float dy = y - GetPositionY();
|
||||
float dz = z - GetPositionZ();
|
||||
@@ -1751,17 +1751,17 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3
|
||||
{
|
||||
static double const atan_pow = atan(pow(2.0f, -20.0f));
|
||||
|
||||
double f_rot1 = sin(GetOrientation() / 2.0f);
|
||||
double f_rot2 = cos(GetOrientation() / 2.0f);
|
||||
double f_rot1 = std::sin(GetOrientation() / 2.0f);
|
||||
double f_rot2 = std::cos(GetOrientation() / 2.0f);
|
||||
|
||||
int64 i_rot1 = int64(f_rot1 / atan_pow *(f_rot2 >= 0 ? 1.0f : -1.0f));
|
||||
int64 rotation = (i_rot1 << 43 >> 43) & 0x00000000001FFFFF;
|
||||
|
||||
//float f_rot2 = sin(0.0f / 2.0f);
|
||||
//float f_rot2 = std::sin(0.0f / 2.0f);
|
||||
//int64 i_rot2 = f_rot2 / atan(pow(2.0f, -20.0f));
|
||||
//rotation |= (((i_rot2 << 22) >> 32) >> 11) & 0x000003FFFFE00000;
|
||||
|
||||
//float f_rot3 = sin(0.0f / 2.0f);
|
||||
//float f_rot3 = std::sin(0.0f / 2.0f);
|
||||
//int64 i_rot3 = f_rot3 / atan(pow(2.0f, -21.0f));
|
||||
//rotation |= (i_rot3 >> 42) & 0x7FFFFC0000000000;
|
||||
|
||||
|
||||
@@ -424,7 +424,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
Tokens tokens(fields[4].GetString(), ' ', MAX_ITEM_PROTO_SPELLS);
|
||||
Tokenizer tokens(fields[4].GetString(), ' ', MAX_ITEM_PROTO_SPELLS);
|
||||
if (tokens.size() == MAX_ITEM_PROTO_SPELLS)
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
SetSpellCharges(i, atoi(tokens[i]));
|
||||
|
||||
@@ -772,7 +772,7 @@ void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 cou
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
Tokens tokens(data, ' ', count);
|
||||
Tokenizer tokens(data, ' ', count);
|
||||
|
||||
if (tokens.size() != count)
|
||||
return;
|
||||
@@ -1511,8 +1511,8 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
|
||||
|
||||
void Position::RelocateOffset(const Position & offset)
|
||||
{
|
||||
m_positionX = GetPositionX() + (offset.GetPositionX() * cos(GetOrientation()) + offset.GetPositionY() * sin(GetOrientation() + M_PI));
|
||||
m_positionY = GetPositionY() + (offset.GetPositionY() * cos(GetOrientation()) + offset.GetPositionX() * sin(GetOrientation()));
|
||||
m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + M_PI));
|
||||
m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
|
||||
m_positionZ = GetPositionZ() + offset.GetPositionZ();
|
||||
m_orientation = GetOrientation() + offset.GetOrientation();
|
||||
}
|
||||
@@ -1522,8 +1522,8 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset
|
||||
float dx = endPos.GetPositionX() - GetPositionX();
|
||||
float dy = endPos.GetPositionY() - GetPositionY();
|
||||
|
||||
retOffset.m_positionX = dx * cos(GetOrientation()) + dy * sin(GetOrientation());
|
||||
retOffset.m_positionY = dy * cos(GetOrientation()) - dx * sin(GetOrientation());
|
||||
retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation());
|
||||
retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation());
|
||||
retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
|
||||
retOffset.m_orientation = endPos.GetOrientation() - GetOrientation();
|
||||
}
|
||||
@@ -1555,8 +1555,8 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
|
||||
if (fabs(dx) < 0.001f && fabs(dy) < 0.001f)
|
||||
{
|
||||
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
|
||||
vcos = cos(angle);
|
||||
vsin = sin(angle);
|
||||
vcos = std::cos(angle);
|
||||
vsin = std::sin(angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1605,7 +1605,7 @@ bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2,
|
||||
float angle = obj1->GetAngle(obj2);
|
||||
|
||||
// not using sqrt() for performance
|
||||
return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + cos(angle) * dist, obj1->GetPositionY() + sin(angle) * dist);
|
||||
return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + std::cos(angle) * dist, obj1->GetPositionY() + std::sin(angle) * dist);
|
||||
}
|
||||
|
||||
bool WorldObject::isInFront(WorldObject const* target, float arc) const
|
||||
@@ -1630,8 +1630,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran
|
||||
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
|
||||
float new_dist = (float)rand_norm()*static_cast<float>(distance);
|
||||
|
||||
rand_x = pos.m_positionX + new_dist * cos(angle);
|
||||
rand_y = pos.m_positionY + new_dist * sin(angle);
|
||||
rand_x = pos.m_positionX + new_dist * std::cos(angle);
|
||||
rand_y = pos.m_positionY + new_dist * std::sin(angle);
|
||||
rand_z = pos.m_positionZ;
|
||||
|
||||
Trinity::NormalizeMapCoord(rand_x);
|
||||
@@ -2649,8 +2649,8 @@ namespace Trinity
|
||||
|
||||
void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle) const
|
||||
{
|
||||
x = GetPositionX() + (GetObjectSize() + distance2d) * cos(absAngle);
|
||||
y = GetPositionY() + (GetObjectSize() + distance2d) * sin(absAngle);
|
||||
x = GetPositionX() + (GetObjectSize() + distance2d) * std::cos(absAngle);
|
||||
y = GetPositionY() + (GetObjectSize() + distance2d) * std::sin(absAngle);
|
||||
|
||||
Trinity::NormalizeMapCoord(x);
|
||||
Trinity::NormalizeMapCoord(y);
|
||||
@@ -2785,8 +2785,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
|
||||
{
|
||||
angle += m_orientation;
|
||||
float destx, desty, destz, ground, floor;
|
||||
destx = pos.m_positionX + dist * cos(angle);
|
||||
desty = pos.m_positionY + dist * sin(angle);
|
||||
destx = pos.m_positionX + dist * std::cos(angle);
|
||||
desty = pos.m_positionY + dist * std::sin(angle);
|
||||
|
||||
// Prevent invalid coordinates here, position is unchanged
|
||||
if (!Trinity::IsValidMapCoord(destx, desty, pos.m_positionZ))
|
||||
@@ -2806,8 +2806,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
|
||||
// do not allow too big z changes
|
||||
if (fabs(pos.m_positionZ - destz) > 6)
|
||||
{
|
||||
destx -= step * cos(angle);
|
||||
desty -= step * sin(angle);
|
||||
destx -= step * std::cos(angle);
|
||||
desty -= step * std::sin(angle);
|
||||
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
|
||||
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
|
||||
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;
|
||||
@@ -2831,8 +2831,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
|
||||
angle += m_orientation;
|
||||
float destx, desty, destz, ground, floor;
|
||||
pos.m_positionZ += 2.0f;
|
||||
destx = pos.m_positionX + dist * cos(angle);
|
||||
desty = pos.m_positionY + dist * sin(angle);
|
||||
destx = pos.m_positionX + dist * std::cos(angle);
|
||||
desty = pos.m_positionY + dist * std::sin(angle);
|
||||
|
||||
// Prevent invalid coordinates here, position is unchanged
|
||||
if (!Trinity::IsValidMapCoord(destx, desty))
|
||||
@@ -2851,8 +2851,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
|
||||
if (col)
|
||||
{
|
||||
// move back a bit
|
||||
destx -= CONTACT_DISTANCE * cos(angle);
|
||||
desty -= CONTACT_DISTANCE * sin(angle);
|
||||
destx -= CONTACT_DISTANCE * std::cos(angle);
|
||||
desty -= CONTACT_DISTANCE * std::sin(angle);
|
||||
dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
|
||||
}
|
||||
|
||||
@@ -2862,8 +2862,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
|
||||
// Collided with a gameobject
|
||||
if (col)
|
||||
{
|
||||
destx -= CONTACT_DISTANCE * cos(angle);
|
||||
desty -= CONTACT_DISTANCE * sin(angle);
|
||||
destx -= CONTACT_DISTANCE * std::cos(angle);
|
||||
desty -= CONTACT_DISTANCE * std::sin(angle);
|
||||
dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
|
||||
}
|
||||
|
||||
@@ -2874,8 +2874,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
|
||||
// do not allow too big z changes
|
||||
if (fabs(pos.m_positionZ - destz) > 6)
|
||||
{
|
||||
destx -= step * cos(angle);
|
||||
desty -= step * sin(angle);
|
||||
destx -= step * std::cos(angle);
|
||||
desty -= step * std::sin(angle);
|
||||
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
|
||||
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
|
||||
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;
|
||||
|
||||
@@ -663,7 +663,7 @@ void Creature::Regenerate(Powers power)
|
||||
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
if (Powers((*i)->GetMiscValue()) == power)
|
||||
AddPctN(addvalue, (*i)->GetAmount());
|
||||
AddPct(addvalue, (*i)->GetAmount());
|
||||
|
||||
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (isHunterPet()? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILLISECONDS);
|
||||
|
||||
@@ -1979,7 +1979,7 @@ void Pet::CastPetAura(PetAura const* aura)
|
||||
|
||||
if (auraId == 35696) // Demonic Knowledge
|
||||
{
|
||||
int32 basePoints = CalculatePctF(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT));
|
||||
int32 basePoints = CalculatePct(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT));
|
||||
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -192,10 +192,10 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
|
||||
|
||||
void PlayerTaxi::LoadTaxiMask(const char* data)
|
||||
{
|
||||
Tokens tokens(data, ' ');
|
||||
Tokenizer tokens(data, ' ');
|
||||
|
||||
uint8 index;
|
||||
Tokens::iterator iter;
|
||||
Tokenizer::const_iterator iter;
|
||||
for (iter = tokens.begin(), index = 0;
|
||||
(index < TaxiMaskSize) && (iter != tokens.end()); ++iter, ++index)
|
||||
{
|
||||
@@ -222,9 +222,9 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, uint3
|
||||
{
|
||||
ClearTaxiDestinations();
|
||||
|
||||
Tokens tokens(values, ' ');
|
||||
Tokenizer tokens(values, ' ');
|
||||
|
||||
for (Tokens::iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
|
||||
for (Tokenizer::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
|
||||
{
|
||||
uint32 node = uint32(atol(*iter));
|
||||
AddTaxiDestination(node);
|
||||
@@ -520,7 +520,7 @@ inline void KillRewarder::_RewardXP(Player* player, float rate)
|
||||
// 4.2.2. Apply auras modifying rewarded XP (SPELL_AURA_MOD_XP_PCT).
|
||||
Unit::AuraEffectList const& auras = player->GetAuraEffectsByType(SPELL_AURA_MOD_XP_PCT);
|
||||
for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
|
||||
AddPctN(xp, (*i)->GetAmount());
|
||||
AddPct(xp, (*i)->GetAmount());
|
||||
|
||||
// 4.2.3. Give XP to player.
|
||||
player->GiveXP(xp, _victim, _groupRate);
|
||||
@@ -1325,7 +1325,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
|
||||
int32 UnderWaterTime = 3 * MINUTE * IN_MILLISECONDS;
|
||||
AuraEffectList const& mModWaterBreathing = GetAuraEffectsByType(SPELL_AURA_MOD_WATER_BREATHING);
|
||||
for (AuraEffectList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
|
||||
AddPctN(UnderWaterTime, (*i)->GetAmount());
|
||||
AddPct(UnderWaterTime, (*i)->GetAmount());
|
||||
return UnderWaterTime;
|
||||
}
|
||||
case FIRE_TIMER:
|
||||
@@ -1975,7 +1975,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
|
||||
*data << uint32(petLevel);
|
||||
*data << uint32(petFamily);
|
||||
|
||||
Tokens equipment(fields[19].GetString(), ' ');
|
||||
Tokenizer equipment(fields[19].GetString(), ' ');
|
||||
for (uint8 slot = 0; slot < INVENTORY_SLOT_BAG_END; ++slot)
|
||||
{
|
||||
uint32 visualBase = slot * 2;
|
||||
@@ -2540,7 +2540,7 @@ void Player::Regenerate(Powers power)
|
||||
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
if (Powers((*i)->GetMiscValue()) == power)
|
||||
AddPctN(addvalue, (*i)->GetAmount());
|
||||
AddPct(addvalue, (*i)->GetAmount());
|
||||
|
||||
// Butchery requires combat for this effect
|
||||
if (power != POWER_RUNIC_POWER || isInCombat())
|
||||
@@ -2620,12 +2620,12 @@ void Player::RegenerateHealth()
|
||||
{
|
||||
AuraEffectList const& mModHealthRegenPct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
|
||||
AddPctN(addvalue, (*i)->GetAmount());
|
||||
AddPct(addvalue, (*i)->GetAmount());
|
||||
|
||||
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * 2 * IN_MILLISECONDS / (5 * IN_MILLISECONDS);
|
||||
}
|
||||
else if (HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
|
||||
ApplyPctN(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
|
||||
ApplyPct(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
|
||||
|
||||
if (!IsStandState())
|
||||
addvalue *= 1.5f;
|
||||
@@ -5503,8 +5503,8 @@ void Player::RepopAtGraveyard()
|
||||
ClosestGrave = bg->GetClosestGraveYard(this);
|
||||
else
|
||||
{
|
||||
if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
|
||||
ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
|
||||
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
|
||||
ClosestGrave = bf->GetClosestGraveYard(this);
|
||||
else
|
||||
ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
|
||||
}
|
||||
@@ -5947,7 +5947,7 @@ void Player::UpdateRating(CombatRating cr)
|
||||
AuraEffectList const& modRatingFromStat = GetAuraEffectsByType(SPELL_AURA_MOD_RATING_FROM_STAT);
|
||||
for (AuraEffectList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
|
||||
if ((*i)->GetMiscValue() & (1<<cr))
|
||||
amount += int32(CalculatePctN(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount()));
|
||||
amount += int32(CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount()));
|
||||
if (amount < 0)
|
||||
amount = 0;
|
||||
SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));
|
||||
@@ -7187,7 +7187,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
|
||||
honor_f /= groupsize;
|
||||
|
||||
// apply honor multiplier from aura (not stacking-get highest)
|
||||
AddPctN(honor_f, GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN_PCT));
|
||||
AddPct(honor_f, GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN_PCT));
|
||||
}
|
||||
|
||||
honor_f *= sWorld->getRate(RATE_HONOR);
|
||||
@@ -15146,7 +15146,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
// handle SPELL_AURA_MOD_XP_QUEST_PCT auras
|
||||
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
|
||||
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
|
||||
AddPctN(XP, (*i)->GetAmount());
|
||||
AddPct(XP, (*i)->GetAmount());
|
||||
|
||||
int32 moneyRew = 0;
|
||||
if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
@@ -16691,7 +16691,7 @@ void Player::SetHomebind(WorldLocation const& /*loc*/, uint32 /*area_id*/)
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
uint32 Player::GetUInt32ValueFromArray(Tokens const& data, uint16 index)
|
||||
uint32 Player::GetUInt32ValueFromArray(Tokenizer const& data, uint16 index)
|
||||
{
|
||||
if (index >= data.size())
|
||||
return 0;
|
||||
@@ -16699,7 +16699,7 @@ uint32 Player::GetUInt32ValueFromArray(Tokens const& data, uint16 index)
|
||||
return (uint32)atoi(data[index]);
|
||||
}
|
||||
|
||||
float Player::GetFloatValueFromArray(Tokens const& data, uint16 index)
|
||||
float Player::GetFloatValueFromArray(Tokenizer const& data, uint16 index)
|
||||
{
|
||||
float result;
|
||||
uint32 temp = Player::GetUInt32ValueFromArray(data, index);
|
||||
@@ -17742,9 +17742,9 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
|
||||
{
|
||||
std::string strGUID = (*result)[0].GetString();
|
||||
Tokens GUIDlist(strGUID, ' ');
|
||||
Tokenizer GUIDlist(strGUID, ' ');
|
||||
AllowedLooterSet looters;
|
||||
for (Tokens::iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
|
||||
for (Tokenizer::const_iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
|
||||
looters.insert(atol(*itr));
|
||||
item->SetSoulboundTradeable(looters);
|
||||
AddTradeableItem(item);
|
||||
@@ -19604,7 +19604,7 @@ void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o,
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
void Player::SetUInt32ValueInArray(Tokens& tokens, uint16 index, uint32 value)
|
||||
void Player::SetUInt32ValueInArray(Tokenizer& tokens, uint16 index, uint32 value)
|
||||
{
|
||||
char buf[11];
|
||||
snprintf(buf, 11, "%u", value);
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
#include "Unit.h"
|
||||
#include "Util.h" // for Tokens typedef
|
||||
#include "WorldSession.h"
|
||||
|
||||
// for template
|
||||
#include "SpellMgr.h"
|
||||
|
||||
#include<string>
|
||||
@@ -1518,8 +1516,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
bool isBeingLoaded() const { return GetSession()->PlayerLoading();}
|
||||
|
||||
void Initialize(uint32 guid);
|
||||
static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index);
|
||||
static float GetFloatValueFromArray(Tokens const& data, uint16 index);
|
||||
static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index);
|
||||
static float GetFloatValueFromArray(Tokenizer const& data, uint16 index);
|
||||
static uint32 GetZoneIdFromDB(uint64 guid);
|
||||
static uint32 GetLevelFromDB(uint64 guid);
|
||||
static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid);
|
||||
@@ -1534,8 +1532,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
void SaveInventoryAndGoldToDB(SQLTransaction& trans); // fast save function for item/money cheating preventing
|
||||
void SaveGoldToDB(SQLTransaction& trans);
|
||||
|
||||
static void SetUInt32ValueInArray(Tokens& data, uint16 index, uint32 value);
|
||||
static void SetFloatValueInArray(Tokens& data, uint16 index, float value);
|
||||
static void SetUInt32ValueInArray(Tokenizer& data, uint16 index, uint32 value);
|
||||
static void SetFloatValueInArray(Tokenizer& data, uint16 index, float value);
|
||||
static void Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
|
||||
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid);
|
||||
|
||||
@@ -2918,7 +2916,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
|
||||
if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
|
||||
continue;
|
||||
|
||||
totalmul += CalculatePctN(1.0f, mod->value);
|
||||
totalmul += CalculatePct(1.0f, mod->value);
|
||||
}
|
||||
|
||||
DropModCharge(mod, spell);
|
||||
|
||||
@@ -646,8 +646,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
|
||||
creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim);
|
||||
|
||||
creature->Relocate(
|
||||
GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))),
|
||||
GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())),
|
||||
GetPositionX() + (x * std::cos(GetOrientation()) + y * std::sin(GetOrientation() + float(M_PI))),
|
||||
GetPositionY() + (y * std::cos(GetOrientation()) + x * std::sin(GetOrientation())),
|
||||
z + GetPositionZ(),
|
||||
o + GetOrientation());
|
||||
|
||||
@@ -680,8 +680,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
|
||||
void Transport::UpdatePosition(MovementInfo* mi)
|
||||
{
|
||||
float transport_o = mi->pos.m_orientation - mi->t_pos.m_orientation;
|
||||
float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * cos(transport_o) - mi->t_pos.m_positionY*sin(transport_o));
|
||||
float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * cos(transport_o) + mi->t_pos.m_positionX*sin(transport_o));
|
||||
float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * std::cos(transport_o) - mi->t_pos.m_positionY* std::sin(transport_o));
|
||||
float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * std::cos(transport_o) + mi->t_pos.m_positionX* std::sin(transport_o));
|
||||
float transport_z = mi->pos.m_positionZ - mi->t_pos.m_positionZ;
|
||||
|
||||
Relocate(transport_x, transport_y, transport_z, transport_o);
|
||||
@@ -708,8 +708,8 @@ void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float&
|
||||
{
|
||||
float inx = x, iny = y, inz = z, ino = o;
|
||||
o = GetOrientation() + ino;
|
||||
x = GetPositionX() + inx * cos(GetOrientation()) - iny * sin(GetOrientation());
|
||||
y = GetPositionY() + iny * cos(GetOrientation()) + inx * sin(GetOrientation());
|
||||
x = GetPositionX() + inx * std::cos(GetOrientation()) - iny * std::sin(GetOrientation());
|
||||
y = GetPositionY() + iny * std::cos(GetOrientation()) + inx * std::sin(GetOrientation());
|
||||
z = GetPositionZ() + inz;
|
||||
}
|
||||
|
||||
@@ -717,9 +717,9 @@ void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
|
||||
{
|
||||
o -= GetOrientation();
|
||||
z -= GetPositionZ();
|
||||
y -= GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
|
||||
x -= GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
|
||||
y -= GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o)
|
||||
x -= GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi)
|
||||
float inx = x, iny = y;
|
||||
y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation()));
|
||||
x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation()));
|
||||
y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation()));
|
||||
x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation()));
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ void Player::UpdateArmor()
|
||||
for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
|
||||
{
|
||||
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
|
||||
value += CalculatePctN(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
|
||||
value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
|
||||
}
|
||||
|
||||
value *= GetModifierValue(unitMod, TOTAL_PCT);
|
||||
@@ -359,7 +359,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
||||
switch (aurEff->GetEffIndex())
|
||||
{
|
||||
case 0: // Predatory Strikes (effect 0)
|
||||
mLevelMult = CalculatePctN(1.0f, aurEff->GetAmount());
|
||||
mLevelMult = CalculatePct(1.0f, aurEff->GetAmount());
|
||||
break;
|
||||
case 1: // Predatory Strikes (effect 1)
|
||||
if (Item* mainHand = m_items[EQUIPMENT_SLOT_MAINHAND])
|
||||
@@ -369,7 +369,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
||||
if (!proto)
|
||||
continue;
|
||||
|
||||
weapon_bonus = CalculatePctN(float(proto->getFeralBonus()), aurEff->GetAmount());
|
||||
weapon_bonus = CalculatePct(float(proto->getFeralBonus()), aurEff->GetAmount());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -421,14 +421,14 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
||||
{
|
||||
AuraEffectList const& mRAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mRAPbyStat.begin(); i != mRAPbyStat.end(); ++i)
|
||||
attPowerMod += CalculatePctN(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
|
||||
attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AuraEffectList const& mAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mAPbyStat.begin(); i != mAPbyStat.end(); ++i)
|
||||
attPowerMod += CalculatePctN(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
|
||||
attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
|
||||
|
||||
AuraEffectList const& mAPbyArmor = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
|
||||
for (AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
|
||||
@@ -856,7 +856,7 @@ void Player::UpdateManaRegen()
|
||||
int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
|
||||
if (modManaRegenInterrupt > 100)
|
||||
modManaRegenInterrupt = 100;
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePctN(power_regen, modManaRegenInterrupt));
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePct(power_regen, modManaRegenInterrupt));
|
||||
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
|
||||
}
|
||||
@@ -1098,12 +1098,12 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
if (aurEff)
|
||||
{
|
||||
SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value
|
||||
AddPctN(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
|
||||
AddPct(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
|
||||
}
|
||||
// Glyph of the Ghoul
|
||||
aurEff = owner->GetAuraEffect(58686, 0);
|
||||
if (aurEff)
|
||||
mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
|
||||
mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
|
||||
ownersBonus = float(owner->GetStat(stat)) * mod;
|
||||
value += ownersBonus;
|
||||
}
|
||||
@@ -1111,7 +1111,7 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
{
|
||||
if (owner->getClass() == CLASS_WARLOCK && isPet())
|
||||
{
|
||||
ownersBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
|
||||
ownersBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
|
||||
value += ownersBonus;
|
||||
}
|
||||
else
|
||||
@@ -1126,7 +1126,7 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
||||
AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
|
||||
AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
|
||||
}
|
||||
}
|
||||
ownersBonus = float(owner->GetStat(stat)) * mod;
|
||||
@@ -1138,7 +1138,7 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
{
|
||||
if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
|
||||
{
|
||||
ownersBonus = CalculatePctN(owner->GetStat(stat), 30);
|
||||
ownersBonus = CalculatePct(owner->GetStat(stat), 30);
|
||||
value += ownersBonus;
|
||||
}
|
||||
}
|
||||
@@ -1190,7 +1190,7 @@ void Guardian::UpdateResistances(uint32 school)
|
||||
|
||||
// hunter and warlock pets gain 40% of owner's resistance
|
||||
if (isPet())
|
||||
value += float(CalculatePctN(m_owner->GetResistance(SpellSchools(school)), 40));
|
||||
value += float(CalculatePct(m_owner->GetResistance(SpellSchools(school)), 40));
|
||||
|
||||
SetResistance(SpellSchools(school), int32(value));
|
||||
}
|
||||
@@ -1206,7 +1206,7 @@ void Guardian::UpdateArmor()
|
||||
|
||||
// hunter and warlock pets gain 35% of owner's armor value
|
||||
if (isPet())
|
||||
bonus_armor = float(CalculatePctN(m_owner->GetArmor(), 35));
|
||||
bonus_armor = float(CalculatePct(m_owner->GetArmor(), 35));
|
||||
|
||||
value = GetModifierValue(unitMod, BASE_VALUE);
|
||||
value *= GetModifierValue(unitMod, BASE_PCT);
|
||||
@@ -1296,7 +1296,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
|
||||
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
|
||||
{
|
||||
SpellInfo const* sProto = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
||||
mod += CalculatePctN(1.0f, sProto->Effects[1].CalcValue());
|
||||
mod += CalculatePct(1.0f, sProto->Effects[1].CalcValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1414,8 +1414,8 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
|
||||
{
|
||||
case 61682:
|
||||
case 61683:
|
||||
AddPctN(mindamage, -(*itr)->GetAmount());
|
||||
AddPctN(maxdamage, -(*itr)->GetAmount());
|
||||
AddPct(mindamage, -(*itr)->GetAmount());
|
||||
AddPct(maxdamage, -(*itr)->GetAmount());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1335,8 +1335,8 @@ class Unit : public WorldObject
|
||||
bool HealthAbovePct(int32 pct) const { return GetHealth() > CountPctFromMaxHealth(pct); }
|
||||
bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return uint64(GetHealth()) + uint64(heal) > CountPctFromMaxHealth(pct); }
|
||||
float GetHealthPct() const { return GetMaxHealth() ? 100.f * GetHealth() / GetMaxHealth() : 0.0f; }
|
||||
uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePctN(GetMaxHealth(), pct); }
|
||||
uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePctN(GetHealth(), pct); }
|
||||
uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePct(GetMaxHealth(), pct); }
|
||||
uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePct(GetHealth(), pct); }
|
||||
|
||||
void SetHealth(uint32 val);
|
||||
void SetMaxHealth(uint32 val);
|
||||
|
||||
@@ -517,8 +517,8 @@ void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
|
||||
{
|
||||
float inx = x, iny = y, inz = z, ino = o;
|
||||
o = GetBase()->GetOrientation() + ino;
|
||||
x = GetBase()->GetPositionX() + inx * cos(GetBase()->GetOrientation()) - iny * sin(GetBase()->GetOrientation());
|
||||
y = GetBase()->GetPositionY() + iny * cos(GetBase()->GetOrientation()) + inx * sin(GetBase()->GetOrientation());
|
||||
x = GetBase()->GetPositionX() + inx * std::cos(GetBase()->GetOrientation()) - iny * std::sin(GetBase()->GetOrientation());
|
||||
y = GetBase()->GetPositionY() + iny * std::cos(GetBase()->GetOrientation()) + inx * std::sin(GetBase()->GetOrientation());
|
||||
z = GetBase()->GetPositionZ() + inz;
|
||||
}
|
||||
|
||||
@@ -526,9 +526,9 @@ void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
|
||||
{
|
||||
o -= GetBase()->GetOrientation();
|
||||
z -= GetBase()->GetPositionZ();
|
||||
y -= GetBase()->GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
|
||||
x -= GetBase()->GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
|
||||
y -= GetBase()->GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o)
|
||||
x -= GetBase()->GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi)
|
||||
float inx = x, iny = y;
|
||||
y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
|
||||
x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
|
||||
y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
|
||||
x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
|
||||
}
|
||||
|
||||
@@ -525,10 +525,10 @@ void ObjectMgr::LoadCreatureTemplateAddons()
|
||||
creatureAddon.bytes2 = fields[4].GetUInt32();
|
||||
creatureAddon.emote = fields[5].GetUInt32();
|
||||
|
||||
Tokens tokens(fields[6].GetString(), ' ');
|
||||
Tokenizer tokens(fields[6].GetString(), ' ');
|
||||
uint8 i = 0;
|
||||
creatureAddon.auras.resize(tokens.size());
|
||||
for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
|
||||
for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
|
||||
{
|
||||
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
|
||||
if (!AdditionalSpellInfo)
|
||||
@@ -907,10 +907,10 @@ void ObjectMgr::LoadCreatureAddons()
|
||||
creatureAddon.bytes2 = fields[4].GetUInt32();
|
||||
creatureAddon.emote = fields[5].GetUInt32();
|
||||
|
||||
Tokens tokens(fields[6].GetString(), ' ');
|
||||
Tokenizer tokens(fields[6].GetString(), ' ');
|
||||
uint8 i = 0;
|
||||
creatureAddon.auras.resize(tokens.size());
|
||||
for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
|
||||
for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
|
||||
{
|
||||
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
|
||||
if (!AdditionalSpellInfo)
|
||||
|
||||
@@ -148,7 +148,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
|
||||
|
||||
if (_player->GetBattlegroundQueueIndex(bgQueueTypeIdRandom) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||
{
|
||||
//player is already in random queue
|
||||
// player is already in random queue
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_RANDOM_BG);
|
||||
_player->GetSession()->SendPacket(&data);
|
||||
@@ -157,7 +157,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
|
||||
|
||||
if (_player->InBattlegroundQueue() && bgTypeId == BATTLEGROUND_RB)
|
||||
{
|
||||
//player is already in queue, can't start random queue
|
||||
// player is already in queue, can't start random queue
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_NON_RANDOM_BG);
|
||||
_player->GetSession()->SendPacket(&data);
|
||||
@@ -166,7 +166,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
|
||||
|
||||
// check if already in queue
|
||||
if (_player->GetBattlegroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||
//player is already in this queue
|
||||
// player is already in this queue
|
||||
return;
|
||||
|
||||
// check if has free queue slots
|
||||
@@ -178,7 +178,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
|
||||
GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, 0, false, isPremade, 0, 0);
|
||||
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
|
||||
@@ -189,7 +189,8 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
|
||||
// send status packet (in queue)
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
|
||||
SendPacket(&data);
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName());
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",
|
||||
bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -202,7 +203,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
|
||||
err = grp->CanJoinBattlegroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
||||
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
|
||||
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
GroupQueueInfo* ginfo = NULL;
|
||||
uint32 avgTime = 0;
|
||||
|
||||
@@ -256,14 +257,14 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recv_d
|
||||
Player* allianceFlagCarrier = NULL;
|
||||
Player* hordeFlagCarrier = NULL;
|
||||
|
||||
if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_ALLIANCE))
|
||||
if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
|
||||
{
|
||||
allianceFlagCarrier = ObjectAccessor::FindPlayer(guid);
|
||||
if (allianceFlagCarrier)
|
||||
++flagCarrierCount;
|
||||
}
|
||||
|
||||
if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_HORDE))
|
||||
if (uint64 guid = bg->GetFlagPickerGUID(TEAM_HORDE))
|
||||
{
|
||||
hordeFlagCarrier = ObjectAccessor::FindPlayer(guid);
|
||||
if (hordeFlagCarrier)
|
||||
@@ -366,7 +367,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
|
||||
//get GroupQueueInfo from BattlegroundQueue
|
||||
BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_);
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, type);
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
//we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattlegroundQueue::RemovePlayer() function
|
||||
GroupQueueInfo ginfo;
|
||||
if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
|
||||
@@ -540,7 +541,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
|
||||
}
|
||||
//we are sending update to player about queue - he can be invited there!
|
||||
//get GroupQueueInfo for queue status
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
GroupQueueInfo ginfo;
|
||||
if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
|
||||
continue;
|
||||
@@ -680,7 +681,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
|
||||
arenaRating = 1;
|
||||
}
|
||||
|
||||
BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
|
||||
BattlegroundQueue &bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
if (asGroup)
|
||||
{
|
||||
uint32 avgTime = 0;
|
||||
|
||||
@@ -1730,7 +1730,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
|
||||
sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race);
|
||||
|
||||
BattlegroundTeamId team = BG_TEAM_ALLIANCE;
|
||||
TeamId team = TEAM_ALLIANCE;
|
||||
|
||||
// Search each faction is targeted
|
||||
switch (race)
|
||||
@@ -1740,7 +1740,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
case RACE_UNDEAD_PLAYER:
|
||||
case RACE_TROLL:
|
||||
case RACE_BLOODELF:
|
||||
team = BG_TEAM_HORDE;
|
||||
team = TEAM_HORDE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1757,7 +1757,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
|
||||
// Faction specific languages
|
||||
if (team == BG_TEAM_HORDE)
|
||||
if (team == TEAM_HORDE)
|
||||
stmt->setUInt16(1, 109);
|
||||
else
|
||||
stmt->setUInt16(1, 98);
|
||||
@@ -1816,7 +1816,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
uint32 numFullTaximasks = level / 7;
|
||||
if (numFullTaximasks > 11)
|
||||
numFullTaximasks = 11;
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
if (team == TEAM_ALLIANCE)
|
||||
{
|
||||
if (playerClass != CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
@@ -1868,7 +1868,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
{
|
||||
Quest *qinfo = iter->second;
|
||||
uint32 requiredRaces = qinfo->GetRequiredRaces();
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
if (team == TEAM_ALLIANCE)
|
||||
{
|
||||
if (requiredRaces & RACEMASK_ALLIANCE)
|
||||
{
|
||||
@@ -1876,7 +1876,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
quests << ',';
|
||||
}
|
||||
}
|
||||
else // if (team == BG_TEAM_HORDE)
|
||||
else // if (team == TEAM_HORDE)
|
||||
{
|
||||
if (requiredRaces & RACEMASK_HORDE)
|
||||
{
|
||||
@@ -1929,7 +1929,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_HOMEBIND);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
if (team == TEAM_ALLIANCE)
|
||||
{
|
||||
stmt->setUInt16(1, 0);
|
||||
stmt->setUInt16(2, 1519);
|
||||
@@ -1956,13 +1956,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
uint32 achiev_horde = it->second;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
|
||||
stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
|
||||
stmt->setUInt16(0, uint16(team == TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
|
||||
stmt->setUInt32(1, lowGuid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACHIEVEMENT);
|
||||
stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
|
||||
stmt->setUInt16(1, uint16(team == BG_TEAM_ALLIANCE ? achiev_horde : achiev_alliance));
|
||||
stmt->setUInt16(0, uint16(team == TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
|
||||
stmt->setUInt16(1, uint16(team == TEAM_ALLIANCE ? achiev_horde : achiev_alliance));
|
||||
stmt->setUInt32(2, lowGuid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
@@ -1974,8 +1974,8 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
uint32 item_horde = it->second;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE);
|
||||
stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? item_alliance : item_horde));
|
||||
stmt->setUInt32(1, (team == BG_TEAM_ALLIANCE ? item_horde : item_alliance));
|
||||
stmt->setUInt32(0, (team == TEAM_ALLIANCE ? item_alliance : item_horde));
|
||||
stmt->setUInt32(1, (team == TEAM_ALLIANCE ? item_horde : item_alliance));
|
||||
stmt->setUInt32(2, guid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
@@ -1987,13 +1987,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
uint32 spell_horde = it->second;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
|
||||
stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde));
|
||||
stmt->setUInt32(0, (team == TEAM_ALLIANCE ? spell_alliance : spell_horde));
|
||||
stmt->setUInt32(1, lowGuid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_SPELL_FACTION_CHANGE);
|
||||
stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde));
|
||||
stmt->setUInt32(1, (team == BG_TEAM_ALLIANCE ? spell_horde : spell_alliance));
|
||||
stmt->setUInt32(0, (team == TEAM_ALLIANCE ? spell_alliance : spell_horde));
|
||||
stmt->setUInt32(1, (team == TEAM_ALLIANCE ? spell_horde : spell_alliance));
|
||||
stmt->setUInt32(2, lowGuid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
@@ -2005,13 +2005,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
uint32 reputation_horde = it->second;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REP_BY_FACTION);
|
||||
stmt->setUInt32(0, uint16(team == BG_TEAM_ALLIANCE ? reputation_alliance : reputation_horde));
|
||||
stmt->setUInt32(0, uint16(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde));
|
||||
stmt->setUInt32(1, lowGuid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REP_FACTION_CHANGE);
|
||||
stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? reputation_alliance : reputation_horde));
|
||||
stmt->setUInt16(1, uint16(team == BG_TEAM_ALLIANCE ? reputation_horde : reputation_alliance));
|
||||
stmt->setUInt16(0, uint16(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde));
|
||||
stmt->setUInt16(1, uint16(team == TEAM_ALLIANCE ? reputation_horde : reputation_alliance));
|
||||
stmt->setUInt32(2, lowGuid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
@@ -2021,7 +2021,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
{
|
||||
const uint32 ktcount = KNOWN_TITLES_SIZE * 2;
|
||||
uint32 knownTitles[ktcount];
|
||||
Tokens tokens(knownTitlesStr, ' ', ktcount);
|
||||
Tokenizer tokens(knownTitlesStr, ' ', ktcount);
|
||||
|
||||
if (tokens.size() != ktcount)
|
||||
return;
|
||||
@@ -2037,7 +2037,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
CharTitlesEntry const* atitleInfo = sCharTitlesStore.LookupEntry(title_alliance);
|
||||
CharTitlesEntry const* htitleInfo = sCharTitlesStore.LookupEntry(title_horde);
|
||||
// new team
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
if (team == TEAM_ALLIANCE)
|
||||
{
|
||||
uint32 bitIndex = htitleInfo->bit_index;
|
||||
uint32 index = bitIndex / 32;
|
||||
|
||||
@@ -862,8 +862,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
|
||||
// 2PI = 360°, keep in mind that ingame orientation is counter-clockwise
|
||||
double rotation = 2 * M_PI - atEntry->box_orientation;
|
||||
double sinVal = sin(rotation);
|
||||
double cosVal = cos(rotation);
|
||||
double sinVal = std::sin(rotation);
|
||||
double cosVal = std::cos(rotation);
|
||||
|
||||
float playerBoxDistX = player->GetPositionX() - atEntry->x;
|
||||
float playerBoxDistY = player->GetPositionY() - atEntry->y;
|
||||
|
||||
Executable → Regular
+2
-2
@@ -100,8 +100,8 @@ bool FleeingMovementGenerator<T>::_getPoint(T* owner, float &x, float &y, float
|
||||
float curr_x, curr_y, curr_z;
|
||||
owner->GetPosition(curr_x, curr_y, curr_z);
|
||||
|
||||
x = curr_x + dist*cos(angle);
|
||||
y = curr_y + dist*sin(angle);
|
||||
x = curr_x + dist * std::cos(angle);
|
||||
y = curr_y + dist * std::sin(angle);
|
||||
z = curr_z;
|
||||
|
||||
owner->UpdateAllowedPositionZ(x, y, z);
|
||||
|
||||
@@ -46,8 +46,8 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
|
||||
|
||||
const float angle = float(rand_norm()) * static_cast<float>(M_PI*2.0f);
|
||||
const float range = float(rand_norm()) * wander_distance;
|
||||
const float distanceX = range * cos(angle);
|
||||
const float distanceY = range * sin(angle);
|
||||
const float distanceX = range * std::cos(angle);
|
||||
const float distanceY = range * std::sin(angle);
|
||||
|
||||
destX = respX + distanceX;
|
||||
destY = respY + distanceY;
|
||||
|
||||
@@ -135,7 +135,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
|
||||
m_maxValue = (float)goinfo->capturePoint.maxTime;
|
||||
m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60);
|
||||
m_neutralValuePct = goinfo->capturePoint.neutralPercent;
|
||||
m_minValue = CalculatePctU(m_maxValue, m_neutralValuePct);
|
||||
m_minValue = CalculatePct(m_maxValue, m_neutralValuePct);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "PoolMgr.h"
|
||||
#include "Containers.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
|
||||
@@ -423,10 +423,6 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||
}
|
||||
else if (!_player->getAttackers().empty())
|
||||
{
|
||||
_player->CombatStop();
|
||||
_player->getHostileRefManager().setOnlineOfflineState(false);
|
||||
_player->RemoveAllAurasOnDeath();
|
||||
|
||||
// build set of player who attack _player or who have pet attacking of _player
|
||||
std::set<Player*> aset;
|
||||
for (Unit::AttackerSet::const_iterator itr = _player->getAttackers().begin(); itr != _player->getAttackers().end(); ++itr)
|
||||
@@ -438,6 +434,11 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||
aset.insert((Player*)(*itr));
|
||||
}
|
||||
|
||||
// CombatStop() method is removing all attackers from the AttackerSet
|
||||
// That is why it must be AFTER building current set of attackers
|
||||
_player->CombatStop();
|
||||
_player->getHostileRefManager().setOnlineOfflineState(false);
|
||||
_player->RemoveAllAurasOnDeath();
|
||||
_player->SetPvPDeath(!aset.empty());
|
||||
_player->KillPlayer();
|
||||
_player->BuildPlayerRepop();
|
||||
@@ -482,7 +483,8 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||
if (BattlegroundQueueTypeId bgQueueTypeId = _player->GetBattlegroundQueueTypeId(i))
|
||||
{
|
||||
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
|
||||
sBattlegroundMgr->m_BattlegroundQueues[ bgQueueTypeId ].RemovePlayer(_player->GetGUID(), true);
|
||||
BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
queue.RemovePlayer(_player->GetGUID(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -474,7 +474,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
// Glyph of Fear, Glyph of Frost nova and similar auras
|
||||
if ((*itr)->GetMiscValue() == 7801)
|
||||
{
|
||||
AddPctN(amount, (*itr)->GetAmount());
|
||||
AddPct(amount, (*itr)->GetAmount());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -527,7 +527,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
|
||||
// Borrowed Time
|
||||
if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1))
|
||||
bonus += CalculatePctN(1.0f, pAurEff->GetAmount());
|
||||
bonus += CalculatePct(1.0f, pAurEff->GetAmount());
|
||||
|
||||
DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus;
|
||||
// Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
|
||||
@@ -539,7 +539,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
|
||||
// Twin Disciplines
|
||||
if (AuraEffect const* pAurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID()))
|
||||
AddPctN(amount, pAurEff->GetAmount());
|
||||
AddPct(amount, pAurEff->GetAmount());
|
||||
|
||||
// Focused Power
|
||||
// Reuse variable, not sure if this code below can be moved before Twin Disciplines
|
||||
@@ -569,7 +569,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
if (!pAurEff)
|
||||
pAurEff = caster->GetAuraEffect(74411, 0); // Battleground - Dampening
|
||||
if (pAurEff)
|
||||
AddPctN(amount, pAurEff->GetAmount());
|
||||
AddPct(amount, pAurEff->GetAmount());
|
||||
|
||||
return amount;
|
||||
}
|
||||
@@ -635,7 +635,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
else if (AuraEffect const* aurEff = caster->GetAuraEffect(60774, EFFECT_0))
|
||||
amount += cp * aurEff->GetAmount();
|
||||
|
||||
amount += uint32(CalculatePctU(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
|
||||
amount += uint32(CalculatePct(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
|
||||
}
|
||||
// Rend
|
||||
else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && GetSpellInfo()->SpellFamilyFlags[0] & 0x20)
|
||||
@@ -653,7 +653,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
if (m_spellInfo->GetRank() >= 9)
|
||||
{
|
||||
if (GetBase()->GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, m_spellInfo, caster))
|
||||
AddPctN(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster));
|
||||
AddPct(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster));
|
||||
}
|
||||
}
|
||||
// Unholy Blight damage over time effect
|
||||
@@ -674,10 +674,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f;
|
||||
break;
|
||||
case 29166: // Innervate
|
||||
ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
|
||||
ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
|
||||
break;
|
||||
case 48391: // Owlkin Frenzy
|
||||
ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
|
||||
ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -692,7 +692,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER)
|
||||
// Bonus from Glyph of Lightwell
|
||||
if (AuraEffect* modHealing = caster->GetAuraEffect(55673, 0))
|
||||
AddPctN(amount, modHealing->GetAmount());
|
||||
AddPct(amount, modHealing->GetAmount());
|
||||
}
|
||||
break;
|
||||
case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN:
|
||||
@@ -4745,7 +4745,7 @@ void AuraEffect::HandleModPowerCostPCT(AuraApplication const* aurApp, uint8 mode
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
float amount = CalculatePctN(1.0f, GetAmount());
|
||||
float amount = CalculatePct(1.0f, GetAmount());
|
||||
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
|
||||
if (GetMiscValue() & (1 << i))
|
||||
target->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + i, amount, apply);
|
||||
@@ -6399,25 +6399,25 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
|
||||
|
||||
// Tenacity increase healing % taken
|
||||
if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0))
|
||||
AddPctN(TakenTotalMod, Tenacity->GetAmount());
|
||||
AddPct(TakenTotalMod, Tenacity->GetAmount());
|
||||
|
||||
// Healing taken percent
|
||||
float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
|
||||
if (minval)
|
||||
AddPctF(TakenTotalMod, minval);
|
||||
AddPct(TakenTotalMod, minval);
|
||||
|
||||
float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
|
||||
if (maxval)
|
||||
AddPctF(TakenTotalMod, maxval);
|
||||
AddPct(TakenTotalMod, maxval);
|
||||
|
||||
// Healing over time taken percent
|
||||
float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
|
||||
if (minval_hot)
|
||||
AddPctF(TakenTotalMod, minval_hot);
|
||||
AddPct(TakenTotalMod, minval_hot);
|
||||
|
||||
float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
|
||||
if (maxval_hot)
|
||||
AddPctF(TakenTotalMod, maxval_hot);
|
||||
AddPct(TakenTotalMod, maxval_hot);
|
||||
|
||||
TakenTotalMod = std::max(TakenTotalMod, 0.0f);
|
||||
|
||||
@@ -6510,8 +6510,8 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
|
||||
if (m_spellInfo->ManaCostPercentage)
|
||||
{
|
||||
// max value
|
||||
int32 maxmana = CalculatePctF(caster->GetMaxPower(powerType), drainAmount * 2.0f);
|
||||
ApplyPctU(drainAmount, target->GetMaxPower(powerType));
|
||||
int32 maxmana = CalculatePct(caster->GetMaxPower(powerType), drainAmount * 2.0f);
|
||||
ApplyPct(drainAmount, target->GetMaxPower(powerType));
|
||||
if (drainAmount > maxmana)
|
||||
drainAmount = maxmana;
|
||||
}
|
||||
@@ -6548,7 +6548,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
|
||||
// Mana Feed - Drain Mana
|
||||
if (manaFeedVal > 0)
|
||||
{
|
||||
int32 feedAmount = CalculatePctN(gainedAmount, manaFeedVal);
|
||||
int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
|
||||
caster->CastCustomSpell(caster, 32554, &feedAmount, NULL, NULL, true, NULL, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1215,7 +1215,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT);
|
||||
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
|
||||
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
|
||||
int32 heal = int32(CalculatePctN(basepoints0, 15));
|
||||
int32 heal = int32(CalculatePct(basepoints0, 15));
|
||||
|
||||
caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
|
||||
caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0));
|
||||
@@ -1433,7 +1433,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
else if (aurEff->GetId() == 47537)
|
||||
multiplier += 0.5f;
|
||||
|
||||
int32 basepoints0 = int32(CalculatePctF(caster->GetMaxPower(POWER_MANA), multiplier));
|
||||
int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
|
||||
caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true);
|
||||
}
|
||||
// effect on aura target
|
||||
@@ -1447,7 +1447,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
{
|
||||
case POWER_MANA:
|
||||
{
|
||||
int32 basepoints0 = int32(CalculatePctN(target->GetMaxPower(POWER_MANA), 2));
|
||||
int32 basepoints0 = int32(CalculatePct(target->GetMaxPower(POWER_MANA), 2));
|
||||
caster->CastCustomSpell(target, 63654, &basepoints0, NULL, NULL, true);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1652,7 +1652,7 @@ void Spell::SelectImplicitTrajTargets()
|
||||
|
||||
const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3)
|
||||
// TODO: all calculation should be based on src instead of m_caster
|
||||
const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr));
|
||||
const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * std::cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr));
|
||||
const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ;
|
||||
|
||||
DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);)
|
||||
@@ -1720,8 +1720,8 @@ void Spell::SelectImplicitTrajTargets()
|
||||
|
||||
if (m_targets.GetSrcPos()->GetExactDist2d(m_targets.GetDstPos()) > bestDist)
|
||||
{
|
||||
float x = m_targets.GetSrcPos()->m_positionX + cos(m_caster->GetOrientation()) * bestDist;
|
||||
float y = m_targets.GetSrcPos()->m_positionY + sin(m_caster->GetOrientation()) * bestDist;
|
||||
float x = m_targets.GetSrcPos()->m_positionX + std::cos(m_caster->GetOrientation()) * bestDist;
|
||||
float y = m_targets.GetSrcPos()->m_positionY + std::sin(m_caster->GetOrientation()) * bestDist;
|
||||
float z = m_targets.GetSrcPos()->m_positionZ + bestDist * (a * bestDist + b);
|
||||
|
||||
if (itr != targets.end())
|
||||
@@ -6384,7 +6384,7 @@ void Spell::Delayed() // only called in DealDamage()
|
||||
if (delayReduce >= 100)
|
||||
return;
|
||||
|
||||
AddPctN(delaytime, -delayReduce);
|
||||
AddPct(delaytime, -delayReduce);
|
||||
|
||||
if (m_timer + delaytime > m_casttime)
|
||||
{
|
||||
@@ -6412,14 +6412,14 @@ void Spell::DelayedChannel()
|
||||
return;
|
||||
|
||||
//check pushback reduce
|
||||
int32 delaytime = CalculatePctN(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit
|
||||
int32 delaytime = CalculatePct(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit
|
||||
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
|
||||
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
|
||||
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
|
||||
if (delayReduce >= 100)
|
||||
return;
|
||||
|
||||
AddPctN(delaytime, -delayReduce);
|
||||
AddPct(delaytime, -delayReduce);
|
||||
|
||||
if (m_timer <= delaytime)
|
||||
{
|
||||
|
||||
@@ -155,8 +155,8 @@ class SpellCastTargets
|
||||
void SetSpeed(float speed) { m_speed = speed; }
|
||||
|
||||
float GetDist2d() const { return m_src._position.GetExactDist2d(&m_dst._position); }
|
||||
float GetSpeedXY() const { return m_speed * cos(m_elevation); }
|
||||
float GetSpeedZ() const { return m_speed * sin(m_elevation); }
|
||||
float GetSpeedXY() const { return m_speed * std::cos(m_elevation); }
|
||||
float GetSpeedZ() const { return m_speed * std::sin(m_elevation); }
|
||||
|
||||
void Update(Unit* caster);
|
||||
void OutDebug() const;
|
||||
|
||||
@@ -378,13 +378,13 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
|
||||
}
|
||||
// Victory Rush
|
||||
else if (m_spellInfo->SpellFamilyFlags[1] & 0x100)
|
||||
ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
|
||||
ApplyPct(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
|
||||
// Shockwave
|
||||
else if (m_spellInfo->Id == 46968)
|
||||
{
|
||||
int32 pct = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, 2);
|
||||
if (pct > 0)
|
||||
damage += int32(CalculatePctN(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct));
|
||||
damage += int32(CalculatePct(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -435,10 +435,10 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
|
||||
pdamage = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount());
|
||||
uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1));
|
||||
uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude);
|
||||
damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir));
|
||||
damage += int32(CalculatePct(pdamage * baseTotalTicks, pct_dir));
|
||||
|
||||
uint32 pct_dot = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 2)) / 3;
|
||||
m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePctU(pdamage * baseTotalTicks, pct_dot)));
|
||||
m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePct(pdamage * baseTotalTicks, pct_dot)));
|
||||
|
||||
apply_direct_bonus = false;
|
||||
// Glyph of Conflagrate
|
||||
@@ -496,7 +496,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
|
||||
float multiple = ap / 410 + m_spellInfo->Effects[effIndex].DamageMultiplier;
|
||||
int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -30));
|
||||
damage += int32(energy * multiple);
|
||||
damage += int32(CalculatePctN(m_caster->ToPlayer()->GetComboPoints() * ap, 7));
|
||||
damage += int32(CalculatePct(m_caster->ToPlayer()->GetComboPoints() * ap, 7));
|
||||
}
|
||||
// Wrath
|
||||
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00000001)
|
||||
@@ -504,7 +504,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
|
||||
// Improved Insect Swarm
|
||||
if (AuraEffect const* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
|
||||
if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00200000, 0, 0))
|
||||
AddPctN(damage, aurEff->GetAmount());
|
||||
AddPct(damage, aurEff->GetAmount());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -637,7 +637,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
|
||||
{
|
||||
uint8 level = m_caster->getLevel();
|
||||
uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 39.5f));
|
||||
damage += CalculatePctN(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue());
|
||||
damage += CalculatePct(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -1437,8 +1437,8 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
|
||||
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
|
||||
if (m_spellInfo->Id == 8129)
|
||||
{
|
||||
int32 maxDamage = int32(CalculatePctN(m_caster->GetMaxPower(powerType), damage * 2));
|
||||
damage = int32(CalculatePctN(unitTarget->GetMaxPower(powerType), damage));
|
||||
int32 maxDamage = int32(CalculatePct(m_caster->GetMaxPower(powerType), damage * 2));
|
||||
damage = int32(CalculatePct(unitTarget->GetMaxPower(powerType), damage));
|
||||
damage = std::min(damage, maxDamage);
|
||||
}
|
||||
|
||||
@@ -1494,7 +1494,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = m_caster->ToPlayer())
|
||||
if (player->HasSkill(SKILL_ENGINEERING))
|
||||
AddPctN(addhealth, 25);
|
||||
AddPct(addhealth, 25);
|
||||
}
|
||||
// Swiftmend - consumes Regrowth or Rejuvenation
|
||||
else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND, m_spellInfo, m_caster))
|
||||
@@ -1553,7 +1553,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
|
||||
for (Unit::AuraEffectList::const_iterator i = Periodic.begin(); i != Periodic.end(); ++i)
|
||||
{
|
||||
if (m_caster->GetGUID() == (*i)->GetCasterGUID())
|
||||
AddPctN(addhealth, aurEff->GetAmount());
|
||||
AddPct(addhealth, aurEff->GetAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1877,20 +1877,20 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
|
||||
case 31930: // Judgements of the Wise
|
||||
case 63375: // Improved Stormstrike
|
||||
case 68082: // Glyph of Seal of Command
|
||||
damage = int32(CalculatePctN(unitTarget->GetCreateMana(), damage));
|
||||
damage = int32(CalculatePct(unitTarget->GetCreateMana(), damage));
|
||||
break;
|
||||
case 48542: // Revitalize
|
||||
damage = int32(CalculatePctN(unitTarget->GetMaxPower(power), damage));
|
||||
damage = int32(CalculatePct(unitTarget->GetMaxPower(power), damage));
|
||||
break;
|
||||
case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
|
||||
{
|
||||
if (Player* player = m_caster->ToPlayer())
|
||||
if (player->HasSkill(SKILL_ENGINEERING))
|
||||
AddPctN(damage, 25);
|
||||
AddPct(damage, 25);
|
||||
break;
|
||||
}
|
||||
case 71132: // Glyph of Shadow Word: Pain
|
||||
damage = int32(CalculatePctN(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc
|
||||
damage = int32(CalculatePct(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1973,7 +1973,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
|
||||
if (maxPower == 0)
|
||||
return;
|
||||
|
||||
uint32 gain = CalculatePctN(maxPower, damage);
|
||||
uint32 gain = CalculatePct(maxPower, damage);
|
||||
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power);
|
||||
}
|
||||
|
||||
@@ -3364,7 +3364,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00008800 && unitTarget->HasAuraState(AURA_STATE_BLEEDING))
|
||||
{
|
||||
if (AuraEffect const* rendAndTear = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 0))
|
||||
AddPctN(totalDamagePercentMod, rendAndTear->GetAmount());
|
||||
AddPct(totalDamagePercentMod, rendAndTear->GetAmount());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3382,7 +3382,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
{
|
||||
// Glyph of Plague Strike
|
||||
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(58657, EFFECT_0))
|
||||
AddPctN(totalDamagePercentMod, aurEff->GetAmount());
|
||||
AddPct(totalDamagePercentMod, aurEff->GetAmount());
|
||||
break;
|
||||
}
|
||||
// Blood Strike
|
||||
@@ -3391,13 +3391,13 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f;
|
||||
// Death Knight T8 Melee 4P Bonus
|
||||
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
|
||||
AddPctF(bonusPct, aurEff->GetAmount());
|
||||
AddPctF(totalDamagePercentMod, bonusPct);
|
||||
AddPct(bonusPct, aurEff->GetAmount());
|
||||
AddPct(totalDamagePercentMod, bonusPct);
|
||||
|
||||
// Glyph of Blood Strike
|
||||
if (m_caster->GetAuraEffect(59332, EFFECT_0))
|
||||
if (unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
|
||||
AddPctN(totalDamagePercentMod, 20);
|
||||
AddPct(totalDamagePercentMod, 20);
|
||||
break;
|
||||
}
|
||||
// Death Strike
|
||||
@@ -3406,7 +3406,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
// Glyph of Death Strike
|
||||
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(59336, EFFECT_0))
|
||||
if (uint32 runic = std::min<uint32>(m_caster->GetPower(POWER_RUNIC_POWER), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
|
||||
AddPctN(totalDamagePercentMod, runic);
|
||||
AddPct(totalDamagePercentMod, runic);
|
||||
break;
|
||||
}
|
||||
// Obliterate (12.5% more damage per disease)
|
||||
@@ -3422,14 +3422,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f;
|
||||
// Death Knight T8 Melee 4P Bonus
|
||||
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
|
||||
AddPctF(bonusPct, aurEff->GetAmount());
|
||||
AddPctF(totalDamagePercentMod, bonusPct);
|
||||
AddPct(bonusPct, aurEff->GetAmount());
|
||||
AddPct(totalDamagePercentMod, bonusPct);
|
||||
break;
|
||||
}
|
||||
// Blood-Caked Strike - Blood-Caked Blade
|
||||
if (m_spellInfo->SpellIconID == 1736)
|
||||
{
|
||||
AddPctF(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f);
|
||||
AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f);
|
||||
break;
|
||||
}
|
||||
// Heart Strike
|
||||
@@ -3438,9 +3438,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
|
||||
// Death Knight T8 Melee 4P Bonus
|
||||
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
|
||||
AddPctF(bonusPct, aurEff->GetAmount());
|
||||
AddPct(bonusPct, aurEff->GetAmount());
|
||||
|
||||
AddPctF(totalDamagePercentMod, bonusPct);
|
||||
AddPct(totalDamagePercentMod, bonusPct);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -3462,7 +3462,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
normalized = true;
|
||||
break;
|
||||
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
|
||||
ApplyPctN(weaponDamagePercentMod, CalculateDamage(j, unitTarget));
|
||||
ApplyPct(weaponDamagePercentMod, CalculateDamage(j, unitTarget));
|
||||
break;
|
||||
default:
|
||||
break; // not weapon damage effect, just skip
|
||||
@@ -3633,36 +3633,10 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
|
||||
// Wild object not have owner and check clickable by players
|
||||
map->AddToMap(pGameObj);
|
||||
|
||||
if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* player = m_caster->ToPlayer();
|
||||
Battleground* bg = player->GetBattleground();
|
||||
|
||||
switch (pGameObj->GetMapId())
|
||||
{
|
||||
case 489: //WS
|
||||
{
|
||||
if (bg && bg->GetTypeID(true) == BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
uint32 team = ALLIANCE;
|
||||
|
||||
if (player->GetTeam() == team)
|
||||
team = HORDE;
|
||||
|
||||
((BattlegroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(), team);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 566: //EY
|
||||
{
|
||||
if (bg && bg->GetTypeID(true) == BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
((BattlegroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP)
|
||||
if (Player* player = m_caster->ToPlayer())
|
||||
if (Battleground* bg = player->GetBattleground())
|
||||
bg->SetDroppedFlagGUID(pGameObj->GetGUID(), player->GetTeam() == ALLIANCE ? TEAM_HORDE: TEAM_ALLIANCE);
|
||||
|
||||
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
|
||||
{
|
||||
@@ -4938,7 +4912,7 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
|
||||
return;
|
||||
|
||||
uint32 health = target->CountPctFromMaxHealth(damage);
|
||||
uint32 mana = CalculatePctN(target->GetMaxPower(POWER_MANA), damage);
|
||||
uint32 mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage);
|
||||
|
||||
ExecuteLogEffectResurrect(effIndex, target);
|
||||
|
||||
@@ -5088,7 +5062,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
|
||||
{
|
||||
health = m_caster->CountPctFromMaxHealth(damage);
|
||||
if (m_caster->GetMaxPower(POWER_MANA) > 0)
|
||||
mana = CalculatePctN(m_caster->GetMaxPower(POWER_MANA), damage);
|
||||
mana = CalculatePct(m_caster->GetMaxPower(POWER_MANA), damage);
|
||||
}
|
||||
|
||||
Player* player = m_caster->ToPlayer();
|
||||
@@ -5404,12 +5378,12 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/)
|
||||
if (spellInfo)
|
||||
{
|
||||
mana += spellInfo->ManaCost;
|
||||
mana += int32(CalculatePctU(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
|
||||
mana += int32(CalculatePct(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
|
||||
}
|
||||
totem->ToTotem()->UnSummon();
|
||||
}
|
||||
}
|
||||
ApplyPctN(mana, damage);
|
||||
ApplyPct(mana, damage);
|
||||
if (mana)
|
||||
m_caster->CastCustomSpell(m_caster, 39104, &mana, NULL, NULL, true);
|
||||
}
|
||||
|
||||
@@ -2026,16 +2026,16 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask)
|
||||
{
|
||||
// health as power used
|
||||
case POWER_HEALTH:
|
||||
powerCost += int32(CalculatePctU(caster->GetCreateHealth(), ManaCostPercentage));
|
||||
powerCost += int32(CalculatePct(caster->GetCreateHealth(), ManaCostPercentage));
|
||||
break;
|
||||
case POWER_MANA:
|
||||
powerCost += int32(CalculatePctU(caster->GetCreateMana(), ManaCostPercentage));
|
||||
powerCost += int32(CalculatePct(caster->GetCreateMana(), ManaCostPercentage));
|
||||
break;
|
||||
case POWER_RAGE:
|
||||
case POWER_FOCUS:
|
||||
case POWER_ENERGY:
|
||||
case POWER_HAPPINESS:
|
||||
powerCost += int32(CalculatePctU(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage));
|
||||
powerCost += int32(CalculatePct(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage));
|
||||
break;
|
||||
case POWER_RUNE:
|
||||
case POWER_RUNIC_POWER:
|
||||
|
||||
@@ -3599,6 +3599,13 @@ void SpellMgr::LoadDbcDataCorrections()
|
||||
spellInfo->manaCost = 0;
|
||||
spellInfo->manaPerSecond = 0;
|
||||
break;
|
||||
// OCULUS SPELLS
|
||||
// The spells below are here, because their effect 1 is giving warning, because the triggered spell is not found in dbc and is missing from encounter sniff.
|
||||
case 49462: // Call Ruby Drake
|
||||
case 49461: // Call Amber Drake
|
||||
case 49345: // Call Emerald Drake
|
||||
spellInfo->Effect[1] = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -201,8 +201,8 @@ public:
|
||||
float z = player->GetPositionZ();
|
||||
float ang = player->GetOrientation();
|
||||
|
||||
float rot2 = sin(ang/2);
|
||||
float rot3 = cos(ang/2);
|
||||
float rot2 = std::sin(ang/2);
|
||||
float rot3 = std::cos(ang/2);
|
||||
|
||||
uint32 objectId = atoi(id);
|
||||
|
||||
|
||||
@@ -39,12 +39,12 @@ public:
|
||||
{ "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "", NULL },
|
||||
{ "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "", NULL },
|
||||
{ "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
@@ -408,9 +408,9 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Tokens entries(std::string(args), ' ');
|
||||
Tokenizer entries(std::string(args), ' ');
|
||||
|
||||
for (Tokens::const_iterator itr = entries.begin(); itr != entries.end(); ++itr)
|
||||
for (Tokenizer::const_iterator itr = entries.begin(); itr != entries.end(); ++itr)
|
||||
{
|
||||
uint32 entry = uint32(atoi(*itr));
|
||||
|
||||
|
||||
@@ -210,16 +210,16 @@ public:
|
||||
pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
float angle = me->GetAngle(pAttumen);
|
||||
float distance = me->GetDistance2d(pAttumen);
|
||||
float newX = me->GetPositionX() + cos(angle)*(distance/2);
|
||||
float newY = me->GetPositionY() + sin(angle)*(distance/2);
|
||||
float newX = me->GetPositionX() + std::cos(angle)*(distance/2);
|
||||
float newY = me->GetPositionY() + std::sin(angle)*(distance/2);
|
||||
float newZ = 50;
|
||||
//me->Relocate(newX, newY, newZ, angle);
|
||||
//me->SendMonsterMove(newX, newY, newZ, 0, true, 1000);
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
|
||||
distance += 10;
|
||||
newX = me->GetPositionX() + cos(angle)*(distance/2);
|
||||
newY = me->GetPositionY() + sin(angle)*(distance/2);
|
||||
newX = me->GetPositionX() + std::cos(angle)*(distance/2);
|
||||
newY = me->GetPositionY() + std::sin(angle)*(distance/2);
|
||||
pAttumen->GetMotionMaster()->Clear();
|
||||
pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
|
||||
//pAttumen->Relocate(newX, newY, newZ, -angle);
|
||||
|
||||
@@ -774,8 +774,8 @@ public:
|
||||
for (uint8 i = 1; i < Phase; ++i)
|
||||
{
|
||||
float sx, sy;
|
||||
sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]);
|
||||
sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]);
|
||||
sx = ShieldOrbLocations[0][0] + std::sin(ShieldOrbLocations[i][0]);
|
||||
sy = ShieldOrbLocations[0][1] + std::sin(ShieldOrbLocations[i][1]);
|
||||
me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
|
||||
}
|
||||
Timer[TIMER_SUMMON_SHILEDORB] = urand(30000, 60000); // 30-60seconds cooldown
|
||||
@@ -1207,13 +1207,13 @@ public:
|
||||
{
|
||||
if (bClockwise)
|
||||
{
|
||||
y = my - r * sin(c);
|
||||
x = mx - r * cos(c);
|
||||
y = my - r * std::sin(c);
|
||||
x = mx - r * std::cos(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
y = my + r * sin(c);
|
||||
x = mx + r * cos(c);
|
||||
y = my + r * std::sin(c);
|
||||
x = mx + r * std::cos(c);
|
||||
}
|
||||
bPointReached = false;
|
||||
uiCheckTimer = 1000;
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Comment: Find correct mushrooms spell to make them visible - buffs of the mushrooms not ever applied to the users...
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ahnkahet.h"
|
||||
@@ -34,12 +30,24 @@ enum Spells
|
||||
SPELL_POISONOUS_MUSHROOM_VISUAL_AREA = 61566, // Self
|
||||
SPELL_POISONOUS_MUSHROOM_VISUAL_AURA = 56741, // Self
|
||||
SPELL_PUTRID_MUSHROOM = 31690, // To make the mushrooms visible
|
||||
SPELL_POWER_MUSHROOM_VISUAL_AURA = 56740,
|
||||
};
|
||||
|
||||
enum Creatures
|
||||
{
|
||||
NPC_HEALTHY_MUSHROOM = 30391,
|
||||
NPC_POISONOUS_MUSHROOM = 30435
|
||||
NPC_HEALTHY_MUSHROOM = 30391,
|
||||
NPC_POISONOUS_MUSHROOM = 30435,
|
||||
NPC_TRIGGER = 19656
|
||||
};
|
||||
|
||||
enum event
|
||||
{
|
||||
EVENT_SPAWN = 1,
|
||||
EVENT_MINI,
|
||||
EVENT_ROOT,
|
||||
EVENT_BASH,
|
||||
EVENT_BOLT,
|
||||
EVENT_AURA
|
||||
};
|
||||
|
||||
class boss_amanitar : public CreatureScript
|
||||
@@ -47,110 +55,118 @@ class boss_amanitar : public CreatureScript
|
||||
public:
|
||||
boss_amanitar() : CreatureScript("boss_amanitar") { }
|
||||
|
||||
struct boss_amanitarAI : public ScriptedAI
|
||||
struct boss_amanitarAI : public BossAI
|
||||
{
|
||||
boss_amanitarAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
bFirstTime = true;
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
|
||||
uint32 uiRootTimer;
|
||||
uint32 uiBashTimer;
|
||||
uint32 uiBoltTimer;
|
||||
uint32 uiSpawnTimer;
|
||||
|
||||
bool bFirstTime;
|
||||
|
||||
boss_amanitarAI(Creature* creature) : BossAI(creature, DATA_AMANITAR) { }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
uiRootTimer = urand(5*IN_MILLISECONDS, 9*IN_MILLISECONDS);
|
||||
uiBashTimer = urand(10*IN_MILLISECONDS, 14*IN_MILLISECONDS);
|
||||
uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
|
||||
uiSpawnTimer = 0;
|
||||
|
||||
_Reset();
|
||||
|
||||
me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE);
|
||||
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
|
||||
summons.DespawnAll();
|
||||
|
||||
if (instance)
|
||||
{
|
||||
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
|
||||
if (!bFirstTime)
|
||||
instance->SetData(DATA_AMANITAR_EVENT, FAIL);
|
||||
else
|
||||
bFirstTime = false;
|
||||
instance->SetData(DATA_AMANITAR_EVENT, NOT_STARTED);
|
||||
}
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
void JustDied(Unit* /*Killer*/)
|
||||
{
|
||||
if (instance)
|
||||
{
|
||||
_JustDied();
|
||||
instance->SetData(DATA_AMANITAR_EVENT, DONE);
|
||||
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
|
||||
summons.DespawnAll();
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/)
|
||||
{
|
||||
_EnterCombat();
|
||||
|
||||
events.ScheduleEvent(EVENT_ROOT, urand(5,9)*IN_MILLISECONDS);
|
||||
events.ScheduleEvent(EVENT_BASH, urand(10,14)*IN_MILLISECONDS);
|
||||
events.ScheduleEvent(EVENT_BOLT, urand(15,20)*IN_MILLISECONDS);
|
||||
events.ScheduleEvent(EVENT_MINI, urand(12,18)*IN_MILLISECONDS);
|
||||
events.ScheduleEvent(EVENT_SPAWN, 5 *IN_MILLISECONDS);
|
||||
|
||||
me->SetInCombatWithZone();
|
||||
if (instance)
|
||||
instance->SetData(DATA_AMANITAR_EVENT, IN_PROGRESS);
|
||||
|
||||
DoCast(me, SPELL_MINI, false);
|
||||
}
|
||||
|
||||
void SpawnAdds()
|
||||
{
|
||||
uint8 u = 0;
|
||||
|
||||
for (uint8 i = 0; i < 30; ++i)
|
||||
{
|
||||
Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0);
|
||||
Position pos;
|
||||
me->GetPosition(&pos);
|
||||
me->GetRandomNearPosition(pos, 30.0f);
|
||||
pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;
|
||||
|
||||
if (victim)
|
||||
if (Creature* trigger = me->SummonCreature(NPC_TRIGGER, pos))
|
||||
{
|
||||
Position pos;
|
||||
victim->GetPosition(&pos);
|
||||
me->GetRandomNearPosition(pos, float(urand(5, 80)));
|
||||
me->SummonCreature(NPC_POISONOUS_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30*IN_MILLISECONDS);
|
||||
me->GetRandomNearPosition(pos, float(urand(5, 80)));
|
||||
me->SummonCreature(NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30*IN_MILLISECONDS);
|
||||
Creature* temp1 = trigger->FindNearestCreature(NPC_HEALTHY_MUSHROOM, 4.0f, true);
|
||||
Creature* temp2 = trigger->FindNearestCreature(NPC_POISONOUS_MUSHROOM, 4.0f, true);
|
||||
if (temp1 || temp2)
|
||||
{
|
||||
trigger->DisappearAndDie();
|
||||
}
|
||||
else
|
||||
{
|
||||
u = 1 - u;
|
||||
trigger->DisappearAndDie();
|
||||
me->SummonCreature(u > 0 ? NPC_POISONOUS_MUSHROOM : NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60*IN_MILLISECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiSpawnTimer <= diff)
|
||||
{
|
||||
SpawnAdds();
|
||||
uiSpawnTimer = urand(35*IN_MILLISECONDS, 40*IN_MILLISECONDS);
|
||||
} else uiSpawnTimer -= diff;
|
||||
events.Update(diff);
|
||||
|
||||
if (uiRootTimer <= diff)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
DoCast(target, SPELL_ENTANGLING_ROOTS);
|
||||
uiRootTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
|
||||
} else uiRootTimer -= diff;
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
if (uiBashTimer <= diff)
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
DoCastVictim(SPELL_BASH);
|
||||
uiBashTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
|
||||
} else uiBashTimer -= diff;
|
||||
|
||||
if (uiBoltTimer <= diff)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
DoCast(target, SPELL_VENOM_BOLT_VOLLEY);
|
||||
uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
|
||||
} else uiBoltTimer -= diff;
|
||||
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_SPAWN:
|
||||
SpawnAdds();
|
||||
events.ScheduleEvent(EVENT_SPAWN, 20*IN_MILLISECONDS);
|
||||
break;
|
||||
case EVENT_MINI:
|
||||
DoCast(SPELL_MINI);
|
||||
events.ScheduleEvent(EVENT_MINI, urand(25,30)*IN_MILLISECONDS);
|
||||
break;
|
||||
case EVENT_ROOT:
|
||||
DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_ENTANGLING_ROOTS,true);
|
||||
events.ScheduleEvent(EVENT_ROOT, urand(10,15)*IN_MILLISECONDS);
|
||||
break;
|
||||
case EVENT_BASH:
|
||||
DoCastVictim(SPELL_BASH);
|
||||
events.ScheduleEvent(EVENT_BASH, urand(7,12)*IN_MILLISECONDS);
|
||||
break;
|
||||
case EVENT_BOLT:
|
||||
DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_VENOM_BOLT_VOLLEY,true);
|
||||
events.ScheduleEvent(EVENT_BOLT, urand(18,22)*IN_MILLISECONDS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
@@ -170,30 +186,26 @@ public:
|
||||
{
|
||||
mob_amanitar_mushroomsAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
|
||||
|
||||
uint32 uiAuraTimer;
|
||||
uint32 uiDeathTimer;
|
||||
EventMap events;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
DoCast(me, SPELL_PUTRID_MUSHROOM, true); // Hack, to make the mushrooms visible, can't find orig. spell...
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_AURA, 1*IN_MILLISECONDS);
|
||||
|
||||
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
|
||||
DoCast(SPELL_PUTRID_MUSHROOM);
|
||||
|
||||
if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
|
||||
DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AURA, true);
|
||||
|
||||
uiAuraTimer = 0;
|
||||
uiDeathTimer = 30*IN_MILLISECONDS;
|
||||
DoCast(SPELL_POISONOUS_MUSHROOM_VISUAL_AURA);
|
||||
else
|
||||
DoCast(SPELL_POWER_MUSHROOM_VISUAL_AURA);
|
||||
}
|
||||
|
||||
void JustDied(Unit* killer)
|
||||
void DamageTaken(Unit* /*attacker*/, uint32 &damage)
|
||||
{
|
||||
if (!killer)
|
||||
return;
|
||||
|
||||
if (me->GetEntry() == NPC_HEALTHY_MUSHROOM && killer->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
DoCast(killer, SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, false);
|
||||
}
|
||||
if (damage >= me->GetHealth() && me->GetEntry() == NPC_HEALTHY_MUSHROOM)
|
||||
DoCast(me, SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, true);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) {}
|
||||
@@ -201,18 +213,30 @@ public:
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
if (uiAuraTimer <= diff)
|
||||
switch (eventId)
|
||||
{
|
||||
DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true);
|
||||
DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD, false);
|
||||
uiAuraTimer = 7*IN_MILLISECONDS;
|
||||
} else uiAuraTimer -= diff;
|
||||
case EVENT_AURA:
|
||||
if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
|
||||
{
|
||||
DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true);
|
||||
DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD);
|
||||
}
|
||||
events.ScheduleEvent(EVENT_AURA, 7*IN_MILLISECONDS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (uiDeathTimer <= diff)
|
||||
me->DisappearAndDie();
|
||||
else uiDeathTimer -= diff;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -224,6 +248,6 @@ public:
|
||||
|
||||
void AddSC_boss_amanitar()
|
||||
{
|
||||
new boss_amanitar;
|
||||
new mob_amanitar_mushrooms;
|
||||
}
|
||||
new boss_amanitar();
|
||||
new mob_amanitar_mushrooms();
|
||||
}
|
||||
@@ -44,16 +44,13 @@ enum Creatures
|
||||
MOB_TWISTED_VISAGE = 30625
|
||||
};
|
||||
|
||||
//not in db
|
||||
|
||||
enum Yells
|
||||
{
|
||||
SAY_AGGRO = -1619030,
|
||||
SAY_SLAY_1 = -1619031,
|
||||
SAY_SLAY_2 = -1619032,
|
||||
SAY_SLAY_3 = -1619033,
|
||||
SAY_DEATH_1 = -1619034,
|
||||
SAY_DEATH_2 = -1619035,
|
||||
SAY_PHASE = -1619036
|
||||
SAY_AGGRO = 0,
|
||||
SAY_SLAY = 1,
|
||||
SAY_DEATH = 2,
|
||||
SAY_PHASE = 3
|
||||
};
|
||||
|
||||
enum Achievements
|
||||
@@ -177,7 +174,7 @@ public:
|
||||
|
||||
void EnterCombat(Unit* /*who*/)
|
||||
{
|
||||
DoScriptText(SAY_AGGRO, me);
|
||||
Talk(SAY_AGGRO);
|
||||
|
||||
if (instance)
|
||||
{
|
||||
@@ -300,7 +297,7 @@ public:
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
{
|
||||
DoScriptText(SAY_DEATH_1, me);
|
||||
Talk(SAY_DEATH);
|
||||
|
||||
if (instance)
|
||||
instance->SetData(DATA_HERALD_VOLAZJ, DONE);
|
||||
@@ -311,7 +308,7 @@ public:
|
||||
|
||||
void KilledUnit(Unit* /*victim*/)
|
||||
{
|
||||
DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -23,22 +23,15 @@
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ahnkahet.h"
|
||||
|
||||
|
||||
enum Yells
|
||||
{
|
||||
TEXT_AGGRO = -1619000,
|
||||
TEXT_SACRIFICE_1_1 = -1619001,
|
||||
TEXT_SACRIFICE_1_2 = -1619002,
|
||||
TEXT_SACRIFICE_2_1 = -1619003,
|
||||
TEXT_SACRIFICE_2_2 = -1619004,
|
||||
TEXT_SLAY_1 = -1619005,
|
||||
TEXT_SLAY_2 = -1619006,
|
||||
TEXT_SLAY_3 = -1619007,
|
||||
TEXT_DEATH = -1619008,
|
||||
TEXT_PREACHING_1 = -1619009,
|
||||
TEXT_PREACHING_2 = -1619010,
|
||||
TEXT_PREACHING_3 = -1619011,
|
||||
TEXT_PREACHING_4 = -1619012,
|
||||
TEXT_PREACHING_5 = -1619013
|
||||
TEXT_AGGRO = 0,
|
||||
TEXT_SACRIFICE_1 = 1,
|
||||
TEXT_SACRIFICE_2 = 2,
|
||||
TEXT_SLAY = 3,
|
||||
TEXT_DEATH = 4,
|
||||
TEXT_PREACHING = 5
|
||||
};
|
||||
|
||||
enum Spells
|
||||
@@ -129,7 +122,7 @@ public:
|
||||
if (!instance || (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_JEDOGA_CONTROLLER))
|
||||
return;
|
||||
|
||||
DoScriptText(TEXT_AGGRO, me);
|
||||
Talk(TEXT_AGGRO);
|
||||
me->SetInCombatWithZone();
|
||||
instance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, IN_PROGRESS);
|
||||
}
|
||||
@@ -147,12 +140,12 @@ public:
|
||||
if (!Victim || Victim->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
DoScriptText(RAND(TEXT_SLAY_1, TEXT_SLAY_2, TEXT_SLAY_3), me);
|
||||
Talk(TEXT_SLAY);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
{
|
||||
DoScriptText(TEXT_DEATH, me);
|
||||
Talk(TEXT_DEATH);
|
||||
if (instance)
|
||||
instance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, DONE);
|
||||
}
|
||||
@@ -178,7 +171,7 @@ public:
|
||||
|
||||
if (!bPreDone && who->GetTypeId() == TYPEID_PLAYER && me->GetDistance(who) < 100.0f)
|
||||
{
|
||||
DoScriptText(RAND(TEXT_PREACHING_1, TEXT_PREACHING_2, TEXT_PREACHING_3, TEXT_PREACHING_4, TEXT_PREACHING_5), me);
|
||||
Talk(TEXT_PREACHING);
|
||||
bPreDone = true;
|
||||
}
|
||||
|
||||
@@ -270,7 +263,7 @@ public:
|
||||
|
||||
if (opfer)
|
||||
{
|
||||
DoScriptText(RAND(TEXT_SACRIFICE_1_1, TEXT_SACRIFICE_1_2), me);
|
||||
Talk(TEXT_SACRIFICE_1);
|
||||
instance->SetData64(DATA_ADD_JEDOGA_OPFER, opfer);
|
||||
} else
|
||||
bCanDown = true;
|
||||
@@ -278,7 +271,7 @@ public:
|
||||
|
||||
void Opfern()
|
||||
{
|
||||
DoScriptText(RAND(TEXT_SACRIFICE_2_1, TEXT_SACRIFICE_2_2), me);
|
||||
Talk(TEXT_SACRIFICE_2);
|
||||
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
DoCast(me, SPELL_GIFT_OF_THE_HERALD, false);
|
||||
@@ -534,11 +527,11 @@ public:
|
||||
{
|
||||
npc_jedogas_aufseher_triggerAI(Creature* creature) : Scripted_NoMovementAI(creature)
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
bRemoved = false;
|
||||
bRemoved2 = false;
|
||||
bCasted = false;
|
||||
bCasted2 = false;
|
||||
instance = creature->GetInstanceScript();
|
||||
bRemoved = false;
|
||||
bRemoved2 = false;
|
||||
bCasted = false;
|
||||
bCasted2 = false;
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
|
||||
@@ -140,8 +140,8 @@ public:
|
||||
{
|
||||
float angle, x, y;
|
||||
angle = pSpheres[0]->GetAngle(pSphereTarget);
|
||||
x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * cos(angle);
|
||||
y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * sin(angle);
|
||||
x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle);
|
||||
y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle);
|
||||
pSpheres[0]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[0]->GetPositionZ());
|
||||
}
|
||||
if (IsHeroic())
|
||||
@@ -154,12 +154,12 @@ public:
|
||||
{
|
||||
float angle, x, y;
|
||||
angle = pSpheres[1]->GetAngle(pSphereTarget) + DATA_SPHERE_ANGLE_OFFSET;
|
||||
x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle);
|
||||
y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle);
|
||||
x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
|
||||
y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
|
||||
pSpheres[1]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[1]->GetPositionZ());
|
||||
angle = pSpheres[2]->GetAngle(pSphereTarget) - DATA_SPHERE_ANGLE_OFFSET;
|
||||
x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle);
|
||||
y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle);
|
||||
x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
|
||||
y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
|
||||
pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,8 @@ enum Spells
|
||||
SPELL_SUMMON_CARRION_BEETLES = 53521,
|
||||
SPELL_LEECHING_SWARM = 53467,
|
||||
SPELL_POUND = 53472,
|
||||
SPELL_POUND_H = 59433,
|
||||
SPELL_SUBMERGE = 53421,
|
||||
SPELL_IMPALE_DMG = 53454,
|
||||
SPELL_IMPALE_DMG_H = 59446,
|
||||
SPELL_IMPALE_SHAKEGROUND = 53455,
|
||||
SPELL_IMPALE_SPIKE = 53539, //this is not the correct visual effect
|
||||
//SPELL_IMPALE_TARGET = 53458,
|
||||
@@ -211,7 +209,7 @@ public:
|
||||
break;
|
||||
case IMPALE_PHASE_DMG:
|
||||
if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget))
|
||||
me->CastSpell(impaleTarget, DUNGEON_MODE(SPELL_IMPALE_DMG, SPELL_IMPALE_DMG_H), true);
|
||||
me->CastSpell(impaleTarget, SPELL_IMPALE_DMG, true);
|
||||
ImpalePhase = IMPALE_PHASE_TARGET;
|
||||
ImpaleTimer = 9*IN_MILLISECONDS;
|
||||
break;
|
||||
@@ -328,7 +326,7 @@ public:
|
||||
if (Unit* target = me->getVictim())
|
||||
{
|
||||
if (Creature* pImpaleTarget = DoSummonImpaleTarget(target))
|
||||
me->CastSpell(pImpaleTarget, DUNGEON_MODE(SPELL_POUND, SPELL_POUND_H), false);
|
||||
me->CastSpell(pImpaleTarget, SPELL_POUND, false);
|
||||
}
|
||||
PoundTimer = 16500;
|
||||
} else PoundTimer -= diff;
|
||||
|
||||
+28
-7
@@ -42,6 +42,8 @@ enum Events
|
||||
EVENT_FLIGHT = 2,
|
||||
EVENT_FLAME_BREATH = 3,
|
||||
EVENT_CONFLAGRATION = 4,
|
||||
EVENT_LAND_GROUND = 5,
|
||||
EVENT_AIR_MOVEMENT = 6,
|
||||
|
||||
// Event group
|
||||
EVENT_GROUP_LAND_PHASE = 1,
|
||||
@@ -51,6 +53,8 @@ enum MovementPoints
|
||||
{
|
||||
POINT_FLIGHT = 1,
|
||||
POINT_LAND = 2,
|
||||
POINT_TAKEOFF = 3,
|
||||
POINT_LAND_GROUND = 4
|
||||
};
|
||||
|
||||
enum Misc
|
||||
@@ -58,8 +62,9 @@ enum Misc
|
||||
SOUND_ID_DEATH = 17531,
|
||||
};
|
||||
|
||||
Position const SavianaRagefireFlyPos = {3155.51f, 683.844f, 95.20f, 4.69f};
|
||||
Position const SavianaRagefireLandPos = {3151.07f, 636.443f, 79.54f, 4.69f};
|
||||
Position const SavianaRagefireFlyOutPos = {3155.51f, 683.844f, 95.0f, 4.69f};
|
||||
Position const SavianaRagefireFlyInPos = {3151.07f, 636.443f, 79.540f, 4.69f};
|
||||
Position const SavianaRagefireLandPos = {3151.07f, 636.443f, 78.649f, 4.69f};
|
||||
|
||||
class boss_saviana_ragefire : public CreatureScript
|
||||
{
|
||||
@@ -96,7 +101,7 @@ class boss_saviana_ragefire : public CreatureScript
|
||||
|
||||
void MovementInform(uint32 type, uint32 point)
|
||||
{
|
||||
if (type != POINT_MOTION_TYPE)
|
||||
if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
|
||||
return;
|
||||
|
||||
switch (point)
|
||||
@@ -106,13 +111,18 @@ class boss_saviana_ragefire : public CreatureScript
|
||||
Talk(SAY_CONFLAGRATION);
|
||||
break;
|
||||
case POINT_LAND:
|
||||
events.ScheduleEvent(EVENT_LAND_GROUND, 1);
|
||||
break;
|
||||
case POINT_LAND_GROUND:
|
||||
me->SetCanFly(false);
|
||||
me->SetDisableGravity(false);
|
||||
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
DoStartMovement(me->getVictim());
|
||||
break;
|
||||
case POINT_TAKEOFF:
|
||||
events.ScheduleEvent(EVENT_AIR_MOVEMENT, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -149,8 +159,13 @@ class boss_saviana_ragefire : public CreatureScript
|
||||
{
|
||||
me->SetCanFly(true);
|
||||
me->SetDisableGravity(true);
|
||||
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyPos);
|
||||
me->AttackStop();
|
||||
Position pos;
|
||||
pos.Relocate(me);
|
||||
pos.m_positionZ += 10.0f;
|
||||
me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, pos);
|
||||
events.ScheduleEvent(EVENT_FLIGHT, 50000);
|
||||
events.DelayEvents(12500, EVENT_GROUP_LAND_PHASE);
|
||||
break;
|
||||
@@ -167,6 +182,12 @@ class boss_saviana_ragefire : public CreatureScript
|
||||
DoCastVictim(SPELL_FLAME_BREATH);
|
||||
events.ScheduleEvent(EVENT_FLAME_BREATH, urand(20000, 30000), EVENT_GROUP_LAND_PHASE);
|
||||
break;
|
||||
case EVENT_AIR_MOVEMENT:
|
||||
me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyOutPos);
|
||||
break;
|
||||
case EVENT_LAND_GROUND:
|
||||
me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SavianaRagefireLandPos);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -243,7 +264,7 @@ class spell_saviana_conflagration_throwback : public SpellScriptLoader
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
GetHitUnit()->GetMotionMaster()->MovePoint(POINT_LAND, SavianaRagefireLandPos);
|
||||
GetHitUnit()->GetMotionMaster()->MovePoint(POINT_LAND, SavianaRagefireFlyInPos);
|
||||
}
|
||||
|
||||
void Register()
|
||||
|
||||
@@ -1585,7 +1585,7 @@ class spell_valanar_kinetic_bomb_absorb : public SpellScriptLoader
|
||||
|
||||
void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
|
||||
{
|
||||
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), aurEff->GetAmount());
|
||||
absorbAmount = CalculatePct(dmgInfo.GetDamage(), aurEff->GetAmount());
|
||||
RoundToInterval<uint32>(absorbAmount, 0, dmgInfo.GetDamage());
|
||||
dmgInfo.AbsorbDamage(absorbAmount);
|
||||
}
|
||||
|
||||
@@ -722,7 +722,7 @@ class npc_putricide_oozeAI : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
npc_putricide_oozeAI(Creature* creature, uint32 hitTargetSpellId) : ScriptedAI(creature),
|
||||
_newTargetSelectTimer(0), _hitTargetSpellId(hitTargetSpellId)
|
||||
_hitTargetSpellId(hitTargetSpellId), _newTargetSelectTimer(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -207,9 +207,7 @@ class mob_chaotic_rift : public CreatureScript
|
||||
{
|
||||
uiChaoticEnergyBurstTimer = 1000;
|
||||
uiSummonCrazedManaWraithTimer = 5000;
|
||||
//me->SetDisplayId(25206); //For some reason in DB models for ally and horde are different.
|
||||
//Model for ally (1126) does not show auras. Horde model works perfect.
|
||||
//Set model to horde number
|
||||
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
|
||||
DoCast(me, SPELL_ARCANEFORM, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,14 +129,14 @@ public:
|
||||
{
|
||||
if (uiCrystalSpikesTimer2 <= diff)
|
||||
{
|
||||
fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO));
|
||||
fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO));
|
||||
fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO));
|
||||
fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO));
|
||||
fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2)));
|
||||
fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2)));
|
||||
fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2)));
|
||||
fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2)));
|
||||
fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO));
|
||||
fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO));
|
||||
fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO));
|
||||
fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO));
|
||||
fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2)));
|
||||
fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2)));
|
||||
fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2)));
|
||||
fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2)));
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS);
|
||||
if (++uiCrystalSpikesCount >= 13)
|
||||
|
||||
@@ -68,51 +68,6 @@ enum Actions
|
||||
ACTION_SET_NORMAL_EVENTS = 1
|
||||
};
|
||||
|
||||
/*Ruby Drake,
|
||||
(npc 27756) (item 37860)
|
||||
(summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756)
|
||||
*/
|
||||
enum RubyDrake
|
||||
{
|
||||
NPC_RUBY_DRAKE_VEHICLE = 27756,
|
||||
SPELL_RIDE_RUBY_DRAKE_QUE = 49463, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464
|
||||
SPELL_RUBY_DRAKE_SADDLE = 49464, //Allows you to ride on the back of an Amber Drake. ---> Dummy
|
||||
SPELL_RUBY_SEARING_WRATH = 50232, //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets
|
||||
SPELL_RUBY_EVASIVE_AURA = 50248, //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells.
|
||||
SPELL_RUBY_EVASIVE_MANEUVERS = 50240, //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted.
|
||||
//you do not have acces to until you kill Mage-Lord Urom
|
||||
SPELL_RUBY_MARTYR = 50253 //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec.
|
||||
};
|
||||
/*Amber Drake,
|
||||
(npc 27755) (item 37859)
|
||||
(summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755)
|
||||
*/
|
||||
enum AmberDrake
|
||||
{
|
||||
NPC_AMBER_DRAKE_VEHICLE = 27755,
|
||||
SPELL_RIDE_AMBER_DRAKE_QUE = 49459, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460
|
||||
SPELL_AMBER_DRAKE_SADDLE = 49460, //Allows you to ride on the back of an Amber Drake. ---> Dummy
|
||||
SPELL_AMBER_SHOCK_LANCE = 49840, //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated.
|
||||
// SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target.
|
||||
//you do not have access to until you kill the Mage-Lord Urom.
|
||||
SPELL_AMBER_TEMPORAL_RIFT = 49592 //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated.
|
||||
};
|
||||
|
||||
/*Emerald Drake,
|
||||
(npc 27692) (item 37815),
|
||||
(summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692)
|
||||
*/
|
||||
enum EmeraldDrake
|
||||
{
|
||||
NPC_EMERALD_DRAKE_VEHICLE = 27692,
|
||||
SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346
|
||||
SPELL_EMERALD_DRAKE_SADDLE = 49346, //Allows you to ride on the back of an Amber Drake. ---> Dummy
|
||||
SPELL_EMERALD_LEECHING_POISON = 50328, //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times.
|
||||
SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec.
|
||||
// you do not have access to until you kill the Mage-Lord Urom
|
||||
SPELL_EMERALD_DREAM_FUNNEL = 50344 //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels.
|
||||
};
|
||||
|
||||
enum EregosData
|
||||
{
|
||||
DATA_RUBY_VOID = 0, // http://www.wowhead.com/achievement=2044
|
||||
|
||||
@@ -38,7 +38,8 @@ enum Spells
|
||||
SPELL_SUMMON_MENAGERIE_3 = 50496,
|
||||
SPELL_TELEPORT = 51112, //Teleports to the center of Oculus
|
||||
SPELL_TIME_BOMB = 51121, //Deals arcane damage to a random player, and after 6 seconds, deals zone damage to nearby equal to the health missing of the target afflicted by the debuff.
|
||||
SPELL_TIME_BOMB_2 = 59376
|
||||
SPELL_TIME_BOMB_2 = 59376,
|
||||
SPELL_EVOCATE = 51602 // He always cast it on reset or after teleportation
|
||||
};
|
||||
|
||||
enum Yells
|
||||
@@ -103,10 +104,9 @@ public:
|
||||
|
||||
void Reset()
|
||||
{
|
||||
if (instance->GetBossState(DATA_VAROS_EVENT) != DONE)
|
||||
DoCast(SPELL_ARCANE_SHIELD);
|
||||
|
||||
_Reset();
|
||||
me->CastSpell(me, SPELL_EVOCATE);
|
||||
|
||||
_Reset();
|
||||
|
||||
if (instance->GetData(DATA_UROM_PLATAFORM) == 0)
|
||||
{
|
||||
@@ -307,14 +307,17 @@ public:
|
||||
case SPELL_SUMMON_MENAGERIE:
|
||||
me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f);
|
||||
LeaveCombat();
|
||||
me->CastSpell(me, SPELL_EVOCATE);
|
||||
break;
|
||||
case SPELL_SUMMON_MENAGERIE_2:
|
||||
me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f);
|
||||
LeaveCombat();
|
||||
me->CastSpell(me, SPELL_EVOCATE);
|
||||
break;
|
||||
case SPELL_SUMMON_MENAGERIE_3:
|
||||
me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f);
|
||||
LeaveCombat();
|
||||
me->CastSpell(me, SPELL_EVOCATE);
|
||||
break;
|
||||
case SPELL_TELEPORT:
|
||||
//! Unconfirmed, previous below
|
||||
|
||||
@@ -56,9 +56,13 @@ public:
|
||||
|
||||
eregosCacheGUID = 0;
|
||||
|
||||
azureDragonsList.clear();
|
||||
gwhelpList.clear();
|
||||
gameObjectList.clear();
|
||||
}
|
||||
|
||||
belgaristraszGUID = 0;
|
||||
eternosGUID = 0;
|
||||
verdisaGUID = 0;
|
||||
}
|
||||
|
||||
void OnUnitDeath(Unit* unit)
|
||||
{
|
||||
@@ -112,17 +116,49 @@ public:
|
||||
break;
|
||||
case NPC_VAROS:
|
||||
varosGUID = creature->GetGUID();
|
||||
if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
|
||||
creature->SetPhaseMask(1, true);
|
||||
break;
|
||||
case NPC_UROM:
|
||||
uromGUID = creature->GetGUID();
|
||||
if (GetBossState(DATA_VAROS_EVENT) == DONE)
|
||||
creature->SetPhaseMask(1, true);
|
||||
break;
|
||||
case NPC_EREGOS:
|
||||
eregosGUID = creature->GetGUID();
|
||||
if (GetBossState(DATA_UROM_EVENT) == DONE)
|
||||
creature->SetPhaseMask(1, true);
|
||||
break;
|
||||
case NPC_CENTRIFUGE_CONSTRUCT:
|
||||
if (creature->isAlive())
|
||||
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++centrifugueConstructCounter);
|
||||
break;
|
||||
case NPC_BELGARISTRASZ:
|
||||
belgaristraszGUID = creature->GetGUID();
|
||||
if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
|
||||
creature->SetWalk(true),
|
||||
creature->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f),
|
||||
creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
break;
|
||||
case NPC_ETERNOS:
|
||||
eternosGUID = creature->GetGUID();
|
||||
if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
|
||||
creature->SetWalk(true),
|
||||
creature->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f),
|
||||
creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
break;
|
||||
case NPC_VERDISA:
|
||||
verdisaGUID = creature->GetGUID();
|
||||
if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
|
||||
creature->SetWalk(true),
|
||||
creature->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f),
|
||||
creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
break;
|
||||
case NPC_GREATER_WHELP:
|
||||
if (GetBossState(DATA_UROM_EVENT) == DONE)
|
||||
creature->SetPhaseMask(1, true);
|
||||
gwhelpList.push_back(creature->GetGUID());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,11 +195,22 @@ public:
|
||||
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1);
|
||||
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, centrifugueConstructCounter);
|
||||
OpenCageDoors();
|
||||
FreeDragons();
|
||||
if (Creature* varos = instance->GetCreature(varosGUID))
|
||||
varos->SetPhaseMask(1, true);
|
||||
}
|
||||
break;
|
||||
case DATA_VAROS_EVENT:
|
||||
if (state == DONE)
|
||||
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0);
|
||||
if (Creature* urom = instance->GetCreature(uromGUID))
|
||||
urom->SetPhaseMask(1, true);
|
||||
break;
|
||||
case DATA_UROM_EVENT:
|
||||
if (state == DONE)
|
||||
if (Creature* eregos = instance->GetCreature(eregosGUID))
|
||||
eregos->SetPhaseMask(1, true);
|
||||
GreaterWhelps();
|
||||
break;
|
||||
case DATA_EREGOS_EVENT:
|
||||
if (state == DONE)
|
||||
@@ -221,6 +268,31 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void FreeDragons()
|
||||
{
|
||||
if (Creature* belgaristrasz = instance->GetCreature(belgaristraszGUID))
|
||||
belgaristrasz->SetWalk(true),
|
||||
belgaristrasz->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f);
|
||||
if (Creature* eternos = instance->GetCreature(eternosGUID))
|
||||
eternos->SetWalk(true),
|
||||
eternos->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f);
|
||||
if (Creature* verdisa = instance->GetCreature(verdisaGUID))
|
||||
verdisa->SetWalk(true),
|
||||
verdisa->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f);
|
||||
}
|
||||
|
||||
void GreaterWhelps()
|
||||
{
|
||||
if (gwhelpList.empty())
|
||||
return;
|
||||
|
||||
for (std::list<uint64>::const_iterator itr = gwhelpList.begin(); itr != gwhelpList.end(); ++itr)
|
||||
{
|
||||
if (Creature* gwhelp = instance->GetCreature(*itr))
|
||||
gwhelp->SetPhaseMask(1, true);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
@@ -269,6 +341,10 @@ public:
|
||||
uint64 uromGUID;
|
||||
uint64 eregosGUID;
|
||||
|
||||
uint64 belgaristraszGUID;
|
||||
uint64 eternosGUID;
|
||||
uint64 verdisaGUID;
|
||||
|
||||
uint8 platformUrom;
|
||||
uint8 centrifugueConstructCounter;
|
||||
|
||||
@@ -277,9 +353,8 @@ public:
|
||||
std::string str_data;
|
||||
|
||||
std::list<uint64> gameObjectList;
|
||||
std::list<uint64> azureDragonsList;
|
||||
std::list<uint64> gwhelpList;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
void AddSC_instance_oculus()
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "ScriptedGossip.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "Vehicle.h"
|
||||
#include "CombatAI.h"
|
||||
#include "oculus.h"
|
||||
|
||||
#define GOSSIP_ITEM_DRAKES "So where do we go from here?"
|
||||
@@ -32,7 +34,7 @@
|
||||
|
||||
#define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE, 1) || (a)->HasItemCount(ITEM_AMBER_ESSENCE, 1) || (a)->HasItemCount(ITEM_RUBY_ESSENCE, 1))
|
||||
|
||||
enum Drakes
|
||||
enum GossipNPCs
|
||||
{
|
||||
GOSSIP_TEXTID_DRAKES = 13267,
|
||||
GOSSIP_TEXTID_BELGARISTRASZ1 = 12916,
|
||||
@@ -49,25 +51,67 @@ enum Drakes
|
||||
ITEM_AMBER_ESSENCE = 37859,
|
||||
ITEM_RUBY_ESSENCE = 37860,
|
||||
|
||||
NPC_VERDISA = 27657,
|
||||
NPC_BELGARISTRASZ = 27658,
|
||||
NPC_ETERNOS = 27659,
|
||||
SPELL_SHOCK_CHARGE = 49836
|
||||
};
|
||||
|
||||
SPELL_SHOCK_CHARGE = 49836,
|
||||
enum Drakes
|
||||
{
|
||||
/*Ruby Drake,
|
||||
(npc 27756) (item 37860)
|
||||
(summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756)
|
||||
*/
|
||||
SPELL_RIDE_RUBY_DRAKE_QUE = 49463, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464
|
||||
SPELL_RUBY_DRAKE_SADDLE = 49464, //Allows you to ride on the back of an Amber Drake. ---> Dummy
|
||||
SPELL_RUBY_SEARING_WRATH = 50232, //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets
|
||||
SPELL_RUBY_EVASIVE_AURA = 50248, //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells.
|
||||
SPELL_RUBY_EVASIVE_MANEUVERS = 50240, //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted.
|
||||
//you do not have acces to until you kill Mage-Lord Urom
|
||||
SPELL_RUBY_MARTYR = 50253, //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec.
|
||||
|
||||
/*Amber Drake,
|
||||
(npc 27755) (item 37859)
|
||||
(summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755)
|
||||
*/
|
||||
|
||||
SPELL_RIDE_AMBER_DRAKE_QUE = 49459, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460
|
||||
SPELL_AMBER_DRAKE_SADDLE = 49460, //Allows you to ride on the back of an Amber Drake. ---> Dummy
|
||||
SPELL_AMBER_SHOCK_LANCE = 49840, //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated.
|
||||
// SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target.
|
||||
//you do not have access to until you kill the Mage-Lord Urom.
|
||||
SPELL_AMBER_TEMPORAL_RIFT = 49592, //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated.
|
||||
|
||||
/*Emerald Drake,
|
||||
(npc 27692) (item 37815),
|
||||
(summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692)
|
||||
*/
|
||||
SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346
|
||||
SPELL_EMERALD_DRAKE_SADDLE = 49346, //Allows you to ride on the back of an Amber Drake. ---> Dummy
|
||||
SPELL_EMERALD_LEECHING_POISON = 50328, //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times.
|
||||
SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec.
|
||||
// you do not have access to until you kill the Mage-Lord Urom
|
||||
SPELL_EMERALD_DREAM_FUNNEL = 50344, //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels.
|
||||
};
|
||||
|
||||
enum Says
|
||||
{
|
||||
SAY_VAROS = 0,
|
||||
SAY_UROM = 1
|
||||
SAY_VAROS = 0,
|
||||
SAY_UROM = 1,
|
||||
SAY_BELGARISTRASZ = 0,
|
||||
SAY_DRAKES_TAKEOFF = 0,
|
||||
WHISPER_DRAKES_WELCOME = 1,
|
||||
WHISPER_DRAKES_ABILITIES = 2,
|
||||
WHISPER_DRAKES_SPECIAL = 3,
|
||||
WHISPER_DRAKES_LOWHEALTH = 4
|
||||
};
|
||||
|
||||
class npc_oculus_drake : public CreatureScript
|
||||
class npc_verdisa_beglaristrasz_eternos : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_oculus_drake() : CreatureScript("npc_oculus_drake") { }
|
||||
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
|
||||
npc_verdisa_beglaristrasz_eternos() : CreatureScript("npc_verdisa_beglaristrasz_eternos") { }
|
||||
|
||||
InstanceScript* instance;
|
||||
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
|
||||
{
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
switch (creature->GetEntry())
|
||||
@@ -184,6 +228,28 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
struct npc_verdisa_beglaristrasz_eternosAI : public ScriptedAI
|
||||
{
|
||||
npc_verdisa_beglaristrasz_eternosAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void MovementInform(uint32 type, uint32 id)
|
||||
{
|
||||
// When Belgaristraz finish his moving say grateful text
|
||||
if (me->GetEntry() == NPC_BELGARISTRASZ)
|
||||
if (id == 0)
|
||||
{
|
||||
Talk(SAY_BELGARISTRASZ);
|
||||
}
|
||||
// The gossip flag should activate when Drakos die and not from DB
|
||||
if (id == 0)
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_verdisa_beglaristrasz_eternosAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_image_belgaristrasz : public CreatureScript
|
||||
@@ -193,7 +259,7 @@ public:
|
||||
|
||||
struct npc_image_belgaristraszAI : public ScriptedAI
|
||||
{
|
||||
npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) {}
|
||||
npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void IsSummonedBy(Unit* summoner)
|
||||
{
|
||||
@@ -216,6 +282,176 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class npc_ruby_emerald_amber_drake : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_ruby_emerald_amber_drake() : CreatureScript("npc_ruby_emerald_amber_drake") { }
|
||||
|
||||
struct npc_ruby_emerald_amber_drakeAI : public VehicleAI
|
||||
{
|
||||
npc_ruby_emerald_amber_drakeAI(Creature* creature) : VehicleAI(creature)
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
|
||||
uint64 summonerGUID;
|
||||
uint32 WelcomeTimer;
|
||||
uint32 WelcomeSequelTimer;
|
||||
uint32 SpecialTimer;
|
||||
uint32 WarningTimer;
|
||||
uint32 TakeOffTimer;
|
||||
|
||||
bool WelcomeOff;
|
||||
bool WelcomeSequelOff;
|
||||
bool SpecialOff;
|
||||
bool HealthWarningOff;
|
||||
bool DisableTakeOff;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
summonerGUID = 0;
|
||||
WelcomeTimer = 4500;
|
||||
WelcomeSequelTimer = 4500;
|
||||
SpecialTimer = 10000;
|
||||
WarningTimer = 25000;
|
||||
TakeOffTimer = 3500;
|
||||
|
||||
WelcomeOff = false;
|
||||
WelcomeSequelOff = false;
|
||||
SpecialOff = false;
|
||||
HealthWarningOff = false;
|
||||
DisableTakeOff = false;
|
||||
}
|
||||
|
||||
void IsSummonedBy(Unit* summoner)
|
||||
{
|
||||
if (instance->GetBossState(DATA_EREGOS_EVENT) == IN_PROGRESS)
|
||||
if (Creature* eregos = me->FindNearestCreature(NPC_EREGOS, 450.0f, true))
|
||||
{
|
||||
eregos->DespawnOrUnsummon(); // On retail this kills abusive call of drake during engaged Eregos
|
||||
}
|
||||
summonerGUID = summoner->GetGUID();
|
||||
me->SetFacingToObject(summoner);
|
||||
// TO DO: Drake Ques should be casted from vehicle to player, however the way core handle triggered spells from auras break it no matter the conditions. So this change the caster and give the same result until someone fix triggered spells from auras that involve implicit targets or make exception for this case.
|
||||
if (me->GetEntry() == NPC_RUBY_DRAKE_VEHICLE)
|
||||
summoner->CastSpell(summoner, SPELL_RIDE_RUBY_DRAKE_QUE);
|
||||
if (me->GetEntry() == NPC_EMERALD_DRAKE_VEHICLE)
|
||||
summoner->CastSpell(summoner, SPELL_RIDE_EMERALD_DRAKE_QUE);
|
||||
if (me->GetEntry() == NPC_AMBER_DRAKE_VEHICLE)
|
||||
summoner->CastSpell(summoner, SPELL_RIDE_AMBER_DRAKE_QUE);
|
||||
Position pos;
|
||||
summoner->GetPosition(&pos);
|
||||
me->GetMotionMaster()->MovePoint(0, pos);
|
||||
}
|
||||
|
||||
void MovementInform(uint32 type, uint32 id)
|
||||
{
|
||||
if (type == POINT_MOTION_TYPE && id == 0)
|
||||
{
|
||||
me->SetDisableGravity(false); // Needed this for proper animation after spawn, the summon in air fall to ground bug leave no other option for now, if this isn't used the drake will only walk on move.
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!(instance->GetBossState(DATA_VAROS_EVENT) == DONE))
|
||||
{
|
||||
if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
|
||||
{
|
||||
if (!(WelcomeOff))
|
||||
{
|
||||
if (WelcomeTimer <= diff)
|
||||
{
|
||||
Talk(WHISPER_DRAKES_WELCOME, me->GetCreatorGUID());
|
||||
WelcomeOff = true;
|
||||
WelcomeSequelOff = true;
|
||||
}
|
||||
else WelcomeTimer -= diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
|
||||
{
|
||||
if (WelcomeSequelOff)
|
||||
{
|
||||
if (WelcomeSequelTimer <= diff)
|
||||
{
|
||||
Talk(WHISPER_DRAKES_ABILITIES, me->GetCreatorGUID());
|
||||
WelcomeSequelOff = false;
|
||||
}
|
||||
else WelcomeSequelTimer -= diff;
|
||||
}
|
||||
}
|
||||
if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
|
||||
{
|
||||
if (instance->GetBossState(DATA_UROM_EVENT) == DONE)
|
||||
{
|
||||
if (!(SpecialOff))
|
||||
{
|
||||
if (SpecialTimer <= diff)
|
||||
{
|
||||
Talk(WHISPER_DRAKES_SPECIAL, me->GetCreatorGUID());
|
||||
SpecialOff = true;
|
||||
}
|
||||
else SpecialTimer -= diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
|
||||
{
|
||||
if (!(HealthWarningOff))
|
||||
{
|
||||
if (me->GetHealthPct() <= 40.0f)
|
||||
{
|
||||
Talk(WHISPER_DRAKES_LOWHEALTH, me->GetCreatorGUID());
|
||||
HealthWarningOff = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
|
||||
{
|
||||
if (HealthWarningOff)
|
||||
{
|
||||
if (WarningTimer <= diff)
|
||||
{
|
||||
HealthWarningOff = false;
|
||||
WarningTimer = 25000;
|
||||
}
|
||||
else WarningTimer -= diff;
|
||||
}
|
||||
}
|
||||
if (!(me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)))
|
||||
{
|
||||
if (!(DisableTakeOff))
|
||||
{
|
||||
if (TakeOffTimer <= diff)
|
||||
{
|
||||
me->DespawnOrUnsummon(2050);
|
||||
me->SetOrientation(2.5f);
|
||||
me->SetSpeed(MOVE_FLIGHT, 1.0f, true);
|
||||
Talk(SAY_DRAKES_TAKEOFF);
|
||||
Position pos;
|
||||
me->GetPosition(&pos);
|
||||
pos.m_positionX += 10.0f;
|
||||
pos.m_positionY += 10.0f;
|
||||
pos.m_positionZ += 12.0f;
|
||||
me->GetMotionMaster()->MovePoint(1, pos);
|
||||
DisableTakeOff = true;
|
||||
}
|
||||
else TakeOffTimer -= diff;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_ruby_emerald_amber_drakeAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_stop_time : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
@@ -247,9 +483,50 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class spell_call_ruby_emerald_amber_drake : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_call_ruby_emerald_amber_drake() : SpellScriptLoader("spell_call_ruby_emerald_amber_drake") { }
|
||||
|
||||
class spell_call_ruby_emerald_amber_drake_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_call_ruby_emerald_amber_drake_SpellScript);
|
||||
|
||||
void ChangeSummonPos(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
// Adjust effect summon position
|
||||
WorldLocation summonPos = *GetExplTargetDest();
|
||||
Position offset = {0.0f, 0.0f, 12.0f, 0.0f};
|
||||
summonPos.RelocateOffset(offset);
|
||||
SetExplTargetDest(summonPos);
|
||||
GetHitDest()->RelocateOffset(offset);
|
||||
}
|
||||
|
||||
void ModDestHeight(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
// Used to cast visual effect at proper position
|
||||
Position offset = {0.0f, 0.0f, 12.0f, 0.0f};
|
||||
const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON);
|
||||
OnEffectLaunch += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_call_ruby_emerald_amber_drake_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_oculus()
|
||||
{
|
||||
new npc_oculus_drake();
|
||||
new npc_verdisa_beglaristrasz_eternos();
|
||||
new npc_image_belgaristrasz();
|
||||
new npc_ruby_emerald_amber_drake();
|
||||
new spell_gen_stop_time();
|
||||
new spell_call_ruby_emerald_amber_drake();
|
||||
}
|
||||
|
||||
@@ -35,15 +35,22 @@ enum Data64
|
||||
DATA_EREGOS
|
||||
};
|
||||
|
||||
enum Bosses
|
||||
enum Bosses_NPCs
|
||||
{
|
||||
NPC_DRAKOS = 27654,
|
||||
NPC_VAROS = 27447,
|
||||
NPC_UROM = 27655,
|
||||
NPC_EREGOS = 27656,
|
||||
|
||||
NPC_AZURE_RING_GUARDIAN = 28236,
|
||||
NPC_CENTRIFUGE_CONSTRUCT = 27641,
|
||||
NPC_AZURE_RING_GUARDIAN = 28236,
|
||||
NPC_CENTRIFUGE_CONSTRUCT = 27641,
|
||||
NPC_RUBY_DRAKE_VEHICLE = 27756,
|
||||
NPC_EMERALD_DRAKE_VEHICLE = 27692,
|
||||
NPC_AMBER_DRAKE_VEHICLE = 27755,
|
||||
NPC_VERDISA = 27657,
|
||||
NPC_BELGARISTRASZ = 27658,
|
||||
NPC_ETERNOS = 27659,
|
||||
NPC_GREATER_WHELP = 28276
|
||||
};
|
||||
|
||||
enum GameObjects
|
||||
|
||||
@@ -521,7 +521,7 @@ class boss_algalon_the_observer : public CreatureScript
|
||||
if (Creature* wormHole = DoSummon(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN))
|
||||
wormHole->m_Events.AddEvent(new SummonUnleashedDarkMatter(wormHole), wormHole->m_Events.CalculateTime(i >= 2 ? 8000 : 6000));
|
||||
}
|
||||
else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePctF<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
|
||||
else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePct<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
|
||||
{
|
||||
_fightWon = true;
|
||||
damage = 0;
|
||||
|
||||
@@ -181,8 +181,8 @@ class boss_warp_splinter : public CreatureScript
|
||||
{
|
||||
float angle = (M_PI / 3) * i;
|
||||
|
||||
float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * cos(angle);
|
||||
float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * sin(angle);
|
||||
float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * std::cos(angle);
|
||||
float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * std::sin(angle);
|
||||
float O = - me->GetAngle(X, Y);
|
||||
|
||||
if (Creature* pTreant = me->SummonCreature(CREATURE_TREANT, treant_pos[i][0], treant_pos[i][1], treant_pos[i][2], O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000))
|
||||
|
||||
@@ -194,7 +194,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
if (Unit* owner = GetUnitOwner())
|
||||
amount = CalculatePctU(owner->GetPower(POWER_MANA), 5);
|
||||
amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* aurEff)
|
||||
|
||||
@@ -70,7 +70,7 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader
|
||||
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
|
||||
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -118,7 +118,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
|
||||
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
absorbAmount = std::min(CalculatePctN(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
|
||||
absorbAmount = std::min(CalculatePct(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
|
||||
}
|
||||
|
||||
void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
|
||||
@@ -179,7 +179,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
|
||||
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
|
||||
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -413,7 +413,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
|
||||
multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f);
|
||||
// Death Knight T8 Melee 4P Bonus
|
||||
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0))
|
||||
AddPctF(multiplier, aurEff->GetAmount());
|
||||
AddPct(multiplier, aurEff->GetAmount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
|
||||
int32 bp = GetHitDamage() * multiplier;
|
||||
|
||||
if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0))
|
||||
AddPctN(bp, aurEff->GetAmount());
|
||||
AddPct(bp, aurEff->GetAmount());
|
||||
|
||||
caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
|
||||
}
|
||||
@@ -472,7 +472,7 @@ class spell_dk_spell_deflection : public SpellScriptLoader
|
||||
{
|
||||
// You have a chance equal to your Parry chance
|
||||
if ((dmgInfo.GetDamageType() == SPELL_DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance()))
|
||||
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
|
||||
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -582,7 +582,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
|
||||
|
||||
// Damage that would take you below [effect0] health or taken while you are at [effect0]
|
||||
if (remainingHp < minHp)
|
||||
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
|
||||
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -722,7 +722,7 @@ class spell_dk_death_strike : public SpellScriptLoader
|
||||
int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier)));
|
||||
// Improved Death Strike
|
||||
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0))
|
||||
AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
|
||||
AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
|
||||
caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user