Thread: fishing errors..

Results 1 to 2 of 2
  1. #1 fishing errors.. 
    devildreams54
    Guest
    hey, i added fishing but getting this errors...

    .\Source\world\items\Items.java:279: non-static variable maxListedItems cannot be referenced from a static conte
    xt
    if (itemId == -1 || itemId >= maxListedItems) {
    ^
    .\Source\world\items\Items.java:282: non-static variable itemLists cannot be referenced from a static context
    if (itemLists[itemId] != null) {
    ^
    .\Source\world\items\Items.java:283: non-static variable itemLists cannot be referenced from a static context
    return (itemLists[itemId].itemName);
    ^
    .\Source\Skills\Fishing.java:37: requestAnim(int) in Source.players.Player cannot be applied to (int,int)
    p.requestAnim(getAnimForSpot(spot), 0);
    ^
    .\Source\Skills\Fishing.java:57: requestAnim(int) in Source.players.Player cannot be applied to (int,int)
    p.requestAnim(getAnimForSpot(spot), 0);
    ^
    5 errors
    Press any key to continue . . .
    if u can il rep ++ thanks
    Reply With Quote  
     

  2. #2  
    Registered Member
    Jumper''s Avatar
    Join Date
    Jan 2009
    Posts
    893
    Thanks given
    4
    Thanks received
    6
    Rep Power
    204
    in items.java
    replace
    Code:
    public static String getItemName(int itemId) {
    with
    Code:
    public String getItemName(int itemId) {
    and replace your fishing.java with this:
    Code:
    package Source.Skills;
    
    import Source.players.Player;
    import Source.players.items.PlayerItems;
    import Source.world.items.Items;
    import Source.util.Misc;
    import Source.Engine;
    
    public class Fishing {
    
    	public Player p;
    	PlayerItems pi = new PlayerItems();
    	//This system have been created by Gustavo (Skill S2 Me) from Distant Realm
    	public int anim;
    	public int fishTimer;
    	public boolean fishing = false;
    	public int spot;
    	public int chanceOfCatch;
    	public int rOption;
    	public int fisheditem = -1;
    
    	public Fishing(Player p2){
    		p = p2;
    	}
    	
    	public void startFishing(int npcID, int option) {
    		spot = npcID;
    		rOption = option;
    		if (pi.freeSlotCount(p) > 1){
    			if (getFishingLevel() >= getLevelForFish(getFishForSpot(spot))){
    				if (!hasItem(getNetForSpot(spot))) {
    					p.frames.sendMessage(p, "You don't have "+Engine.items.getItemName(getNetForSpot(spot))+" to fish "+Engine.items.getItemName(getFishForSpot(spot))+".");
    				} else {
    					if (getBaitForSpot(spot) != -1 && !hasItem(getBaitForSpot(spot))){
    						p.frames.sendMessage(p, "You don't have "+Engine.items.getItemName(getBaitForSpot(spot))+" to fish "+Engine.items.getItemName(getFishForSpot(spot))+".");
    					} else {
    						p.frames.sendMessage(p, "You attempt to catch some "+Engine.items.getItemName(getFishForSpot(spot))+".");
    						p.requestAnim(getAnimForSpot(spot));
    						fishing = true;
    						fishTimer = getTimeForFish(getFishForSpot(spot));
    					}
    				}
    			} else {
    				p.frames.sendMessage(p, "You need a Fishing level of " +getLevelForFish(getFishForSpot(spot))+" to fish "+Engine.items.getItemName(getFishForSpot(spot))+".");
    			}
    		} else {
    			p.frames.sendMessage(p, "You don't have enough inventory space to fish.");
    		}
    	}
    	
    	public void process() {
    		if (hasItem(getNetForSpot(spot))){
    			if (fishing) {
    				if (fishTimer == 0) {
    					doFish();
    				}
    				fishTimer--;
    				p.requestAnim(getAnimForSpot(spot));
    			}
    		}
    	}
    	
    	public void resetFishing() {
    		fishTimer = -1;
    		fishing = false;
    	}
    	
    	public void doFish() {
    		PlayerItems pit = new PlayerItems();
    		if (pit.freeSlotCount(p) > 0){
    			p.frames.sendMessage(p, "You fish some "+Engine.items.getItemName(getFishForSpot(spot))+".");
    			if (getBaitForSpot(spot) != -1){
    				deleteItem(getBaitForSpot(spot));
    			}
    			giveItem(fisheditem);
    			giveFishingXP(getXpForFish(fisheditem));
    			fishTimer = getTimeForFish(fisheditem);
    			pit = null;
    		} else {
    			resetFishing();
    			p.frames.sendMessage(p, "You don't have enough inventory space to continue fishing.");
    		}
    	}
    	
    	public int getFishingLevel() {
    		return p.skillLvl[10];
    	}
    	
    	public void giveFishingXP(int xp) {
    		p.addSkillXP(xp, 10);
    	}
    	
    	public boolean hasItem(int id) {
    		PlayerItems pi = new PlayerItems();
    		return pi.invItemCount(p, id) > 0;
    	}
    	
    	public void giveItem(int id) {
    		PlayerItems pi = new PlayerItems();
    		pi.addItem(p, id, 1);
    		pi = null;
    	}
    	
    	public void deleteItem(int id) {
    		PlayerItems pi = new PlayerItems();
    		pi.deleteItem(p, id, 1);
    		pi = null;
    	}
    	
    	public int getNetForSpot(int spot){
    		switch (spot){
    			case 309:
    				switch (rOption){
    					case 1://lure
    						return 309;
    					case 2://bait
    						return 307;
    				}
    			case 312:
    				switch (rOption){
    					case 1://cage
    						return 301;
    					case 2://harpoon
    						return 311;
    				}
    			case 313:
    				switch (rOption){
    					case 1://net
    						return 303;
    					case 2://harpoon
    						return 311;
    				}
    			case 316:
    				switch (rOption){
    					case 1://net
    						return 303;
    					case 2://bait
    						return 307;
    			}
    		}
    		return -1;
    	}
    	
    	public int getBaitForSpot(int spot){
    		switch (spot){
    			case 309:
    				if (rOption == 1){
    					return 314;//feather
    				} if (rOption == 2) {
    					return 313;//fishing bait
    				}
    			case 316:
    				if (rOption == 2){
    					return 313;
    				}
    		}
    		return -1;
    	}
    	
    	public int getFishForSpot(int spot){
    		switch (spot){
    			case 309:
    				switch (rOption){
    					case 1:
    						return getChanceOfCatch(335, 331);//raw trout, raw salmon
    					case 2:
    						fisheditem = 349;
    						return 349;//raw pike
    				}
    			case 312:
    				switch (rOption){
    					case 1:
    						fisheditem = 377;
    						return 377;//raw lobster
    					case 2:
    						return getChanceOfCatch(359, 371);//raw tuna, raw swordfish
    				}
    			case 313:
    				switch (rOption){
    					case 1:
    						fisheditem = 7944;
    						return 7944;//raw monkfish
    					case 2:
    						if (getFishingLevel() < getLevelForFish(383)){
    							fisheditem = 383;
    							return 383;
    						}
    						if (getFishingLevel() >= getLevelForFish(389)){
    							if (hasItem(8269)){
    								fisheditem = 383;
    								return 383;
    							}
    							if (hasItem(424)){
    								fisheditem = 395;
    								return 395;
    							}
    							fisheditem = 389;
    							return 389;
    						}
    						if (getFishingLevel() >= getLevelForFish(395)){
    							if (hasItem(8269)){
    								fisheditem = 383;
    								return 383;
    							}
    							fisheditem = 395;
    							return 395;
    						}
    						if (getFishingLevel() >= getLevelForFish(383)){
    							fisheditem = 383;
    							return 383;
    						}
    				}
    			case 316:
    				switch (rOption){
    					case 1:
    						return getChanceOfCatch(317, 321);//raw shrimps, raw anchovies
    					case 2:
    						return getChanceOfCatch(327, 345);//raw sardine, raw herring
    				}
    		}
    		return -1;
    	}
    	
    	public int getChanceOfCatch(int fish1, int fish2){
    		if ((getFishingLevel() < getLevelForFish(fish1))){
    			fisheditem = fish1;
    			return fish1;
    		}
    		if ((getFishingLevel() >= getLevelForFish(fish1)) && (getFishingLevel() < getLevelForFish(fish2))){
    			fisheditem = fish1;
    			return fish1;
    		}
    		if ((getFishingLevel() >= getLevelForFish(fish1)) && (getFishingLevel() >= getLevelForFish(fish2))){
    			chanceOfCatch = Misc.random(10);
    			if (chanceOfCatch <= 5){
    				fisheditem = fish1;
    				return fish1;
    			} else {
    				fisheditem = fish2;
    				return fish2;
    			}
    		}
    		return -1;
    	}
    	
    	public int getXpForFish(int fish){
    		switch (fish){
    			case 335://raw trout
    				return 500;
    			case 331://raw salmon
    				return 700;
    			case 349://raw pike
    				return 600;
    			case 377://raw lobster
    				return 900;
    			case 359://raw tuna
    				return 800;
    			case 371://raw swordfish
    				return 1000;
    			case 7944://raw monkfish
    				return 1200;
    			case 383://raw shark
    				return 1500;
    			case 389://raw manta ray
    				return 2500;
    			case 395://raw sea turtle
    				return 1750;
    			case 317://raw shrimp
    				return 100;
    			case 321://raw anchovies
    				return 400;
    			case 327://raw sardine
    				return 200;
    			case 345://raw herring
    				return 300;
    		}
    		return 0;
    	}
    	
    	public int getLevelForFish(int fish){
    		switch (fish){
    			case 335://raw trout
    				return 20;
    			case 331://raw salmon
    				return 30;
    			case 349://raw pike
    				return 25;
    			case 377://raw lobster
    				return 40;
    			case 359://raw tuna
    				return 35;
    			case 371://raw swordfish
    				return 50;
    			case 7944://raw monkfish
    				return 62;
    			case 383://raw shark
    				return 76;
    			case 395://raw sea turtle
    				return 79;
    			case 389://raw manta ray
    				return 81;
    			case 317://raw shrimp
    				return 1;
    			case 321://raw anchovies
    				return 15;
    			case 327://raw sardine
    				return 5;
    			case 345://raw herring
    				return 10;
    		}
    		return 1;
    	}
    	
    	public int getAnimForSpot(int spot){
    		switch (spot){
    			case 309:
    				switch (rOption){
    					case 1://lure
    						return 622;
    					case 2://bait
    						return 622;
    				}
    			case 312:
    				switch (rOption){
    					case 1://cage
    						return 619;
    					case 2://harpoon
    						return 618;
    				}
    			case 313:
    				switch (rOption){
    					case 1://net
    						return 620;
    					case 2://harpoon
    						return 618;
    				}
    			case 316:
    				switch (rOption){
    					case 1://net
    						return 620;
    					case 2://bait
    						return 622;
    			}
    		}
    		return -1;
    	}
    	
    	public int getTimeForFish(int fish){
    		if (getFishingLevel() >= (getLevelForFish(getFishForSpot(spot))+20)){
    			return 2;
    		} else {
    			return 22-(getFishingLevel()-getLevelForFish(getFishForSpot(spot)));
    		}
    	}
    
    }
    That should fix all of the errors.

    Quote Originally Posted by runepurex123123 View Post
    don't flame me or I'm gonna rip yo dicks off and shove them up your asses b4 you hit the ground, cause I'm tired of this flaming bitch that is rune-server
    Beware.
    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
  •