Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • Decimate Returns: Join Project Decimate !! NEW SERVER 15+ players daily - Double XP and Pest Control weekends! new content added weekly - PRESS TO PLAY [link]
      June 05, 2020, 08:13:23 PM
    • ragnoroker: Join RuneGuild Today - New Server - Double exp + lots of events this weekend! - JOIN NOW - [link]
      June 05, 2020, 03:54:49 PM
    • ragnoroker: Join RuneGuild Today - New Server - Double exp + lots of events this weekend! - JOIN NOW - [link]
      June 05, 2020, 03:54:46 PM
    • hardcore22: are there any kind of silabsoft servers like back in the days i miss that
      May 25, 2020, 05:44:08 AM
    • Amcora: @ dr house contact me; greetings celien :)
      May 24, 2020, 03:16:21 PM
    • Amcora: Stop shouting around please
      May 24, 2020, 03:13:26 PM
    • iddsyou: PkOwnage OSRSPS [link]  Join us on Discord! [link]  Download: [link]
      May 17, 2020, 11:44:17 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:48:19 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:48:12 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:47:56 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:47:49 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:47:42 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:47:29 AM
    • ragnoroker: BRAND NEW SERVER - PRE EOC - UNIQUE - JOIN TODAY :) - [link]
      May 15, 2020, 11:18:03 AM
    • ragnoroker: BRAND NEW SERVER - PRE EOC - UNIQUE - JOIN TODAY :) - [link]
      May 15, 2020, 11:17:53 AM
    • ragnoroker: BRAND NEW SERVER - PRE EOC - UNIQUE - JOIN TODAY :) - [link]
      May 15, 2020, 11:17:50 AM
    • Decimate Returns: Project Decimate 474 OSRS ; [link]
      May 13, 2020, 07:27:00 PM
    • hardcore22: are there any silabsoft servers left? of the good old days like hackscape
      May 12, 2020, 07:53:18 AM
    • iddsyou: yo guys check out this instagram post #pkownage  [link]
      May 06, 2020, 02:35:58 PM
    • fishingsheep: any servers like project catasrophe or frugoo scape been remade ?
      May 04, 2020, 05:01:00 PM

    Author Topic: Help please?  (Read 768 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineDrapht96

    • First Time Poster
    • *
    • Posts: 3
    • Thanks: +10/-10
      • View Profile
    Help please?
    « on: October 07, 2017, 06:07:52 AM »
    So I've been working on making skills more profitable and I've made it so when you woodcut you can get crystal keys & stuf...
    But I tested it and you can just spam click the tree & get rewards, can somebody please help me out a bit?
    Server revision - 317 PI
    Thank you

    Code: [Select]
    package server.model.players.skills;

    import server.Server;
    import server.model.players.Client;
    import server.model.players.PlayerHandler;
    import server.util.Misc;
    import server.*;
    import server.model.players.PlayerAssistant;
    import server.task.Task;
     
    public class Woodcutting extends SkillHandler {

    public static void attemptData(final Client c, final int tree, final int obX, final int obY) {
    c.playerIsWoodcutting = false;
    if (!noInventorySpace(c, "woodcutting")){
    resetWoodcutting(c);
    return;
    }
    if (hasAxe(c) && !canUseAxe(c)){
    c.playerIsWoodcutting = false;
    c.sendMessage("Your Woodcutting level is too low to use this axe.");
    return;
    }
    if (!hasAxe(c)) {
    c.playerIsWoodcutting = false;
    c.sendMessage("You need a Woodcutting axe to chop this.");
    return;
    }

    if(c.playerIsWoodcutting) {
    c.playerIsWoodcutting = false;
    return;
    }

    c.sendMessage("You swing your axe at the tree.");
    c.playerIsWoodcutting = true;
    c.stopPlayerSkill = true;

    c.playerSkillProp[8][1] = getRespawnTime(c, tree);//RESPAWN TIME
    c.playerSkillProp[8][2] = getRequiredLevel(c, tree);//LEVELREQ
    c.playerSkillProp[8][3] = recieveXP(c, tree);//XP
    c.playerSkillProp[8][4] = getAnimId(c);//ANIM
    c.playerSkillProp[8][5] = getRespawnTime(c, tree);//RESPAWN TIME
    c.playerSkillProp[8][6] = getTreeLog(c, tree);//LOG

    c.woodcuttingTree = obX + obY;

    c.doAmount = 1 + Misc.random(25);
    if(normalTree(c, tree)) {
    c.doAmount = 1;
    }

    if(!hasRequiredLevel(c, 8, c.playerSkillProp[8][2], "woodcutting", "cut this tree")) {
    resetWoodcutting(c);
    return;
    }

    c.startAnimation(c.playerSkillProp[8][4]);

    for(int i = 0; i < trees.length; i++) {
    for(int l = 0; l < 6; l++)
    if(tree == trees[l][i]) {
           Server.getTaskScheduler().addEvent(new Task(getTimer(c), false) {
    public void execute() {

    if(c.playerSkillProp[8][6] > 0) {
    c.getItems().addItem(c.playerSkillProp[8][6], 1);
    }
    if(c.playerSkillProp[8][3] > 0) {
    c.getPA().addSkillXP(c.playerSkillProp[8][3] * WOODCUTTING_XP, 8);
    }
    if(c.playerSkillProp[8][6] > 0) {
    c.sendMessage("You get some logs.");
    }
    if(Misc.random(100) == 0) {
    recieveBirdsNest(c);
    }
    if(Misc.random(5) == 5) {//WOODCUTTING POINTS
       c.Woodcuttingpoints += 1;
       c.sendMessage("You've received 1 Woodcutting point.");
    }
    if(Misc.random(30) == 30) {//1 TOKEN
       c.getItems().addItem(12852, 1);
       c.sendMessage("You've received a 1 token.");
    }
    if(Misc.random(20000) == 20000) {
    //c.getItems().addItem(CODE, 1);
    c.sendMessage("You have a funny feeling like you're being followed.");
    }
    if(Misc.random(30) == 30) {
    c.getItems().addItem(989, 1);
    c.sendMessage("Ooooh, a crystal key! This has to be rare!");
    }
    if(Misc.random(50) == 50) {
    c.spinsLe += 1;
    c.sendMessage("Ooooh, a spin ticket! This has to be rare!");
    }
    if(Misc.random(100) == 100) {
    c.getItems().addItem(2677, 1);
    c.sendMessage("Woooaaah, a sclue scroll! This has to be rare!");
    }
    deleteTime(c);
    if (!hasAxe(c)) {
    c.sendMessage("You need a Woodcutting axe which you need a Woodcutting level to use.");
    resetWoodcutting(c);
    this.stop();
    }
    if (!noInventorySpace(c, "woodcutting")){
    resetWoodcutting(c);
    this.stop();
    }
    if(!c.stopPlayerSkill) {
    resetWoodcutting(c);
    this.stop();
    }
    if(!c.playerIsWoodcutting) {
    this.stop();
    }
    if(c.doAmount <= 0 && c.playerIsWoodcutting) {
    createStump(c, tree, obX, obY);
    resetWoodcutting(c);
    this.stop();
    }
    }

    });
           Server.getTaskScheduler().addEvent(new Task(4, false) {
    public void execute() {
    if(c.playerSkillProp[8][4] > 0) {
    c.startAnimation(c.playerSkillProp[8][4]);
    //}
    //if (c.getItems().playerHasItem(13661, 1)) {
    //if(Misc.random(4) == 4) {
    //c.getPA().addSkillXP(FIREMAKING_XP, 11);
    //c.sendMessage("The adze's heat instantly incinerates the log, granting Firemaking experience.");
    //}
    } else {
    resetWoodcutting(c);
    }
    if(!c.stopPlayerSkill) {
    this.stop();
    }
    }

    });
    }
    }
    }

    public static boolean playerTrees(Client c, int tree) {
    boolean trees2 = false;
    for(int i = 0; i < trees.length; i++) {
    for(int i1 = 0; i1 < 6; i1++) {
    if(tree == trees[i1][i]){
    trees2 = true;
    }
    }
    }
    return trees2;
    }

    private static void treeLocated(Client c, int obX, int obY) {
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(PlayerHandler.players[i] != null) {
    Client person = (Client)PlayerHandler.players[i];
    if(person != null) {
    Client p = (Client)person;
    if(p.distanceToPoint(c.absX, c.absY) <= 10){
    if(c.woodcuttingTree == p.woodcuttingTree) {
    p.woodcuttingTree = -1;
    Woodcutting.resetWoodcutting(p);
    }
    }
    }
    }
    }
    }

    private static int getTimer(Client c) {
    return (Misc.random(5) + getAxeTime(c) + playerWoodcuttingLevel(c));
    }

    private static void recieveBirdsNest(Client c) {
    Server.itemHandler.createGroundItem(c, 5070 + Misc.random(4), c.getX(), c.getY(), 1, c.getId());
    c.sendMessage("A bird's nest falls out of the tree!");
    }

    private static void createStump(final Client c, final int i, final int obX, final int obY) {
    Server.objectHandler.createAnObject(c, 1341, obX, obY);
    treeLocated(c, obX, obY);
           Server.getTaskScheduler().addEvent(new Task(getRespawnTime(c,i), false) {
    public void execute() {
    Server.objectHandler.createAnObject(c, i, obX, obY);
    this.stop();
    }

    });
    }

    public static void resetWoodcutting(Client c) {
    c.startAnimation(65535);
    c.getPA().removeAllWindows();
    c.playerIsWoodcutting = false;
    c.doAmount = 0;
    for(int i = 0; i < 9; i++) {
    c.playerSkillProp[8][i] = -1;
    }
    }

    private static boolean hasAxe(Client c) {
    boolean has = false;
    for(int i = 0; i < axes.length; i++) {
    if(c.getItems().playerHasItem(axes[i][0]) || c.playerEquipment[3] == axes[i][0]) {
    has = true;
    }
    }
    return has;
    }

    private static int playerWoodcuttingLevel(Client c) {
    return (10 - (int)Math.floor(c.playerLevel[8] / 10));
    }

    private static int getTreeLog(Client c, int l) {
    c.playerSkillProp[8][6] = -1;
    for(int i = 0; i < trees.length; i++) {
     if(l== trees[5][i]) {
    c.playerSkillProp[8][6] = 1513;
    } else if(l == trees[4][i]) {
    c.playerSkillProp[8][6] = 1515;
    } else if(l == trees[3][i]) {
    c.playerSkillProp[8][6] = 1517;
    } else if(l == trees[2][i]) {
    c.playerSkillProp[8][6] = 1519;
    } else if(l == trees[1][i]) {
    c.playerSkillProp[8][6] = 1521;
    } else if(l == trees[0][i]) {
    c.playerSkillProp[8][6] = 1511;
    }
    }
    return c.playerSkillProp[8][6];
    }

    private static int getAxeTime(Client c) {
    int axe = -1;
    for(int i = 0; i < axes.length; i++) {
    if(c.playerLevel[8] >= axes[i][1]) {
    if(c.getItems().playerHasItem(axes[i][0]) || c.playerEquipment[3] == axes[i][0]) {
    axe = axes[i][3];
    }
    }
    }
    return axe;
    }

    private static int getAnimId(Client c) {
    int anim = -1;
    for(int i = 0; i < axes.length; i++) {
    if(c.playerLevel[8] >= axes[i][1]) {
    if(c.getItems().playerHasItem(axes[i][0]) || c.playerEquipment[3] == axes[i][0]) {
    anim = axes[i][2];
    }
    }
    }
    return anim;
    }

    private static int recieveXP(Client c, int treep) {
    c.playerSkillProp[8][3] = -1;
    for(int i = 0; i < trees.length; i++) {
    if(treep == trees[5][i]) {
    c.playerSkillProp[8][3] = 250;
    } else if(treep == trees[4][i]) {
    c.playerSkillProp[8][3] = 175;
    } else if(treep == trees[3][i]) {
    c.playerSkillProp[8][3] = 100;
    } else if(treep == trees[2][i]) {
    c.playerSkillProp[8][3] = 68;
    } else if(treep == trees[1][i]) {
    c.playerSkillProp[8][3] = 38;
    } else if(treep == trees[0][i]) {
    c.playerSkillProp[8][3] = 25;
    }
    }
    return c.playerSkillProp[8][3];
    }

    private static int getRespawnTime(Client c, int treep) {
    int respawn = -1;
    for(int i = 0; i < trees.length; i++) {
    if(treep == trees[5][i]) {
    respawn = 100;//1 Minute
    } else if(treep == trees[4][i]) {
    respawn = 50;//30
    } else if(treep == trees[3][i]) {
    respawn = 25;//15
    } else if(treep == trees[2][i]) {
    respawn = 25;//15
    } else if(treep == trees[1][i]) {
    respawn = 15;//9
    } else if(treep == trees[0][i]) {
    respawn = 10;//6
    }
    }
    return respawn;
    }

    private static boolean normalTree(Client c, int treep) {
    boolean normal = false;
    for(int i = 0; i < trees.length; i++) {
    if(treep == trees[0][i]) {
    normal = true;
    }
    }
    return normal;
    }

    private static boolean canUseAxe(Client c) {
    boolean axe = false;
    if(performCheck(c, 1349, 1) || performCheck(c, 1351, 1)
    || performCheck(c, 1353, 6) || performCheck(c, 1361, 6)
    || performCheck(c, 1355, 21) || performCheck(c, 1357, 31)
    || performCheck(c, 1359, 41) || performCheck(c, 6739, 61)
    || performCheck(c, 13661, 81)) {
    axe = true;
    }
    return axe;
    }

    private static boolean performCheck(Client c, int i, int l) {
    return (c.getItems().playerHasItem(i) || c.playerEquipment[3] == i) && c.playerLevel[8] >= l;
    }

    private static int getRequiredLevel(Client c, int treep) {
    int respawn = -1;
    for(int i = 0; i < trees.length; i++) {
    if(treep == trees[5][i]) {
    respawn = 75;
    } else if(treep == trees[4][i]) {
    respawn = 60;
    } else if(treep == trees[3][i]) {
    respawn = 45;
    } else if(treep == trees[2][i]) {
    respawn = 30;
    } else if(treep == trees[1][i]) {
    respawn = 15;
    } else if(treep == trees[0][i]) {
    respawn = 1;
    }
    }
    return respawn;
    }

    private static int[][] axes = {
    {1351, 1, 879, 10},
    {1349, 1, 877, 10},
    {1353, 6, 875, 10},
    {1361, 6, 873, 9},
    {1355, 21, 871, 9},
    {1357, 31, 869, 9},
    {1359, 41, 867, 7},
    {6739, 61, 2846, 6},
    {13661, 81, 10250, 4},
    };

    private static int[][] trees = {
    {//NORMAL
    1276, 1277, 1278, 1279, 1280, 1282,
    1283, 1284, 1285, 1286, 1287, 1288,
    1289, 1290, 1291, 1301, 1303, 1304,
    1305, 1318, 1319, 1315, 1316, 1330,
    1331, 1332, 1333, 1383, 1384, 2409,
    2447, 2448, 3033, 3034, 3035, 3036,
    3879, 3881, 3883, 3893, 3885, 3886,
    3887, 3888, 3892, 3889, 3890, 3891,
    3928, 3967, 3968, 4048, 4049, 4050,
    4051, 4052, 4053, 4054, 4060, 5004,
    5005, 5045, 5902, 5903, 5904, 8973,
    8974, 10041, 10081, 10082, 10664, 11112,
    11510, 12559, 12560, 12732, 12895, 12896,
    13412, 13411, 13419, 13843, 13844, 13845,
    13847, 13848, 13849, 13850, 14308, 14309,
    14513, 14514, 14515, 14521, 14564, 14565,
    14566, 14593, 14594, 14595, 14600, 14635,
    14636, 14637, 14642, 14664, 14665, 14666,
    14693, 14694, 14695, 14696, 14701, 14738,
    14796, 14797, 14798, 14799, 14800, 14801,
    14802, 14803, 14804, 14805, 14806, 14807,
    15489, 15776, 15777, 16264, 16265, 19165,
    19166, 19167, 23381,

    }, {//OAK
    1281, 3037, 8462, 8463, 8464, 8465,
    8466, 8467, 10083, 13413, 13420,
    }, {//WILLOW
    1308, 5551, 5552, 5553, 8481, 8482, 8483,
    8484, 8485, 8486, 8487, 8488, 8496, 8497,
    8498, 8499, 8500, 8501, 13414, 13421,
    }, {//MAPLE
    1307, 4674, 8435, 8436, 8437, 8438, 8439,
    8440, 8441, 8442, 8443, 8444, 8454, 8455,
    8456, 8457, 8458, 8459, 8460, 8461, 13415,
    13423,
    }, {//YEW
    1309, 8503, 8504, 8505, 8506, 8507, 8508,
    8509, 8510, 8511, 8512, 8513, 13416, 13422,
    }, {//MAGIC
    1306, 8396, 8397, 8398, 8399, 8400, 8401,
    8402, 8403, 8404, 8405, 8406, 8407, 8408,
    8409, 13417, 13424,
    }
    };

    }
    Runescape Gambling

    Offlinematzie

    • Member
    • ****
    • Posts: 1,014
    • Thanks: +0/-0
      • View Profile
    Re: Help please?
    « Reply #1 on: November 02, 2017, 06:25:34 PM »
    You should put the chance as part of the 'get log' rather than a 'precut conditioning'. Somewhere in your code, a log is chopped. That is the code you want to spruce(haha) up with your random chance.
    smart phones are dumb
    people are smart phones.

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal