Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into 400
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMangos committed May 12, 2011
2 parents 3b8eee8 + 7fff23f commit 5ded9db
Show file tree
Hide file tree
Showing 108 changed files with 1,899 additions and 1,569 deletions.
4 changes: 3 additions & 1 deletion sql/characters.sql
Expand Up @@ -21,7 +21,7 @@

DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` (
`required_11391_01_characters_auction` bit(1) default NULL
`required_11436_01_characters_character_queststatus` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';

--
Expand Down Expand Up @@ -692,6 +692,8 @@ CREATE TABLE `character_queststatus` (
`itemcount2` int(11) unsigned NOT NULL default '0',
`itemcount3` int(11) unsigned NOT NULL default '0',
`itemcount4` int(11) unsigned NOT NULL default '0',
`itemcount5` int(11) unsigned NOT NULL default '0',
`itemcount6` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`guid`,`quest`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System';

Expand Down
17 changes: 11 additions & 6 deletions sql/mangos.sql
Expand Up @@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_11433_01_mangos_item_template` bit(1) default NULL
`required_11453_01_mangos_spell_proc_event` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';

--
Expand Down Expand Up @@ -14664,9 +14664,13 @@ INSERT INTO `spell_bonus_data` VALUES
(17712, 0, 0, 0, 0, 'Item - Lifestone Healing'),
(5707, 0, 0, 0, 0, 'Item - Lifestone Regeneration'),
(43733, 0, 0, 0, 0, 'Item - Lightning Zap'),
(71824, 0, 0, 0, 0, 'Item - Shaman T9 Elemental 4P Bonus'),
(38395, 0, 0, 0, 0, 'Item - Siphon Essence'),
(40293, 0, 0, 0, 0, 'Item - Siphon Essence'),
(71824, 0, 0, 0, 0, 'Item - Shaman T9 Elemental 4P Bonus');
(21179, 0, 0, 0, 0, 'Item - Six Demon Bag - Chain Lightning'),
(15662, 0, 0, 0, 0, 'Item - Six Demon Bag - Fireball'),
(11538, 0, 0, 0, 0, 'Item - Six Demon Bag - Frostbolt');

/*!40000 ALTER TABLE `spell_bonus_data` ENABLE KEYS */;
UNLOCK TABLES;

