Advertisement
Guest User

PJGH The definition of clean.

a guest
Apr 25th, 2014
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.72 KB | None | 0 0
  1. /**
  2.  * Thieving from Stalls
  3.  *
  4.  * @author Ethan Reid <PJGH #Rune-Server>
  5.  */
  6.  
  7. public class stalls {
  8.  
  9.     private static int xp;
  10.     private static String Name;
  11.     private static int Value;
  12.     private static int Rate;
  13.     private static int X;
  14.     private static int Y;
  15.  
  16.     private static void failed(Player c) {
  17.         c.getUpdateFlags().turnPlayerTo(X, Y);
  18.         c.sendAnimation(Animation.create(834));
  19.         NotComplete(c);
  20.         NPC n = c.getCloseNpc(4);
  21.         if (n != null) {
  22.             n.killerId = c.getIndex();
  23.             n.underAttack = true;
  24.             n.forceChat("Hey you, what do you think you're doing!");
  25.             return;
  26.         }
  27.         CallResets(c);
  28.     }
  29.    
  30.     private static void success(Player c) {
  31.             c.getUpdateFlags().turnPlayerTo(X, Y);
  32.         c.sendAnimation(Animation.create(834));
  33.             c.getSkills().addSkillXP((int) xp, Skills.THIEVING);
  34.             c.getItems().addItem(995, Value);  
  35.             Complete(c);
  36.             CallResets(c);
  37.     }
  38.    
  39.  
  40.     public static void Start(final Player c ,final int Original, final int objectX, final int objectY, final int face, int EXP,
  41.     int Replace, int requirement, int time, String name, int coins) {
  42.         xp = EXP + Misc.random(400);
  43.         Name = name;
  44.         X = objectX;
  45.         Y = objectY;
  46.         Value = coins;
  47.        
  48.         if(c.getSkills().getPlayerLevel()[Skills.THIEVING] < requirement) {
  49.                     c.getClient().sendMessage("You need a thieving level of at-least"+ requirement +".");
  50.                     return;
  51.             }
  52.        
  53.         if(c.getItems().freeSlots() < 1) {
  54.                 c.getClient().sendMessage("You need atleast 1 free inventory slot.");
  55.                 return;
  56.             }
  57.         Rate = Misc.random(5);
  58.         if(Rate != 4) {
  59.             ObjectManager.addObject(new GameObject(634, objectX, objectY, 0, face, 10, Original, time));
  60.                  success(c);
  61.         } else {
  62.             failed(c);
  63.             }
  64.         }
  65.  
  66.     private static void resetXP() {
  67.         xp = 0;
  68.     }
  69.  
  70.     private static void ResetXY() {
  71.         X = 0;
  72.         Y = 0;
  73.     }
  74.  
  75.     private static void ResetValue() {
  76.         Value = 0;
  77.     }
  78.  
  79.     private static void Complete(Player c) {
  80.         c.getClient().sendMessage("You successfully thieve from the @blu@"+Name+" Stall@bla@.");
  81.         c.getClient().sendMessage("You receive @blu@"+ xp +"@bla@ EXP.");
  82.         c.getClient().sendMessage("You receive @blu@"+ Value +" Coins@bla@.");
  83.     }
  84.  
  85.     private static void NotComplete(Player c) {
  86.         c.getClient().sendMessage("You failed to thieve from the @blu@"+Name+" Stall@bla@.");
  87.         c.getClient().sendMessage("Therefor you get@blu@ 0 Exp@bla@.");
  88.         CallResets(c);
  89.     }
  90.    
  91.     private static void CallResets(Player player) {
  92.         ResetValue();
  93.         resetXP();
  94.         ResetXY();
  95.     }
  96.  
  97.     private static void GiveTokens(Player player) {
  98.         player.TeleTokens +=1;
  99.         player.getClient().sendMessage("You receive: 1 Tele Token.");
  100.         player.getClient().sendMessage("You now have: "+player.TeleTokens+"");
  101.     }
  102.  
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement