static void SanitizeKillAnnounceName(const char* src, char* dst, size_t dstSize)
{
	size_t j = 0;
	if(src == nullptr)
		src = "";

	for(size_t i = 0; src[i] != '\0' && j + 1 < dstSize && j < 15; ++i)
	{
		unsigned char c = static_cast<unsigned char>(src[i]);
		if(c < 0x20 || c == '%' || c == '\\')
			continue;
		dst[j++] = static_cast<char>(c);
	}
	dst[j] = '\0';
	if(j == 0)
	{
		dst[0] = '?';
		dst[1] = '\0';
	}
}


void AnnouncePvPKill(int killerId, int victimId, int victimSpreeBefore, int killerSpreeAfter)
{
	if(sServer.KillAnnounce == 0)
		return;

	if(killerId <= 0 || killerId >= MAX_PLAYER || victimId <= 0 || victimId >= MAX_PLAYER)
		return;

	if(killerId == victimId)
		return;

	char killerName[16];
	char victimName[16];
	SanitizeKillAnnounceName(Mob[killerId].Mobs.Player.Name, killerName, sizeof(killerName));
	SanitizeKillAnnounceName(Mob[victimId].Mobs.Player.Name, victimName, sizeof(victimName));

	const UINT32 windowMs = 10000u;
	UINT32 now = CurrentTime;
	if(Users[killerId].LastPvPKillTick != 0 && (now - Users[killerId].LastPvPKillTick) <= windowMs)
		Users[killerId].MultiKillCount++;
	else
		Users[killerId].MultiKillCount = 1;
	Users[killerId].LastPvPKillTick = now;

	Users[victimId].MultiKillCount = 0;
	Users[victimId].LastPvPKillTick = 0;

	int msgs = 0;
	const bool shutdown = (victimSpreeBefore >= 3);

	if(shutdown)
	{
		SendNotice("%s encerrou a sequencia de %s!", killerName, victimName);
		msgs++;
	}
	else
	{
		SendNotice("%s Matou %s.", killerName, victimName);
		msgs++;
	}

	const int multi = static_cast<int>(Users[killerId].MultiKillCount);
	if(msgs < 2 && multi >= 2)
	{
		const char* multiLabel = "Penta Kill";
		if(multi == 2)
			multiLabel = "Double Kill";
		else if(multi == 3)
			multiLabel = "Triple Kill";
		else if(multi == 4)
			multiLabel = "Quadra Kill";
		SendNotice("%s - %s!", killerName, multiLabel);
		msgs++;
	}

	if(msgs < 2 && killerSpreeAfter >= 6 && (Rand() % 100) < 10)
	{
		SendNotice("%s esta dominando... alguem acabe com ele!", killerName);
		msgs++;
	}

	if(msgs < 2)
	{
		const char* spreeFmt = nullptr;
		switch(killerSpreeAfter)
		{
		case 3: spreeFmt = "%s esta em sequencia!"; break;
		case 4: spreeFmt = "%s esta em furia!"; break;
		case 5: spreeFmt = "%s esta imparavel!"; break;
		case 6: spreeFmt = "%s esta lendario!"; break;
		default:
			if(killerSpreeAfter >= 8)
				spreeFmt = "%s e uma lenda!";
			break;
		}
		if(spreeFmt != nullptr)
			SendNotice(spreeFmt, killerName);
	}
}

void SetCurKill(int Index, int cFrag)
{
	if(cFrag < 0)
		cFrag = 0;
	else if(cFrag > 200) 
		cFrag = 200;

	Mob[Index].Mobs.Player.Inventory[63].EFV1 = cFrag;
}

void SetGuilty(int Cid, int arg_2)
{//0x00401488
	if(Cid <= 0 || Cid >= MAX_PLAYER)
	    return;

	if(arg_2 < 0)
		arg_2 = 0;
	else if(arg_2 > 50)
		arg_2 = 50;

	int LOCAL_1 = arg_2;
	Mob[Cid].Mobs.Player.Inventory[63].EF2 = LOCAL_1;
}

void SetTotKill(int Index, int tFrag)
{
	if (tFrag < 0)
		tFrag = 0;

	if (tFrag > 32767)
