PDA

View Full Version : [317] 85% Weapon poison handler [317]



icereign2
June 21st, 2010, 23:37
The handler was made by Ownerblade when the forums were in its earlier stages
the poisononitem was made by me.

To get started,
Make a new Text file called weppoison.java paste this in it.
Only the registered members can see the link. code was two big to post.
Then in server.java search:

public static ArrayList objects = new ArrayList();

Right under that paste this:

public static weppoison weppoison = null;

Then search for:

itemHandler = new ItemHandler();
And under it add:

weppoison = new weppoison();
Then in client.java search for:

int itemUsed = playerItems[itemUsedSlot] - 1;
And under it add:

server.weppoison.weppoison(playerId,useWith,itemUs ed);

50% -- to owner blade for making the awsome handler 50% -- to me for making the huge poisoning code.

If you think theres a better way to do it please don't rant about it on the thread please.

XxBryantD
June 21st, 2010, 23:39
looks good ill try when im done with working on webclient

icereign2
June 21st, 2010, 23:54
looks good ill try when im done with working on webclient

thanks and gl with the webclient. ;)

Malik
June 22nd, 2010, 01:03
Im doing this right now ;) If it works thanks a bunch X)

icereign2
June 22nd, 2010, 01:38
Im doing this right now ;) If it works thanks a bunch X)

Np malik thanks for using it :D

Canownueasy`
June 22nd, 2010, 03:04
public void posionWeapon(Player p, int itemUsed, int usedWith, int itemToGet, int potToGet) {
c.deleteItem(usedWith, c.getItemSlot(usedWith), 15);
c.deleteItem(itemUsed, c.getItemSlot(itemUsed), 1);
c.addItem(itemToGet, 1);
c.addItem(potToGet, 1);
}
Hardcode some more?

And for the data you would use an enum or array (i'd go with enum)

Trey
June 22nd, 2010, 03:08
public void posionWeapon(Player p, int itemUsed, int usedWith, int itemToGet, int potToGet) {
c.deleteItem(usedWith, c.getItemSlot(usedWith), 15);
c.deleteItem(itemUsed, c.getItemSlot(itemUsed), 1);
c.addItem(itemToGet, 1);
c.addItem(potToGet, 1);
}
Hardcode some more?

And for the data you would use an enum or array (i'd go with enum)

Why the hell would you use an enum in this situation? Using an enum or array is still hardcoding in a sense. This can be easily reduced by just writing a method and either using a switch, or using arrays (much less code, but slower because you'd have to loop, making it O(N), but the amount of code it would reduce makes it worth it in my opinion).

And learn some naming conventions, weppoisen is horrible.

icereign2
June 22nd, 2010, 03:08
Although I wasn't ranting, I was just stating something. I'm sorry if you overreacted about this. >_>

i didnt overreact at all, if you would of read it first then you would of known...its not like i just go on your threads and say that is horrible.
but yeah thanks for the appologie

Canownueasy`
June 22nd, 2010, 03:10
Why the hell would you use an enum in this situation? Using an enum or array is still hardcoding in a sense. This can be easily reduced by just writing a method and either using a switch, or using arrays (less code, but slower because you'd have to loop, making it O(N)).

It's not as bad as going with 100s of if statements.

And also, enums are faster and are understood easier.

Trey
June 22nd, 2010, 03:11
It's not as bad as going with 100s of if statements.

And also, enums are faster and are understood easier.

Not faster, but easier to read.

icereign2
June 22nd, 2010, 19:53
wow....this is turning in to what i did not want it to turn into lol

Mohammad
June 26th, 2010, 13:35
Dude no offense but if i add that to my client.java it will make it around 20mb...

icereign2
June 26th, 2010, 23:34
Dude no offense but if i add that to my client.java it will make it around 20mb...
what are u talking about


server.weppoison.weppoison(playerId,useWith,itemUs ed);

only goes in client.java......

bahamutskingdom
February 24th, 2012, 00:48
Icereign2 this was a fantastic code. I thank you for allowing the public to use it. I placed it in, and it works wonderfully. I will of course be changing codes to Weapon Poison, and others of the similar nature. But it works 100% I appreciate this immensely, and it has also opened doors in the ability to separate out other things into different pages. Great work!

Naughty`
February 24th, 2012, 00:58
Icereign2 this was a fantastic code. I thank you for allowing the public to use it. I placed it in, and it works wonderfully. I will of course be changing codes to Weapon Poison, and others of the similar nature. But it works 100% I appreciate this immensely, and it has also opened doors in the ability to separate out other things into different pages. Great work!You grave-dug a year and a half old thread just to thank some guy? LOL

bahamutskingdom
February 24th, 2012, 17:18
Yeah. I was taught to give thanks to help and assistance whenever it is given. Did not notice it was a year old, and really don't give a shit either. It is called manners and showing curtsey and respect to others. Something the generations now a days have little if any of.

Sins
February 29th, 2012, 05:05
Cool :)