Thread: [Pi] FOOD!

Results 1 to 4 of 4
  1. #1 [Pi] FOOD! 
    Registered Member
    Join Date
    Aug 2013
    Posts
    115
    Thanks given
    24
    Thanks received
    6
    Rep Power
    0
    okay so when i eat a manta it's suppose to heal 22 but for some reaosn every food doubles ? :/ how do i fix this

    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 {
    MONKEY_NUTS(4012,24,"Lost penis of Jupiter"),
    ROCKTAIL(15272,24,"Rocktail"),
    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"),
    EASTER_EGG(1961,69,"Easter Egg"),
    HALF_FULL_WINE_JUG(1989,69,"Half full wine jug"),
    PUMPKIN(1959,69,"Pumpkin"),
    CABAGGE(1965,1,"Cabbage"),
    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 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 >= 1500 && c.playerLevel[3] > 0) {
    int originalHealth; // defined this to test something
    originalHealth = c.playerLevel[3];
    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] < c.calculateMaxLifePoints()) {
    c.playerLevel[3] += f.getHeal();
    if (c.playerLevel[3] > c.calculateMaxLifePoints())
    c.playerLevel[3] = c.calculateMaxLifePoints();
    /*if ((c.playerLevel[3] > (c.getLevelForXP(c.playerXP[3])) + 10)) {
    c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]) + 10;*/
    }
    if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3]) + 10) {
    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])) + 10)) {
    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);
    }


    }
    Not sure if codes in there but that's my food.java
    [ad][/ad]

    currently in Beta! need testers for bugs, staff positions available, limited!
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Aug 2013
    Posts
    115
    Thanks given
    24
    Thanks received
    6
    Rep Power
    0
    Can anyone help me please here is my code^
    [ad][/ad]

    currently in Beta! need testers for bugs, staff positions available, limited!
    Reply With Quote  
     

  3. #3  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    You're repeating this shit twice, just look through the code and delete it.

    Code:
    if (c.playerLevel[3] < c.calculateMaxLifePoints()) {
    c.playerLevel[3] += f.getHeal();
    
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Aug 2013
    Posts
    115
    Thanks given
    24
    Thanks received
    6
    Rep Power
    0
    already fixed and yes as i said in my other post it duplicated hence why i said in other post "remove this"
    thanks anyway
    [ad][/ad]

    currently in Beta! need testers for bugs, staff positions available, limited!
    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

Similar Threads

  1. [PI] Food
    By SodomizedU in forum Help
    Replies: 9
    Last Post: 09-12-2012, 10:58 AM
  2. [PI] Food Pouch
    By DeathTacoz in forum Snippets
    Replies: 14
    Last Post: 07-11-2011, 05:07 PM
  3. [PI] Food system!
    By Hellobuddyhowareyou in forum Help
    Replies: 5
    Last Post: 05-18-2011, 01:29 AM
  4. [PI]Foods
    By Arithium in forum Snippets
    Replies: 24
    Last Post: 12-05-2010, 05:58 PM
  5. [PI] Food Issue
    By Lenin in forum Help
    Replies: 0
    Last Post: 08-16-2010, 01: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
  •