Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include "Chat.h"
  3. #include "AccountMgr.h"
  4. #include "ScriptMgr.h"
  5. #include "Common.h"
  6. #include "Player.h"
  7. #include "WorldSession.h"
  8. #include "Language.h"
  9. #include "Log.h"
  10. #include "SpellAuras.h"
  11. #include "World.h"
  12. #include "Mail.h"
  13. #include "Item.h"
  14. #include "Config.h"
  15. #include "SystemConfig.h"
  16. #include "revision.h"
  17. #include "ObjectMgr.h"
  18. #include "WorldPacket.h"
  19. #include "DatabaseEnv.h"
  20. #include "TicketMgr.h"
  21. #include "Battleground.h"
  22.  
  23. void SendMail(Player* player, uint32 itemId)
  24. {
  25. MailSender sender(MAIL_NORMAL, 0, MAIL_STATIONERY_GM);
  26. MailDraft draft("[DONATE-ALERT]", "Возврат вещей с Поля Боя!");
  27. SQLTransaction trans = CharacterDatabase.BeginTransaction();
  28.  
  29. if (Item* item = Item::CreateItem(itemId, 10, 0))
  30. {
  31. item->SaveToDB(trans); // Save to prevent being lost at next mail load. If send fails, the item will be deleted.
  32. draft.AddItem(item);
  33. }
  34.  
  35. draft.SendMailTo(trans, MailReceiver(player, player->GetGUID()), sender);
  36. CharacterDatabase.CommitTransaction(trans);
  37. }
  38.  
  39. class Donate_Alert : public PlayerScript
  40. {
  41. public:
  42. Donate_Alert() : PlayerScript("Donate_Alert") {}
  43.  
  44. void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea)
  45. {
  46. Battleground* bg = player->GetBattleground();
  47.  
  48.  
  49. if (bg && player->GetMap()->IsBattlegroundOrArena() && bg->GetStatus() == STATUS_WAIT_JOIN)
  50. {
  51. ChatHandler handler(player->GetSession());
  52. if (sConfigMgr->GetBoolDefault("Donate.BattleGround.Enable", false))
  53. {
  54. //Для Сумок
  55. if (player->HasItemCount(500005, 1, false))
  56. {
  57. handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFУ вас обнаружены донат-сумки.");
  58. handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFПожалуйста выложите их в банк.");
  59. handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFИспользование доната на Полях Боя - Запрещено!");
  60. if (player->GetTeamId() == TEAM_HORDE)
  61. player->TeleportTo(1, 1293.797974f, -4327.997070f, 34.034290f, 1.094702f);
  62. else
  63. player->TeleportTo(0, -8958.486328f, 533.348083f, 97.405876f, 1.538157f);
  64. }
  65. //Остальной Донат
  66. if (player->HasItemCount(500011, 1, false))
  67. {
  68. handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFУ вас обнаружены донат вещи.");
  69. handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFИспользование доната на Полях Боя - Запрещено!");
  70. handler.PSendSysMessage("|cffff0000[DONATE-ALERT] |cff14ECCFВещи отправлены на вашу почту!");
  71. player->DestroyItemCount(500011, 1, true, false);
  72. SendMail(player, 500011);
  73. }
  74. }
  75. }
  76.  
  77. if (bg && player->GetMap()->IsBattleArena() && bg->GetStatus() == STATUS_WAIT_JOIN)
  78. {
  79. ChatHandler handler(player->GetSession());
  80. // handler.PSendSysMessage("Вы в зоне Арены, которая вот вот начнётся!");
  81. }
  82. }
  83. };
  84.  
  85. void AddSC_Donate_Alert_System()
  86. {
  87. new Donate_Alert();
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement