Elite Diviner
- Joined
- Feb 8, 2012
- Messages
- 439
- Reaction score
- 867
Hey guys my last release is a while ago, but now i present you my CoolDownProtection:
The Config File:
0 = OFF
1 = 1 Millsecond Cooldown
1000 = 1 Second Cooldown
Example:
VitalityDrain=9000
That is LA Cooldowntime 9 Seconds.
If someone use Cooldownhack he gets kicked.
You can reload the Config File as GM/Admin (8+ DB) with following command:
/reloadcooldown
MadCoolDownConfig.txt goes next to Mainserver.exe
MadCoolDown.dll can be loaded via Obsidian or any other DLL loader
The Skills are mapped one by one, so Skill Index 0 = run, Skill Index 1 = behead, ... Skill Index 18 = LifeAbsorb (Archer) / RainforceDefense (Knight) / stoneshield2 (Mage)
Names are similar to InitSkill.txt
The Source Code:
dllmain.cpp
MadCoolDown.h
Utilities.h
Have fun with it and report any bug here : )
The Config File:
Code:
[Knight]
run=0
behead=0
upgradeweapon=0
thunder=0
mock=0
Transcendental=0
upblockshield=0
UpperSlash=0
Enrage=0
Edge=0
WildAccuracy=0
rest=0
upfatal=0
FatalWound=0
Protect=0
ShieldSmash=0
UpperSmash=0
Infernal=0
RainforceDefense=0
ChantProtect=0
CUpParry=0
CDash=0
CShieldAttack=0
ChantHealing=0
CBerserk=0
CPullSwing=0
CSacrifice=0
CChantDefLightning=0
CChantDefIce=0
CChantDefFire=0
CUpReinforceVitality=0
CChantAccuracy=0
CChantBattle=0
CChangeVitality=0
CShieldResilience=0
CReincarnate=0
upfatal=0
[Mage]
run=0
behead=0
firemagic=0
icemagic=0
litningmagic=0
ProtectRange=0
upIce2=0
upFire2=0
selfheal=0
shockmagic=0
Anyheal=0
rest=0
uplitning=0
upIce=0
upFire=0
Meditation=0
revival=0
stoneshield=0
stoneshield2=0
stoneshield3=0
stoneshield4=0
stoneshield5=0
PlusAnyheal=0
Spark=0
MagicWideIce=0
MagicWideFire=0
Haste=0
FrostBlast=0
HealingParty=0
HealingAnyQuick=0
CUpReinforceVitality=0
CCalllitning=0
IceLance=0
FireExplosion=0
Resurrection=0
Restoration=0
Mesmerization=0
SnowField=0
InchantWeapon=0
AuraDefense=0
SpiritBlast=0
ChainLitning=0
ThunderLitning=0
ThunderStorm=0
IceRequiem=0
IceStorm=0
FireEruption=0
ExplosiveBurst=0
FireRain=0
StrenUpStr=0
StrenUpHth=0
StrenUpDex=0
StrenUpInt=0
StrenUpFatal=0
Purge=0
HealingInstance=0
ReinforceSight=0
HealingPartyPlus=0
HealingPartyIns=0
HealingGreatRe=0
ControlAppetite=0
CAmnegia=0
[Archer]
run=0
behead=0
upgradebow=0
shot=0
negative=0
upgradeconcentration=0
flameArrow=0
fatalchance=0
upevade=0
StunArrow=0
WildStrength=0
rest=0
upfatal=0
PoisonArrow=0
Explosion=0
SilenceArrow=0
GetherShot=0
UpAttackRange=0
VitalityDrain=0
Suffering=0
CUpRFEvade=0
CMysticArrow=0
CMeshSpeed=0
CDarknessVision=0
CResistLightning=0
CResistIce=0
CResistFire=0
CSilenceShot=0
CResistCurse=0
CResistPalsy=0
CUpReinforceVitality=0
CEmergencyEscape=0
upfatal2=0
CCloudSight=0
CManaBurn=0
CMeshChance=0
CMeshStr=0
CMeshHth=0
CMeshDex=0
CMeshInt=0
CMeshWis=0
CMeshDefense=0
CPoisonCloud=0
CVanishConfi=0
CDestroySight=0
CBenefitAblation=0
0 = OFF
1 = 1 Millsecond Cooldown
1000 = 1 Second Cooldown
Example:
VitalityDrain=9000
That is LA Cooldowntime 9 Seconds.
If someone use Cooldownhack he gets kicked.
You can reload the Config File as GM/Admin (8+ DB) with following command:
/reloadcooldown
MadCoolDownConfig.txt goes next to Mainserver.exe
MadCoolDown.dll can be loaded via Obsidian or any other DLL loader
The Skills are mapped one by one, so Skill Index 0 = run, Skill Index 1 = behead, ... Skill Index 18 = LifeAbsorb (Archer) / RainforceDefense (Knight) / stoneshield2 (Mage)
Names are similar to InitSkill.txt
The Source Code:
dllmain.cpp
Code:
#include <MadCore.h>
#include "MadCoolDown.h"
#pragma comment(lib, "MadLib.lib")
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
MadCore core(ul_reason_for_call);
core.Register(&(PVOID&)Server::CIOServer::Start, MadCoolDown::CIOServer::Start);
core.Register(&(PVOID&)Server::CPlayer::ChatCommand, MadCoolDown::CPlayer::ChatCommand);
core.Register(&(PVOID&)Server::CPlayerSkill::ExcuteSkill, MadCoolDown::CPlayerSkill::ExcuteSkill);
return core.Run();
}
MadCoolDown.h
Code:
#pragma comment(lib, "MadLib.lib")
#include <MainPlayer.h>
#include "Utilities.h"
#include <Command.h>
namespace MadCoolDown
{
namespace CIOServer
{
void __stdcall Start(int start)
{
Server::CIOServer::Start(start);
Read_Config();
Server::Console::WriteBlue("[MadCoolDown started]");
}
}
namespace CPlayer
{
void __fastcall ChatCommand(void *thispointer, void *_edx, char *comm)
{
Player player(thispointer);
Command command(comm);
if(player.isGM())
{
if (command.beginWith("/reloadcooldown"))
{
Read_Config();
Server::Console::WriteBlue("[MadCoolDown reloaded]");
}
}
Server::CPlayer::ChatCommand(thispointer,comm);
}
}
namespace CPlayerSkill
{
signed int __fastcall ExcuteSkill(int *thispointer, void *_edx, signed int skillid, int a3, int a4)
{
Player player(thispointer - 156);
if (CoolDownTable[player.GetClass()][skillid] > 0 && CoolDown_Timer[player.GetPid()].Last_Call[skillid] != NULL &&
GetTickCount() - CoolDown_Timer[player.GetPid()].Last_Call[skillid] < CoolDownTable[player.GetClass()][skillid])
{
Server::Console::WriteRed("[Cooldownhack detected! Player: %s]",player.GetName());
player.Kick();
}
else
{
CoolDown_Timer[player.GetPid()].Last_Call[skillid] = GetTickCount();
return Server::CPlayerSkill::ExcuteSkill(thispointer,skillid,a3,a4);
}
}
}
}
Utilities.h
Code:
#include <map>
struct Cooldown
{
int Last_Call[70];
};
char* configname = "./MadCoolDownConfig.txt";
const char* knight = "Knight";
const char* mage = "Mage";
const char* archer = "Archer";
const int knight_skills_count = 37;
const int mage_skills_count = 62;
const int archer_skills_count = 46;
int CoolDownTable[3][70];
map<int,Cooldown> CoolDown_Timer;
void parse(int class_id,const char* class_name, int skill_count,char* skills[])
{
for (int i = 0;i < skill_count; i++)
{
CoolDownTable[class_id][i] = GetPrivateProfileInt(class_name, skills[i], -1, configname);
}
}
void Read_Config()
{
char* knight_skills[knight_skills_count] =
{
"run","behead","upgradeweapon","thunder","mock","Transcendental","upblockshield",
"UpperSlash","Enrage","Edge","WildAccuracy","rest","upfatal","FatalWound","Protect",
"ShieldSmash","UpperSmash","Infernal","RainforceDefense","ChantProtect","CUpParry",
"CDash","CShieldAttack","ChantHealing","CBerserk","CPullSwing","CSacrifice",
"CChantDefLightning","CChantDefIce","CChantDefFire","CUpReinforceVitality","CChantAccuracy",
"CChantBattle","CChangeVitality","CShieldResilience","CReincarnate","upfatal"
};
char* mage_skills[mage_skills_count] =
{
"run","behead","firemagic","icemagic","litningmagic","ProtectRange","upIce2","upFire2",
"selfheal","shockmagic","Anyheal","rest","uplitning","upIce","upFire","Meditation",
"revival","stoneshield","stoneshield2","stoneshield3","stoneshield4","stoneshield5",
"PlusAnyheal","Spark","MagicWideIce","MagicWideFire","Haste","FrostBlast","HealingParty",
"HealingAnyQuick","CUpReinforceVitality","CCalllitning","IceLance","FireExplosion",
"Resurrection","Restoration","Mesmerization","SnowField","InchantWeapon","AuraDefense",
"SpiritBlast","ChainLitning","ThunderLitning","ThunderStorm","IceRequiem","IceStorm",
"FireEruption","ExplosiveBurst","FireRain","StrenUpStr","StrenUpHth","StrenUpDex",
"StrenUpInt","StrenUpFatal","Purge","HealingInstance","ReinforceSight","HealingPartyPlus",
"HealingPartyIns","HealingGreatRe","ControlAppetite","CAmnegia"
};
char* archer_skills[archer_skills_count] =
{
"run","behead","upgradebow","shot","negative","upgradeconcentration",
"flameArrow","fatalchance","upevade","StunArrow","WildStrength","rest",
"upfatal","PoisonArrow","Explosion","SilenceArrow","GetherShot","UpAttackRange",
"VitalityDrain","Suffering","CUpRFEvade","CMysticArrow","CMeshSpeed","CDarknessVision",
"CResistLightning","CResistIce","CResistFire","CSilenceShot","CResistCurse","CResistPalsy",
"CUpReinforceVitality","CEmergencyEscape","upfatal2","CCloudSight","CManaBurn","CMeshChance",
"CMeshStr","CMeshHth","CMeshDex","CMeshInt","CMeshWis","CMeshDefense","CPoisonCloud",
"CVanishConfi","CDestroySight","CBenefitAblation"
};
parse(0,knight,knight_skills_count,knight_skills);
parse(1,mage,mage_skills_count,mage_skills);
parse(2,archer,archer_skills_count,archer_skills);
}
Have fun with it and report any bug here : )
Attachments
You must be registered for see attachments list