Jump to content
Sign in to follow this  
trees

[PI] Hand Cannon - Copy and Paste

Recommended Posts

[QUOTE][CENTER]In order to use this you need 602 animations/gfx and Hand cannon shots + Hand cannon in your server!
Assumed Knowledge:
Copy And Pasting.
Posting feedback.
Difficulty 1/10. (If you have any knowledge of reading/c+p.
Tested on: FormationX[/QUOTE]

[COLOR="#008000"]Trees[/COLOR] takes [B]no credit[/B] for this except for reformatting the thread for RL. I saw someone asking about this on the help thread and decided to post it here.

Firstly open your combatassistant.java

[Spoiler=CombatAssist.java]
[CODE]public void attackNpc(int i) {[/CODE]

Under that add;
[CODE]
if (c.playerEquipment[c.playerWeapon] == 15241) {
c.gfx0(2138);
}
if(c.playerEquipment[c.playerWeapon] == 15241 && 15243 != c.playerEquipment[c.playerArrows]){
c.sendMessage("You can't use Hand Cannon without the shots! (You dumb?)");
return;
}[/CODE]

Next find (Still in combatassistant.java:
[CODE]public void attackPlayer(int i) {[/CODE]

And once again below that add;
[CODE]
if (c.playerEquipment[c.playerWeapon] == 15241) {
c.gfx0(2138);
}
if(c.playerEquipment[c.playerWeapon] == 15241 && 15243 != c.playerEquipment[c.playerArrows]){
c.sendMessage("You can't use Hand Cannon without the shots! (You dumb?)");
return;
}[/CODE]

Next find in combatassistant.java still (This is optional if u dont have it dw about it).
[CODE]
for (int u : c.Bolts) {
for (int y : c.BOWS) {[/CODE]

And replace it with.
[CODE]
for (int u : c.Bolts) {
for (int y : c.BOWS) {
if(y == c.playerEquipment[c.playerWeapon] && c.playerEquipment[c.playerWeapon] != 9185 && u == c.playerEquipment[c.playerArrows] && c.playerEquipment[c.playerWeapon] != 15241 && u == c.playerEquipment[c.playerArrows]){
c.sendMessage("You can only use arrows with this bow.");
return;
}
}
}[/CODE]

Next still in combatassistant.java find;
[CODE]
c.sendMessage("You have run out of arrows!");[/CODE]

Above that add.
[CODE]
if(c.playerEquipment[c.playerWeapon] == 15241)
c.sendMessage("You have run out of Shots!");
else[/CODE]

Still in combatassistant.java find:

[CODE]public void fireProjectilePlayer() {[/CODE]

Replace that with.

[CODE]public void fireProjectilePlayer() {
if(c.oldPlayerIndex > 0) {
if(Server.playerHandler.players[c.oldPlayerIndex] != null) {
c.projectileStage = 2;
int pX = c.getX();
int pY = c.getY();
int oX = Server.playerHandler.players[c.oldPlayerIndex].getX();
int oY = Server.playerHandler.players[c.oldPlayerIndex].getY();
int offX = (pY - oY)* -1;
int offY = (pX - oX)* -1;
if(c.playerEquipment[c.playerWeapon] == 15241) {
if(!c.specGfx) {
c.gfx0(2138);
}
c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 55, getRangeProjectileGFX(), 22, 22, c.oldPlayerIndex - 1, getStartDelay(), -1);
c.handCannonDestory();
c.specGfx = false;
} else if(!c.msbSpec)
c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, getProjectileSpeed(), getRangeProjectileGFX(), 43, 31, - c.oldPlayerIndex - 1, getStartDelay());
else if (c.msbSpec) {
c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, getProjectileSpeed(), getRangeProjectileGFX(), 43, 31, - c.oldPlayerIndex - 1, getStartDelay(), 10);
c.msbSpec = false;
}
if (usingDbow())
c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, getProjectileSpeed(), getRangeProjectileGFX(), 60, 31, - c.oldPlayerIndex - 1, getStartDelay(), 35);
}
}
}
[/CODE]

Next still in combatassistant.java find;
[CODE]
case 1215: // dragon daggers
case 1231:
case 5680:
case 5698:
c.gfx100(252);
c.startAnimation(1062);
c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
c.doubleHit = true;
c.specAccuracy = 1.30;
c.specDamage = 1.05;
break;[/CODE]

Above that add.

[CODE]
case 15241: // hand cannon spec!!
c.usingBow = true;
c.rangeItemUsed = c.playerEquipment[c.playerArrows];
c.getItems().deleteArrow();
c.lastWeaponUsed = weapon;
c.startAnimation(12175);
c.specAccuracy = 8.5;
c.specDamage = 2.25;
c.hitDelay = 5;
c.attackTimer-= 7;
c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
if (c.fightMode == 2)
if (c.playerIndex > 0)
fireProjectilePlayer();
else if (c.npcIndex > 0)
fireProjectileNpc();
break;[/CODE]

Still in combatassistant.java find:
[CODE]
case 4151:
case 11694:
case 11698:
case 4153:
case 15241:
case 14484:
if(c.specAmount >= 5) {
c.specAmount -= 5;
c.getItems().addSpecialBar(weapon);
return true;
}
return false;[/CODE]

Below that add

[CODE]case 15241:[/CODE]

Next in combatassistant.java find:

[CODE]
public void getPlayerAnimIndex(String weaponName){[/CODE]

Somewhere in there add.

[CODE]
case 15241:
c.playerStandIndex = 12155;
c.playerWalkIndex = 12154;
c.playerRunIndex = 12154;
break;[/CODE]

Next find in combatassistant.java:

[CODE]public int getWepAnim(String weaponName) {[/CODE]

Somewhere in there add.
[CODE]
case 15241:
return 12153;[/CODE]

Keep searching for in combatassistant.java:

[CODE]public int getBlockEmote() {[/CODE]

Below that add.

[CODE]case 15241:
return 1666;[/CODE]

Find.
[CODE]public int getAttackDelay(String s) {[/CODE]

add This somewhere in there.
[CODE]
case 15241:
return 9;[/CODE]

Next find still in combatassistant.java:

[CODE]public int rangeMaxHit() {
[/CODE]

below that add.

[CODE]int weapon = c.playerEquipment[c.playerWeapon];[/CODE]

And under

[CODE]if (c.fullVoidRange()) {[/CODE]

Add.
[CODE]if(weapon == 15241)
b *= 1.35;[/CODE]

Next find still in combatassistant.java:

[CODE]public int correctBowAndArrows() {[/CODE]

Below that add.

[CODE]case 15241://hand cannon with Shots
return 15243;[/CODE]

Next still in combatassistant.java find;


[CODE]switch(c.rangeItemUsed) {[/CODE]

Above that add.

[CODE]if (c.playerEquipment[c.playerWeapon] == 15241)
return 2143;[/CODE]
Now find;

[CODE]public int getStartDelay() {[/CODE]

Right under that like seriously right under it add.

[CODE]if(c.playerEquipment[c.playerWeapon] == 15241)
return 30;[/CODE]

Still In combatassistant.java find:

[CODE]public int getRangeStr(int i) {[/CODE]

Replace it with:
[CODE]
public int getRangeStr(int i) {
int str = 0;
int[][] data = {
{877, 10}, {9140, 46}, {9145, 36}, {9141, 64},
{9142, 82}, {9143,100}, {9144,115}, {9236, 14},
{9237, 30}, {9238, 48}, {9239, 66}, {9240, 83},
{9241, 85}, {9242,103}, {9243,105}, {9244,117},
{9245,120}, {882, 7}, {884, 10}, {886, 16},
{888, 22}, {890, 31}, {892, 49},{15243, 60}, {4740, 55},
{11212, 60}, {806, 1}, {807, 3}, {808, 4},
{809, 7}, {810,10}, {811,14}, {11230,20},
{864, 3}, {863, 4}, {865, 7}, {866, 10},
{867, 14}, {868, 24}, {825, 6}, {826,10},
{827,12}, {828,18}, {829,28}, {830,42},
{800, 5}, {801, 7}, {802,11}, {803,16},
{804,23}, {805,36}, {9976, 0}, {9977, 15},
{4212, 70}, {4214, 70}, {4215, 70}, {4216, 70},
{4217, 70}, {4218, 70}, {4219, 70}, {4220, 70},
{4221, 70}, {4222, 70}, {4223, 70}, {6522, 49},
{10034, 15},
};
for(int l = 0; l < data.length; l++) {
if(i == data[l][0]) {
str = data[l][1];
}
}
return str;
}[/CODE]

Still in combatassistant.java find:

[CODE]} else if (Arrows == 11212) {//dragon arrows[/CODE]

Above that add:

[CODE]} else if (Arrows == 15243) {//Hand cannon shots
rangehit = 4;
rangehit += c.playerLevel[4] / 6;
[/CODE]
[/spoiler]

Now open Client.java
[Spoiler=Client.java]
In client.java add;

[CODE]public void handCannonDestory() {
cannonTimer = 0;
int chance = playerLevel[playerFiremaking] * 5 + 25;
if(specGfx)
chance/=2;
if(Misc.random(chance) == 1)
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer c) {
if(cannonTimer <= 0) {
gfx0(2140);
playerEquipment[playerWeapon] = -1;
sendMessage("Your hand cannon explodes LMFAO!");
int damage = Misc.random(15) + 1;
setHitDiff(damage);
setHitUpdateRequired(true);
dealDamage(Misc.random(15) + 1);
updateRequired = true;
getItems().sendWeapon(playerEquipment[playerWeapon], getItems().getItemName(playerEquipment[playerWeapon]));
getCombat().getPlayerAnimIndex(getItems().getItemName(playerEquipment[playerWeapon]).toLowerCase());
getItems().resetBonus();
getItems().getBonus();
getItems().writeBonus();
getPA().requestUpdates();getOutStream().createFrame(34);
getOutStream().writeWord(6);
getOutStream().writeWord(1688);
getOutStream().writeByte(playerWeapon);
getOutStream().writeWord(0);
getOutStream().writeByte(0);
updateRequired = true;
setAppearanceUpdateRequired(true);
c.stop();
} else {
cannonTimer--;
}
}
}, 500);
}
public boolean specGfx = false;
public void handCannonSpec() {
cannonTimer = 0;
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer c) {
cannonTimer--;
if(cannonTimer == 0) {
gfx0(2141);
specGfx = true;
}
if(cannonTimer == 1) {
if (playerIndex > 0)
getCombat().fireProjectilePlayer();
else if (npcIndex > 0)
getCombat().fireProjectileNpc();
c.stop();
}
}
}, 25);
}[/CODE]

Oh and declare this in client.java aswell;

[CODE]public int cannonTimer = 0;[/CODE]
[/spoiler]

Now open Itemassistant.java
[Spoiler=ItemAssist.java]
In Itemassistant.java find;

[CODE]public void sendWeapon(int Weapon, String WeaponName) {[/CODE]

In there you should find something like.

[CODE]} else if (WeaponName.endsWith("bow") || WeaponName.endsWith("10") || c.playerEquipment[c.playerWeapon] == 15015 || c.playerEquipment[c.playerWeapon] == 15016 || WeaponName.endsWith("full") || WeaponName.startsWith("seercull")) {[/CODE]

Replace that with;

[CODE]} else if (WeaponName.endsWith("bow") || WeaponName.endsWith("10") || c.playerEquipment[c.playerWeapon] == 15015 || c.playerEquipment[c.playerWeapon] == 15241 || c.playerEquipment[c.playerWeapon] == 15016 || WeaponName.endsWith("full") || WeaponName.startsWith("seercull")) {[/CODE]

Next still in itemassistant.java find;

[CODE]case 11284:
case 11283:
c.defenceLevelReq = 75;
return;[/CODE]

In there add;

[CODE]case 15241: //hand cannon
c.rangeLevelReq = 61;
break;[/CODE]

Still in there find;

[CODE]case 859: // magic bows
case 861:[/CODE]

In below them add.

[CODE]case 15241:
[/CODE]

In player.java find

[CODE]public final int[] BOWS =[/CODE]

In that array Add, 15241
Now find

[CODE]public final int[] ARROWS =[/CODE]

In that array add, 15243.

If you do not understand replace urs with mine.

[CODE]public final int[] BOWS = {15241,9185,839,845,847,851,855,859,841,843,849,853,857,861,4212,4214,4215,11235,4216,4217,4218,4219,4220,4221,4222,4223,6724,4734,4934,4935,4936,4937};
public final int[] ARROWS = {15243,882,884,886,888,890,892,4740,11212,9140,9141,4142,9143,9144,9240,9241,9242,9243,9244,9245};
[/CODE]
[/spoiler]

If you get setHitDiff(Damage); Error then replace the current handCannon destroy method in client.java with this one below
Mainly an error on FormationX V3. But if you get it use this one /:

[spoiler=Destroy method && Spec method]
[CODE]public void handCannonDestory() {
cannonTimer = 0;
int chance = playerLevel[playerFiremaking] * 5 + 25;
if(specGfx)
chance/=2;
if(Misc.random(chance) == 1)
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer c) {
if(cannonTimer <= 0) {
gfx0(2140);
playerEquipment[playerWeapon] = -1;
sendMessage("Your hand cannon explodes LMFAO!");
int damage = Misc.random(15) + 1;
hitDiff = new Hit(damage, CombatType.RANGE);
setHitUpdateRequired(true);
dealDamage(Misc.random(15) + 1);
updateRequired = true;
getItems().sendWeapon(playerEquipment[playerWeapon], getItems().getItemName(playerEquipment[playerWeapon]));
getCombat().getPlayerAnimIndex(getItems().getItemName(playerEquipment[playerWeapon]).toLowerCase());
getItems().resetBonus();
getItems().getBonus();
getItems().writeBonus();
getPA().requestUpdates();getOutStream().createFrame(34);
getOutStream().writeWord(6);
getOutStream().writeWord(1688);
getOutStream().writeByte(playerWeapon);
getOutStream().writeWord(0);
getOutStream().writeByte(0);
updateRequired = true;
setAppearanceUpdateRequired(true);
c.stop();
} else {
cannonTimer--;
}
}
}, 500);
}
public boolean specGfx = false;
public void handCannonSpec() {
cannonTimer = 0;
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer c) {
cannonTimer--;
if(cannonTimer == 0) {
gfx0(2141);
specGfx = true;
}
if(cannonTimer == 1) {
if (playerIndex > 0)
getCombat().fireProjectilePlayer();
else if (npcIndex > 0)
getCombat().fireProjectileNpc();
c.stop();
}
}
}, 25);
}[/CODE]
[/spoiler]


We are all done now.[/CENTER] Edited by trees

Share this post


Link to post
Share on other sites
[quote name='thebadman']I don't have a 'combatassistant.java'[/QUOTE]

The packages might be renamed but its all the same brother.

Share this post


Link to post
Share on other sites
Tnx man, really helped.

Share this post


Link to post
Share on other sites
[quote name='dipons']Tnx man, really helped.[/QUOTE]

No problem brotha.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×