Ultimate Empire
BattleForums Addict
- Joined
- May 18, 2003
- Messages
- 701
- Reaction score
- 0
I've decided to start releasing old code that BFHS or myself kept private. I will do this every so often as different code become abandonware/obsolete/cool to look at.
My first release is bulletTime which took advantage of the dead body bug. Where, if a person precisley stood on top of their own (or someone elses) dead body...they would be immune to ANY ranged/ranged magical attack from ANYONE. I'm not sure if this bug has been fixed or not.
The code for the module bulletTime 0.2, is designed to stand over your own dead body (once you've been killed) and lock you there (impossible to move by accident) so you can fire your own ranged attacks, until you choose to move by typing in an unlock command or teleporting/leaping or getting damaged (melee or if for some reason you get hit by ranged attack).
I will be posting comments/editing this post in the future.
Remember to source myself and BFHS if you use this code in anyway.
Thanks, and enjoy!
My first release is bulletTime which took advantage of the dead body bug. Where, if a person precisley stood on top of their own (or someone elses) dead body...they would be immune to ANY ranged/ranged magical attack from ANYONE. I'm not sure if this bug has been fixed or not.
The code for the module bulletTime 0.2, is designed to stand over your own dead body (once you've been killed) and lock you there (impossible to move by accident) so you can fire your own ranged attacks, until you choose to move by typing in an unlock command or teleporting/leaping or getting damaged (melee or if for some reason you get hit by ranged attack).
I will be posting comments/editing this post in the future.
Remember to source myself and BFHS if you use this code in anyway.
Thanks, and enjoy!
Code:
////////////////////////////////////////////////////////////////////////////
// bulletTime 0.2 by Ultimate Empire and BFHS
////////////////////////////////////////////////////////////////////////////
//This is the statement that links your module to the d2hackit framework.
//When compiling your source, make sure it is in the same directory as
//Or one directory above this file. (This means you need to get the source code
//for D2hackit)
#include "ClientCore.cpp"
//Boolean variables
//If player has died yet (true if they can use their dead body/false otherwise)
bool KilledPlayer=false;
//TRUE if player has typed .bt go
bool commanded=false;
//TRUE if player has successfully moved ontop of their dead body
bool stuck=false;
//TRUE if player is in process of moving to body
bool damn=false;
//TRUE if their health is 'ok' (unchanged)
bool ok=false;
//TRUE if the person attempts a teleports away from body
bool teleported=false;
//Strings don't really exist in C++ or anywhere for that matter
//So we use an array of characters to output lines of text
char Msg1[256];
char Msg2[256];
char Msg3[256];
char PID[256];
//Packets in d2hacket or of type BYTE, these are like the ones you manually
//send with d2hackit in game, but in c++ format
BYTE attack[5]={0x05,0,0,0,0};
BYTE xypos[5]={0x03,0,0,0,0};
BYTE BID[4]={0,0,0,0};
BYTE pickup[]={0x13,0,0,0,0,0,0,0,0};
BYTE MyPosX[2]={0,0};
BYTE MyPosY[2]={0,0};
BYTE ForceRun[11]={0x15,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
BYTE teleport[4]={0,0,0,0};
BYTE warpto[4]={0,0,0,0};
BYTE attempt[11]={0x15,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
BYTE bodylocal[11]={0x15,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//Standard integers
int PacketOne;
int health;
int hmedian=1;
int comp1;
int comp2;
THISGAMESTRUCT* thisgame;
////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS
BOOL PRIVATE OnGameCommandGo(char** argv, int argc);
BOOL PRIVATE OnGameCommandUnstuck(char** argv, int argc);
BOOL PRIVATE OnGameCommandMatrix(char** argv, int argc);
CLIENTINFO
(
0,2, // Module version (Major, Minor)
"Ultimate Empire and the BFHS", // Author
"battleforums.com", // url (http:// is appended)
"Bullet Time", // Short module description
"" // Author eMail
)
////////////////////////////////////////////////////////////////////////////
// Module Commands
////////////////////////////////////////////////////////////////////////////
MODULECOMMANDSTRUCT ModuleCommands[]=
{
{
"help",
OnGameCommandHelp,
"helpÿc0 List commands available in this module.\n"
"<command> helpÿc0 Shows detailed help for <command> in this module."
},
{
// MyCommand
"entermatrix", // command users use to call MyCommand
OnGameCommandMatrix, // the function name
"Main Help Function" // command description
},
{
// Go
"go",
OnGameCommandGo,
"Runs and stands on your corpse."
},
{
// Unstuck
"run",
OnGameCommandUnstuck,
"Allows movement from invincible position."
},
{NULL}
};
// called about every 10th of a second
DWORD EXPORT OnGameTimerTick(VOID)
{
return true;
} /
//////////////////////////////////////////////////////////////////////
// OnGameJoin - Introduction
//////////////////////////////////////////////////////////////////////
VOID EXPORT OnGameJoin(THISGAMESTRUCT* aThisgame) {
thisgame = aThisgame;
stuck=false;
server->GamePrintInfo("What are you saying... that I can dodge bullets?");
server->GamePrintInfo("No, Neo. I'm telling you that when you're ready, you won't have to.");
server->GamePrintInfo("");
server->GamePrintInfo("ÿc0Type ÿc2.bt entermatrix ÿc0 to learn the ways...");
server->GamePrintInfo("Or proceed to phase 2 if you are familiar.");
server->GamePrintInfo("You are currently: ÿc1VULNERABLE");
server->GamePrintInfo("You are currently: ÿc1VULNERABLE");
return;
}
////////////////////////////////////////////////////////////////////////
// outgoing
////////////////////////////////////////////////////////////////////////////
//
DWORD EXPORT OnGamePacketBeforeSent(BYTE* aPacket, DWORD aLen)
{
//If the person moves or teleports (or leaps??)
//Tell them that they are now vulnerable
if ((aPacket[0] == 0x0c) && (stuck))
{
memcpy(teleport,aPacket+1,4);
memcpy(warpto,ForceRun+6,4);
if ((char *)teleport == (char *)attempt)
{
stuck=false;
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
}
}
if ((aPacket[0] == 0x66) || (aPacket[0] == 0x41))
{
stuck=false;
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
return true;
}
if ((aPacket[0] == 0x01) && (stuck) || (aPacket[0] == 0x03) && (stuck) || (aPacket[0] == 0x04) && (stuck)) // Copy down the person's location
for future reference
{
server->GameSendPacketToGame(ForceRun, 11);
return false;
}
return aLen;
}
////////////////////////////////////////////////////////////////////////////
// incoming
////////////////////////////////////////////////////////////////////////////
DWORD EXPORT OnGamePacketBeforeReceived(BYTE* aPacket, DWORD aLen)
{
//Check for changes in health
//If they are getting hit when they are supposed to be in bullettime mode
//then tell them they are vulnerable.
if (aPacket[0] == 0x95)
{
health = *((WORD *)(aPacket + 1)) & 0x0FFF;
if (hmedian >> health)
{
ok=true;
}
if (hmedian <= health)
{
ok=false;
hmedian = health;
}
if ((stuck) & (ok))
{
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1Health Rel");
ok=false;
stuck=false;
}
}
//If they are where they should be by typing .bt go then they will be
//stcuk in place and invincible to ranged attacks
if ((aPacket[0] == 0x96) && (aPacket[7] == 0) && (aPacket[8] == 0) && (commanded))
{
stuck=true;
server->GameSendPacketToServer(pickup, 9);
commanded=false;
server->GamePrintInfo("ÿc2>;===--- - ! BULLET TIME ! - ---===;<");
server->GamePrintInfo("ÿc2>;===--- - ! BULLET TIME ! - ---===;<");
server->GamePrintInfo("ÿc2>;===--- - ! BULLET TIME ! - ---===;<");
hmedian=health - 1;
return true;
}
if (aPacket[0] == 0x15)
{
//THESE WERE MY ATTEMPTS AT TELEPORTS TURNING OFF THE STUCK
if (damn)
{
memcpy(bodylocal,aPacket,11);
damn=false;
}
if (stuck)
{
memcpy(attempt,aPacket,11);
if ((char *)teleport == (char *)attempt)
{
stuck=false;
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
}
}
if (teleported)
{
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
stuck=false;
}
}
if (aPacket[0] == 0x5a)
{
//When you first die, instruct user to stand near body and type .bt go
sprintf(Msg1, "%s", (char*) (aPacket+8));
sprintf(PID, "%s", &thisgame->player->PlayerName[0]); //PID is the Player's name
if (strcmpi(Msg1,PID) == 0)
{
server->GamePrintInfo("ÿc3You have died. Now resurrect yourself and go stand within viewable range of your body");
server->GamePrintInfo("ÿc3then type ÿc2.bt go");
KilledPlayer=true;
}
return true;
}
//Takes note of where you died so module can go back there...duh!
//
if ((aPacket[0] == 0x59) && (KilledPlayer)) {
int posstart;
posstart=((int)aLen)-4;
memcpy(xypos+1,aPacket+posstart,4);
memcpy(BID,aPacket+1,4);
memcpy(pickup+5,BID,4);
KilledPlayer=false;
return true;
}
return aLen;
}
////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS
////////////////////////////////////////////////////////////////////////////
// Record
BOOL PRIVATE OnGameCommandGo(char** argv, int argc)
{
//server->GamePrintInfo("Moving to dead body");
damn=true;
memcpy(ForceRun+2, &thisgame->player->PlayerID, 4); // playerID
server->GameSendPacketToServer(xypos, 5);
memcpy(ForceRun+6,xypos+1,4);
server->GameSendPacketToGame(ForceRun, 11);
commanded=true;
return true;
}
BOOL PRIVATE OnGameCommandUnstuck(char** argv, int argc)
{
stuck=false;
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
server->GamePrintInfo("ÿc1VULNERABLE");
return true;
}
BOOL PRIVATE OnGameCommandMatrix(char** argv, int argc)
{
stuck=false;
server->GamePrintInfo("Welcome to the Matrix. Prepare to learn the art of BulletTime.");
server->GamePrintInfo("Follow these instructions to successful dodge missile attacks (NOT MELEE)");
server->GamePrintInfo("1. The first step is to kill yourself so we have a body to work with. Go let someone kill you.");
server->GamePrintInfo("2. After that, go within range of your body within an unobstructed view and type ÿc2.bt go");
server->GamePrintInfo("3. After that, you will be immune to missile attacks, but only if you stay in one place.");
server->GamePrintInfo("4. You can unlock yourself by typing ÿc2.bt run ÿc0 or by getting hit by a melee attack.");
server->GamePrintInfo("DO NOT: Teleport, Leap, Warp, etc. while locked. You have been warned.");
return true;
}