CoolDownProtection

Joined
Feb 8, 2012
Messages
439
Reaction score
870
Hey guys my last release is a while ago, but now i present you my CoolDownProtection:

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

Awsome release madknight, exactly what the ppl need atm! well done
 
Is there any info on the mainsvr window when it's loaded?;d

If its correct loaded it should appear in blue MadCoolDown started.
Code:
 [COLOR=#333333]Server::Console::WriteBlue("[MadCoolDown started]");
[/COLOR]

It also prints on Console if someone gets kicked because of CoolDownHack and it prints when you reload the settings via chat command.

MadKnight - CoolDownProtection - RaGEZONE Forums
 
Last edited:
First bug noticed - got expelled while making LA cd to 18000 + mainsvr crashed

Nazwa zdarzenia problemu: APPCRASH
Nazwa aplikacji: MainSvrT.exe
Wersja aplikacji: 0.0.0.0
Sygnatura czasowa aplikacji: 447e4cd4
Nazwa modułu z błędem: StackHash_4e45
Wersja modułu z błędem: 0.0.0.0
Sygnatura czasowa modułu z błędem: 00000000
Kod wyjątku: c0000005
Przesunięcie wyjątku: 00000000
Wersja systemu operacyjnego: 6.1.7601.2.1.0.256.1
Identyfikator ustawień regionalnych: 1045
Dodatkowe informacje 1: 4e45
Dodatkowe informacje 2: 4e45ac25958747c95de65de58e5461c5
Dodatkowe informacje 3: 6ec0
Dodatkowe informacje 4: 6ec0f21cd4b5db02836ec4300cd4d681

[c20 2013/01/19 19:46:25]: CIOObject::Release 0273F13C 004BA660 160 -1
[c20 2013/01/19 19:46:25]: EASSERT
[c20 2013/01/19 19:46:25]: =======================
start at 13/01/19 19:44:52

BTW it shouldn't kick ;d That's not a solution for skills cd.
 
Last edited:
Here for Persons who got Problem with the Kick Version, or just dont wanted that Player gets kicked if a Cooldown was detected. Instead of kick the skill simply wont be executed, if a Cooldownhack was detected.
For me both versions work.

What about the source code for this one, or what to change?;d Would be useful too i guess.
 
Here for Persons who got Problem with the Kick Version, or just dont wanted that Player gets kicked if a Cooldown was detected. Instead of kick the skill simply wont be executed, if a Cooldownhack was detected.
For me both versions work.

alright i will download the #second thanks alot..
 
Btw if that's not a prob you should also add a animals skills cd protect ;d some of them are pretty dangerous with no cd :P
 
First of all, this is really great release.
Second thing, i would like to ask, is it possible to make function which write
messege for admins chat in game when any player used cd hack. So any admin
will be informed right time and they could check player in realtime.

Example, how it could looks like in admin/gm game chat:
[CoolDownProtection] Player: NickName Skill: Thunder Storm

Example, how config files looks like:
[Admins]
NickName1
NickName2
etc

[Msgforadmins]
messege = 0 ;0 = off / 1 = on

[KickPlayerForCD]
kick = 0 ;0 = off / 1 =on

It could be very useful :)

p.s. sorry for my english ;)

~ ObuolYs
 
Last edited:
First of all, this really great release.
Second thing, i would like to ask, is it possible to make that function which write
messege for admins chat in game when any player used cd hack. So any admin
will be informed right time and they could check player in realtime.

Example, how it could looks like in admin/gm game chat:
[CoolDownProtection] Player: NickName Skill: Thunder Storm

Example, how config files looks like:
[Admins]
NickName1
NickName2
etc

[Msgforadmins]
messege = 0 ;0 = off / 1 = on

[KickPlayerForCD]
kick = 0 ;0 = offer / 1 =on

It could be very useful :)

p.s. sorry for my english ;)

~ ObuolYs

Good idea ;d
 
Back