Exemplo n.º 1
0
void SendGridMob(int conn)
{
	int posX = pMob[conn].TargetX;
	int posY = pMob[conn].TargetY;

	if (conn <= 0 || conn >= MAX_USER)
		return;

	int SizeY = VIEWGRIDY;
	int SizeX = VIEWGRIDX;
	int StartX = posX - HALFGRIDX;
	int StartY = posY - HALFGRIDY;

	if ((posX - HALFGRIDX + VIEWGRIDX) >= MAX_GRIDX)
		SizeX -= (StartX + SizeX - MAX_GRIDX);

	if ((posY - HALFGRIDY + VIEWGRIDY) >= MAX_GRIDY)
		SizeY -= (StartY + SizeY - MAX_GRIDY);

	if (StartX < 0)
		StartX = 0;

	if (StartY < 0)
		StartY = 0;


	int sx1 = StartX;
	int sy1 = StartY;
	int sx2 = StartX + SizeX;
	int sy2 = StartY + SizeY;

	for (int y = sy1; y < sy2; y++)
	{
		for (int x = sx1; x < sx2; x++)
		{
			int tmob = pMobGrid[y][x];
			int titem = pItemGrid[y][x];

			if (tmob > 0 && tmob < MAX_MOB && tmob != conn)
			{
				if (pMob[tmob].Mode == MOB_EMPTY)
					pMobGrid[y][x] = 0;
				else
				{
					SendCreateMob(conn, tmob, 0);
					SendPKInfo(conn, tmob);
				}
			}

			if (titem > 0 && titem < MAX_ITEM)
			{
				if (pItem[titem].Mode)
					SendCreateItem(conn, titem, 0);
				else
					pItemGrid[y][x] = 0;
			}
		}
	}
}
Exemplo n.º 2
0
void AddExp(int clientid)
{
	MOB *player = (MOB*)GetMobFromIndex(clientid);
	int addr_bclient = clientid * 0x0410;
	int caos = PByte(clientid * 0x410 + 0x15c6c8e);
	FILE *fs = NULL;
    char name[100];
	char Classe;
	char Level;
	Classe = player->Equip[0].EFV2;
	Level = player->bStatus.Level;
	PremioLv(clientid);
	
	if(player->Equip[0].EFV2 >= 3)
	{
		if(player->bStatus.Level >= 5)
		{
			if(player->Exp < exp_Cele_Sub[player->bStatus.Level - 2])
			{
				player->Exp = exp_Cele_Sub[player->bStatus.Level - 1];
			}
		
		}
	}
	
	
	if(player->Equip[0].EFV2 == 1)
	{	
		if(player->bStatus.Level < 255)
		{
			if(player->Exp >= exp_Mortal_Arch[player->bStatus.Level])
			{
				player->StatusPoint += 5;
				player->MasterPoint += 3;
				player->SkillPoint += 3;
				player->bStatus.Level += 1;
				player->bStatus.Attack += 1;
				player->bStatus.Defense  += 2;
				if(caos <= 148)
				{
					PByte(clientid * 0x410 + 0x15c6c8e) += 3;
					RespawCreatMob(clientid);
					SendCreateMob(clientid,clientid,1);
				}
				PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
				player->bStatus.curHP = player->bStatus.maxMP;
				player->Status.curHP = player->bStatus.maxHP; 
				player->Status.curMP = player->bStatus.maxMP;
				GetCurrentScore(clientid);
				SendScore(clientid);
				SendStats(clientid);
				SendSetHpMp(clientid);
				SendClientMsg(clientid, "+ + + LEVEL UP + + +");
				SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
				return;
			}
		}
		else if(player->bStatus.Level < 300)
		{
			if(player->Exp >= exp_Mortal_Arch[player->bStatus.Level])
			{
				player->StatusPoint += 10;
				player->MasterPoint += 3;
				player->SkillPoint += 3;
				player->bStatus.Level += 1;
				player->bStatus.Attack += 1;
				player->bStatus.Defense  += 2;
				if(caos <= 148)
				{
					PByte(clientid * 0x410 + 0x15c6c8e) += 3;
					RespawCreatMob(clientid);
					SendCreateMob(clientid,clientid,1);
				}
				PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
				player->bStatus.curHP = player->bStatus.maxMP;
				player->Status.curHP = player->bStatus.maxHP; 
				player->Status.curMP = player->bStatus.maxMP;
				GetCurrentScore(clientid);
				SendScore(clientid);
				SendStats(clientid);
				SendSetHpMp(clientid);
				SendClientMsg(clientid, "+ + + LEVEL UP + + +");
				SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
				return;
			}
		}
		else if(player->bStatus.Level < 394)
		{
			if(player->Exp >= exp_Mortal_Arch[player->bStatus.Level])
			{
				player->StatusPoint += 15;
				player->MasterPoint += 3;
				player->SkillPoint += 3;
				player->bStatus.Level += 1;
				player->bStatus.Attack += 1;
				player->bStatus.Defense  += 2;
				if(caos <= 148)
				{
					PByte(clientid * 0x410 + 0x15c6c8e) += 3;
					RespawCreatMob(clientid);
					SendCreateMob(clientid,clientid,1);
				}
				PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
				player->bStatus.curHP = player->bStatus.maxMP;
				player->Status.curHP = player->bStatus.maxHP; 
				player->Status.curMP = player->bStatus.maxMP;
				GetCurrentScore(clientid);
				SendScore(clientid);
				SendStats(clientid);
				SendSetHpMp(clientid);
				SendClientMsg(clientid, "+ + + LEVEL UP + + +");
				SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
				return;
			}
		}
		else if(player->bStatus.Level < 399)
		{
			if(player->Exp >= exp_Mortal_Arch[player->bStatus.Level])
			{
				player->StatusPoint += 15;
				player->MasterPoint += 3;
				player->SkillPoint += 3;
				player->bStatus.Level += 1;
				player->bStatus.Attack += 1;
				player->bStatus.Defense  += 2;
				if(caos <= 148)
				{
					PByte(clientid * 0x410 + 0x15c6c8e) += 3;
					RespawCreatMob(clientid);
					SendCreateMob(clientid,clientid,1);
				}
				PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
				player->bStatus.curHP = player->bStatus.maxMP;
				player->Status.curHP = player->bStatus.maxHP; 
				player->Status.curMP = player->bStatus.maxMP;
				GetCurrentScore(clientid);
				SendScore(clientid);
				SendStats(clientid);
				SendSetHpMp(clientid);
				SendClientMsg(clientid, "+ + + LEVEL UP + + +");
				SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
				return;
			}
		}
		return;
	}
	else if(player->Equip[0].EFV2 == 2)
	{
		if(player->bStatus.Level == 350)
		{
			if(player->Exp >= exp_Mortal_Arch[player->bStatus.Level+4])
			{
				player->StatusPoint += 10;
				player->MasterPoint += 3;
				player->SkillPoint += 3;
				player->bStatus.Level += 1;
				player->bStatus.Attack += 2;
				player->bStatus.Defense += 3;
				PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
				player->bStatus.curHP = player->bStatus.maxMP;
				player->Status.curHP = player->bStatus.maxHP; 
				player->Status.curMP = player->bStatus.maxMP;
				GetCurrentScore(clientid);
				SendScore(clientid);
				SendStats(clientid);
				SendSetHpMp(clientid);
				SendClientMsg(clientid, "+ + + LEVEL UP + + +");
				SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
   				return;
			}
		}
		else if(player->bStatus.Level > 351 && player->bStatus.Level < 353)
		{
			player->StatusPoint += 13;
			player->MasterPoint += 3;
			player->SkillPoint += 3;
   			player->bStatus.Level += 1;
			player->bStatus.Attack += 1;
			player->bStatus.Defense  += 2;
			if(caos <= 148)
			{
				PByte(clientid * 0x410 + 0x15c6c8e) += 3;
				RespawCreatMob(clientid);
				SendCreateMob(clientid,clientid,1);
			}
			PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
			player->bStatus.curHP = player->bStatus.maxMP;
			player->Status.curHP = player->bStatus.maxHP; 
			player->Status.curMP = player->bStatus.maxMP;
			GetCurrentScore(clientid);
			SendScore(clientid);
			SendStats(clientid);
			SendSetHpMp(clientid);
			SendClientMsg(clientid, "+ + + LEVEL UP + + +");
			SendEffect(3, 0xE, clientid);
			    /*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
			return;
  		}
		else if(player->bStatus.Level < 370)
		{
			if(player->Exp >= exp_Mortal_Arch[player->bStatus.Level])
			{
				//if(player->QuestInfo == 1)
				{
					player->StatusPoint += 12;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack += 1;
					player->bStatus.Defense  += 2;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					return;
				}
			}
		}
		else if(player->bStatus.Level < 399)
		{
			if(player->Exp >= exp_Mortal_Arch[player->bStatus.Level])
			{
				//if(player->QuestInfo == 2)
				{
					player->StatusPoint += 12;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack += 1;
					player->bStatus.Defense  += 2;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					return;
				}
			}
		}
		return;
	}
	else if(player->Equip[0].EFV2 == 3)
	{
		if(player->bStatus.Level < 40)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
				player->StatusPoint += 5;
				player->MasterPoint += 4;
				player->SkillPoint += 3;
				player->bStatus.Attack  += 1;
				player->bStatus.Defense  += 3;	
				player->bStatus.Level += 1;
				if(caos <= 148)
				{
					PByte(clientid * 0x410 + 0x15c6c8e) += 3;
					RespawCreatMob(clientid);
					SendCreateMob(clientid,clientid,1);
				}
				PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
				player->bStatus.curHP = player->bStatus.maxMP;
				player->Status.curHP = player->bStatus.maxHP; 
				player->Status.curMP = player->bStatus.maxMP;
				GetCurrentScore(clientid);
				SendScore(clientid);
				SendStats(clientid);
				SendSetHpMp(clientid);
				SendClientMsg(clientid, "+ + + LEVEL UP + + +");
				SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
				return;
			}
		}
		else if(player->bStatus.Level < 90)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				//if(player->QuestInfo == 1)
				//{
					printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
					player->StatusPoint += 10;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack  += 1;
					player->bStatus.Defense  += 3;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					return;
				//}
			}
		}
		else if(player->bStatus.Level < 399)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				//if(player->QuestInfo == 2)
				//{
					printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
					player->StatusPoint += 15;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack  += 1;
					player->bStatus.Defense  += 4;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					return;
				//}
			}
		}
	}
	else if(player->Equip[0].EFV2 == 4)
	{
		if(player->bStatus.Level < 40)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
				player->StatusPoint += 5;
				player->MasterPoint += 4;
				player->SkillPoint += 3;
				player->bStatus.Level += 1;
				player->bStatus.Attack  += 1;
				player->bStatus.Defense  += 3;
				if(caos <= 148)
				{
					PByte(clientid * 0x410 + 0x15c6c8e) += 3;
					RespawCreatMob(clientid);
					SendCreateMob(clientid,clientid,1);
				}
				PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
				player->bStatus.curHP = player->bStatus.maxMP;
				player->Status.curHP = player->bStatus.maxHP; 
				player->Status.curMP = player->bStatus.maxMP;
				GetCurrentScore(clientid);
				SendScore(clientid);
				SendStats(clientid);
				SendSetHpMp(clientid);
				SendClientMsg(clientid, "+ + + LEVEL UP + + +");
				SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
				return;
			}
		}
		else if(player->bStatus.Level < 90)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				//if(player->QuestInfo == 1)
				//{
					printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
					player->StatusPoint += 10;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack  += 1;
					player->bStatus.Defense  += 3;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					return;
				//}
			}
		}
		else if(player->bStatus.Level < 399)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				//if(player->QuestInfo == 2)
				//{
					printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
					player->StatusPoint += 15;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack  += 1;
					player->bStatus.Defense  += 4;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					//
					return;
				//}
			}
		}
	}
	else if(player->Equip[0].EFV2 == 5)
	{
		if(player->bStatus.Level < 40)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
				player->StatusPoint += 5;
				player->MasterPoint += 4;
				player->SkillPoint += 3;
				player->bStatus.Level += 1;
				player->bStatus.Attack  += 1;
				player->bStatus.Defense  += 3;
				if(caos <= 148)
				{
					PByte(clientid * 0x410 + 0x15c6c8e) += 3;
					RespawCreatMob(clientid);
					SendCreateMob(clientid,clientid,1);
				}
				PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
				player->bStatus.curHP = player->bStatus.maxMP;
				player->Status.curHP = player->bStatus.maxHP; 
				player->Status.curMP = player->bStatus.maxMP;
				GetCurrentScore(clientid);
				SendScore(clientid);
				SendStats(clientid);
				SendSetHpMp(clientid);
				SendClientMsg(clientid, "+ + + LEVEL UP + + +");
				SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
				//
				return;
			}
		}
		else if(player->bStatus.Level < 90)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				//if(player->QuestInfo == 1)
				//{
					printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
					player->StatusPoint += 10;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack  += 1;
					player->bStatus.Defense  += 3;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					//
					return;
				//}
			}
		}
		else if(player->bStatus.Level < 399)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				//if(player->QuestInfo == 2)
				//{
					printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
					player->StatusPoint += 15;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack  += 1;
					player->bStatus.Defense  += 4;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					//
					return;
				//}

			}

		}


	}
	else if(player->Equip[0].EFV2 == 6)
	{
		if(player->bStatus.Level < 40)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
				player->StatusPoint += 7;
				player->MasterPoint += 4;
				player->SkillPoint += 3;
				player->bStatus.Level += 1;
				player->bStatus.Attack  += 1;
				player->bStatus.Defense  += 3;
				if(caos <= 148)
				{
					PByte(clientid * 0x410 + 0x15c6c8e) += 3;
					RespawCreatMob(clientid);
					SendCreateMob(clientid,clientid,1);
				}
				PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
				player->bStatus.curHP = player->bStatus.maxMP;
				player->Status.curHP = player->bStatus.maxHP; 
				player->Status.curMP = player->bStatus.maxMP;
				GetCurrentScore(clientid);
				SendScore(clientid);
				SendStats(clientid);
				SendSetHpMp(clientid);
				SendClientMsg(clientid, "+ + + LEVEL UP + + +");
				SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
				//
				return;
			}
		}
		else if(player->bStatus.Level < 90)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				//if(player->QuestInfo == 1)
				//{
					printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
					player->StatusPoint += 10;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack  += 1;
					player->bStatus.Defense  += 4;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					return;
				//}
			}
		}
		else if(player->bStatus.Level < 399)
		{
			if(player->Exp >= exp_Cele_Sub[player->bStatus.Level])
			{
				//if(player->QuestInfo == 2)
				//{
					printf("\n %s evoluiu para level %d \n.",player->Name,player->bStatus.Level +2);
					player->StatusPoint += 15;
					player->MasterPoint += 4;
					player->SkillPoint += 3;
					player->bStatus.Level += 1;
					player->bStatus.Attack  += 1;
					player->bStatus.Defense  += 6;
					if(caos <= 148)
					{
						PByte(clientid * 0x410 + 0x15c6c8e) += 3;
						RespawCreatMob(clientid);
						SendCreateMob(clientid,clientid,1);
					}
					PInt(addr_bclient + 0x015C6A04) = PInt(addr_bclient + 0x015C6A00);
					player->bStatus.curHP = player->bStatus.maxMP;
					player->Status.curHP = player->bStatus.maxHP; 
					player->Status.curMP = player->bStatus.maxMP;
					GetCurrentScore(clientid);
					SendScore(clientid);
					SendStats(clientid);
					SendSetHpMp(clientid);
					SendClientMsg(clientid, "+ + + LEVEL UP + + +");
					SendEffect(3, 0xE, clientid);
				/*Ranking(clientid);
				DeletarPlayer1(clientid);
				DeletarPlayer2(clientid);
				DeletarPlayer3(clientid);*/
					return;
				//}

			}

		}

	}
	


	
}
Exemplo n.º 3
0
void FixUseSkill(BYTE *m_PacketBuffer, bool* pRetn)
{
	p39D_754 *p = (p39D_754*)m_PacketBuffer;

	INT16 cId = p->Header.ClientId;

	p754_SendAffect *oldp = (p754_SendAffect*)m_PacketBuffer;

	INT16 oldcId = oldp->Header.ClientId;

	st_Mob *player = GetMobFromIndex(oldcId);	

	if(p->m_SkillId == 103) // Skill Kefra sem ser mob
	{
		*pRetn = true;

		CloseUser(cId);
		
		return;
	}		

	else if(!p->m_SkillId) // Se não for skill 
		return;	

	if(p->Header.PacketId == 0x36C && p->m_SkillId == 79)
	{
		OitavaHT(cId, p->m_Target.Index);

		*pRetn = true;

		return;
	}
		
	switch(p->m_SkillId)
	{
		case 27: case 29:
			*(DWORD*)&m_PacketBuffer[12] = 0x0;
			break;

		case 31: // Renascimento
		{
			*pRetn = true;

			if(cId == p->m_Target.Index)
				return;
			else if(p->m_Target.Index < 0 || p->m_Target.Index > 750)
				return;
				
			bool HasOnGroup = false;

			if(player->Leader <= 0) // Lider do grupo ou sem grupo
			{
				for(int i = 0; i < 12; i++)
				{
					if(player->PartyList[i] == p->m_Target.Index)
					{
						HasOnGroup = true;
						break;
					}
				}
			}
			else if(player->Leader != -1)
			{
				st_Mob *leader = GetMobFromIndex(player->Leader);

				for(int i = 0; i < 12; i++)
				{
					if(leader->PartyList[i] == p->m_Target.Index)
					{
						HasOnGroup = true;
						break;
					}
				}
			}

			if(!HasOnGroup)
				return;

			st_Mob *deadPerson = GetMobFromIndex(p->m_Target.Index);

			if(deadPerson->Status.curHP > 0)
				return;
			if(!player->Status.curHP || !player->Status.curMP)
				return;

			deadPerson->Status.curHP = deadPerson->Status.maxHP / 2;
			deadPerson->Status.curMP = deadPerson->Status.maxMP / 2;

			deadPerson->bStatus.curHP = deadPerson->bStatus.maxHP / 2;
			deadPerson->bStatus.curMP = deadPerson->bStatus.maxMP / 2;

			Users[p->m_Target.Index].Potion.CountMp = deadPerson->Status.curMP;
			Users[p->m_Target.Index].Potion.CountHp = deadPerson->Status.curHP;

			player->Status.curMP = 0;
			player->bStatus.curMP = 0;

			Users[cId].Potion.CountMp = player->Status.curMP;
				
			GetCurrentScore(p->m_Target.Index);

			BASE_GetHpMp(deadPerson);

			SendScore(p->m_Target.Index);
			SendCreateMob(p->m_Target.Index, p->m_Target.Index, 1);

			DoTeleport(p->m_Target.Index, deadPerson->PosX, deadPerson->PosY);

			break;
		}

		case 56: case 57: case 58: 
		case 59: case 60: case 61: 
		case 62: case 63: 
		{
			*pRetn = true;

			UINT8 summonId = p->m_SkillId - 56; 

			static const UINT8 MobDivisor[8] = {31, 36, 42, 51, 63, 85, 127, 255};

			if(!player->Leader || player->Leader == -1)
			{
				for(int i = 0; i < 12; i++)
				{
					if(player->PartyList[i] <= 0)
						continue;

					st_Mob *tmpMob = GetMobFromIndex(player->PartyList[i]);

					for(int e = 0; e < 8; e++)
					{
						if(tmpMob->Equip[0].Index == MobFaces[e]) 
						{
							if(tmpMob->Summoner != p->Header.ClientId)
								return;

							RemoveParty(player->PartyList[i]);
							SendRemoveParty(player->Leader, player->PartyList[i]);
						}
					}
				}
			}
			else // Não é o lider do grupo
			{
				st_Mob *Lider = GetMobFromIndex(player->Leader);

				for(int i = 0;i<12;i++)
				{
					if(Lider->PartyList[i] == cId)
						continue;

					if(Lider->PartyList[i] <= 0)
						continue;

					st_Mob *tmpMob = (st_Mob*)GetMobFromIndex(Lider->PartyList[i]);
						
					for(int e = 0; e < 8; e++)
					{
						if(tmpMob->Equip[0].Index == MobFaces[e]) 
						{
							if(tmpMob->Summoner != p->Header.ClientId)
							    return;

							RemoveParty(Lider->PartyList[i]);
							SendRemoveParty(Lider->Leader, Lider->PartyList[i]);
						}
					}
				}
			}

			// Essa conta pega o número de mobs que a skill deve criar
			INT16 numMob = player->Status.Mastery[2] / MobDivisor[summonId];

			if(!numMob)
				numMob += 1;

			for(int i = 0; i < numMob; i++)
				GenerateSummon(cId, summonId, 0);

			break;
		}

		case 64: case 66: case 68: 
		case 70: case 71:
		{
			if(player->Equip[13].Index > 4151 && player->Equip[13].Index < 4159)
			{
				// Está de traje
				SendClientMessage(cId, "Impossível utilizar esta skill enquanto trajado.");

				*pRetn = true;

				return;
			}

			break;
		}

		////case 98: // Vinha - Skill sephira
		////	CreateMob("Vinha", oldp->PositionFinal.X, oldp->PositionFinal.Y, "npc");
		////	break;

		case 99: // Ressureição - Skill sephira
		{
			*pRetn = true;

			INT16 Level = player->bStatus.Level + 1;

			if(player->Equip[0].EFV2 > ARCH)
				Level += 200;

			INT8 resChances = Level / 5;

			if(wdBuffer[cId].Ingame.hasFailed)
				return;

			srand(time(NULL) / 5 * (rand() % 500) * 5);

			if(rand() % 100 <= resChances)
			{
				player->Status.curHP = player->Status.maxHP / 2;
				player->Status.curMP = player->Status.maxMP / 2;
				player->bStatus.curHP = player->bStatus.maxHP / 2;
				player->bStatus.curMP = player->bStatus.maxMP / 2;

				GetCurrentScore(cId);

				BASE_GetHpMp(player);

				SendScore(cId);
				SendCreateMob(cId, cId, 1);
			}
			else
				if(!wdBuffer[cId].Ingame.hasFailed)
					wdBuffer[cId].Ingame.hasFailed = 200;
				
			break;
		}

		case 102: // Soul - Melhor buff ever
		{
			*pRetn = true;

			if(player->Equip[0].EFV2 == ARCH)
				return;

			bool hasSoulOn = false;

			for(int i = 0; i < 16; i++)
				if(mBuffer[cId].Affects[i].Index == 29)
				{
					hasSoulOn = true;
					mBuffer[cId].Affects[i].Master = wdBuffer[cId].Chars[wdBuffer[cId].Ingame.LoggedMob].SoulInfo;
					mBuffer[cId].Affects[i].Time = 139;
					mBuffer[cId].Affects[i].Value = 4;
					break;
				}

			if(!hasSoulOn)
			{
				for(int i = 0; i < 16; i++)
					if(!mBuffer[cId].Affects[i].Index)
					{
						mBuffer[cId].Affects[i].Index = 29;
						mBuffer[cId].Affects[i].Master = wdBuffer[cId].Chars[wdBuffer[cId].Ingame.LoggedMob].SoulInfo;
						mBuffer[cId].Affects[i].Time = 139;
						mBuffer[cId].Affects[i].Value = 4;
						break;
					}
			}				

			GetCurrentScore(cId);
			SendStats(cId);
			SendScore(cId);				
			break;
		}
	}
}
Exemplo n.º 4
0
void GridMulticast(int conn, int tx, int ty, MSG_STANDARD *msg)
{
	if (conn == 0 || pMob[conn].TargetX == 0)
	{
		Log("err,GridMulticast mobidx,pos", "-system", 0);

		return;
	}

	int tmob = pMobGrid[pMob[conn].TargetY][pMob[conn].TargetX];

	if (tmob != conn && tmob)
		GetEmptyMobGrid(conn, &pMob[conn].TargetX, &pMob[conn].TargetY);
 
	if (tmob != conn && tmob)
	{
		if (conn < MAX_USER)
			Log("PC do not have his own grid", "-system", 0);

		else
			Log("NPC do not have his own grid", "-system", 0);

	}
	pMobGrid[pMob[conn].TargetY][pMob[conn].TargetX] = 0;

	if (pMobGrid[ty][tx] != conn && pMobGrid[ty][tx] != 0)
		GetEmptyMobGrid(conn, &pMob[conn].TargetX, &pMob[conn].TargetY);

	if (pMobGrid[ty][tx] != conn && pMobGrid[ty][tx] != 0)
	{
		if (conn < MAX_USER)
			Log("PC step in other mob's grid", "-system", 0);

		else
			Log("NPC charge other mob's grid", "-system", 0);
	}

	pMobGrid[ty][tx] = conn;

	int SizeY = VIEWGRIDY;
	int SizeX = VIEWGRIDX;
	int StartX = pMob[conn].TargetX - HALFGRIDX;
	int StartY = pMob[conn].TargetY - HALFGRIDY;

	if (StartX + SizeX >= MAX_GRIDX)
		SizeX = SizeX - (StartX + SizeX - MAX_GRIDX);

	if (SizeY + StartY >= MAX_GRIDY)
		SizeY = SizeY - (StartY + SizeY - MAX_GRIDY);

	if (StartX < 0)
		StartX = 0;

	if (StartY < 0)
		StartY = 0;

	int sx1 = StartX;
	int sy1 = StartY;
	int sx2 = StartX + SizeX;
	int sy2 = StartY + SizeY;


	SizeY = VIEWGRIDY;
	SizeX = VIEWGRIDX;
	StartX = tx - HALFGRIDX;
	StartY = ty - HALFGRIDY;

	if (StartX + SizeX >= MAX_GRIDX)
		SizeX = SizeX - (StartX + SizeX - MAX_GRIDX);

	if (SizeY + StartY >= MAX_GRIDY)
		SizeY = SizeY - (StartY + SizeY - MAX_GRIDY);

	if (StartX < 0)
		StartX = 0;

	if (StartY < 0)
		StartY = 0;

	int tx1 = StartX;
	int ty1 = StartY;
	int tx2 = StartX + SizeX;
	int ty2 = StartY + SizeY;

	for (int y = sy1; y < sy2; y++)
	{
		for (int x = sx1; x < sx2; x++)
		{
			tmob = pMobGrid[y][x];

			if (tmob == 0 || tmob == conn)
				continue;

			if (msg != NULL && tmob < MAX_USER)
				pUser[tmob].cSock.AddMessage((char*)msg, msg->Size);

			if (x < tx1 || x >= tx2 || y < ty1 || y >= ty2 && tx)
			{
				if (tmob < MAX_USER)
					SendRemoveMob(tmob, conn, 0, 0);

				if (conn < MAX_USER)
					SendRemoveMob(conn, tmob, 0, 0);
			}
		}
	}


	for (int y = sy1; y < sy2; y++)
	{
		for (int x = sx1; x < sx2; x++)
		{
			int titem = pItemGrid[y][x];

			if (titem == 0)
				continue;

			if (x < tx1 || x >= tx2 || y < ty1 || y >= ty2 && tx)
			{
				if (titem > 0 && titem < MAX_ITEM && pItem[titem].Mode && pItem[titem].ITEM.sIndex && conn > 0 && conn < MAX_USER)
					SendRemoveItem(conn, titem, 0);
			}
		}
	}

	for (int y = ty1; y < ty2; y++)
	{
		for (int x = tx1; x < tx2; x++)
		{
			int titem = pItemGrid[y][x];
			tmob = pMobGrid[y][x];

			if (x < sx1 || x >= sx2 || y < sy1 || y >= sy2)
			{
				if (titem > 0 && titem < MAX_ITEM && pItem[titem].Mode && pItem[titem].ITEM.sIndex && conn < MAX_USER)
				{
					if (pItem[titem].Mode)
						SendCreateItem(conn, titem, 0);

					else
						pItemGrid[y][x] = 0;
				}

				if (tmob != conn && tmob)
				{
					if (pMob[tmob].Mode == MOB_EMPTY)
					{
						pMobGrid[y][x] = 0;

						Log("MOB GRID HAS EMPTY MOB", "-system", 0);
						continue;
					}

					if (tmob < MAX_USER)
					{
						if (pMob[conn].Mode == MOB_EMPTY)
							pMobGrid[y][x] = 0;

						else
						{
							SendCreateMob(tmob, conn, 0);
							SendPKInfo(tmob, conn);
						}
					}

					if (conn < MAX_USER)
					{
						if (pMob[tmob].Mode == MOB_EMPTY)
							pMobGrid[y][x] = 0;

						else
						{
							SendCreateMob(conn, tmob, 0);
							SendPKInfo(conn, tmob);
						}
					}

					if (msg != NULL && tmob > 0 && tmob < MAX_USER)
					{
						if (pUser[tmob].cSock.AddMessage((char*)msg, msg->Size) == 0)
						{
							pUser[tmob].AccountName[ACCOUNTNAME_LENGTH - 1] = 0;
							pUser[tmob].AccountName[ACCOUNTNAME_LENGTH - 2] = 0;

							sprintf(temp, "err,gridmulticast add %d-%d %s", tmob, pUser[tmob].Mode, pUser[tmob].AccountName);
							Log(temp, "-system", 0);
						}
					}
				}
			}
		}
	}

	MSG_Action *sm = (MSG_Action*)msg;

	pMob[conn].LastTime = sm->ClientTick;
	pMob[conn].LastSpeed = sm->Speed;

	pMob[conn].LastX = sm->PosX;
	pMob[conn].LastY = sm->PosY;

	pMob[conn].TargetX = tx;
	pMob[conn].TargetY = ty;
}