SilabGarza - RS Private Server  
Home Forum Play Register Store Market Highscores Mark Forums Read
Go Back   SilabGarza - RS Private Server > SilGar Media > Computers > Programming
Reload this Page [PI] Degrading essence pouches


[PI] Degrading essence pouches
Old
  (#1 (permalink))
phl0w is Offline
ARE YOU MAD?
image
 
phl0w's Avatar
 
Posts: 59
Cookies Given: 0
Cookies Received: 0
Time Online: 20 h 55 m
   
Default [PI] Degrading essence pouches - 01-24-2012, 12:11 PM

Classes modified: PlayerAssistant, Player, ItemClick2, ClickItem

PlayerAssistant.java:
Find
Code:
	public void fillPouch(int pouchID) {
Replace the method with
Code:
	public void fillPouch(int pouchID) {
		if (pouchID < 0) {
			return;
		}
		if (c.pouches[pouchID] - c.POUCH_SIZE[pouchID] == 0) {
			c.sendMessage("This pouch is full.");
			return;
		}
		if (c.getItems().getItemCount(1436) == 0) {
			c.sendMessage("You have no essence you can fill this pouch with.");
			return;
		}
		int toAdd = c.POUCH_SIZE[pouchID] - c.pouches[pouchID];
		if (toAdd > c.getItems().getItemAmount(1436)) {
			toAdd = c.getItems().getItemAmount(1436);
		}
		if (toAdd > c.POUCH_SIZE[pouchID] - c.pouches[pouchID]) {
			toAdd = c.POUCH_SIZE[pouchID] - c.pouches[pouchID];
		}
		if (toAdd > 0) {
			c.getItems().deleteItem(1436, toAdd);
			c.pouches[pouchID] += toAdd;
			int spaceLeft = c.POUCH_SIZE[pouchID] - c.pouches[pouchID];
			c.sendMessage(spaceLeft == 0 ? "The pouch can hold no more essence." : "The pouch can hold "+spaceLeft+" more essence.");
		}
	}
Then, find
Code:
	public void emptyPouch(int i) {
Replace that method with:
Code:
	public void emptyPouch(int i) {
		if (i < 0)
			return;
		int toAdd = c.pouches[i];
		if (toAdd > c.getItems().freeSlots()) {
			toAdd = c.getItems().freeSlots();
		}
		if (toAdd > 0) {
			c.getItems().addItem(1436, toAdd);
			c.pouches[i] -= toAdd;
		} else {
			c.sendMessage("This pouch is empty.");
		}
	}
Player.java:
Find
Code:
public int[] pouches
Increase size to 6 like so:
Code:
	public int[] pouches = new int[6];
Find
Code:
public final int[] POUCH_SIZE
then replace array with
Code:
	public final int[] POUCH_SIZE = {3, 6, 9, 12, 3, 5, 9};
ItemClick2.java:
Find
Code:
			c.getPA().checkPouch(pouch);
Replace all code around it with
Code:
		if (itemId >= 5509 && itemId <= 5515) {
			int pouch = -1;
			switch (itemId) {
			case 5509:
				pouch = 0;
				break;
			case 5510:
				pouch = 1;
				break;
			case 5512:
				pouch = 2;
				break;
			case 5514:
				pouch = 3;
				break;
			case 5511:
				pouch = 4;
				break;
			case 5513:
				pouch = 5;
				break;
			case 5515:
				pouch = 6;
			}
			c.getPA().checkPouch(pouch);
		}
ClickItem.java:
find
Code:
if (itemId >= 5509 && itemId <= 5514) {
			int pouch = -1;
			int a = itemId;
			if (a == 5509)
				pouch = 0;
			if (a == 5510)
				pouch = 1;
			if (a == 5512)
				pouch = 2;
			if (a == 5514)
				pouch = 3;
			c.getPA().fillPouch(pouch);
			return;
		}
Replace with:
Code:
		if (itemId >= 5509 && itemId <= 5514) {
			int pouch = -1;
			int brokenPouchId = -1;
			int amtOfEssence = c.getItems().getItemCount(1436);
			switch (itemId) {
			case 5509: //Non-degraded small pouch
				pouch = 0;
				break;
			case 5510: //Non-degraded medium pouch
				brokenPouchId = 5511;
				pouch = 1;
				break;
			case 5512: //Non-degraded large pouch
				pouch = 2;
				brokenPouchId = 5513;
				break;
			case 5514: //Non-degraded giant pouch
				pouch = 3;
				brokenPouchId = 5515;
				break;
			case 5511: //Degraded medium pouch
				pouch = 4;
				break;
			case 5513: //Degraded large pouch
				pouch = 5;
				break;
			case 5515: //Degraded giant pouch
				pouch = 6;
				break;
			}
			if (amtOfEssence > 0) {
				if (Misc.random(2) == 1 && brokenPouchId > 0) {
					c.getItems().deleteItem(itemId, 1);
					c.getItems().addItem(brokenPouchId, 1);
					c.sendMessage("Your pouch has degraded!");
					switch (brokenPouchId) {
					case 5511:
						pouch = 4;
						break;
					case 5513:
						pouch = 5;
						break;
					case 5515:
						pouch = 6;
						break;
					default:
						pouch = -1;
						break;
					}
				}
			}
			c.getPA().fillPouch(pouch);
			return;
		}
Hope you like, wasn't too hard to make but I see many servers that don't have it while they strive to be just like runescape




~[email protected]
  
Old
  (#2 (permalink))
caliban is Offline
Senior Member
image
 
caliban's Avatar
 
Posts: 5,174
Cookies Given: 32
Cookies Received: 27
Time Online: 40 d 1 h 44 m
Clan: Butt Pirates.
   
Default 01-24-2012, 12:13 PM

I don't exactly know what you're doing for us, but I get the feeling it's good.
Thank you.




  
Old
  (#3 (permalink))
phl0w is Offline
ARE YOU MAD?
image
 
phl0w's Avatar
 
Posts: 59
Cookies Given: 0
Cookies Received: 0
Time Online: 20 h 55 m
   
Default 01-24-2012, 12:22 PM

I'm not doing anything for you, just releasing stuff I've programmed. :P




~[email protected]
  
Old
  (#4 (permalink))
caliban is Offline
Senior Member
image
 
caliban's Avatar
 
Posts: 5,174
Cookies Given: 32
Cookies Received: 27
Time Online: 40 d 1 h 44 m
Clan: Butt Pirates.
   
Default 01-24-2012, 12:25 PM

And I suppose this is to be incorperated into the server?
I have no idea if the server is based on PI or not, but if these are all fixes/ updates that would be wicked.




  
Old
  (#5 (permalink))
phl0w is Offline
ARE YOU MAD?
image
 
phl0w's Avatar
 
Posts: 59
Cookies Given: 0
Cookies Received: 0
Time Online: 20 h 55 m
   
Default 01-24-2012, 12:28 PM

Nope. I don't think Travis knows me outside of hacking.rs




~[email protected]
  
Old
  (#6 (permalink))
Brendan is Offline
Senior Member
image
 
Brendan's Avatar
 
Posts: 5,003
Cookies Given: 270
Cookies Received: 342
Time Online: 47 d 15 h 1 m
   
Default 01-24-2012, 09:03 PM

This looks like it degrades the pouches that hold rune essence over time / use. At least that's what I got from it all.

I'm not sure people use pouches to rc in game anyways, but this could be a cool little update for them i guess.

Good job programming it though. It looks pretty solid.


ball cancer too, douches.
  
Old
  (#7 (permalink))
Iamdominic is Offline
Senior Member
image
 
Iamdominic's Avatar
 
Posts: 294
Cookies Given: 0
Cookies Received: 0
Time Online: 1 d 3 h 16 m
Clan: None Atm
   
Default 01-25-2012, 12:17 AM

Good job programming, looking good.


Iamdominic's Signature
Useful Links:

Webclient: http://sg-forum.com/showthread.php?t=71875
donate: http://playsilab.com/paypal/benefits.php
vote: http://playsilab.com/v/vote.php


Chatbox all day, every day.

  
Old
  (#8 (permalink))
MageTank is Offline
PvM

image
 
MageTank's Avatar
 
Posts: 374
Cookies Given: 4
Cookies Received: 12
Time Online: 3 d 19 h 22 m
Clan: Imperium
   
Default 03-04-2012, 04:16 PM

Damn son, you're skilled. Keep it up.


  
Old
  (#9 (permalink))
Im Teh Noob is Offline
image
 
Im Teh Noob's Avatar
 
Posts: 127
Cookies Given: 0
Cookies Received: 0
Time Online: 1 d 23 h 10 m
   
Default 03-09-2012, 09:58 AM

Looks like a lot of code to add for just a degrading essence pouch. Won't get much use imo. :S
  
adsense code2.3
Closed Thread

Bookmarks

[PI] Degrading essence pouches

Programming




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
adsense2.6
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 12:00 AM.





Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.