Thread: Food Help [PI]

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 Food Help [PI] 
    Registered Member
    Join Date
    Mar 2012
    Posts
    710
    Thanks given
    19
    Thanks received
    5
    Rep Power
    37
    I am hosting a 317 Pi server and when you eat tuna, you eat it wayyy to fast. How can i change this?
    Reply With Quote  
     

  2. #2  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    food.java.
    Reply With Quote  
     

  3. #3  
    Donator

    Arithium's Avatar
    Join Date
    May 2010
    Age
    31
    Posts
    4,721
    Thanks given
    199
    Thanks received
    1,256
    Rep Power
    1114
    Is it JUST tuna that is doing it?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Mar 2012
    Posts
    710
    Thanks given
    19
    Thanks received
    5
    Rep Power
    37
    No, the tuna potatoe, shrimps and other food is too.I fixed to long time ago but now I refreshed the whole source. What I did is that I went into to food.java and fixed it in there. I dont know what to change.
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Jul 2011
    Age
    31
    Posts
    1,735
    Thanks given
    101
    Thanks received
    81
    Rep Power
    0
    Quote Originally Posted by i am here View Post
    No, the tuna potatoe, shrimps and other food is too.I fixed to long time ago but now I refreshed the whole source. What I did is that I went into to food.java and fixed it in there. I dont know what to change.
    Food.java
    Reply With Quote  
     

  6. #6  
    Donator


    Join Date
    Mar 2012
    Posts
    1,023
    Thanks given
    221
    Thanks received
    299
    Rep Power
    605
    You want to go to public void eat and change this:

    Code:
    if (System.currentTimeMillis() - c.foodDelay >= 1500 && c.constitution > 0) {
    1500 milliseconds is 1.5 seconds.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Mar 2012
    Posts
    710
    Thanks given
    19
    Thanks received
    5
    Rep Power
    37
    Yes I know its the food.java but what in there?
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Mar 2012
    Posts
    710
    Thanks given
    19
    Thanks received
    5
    Rep Power
    37
    package server.model.players;

    import java.util.HashMap;

    /**
    * @author Sanity
    */

    public class Food {


    private Client c;

    public Food (Client c) {
    this.c = c;
    }
    public static enum FoodToEat {

    HEIM_CRAB(18159,12,"Heim crab"),
    ROCKTAIL(15272,24,"Rocktail"),
    BANDAGES(4049,3,"Bandages"),
    MANTA(391,22,"Manta Ray"),
    SHARK(385,20,"Shark"),
    LOBSTER(379,12,"Lobster"),
    TROUT(333,7,"Trout"),
    SALMON(329,9,"Salmon"),
    SWORDFISH(373,14,"Swordfish"),
    TUNA(361,10,"Tuna"),
    MONKFISH(7946,16,"Monkfish"),
    SEA_TURTLE(397,21,"Sea Turtle"),
    CAKE(1891,4,"Cake"),
    BASS(365,13,"Bass"),
    COD(339,7,"Cod"),
    POTATO(1942,1,"Potato"),
    BAKED_POTATO(6701,4,"Baked Potato"),
    POTATO_WITH_CHEESE(6705,16,"Potato with Cheese"),
    EGG_POTATO(7056,16,"Egg Potato"),
    CHILLI_POTATO(7054,14,"Chilli Potato"),
    MUSHROOM_POTATO(7058,20,"Mushroom Potato"),
    TUNA_POTATO(7060,22,"Tuna Potato"),
    SHRIMPS(315,3,"Shrimps"),
    HERRING(347,5,"Herring"),
    SARDINE(325,4,"Sardine"),
    CHOCOLATE_CAKE(1897,5,"Chocolate Cake"),
    ANCHOVIES(319,1,"Anchovies"),
    PLAIN_PIZZA(2289,7,"Plain Pizza"),
    MEAT_PIZZA(2293,8,"Meat Pizza"),
    ANCHOVY_PIZZA(2297,9,"Anchovy Pizza"),
    PINEAPPLE_PIZZA(2301,11,"Pineapple Pizza"),
    BREAD(2309,5,"Bread"),
    APPLE_PIE(2323,7,"Apple Pie"),
    REDBERRY_PIE(2325,5,"Redberry Pie"),
    MEAT_PIE(2327,6,"Meat Pie"),
    PIKE(351,8,"Pike"),
    POTATO_WITH_BUTTER(6703,14,"Potato with Butter"),
    BANANA(1963,2,"Banana"),
    PEACH(6883,8,"Peach"),
    ORANGE(2108,2,"Orange"),
    PINEAPPLE_RINGS(2118,2,"Pineapple Rings"),
    PINEAPPLE_CHUNKS(2116,2,"Pineapple Chunks");



    private int id; private int heal; private String name;

    private FoodToEat(int id, int heal, String name) {
    this.id = id;
    this.heal = heal;
    this.name = name;
    }

    public int getId() {
    return id;
    }

    public int getHeal() {
    return heal;
    }

    public String getName() {
    return name;
    }
    public static HashMap <Integer,FoodToEat> food = new HashMap<Integer,FoodToEat>();

    public static FoodToEat forId(int id) {
    return food.get(id);
    }

    static {
    for (FoodToEat f : FoodToEat.values())
    food.put(f.getId(), f);
    }
    }
    public int gwdarmourStat(double amount) {
    return (int)(c.getLevelForXP(c.playerXP[3]) * amount);
    }
    public boolean hasFullPrimal() {
    return c.playerEquipment[c.playerHat] == 13362 && c.playerEquipment[c.playerChest] == 13360 && c.playerEquipment[c.playerLegs] == 13361;
    }

    public boolean torva() {
    return c.playerEquipment[c.playerHat] == 13362 && c.playerEquipment[c.playerChest] == 13360 && c.playerEquipment[c.playerLegs] == 13361;
    }

    public void eat(int id, int slot) {
    if (c.duelRule[6]) {
    c.sendMessage("You may not eat in this duel.");
    return;
    }
    if (System.currentTimeMillis() - c.foodDelay >= 300 && c.playerLevel[3] > 0) {
    c.getCombat().resetPlayerAttack();
    c.attackTimer += 2;
    c.startAnimation(829);
    c.getItems().deleteItem(id,slot,1);
    FoodToEat f = FoodToEat.food.get(id);
    if (c.playerLevel[3] < gwdarmourStat(1.41) && c.torva()) {
    c.playerLevel[3] += f.getHeal();
    if (c.playerLevel[3] > gwdarmourStat(1.41))
    c.playerLevel[3] = gwdarmourStat(1.41);
    }
    else if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3]) && !c.torva()) {
    c.playerLevel[3] += f.getHeal();
    if(id != 15272) {
    if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
    c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
    //this makes sure normal food doesn't overload
    } else {
    // this says if their eating rocktails and their hp level is more then their player xp + 10, then make it playerxp + 10. If it isnt then it will overload anyway.
    if ((c.playerLevel[3] > (c.getLevelForXP(c.playerXP[3])))) {
    c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]) + 10;
    }
    }
    }
    c.foodDelay = System.currentTimeMillis();
    c.getPA().refreshSkill(3);
    c.sendMessage("You eat the " + f.getName() + ".");
    }
    }


    public boolean isFood(int id) {
    return FoodToEat.food.containsKey(id);
    }


    }

    This is my food.java
    Reply With Quote  
     

  9. #9  
    Donator


    Join Date
    Mar 2012
    Posts
    1,023
    Thanks given
    221
    Thanks received
    299
    Rep Power
    605
    I posted the fix stop bumping this and read.
    Reply With Quote  
     

  10. #10  
    I'm secretly a carrot named 3arl.

    Mainframe's Avatar
    Join Date
    Jun 2012
    Age
    26
    Posts
    1,422
    Thanks given
    542
    Thanks received
    214
    Rep Power
    147
    Quote Originally Posted by i am here View Post
    package server.model.players;

    import java.util.HashMap;

    /**
    * @author Sanity
    */

    public class Food {


    private Client c;

    public Food (Client c) {
    this.c = c;
    }
    public static enum FoodToEat {

    HEIM_CRAB(18159,12,"Heim crab"),
    ROCKTAIL(15272,24,"Rocktail"),
    BANDAGES(4049,3,"Bandages"),
    MANTA(391,22,"Manta Ray"),
    SHARK(385,20,"Shark"),
    LOBSTER(379,12,"Lobster"),
    TROUT(333,7,"Trout"),
    SALMON(329,9,"Salmon"),
    SWORDFISH(373,14,"Swordfish"),
    TUNA(361,10,"Tuna"),
    MONKFISH(7946,16,"Monkfish"),
    SEA_TURTLE(397,21,"Sea Turtle"),
    CAKE(1891,4,"Cake"),
    BASS(365,13,"Bass"),
    COD(339,7,"Cod"),
    POTATO(1942,1,"Potato"),
    BAKED_POTATO(6701,4,"Baked Potato"),
    POTATO_WITH_CHEESE(6705,16,"Potato with Cheese"),
    EGG_POTATO(7056,16,"Egg Potato"),
    CHILLI_POTATO(7054,14,"Chilli Potato"),
    MUSHROOM_POTATO(7058,20,"Mushroom Potato"),
    TUNA_POTATO(7060,22,"Tuna Potato"),
    SHRIMPS(315,3,"Shrimps"),
    HERRING(347,5,"Herring"),
    SARDINE(325,4,"Sardine"),
    CHOCOLATE_CAKE(1897,5,"Chocolate Cake"),
    ANCHOVIES(319,1,"Anchovies"),
    PLAIN_PIZZA(2289,7,"Plain Pizza"),
    MEAT_PIZZA(2293,8,"Meat Pizza"),
    ANCHOVY_PIZZA(2297,9,"Anchovy Pizza"),
    PINEAPPLE_PIZZA(2301,11,"Pineapple Pizza"),
    BREAD(2309,5,"Bread"),
    APPLE_PIE(2323,7,"Apple Pie"),
    REDBERRY_PIE(2325,5,"Redberry Pie"),
    MEAT_PIE(2327,6,"Meat Pie"),
    PIKE(351,8,"Pike"),
    POTATO_WITH_BUTTER(6703,14,"Potato with Butter"),
    BANANA(1963,2,"Banana"),
    PEACH(6883,8,"Peach"),
    ORANGE(2108,2,"Orange"),
    PINEAPPLE_RINGS(2118,2,"Pineapple Rings"),
    PINEAPPLE_CHUNKS(2116,2,"Pineapple Chunks");



    private int id; private int heal; private String name;

    private FoodToEat(int id, int heal, String name) {
    this.id = id;
    this.heal = heal;
    this.name = name;
    }

    public int getId() {
    return id;
    }

    public int getHeal() {
    return heal;
    }

    public String getName() {
    return name;
    }
    public static HashMap <Integer,FoodToEat> food = new HashMap<Integer,FoodToEat>();

    public static FoodToEat forId(int id) {
    return food.get(id);
    }

    static {
    for (FoodToEat f : FoodToEat.values())
    food.put(f.getId(), f);
    }
    }
    public int gwdarmourStat(double amount) {
    return (int)(c.getLevelForXP(c.playerXP[3]) * amount);
    }
    public boolean hasFullPrimal() {
    return c.playerEquipment[c.playerHat] == 13362 && c.playerEquipment[c.playerChest] == 13360 && c.playerEquipment[c.playerLegs] == 13361;
    }

    public boolean torva() {
    return c.playerEquipment[c.playerHat] == 13362 && c.playerEquipment[c.playerChest] == 13360 && c.playerEquipment[c.playerLegs] == 13361;
    }

    public void eat(int id, int slot) {
    if (c.duelRule[6]) {
    c.sendMessage("You may not eat in this duel.");
    return;
    }
    if (System.currentTimeMillis() - c.foodDelay >= 300 && c.playerLevel[3] > 0) {
    c.getCombat().resetPlayerAttack();
    c.attackTimer += 2;
    c.startAnimation(829);
    c.getItems().deleteItem(id,slot,1);
    FoodToEat f = FoodToEat.food.get(id);
    if (c.playerLevel[3] < gwdarmourStat(1.41) && c.torva()) {
    c.playerLevel[3] += f.getHeal();
    if (c.playerLevel[3] > gwdarmourStat(1.41))
    c.playerLevel[3] = gwdarmourStat(1.41);
    }
    else if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3]) && !c.torva()) {
    c.playerLevel[3] += f.getHeal();
    if(id != 15272) {
    if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
    c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
    //this makes sure normal food doesn't overload
    } else {
    // this says if their eating rocktails and their hp level is more then their player xp + 10, then make it playerxp + 10. If it isnt then it will overload anyway.
    if ((c.playerLevel[3] > (c.getLevelForXP(c.playerXP[3])))) {
    c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]) + 10;
    }
    }
    }
    c.foodDelay = System.currentTimeMillis();
    c.getPA().refreshSkill(3);
    c.sendMessage("You eat the " + f.getName() + ".");
    }
    }


    public boolean isFood(int id) {
    return FoodToEat.food.containsKey(id);
    }


    }

    This is my food.java
    Use [Code] (Food.Java) [ /Code] just remove that one space after /code.

    Edit:

    Change
    Code:
    if (System.currentTimeMillis() - c.foodDelay >= 300 && c.playerLevel[3] > 0) {
    To
    Code:
    if (System.currentTimeMillis() - c.foodDelay >= 500 && c.playerLevel[3] > 0) {
    Reply With Quote  
     

Page 1 of 2 12 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. Food
    By Jaegon in forum Help
    Replies: 2
    Last Post: 10-03-2011, 03:38 AM
  2. Food
    By Jaegon in forum Help
    Replies: 15
    Last Post: 09-25-2011, 06:35 AM
  3. Food In PI
    By PrataKosong in forum Help
    Replies: 7
    Last Post: 08-14-2010, 12:15 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
  •