• Страница 1 из 1
  • 1
Модератор форума: INFERNOS  
External Mail?
djonii
Сержант
У кого есть патч External Mail для скай фире

Добавлено (13.03.2012, 12:59)
---------------------------------------------
все нашел спс..

Сообщение # 1 написано 13.03.2012 в 12:59
HiTON
Рыцарь
а для остальных ссылку?
Сообщение # 2 написано 30.07.2014 в 17:59
morra
Центурион
Цитата HiTON ()
а для остальных ссылку?

ну, дай мне ссылку, жлоб))
Сообщение # 3 написано 01.09.2014 в 03:55
Teaching_shop
Скаут
Цитата morra ()
ну, дай мне ссылку, жлоб))
Автор LordPsyan
Код
From 0907c68d5396b43df362b04f5267fc3f827a8d8b Mon Sep 17 00:00:00 2001From: LordPsyan <realmsofwarcraft@gmail.com>
Date: Mon, 29 Feb 2016 08:34:48 -0600
Subject:  [PATCH]2016_02_29-External_Mail

--- .../External_Mail/characters.external_mail.sql     | 10 ++++
.../Database/Implementation/CharacterDatabase.cpp  |  3 ++
.../Database/Implementation/CharacterDatabase.h    |  2 +
src/server/game/Mails/Mail.cpp                     | 62 ++++++++++++++++++++++
src/server/game/Server/WorldSession.h              |  1 +
src/server/game/World/World.cpp                    | 19 ++++++-
src/server/game/World/World.h                      |  4 +-
src/server/worldserver/worldserver.conf.dist       | 16 ++++++
8 files changed, 115 insertions(+), 2 deletions(-)
create mode 100644 sql/TrinityCore-Patches/External_Mail/characters.external_mail.sql

diff --git a/sql/TrinityCore-Patches/External_Mail/characters.external_mail.sql b/sql/TrinityCore-Patches/External_Mail/characters.external_mail.sqlnew file mode 100644
index 0000000..8cd6a05--- /dev/null+++ b/sql/TrinityCore-Patches/External_Mail/characters.external_mail.sql@@ -0,0 +1,10 @@+CREATE TABLE `mail_external` (+  `id` bigint(20) unsigned NOT NULL auto_increment,+  `receiver` bigint(20) unsigned NOT NULL,+  `subject` varchar(200) default 'Support Message',+  `message` varchar(500) default 'Support Message',+  `money` bigint(20) unsigned NOT NULL default '0',+  `item` bigint(20) unsigned NOT NULL default '0',+  `item_count` bigint(20) unsigned NOT NULL default '0',+  PRIMARY KEY  (`id`)+) ENGINE=MyISAM AUTO_INCREMENT=7525 DEFAULT CHARSET=utf8;\ No newline at end of file
diff --git a/src/server/database/Database/Implementation/CharacterDatabase.cpp b/src/server/database/Database/Implementation/CharacterDatabase.cppindex 23c4d11..fcaf016 100644--- a/src/server/database/Database/Implementation/CharacterDatabase.cpp+++ b/src/server/database/Database/Implementation/CharacterDatabase.cpp@@ -142,6 +142,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()     PrepareStatement(CHAR_UPD_MAIL_RETURNED, "UPDATE mail SET sender = ?, receiver = ?, expire_time = ?, deliver_time = ?, cod = 0, checked = ? WHERE id = ?", CONNECTION_ASYNC);
     PrepareStatement(CHAR_UPD_MAIL_ITEM_RECEIVER, "UPDATE mail_items SET receiver = ? WHERE item_guid = ?", CONNECTION_ASYNC);
     PrepareStatement(CHAR_UPD_ITEM_OWNER, "UPDATE item_instance SET owner_guid = ? WHERE guid = ?", CONNECTION_ASYNC);
+    PrepareStatement(CHAR_GET_EXTERNAL_MAIL, "SELECT id, receiver, subject, message, money, item, item_count FROM mail_external ORDER BY id ASC", CONNECTION_SYNCH);+    PrepareStatement(CHAR_DEL_EXTERNAL_MAIL, "DELETE FROM mail_external WHERE id = ?", CONNECTION_ASYNC);+
     PrepareStatement(CHAR_SEL_ITEM_REFUNDS, "SELECT player_guid, paidMoney, paidExtendedCost FROM item_refund_instance WHERE item_guid = ? AND player_guid = ? LIMIT 1", CONNECTION_SYNCH);
     PrepareStatement(CHAR_SEL_ITEM_BOP_TRADE, "SELECT allowedPlayers FROM item_soulbound_trade_data WHERE itemGuid = ? LIMIT 1", CONNECTION_SYNCH);
diff --git a/src/server/database/Database/Implementation/CharacterDatabase.h b/src/server/database/Database/Implementation/CharacterDatabase.hindex d69580d..32c22f6 100644--- a/src/server/database/Database/Implementation/CharacterDatabase.h+++ b/src/server/database/Database/Implementation/CharacterDatabase.h@@ -129,6 +129,8 @@ enum CharacterDatabaseStatements     CHAR_UPD_MAIL_RETURNED,
     CHAR_UPD_MAIL_ITEM_RECEIVER,
     CHAR_UPD_ITEM_OWNER,
+    CHAR_GET_EXTERNAL_MAIL,+    CHAR_DEL_EXTERNAL_MAIL,     CHAR_SEL_ITEM_REFUNDS,
     CHAR_SEL_ITEM_BOP_TRADE,
     CHAR_DEL_ITEM_BOP_TRADE,
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cppindex bc31a3c..5c17521 100644--- a/src/server/game/Mails/Mail.cpp+++ b/src/server/game/Mails/Mail.cpp@@ -20,6 +20,7 @@ #include "Mail.h"
#include "Log.h"
#include "World.h"
+#include "WorldSession.h" #include "ObjectMgr.h"
#include "Player.h"
#include "BattlegroundMgr.h"
@@ -281,3 +282,64 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,         deleteIncludedItems(temp);
     }
}
++void WorldSession::SendExternalMails()+{+    TC_LOG_DEBUG("entities.player.character", "External Mail> Sending mails in queue...");++    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_GET_EXTERNAL_MAIL);+    PreparedQueryResult result = CharacterDatabase.Query(stmt);+    if (!result)+    {+        TC_LOG_DEBUG("entities.player.character", "External Mail> No mails in queue...");+        return;+    }++    SQLTransaction trans = CharacterDatabase.BeginTransaction();++    MailDraft* mail = NULL;++    do+    {+        Field *fields = result->Fetch();+        uint32 id = fields[0].GetUInt32();+        uint32 receiver_guid = fields[1].GetUInt32();+        std::string subject = fields[2].GetString();+        std::string body = fields[3].GetString();+        uint32 money = fields[4].GetUInt32();+        uint32 itemId = fields[5].GetUInt32();+        uint32 itemCount = fields[6].GetUInt32();++        Player *receiver = ObjectAccessor::FindPlayer(ObjectGuid(HighGuid::Player, 0, (receiver_guid)));++        mail = new MailDraft(subject, body);++        if (money)+        {+            TC_LOG_DEBUG("entities.player.character", "External Mail> Adding money");+            mail->AddMoney(money);+        }++        if (itemId)+        {+             TC_LOG_DEBUG("entities.player.character", "External Mail> Adding %u of item with id %u", itemCount, itemId);+             if(Item* mailItem = Item::CreateItem(itemId, itemCount))+             {+                 mailItem->SaveToDB(trans);+                 mail->AddItem(mailItem);+             }+        }++        mail->SendMailTo(trans, receiver ? receiver : MailReceiver(receiver_guid), MailSender(MAIL_NORMAL, 0, MAIL_STATIONERY_GM), MAIL_CHECK_MASK_RETURNED);+        delete mail;++        stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXTERNAL_MAIL);+        stmt->setUInt32(0, id);+        trans->Append(stmt);++        TC_LOG_DEBUG("entities.player.character", "External Mail> Mail sent");+   } while (result->NextRow());++   CharacterDatabase.CommitTransaction(trans);+   TC_LOG_DEBUG("entities.player.character", "External Mail> All Mails Sent...");+}\ No newline at end of file
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.hindex 2253b6b..d5e1046 100644--- a/src/server/game/Server/WorldSession.h+++ b/src/server/game/Server/WorldSession.h@@ -377,6 +377,7 @@ class WorldSession             }
         }
         //used with item_page table
