SHOW:
|
|
- or go back to the newest paste.
| 1 | #include "ScriptPCH.h" | |
| 2 | #include "Chat.h" | |
| 3 | #define PlayerAmount 10 | |
| 4 | - | #define contestors 0 |
| 4 | + | // #define contestors 0 Teh fuck is this? |
| 5 | static bool Countdownstart; | |
| 6 | - | static uint32 playeroom = PlayerAmount; |
| 6 | + | // Player*pPlayer; Teh fuck is this?? |
| 7 | - | Player*pPlayer; |
| 7 | + | |
| 8 | class PvP_Event_Announcer : public WorldScript | |
| 9 | {
| |
| 10 | - | std::string Name; |
| 10 | + | |
| 11 | - | uint32 Level; |
| 11 | + | |
| 12 | ||
| 13 | void OnStartup() | |
| 14 | {
| |
| 15 | Events.ScheduleEvent(COUNTDOWN_60,60000); | |
| 16 | Events.ExecuteEvent(); | |
| 17 | } | |
| 18 | ||
| 19 | void OnUpdate(uint32 diff) | |
| 20 | {
| |
| 21 | Events.Update(diff); | |
| 22 | while (uint32 eventId = Events.ExecuteEvent()) | |
| 23 | {
| |
| 24 | switch (eventId) | |
| 25 | {
| |
| 26 | case COUNTDOWN_60: | |
| 27 | {
| |
| 28 | sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event countdown is starting in 1 minute !"); | |
| 29 | Events.ScheduleEvent(COUNTDOWN_30, 30000); | |
| 30 | ||
| 31 | }break; | |
| 32 | case COUNTDOWN_30: | |
| 33 | {
| |
| 34 | sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event countdown is starting in 30 seconds, contestors be ready!"); | |
| 35 | Events.ScheduleEvent(EVENT_START_60, 30000); | |
| 36 | ||
| 37 | }break; | |
| 38 | case EVENT_START_60: | |
| 39 | {
| |
| 40 | Countdownstart = true; | |
| 41 | sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event countdown has started, you have 1 minute to enter by typing: .pvpevent enter , be fast cause only 10 players can enter!"); | |
| 42 | Events.ScheduleEvent(EVENT_START_30, 30000); | |
| 43 | ||
| 44 | }break; | |
| 45 | case EVENT_START_30: | |
| 46 | {
| |
| 47 | sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event countdown is only 30 seconds more, enter fast if you still want to by typing : .pvpevent enter"); | |
| 48 | Events.ScheduleEvent(EVENT_START, 30000); | |
| 49 | ||
| 50 | }break; | |
| 51 | case EVENT_START: | |
| 52 | {
| |
| 53 | sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event has started !"); | |
| 54 | ||
| 55 | // Events.ScheduleEvent(EVENT_END, 60000); | |
| 56 | ||
| 57 | } | |
| 58 | break; | |
| 59 | } | |
| 60 | } | |
| 61 | } | |
| 62 | ||
| 63 | private: | |
| 64 | EventMap Events; | |
| 65 | ||
| 66 | enum eEvents | |
| 67 | {
| |
| 68 | COUNTDOWN_60 , | |
| 69 | COUNTDOWN_30 , | |
| 70 | EVENT_START_60 , | |
| 71 | EVENT_START_30 , | |
| 72 | EVENT_START | |
| 73 | }; | |
| 74 | ||
| 75 | }; | |
| 76 | ||
| 77 | struct Constestor_info | |
| 78 | {
| |
| 79 | const char* Name; | |
| 80 | uint8 Level; | |
| 81 | uint32 Class; | |
| 82 | uint32 Race; | |
| 83 | }; | |
| 84 | ||
| 85 | std::vector<struct Constestor_info> Contestors; | |
| 86 | ||
| 87 | class PvP_Event_Command : public CommandScript | |
| 88 | {
| |
| 89 | public: | |
| 90 | PvP_Event_Command() : CommandScript("PvP_Event_Command") {}
| |
| 91 | ||
| 92 | ChatCommand* GetCommands() const | |
| 93 | {
| |
| 94 | static ChatCommand PVPEventSubCommandTable[] = | |
| 95 | {
| |
| 96 | { "enter", SEC_PLAYER, false, &HandleEnterpvpcommand, "", NULL },
| |
| 97 | { NULL, 0, false, NULL, "", NULL }
| |
| 98 | }; | |
| 99 | ||
| 100 | static ChatCommand CommandTable[] = | |
| 101 | {
| |
| 102 | { "pvpevent", SEC_PLAYER, false, NULL, "", PVPEventSubCommandTable },
| |
| 103 | { NULL, 0, false, NULL, "", NULL }
| |
| 104 | }; | |
| 105 | return CommandTable; | |
| 106 | } | |
| 107 | ||
| 108 | static bool HandleEnterpvpcommand(ChatHandler* handler, const char* args) | |
| 109 | {
| |
| 110 | WorldSession* Session = handler->GetSession(); | |
| 111 | Player* pPlayer = Session->GetPlayer(); | |
| 112 | - | contestors + 1; |
| 112 | + | |
| 113 | Session->SendNotification("There is currently no countdown for this event going on");
| |
| 114 | else if(Contestors.size() < PlayerAmount) | |
| 115 | {
| |
| 116 | Session->SendAreaTriggerMessage("Thank you for entering %s, there is room for %u more players!",pPlayer->GetName(), PlayerAmount-Contestors.size()); // uint - uint may glitch.. test!
| |
| 117 | - | else if(playeroom-- > 0) |
| 117 | + | Constestor_info temp = {pPlayer->GetName(), pPlayer->getLevel(), pPlayer->getClassMask(), pPlayer->getRaceMask()}; // getclass and getrace instead?
|
| 118 | Contestors.push_back(temp); // must use a temp variable, cant just push back an array like {1,2,3,4}
| |
| 119 | - | Session->SendAreaTriggerMessage("Thank you for entering %s, there is room for %u more players!",pPlayer->GetName(), playeroom);
|
| 119 | + | |
| 120 | - | |
| 120 | + | |
| 121 | Session->SendNotification("The maximum player amount for this event is already reached, please try another time");
| |
| 122 | return true; | |
| 123 | } | |
| 124 | }; | |
| 125 | ||
| 126 | void AddSC_PvP_Event() | |
| 127 | {
| |
| 128 | new PvP_Event_Announcer; | |
| 129 | new PvP_Event_Command; | |
| 130 | } |