Thread: Method supporting code

Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1 Method supporting code 
    If you read this you're gay!
    Infexis's Avatar
    Join Date
    Aug 2009
    Age
    28
    Posts
    4,557
    Thanks given
    1,158
    Thanks received
    1,174
    Rep Power
    2949
    Base: Project Insanity.

    Problem: I need my method support the code bellow.

    Errors(Compiling Errors): No errors.

    Other Information/Media(Pictures, etc): I need my method to support my code bellow becuase it doesn't do that at the moment. At the moment it does support cases.

    My method which needs to support the code bellow:
    Code:
    	public static void ItemonObject(Client c, int objectID, int objectX, int objectY, int itemId) {
    		if (!c.getItems().playerHasItem(itemId, 1))
    			return;
    		switch(objectID) {
    
    		case ####:
    		
    		break;
    
    		default:
    			if(c.playerRights == 3)
    				Misc.println("Player At Object id: "+objectID+" with Item id: "+itemId);
    			break;
    		}
    		
    	}
    Code which needs to be supported in the method:
    Code:
    		if (c.objectId == 12102 || c.objectId == 12269 || c.objectId == 8712 || c.objectId == 9085 || c.objectId == 9086 || c.objectId == 9087 || c.objectId == 2728 || c.objectId == 2729 || c.objectId == 2730 || c.objectId == 2731 || c.objectId == 2859 || c.objectId == 3039 || c.objectId == 5275 || c.objectId == 114 || c.objectId == 8750) {
    	if((itemId == 2132 || itemId == 2134 || itemId == 2136 || itemId == 2138 || itemId == 317 || itemId == 383 || itemId == 321 || itemId == 2307|| itemId == 327 || itemId == 345 || itemId == 335 || itemId == 349 || itemId == 331 || itemId == 359 || itemId == 377 || itemId == 389 || itemId == 371 || itemId == 7944)){
    		if(c.goodDistance(c.usedOnobjectX, c.usedOnobjectY, c.getX(), c.getY(), 1)) {
    		c.CookFishName = Server.getItemManager().getItemDefinition(itemId).getName();
    		c.CookingEmote = 883;
    		c.getPA().openCookDialogue(itemId);
    		}	
    	}
    }
    if (c.objectId == 2732 || c.objectId == 3038 || c.objectId == 3769 || c.objectId == 3775 || c.objectId == 4265 || c.objectId == 4266 || c.objectId == 5499 || c.objectId == 5249 || c.objectId == 5631 || c.objectId == 5632 || c.objectId == 5981) {
    	if((itemId == 383 || itemId == 2132 || itemId == 2134 || itemId == 2136 || itemId == 2138 || itemId == 317 || itemId == 321 || itemId == 2307|| itemId == 327 || itemId == 345 || itemId == 335|| itemId == 349 || itemId == 331 || itemId == 359 || itemId == 377 || itemId == 389 || itemId == 371 || itemId == 7944)){
    		if(c.goodDistance(c.usedOnobjectX, c.usedOnobjectY, c.getX(), c.getY(), 1)) {
    		c.CookFishName = Server.getItemManager().getItemDefinition(itemId).getName();
    		c.CookingEmote = 897;
    		c.getPA().openCookDialogue(itemId);
    		}
    	}
    }

    "If you can't explain it simply, you don't understand it well enough." - Albert Einstein
    Reply With Quote  
     

  2. #2  
    Member Method supporting code Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    what..?

    Attached imageAttached image
    Reply With Quote  
     

  3. #3  
    If you read this you're gay!
    Infexis's Avatar
    Join Date
    Aug 2009
    Age
    28
    Posts
    4,557
    Thanks given
    1,158
    Thanks received
    1,174
    Rep Power
    2949
    Quote Originally Posted by Luke132 View Post
    what..?
    I need the second code be supported in the method. Currently the method only supports cases.

    "If you can't explain it simply, you don't understand it well enough." - Albert Einstein
    Reply With Quote  
     

  4. #4  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Think he means he wants it in cases...

    Code:
    		case 12102:
    		case 12269:
    		case 8712:
    		case 9085:
    		case 9086:
    		case 9087:
    		case 2728:
    		case 2729:
    		case 2730:
    		case 2731:
    		case 2859:
    		case 3039:
    		case 5275:
    		case 114:
    		case 8750:
    			if ((itemId == 2132 || itemId == 2134 || itemId == 2136
    					|| itemId == 2138 || itemId == 317 || itemId == 383
    					|| itemId == 321 || itemId == 2307 || itemId == 327
    					|| itemId == 345 || itemId == 335 || itemId == 349
    					|| itemId == 331 || itemId == 359 || itemId == 377
    					|| itemId == 389 || itemId == 371 || itemId == 7944)) {
    				if (c.goodDistance(c.usedOnobjectX, c.usedOnobjectY, c.getX(),
    						c.getY(), 1)) {
    					// c.CookFishName =
    					// Server.getItemManager().getItemDefinition(itemId).getName();
    					// c.CookingEmote = 883;
    					// c.getPA().openCookDialogue(itemId);
    				}
    			}
    			break;
    Rubbish way to do it though...
    Reply With Quote  
     

  5. #5  
    If you read this you're gay!
    Infexis's Avatar
    Join Date
    Aug 2009
    Age
    28
    Posts
    4,557
    Thanks given
    1,158
    Thanks received
    1,174
    Rep Power
    2949
    Quote Originally Posted by Pixelthis View Post
    Think he means he wants it in cases...

    Code:
    		case 12102:
    		case 12269:
    		case 8712:
    		case 9085:
    		case 9086:
    		case 9087:
    		case 2728:
    		case 2729:
    		case 2730:
    		case 2731:
    		case 2859:
    		case 3039:
    		case 5275:
    		case 114:
    		case 8750:
    			if ((itemId == 2132 || itemId == 2134 || itemId == 2136
    					|| itemId == 2138 || itemId == 317 || itemId == 383
    					|| itemId == 321 || itemId == 2307 || itemId == 327
    					|| itemId == 345 || itemId == 335 || itemId == 349
    					|| itemId == 331 || itemId == 359 || itemId == 377
    					|| itemId == 389 || itemId == 371 || itemId == 7944)) {
    				if (c.goodDistance(c.usedOnobjectX, c.usedOnobjectY, c.getX(),
    						c.getY(), 1)) {
    					// c.CookFishName =
    					// Server.getItemManager().getItemDefinition(itemId).getName();
    					// c.CookingEmote = 883;
    					// c.getPA().openCookDialogue(itemId);
    				}
    			}
    			break;
    Rubbish way to do it though...
    I don't want it in cases and it doesn't work if you do it that way I've tryed. I want the "public static void ItemonObject" support the clicking code without making it into cases.

    "If you can't explain it simply, you don't understand it well enough." - Albert Einstein
    Reply With Quote  
     

  6. #6  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Code:
    	private static final int[] COOKING_OBJECT_IDS = { 12102, 12269, 8712, 9085,
    			9086, 9087, 2728, 2729, 2730, 2731, 2859, 3039, 275, 114, 8750 };
    	private static final int[] COOKING_ITEM_IDS = { 2132, 2134, 2136, 2138,
    			217, 283, 231, 2307, 327, 345, 335, 349, 331, 359, 377, 389, 371,
    			7944 };
    
    	public static void ItemonObject(Client c, int objectID, int objectX,
    			int objectY, int itemId) {
    		if (!c.getItems().playerHasItem(itemId, 1))
    			return;
    		for (int a : COOKING_OBJECT_IDS) {
    			if (objectID == a) {
    				for (int b : COOKING_ITEM_IDS) {
    					if (itemId == b) {
    						if (c.goodDistance(c.usedOnobjectX, c.usedOnobjectY, c.getX(), c.getY(), 1)) {
    							c.CookFishName =
    							Server.getItemManager().getItemDefinition(itemId).getName();
    							c.CookingEmote = 883;
    							c.getPA().openCookDialogue(itemId);
    						}
    						break;
    					}
    				}
    				break;
    			}
    		}
    		switch (objectID) {
    		
    		default:
    			if (c.playerRights == 3)
    				Misc.println("Player At Object id: " + objectID
    						+ " with Item id: " + itemId);
    			break;
    		}
    	}
    Only did

    Code:
    		if (c.objectId == 12102 || c.objectId == 12269 || c.objectId == 8712 || c.objectId == 9085 || c.objectId == 9086 || c.objectId == 9087 || c.objectId == 2728 || c.objectId == 2729 || c.objectId == 2730 || c.objectId == 2731 || c.objectId == 2859 || c.objectId == 3039 || c.objectId == 5275 || c.objectId == 114 || c.objectId == 8750) {
    	if((itemId == 2132 || itemId == 2134 || itemId == 2136 || itemId == 2138 || itemId == 317 || itemId == 383 || itemId == 321 || itemId == 2307|| itemId == 327 || itemId == 345 || itemId == 335 || itemId == 349 || itemId == 331 || itemId == 359 || itemId == 377 || itemId == 389 || itemId == 371 || itemId == 7944)){
    		if(c.goodDistance(c.usedOnobjectX, c.usedOnobjectY, c.getX(), c.getY(), 1)) {
    		c.CookFishName = Server.getItemManager().getItemDefinition(itemId).getName();
    		c.CookingEmote = 883;
    		c.getPA().openCookDialogue(itemId);
    		}	
    	}
    }
    Not the last last one, you can do that one yourself.
    Reply With Quote  
     

  7. #7  
    If you read this you're gay!
    Infexis's Avatar
    Join Date
    Aug 2009
    Age
    28
    Posts
    4,557
    Thanks given
    1,158
    Thanks received
    1,174
    Rep Power
    2949
    Quote Originally Posted by Pixelthis View Post
    Code:
    	private static final int[] COOKING_OBJECT_IDS = { 12102, 12269, 8712, 9085,
    			9086, 9087, 2728, 2729, 2730, 2731, 2859, 3039, 275, 114, 8750 };
    	private static final int[] COOKING_ITEM_IDS = { 2132, 2134, 2136, 2138,
    			217, 283, 231, 2307, 327, 345, 335, 349, 331, 359, 377, 389, 371,
    			7944 };
    
    	public static void ItemonObject(Client c, int objectID, int objectX,
    			int objectY, int itemId) {
    		if (!c.getItems().playerHasItem(itemId, 1))
    			return;
    		for (int a : COOKING_OBJECT_IDS) {
    			if (objectID == a) {
    				for (int b : COOKING_ITEM_IDS) {
    					if (itemId == b) {
    						if (c.goodDistance(c.usedOnobjectX, c.usedOnobjectY, c.getX(), c.getY(), 1)) {
    							c.CookFishName =
    							Server.getItemManager().getItemDefinition(itemId).getName();
    							c.CookingEmote = 883;
    							c.getPA().openCookDialogue(itemId);
    						}
    						break;
    					}
    				}
    				break;
    			}
    		}
    		switch (objectID) {
    		
    		default:
    			if (c.playerRights == 3)
    				Misc.println("Player At Object id: " + objectID
    						+ " with Item id: " + itemId);
    			break;
    		}
    	}
    Only did

    Code:
    		if (c.objectId == 12102 || c.objectId == 12269 || c.objectId == 8712 || c.objectId == 9085 || c.objectId == 9086 || c.objectId == 9087 || c.objectId == 2728 || c.objectId == 2729 || c.objectId == 2730 || c.objectId == 2731 || c.objectId == 2859 || c.objectId == 3039 || c.objectId == 5275 || c.objectId == 114 || c.objectId == 8750) {
    	if((itemId == 2132 || itemId == 2134 || itemId == 2136 || itemId == 2138 || itemId == 317 || itemId == 383 || itemId == 321 || itemId == 2307|| itemId == 327 || itemId == 345 || itemId == 335 || itemId == 349 || itemId == 331 || itemId == 359 || itemId == 377 || itemId == 389 || itemId == 371 || itemId == 7944)){
    		if(c.goodDistance(c.usedOnobjectX, c.usedOnobjectY, c.getX(), c.getY(), 1)) {
    		c.CookFishName = Server.getItemManager().getItemDefinition(itemId).getName();
    		c.CookingEmote = 883;
    		c.getPA().openCookDialogue(itemId);
    		}	
    	}
    }
    Not the last last one, you can do that one yourself.
    The clicking doesn't work.. :/

    "If you can't explain it simply, you don't understand it well enough." - Albert Einstein
    Reply With Quote  
     

  8. #8  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Quote Originally Posted by Infexis View Post
    The clicking doesn't work.. :/
    Code:
    		for (int a : COOKING_OBJECT_IDS) {
    			if (objectID == a) {
                                    c.sendMessage("IM CLICKING A COOKING OBJECT!");
    				for (int b : COOKING_ITEM_IDS) {
    					if (itemId == b) {
                                                    c.sendMessage("IM CLICKING A COOKING ITEM AND OBJECT");
    						if (c.goodDistance(c.usedOnobjectX, c.usedOnobjectY, c.getX(), c.getY(), 1)) {
                                                           c.sendMessage("IM DOING WHAT EVER THE FUCK I SHOULD BE DOING WITH THIS COOKING STUFF!");
    							c.CookFishName =
    							Server.getItemManager().getItemDefinition(itemId).getName();
    							c.CookingEmote = 883;
    							c.getPA().openCookDialogue(itemId);
    						}
    						break;
    					}
    				}
    				break;
    			}
    		}
    Reply With Quote  
     

  9. #9  
    Registered Member Richie's Avatar
    Join Date
    Sep 2009
    Age
    28
    Posts
    791
    Thanks given
    81
    Thanks received
    18
    Rep Power
    6
    Quote Originally Posted by Infexis View Post
    The clicking doesn't work.. :/
    Use your method infexis then change 'objectId' to 'objectID' for clicking.
    Reply With Quote  
     

  10. #10  
    If you read this you're gay!
    Infexis's Avatar
    Join Date
    Aug 2009
    Age
    28
    Posts
    4,557
    Thanks given
    1,158
    Thanks received
    1,174
    Rep Power
    2949
    It's still not working or appearing the sendMessage :/

    "If you can't explain it simply, you don't understand it well enough." - Albert Einstein
    Reply With Quote  
     

Page 1 of 3 123 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. method 257 Code too large?
    By Bliss-Scape in forum Help
    Replies: 5
    Last Post: 06-08-2010, 04:29 AM
  2. method code
    By mige5 in forum Help
    Replies: 0
    Last Post: 01-06-2010, 05:50 PM
  3. Replies: 5
    Last Post: 11-25-2009, 06:19 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
  •