+        static void SendExternalMails();         bool SendItemInfo(uint32 itemid, WorldPacket data);
         //auction
         void SendAuctionHello(ObjectGuid guid, Creature* unit);
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cppindex f904f30..262c48f 100644--- a/src/server/game/World/World.cpp+++ b/src/server/game/World/World.cpp@@ -1307,6 +1307,10 @@ void World::LoadConfigSettings(bool reload)     // MySQL ping time interval
     m_int_configs[CONFIG_DB_PING_INTERVAL] = sConfigMgr->GetIntDefault("MaxPingTime", 30);

+     // External Mail+    m_bool_configs[CONFIG_EXTERNAL_MAIL_ENABLE] = sConfigMgr->GetBoolDefault("External.Mail.Enable", false);+    m_int_configs[CONFIG_EXTERNAL_MAIL_INTERVAL] = sConfigMgr->GetIntDefault("External.Mail.Interval", 1);+     // misc
     m_bool_configs[CONFIG_PDUMP_NO_PATHS] = sConfigMgr->GetBoolDefault("PlayerDump.DisallowPaths", true);
     m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = sConfigMgr->GetBoolDefault("PlayerDump.DisallowOverwrite", true);
@@ -1885,7 +1889,9 @@ void World::SetInitialWorldSettings()     tm localTm;
     localtime_r(&m_gameTime, &localTm);
     mail_timer = ((((localTm.tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
-                    //1440++    extmail_timer.SetInterval(m_int_configs[CONFIG_EXTERNAL_MAIL_INTERVAL] * MINUTE * IN_MILLISECONDS);+     mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
     TC_LOG_INFO("server.loading", "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));

@@ -2117,6 +2123,17 @@ void World::Update(uint32 diff)     if (m_gameTime > m_NextGuildReset)
         ResetGuildCap();

+     // Handle external mail+    if (sWorld->getBoolConfig(CONFIG_EXTERNAL_MAIL_ENABLE))+    {+        extmail_timer.Update(diff);+        if (extmail_timer.Passed())+        {+            WorldSession::SendExternalMails();+            extmail_timer.Reset();+        }+    }+     /// <ul><li> Handle auctions when the timer has passed
     if (m_timers[WUPDATE_AUCTIONS].Passed())
     {
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.hindex 492a3bd..1534fdc 100644--- a/src/server/game/World/World.h+++ b/src/server/game/World/World.h@@ -195,7 +195,7 @@ enum WorldBoolConfigs     // 32
     // 33
     // 34
-    // 35+    CONFIG_EXTERNAL_MAIL_ENABLE,     // 36
     // 37
     // 38
@@ -437,6 +437,7 @@ enum WorldIntConfigs     CONFIG_BIRTHDAY_TIME,
     CONFIG_CREATURE_PICKPOCKET_REFILL,
     CONFIG_AHBOT_UPDATE_INTERVAL,
+    CONFIG_EXTERNAL_MAIL_INTERVAL,     CONFIG_CHARTER_COST_GUILD,
     CONFIG_CHARTER_COST_ARENA_2v2,
     CONFIG_CHARTER_COST_ARENA_3v3,
@@ -920,6 +921,7 @@ class World         time_t m_startTime;
         time_t m_gameTime;
         IntervalTimer m_timers[WUPDATE_COUNT];
+        IntervalTimer extmail_timer;         time_t mail_timer;
         time_t mail_timer_expires;
         uint32 m_updateTime, m_updateTimeSum;
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.distindex 4837a24..da99b0c 100644--- a/src/server/worldserver/worldserver.conf.dist+++ b/src/server/worldserver/worldserver.conf.dist@@ -3565,6 +3565,22 @@ PacketSpoof.BanDuration = 86400
#
###################################################################################################
+#+#    External.Mail.Enable+#        Enable external mail delivery from mail_external table.+#        Default: 0 (disabled)+#                 1 (enabled)+#+#    External.Mail.Interval+#        Mail delivery delay time for item sending from mail_external table, in minutes.+#        Default: 5 minutes+#++External.Mail.Enable = 1+External.Mail.Interval = 5++#+###################################################################################################
#
# Prepatch by LordPsyan.
-- 2.1.4
Сообщение # 4 написано 30.04.2016 в 16:47
  • Страница 1 из 1
  • 1
Поиск: