*Merge.
--HG-- branch : trunk
This commit is contained in:
@@ -176,8 +176,6 @@ CREATE TABLE `auctionhousebot` (
|
||||
`name` char(25) default NULL COMMENT 'Text name of the auctionhouse.',
|
||||
`minitems` int(11) default '0' COMMENT 'This is the minimum number of items you want to keep in the auction house. a 0 here will make it the same as the maximum.',
|
||||
`maxitems` int(11) default '0' COMMENT 'This is the number of items you want to keep in the auction house.',
|
||||
`mintime` int(11) default '8' COMMENT 'Sets the minimum number of hours for an auction.',
|
||||
`maxtime` int(11) default '24' COMMENT 'Sets the maximum number of hours for an auction.',
|
||||
`percentgreytradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Grey Trade Goods auction items',
|
||||
`percentwhitetradegoods` int(11) default '27' COMMENT 'Sets the percentage of the White Trade Goods auction items',
|
||||
`percentgreentradegoods` int(11) default '12' COMMENT 'Sets the percentage of the Green Trade Goods auction items',
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE `auctionhousebot`
|
||||
DROP COLUMN `minTime`,
|
||||
DROP COLUMN `maxTime`;
|
||||
@@ -452,6 +452,40 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
|
||||
break;
|
||||
}
|
||||
|
||||
if(auctionmgr.GetAItem(GUID_LOPART(item->GetGUID())))
|
||||
{
|
||||
sLog.outError("Item %u not found", item->GetEntry());
|
||||
break;
|
||||
}
|
||||
if(!item->CanBeTraded())
|
||||
{
|
||||
sLog.outError("Item %u can't be traded", item->GetEntry());
|
||||
break;
|
||||
}
|
||||
|
||||
if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_CONJURED) || item->GetUInt32Value(ITEM_FIELD_DURATION))
|
||||
{
|
||||
sLog.outError("Item %u is conjured or has a duration", item->GetEntry());
|
||||
break;
|
||||
}
|
||||
uint32 etime = urand(1,3);
|
||||
switch(etime)
|
||||
{
|
||||
case 1:
|
||||
etime = 43200;
|
||||
break;
|
||||
case 2:
|
||||
etime = 86400;
|
||||
break;
|
||||
case 3:
|
||||
etime = 172800;
|
||||
break;
|
||||
default:
|
||||
etime = 86400;
|
||||
break;
|
||||
}
|
||||
uint32 dep = auctionmgr.GetAuctionDeposit( ahEntry, etime, item );
|
||||
|
||||
item->SetCount(stackCount);
|
||||
|
||||
AuctionEntry* auctionEntry = new AuctionEntry;
|
||||
@@ -464,8 +498,8 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
|
||||
auctionEntry->buyout = buyoutPrice;
|
||||
auctionEntry->bidder = 0;
|
||||
auctionEntry->bid = 0;
|
||||
auctionEntry->deposit = 0;
|
||||
auctionEntry->expire_time = (time_t) (urand(config->GetMinTime(), config->GetMaxTime()) * 60 * 60 + time(NULL));
|
||||
auctionEntry->deposit = dep;
|
||||
auctionEntry->expire_time = (time_t) etime + time(NULL);
|
||||
auctionEntry->auctionHouseEntry = ahEntry;
|
||||
item->SaveToDB();
|
||||
item->RemoveFromUpdateQueueOf(AHBplayer);
|
||||
@@ -1119,19 +1153,11 @@ void AuctionHouseBotCommands(uint32 command, uint32 ahMapID, uint32 col, char* a
|
||||
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID);
|
||||
config->SetMaxItems(maxItems);
|
||||
}break;
|
||||
case 3: //min time
|
||||
case 3: //min time Deprecated (Place holder for future commands)
|
||||
{
|
||||
char * param1 = strtok(args, " ");
|
||||
uint32 minTime = (uint32) strtoul(param1, NULL, 0);
|
||||
CharacterDatabase.PExecute("UPDATE auctionhousebot SET mintime = '%u' WHERE auctionhouse = '%u'", minTime, ahMapID);
|
||||
config->SetMinTime(minTime);
|
||||
}break;
|
||||
case 4: //max time
|
||||
case 4: //max time Deprecated (Place holder for future commands)
|
||||
{
|
||||
char * param1 = strtok(args, " ");
|
||||
uint32 maxTime = (uint32) strtoul(param1, NULL, 0);
|
||||
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxtime = '%u' WHERE auctionhouse = '%u'", maxTime, ahMapID);
|
||||
config->SetMaxTime(maxTime);
|
||||
}break;
|
||||
case 5: //percentages
|
||||
{
|
||||
@@ -1252,12 +1278,6 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
|
||||
if(debug_Out)
|
||||
{sLog.outError("minItems = %u", config->GetMinItems());
|
||||
sLog.outError("maxItems = %u", config->GetMaxItems());}
|
||||
//load min and max auction times
|
||||
config->SetMinTime(CharacterDatabase.PQuery("SELECT mintime FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
|
||||
config->SetMaxTime(CharacterDatabase.PQuery("SELECT maxtime FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
|
||||
if(debug_Out)
|
||||
{sLog.outError("minTime = %u", config->GetMinTime());
|
||||
sLog.outError("maxTime = %u", config->GetMaxTime());}
|
||||
//load percentages
|
||||
uint32 greytg = CharacterDatabase.PQuery("SELECT percentgreytradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
|
||||
uint32 whitetg = CharacterDatabase.PQuery("SELECT percentwhitetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
|
||||
|
||||
@@ -40,8 +40,6 @@ class AHBConfig
|
||||
uint32 AHFID;
|
||||
uint32 minItems;
|
||||
uint32 maxItems;
|
||||
uint32 minTime;
|
||||
uint32 maxTime;
|
||||
uint32 percentGreyTradeGoods;
|
||||
uint32 percentWhiteTradeGoods;
|
||||
uint32 percentGreenTradeGoods;
|
||||
@@ -169,27 +167,6 @@ class AHBConfig
|
||||
{
|
||||
return maxItems;
|
||||
}
|
||||
void SetMinTime(uint32 value)
|
||||
{
|
||||
minTime = value;
|
||||
}
|
||||
uint32 GetMinTime()
|
||||
{
|
||||
if (minTime < 1)
|
||||
return 1;
|
||||
else if ((maxTime) && (minTime > maxTime))
|
||||
return maxTime;
|
||||
else
|
||||
return minTime;
|
||||
}
|
||||
void SetMaxTime(uint32 value)
|
||||
{
|
||||
maxTime = value;
|
||||
}
|
||||
uint32 GetMaxTime()
|
||||
{
|
||||
return maxTime;
|
||||
}
|
||||
void SetPercentages(uint32 greytg, uint32 whitetg, uint32 greentg, uint32 bluetg, uint32 purpletg, uint32 orangetg, uint32 yellowtg, uint32 greyi, uint32 whitei, uint32 greeni, uint32 bluei, uint32 purplei, uint32 orangei, uint32 yellowi)
|
||||
{
|
||||
uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi;
|
||||
|
||||
@@ -92,11 +92,13 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
|
||||
faction_pct = 0.0f;
|
||||
deposit = 0.0f;
|
||||
}
|
||||
//sLog.outString("SellPrice:\t\t%u", MSV);
|
||||
//sLog.outString("Deposit Percent:\t%f", faction_pct);
|
||||
//sLog.outString("Min Auction Time:\t%u", (time / MIN_AUCTION_TIME ));
|
||||
//sLog.outString("Count:\t\t\t%u", pItem->GetCount());
|
||||
//sLog.outString("Deposit:\t\t%f", deposit);
|
||||
sLog.outDebug("SellPrice:\t\t%u", MSV);
|
||||
sLog.outDebug("Deposit Percent:\t%f", faction_pct);
|
||||
sLog.outDebug("Auction Time1:\t\t%u", time);
|
||||
sLog.outDebug("Auction Time2:\t\t%u", MIN_AUCTION_TIME);
|
||||
sLog.outDebug("Auction Time3:\t\t%u", (time / MIN_AUCTION_TIME ));
|
||||
sLog.outDebug("Count:\t\t\t%u", pItem->GetCount());
|
||||
sLog.outDebug("Deposit:\t\t%f", deposit);
|
||||
if (deposit > 0)
|
||||
return (uint32)deposit;
|
||||
else
|
||||
|
||||
+1
-1
@@ -646,7 +646,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
|
||||
{ "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
|
||||
{ "loadpath", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllPaths, "", NULL },
|
||||
{ "ahbotoptions", SEC_GAMEMASTER, false, &ChatHandler::HandleAHBotOptionsCommand, "", NULL },
|
||||
{ "ahbotoptions", SEC_GAMEMASTER, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL },
|
||||
{ "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable },
|
||||
|
||||
{ "aura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuraCommand, "", NULL },
|
||||
|
||||
@@ -38,8 +38,7 @@ namespace FactorySelector
|
||||
const CreatureAICreator *ai_factory = NULL;
|
||||
CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
|
||||
|
||||
//player-controlled guardians with pet bar
|
||||
if(creature->HasSummonMask(SUMMON_MASK_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||
if(creature->isPet())
|
||||
ai_factory = ai_registry.GetRegistryItem("PetAI");
|
||||
|
||||
//scriptname in db
|
||||
@@ -55,7 +54,9 @@ namespace FactorySelector
|
||||
// select by NPC flags
|
||||
if(!ai_factory)
|
||||
{
|
||||
if(creature->isVehicle() || creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
|
||||
if(creature->isGuardian() && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||
ai_factory = ai_registry.GetRegistryItem("PetAI");
|
||||
else if(creature->isVehicle() || creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
|
||||
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
|
||||
else if(creature->isGuard())
|
||||
ai_factory = ai_registry.GetRegistryItem("GuardAI");
|
||||
|
||||
@@ -1326,7 +1326,7 @@ struct SpellEntry
|
||||
uint32 AttributesEx3; // 7 m_attributesExC
|
||||
uint32 AttributesEx4; // 8 m_attributesExD
|
||||
uint32 AttributesEx5; // 9 m_attributesExE
|
||||
//uint32 AttributesEx6; // 10 m_attributesExF not used
|
||||
uint32 AttributesEx6; // 10 m_attributesExF
|
||||
uint32 Stances; // 11 m_shapeshiftMask
|
||||
uint32 StancesNot; // 12 m_shapeshiftExclude
|
||||
uint32 Targets; // 13 m_targets
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ const char SkillLineAbilityfmt[]="niiiixxiiiiixx";
|
||||
const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
const char SpellCastTimefmt[]="nixx";
|
||||
const char SpellDurationfmt[]="niii";
|
||||
const char SpellEntryfmt[]="niiiiiiiiixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiix";
|
||||
const char SpellEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiix";
|
||||
const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
|
||||
const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixx";
|
||||
const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
|
||||
|
||||
@@ -73,6 +73,16 @@ PlayerVisibilityNotifier::Notify()
|
||||
|
||||
if( i_data.HasData() )
|
||||
{
|
||||
uint32 entry = 0, map;
|
||||
float x,y;
|
||||
if(!i_visibleNow.empty())
|
||||
{
|
||||
entry = (*i_visibleNow.begin())->GetEntry();
|
||||
map = (*i_visibleNow.begin())->GetMapId();
|
||||
x = (*i_visibleNow.begin())->GetPositionX();
|
||||
y = (*i_visibleNow.begin())->GetPositionY();
|
||||
}
|
||||
|
||||
// send create/outofrange packet to player (except player create updates that already sent using SendUpdateToPlayer)
|
||||
WorldPacket packet;
|
||||
i_data.BuildPacket(&packet);
|
||||
|
||||
+10
-2
@@ -88,8 +88,8 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
|
||||
PSendSysMessage("ahexpire");
|
||||
PSendSysMessage("minitems");
|
||||
PSendSysMessage("maxitems");
|
||||
PSendSysMessage("mintime");
|
||||
PSendSysMessage("maxtime");
|
||||
//PSendSysMessage("");
|
||||
//PSendSysMessage("");
|
||||
PSendSysMessage("percentages");
|
||||
PSendSysMessage("minprice");
|
||||
PSendSysMessage("maxprice");
|
||||
@@ -132,6 +132,9 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
|
||||
}
|
||||
else if (strncmp(opt,"mintime",l) == 0)
|
||||
{
|
||||
PSendSysMessage("ahbotoptions mintime has been deprecated");
|
||||
return false;
|
||||
/*
|
||||
char * param1 = strtok(NULL, " ");
|
||||
if ((!ahMapIdStr) || (!param1))
|
||||
{
|
||||
@@ -139,9 +142,13 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
|
||||
return false;
|
||||
}
|
||||
AuctionHouseBotCommands(3, ahMapID, NULL, param1);
|
||||
*/
|
||||
}
|
||||
else if (strncmp(opt,"maxtime",l) == 0)
|
||||
{
|
||||
PSendSysMessage("ahbotoptions maxtime has been deprecated");
|
||||
return false;
|
||||
/*
|
||||
char * param1 = strtok(NULL, " ");
|
||||
if ((!ahMapIdStr) || (!param1))
|
||||
{
|
||||
@@ -149,6 +156,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
|
||||
return false;
|
||||
}
|
||||
AuctionHouseBotCommands(4, ahMapID, NULL, param1);
|
||||
*/
|
||||
}
|
||||
else if (strncmp(opt,"percentages",l) == 0)
|
||||
{
|
||||
|
||||
@@ -592,7 +592,10 @@ void Map::RelocationNotify()
|
||||
if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Trinity::PlayerRelocationNotifier notifier(*((Player*)unit));
|
||||
if(((Player*)unit)->m_seer != unit)
|
||||
VisitAll(((Player*)unit)->m_seer->GetPositionX(), ((Player*)unit)->m_seer->GetPositionY(), World::GetMaxVisibleDistance() + dist, notifier);
|
||||
else
|
||||
VisitAll(((Player*)unit)->GetPositionX(), ((Player*)unit)->GetPositionY(), World::GetMaxVisibleDistance() + dist, notifier);
|
||||
notifier.Notify();
|
||||
}
|
||||
else
|
||||
|
||||
+6
-7
@@ -126,13 +126,12 @@ void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh )
|
||||
m_PackGUID.appendPackGUID(GetGUID());
|
||||
}
|
||||
|
||||
// This function is never used
|
||||
void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags ) const
|
||||
{
|
||||
ByteBuffer buf(500);
|
||||
ByteBuffer buf(50);
|
||||
|
||||
buf << uint8( UPDATETYPE_MOVEMENT );
|
||||
buf << (uint8)0xFF << GetGUID();
|
||||
buf.append(GetPackGUID());
|
||||
|
||||
_BuildMovementUpdate(&buf, flags);
|
||||
|
||||
@@ -189,9 +188,9 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c
|
||||
|
||||
//sLog.outDebug("BuildCreateUpdate: update-type: %u, object-type: %u got flags: %X, flags2: %X", updatetype, m_objectTypeId, flags, flags2);
|
||||
|
||||
ByteBuffer buf(500);
|
||||
ByteBuffer buf(50);
|
||||
buf << (uint8)updatetype;
|
||||
buf << (uint8)0xFF << GetGUID();
|
||||
buf.append(GetPackGUID());
|
||||
buf << (uint8)m_objectTypeId;
|
||||
|
||||
_BuildMovementUpdate(&buf, flags);
|
||||
@@ -225,10 +224,10 @@ void Object::SendUpdateToPlayer(Player* player)
|
||||
|
||||
void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const
|
||||
{
|
||||
ByteBuffer buf(500);
|
||||
ByteBuffer buf(50);
|
||||
|
||||
buf << (uint8) UPDATETYPE_VALUES;
|
||||
buf << (uint8)0xFF << GetGUID();
|
||||
buf.append(GetPackGUID());
|
||||
|
||||
UpdateMask updateMask;
|
||||
updateMask.SetCount( m_valuesCount );
|
||||
|
||||
+70
-35
@@ -275,7 +275,7 @@ std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi)
|
||||
|
||||
UpdateMask Player::updateVisualBits;
|
||||
|
||||
Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputationMgr(this)
|
||||
Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputationMgr(this) , m_spellModTakingSpell(NULL)
|
||||
{
|
||||
m_speakTime = 0;
|
||||
m_speakCount = 0;
|
||||
@@ -320,8 +320,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
|
||||
|
||||
clearResurrectRequestData();
|
||||
|
||||
m_SpellModRemoveCount = 0;
|
||||
|
||||
memset(m_items, 0, sizeof(Item*)*PLAYER_SLOTS_COUNT);
|
||||
|
||||
m_social = NULL;
|
||||
@@ -1134,6 +1132,10 @@ void Player::Update( uint32 p_time )
|
||||
m_nextMailDelivereTime = 0;
|
||||
}
|
||||
|
||||
// If this is set during update SetSpellModTakingSpell call is missing somewhere in the code
|
||||
// Having this would prevent more aura charges to be dropped, so let's crash
|
||||
assert (!m_spellModTakingSpell);
|
||||
|
||||
Unit::Update( p_time );
|
||||
|
||||
time_t now = time (NULL);
|
||||
@@ -16983,22 +16985,14 @@ void Player::SendRemoveControlBar()
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell const* spell)
|
||||
bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell * spell)
|
||||
{
|
||||
if (!mod || !spellInfo)
|
||||
return false;
|
||||
if (!mod || !spellInfo)
|
||||
return false;
|
||||
|
||||
if(mod->charges == -1 && mod->lastAffected ) // marked as expired but locked until spell casting finish
|
||||
{
|
||||
// prevent apply to any spell except spell that trigger expire
|
||||
if(spell)
|
||||
{
|
||||
if(mod->lastAffected != spell)
|
||||
return false;
|
||||
}
|
||||
else if(mod->lastAffected != FindCurrentSpellBySpellId(spellInfo->Id))
|
||||
return false;
|
||||
}
|
||||
// Mod out of charges
|
||||
if (spell && mod->charges == -1 && spell->m_appliedMods.find(mod->ownerAura) == spell->m_appliedMods.end())
|
||||
return false;
|
||||
|
||||
return spellmgr.IsAffectedByMod(spellInfo, mod);
|
||||
}
|
||||
@@ -17036,8 +17030,6 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
|
||||
m_spellMods[mod->op].push_back(mod);
|
||||
else
|
||||
{
|
||||
if (mod->charges == -1)
|
||||
--m_SpellModRemoveCount;
|
||||
m_spellMods[mod->op].remove(mod);
|
||||
delete mod;
|
||||
}
|
||||
@@ -17046,7 +17038,7 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
|
||||
// Restore spellmods in case of failed cast
|
||||
void Player::RestoreSpellMods(Spell const* spell)
|
||||
{
|
||||
if(!spell || (m_SpellModRemoveCount == 0))
|
||||
if (!spell || spell->m_appliedMods.empty())
|
||||
return;
|
||||
|
||||
for(int i=0;i<MAX_SPELLMOD;++i)
|
||||
@@ -17055,21 +17047,34 @@ void Player::RestoreSpellMods(Spell const* spell)
|
||||
{
|
||||
SpellModifier *mod = *itr;
|
||||
|
||||
if (mod && mod->charges == -1 && mod->lastAffected == spell)
|
||||
{
|
||||
mod->lastAffected = NULL;
|
||||
// spellmods without aura set cannot be charged
|
||||
if (!mod->ownerAura || !mod->ownerAura->GetAuraCharges())
|
||||
continue;
|
||||
|
||||
// check if mod affected this spell
|
||||
Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
|
||||
if (iterMod == spell->m_appliedMods.end())
|
||||
continue;
|
||||
|
||||
// remove from list
|
||||
spell->m_appliedMods.erase(iterMod);
|
||||
|
||||
// add mod charges back to mod
|
||||
if (mod->charges == -1)
|
||||
mod->charges = 1;
|
||||
m_SpellModRemoveCount--;
|
||||
}
|
||||
else
|
||||
mod->charges++;
|
||||
assert (mod->ownerAura->GetAuraCharges() <=charges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::RemoveSpellMods(Spell const* spell)
|
||||
void Player::RemoveSpellMods(Spell * spell)
|
||||
{
|
||||
if(!spell || (m_SpellModRemoveCount == 0))
|
||||
if (!spell || spell->m_appliedMods.empty())
|
||||
return;
|
||||
|
||||
std::set <uint32> checkedSpells;
|
||||
for(int i=0;i<MAX_SPELLMOD;++i)
|
||||
{
|
||||
for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();)
|
||||
@@ -17077,18 +17082,48 @@ void Player::RemoveSpellMods(Spell const* spell)
|
||||
SpellModifier *mod = *itr;
|
||||
++itr;
|
||||
|
||||
if (mod && mod->charges == -1 && (mod->lastAffected == spell || mod->lastAffected==NULL))
|
||||
{
|
||||
RemoveAurasDueToSpell(mod->spellId, 0, AURA_REMOVE_BY_EXPIRE);
|
||||
if (m_spellMods[i].empty())
|
||||
break;
|
||||
else
|
||||
itr = m_spellMods[i].begin();
|
||||
}
|
||||
// spellmods without aura set cannot be charged
|
||||
if (!mod->ownerAura || !mod->ownerAura->GetAuraCharges())
|
||||
continue;
|
||||
|
||||
// check if mod affected this spell
|
||||
Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
|
||||
if (iterMod == spell->m_appliedMods.end())
|
||||
continue;
|
||||
|
||||
// remove from list
|
||||
spell->m_appliedMods.erase(iterMod);
|
||||
|
||||
if (mod->ownerAura->DropAuraCharge())
|
||||
itr = m_spellMods[i].begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::DropModCharge(SpellModifier * mod, Spell * spell)
|
||||
{
|
||||
if (spell && mod->ownerAura && mod->charges > 0 )
|
||||
{
|
||||
--mod->charges;
|
||||
if (mod->charges == 0)
|
||||
{
|
||||
mod->charges = -1;
|
||||
}
|
||||
spell->m_appliedMods.insert(mod->ownerAura);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetSpellModTakingSpell(Spell * spell, bool apply)
|
||||
{
|
||||
if (!spell || (m_spellModTakingSpell && m_spellModTakingSpell != spell))
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
m_spellModTakingSpell = spell;
|
||||
else
|
||||
m_spellModTakingSpell = NULL;
|
||||
}
|
||||
|
||||
// send Proficiency
|
||||
void Player::SendProficiency(uint8 pr1, uint32 pr2)
|
||||
{
|
||||
|
||||
+20
-19
@@ -97,7 +97,7 @@ struct PlayerSpell
|
||||
// Spell modifier (used for modify other spells)
|
||||
struct SpellModifier
|
||||
{
|
||||
SpellModifier() : charges(0), lastAffected(NULL) {}
|
||||
SpellModifier(Aura * _ownerAura = NULL) : charges(0), ownerAura(_ownerAura) {}
|
||||
SpellModOp op : 8;
|
||||
SpellModType type : 8;
|
||||
int16 charges : 16;
|
||||
@@ -1389,10 +1389,12 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
PlayerSpellMap & GetSpellMap() { return m_spells; }
|
||||
|
||||
void AddSpellMod(SpellModifier* mod, bool apply);
|
||||
bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell const* spell = NULL);
|
||||
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const* spell = NULL);
|
||||
void RemoveSpellMods(Spell const* spell);
|
||||
void RestoreSpellMods(Spell const* spell);
|
||||
bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell * spell = NULL);
|
||||
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell * spell = NULL);
|
||||
void RemoveSpellMods(Spell * spell);
|
||||
void RestoreSpellMods(Spell * spell);
|
||||
void DropModCharge(SpellModifier * mod, Spell * spell);
|
||||
void SetSpellModTakingSpell(Spell* spell, bool apply);
|
||||
|
||||
bool HasSpellCooldown(uint32 spell_id) const
|
||||
{
|
||||
@@ -2200,7 +2202,8 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
uint16 m_baseManaRegen;
|
||||
|
||||
SpellModList m_spellMods[MAX_SPELLMOD];
|
||||
int32 m_SpellModRemoveCount;
|
||||
Spell * m_spellModTakingSpell; // Spell for which charges are dropped in spell::finish
|
||||
|
||||
EnchantDurationList m_enchantDuration;
|
||||
ItemDurationList m_itemDuration;
|
||||
|
||||
@@ -2328,16 +2331,25 @@ void AddItemsSetItem(Player*player,Item *item);
|
||||
void RemoveItemsSetItem(Player*player,ItemPrototype const *proto);
|
||||
|
||||
// "the bodies of template functions must be made available in a header file"
|
||||
template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const* spell)
|
||||
template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell * spell)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
if (!spellInfo) return 0;
|
||||
int32 totalpct = 0;
|
||||
int32 totalflat = 0;
|
||||
|
||||
// Drop charges for triggering spells instead of triggered ones
|
||||
if (m_spellModTakingSpell)
|
||||
spell = m_spellModTakingSpell;
|
||||
|
||||
for (SpellModList::iterator itr = m_spellMods[op].begin(); itr != m_spellMods[op].end(); ++itr)
|
||||
{
|
||||
SpellModifier *mod = *itr;
|
||||
|
||||
// Charges can be set only for mods with auras
|
||||
if (!mod->ownerAura)
|
||||
assert(mod->charges==0);
|
||||
|
||||
if(!IsAffectedBySpellmod(spellInfo,mod,spell))
|
||||
continue;
|
||||
if (mod->type == SPELLMOD_FLAT)
|
||||
@@ -2355,18 +2367,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
|
||||
totalpct += mod->value;
|
||||
}
|
||||
|
||||
if (mod->charges > 0 )
|
||||
{
|
||||
--mod->charges;
|
||||
if (mod->charges == 0)
|
||||
{
|
||||
mod->charges = -1;
|
||||
mod->lastAffected = spell;
|
||||
if(!mod->lastAffected)
|
||||
mod->lastAffected = FindCurrentSpellBySpellId(spellId);
|
||||
++m_SpellModRemoveCount;
|
||||
}
|
||||
}
|
||||
DropModCharge(mod, spell);
|
||||
}
|
||||
|
||||
float diff = (float)basevalue*(float)totalpct/100.0f + (float)totalflat;
|
||||
|
||||
@@ -306,7 +306,7 @@ enum SpellCategory
|
||||
#define SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT 0x00080000 // 19 does not necessarly need shapeshift
|
||||
#define SPELL_ATTR_EX2_UNK20 0x00100000 // 20
|
||||
#define SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD 0x00200000 // 21 for ice blocks, pala immunity buffs, priest absorb shields, but used also for other spells -> not sure!
|
||||
#define SPELL_ATTR_EX2_UNK22 0x00400000 // 22 spell can trigger even if triggered
|
||||
#define SPELL_ATTR_EX2_UNK22 0x00400000 // 22
|
||||
#define SPELL_ATTR_EX2_UNK23 0x00800000 // 23 Only mage Arcane Concentration have this flag
|
||||
#define SPELL_ATTR_EX2_UNK24 0x01000000 // 24
|
||||
#define SPELL_ATTR_EX2_UNK25 0x02000000 // 25
|
||||
@@ -324,7 +324,7 @@ enum SpellCategory
|
||||
#define SPELL_ATTR_EX3_UNK4 0x00000010 // 4 Druid Rebirth only this spell have this flag
|
||||
#define SPELL_ATTR_EX3_UNK5 0x00000020 // 5
|
||||
#define SPELL_ATTR_EX3_UNK6 0x00000040 // 6
|
||||
#define SPELL_ATTR_EX3_UNK7 0x00000080 // 7
|
||||
#define SPELL_ATTR_EX3_UNK7 0x00000080 // 7 separate stack for every caster
|
||||
#define SPELL_ATTR_EX3_PLAYERS_ONLY 0x00000100 // 8 Player only?
|
||||
#define SPELL_ATTR_EX3_TRIGGERED_CAN_TRIGGER_2 0x00000200 // 9 triggered from effect?
|
||||
#define SPELL_ATTR_EX3_MAIN_HAND 0x00000400 // 10 Main hand weapon required
|
||||
@@ -418,7 +418,7 @@ enum SpellCategory
|
||||
|
||||
#define SPELL_ATTR_EX6_UNK0 0x00000001 // 0 Only Move spell have this flag
|
||||
#define SPELL_ATTR_EX6_UNK1 0x00000002 // 1 not set in 3.0.3
|
||||
#define SPELL_ATTR_EX6_UNK2 0x00000004 // 2
|
||||
#define SPELL_ATTR_EX6_IGNORE_CASTER_AURAS 0x00000004 // 2
|
||||
#define SPELL_ATTR_EX6_UNK3 0x00000008 // 3
|
||||
#define SPELL_ATTR_EX6_UNK4 0x00000010 // 4
|
||||
#define SPELL_ATTR_EX6_UNK5 0x00000020 // 5
|
||||
|
||||
+76
-35
@@ -733,32 +733,6 @@ void Spell::prepareDataForTriggerSystem(AuraEffect * triggeredByAura)
|
||||
// Create base triggers flags for Attacker and Victim ( m_procAttacker, m_procVictim and m_procEx)
|
||||
//==========================================================================================
|
||||
|
||||
/*
|
||||
Effects which are result of aura proc from triggered spell cannot proc
|
||||
to prevent chain proc of these spells
|
||||
*/
|
||||
|
||||
if (triggeredByAura && !triggeredByAura->GetParentAura()->GetTarget()->CanProc())
|
||||
{
|
||||
m_canTrigger=false;
|
||||
}
|
||||
|
||||
m_procEx = (m_IsTriggeredSpell)
|
||||
&& !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_TRIGGERED_CAN_TRIGGER)
|
||||
&& !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_TRIGGERED_CAN_TRIGGER_2)
|
||||
? PROC_EX_INTERNAL_TRIGGERED : PROC_EX_NONE;
|
||||
|
||||
if (m_IsTriggeredSpell &&
|
||||
(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_TRIGGERED_CAN_TRIGGER ||
|
||||
m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_TRIGGERED_CAN_TRIGGER_2))
|
||||
m_procEx |= PROC_EX_INTERNAL_CANT_PROC;
|
||||
|
||||
// Totem casts require spellfamilymask defined in spell_proc_event to proc
|
||||
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->isTotem() && m_caster->IsControlledByPlayer())
|
||||
{
|
||||
m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY;
|
||||
}
|
||||
|
||||
// Get data for type of attack and fill base info for trigger
|
||||
switch (m_spellInfo->DmgClass)
|
||||
{
|
||||
@@ -797,10 +771,36 @@ void Spell::prepareDataForTriggerSystem(AuraEffect * triggeredByAura)
|
||||
}
|
||||
break;
|
||||
}
|
||||
m_procEx= PROC_EX_NONE;
|
||||
|
||||
// Hunter traps spells (for Entrapment trigger)
|
||||
// Gives your Immolation Trap, Frost Trap, Explosive Trap, and Snake Trap ....
|
||||
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && (m_spellInfo->SpellFamilyFlags[1] & 0x00002000 || m_spellInfo->SpellFamilyFlags[0] & 0x1C))
|
||||
m_procAttacker |= PROC_FLAG_ON_TRAP_ACTIVATION;
|
||||
{
|
||||
m_procAttacker = PROC_FLAG_ON_TRAP_ACTIVATION;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
Effects which are result of aura proc from triggered spell cannot proc
|
||||
to prevent chain proc of these spells
|
||||
*/
|
||||
if (triggeredByAura && !triggeredByAura->GetParentAura()->GetTarget()->CanProc())
|
||||
{
|
||||
m_canTrigger=false;
|
||||
}
|
||||
|
||||
if (m_IsTriggeredSpell &&
|
||||
(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_TRIGGERED_CAN_TRIGGER ||
|
||||
m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_TRIGGERED_CAN_TRIGGER_2))
|
||||
m_procEx |= PROC_EX_INTERNAL_CANT_PROC | PROC_EX_INTERNAL_TRIGGERED;
|
||||
|
||||
// Totem casts require spellfamilymask defined in spell_proc_event to proc
|
||||
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->isTotem() && m_caster->IsControlledByPlayer())
|
||||
{
|
||||
m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::CleanupTargetList()
|
||||
@@ -2514,6 +2514,12 @@ void Spell::cancel()
|
||||
SendChannelUpdate(0);
|
||||
SendInterrupted(0);
|
||||
SendCastResult(SPELL_FAILED_INTERRUPTED);
|
||||
|
||||
// spell is canceled-take mods and clear list
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->RemoveSpellMods(this);
|
||||
|
||||
m_appliedMods.clear();
|
||||
} break;
|
||||
|
||||
default:
|
||||
@@ -2548,6 +2554,12 @@ void Spell::cast(bool skipCheck)
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER && m_targets.getUnitTarget() && m_targets.getUnitTarget() != m_caster)
|
||||
m_caster->SetInFront(m_targets.getUnitTarget());
|
||||
|
||||
// Should this be done for original caster?
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// Set spell which will drop charges for triggered cast spells
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
|
||||
}
|
||||
|
||||
// triggered cast called from Spell::prepare where it was already checked
|
||||
if(!m_IsTriggeredSpell || !skipCheck)
|
||||
@@ -2673,6 +2685,9 @@ void Spell::cast(bool skipCheck)
|
||||
m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true);
|
||||
}
|
||||
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
|
||||
SetExecutedCurrently(false);
|
||||
}
|
||||
|
||||
@@ -2717,6 +2732,10 @@ void Spell::handle_immediate()
|
||||
uint64 Spell::handle_delayed(uint64 t_offset)
|
||||
{
|
||||
UpdatePointers();
|
||||
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
|
||||
|
||||
uint64 next_time = 0;
|
||||
|
||||
if (!m_immediateHandled)
|
||||
@@ -2750,6 +2769,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
|
||||
next_time = ighit->timeDelay;
|
||||
}
|
||||
}
|
||||
|
||||
// All targets passed - need finish phase
|
||||
if (next_time == 0)
|
||||
{
|
||||
@@ -2763,6 +2783,9 @@ uint64 Spell::handle_delayed(uint64 t_offset)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
|
||||
// spell is unfinished, return next execution time
|
||||
return next_time;
|
||||
}
|
||||
@@ -2996,7 +3019,12 @@ void Spell::finish(bool ok)
|
||||
{
|
||||
//restore spell mods
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)m_caster)->RestoreSpellMods(this);
|
||||
// cleanup after mod system
|
||||
// triggered spell pointer can be not removed in some cases
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3013,10 +3041,6 @@ void Spell::finish(bool ok)
|
||||
}
|
||||
}
|
||||
|
||||
//remove spell mods
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->RemoveSpellMods(this);
|
||||
|
||||
// Okay to remove extra attacks
|
||||
if(IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
|
||||
m_caster->m_extraAttacks = 0;
|
||||
@@ -3036,13 +3060,27 @@ void Spell::finish(bool ok)
|
||||
|
||||
// potions disabled by client, send event "not in combat" if need
|
||||
if (!m_triggeredByAuraSpell && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)m_caster)->UpdatePotionCooldown(this);
|
||||
|
||||
// triggered spell pointer can be not set in some cases
|
||||
// this is needed for proper apply of triggered spell mods
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
|
||||
}
|
||||
|
||||
// call triggered spell only at successful cast (after clear combo points -> for add some if need)
|
||||
// I assume what he means is that some triggered spells may add combo points
|
||||
if(!m_TriggerSpells.empty())
|
||||
TriggerSpell();
|
||||
|
||||
// Take mods after trigger spell (needed for 14177 to affect 48664)
|
||||
// mods are taken only on succesfull cast and independantly from targets of the spell
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)m_caster)->RemoveSpellMods(this);
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
}
|
||||
|
||||
// Stop Attack for some spells
|
||||
if( m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET )
|
||||
m_caster->AttackStop();
|
||||
@@ -4797,10 +4835,8 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
|
||||
|
||||
SpellCastResult Spell::CheckCasterAuras() const
|
||||
{
|
||||
// Flag drop spells totally immuned to caster auras
|
||||
// FIXME: find more nice check for all totally immuned spells
|
||||
// AttributesEx3 & 0x10000000?
|
||||
if(m_spellInfo->Id == 23336 || m_spellInfo->Id == 23334 || m_spellInfo->Id == 34991)
|
||||
// spells totally immuned to caster auras ( wsg flag drop, give marks etc
|
||||
if(m_spellInfo->AttributesEx6& SPELL_ATTR_EX6_IGNORE_CASTER_AURAS)
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
uint8 school_immune = 0;
|
||||
@@ -5863,8 +5899,13 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set last not triggered spell for apply spellmods
|
||||
((Player*)m_Spell->GetCaster())->SetSpellModTakingSpell(m_Spell, true);
|
||||
// do the action (pass spell to channeling state)
|
||||
m_Spell->handle_immediate();
|
||||
|
||||
// And remove after effect handling
|
||||
((Player*)m_Spell->GetCaster())->SetSpellModTakingSpell(m_Spell, false);
|
||||
}
|
||||
// event will be re-added automatically at the end of routine)
|
||||
}
|
||||
|
||||
@@ -366,6 +366,8 @@ class Spell
|
||||
void EffectTitanGrip(uint32 i);
|
||||
void EffectEnchantItemPrismatic(uint32 i);
|
||||
|
||||
typedef std::set<Aura *> UsedSpellMods;
|
||||
|
||||
Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL, bool skipCheck = false );
|
||||
~Spell();
|
||||
|
||||
@@ -445,6 +447,8 @@ class Spell
|
||||
uint32 m_preCastSpell;
|
||||
SpellCastTargets m_targets;
|
||||
|
||||
UsedSpellMods m_appliedMods;
|
||||
|
||||
int32 GetCastTime() const { return m_casttime; }
|
||||
bool IsAutoRepeat() const { return m_autoRepeat; }
|
||||
void SetAutoRepeat(bool rep) { m_autoRepeat = rep; }
|
||||
@@ -453,6 +457,7 @@ class Spell
|
||||
{
|
||||
return m_spellInfo->Attributes & SPELL_ATTR_ON_NEXT_SWING;
|
||||
}
|
||||
bool IsTriggered() const {return m_IsTriggeredSpell;};
|
||||
bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; }
|
||||
bool IsMeleeAttackResetSpell() const { return !m_IsTriggeredSpell && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK); }
|
||||
bool IsRangedAttackResetSpell() const { return !m_IsTriggeredSpell && /*IsRangedSpell() &&*/ !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_RESET_AUTOSHOT); }
|
||||
|
||||
+22
-2
@@ -623,6 +623,8 @@ Unit* AuraEffect::GetSource() const
|
||||
|
||||
void Aura::Update(uint32 diff)
|
||||
{
|
||||
// TODO: store pointer to caster in aura class for update/mod handling code
|
||||
|
||||
if (m_duration > 0)
|
||||
{
|
||||
m_duration -= diff;
|
||||
@@ -666,9 +668,23 @@ void Aura::Update(uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
// Apply charged spellmods for channeled auras
|
||||
// used for example when triggered spell of spell:10 is modded
|
||||
Spell * modSpell = NULL;
|
||||
Unit* caster = NULL;
|
||||
if (IS_PLAYER_GUID(GetCasterGUID())
|
||||
{
|
||||
caster = GetCaster();
|
||||
modSpell = ((Player*)caster)->FindCurrentSpellBySpellId(GetId());
|
||||
if (caster)
|
||||
((Player*)caster)->SetSpellModTakingSpell(modSpell, true);
|
||||
}
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if (m_partAuras[i])
|
||||
m_partAuras[i]->Update(diff);
|
||||
|
||||
if (caster)
|
||||
((Player*)caster)->SetSpellModTakingSpell(modSpell, false);
|
||||
}
|
||||
|
||||
void AuraEffect::Update(uint32 diff)
|
||||
@@ -1295,15 +1311,19 @@ void Aura::SetAuraCharges(uint8 charges)
|
||||
SendAuraUpdate();
|
||||
}
|
||||
|
||||
void Aura::DropAuraCharge()
|
||||
bool Aura::DropAuraCharge()
|
||||
{
|
||||
if(m_procCharges) //auras without charges always have charge = 0
|
||||
{
|
||||
if(--m_procCharges) // Send charge change
|
||||
SendAuraUpdate();
|
||||
else // Last charge dropped
|
||||
{
|
||||
m_target->RemoveAura(this, AURA_REMOVE_BY_EXPIRE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Aura::IsPersistent() const
|
||||
@@ -1533,7 +1553,7 @@ void AuraEffect::HandleAddModifier(bool apply, bool Real, bool changeAmount)
|
||||
|
||||
if (apply)
|
||||
{
|
||||
SpellModifier *mod = new SpellModifier;
|
||||
SpellModifier *mod = new SpellModifier(GetParentAura());
|
||||
mod->op = SpellModOp(modOp);
|
||||
mod->value = m_amount;
|
||||
mod->type = SpellModType(m_auraName); // SpellModType value == spell aura types
|
||||
|
||||
@@ -77,7 +77,7 @@ class TRINITY_DLL_SPEC Aura
|
||||
void SetAuraSlot(uint8 slot) { m_auraSlot = slot; }
|
||||
uint8 GetAuraCharges() const { return m_procCharges; }
|
||||
void SetAuraCharges(uint8 charges);
|
||||
void DropAuraCharge();
|
||||
bool DropAuraCharge();
|
||||
void SetProcDamage(uint32 val) { m_procDamage = val; }
|
||||
uint32 GetProcDamage() const { return m_procDamage; }
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ bool GetDispelChance(Unit* caster, uint32 spellId)
|
||||
return !roll_chance_i(miss_chance);
|
||||
}
|
||||
|
||||
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
|
||||
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell * spell)
|
||||
{
|
||||
SpellCastTimesEntry const *spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex);
|
||||
|
||||
@@ -1309,7 +1309,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
|
||||
}
|
||||
|
||||
// Always trigger for this
|
||||
if (EventProcFlag & (PROC_FLAG_KILLED | PROC_FLAG_KILL | PROC_FLAG_ON_TRAP_ACTIVATION))
|
||||
if (procFlags & (PROC_FLAG_KILLED | PROC_FLAG_KILL | PROC_FLAG_ON_TRAP_ACTIVATION))
|
||||
return true;
|
||||
if (spellProcEvent) // Exist event data
|
||||
{
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId);
|
||||
// Different spell properties
|
||||
inline float GetSpellRadiusForHostile(SpellRadiusEntry const *radius) { return (radius ? radius->radiusHostile : 0); }
|
||||
inline float GetSpellRadiusForFriend(SpellRadiusEntry const *radius) { return (radius ? radius->radiusFriend : 0); }
|
||||
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = NULL);
|
||||
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell * spell = NULL);
|
||||
bool GetDispelChance(Unit* caster, uint32 spellId);
|
||||
inline float GetSpellMinRangeForHostile(SpellRangeEntry const *range) { return (range ? range->minRangeHostile : 0); }
|
||||
inline float GetSpellMaxRangeForHostile(SpellRangeEntry const *range) { return (range ? range->maxRangeHostile : 0); }
|
||||
|
||||
+6
-2
@@ -7545,7 +7545,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
|
||||
case 56453:
|
||||
{
|
||||
// Proc only from trap activation (from periodic proc another aura of this spell)
|
||||
if (!(procFlags & PROC_FLAG_ON_TRAP_ACTIVATION) || !roll_chance_i(triggerAmount))
|
||||
if (!(procFlags & PROC_FLAG_ON_TRAP_ACTIVATION))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -11042,7 +11042,7 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i
|
||||
return duration>0 ? duration : 0;
|
||||
}
|
||||
|
||||
void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell const * spell)
|
||||
void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell * spell)
|
||||
{
|
||||
if (!spellProto || castTime<0)
|
||||
return;
|
||||
@@ -12336,6 +12336,10 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
||||
if (triggeredByAura->GetCasterGUID() != pTarget->GetGUID())
|
||||
continue;
|
||||
break;
|
||||
/*case SPELL_AURA_ADD_FLAT_MODIFIER:
|
||||
case SPELL_AURA_ADD_PCT_MODIFIER:
|
||||
// HandleSpellModAuraProc
|
||||
break;*/
|
||||
default:
|
||||
// nothing do, just charges counter
|
||||
break;
|
||||
|
||||
+1
-1
@@ -1643,7 +1643,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 basePoints, Unit const* target);
|
||||
int32 CalcSpellDuration(SpellEntry const* spellProto);
|
||||
int32 ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive);
|
||||
void ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell const * spell=NULL);
|
||||
void ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell * spell=NULL);
|
||||
float CalculateLevelPenalty(SpellEntry const* spellProto) const;
|
||||
|
||||
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
|
||||
|
||||
@@ -105,7 +105,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
|
||||
|
||||
bool UpdateData::BuildPacket(WorldPacket *packet)
|
||||
{
|
||||
ByteBuffer buf(m_data.size() + 10 + m_outOfRangeGUIDs.size()*8);
|
||||
ByteBuffer buf(m_data.size());
|
||||
|
||||
buf << (uint32) (!m_outOfRangeGUIDs.empty() ? m_blockCount + 1 : m_blockCount);
|
||||
|
||||
@@ -116,8 +116,7 @@ bool UpdateData::BuildPacket(WorldPacket *packet)
|
||||
|
||||
for(std::set<uint64>::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
|
||||
{
|
||||
//buf.appendPackGUID(*i);
|
||||
buf << (uint8)0xFF << (uint64)*i;
|
||||
buf.appendPackGUID(*i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user