[C++] Mangos / TC2 Timed Event System menu

User Tag List

Results 1 to 7 of 7
  1. #1
    Pwntzyou's Avatar Contributor
    Reputation
    264
    Join Date
    Dec 2007
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] Mangos / TC2 Timed Event System

    Timed Event System
    By: Pwntzyou



    Intro:
    Since I have switched from ascent based emulators to Mangos based ones, the only thing I found missing was a timed event system, that being said... I waved my magical wand around and created one.

    This C++ addon can be used for -anything- that uses C++... not just Mangos and TC2.


    It consists of two files

    (Both need to be added to the project before a compile)
    *THERE IS NO NEED TO TOUCH ANYTHING IN EITHER OF THE TWO FILES*

    TimedEvent.cpp
    TimedEvent.h


    Getting it working:
    1. The script using the timed events MUST have a #include TimedEvent.h at the top

    2. There are two methods for adding timed methods, one for a function belonging to a class, the other for a function not belonging to a class.


    EX:


    Code:
     
    //Format for function without a class
    ...(&function, "name", (void*)data, time in ms, repeats [0 for infinite]);
    
    
    //Format for function with a class  
    ...(&SC, &SomeClass::Function, "name", (void*)data, time in ms, repeats [0 for  infinite]);
    
    
    //Function without a class that will call the function HelloWorld(void* data) once after two seconds  
    _TimedEvent* te = new _TimedEvent;
    te->newTimedEvent(&HelloWorld, "Hello World", (void*)0, 2000, 1);
    
    
    //Function with a class that will call the function SomeClass::HelloWorld(void* data) twice with a five second interval  
    SomeClass SC;
    TimedEvent<SomeClass>* te = new TimedEvent<SomeClass>;
    te->newTimedEvent(&SC, &SomeClass::HelloWorld, "HW_Class", (void*)0, 5000, 2);
    
    Things to notice:

    -All functions you want timed events to trigger need the parameters (void* data) and only that.


    All of you C++ noobies out there don't start crying, you can still pass all of the data you want through the function!


    Code:
     
    //This will pass the number 1337 to function someInt(void* data)
    
    void someInt(void* data) 
    {
          int aNumber = (int)data;
          //Do whatever you want to do past here... aNumber is = to 1337 in this example
    }
    
    _TimedEvent* te = new _TimedEvent; 
    te->newTimedEvent(&someInt, "C++ Noobs", (void*)1337, 2000, 1);
    
    As you can see we passed (void*)1337 as our parameter in our timed event, whenever you pass data through a timed event it is crucial to have (void*) in front of it.

    In the function we accessed you will also notice we had (int) in front of "data" this changes data from void* to an int. This method can be used for any type of variable.


    Now I know you C++ noobs are still freaking out because you want to pass multiple parameters through, we can use something called a struct.


    Code:
     
    struct myData
    {
          int aNumber;
          string aString;
    };
    
    void anotherExample(void* data) 
    {
        myData* mData = (myData*)data
        //Do what ever you want after this
    }
    
    
    myData * mData = new myData;  
    mData->aNumber = 1337;
    mData->aString = "Pwntzyou Owns";
    
    _TimedEvent* te = new _TimedEvent; 
     te->newTimedEvent(&anotherExample, "C++ Noobs", (void*)mData, 2000, 1);
    
    Hopefully that should clear up some of the questions but feel free to ask me more.

    Last but not least we have the delete a timed event function... oh how I love this one


    Code:
     
    //Put the name of the timed event in there, and it will stop running!
    RemoveTimedEvent("NAME");
    


    Download:

    Download (Password: pwntzyou)
    Filebeam - Beam up that File Scottie!


    Enjoy^^

    <3 MysterioussouL for the sig

    [C++] Mangos / TC2 Timed Event System
  2. #2
    RyeRye's Avatar Contributor
    Reputation
    240
    Join Date
    Aug 2008
    Posts
    996
    Thanks G/R
    0/1
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice Pwntz, why'd you switch to Mangos? hah



  3. #3
    Pwntzyou's Avatar Contributor
    Reputation
    264
    Join Date
    Dec 2007
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because everything else is crap

    <3 MysterioussouL for the sig

  4. #4
    vaniva's Avatar Corporal
    Reputation
    1
    Join Date
    Apr 2010
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank alot mangos!

  5. #5
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This can come in handy to Mangos / TC2 C++ script developers.
    Why do I need a signature?

  6. #6
    kjankoski's Avatar Active Member
    Reputation
    30
    Join Date
    May 2009
    Posts
    110
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very nice. Thanks.

  7. #7
    lorac's Avatar Active Member
    Reputation
    69
    Join Date
    Oct 2008
    Posts
    387
    Thanks G/R
    3/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I beg to differ
    Trinity makes makes mangos look um ....how do i put it nicely
    Trinity is superior to Mangos
    Vehicles work charmed works spells for the most part work
    only thing that trinity is lacking is full DB support from out side projects

Similar Threads

  1. [Lua] Event System
    By Dr. Livingstone in forum WoW EMU General Releases
    Replies: 5
    Last Post: 03-26-2010, 02:20 PM
  2. [Mangos/TC2] Block addons - PunisTool
    By Marikafka in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 03-18-2010, 10:29 AM
  3. How to loot items infinite times. Mangos/Tc2
    By Darknz in forum WoW EMU Exploits & Bugs
    Replies: 9
    Last Post: 02-09-2010, 01:59 PM
  4. [Release] GM Event System
    By CoolManBob in forum WoW EMU General Releases
    Replies: 38
    Last Post: 06-02-2009, 11:37 PM
  5. [Hunter] ZA - Easier Eagle Timed Event
    By Gihelle in forum World of Warcraft Exploits
    Replies: 12
    Last Post: 04-24-2008, 11:02 AM
All times are GMT -5. The time now is 02:39 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search