Expand Down Expand Up @@ -17536,19 +17540,20 @@ INSERT INTO `spell_proc_event` VALUES
(62147, 0x00, 15, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0),
(62600, 0x7F, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(63108, 0x00, 5, 0x00000002, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63156, 0x00, 0, 0x00000001, 0x00000001, 0x00000001, 0x00000040, 0x00000040, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63156, 0x00, 5, 0x00000001, 0x00000001, 0x00000001, 0x000000C0, 0x000000C0, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63251, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45),
(63280, 0x00, 11, 0x20000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63320, 0x00, 5, 0x00040000, 0x00040000, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00008000, 0x00008000, 0x00008000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0),
(63335, 0x00, 15, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63373, 0x00, 11, 0x80000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0),
(63534, 0x00, 6, 0x00000040, 0x00000040, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0),
(64440, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0),
(64952, 0x00, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(64964, 0x00, 15, 0x00000000, 0x00000000, 0x00000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63611, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00050014, 0x00000000, 0.000000, 0.000000, 0),
(63625, 0x00, 6, 0x02000000, 0x02000000, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0),
(63730, 0x00, 6, 0x00000800, 0x00000800, 0x00000800, 0x00000004, 0x00000004, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(64440, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0.000000, 0.000000, 0),
(64860, 0x00, 9, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(64952, 0x00, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(64964, 0x00, 15, 0x00000000, 0x00000000, 0x00000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(64928, 0x00, 11, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(64976, 0x00, 4, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0),
(65661, 0x00, 15, 0x00400011 ,0x00400011, 0x00400011, 0x20020004, 0x20020004, 0x20020004, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0.000000, 100.000000,0),
Expand Down
5 changes: 5 additions & 0 deletions sql/updates/11436_01_characters_character_queststatus.sql
@@ -0,0 +1,5 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11391_01_characters_auction required_11436_01_characters_character_queststatus bit;

ALTER TABLE character_queststatus
ADD COLUMN itemcount5 int(11) unsigned NOT NULL default '0' AFTER itemcount4,
ADD COLUMN itemcount6 int(11) unsigned NOT NULL default '0' AFTER itemcount5;
7 changes: 7 additions & 0 deletions sql/updates/11452_01_mangos_spell_bonus_data.sql
@@ -0,0 +1,7 @@
ALTER TABLE db_version CHANGE COLUMN required_11433_01_mangos_item_template required_11452_01_mangos_spell_bonus_data bit;

DELETE FROM spell_bonus_data WHERE entry IN (15662, 11538, 21179);
INSERT INTO spell_bonus_data VALUES
(15662, 0, 0, 0, 0, 'Item - Six Demon Bag - Fireball'),
(11538, 0, 0, 0, 0, 'Item - Six Demon Bag - Frostbolt'),
(21179, 0, 0, 0, 0, 'Item - Six Demon Bag - Chain Lightning');
5 changes: 5 additions & 0 deletions sql/updates/11452_02_mangos_spell_proc_event.sql
@@ -0,0 +1,5 @@
ALTER TABLE db_version CHANGE COLUMN required_11452_01_mangos_spell_bonus_data required_11452_02_mangos_spell_proc_event bit;

DELETE FROM spell_proc_event WHERE entry = 63156;
INSERT INTO spell_proc_event VALUES
(63156, 0x00, 5, 0x00000001, 0x00000001, 0x00000001, 0x000000C0, 0x000000C0, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
5 changes: 5 additions & 0 deletions sql/updates/11453_01_mangos_spell_proc_event.sql
@@ -0,0 +1,5 @@
ALTER TABLE db_version CHANGE COLUMN required_11452_02_mangos_spell_proc_event required_11453_01_mangos_spell_proc_event bit;

DELETE FROM spell_proc_event WHERE entry = 64860;
INSERT INTO spell_proc_event VALUES
(64860, 0x00, 9, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
10 changes: 5 additions & 5 deletions src/game/AggressorAI.cpp
Expand Up @@ -37,7 +37,7 @@ AggressorAI::Permissible(const Creature *creature)
return PERMIT_BASE_NO;
}

AggressorAI::AggressorAI(Creature *c) : CreatureAI(c), i_victimGuid(0), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK)
AggressorAI::AggressorAI(Creature *c) : CreatureAI(c), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK)
{
}

Expand Down Expand Up @@ -73,7 +73,7 @@ void AggressorAI::EnterEvadeMode()
if (!m_creature->isAlive())
{
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature stopped attacking, he is dead [guid=%u]", m_creature->GetGUIDLow());
i_victimGuid = 0;
i_victimGuid.Clear();
m_creature->CombatStop(true);
m_creature->DeleteThreatList();
return;
Expand Down Expand Up @@ -114,7 +114,7 @@ void AggressorAI::EnterEvadeMode()
}

m_creature->DeleteThreatList();
i_victimGuid = 0;
i_victimGuid.Clear();
m_creature->CombatStop(true);
m_creature->SetLootRecipient(NULL);
}
Expand All @@ -126,7 +126,7 @@ AggressorAI::UpdateAI(const uint32 /*diff*/)
if(!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;

i_victimGuid = m_creature->getVictim()->GetGUID();
i_victimGuid = m_creature->getVictim()->GetObjectGuid();

DoMeleeAttackIfReady();
}
Expand All @@ -146,7 +146,7 @@ AggressorAI::AttackStart(Unit *u)

if(m_creature->Attack(u,true))
{
i_victimGuid = u->GetGUID();
i_victimGuid = u->GetObjectGuid();

m_creature->AddThreat(u);
m_creature->SetInCombatWith(u);
Expand Down
4 changes: 3 additions & 1 deletion src/game/AggressorAI.h
Expand Up @@ -21,6 +21,7 @@

#include "CreatureAI.h"
#include "Timer.h"
#include "ObjectGuid.h"

class Creature;

Expand All @@ -45,8 +46,9 @@ class MANGOS_DLL_DECL AggressorAI : public CreatureAI
static int Permissible(const Creature *);

private:
uint64 i_victimGuid;
ObjectGuid i_victimGuid;
AggressorState i_state;
TimeTracker i_tracker;
};

#endif
2 changes: 1 addition & 1 deletion src/game/ArenaTeam.cpp
Expand Up @@ -545,7 +545,7 @@ uint8 ArenaTeam::GetSlotByType(ArenaType type )
bool ArenaTeam::HaveMember(ObjectGuid guid) const
{
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
if(itr->guid == guid.GetRawValue())
if(itr->guid == guid)
return true;

return false;
Expand Down
72 changes: 37 additions & 35 deletions src/game/Bag.cpp
Expand Up @@ -22,19 +22,19 @@
#include "Log.h"
#include "UpdateData.h"

Bag::Bag( ): Item()
Bag::Bag(): Item()
{
m_objectType |= (TYPEMASK_ITEM | TYPEMASK_CONTAINER);
m_objectTypeId = TYPEID_CONTAINER;

m_valuesCount = CONTAINER_END;

memset(m_bagslot, 0, sizeof(Item *) * MAX_BAG_SIZE);
memset(m_bagslot, 0, sizeof(Item*) * MAX_BAG_SIZE);
}

Bag::~Bag()
{
for(int i = 0; i < MAX_BAG_SIZE; ++i)
for (int i = 0; i < MAX_BAG_SIZE; ++i)
if (m_bagslot[i])
delete m_bagslot[i];
}
Expand All @@ -43,28 +43,28 @@ void Bag::AddToWorld()
{
Item::AddToWorld();

for(uint32 i = 0; i < GetBagSize(); ++i)
if(m_bagslot[i])
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i])
m_bagslot[i]->AddToWorld();
}

void Bag::RemoveFromWorld()
{
for(uint32 i = 0; i < GetBagSize(); ++i)
if(m_bagslot[i])
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i])
m_bagslot[i]->RemoveFromWorld();

Item::RemoveFromWorld();
}

bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
{
ItemPrototype const * itemProto = ObjectMgr::GetItemPrototype(itemid);
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(itemid);

if(!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
return false;

Object::_Create( guidlow, 0, HIGHGUID_CONTAINER );
Object::_Create(guidlow, 0, HIGHGUID_CONTAINER);

SetEntry(itemid);
SetObjectScale(DEFAULT_OBJECT_SCALE);
Expand All @@ -82,7 +82,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
// Cleaning 20 slots
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i*2), ObjectGuid());
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i * 2), ObjectGuid());
m_bagslot[i] = NULL;
}

