Code:
/******************************************************************************\
*
*
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Feb 25th, 2005 -- Stupid Print Plugin to handle Sysmessages and Exmessage
*
\******************************************************************************/
#include <windows.h>
#include <string.h>
#include "Main.h"
#include "irw.h"
struct stHouseItem
{
char cmd;
char size[2];
unsigned char serial[4];
char cmdsend[2];
char unkown1;
char artid[4];
char unkown2;
unsigned char posx[4];
char unkown3;
unsigned char posy[4];
char unkown4;
};
HINSTANCE DLLInst = NULL;
BOOL Inited = FALSE;
POINT Center;
unsigned int Pserial;
BOOL APIENTRY DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
{
switch(fdwReason)
{
case DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls(hDLLInst);
DLLInst = hDLLInst;
}break;
case DLL_PROCESS_DETACH:
{
/* to make sure the dll wasn't simply loaded and InitPlugin() wasnt called */
if(Inited == TRUE)
UnloadPlugin();
}break;
case DLL_THREAD_ATTACH: break;
case DLL_THREAD_DETACH: break;
}
return TRUE;
}
int InitPlugin(void)
{
if(Inited == TRUE)
return FALSE;
Inited = TRUE;
AddCommand("print", Command_Print);
AddCommand("place", Command_Place);
AddCommand("makechar", MakeChar);
AddCommand("printabove", Command_PrintAbove);
AddCommand("center", Command_center);
return TRUE;
}
void UnloadPlugin(void)
{
if(Inited == FALSE)
return;
return;
}
void Command_center(char **Arg, int ArgCount)
{
Center.x = ArgToInt(Arg[1]);
Center.y = ArgToInt(Arg[2]);
Pserial = GetPlayerSerial();
ClientPrint("%s %d", "Player X ",Center.x);
ClientPrint("%s %d", "Player Y ",Center.y);
ClientPrint("%s %i", "Player Serial ",Pserial);
}
void MakeChar()
{
CreateThread(
NULL,
NULL,
(LPTHREAD_START_ROUTINE ) &TempThread,
NULL,
NULL,
NULL
);
}
void TempThread()
{
unsigned char MakeChar[104] = {0x00 ,0xED ,0xED ,0xED ,0xED ,0xFF ,0xFF ,0xFF ,0xFF ,0x00 ,0x31 ,0x32 ,0x68 ,0x79 ,0x6D ,0x33,
0x35,0x00,0x72,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x0F ,0x00 ,0x00,
0x00 ,0x01 ,0x00 ,0x00 ,0x01 ,0x53 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x22 ,0x24 ,0x0A ,0x2A ,0x32 ,0x11 ,0x32 ,0x00 ,0x00,
0x03 ,0xEA ,0x20 ,0x44 ,0x04 ,0x4E ,0x20 ,0x4D ,0x04 ,0x4E ,0x00 ,0x03 ,0x00 ,0x00 ,0x00 ,0x01,
0xC0 ,0xA8 ,0x01 ,0x66 ,0x00 ,0xDF ,0x03 ,0x54 };
int i;
for(i =0;i<15;i++)
{
Sleep(1000);
ClientPrint("%s %d", "Hi ",i);
}
SendToServer(MakeChar,104);
}
void GetPluginInfo(char *Text, int Size)
{
strncpy(Text, "Print Plugin by Boydon", Size);
return;
}
void Command_Print(char **Arg, int ArgCount)
{
if(ArgCount<2)
{
ClientPrint("Usage: print <text> [color] [font]");
return;
}
if(ArgCount==2)
ClientPrint("%s", Arg[1]);
if(ArgCount==3)
//ClientPrintColor(unsigned short Color, unsigned short Font, char *Text, ...);
ClientPrintColor(ArgToInt( Arg[2] ), 3, "%s", Arg[1]);
if(ArgCount==4)
ClientPrintColor(ArgToInt( Arg[2] ), ArgToInt( Arg[3] ), "%s", Arg[1]);
return;
}
void Command_PrintAbove(char **Arg, int ArgCount)
{
if(ArgCount<2)
{
ClientPrint("Usage: printabove <text> [color] [font]");
return;
}
if(ArgCount==2)
ClientPrintAbove(GetPlayerSerial(), "%s", Arg[1]);
if(ArgCount==3)
//void ClientPrintAboveColor(unsigned int Serial, unsigned short Color, unsigned short Font, char *Text, ...);
ClientPrintAboveColor(GetPlayerSerial(), ArgToInt( Arg[2] ), 3, "%s", Arg[1]);
if(ArgCount==4)
ClientPrintAboveColor(GetPlayerSerial(), ArgToInt( Arg[2] ), ArgToInt( Arg[3] ), "%s", Arg[1]);
return;
}
void Command_Place(char **Arg, int ArgCount)
{
POINT PLocal;
POINT HLocal;
char OverflowHue[25] = {0};
stHouseItem HouseItem = {0};
PLocal.x = ArgToInt(Arg[1]);
PLocal.y = ArgToInt(Arg[2]);
HLocal.x = PLocal.x - Center.x;
HLocal.y = PLocal.y - Center.y;
ClientPrint("%s %d", "HOUSE X ",HLocal.x);
ClientPrint("%s %i", "HOUSE Y ",HLocal.y);
HouseItem.cmd = 0xD7;
HouseItem.size[1] = 0x19;
HouseItem.serial[2] = 0x15;
HouseItem.serial[3] = 0xC9;
HouseItem.cmdsend[1] = 0x06;
HouseItem.artid[2] = 0x05;
HouseItem.artid[3] = 0x22;
HouseItem.posx[3] = char(9);
HouseItem.posy[3] = char(-3);
HouseItem.unkown4 = 0x0A;
memcpy(OverflowHue,&HouseItem,sizeof(OverflowHue));
SendToServer(OverflowHue,25);
}