Thread: Added Mining, 4 Errors.

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32
  1. #1 Added Mining, 4 Errors. 
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    3,143
    Thanks given
    27
    Thanks received
    92
    Rep Power
    0
    Code:
    Compiling all files....
    .\palidino76\rs2\players\Player.java:22: package palidino76.rs2.Content.skills d
    oes not exist
    import palidino76.rs2.Content.skills.Mining;
                                        ^
    .\palidino76\rs2\players\Player.java:343: cannot find symbol
    symbol  : class Mining
    location: class palidino76.rs2.players.Player
        public Mining mining = new Mining(this);
               ^
    .\palidino76\rs2\players\Player.java:344: cannot find symbol
    symbol  : class Mining
    location: class palidino76.rs2.players.Player
        public Mining getMining() {
               ^
    .\palidino76\rs2\players\Player.java:343: cannot find symbol
    symbol  : class Mining
    location: class palidino76.rs2.players.Player
        public Mining mining = new Mining(this);
                                   ^
    Note: .\palidino76\rs2\clanchat\Room.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    4 errors
    Press any key to continue . . .
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    3,143
    Thanks given
    27
    Thanks received
    92
    Rep Power
    0
    Bump, help please
    Reply With Quote  
     

  3. #3  
    Certified Stoner

    demon dylan001's Avatar
    Join Date
    Feb 2009
    Age
    25
    Posts
    1,127
    Thanks given
    77
    Thanks received
    94
    Discord
    View profile
    Rep Power
    509
    hey dude post ur mining file here il look at it
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    3,143
    Thanks given
    27
    Thanks received
    92
    Rep Power
    0
    Code:
    package palidino76.rs2.content.skills;
    
    import palidino76.rs2.util.Misc;
    import palidino76.rs2.players.Player;
    import palidino76.rs2.Engine;
    import palidino76.rs2.players.items.PlayerItems;
    
    public class Mining {
    
        Player p;
    
        /**
         * Class constructor.
         * @param player the player which the constructor should be made for.
         */
    
        public Mining(Player p) {
            this.p = p;
        }
    
        /**
         * Mining system.
          */
    
        public void createMiningEvent() {
            if (p == null) {
                resetMiningEvent();
                return;
            }
            if (getPick() == -1) {
                p.frames.sendMessage(p, "You don't have a pickaxe");
                return;
            }
            if (getlevelpick(getPick()) < p.getLevelForXP(14) == false) {
                p.frames.sendMessage(p, "You need a level of " + getlevelpick(getPick()) + " to use the pickaxe");
                resetMiningEvent();
                return;
            }
            if (getLevelForOre() < p.getLevelForXP(14) == false) {
                p.frames.sendMessage(p, "You need a level of " + getLevelForOre() + " to mine this");
                resetMiningEvent();
                return;
            }
            p.requestAnim(getAnimation(), 0);
            setOreDelay(selectRandomDelay());
            p.frames.sendMessage(p, "You swing your pick at the rock..");
        }
    
        /**
         * If player's ore delay reached zero, The player receives an ore and anim resets. Mining resets to.
         */
    
        public void receiveOre() {
            if (p == null || !playerIsMining()) {
                resetMiningEvent();
                return;
            }
            if (getOreDelay() == 0) {
                p.requestAnim(-1, 0);
                Engine.playerItems.addItem(p, getOreType(), 1);
                p.addSkillXP(getXP(), 14);
                p.frames.sendMessage(p, "You succes fully mined an " + Engine.items.getItemName(getOreType()));
                resetMiningEvent();
            }
        }
    
        /**
         * Get the requested animation for the pickaxe.
         * @return the pickaxe's animation id.
         */
    
            public boolean hasItem(int id) {
            PlayerItems pi = new PlayerItems();
            return pi.invItemCount(p, id) > 0;
            }
    
            int getPick() {
            if (hasItem(1265)) return 1265;
            if (hasItem(1275)) return 1275;
            if (p.equipment[3] == 1265) return 1265;
            if (p.equipment[3] == 1275) return 1275;
            return -1;
            }
    
        int getAnimation() {
            switch (getPick()) {
    
                case 1265: //Bronze Pickaxe
                    return 625;
                case 1275: // Rune Pickaxe
                    return 624;
                default:
                    return -1;
            }
        }
    
        /**
         * Return the rock type.
         * @return the rock type to receive the correct ore.
         */
    
            int getOreType() {
            switch (p.oreType) {
    
                            case 1: //Tin
                    return 438;
                            case 2: //Copper
                    return 436;
                case 3: //Iron
                                    return 440;
                            case 4: //Silver
                    return 442;
                case 5: //Coal
                        return 453;
                            case 6: //Gold
                    return 444;
                            case 7: //Mithrill
                    return 447;
                            case 8: //Adamantite
                                    return 449;
                            case 9: //Runite
                                    return 451;
                default:
                    return -1;
            }
        }
    
        /**
         * Return the Xp gained of rock type.
         * @return the right amount of XP.
         */
    
        int getXP() {
            switch(p.oreType) {
        
                case 1: //Tin
                    return 300;
                case 2: //Copper
                    return 500;
                case 3: //Iron
                    return 750;
                case 4: //Silver
                    return 1150;
                case 5: //Coal
                    return 2100;
                case 6: //Gold
                    return 4350;
                case 7: //Mithrill
                    return 6550;
                case 8: //Adamantite
                    return 7750;
                case 9: //Runite
                    return 8900;
                default:
                    return -1;
            }
        }
    
        /**
         * Return the level required to mine.
         * @return the right level.
         */
    
        int getLevelForOre() {
    
            switch(p.oreType) {
    
                case 1: //Tin
                    return 1;
                case 2: //Copper
                    return 1;
                case 3: //Iron
                    return 15;
                case 4: //Silver
                    return 20;
                case 5: //Coal
                    return 30;
                case 6: //Gold
                    return 40;
                case 7: //Mithrill
                    return 55;
                case 8: //Adamantite
                    return 70;
                case 9: //Runite
                    return 85;
                default:
                    return -1;
            }
        }
    
        /**
         * Return the level required to use the pickaxe with.
         * @return the right level.
         */
    
        int getlevelpick(int pick) {
            switch (pick) {
    
                case 1265:
                    return 1;
                case 1275:
                    return 41;
            }
            return -1;
        }
    
        /**
         * Get the player's ore delay.
         * @return the ore delay.
         */
    
         int getOreDelay() {
            return p.oreDelay;
        }
    
    
        /**
         * If player is mining an rock.
         * @return if player is mining.
         */
    
        boolean playerIsMining() {
            return p.isMining;
        }
    
        /**
         * Select a random delay
         * @return the delay thats going to be setted for the ore delay.
         */
    
        int selectRandomDelay() {
            int highestDelay = 14, lowestDelay = 6;
            int delay = Misc.random(14);
            int mining = p.skillLvl[14];
            if (mining >= delay && delay <= highestDelay && delay >= lowestDelay)
                return delay;
            else
                return delay - lowestDelay + 4;
        }
    
        /**
         * Set player mining.
         * @param isMining if player is mining.
         */
    
        void setMining(boolean isMining) {
            p.isMining = isMining;
        }
    
        /**
         * Set ore delay.
         * @param oreDelay the delay thats going to be setted.
         */
    
        void setOreDelay(int oreDelay) {
            p.oreDelay = oreDelay;
        }
    
        /**
         * Set the player's rock type to receive after mining the correct ore.
         * @param oreType the rock type of the ore thats mined later etc.
         */
    
        void setOreType(int oreType) {
            p.oreType = oreType;
        }
    
        /**
         * Reset the mining process.
         */
        public void resetMiningEvent() {
            setOreType(0);
            setMining(false);
            setOreDelay(-1);
        }
    
    }
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    3,143
    Thanks given
    27
    Thanks received
    92
    Rep Power
    0
    Changed "Skills" package to "skills"

    Now:
    Code:
    Compiling all files....
    .\palidino76\rs2\players\Player.java:22: cannot access palidino76.rs2.Content.sk
    ills.Mining
    bad class file: .\palidino76\rs2\Content\skills\Mining.java
    file does not contain class palidino76.rs2.Content.skills.Mining
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    import palidino76.rs2.Content.skills.Mining;
                                        ^
    Press any key to continue . . .
    Reply With Quote  
     

  6. #6  
    Certified Stoner

    demon dylan001's Avatar
    Join Date
    Feb 2009
    Age
    25
    Posts
    1,127
    Thanks given
    77
    Thanks received
    94
    Discord
    View profile
    Rep Power
    509
    ok upload ur player.java file and send me it the download link il fix it
    Reply With Quote  
     

  7. #7  
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    3,143
    Thanks given
    27
    Thanks received
    92
    Rep Power
    0
    Also Removed.
    Reply With Quote  
     

  8. #8  
    Certified Stoner

    demon dylan001's Avatar
    Join Date
    Feb 2009
    Age
    25
    Posts
    1,127
    Thanks given
    77
    Thanks received
    94
    Discord
    View profile
    Rep Power
    509
    paste ur engine this is being jewish i cant figure this stupid thing is its dealing with ur imports
    Reply With Quote  
     

  9. #9  
    Banned

    Join Date
    Jan 2009
    Age
    31
    Posts
    3,143
    Thanks given
    27
    Thanks received
    92
    Rep Power
    0
    Code:
    /*
     * Class Engine
     *
     * Version 1.0
     *
     * Thursday, August 14, 2008
     *
     * Created by Palidino76
     */
    
    package palidino76.rs2;
    
    import java.net.Socket;
    import palidino76.rs2.players.Player;
    import palidino76.rs2.players.items.*;
    import palidino76.rs2.players.update.*;
    import palidino76.rs2.players.combat.PlayerCombat;
    import palidino76.rs2.world.mapdata.MapData;
    import palidino76.rs2.world.items.Items;
    import palidino76.rs2.io.*;
    import palidino76.rs2.util.Misc;
    import palidino76.rs2.npcs.NPC;
    import palidino76.rs2.npcs.update.*;
    import palidino76.rs2.npcs.loading.*;
    //import palidino76.rs2.net.log.Logger;
    import palidino76.rs2.Content.*;
    import palidino76.rs2.clanchat.ClanChat;
    
    public class Engine implements Runnable {
        /**
         * When a new player logs in, a new player is created and stored in this array.
         * <p>The server cannot exceed 2000 players.
         * The id 0 cannot be used as it is not handled by the client corrently.
         */
        public static Player[] players = new Player[2000];
        /**
         * Max id an NPC can have loaded out of the npclist config.
         */
        public static int maxListedNPCs = 8045;
        /**
         * When a new NPC is created, it is stored in this array.
         * <p>There can not be more than 5000 NPCs spawned at a time.
         * The id 0 cannot be used as it is not handled by the client corrently.
         */
        public static NPC[] npcs = new NPC[5000];
        /**
         * Contains NPC data such as respawn times, names, examines, etc.
         */
        public static NPCList[] npcLists = new NPCList[maxListedNPCs];
        /**
         * The class thread.
         */
        private Thread engineThread = new Thread(this);
        /**
         * Set true if the engine should run.
         */
        private boolean engineRunning = true;
        /**
         * Handles packets recieved from the server.
         */
        public static Packets packets = new Packets();
        /**
         * Loads and stores map data for map regions.
         */
        public static MapData mapData = new MapData();
        /**
         * Contains a method for every known frame.
         */
        public static Frames frames = new Frames();
        /**
         * Handles player movement.
         */
        public static PlayerMovement playerMovement = new PlayerMovement();
        /**
         * Contains all item information.
         */
        public static Items items;
        /**
         * Handles player updates.
         */
        public static PlayerUpdate playerUpdate = new PlayerUpdate();
        /**
         * Handles NPC movement.
         */
        public static NPCMovement npcMovement = new NPCMovement();
        /**
         * Handles NPC updates.
         */
        public static NPCUpdate npcUpdate = new NPCUpdate();
        /**
         * Handles players items.
         */
        public static PlayerItems playerItems = new PlayerItems();
        /**
         * Handles file saving and loading.
         */
        public static FileManager fileManager = new FileManager();
        public static PlayerBank playerBank = new PlayerBank();
        public static PlayerCombat playerCombat = new PlayerCombat();
        public static ShopHandler shopHandler = new ShopHandler();
        public static Shops     shops                  = new Shops();
        /**
         * Constructs a new Engine and loads item and NPC data from configs.
         */
        public Engine() {
            items = new Items(this);
            LoadNPCLists lnl = new LoadNPCLists();
            lnl = null;
            engineThread.start();
        }
     public static ClanChat clanChat = new ClanChat();
    
        /**
         * The thread's process.
         * <p>This processes at a rate of 100 milliseconds, and the processing time
         * is subtracted from the amount of time it sleeps to keep at a rate of 100
         * milliseonds. Packets are checked every 100 milliseconds for faster response time,
         * and most other updates are processed every 600 milliseconds.
         */
        public void run() {
            long lastEntityUpdate = 0;
            long curTime;
            while (engineRunning) {
                curTime = System.currentTimeMillis();
                connectAwaitingPlayers();
                packets.parseIncomingPackets();
                if (curTime - lastEntityUpdate >= 600) {
                    items.process();
                    for (Player p : players) {
                        // Proccess and player movement, removing disconnected players.
                        if (p == null || !p.online) {
                            continue;
                        }
                        if (p.disconnected[0] && p.disconnected[1]) {
                            removePlayer(p.playerId);
                            continue;
                        }
                        p.process();
                        playerMovement.getNextPlayerMovement(p);
                    }
                    for (Player p: players) {
                        // Update players.
                        if (p == null || !p.online) {
                            continue;
                        }
                        playerUpdate.update(p);
                    }
                    for (Player p : players) {
                        // Reset masks and send bytes.
                        if (p == null || !p.online) {
                            continue;
                        }
                        playerUpdate.clearUpdateReqs(p);
                        Server.socketListener.writeBuffer(p);
                    }
                    for (NPC n : npcs) {
                        if (n == null) {
                            continue;
                        }
                        npcUpdate.clearUpdateMasks(n);
                    }
                    for (NPC n : npcs) {
                        if (n == null) {
                            continue;
                        }
                        n.process();
                        if (!n.isDead) {
                            if (n.randomWalk) {
                                npcMovement.randomWalk(n);
                            }
                        } else {
                            if (!n.deadEmoteDone) {
                                n.deadEmoteDone = true;
                                n.combatDelay = 3;
                            } else if (n.deadEmoteDone && !n.hiddenNPC && n.combatDelay <= 0) {
                                n.hiddenNPC = true;
                            } else if (n.hiddenNPC && n.respawnDelay <= 0) {
                                if (n.needsRespawn) {
                                    newNPC(n.npcType, n.makeX, n.makeY, n.heightLevel, n.moveRangeX1, n.moveRangeY1, 
                                            n.moveRangeX2, n.moveRangeY2, true);
                                }
                                npcs[n.npcId] = null;
                                rebuildNPCs();
                            }
                        }
                        lastEntityUpdate = curTime;
                    }
                }
                try {
                    Thread.sleep(100 - (System.currentTimeMillis() - curTime));
                } catch (Exception e) {
                }
            }
        }
    
        /**
         * Assign a player to the connection.
         * <p>When a new connection is recieved, a new Player class is created which waits for the run method
         * to run the Login class to finish the connection. If the id is 0, or the server is full, no
         * connection is made and the socket is closed.
         * @param socket The socket the new player is connected to.
         * @param id The id which the new player will be created at.
         */
        public void addConnection(Socket socket, int id) {
            if (id == 0) {
                Server.socketListener.removeSocket(id);
                return;
            }
            players[id] = new Player(socket, id);
        }
    
        /**
         * Run the login class to finish a new connection.
         * <p>Loops through all the players looking for any that are not online.
         * Because the socket can't cause the server to process slower, there
         * are multiple login stages, and the player will go through the login class
         * two or three times before fully logging in.
         */
        public void connectAwaitingPlayers() {
            Login login = null;
            for (Player p : players) {
                if (p == null || p.online) {
                    continue;
                }
                if (login == null)
                    login = new Login();
                login.login(p);
                if (!p.online && p.loginStage == -1 || (System.currentTimeMillis() - p.loginTimeout) >= 15000) {
                    /*
                     * Remove the player if he failed to connect or it was the update server.
                     */
                    removePlayer(p.playerId);
                }
            }
        }
    
        /**
         * Discard a player with the specified id in the player array.
         * <p>This method should only be called when the player is ready to be removed.
         * This nulls closes the players socket and then nulls the player.
         * @param id The position in the player array that should be removed.
         */
        public void removePlayer(int id) {
            if (players[id] == null) {
                return;
            }
            if (players[id].online) {
                try {
                    fileManager.saveCharacter(players[id]);
                } catch (Exception e) {
                }
            }
            players[id].destruct();
            players[id] = null;
            Server.socketListener.removeSocket(id);
        }
    
        /**
         * This method tells every player to re-add any NPCs within distance.
         * <p>By calling this method, with the next NPC update it will discard the NPC list and
         * re-loop through every NPC and re-add them if they fit the specifications.
         */
        public void rebuildNPCs() {
            for (Player p : players) {
                if (p == null) {
                    continue;
                }
                p.rebuildNPCList = true;
            }
        }
    
        /**
         * Returns a players id based on their username, or 0 if the player is not online.
         * <p>This will check if a player is online based on searching every characters username,
         * and comparing it to playerName. Because index 0 is not used and won't throw an
         * ArrayoutofBounds exception error, 0 is returned if the username isn't found.
         * @param playerName The name to compare with the other online player names.
         * @return Returns the index of the player with that username, or 0 if the username isn't found.
         */
    public static int getIdFromName(String playerName) {
    playerName.replaceAll("_", " ");
    for (Player p : players) {
    if (p == null) {
    continue;
    }
    if (p.username.equalsIgnoreCase(playerName)) {
    return p.playerId;
    }
    }
    return 0;
    }
    
        /**
         * Returns the description of npcId.
         * @param npcId The NPC to get the examine for.
         * @return Returns the examine.
         */
        public String getNPCDescription(int npcId) {
            if (npcId == -1 || npcId >= maxListedNPCs) {
                return new String("An NPC.");
            }
            if (npcLists[npcId] != null) {
                return (npcLists[npcId].examine);
            }
            return new String("NPC " + npcId);
        }
    
        /**
         * Spawn a new NPC.
         * <p>This will create a new visible NPC, with the default values from its list and the parameters.
         * @param type The type of NPC this is, such as 50 for the King black dragon.
         * @param absX The absolute x coordinate to spawn the NPC.
         * @param absY The absolute y coordinate to spawn the NPC.
         * @param height The height level to set the NPC.
         * @param mRXY1 The distance it can walk west; must be lower than absX to have any effect.
         * @param mRY1 The distance it can walk south; must be lower than absY to have any effect.
         * @param mRX2 The distance it can walk east; must be higher than absX to have any effect.
         * @param mRY2 The distance it can walk north; must be higher than absY to have any effect.
         * @param needsRespawn Set to true if the NPC should respawn after it dies.
         * @return Returns the index the NPC was placed at.
         */
        public static int newNPC(int type, int absX, int absY, int height, int mRX1, int mRY1, int mRX2, int mRY2, boolean needsRespawn) {
            int index = -1;
            for (int i = 1; i < npcs.length; i++) {
                if (npcs[i] == null) {
                    index = i;
                    break;
               }
            }
            if (index == -1) {
                Misc.println("Max number of NPCs spawned.");
                return -1;
            }
            NPC n = npcs[index] = new NPC(type, index);
            n.absX = absX;
            n.absY = absY;
            n.makeX = absX;
            n.makeY = absY;
            n.heightLevel = height;
            n.moveRangeX1 = mRX1;
            n.moveRangeY1 = mRY1;
            n.moveRangeX2 = mRX2;
            n.moveRangeY2 = mRY2;
            n.needsRespawn = needsRespawn;
            NPCList nl = npcLists[type];
            if (nl != null) {
                n.name = nl.npcName;
                n.combatLevel = nl.combatLevel;
                n.maxHP = nl.maxHP;
                n.currentHP = n.maxHP;
                n.maxHit = nl.maxHit;
                n.atkType = nl.atkType;
                n.weakness = nl.weakness;
                n.respawnDelay = nl.respawnDelay;
            }
            return index;
        }
    }
    Reply With Quote  
     

  10. #10  
    Certified Stoner

    demon dylan001's Avatar
    Join Date
    Feb 2009
    Age
    25
    Posts
    1,127
    Thanks given
    77
    Thanks received
    94
    Discord
    View profile
    Rep Power
    509
    did u just add the content folder?
    Reply With Quote  
     

Page 1 of 4 123 ... LastLast

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
  •