Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- #include "Chat.h"
- #include "AccountMgr.h"
- #include "ScriptMgr.h"
- #include "Common.h"
- #include "Player.h"
- #include "WorldSession.h"
- #include "Language.h"
- #include "Log.h"
- #include "SpellAuras.h"
- #include "World.h"
- #include "Mail.h"
- #include "Item.h"
- #include "Config.h"
- #include "SystemConfig.h"
- #include "revision.h"
- #include "ObjectMgr.h"
- #include "WorldPacket.h"
- #include "DatabaseEnv.h"
- #include "TicketMgr.h"
- #include "Battleground.h"
- void SendMail(Player* player, uint32 itemId)
- {
- MailSender sender(MAIL_NORMAL, 0, MAIL_STATIONERY_GM);
- MailDraft draft("[DONATE-ALERT]", "Возврат вещей с Поля Боя!");
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
- if (Item* item = Item::CreateItem(itemId, 10, 0))
- {
- item->SaveToDB(trans); // Save to prevent being lost at next mail load. If send fails, the item will be deleted.
- draft.AddItem(item);
- }
- draft.SendMailTo(trans, MailReceiver(player, player->GetGUID()), sender);
- CharacterDatabase.CommitTransaction(trans);
- }
- class Donate_Alert : public PlayerScript
- {
- public:
- Donate_Alert() : PlayerScript("Donate_Alert") {}
- void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea)
- {
- Battleground* bg = player->GetBattleground();
- if (bg && player->GetMap()->IsBattlegroundOrArena() && bg->GetStatus() == STATUS_WAIT_JOIN)
- {
- ChatHandler handler(player->GetSession());
- if (sConfigMgr->GetBoolDefault("Donate.BattleGround.Enable", false))
- {
- //Для Сумок
- if (player->HasItemCount(500005, 1, false))
- {
- handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFУ вас обнаружены донат-сумки.");
- handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFПожалуйста выложите их в банк.");
- handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFИспользование доната на Полях Боя - Запрещено!");
- if (player->GetTeamId() == TEAM_HORDE)
- player->TeleportTo(1, 1293.797974f, -4327.997070f, 34.034290f, 1.094702f);
- else
- player->TeleportTo(0, -8958.486328f, 533.348083f, 97.405876f, 1.538157f);
- }
- //Остальной Донат
- if (player->HasItemCount(500011, 1, false))
- {
- handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFУ вас обнаружены донат вещи.");
- handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFИспользование доната на Полях Боя - Запрещено!");
- handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFВещи отправлены на вашу почту!");
- player->DestroyItemCount(500011, 1, true, false);
- SendMail(player, 500011);
- }
- }
- }
- if (bg && player->GetMap()->IsBattleArena() && bg->GetStatus() == STATUS_WAIT_JOIN)
- {
- ChatHandler handler(player->GetSession());
- // handler.PSendSysMessage("Вы в зоне Арены, которая вот вот начнётся!");
- }
- }
- };
- void AddSC_Donate_Alert_System()
- {
- new Donate_Alert();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement