Thread: [PI] Improvements - Cleaning/Converting Process to Events.

Page 5 of 6 FirstFirst ... 3456 LastLast
Results 41 to 50 of 57
  1. #41  
    Registered Member
    netzo's Avatar
    Join Date
    Feb 2008
    Age
    28
    Posts
    1,226
    Thanks given
    402
    Thanks received
    135
    Rep Power
    185
    Quote Originally Posted by aoex4 View Post
    Hey man love this work. But however important things;
    That duel thing that handles the FIGHT force chat & being able to attack does not work. It will work for other player but not for you.
    Second, traderesetneeded causes a DUPE.
    Trade someone an item, after the trade is done relog. You will receive the item and he will aswell.
    You should consider fixing these, thanks.
    oops, delete whatever you've added under c.tradeResetNeeded = false; and redo the step #7 will check the duel arena thing later.
    Reply With Quote  
     

  2. #42  
    Why you reading this?

    LoveandPower's Avatar
    Join Date
    Sep 2010
    Posts
    2,156
    Thanks given
    897
    Thanks received
    282
    Rep Power
    365
    Code:
    src\server\model\players\packets\MagicOnFloorItems.java:59: error: local variabl
    e itemX is accessed from within inner class; needs to be declared final
                                                            if(Server.itemHandler.it
    emExists(c.teleGrabItem, c.teleGrabX, c.teleGrabY) && c.goodDistance(c.getX(), c
    .getY(), itemX, itemY, 12)) {
    
    
             ^
    src\server\model\players\packets\MagicOnFloorItems.java:59: error: local variabl
    e itemY is accessed from within inner class; needs to be declared final
                                                            if(Server.itemHandler.it
    emExists(c.teleGrabItem, c.teleGrabX, c.teleGrabY) && c.goodDistance(c.getX(), c
    .getY(), itemX, itemY, 12)) {
    
    
                    ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    2 errors
    Press any key to continue . . .
    My last two errors...no idea why I get these I have added final to the packet as well before Client c

    here is my MagicOnFloorItems packet

    Code:
    package server.model.players.packets;
    
    import server.Server;
    import server.model.players.*;
    import server.event.*;
    import server.model.items.*;
    
    /**
     * Magic on floor items
     **/
    public class MagicOnFloorItems implements PacketType {
    
    	@Override
    	public void processPacket(final Client c, int packetType, int packetSize) {
    		int itemY = c.getInStream().readSignedWordBigEndian();
    		int itemId = c.getInStream().readUnsignedWord();
    		int itemX = c.getInStream().readSignedWordBigEndian();
    		int spellId = c.getInStream().readUnsignedWordA();
    
    		if(!Server.itemHandler.itemExists(itemId, itemX, itemY)) {
    			c.stopMovement();
    			return;
    		}
    		c.usingMagic = true;
    		if(!c.getCombat().checkMagicReqs(51)) {
    			c.stopMovement();
    			return;
    		}
    		
    		/*
    		 * Telegrab spell
    		 */
    		if ((((c.getItems().freeSlots() >= 1) || c.getItems().playerHasItem(itemId, 1)) && Item.itemStackable[itemId]) || ((c.getItems().freeSlots() > 0) && !Item.itemStackable[itemId])) {
    			if(c.goodDistance(c.getX(), c.getY(), itemX, itemY, 12)) {
    				c.walkingToItem = true;
    				int offY = (c.getX() - itemX) * -1;
    				int offX = (c.getY() - itemY) * -1;
    				c.teleGrabX = itemX;
    				c.teleGrabY = itemY;
    				c.teleGrabItem = itemId;
    				c.turnPlayerTo(itemX, itemY);
    				c.teleGrabDelay = System.currentTimeMillis();
    				c.startAnimation(c.MAGIC_SPELLS[51][2]);
    				c.gfx100(c.MAGIC_SPELLS[51][3]);
    				c.getPA().createPlayersStillGfx(144, itemX, itemY, 0, 72);
    				c.getPA().createPlayersProjectile(c.getX(), c.getY(), offX, offY, 50, 70, c.MAGIC_SPELLS[51][4], 50, 10, 0, 50);
    				c.getPA().addSkillXP(c.MAGIC_SPELLS[51][7], 6);
    				c.getPA().refreshSkill(6);
    				c.stopMovement();
    				CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    					@Override
    					public void execute(CycleEventContainer container) {
    						if(!c.walkingToItem)
    							container.stop();
    						if(System.currentTimeMillis() - c.teleGrabDelay > 1550 && c.usingMagic) {
    							if(Server.itemHandler.itemExists(c.teleGrabItem, c.teleGrabX, c.teleGrabY) && c.goodDistance(c.getX(), c.getY(), itemX, itemY, 12)) {
    								Server.itemHandler.removeGroundItem(c, c.teleGrabItem, c.teleGrabX, c.teleGrabY, true);
    								c.usingMagic = false;
    								container.stop();
    							}
    						}
    					}
    					@Override
    					public void stop() {
    						c.walkingToItem = false;
    					}
    				}, 1);
    			}
    		} else {
    			c.sendMessage("You don't have enough space in your inventory.");
    			c.stopMovement();
    		}
    		
    		if(c.goodDistance(c.getX(), c.getY(), itemX, itemY, 12)) {
    			int offY = (c.getX() - itemX) * -1;
    			int offX = (c.getY() - itemY) * -1;
    			c.teleGrabX = itemX;
    			c.teleGrabY = itemY;
    			c.teleGrabItem = itemId;
    			c.turnPlayerTo(itemX, itemY);
    			c.teleGrabDelay = System.currentTimeMillis();
    			c.startAnimation(c.MAGIC_SPELLS[51][2]);
    			c.gfx100(c.MAGIC_SPELLS[51][3]);
    			c.getPA().createPlayersStillGfx(144, itemX, itemY, 0, 72);
    			c.getPA().createPlayersProjectile(c.getX(), c.getY(), offX, offY, 50, 70, c.MAGIC_SPELLS[51][4], 50, 10, 0, 50);
    			c.getPA().addSkillXP(c.MAGIC_SPELLS[51][7], 6);
    			c.getPA().refreshSkill(6);
    			c.stopMovement();
    		}
    	}
    
    }
    Spoiler for sig too large:


    Reply With Quote  
     

  3. #43  
    Registered Member
    netzo's Avatar
    Join Date
    Feb 2008
    Age
    28
    Posts
    1,226
    Thanks given
    402
    Thanks received
    135
    Rep Power
    185
    Quote Originally Posted by Loveandpower View Post
    Code:
    src\server\model\players\packets\MagicOnFloorItems.java:59: error: local variabl
    e itemX is accessed from within inner class; needs to be declared final
                                                            if(Server.itemHandler.it
    emExists(c.teleGrabItem, c.teleGrabX, c.teleGrabY) && c.goodDistance(c.getX(), c
    .getY(), itemX, itemY, 12)) {
    
    
             ^
    src\server\model\players\packets\MagicOnFloorItems.java:59: error: local variabl
    e itemY is accessed from within inner class; needs to be declared final
                                                            if(Server.itemHandler.it
    emExists(c.teleGrabItem, c.teleGrabX, c.teleGrabY) && c.goodDistance(c.getX(), c
    .getY(), itemX, itemY, 12)) {
    
    
                    ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    2 errors
    Press any key to continue . . .
    My last two errors...no idea why I get these I have added final to the packet as well before Client c

    here is my MagicOnFloorItems packet

    Code:
    package server.model.players.packets;
    
    import server.Server;
    import server.model.players.*;
    import server.event.*;
    import server.model.items.*;
    
    /**
     * Magic on floor items
     **/
    public class MagicOnFloorItems implements PacketType {
    
    	@Override
    	public void processPacket(final Client c, int packetType, int packetSize) {
    		int itemY = c.getInStream().readSignedWordBigEndian();
    		int itemId = c.getInStream().readUnsignedWord();
    		int itemX = c.getInStream().readSignedWordBigEndian();
    		int spellId = c.getInStream().readUnsignedWordA();
    
    		if(!Server.itemHandler.itemExists(itemId, itemX, itemY)) {
    			c.stopMovement();
    			return;
    		}
    		c.usingMagic = true;
    		if(!c.getCombat().checkMagicReqs(51)) {
    			c.stopMovement();
    			return;
    		}
    		
    		/*
    		 * Telegrab spell
    		 */
    		if ((((c.getItems().freeSlots() >= 1) || c.getItems().playerHasItem(itemId, 1)) && Item.itemStackable[itemId]) || ((c.getItems().freeSlots() > 0) && !Item.itemStackable[itemId])) {
    			if(c.goodDistance(c.getX(), c.getY(), itemX, itemY, 12)) {
    				c.walkingToItem = true;
    				int offY = (c.getX() - itemX) * -1;
    				int offX = (c.getY() - itemY) * -1;
    				c.teleGrabX = itemX;
    				c.teleGrabY = itemY;
    				c.teleGrabItem = itemId;
    				c.turnPlayerTo(itemX, itemY);
    				c.teleGrabDelay = System.currentTimeMillis();
    				c.startAnimation(c.MAGIC_SPELLS[51][2]);
    				c.gfx100(c.MAGIC_SPELLS[51][3]);
    				c.getPA().createPlayersStillGfx(144, itemX, itemY, 0, 72);
    				c.getPA().createPlayersProjectile(c.getX(), c.getY(), offX, offY, 50, 70, c.MAGIC_SPELLS[51][4], 50, 10, 0, 50);
    				c.getPA().addSkillXP(c.MAGIC_SPELLS[51][7], 6);
    				c.getPA().refreshSkill(6);
    				c.stopMovement();
    				CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    					@Override
    					public void execute(CycleEventContainer container) {
    						if(!c.walkingToItem)
    							container.stop();
    						if(System.currentTimeMillis() - c.teleGrabDelay > 1550 && c.usingMagic) {
    							if(Server.itemHandler.itemExists(c.teleGrabItem, c.teleGrabX, c.teleGrabY) && c.goodDistance(c.getX(), c.getY(), itemX, itemY, 12)) {
    								Server.itemHandler.removeGroundItem(c, c.teleGrabItem, c.teleGrabX, c.teleGrabY, true);
    								c.usingMagic = false;
    								container.stop();
    							}
    						}
    					}
    					@Override
    					public void stop() {
    						c.walkingToItem = false;
    					}
    				}, 1);
    			}
    		} else {
    			c.sendMessage("You don't have enough space in your inventory.");
    			c.stopMovement();
    		}
    		
    		if(c.goodDistance(c.getX(), c.getY(), itemX, itemY, 12)) {
    			int offY = (c.getX() - itemX) * -1;
    			int offX = (c.getY() - itemY) * -1;
    			c.teleGrabX = itemX;
    			c.teleGrabY = itemY;
    			c.teleGrabItem = itemId;
    			c.turnPlayerTo(itemX, itemY);
    			c.teleGrabDelay = System.currentTimeMillis();
    			c.startAnimation(c.MAGIC_SPELLS[51][2]);
    			c.gfx100(c.MAGIC_SPELLS[51][3]);
    			c.getPA().createPlayersStillGfx(144, itemX, itemY, 0, 72);
    			c.getPA().createPlayersProjectile(c.getX(), c.getY(), offX, offY, 50, 70, c.MAGIC_SPELLS[51][4], 50, 10, 0, 50);
    			c.getPA().addSkillXP(c.MAGIC_SPELLS[51][7], 6);
    			c.getPA().refreshSkill(6);
    			c.stopMovement();
    		}
    	}
    
    }
    Code:
    		final int itemY = c.getInStream().readSignedWordBigEndian();
    		
    		final int itemX = c.getInStream().readSignedWordBigEndian();
    Reply With Quote  
     

  4. Thankful user:


  5. #44  
    Why you reading this?

    LoveandPower's Avatar
    Join Date
    Sep 2010
    Posts
    2,156
    Thanks given
    897
    Thanks received
    282
    Rep Power
    365
    wow I feel slow now xD

    thanks for the fix
    Spoiler for sig too large:


    Reply With Quote  
     

  6. #45  
    Registered Member
    netzo's Avatar
    Join Date
    Feb 2008
    Age
    28
    Posts
    1,226
    Thanks given
    402
    Thanks received
    135
    Rep Power
    185
    You're welcome
    Reply With Quote  
     

  7. #46  
    Registered Member
    Tamatea's Avatar
    Join Date
    Aug 2010
    Posts
    1,282
    Thanks given
    379
    Thanks received
    334
    Rep Power
    2318
    If your going to do this you should just add the hyperion core, and the World class for controlling it along with the game engine and run the process() methods with events like jinsanity and my server does. I can notice results from it.

    [Only registered and activated users can see links. ]



    Reply With Quote  
     

  8. #47  
    Registered Member
    netzo's Avatar
    Join Date
    Feb 2008
    Age
    28
    Posts
    1,226
    Thanks given
    402
    Thanks received
    135
    Rep Power
    185
    Quote Originally Posted by squxx View Post
    If your going to do this you should just add the hyperion core, and the World class for controlling it along with the game engine and run the process() methods with events like jinsanity and my server does. I can notice results from it.
    I'm using hyperion core, cleaning process() with TickManager, if needed, using EventManager
    Reply With Quote  
     

  9. #48  
    Proud Owner of Pbscape

    Pblord7's Avatar
    Join Date
    Jun 2010
    Posts
    1,315
    Thanks given
    2
    Thanks received
    211
    Rep Power
    527
    kewl d00d


    Goodjob

    [Only registered and activated users can see links. ]

    Quote Originally Posted by Vault View Post
    Smilies are essential to a server's success.
    Reply With Quote  
     

  10. #49  
    Banned
    Join Date
    Jan 2012
    Age
    24
    Posts
    552
    Thanks given
    53
    Thanks received
    37
    Rep Power
    0
    thanks this is good
    Reply With Quote  
     

  11. #50  
    Registered Member
    Join Date
    Mar 2012
    Posts
    186
    Thanks given
    16
    Thanks received
    10
    Rep Power
    25
    bump
    Reply With Quote  
     

Page 5 of 6 FirstFirst ... 3456 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. rsps improvements
    By katastrophic in forum RS2 Server
    Replies: 80
    Last Post: 12-16-2011, 03:36 AM
  2. Improvements?
    By Kastro in forum Help
    Replies: 4
    Last Post: 12-16-2009, 01:21 AM
  3. Converting Process() To Events
    By Enjoi in forum Tutorials
    Replies: 35
    Last Post: 07-13-2009, 01:33 AM
  4. Turning my process into Events.
    By myK- in forum Help
    Replies: 5
    Last Post: 07-09-2009, 02:17 AM
  5. Replies: 7
    Last Post: 05-05-2009, 11:01 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •