Merge git://github.com/TrinityCore/TrinityCore into mmaps

This commit is contained in:
kaelima
2012-11-07 16:43:13 +01:00
5 changed files with 45 additions and 37 deletions
+29 -14
View File
@@ -1727,20 +1727,6 @@ CREATE TABLE `guild_member` (
`rank` tinyint(3) unsigned NOT NULL,
`pnote` varchar(31) NOT NULL DEFAULT '',
`offnote` varchar(31) NOT NULL DEFAULT '',
`BankResetTimeMoney` int(10) unsigned NOT NULL DEFAULT '0',
`BankRemMoney` int(10) unsigned NOT NULL DEFAULT '0',
`BankResetTimeTab0` int(10) unsigned NOT NULL DEFAULT '0',
`BankRemSlotsTab0` int(10) unsigned NOT NULL DEFAULT '0',
`BankResetTimeTab1` int(10) unsigned NOT NULL DEFAULT '0',
`BankRemSlotsTab1` int(10) unsigned NOT NULL DEFAULT '0',
`BankResetTimeTab2` int(10) unsigned NOT NULL DEFAULT '0',
`BankRemSlotsTab2` int(10) unsigned NOT NULL DEFAULT '0',
`BankResetTimeTab3` int(10) unsigned NOT NULL DEFAULT '0',
`BankRemSlotsTab3` int(10) unsigned NOT NULL DEFAULT '0',
`BankResetTimeTab4` int(10) unsigned NOT NULL DEFAULT '0',
`BankRemSlotsTab4` int(10) unsigned NOT NULL DEFAULT '0',
`BankResetTimeTab5` int(10) unsigned NOT NULL DEFAULT '0',
`BankRemSlotsTab5` int(10) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `guid_key` (`guid`),
KEY `guildid_key` (`guildid`),
KEY `guildid_rank_key` (`guildid`,`rank`)
@@ -1756,6 +1742,35 @@ LOCK TABLES `guild_member` WRITE;
/*!40000 ALTER TABLE `guild_member` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `guild_member_withdraw`
--
DROP TABLE IF EXISTS `guild_member_withdraw`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE IF NOT EXISTS `guild_member_withdraw` (
`guid` int(10) unsigned NOT NULL,
`tab0` int(10) unsigned NOT NULL DEFAULT '0',
`tab1` int(10) unsigned NOT NULL DEFAULT '0',
`tab2` int(10) unsigned NOT NULL DEFAULT '0',
`tab3` int(10) unsigned NOT NULL DEFAULT '0',
`tab4` int(10) unsigned NOT NULL DEFAULT '0',
`tab5` int(10) unsigned NOT NULL DEFAULT '0',
`money` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Guild Member Daily Withdraws';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `guild_member_withdraw`
--
LOCK TABLES `guild_member_withdraw` WRITE;
/*!40000 ALTER TABLE `guild_member_withdraw` DISABLE KEYS */;
/*!40000 ALTER TABLE `guild_member_withdraw` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `guild_rank`
--
@@ -27,4 +27,3 @@ ALTER TABLE `guild_member` DROP COLUMN `BankResetTimeTab5`;
DELETE FROM `worldstates` WHERE `entry`=20006;
INSERT INTO `worldstates` (`entry`,`value`,`comment`) VALUES (20006,0, 'Guild daily reset');
+7 -11
View File
@@ -223,10 +223,9 @@ void Guild::RankInfo::SaveToDB(SQLTransaction& trans) const
CharacterDatabase.ExecuteOrAppend(trans, stmt);
}
bool Guild::RankInfo::CreateMissingTabsIfNeeded(uint8 ranks, SQLTransaction& trans)
void Guild::RankInfo::CreateMissingTabsIfNeeded(uint8 tabs, SQLTransaction& trans, bool logOnCreate /* = false */)
{
bool ret = false;
for (uint8 i = 0; i < ranks; ++i)
for (uint8 i = 0; i < tabs; ++i)
{
GuildBankRightsAndSlots& rightsAndSlots = m_bankTabRightsAndSlots[i];
if (rightsAndSlots.GetTabId() == i)
@@ -236,7 +235,9 @@ bool Guild::RankInfo::CreateMissingTabsIfNeeded(uint8 ranks, SQLTransaction& tra
if (m_rankId == GR_GUILDMASTER)
rightsAndSlots.SetGuildMasterValues();
ret = true;
if (logOnCreate)
sLog->outError(LOG_FILTER_GUILD, "Guild %u has broken Tab %u for rank %u. Created default tab.", m_guildId, i, m_rankId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_RIGHT);
stmt->setUInt32(0, m_guildId);
stmt->setUInt8 (1, i);
@@ -245,8 +246,6 @@ bool Guild::RankInfo::CreateMissingTabsIfNeeded(uint8 ranks, SQLTransaction& tra
stmt->setUInt32(4, rightsAndSlots.GetSlots());
trans->Append(stmt);
}
return ret;
}
void Guild::RankInfo::WritePacket(WorldPacket& data) const
@@ -2018,11 +2017,8 @@ bool Guild::Validate()
else
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
if (rankInfo->CreateMissingTabsIfNeeded(_GetPurchasedTabsSize(), trans))
{
sLog->outError(LOG_FILTER_GUILD, "Guild %u has broken Tabs for rank id %u, creating default tab...", m_id, rankId);
CharacterDatabase.CommitTransaction(trans);
}
rankInfo->CreateMissingTabsIfNeeded(_GetPurchasedTabsSize(), trans, true);
CharacterDatabase.CommitTransaction(trans);
}
}
}
+1 -1
View File
@@ -500,7 +500,7 @@ private:
}
void SetBankTabSlotsAndRights(GuildBankRightsAndSlots rightsAndSlots, bool saveToDB);
bool CreateMissingTabsIfNeeded(uint8 ranks, SQLTransaction& trans);
void CreateMissingTabsIfNeeded(uint8 ranks, SQLTransaction& trans, bool logOnCreate = false);
private:
uint32 m_guildId;
@@ -232,18 +232,16 @@ public:
{
Unit* target = NULL;
if (PlayerGUID)
{
if (Unit* player = Unit::GetPlayer(*me, PlayerGUID)->ToUnit())
target = RAND((Unit*)me, player);
} else
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
if (player->isAlive() && RAND(0, 1))
target = player;
if (!target)
target = me;
if (target)
{
summoned->setFaction(168);
summoned->AddThreat(target, 32.0f);
summoned->AI()->AttackStart(target);
}
summoned->setFaction(168);
summoned->AddThreat(target, 32.0f);
summoned->AI()->AttackStart(target);
}
}