Expand All @@ -94,15 +94,15 @@ void Bag::SaveToDB()
Item::SaveToDB();
}

bool Bag::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
bool Bag::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
{
if (!Item::LoadFromDB(guidLow, fields, ownerGuid))
return false;

// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
for (int i = 0; i < MAX_BAG_SIZE; ++i)
{
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i*2), ObjectGuid());
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i * 2), ObjectGuid());
if (m_bagslot[i])
{
delete m_bagslot[i];
Expand All @@ -125,29 +125,29 @@ void Bag::DeleteFromDB()
uint32 Bag::GetFreeSlots() const
{
uint32 slots = 0;
for (uint32 i=0; i < GetBagSize(); ++i)
for (uint32 i = 0; i < GetBagSize(); ++i)
if (!m_bagslot[i])
++slots;

return slots;
}

void Bag::RemoveItem( uint8 slot, bool /*update*/ )
void Bag::RemoveItem(uint8 slot, bool /*update*/)
{
MANGOS_ASSERT(slot < MAX_BAG_SIZE);

if (m_bagslot[slot])
m_bagslot[slot]->SetContainer(NULL);

m_bagslot[slot] = NULL;
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot*2), ObjectGuid());
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), ObjectGuid());
}

void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ )
void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/)
{
MANGOS_ASSERT(slot < MAX_BAG_SIZE);

if( pItem )
if (pItem)
{
m_bagslot[slot] = pItem;
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetObjectGuid());
Expand All @@ -158,28 +158,28 @@ void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ )
}
}

void Bag::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const
void Bag::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const
{
Item::BuildCreateUpdateBlockForPlayer( data, target );
Item::BuildCreateUpdateBlockForPlayer(data, target);

for (uint32 i = 0; i < GetBagSize(); ++i)
if(m_bagslot[i])
m_bagslot[i]->BuildCreateUpdateBlockForPlayer( data, target );
if (m_bagslot[i])
m_bagslot[i]->BuildCreateUpdateBlockForPlayer(data, target);
}

// If the bag is empty returns true
bool Bag::IsEmpty() const
{
for(uint32 i = 0; i < GetBagSize(); ++i)
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i])
return false;

return true;
}

Item* Bag::GetItemByEntry( uint32 item ) const
Item* Bag::GetItemByEntry(uint32 item) const
{
for(uint32 i = 0; i < GetBagSize(); ++i)
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i] && m_bagslot[i]->GetEntry() == item)
return m_bagslot[i];

Expand All @@ -188,7 +188,7 @@ Item* Bag::GetItemByEntry( uint32 item ) const

Item* Bag::GetItemByLimitedCategory(uint32 limitedCategory) const
{
for(uint32 i = 0; i < GetBagSize(); ++i)
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i] && m_bagslot[i]->GetProto()->ItemLimitCategory == limitedCategory)
return m_bagslot[i];

Expand All @@ -198,13 +198,14 @@ Item* Bag::GetItemByLimitedCategory(uint32 limitedCategory) const
uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
{
uint32 count = 0;
for(uint32 i=0; i < GetBagSize(); ++i)

for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i])
if (m_bagslot[i] != eItem && m_bagslot[i]->GetEntry() == item)
count += m_bagslot[i]->GetCount();

if (eItem && eItem->GetProto()->GemProperties)
for(uint32 i=0; i < GetBagSize(); ++i)
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i])
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->Socket[0].Color)
count += m_bagslot[i]->GetGemCountWithID(item);
Expand All @@ -215,27 +216,28 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* eItem) const
{
uint32 count = 0;
for(uint32 i = 0; i < GetBagSize(); ++i)

for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i])
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->ItemLimitCategory == limitCategory )
count += m_bagslot[i]->GetCount();

return count;
}

uint8 Bag::GetSlotByItemGUID(uint64 guid) const
uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const
{
for(uint32 i = 0; i < GetBagSize(); ++i)
if(m_bagslot[i] != 0)
if(m_bagslot[i]->GetGUID() == guid)
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i] != 0)
if (m_bagslot[i]->GetObjectGuid() == guid)
return i;

return NULL_SLOT;
}

Item* Bag::GetItemByPos( uint8 slot ) const
Item* Bag::GetItemByPos(uint8 slot) const
{
if( slot < GetBagSize() )
if (slot < GetBagSize())
return m_bagslot[slot];

return NULL;
Expand Down

0 comments on commit 5ded9db

Please sign in to comment.