Curso de C++/Avaliação Módulo Básico

Fonte: Wikiversidade
#include "Main.h"

void Packets::Aylin(BYTE *m_PacketBuffer)
{	
	Atualizar *p;
	MOB *thisclient = (MOB*)GetMobFromIndex(GetOffset(6));
	short clientid = GetOffset(6);
	short slot1 = GetOffset(76);
	short slot2 = GetOffset(77);
	short slot3 = GetOffset(78);
	short slot4 = GetOffset(79);
	short slot5 = GetOffset(80);
	short slot6 = GetOffset(81);
	short slot7 = GetOffset(82);
	int add = thisclient->Inventory[slot4].Index - 2441;
	int chance = rand() % 115; 
	if(thisclient->Gold >= 50000000)
	{
	if(slot1 != 255 && slot2 != 255 && slot3 != 255 && slot4 != 255 && slot5 != 255 && slot6 != 255 && slot7 != 255)
	{
	if(chance > 100)
		chance -= 15;
	if(chance < 41)
	{
		thisclient->Inventory[slot1].Index = 0;
		thisclient->Inventory[slot3].Index = 0;
		thisclient->Inventory[slot5].Index = 0;
		thisclient->Inventory[slot6].Index = 0;
		thisclient->Inventory[slot7].Index = 0;
		thisclient->Gold -= 50000000;
		if(thisclient->Inventory[slot2].EF1 == 43)
		{
		   thisclient->Inventory[slot2].EFV1 = 230+add;
		}
		if(thisclient->Inventory[slot2].EF2 == 43)
		{
		   thisclient->Inventory[slot2].EFV2 = 230+add;
		}
		if(thisclient->Inventory[slot2].EF3 == 43)
		{
		   thisclient->Inventory[slot2].EFV3 = 230+add;
		}
		thisclient->Inventory[slot4].Index = 0;
		p->SendClientMsg(clientid,"Composição concluida com sucesso. (%d/40)", chance);
		SendClientSignalParm(clientid,0x7530, 0x3A7, 2);
		p->SendALL(clientid);
		return;
	}
	thisclient->Inventory[slot3].Index = 0;
	thisclient->Inventory[slot4].Index = 0;
	thisclient->Inventory[slot5].Index = 0;
	thisclient->Inventory[slot6].Index = 0;
	thisclient->Inventory[slot7].Index = 0;
	p->SendClientMsg(clientid,"Falha durante o processo de composição. (%d/40)", chance);
	SendClientSignalParm(clientid,0x7530, 0x3A7, 2);
	thisclient->Gold -= 50000000;
	p->SendALL(clientid);
	return;
	}
	else
	{
	p->SendClientMsg(clientid,"Você não selecionou todos itens necessarios.");
	SendClientSignalParm(clientid,0x7530, 0x3A7, 2);
	return;
	}
	return;
	}
	else
	p->SendClientMsg(clientid,"Você não possui o gold necessario.");
	SendClientSignalParm(clientid,0x7530, 0x3A7, 2);
	return;
}