Description: A base for combat
Difficulty: 2
Assumed Knowledge: The different classes in your 474 server.
Tested Server: Cellkyborg 474
Files/Classes Modified: RSPlayer
Procedure
Step 1:
Open RSPlayer.java and find
Code:
private boolean handleData(int packetType, int packetSize) {
// misc.println("PacketType: "+packetType);
switch (packetType) {
(It may be a partial find)
Underneath add
Code:
case 196:
int attackIndex = inStream.readUnsignedByte();
packetSize--;
//Print remaining packetsize
printBuffer(packetSize);
startAttacking(attackIndex, 8);
break;
Step 2:
Search for
Code:
public void process() {
and above add
Code:
public int attackIndex = -1;
public int attackTimer = -1;
public int attackBackto = -1;
public void startAttacking(int index, int delay){
attackIndex = index;
attackTimer = delay;
attackBackto = delay;
}
public void resetAttacking(){
attackIndex = -1;
attackTimer = -1;
attackBackto = -1;
}
Step 3:
Underneath
Code:
public void process() {
try {
processWalking();
Add
Code:
if(attackIndex > 0){
if(attackTimer > 0) attackTimer--;
if(attackTimer == 0){
attackTimer = attackBackto;
if(server.npcHandler.npcs[attackIndex] != null){
//Add combat code here (Emotes, hitting, ect)
doAnimation(7073, 0);
doGraphics(1223, 0, 0);
}
}
}
Step 4:
Under
Code:
ClientPackets.REGULAR_WALK
Add
Like I say, this is a base, you have to add the rest yourself.
Credits: PKitten