Thread: MiningEvent

Results 1 to 4 of 4
  1. #1 MiningEvent 
    Banned

    Join Date
    Dec 2008
    Posts
    2,097
    Thanks given
    1,419
    Thanks received
    732
    Rep Power
    0
    Hey, i am wondering if someone could convert this to an event or w.e for graham's event manager

    and im not to sure where to put it at this code was supposed to go into process in the WorldObject class

    Code:
    if (minewait > 0)
    		{
    			minewait--;
    		}
    		
    		if (minetime > 0)
    		{
    			minetime--;
    		}
    		
    		if (ismining && canmine && minewait <= 0 && goodDistance(skillX, skillY, getX(), getY(), 1))
    		{
    			startAnimation(mineanim);
    			minewait = 5;
    		}
    		//3176 3368
    		if (minetime <= 0 && ismining && goodDistance(skillX, skillY, getX(), getY(), 1))
    		{
    			if (goodDistance(skillX, skillY, getX(), getY(), 1))
    			{
    				mn.doaction(this, mn.toadd, -1, -1, skillX, skillY, -1, mn.xp);
    			}
    			else
    			{
    				ismining = false;
    				canmine = false;
    			}
    		}
    Reply With Quote  
     

  2. #2  
    PeeHPee_
    Guest
    i believe there should be a PlayerEventListener and a universal Event object instead of using all this gay shit
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Dec 2008
    Posts
    2,097
    Thanks given
    1,419
    Thanks received
    732
    Rep Power
    0
    Quote Originally Posted by PeeHPee_ View Post
    i believe there should be a PlayerEventListener and a universal Event object instead of using all this gay shit
    i need this gay shit converted to an event for eventmanager but idk how..
    Reply With Quote  
     

  4. #4  
    Registered Member
    PSNB's Avatar
    Join Date
    Aug 2009
    Posts
    885
    Thanks given
    8
    Thanks received
    103
    Rep Power
    590
    Quote Originally Posted by Jimmy View Post
    i need this gay shit converted to an event for eventmanager but idk how..
    There's no reason to do that. Starting a thread to handle mining is a bad idea. What's the reason for it, honestly?

    A server updates every 600 (or 500, depending on what you're using) milliseconds.

    Just do a check in your process.

    Code:
    if(p.isMining()) {
        if(p.getMiningTimer() > 1)
            p.decrementMiningTimer();
        else {
            p.isMining(false);
            p.addItem(id, 1);
            //Replace the object for all players.
        }
    }
    That's really all you need. Using a new thread would cause nothing but concurrency issues.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •