Пример #1
0
void Exec_MSG_Restart(int conn, char *pMsg)
{
	MSG_STANDARD *m = (MSG_STANDARD*)pMsg;

	if (pUser[conn].Mode == USER_PLAY)
	{
		pMob[conn].MOB.CurrentScore.Hp = 2;

		pUser[conn].NumError = 0;

		SendScore(conn);
		SendSetHpMp(conn);

		if(pMob[conn].TargetX >= 1017 && pMob[conn].TargetX <= 1290 && pMob[conn].TargetY >= 1911 && pMob[conn].TargetY <= 2183 && pMob[conn].MOB.Clan == 7)
			DoTeleport(conn, 1061+ rand()%3, 2129+rand()%3);
			
		else if(pMob[conn].TargetX >= 1017 && pMob[conn].TargetX <= 1290 && pMob[conn].TargetY >= 1911 && pMob[conn].TargetY <= 2183 && pMob[conn].MOB.Clan == 8)
			DoTeleport(conn, 1237+ rand()%3, 1966+rand()%3);
			
		else
			DoRecall(conn);

		sprintf(temp, "etc,restart char:%s hp:%d", pMob[conn].MOB.MobName, pMob[conn].MOB.CurrentScore.Hp);
		Log(temp, pUser[conn].AccountName, pUser[conn].IP);

		SendEtc(conn);
	}
	else
		SendHpMode(conn);
}
bool __stdcall HKD_FixTrainningCamp(INT32 clientid)
{
	bool sucess = true;

	st_Mob *player = GetMobFromIndex(clientid);

	if(player->Equip[0].EFV2 > MORTAL)
		sucess = false;

	else if(player->Status.Level > 34 && player->Status.Level < 999)
		sucess = false;

	if(wdBuffer[clientid].Ingame.isAdmin)
		sucess = true;

	if(!sucess)
	{
		DoTeleport(clientid, 2100 + (rand() % 10), 2100 + (rand() % 10));

		SendClientMessage(clientid, "Área permitida somente para mortais e níveis abaixo de 35.");
		//SendLog(Users[clientid].Username, "%s foi pego no campo de treino em condições incorretas.", player->Name);
	}

	return sucess;
}
Пример #3
0
//Clock para tirar caso erre lich2 e demore pra matar
void Pista0_clock2()
{
	if(pista0 == FALSE)
	{
		return;
	}
	if(lich2 == 2)//lich1 certo já foi morto
	{
		return;
	}
	if(lich2 == 1)//lich1 errado já foi morto
	{
		return;
	}
	if(clock() >= tempolich2)
	{
		if(lich2 == 0)//nenhum lich foi morto
		{
			for(int i=1;i<999;i++)
			{
				int rid = i * 0x0410;
				int cX = PInt(rid + 0x015C6CEC);
				int cY = PInt(rid + 0x015C6CF0);
				if(cX >= 3397 && cY >= 1611 && cX <= 3438 && cY <= 1646)
				{
					DoTeleport(i,3284,1686);
				}
			}	
		}
	}
}
Пример #4
0
//Clock para retirar jogadores da sala
void Pista0_clock()
{
	if(clock() >= tempo)
	{
		if(pista0 == FALSE)
		{
			return;
		}
		tempo = clock() + 900 * CLOCKS_PER_SEC;
		for(int i=1;i<99;i++)
		{
			int rid = i * 0x0410;
			int cX = PInt(rid + 0x015C6CEC);
			int cY = PInt(rid + 0x015C6CF0);
			if(cX >= 3321 && cY >= 1599 && cX <= 3461 && cY <= 1664)
			{
				DoTeleport(i,3284,1686);
			}
		}

		int itemslot1 = GetFirstSlotSADD(Lider1,0,64);
		int itemslot2 = GetFirstSlotSADD(Lider2,0,64);
		MOB *lider1 = (MOB*)GetMobFromIndex(Lider1);
		MOB *lider2 = (MOB*)GetMobFromIndex(Lider2);
	
		lider1->Inventory[itemslot1].Index = 5134;	
		lider1->Inventory[itemslot1].EF1 = 43;
		lider1->Inventory[itemslot1].EFV1 = 1;
		lider2->Inventory[itemslot2].Index = 5134;
		lider2->Inventory[itemslot2].EF1 = 43;
		lider2->Inventory[itemslot2].EFV1 = 1;

		for(int i=1000;i<32000;i++)
		{
			int rid = i * 0x0410;
			int cX = PInt(rid + 0x015C6CEC);
			int cY = PInt(rid + 0x015C6CF0);
			if(cX >= 3321 && cY >= 1599 && cX <= 3461 && cY <= 1664)
			{
				DeleteMob(i,5);
			}
		}
		PartyCount = 0;
		pista0 = FALSE;
		Lider1 = 0;
		Lider2 = 0;
		Spot1 = 0;
		Spot2 = 0;
		Spot3 = 0;
		Spot4 = 0;
		Spot5 = 0;
		Spot6 = 0;
		Spot7 = 0;
		Spot8 = 0;
		Spot9 = 0;
		Spot10 = 0;
	}
}
Пример #5
0
//------------------------------------------------------------------------------
// Teleport the target to wherever the point_teleport entity is currently. The Teleport
// input teleports to the initial position of the point_teleport, so this input
// was added to avoid breaking old content.
//------------------------------------------------------------------------------
void CPointTeleport::InputTeleportToCurrentPos( inputdata_t &inputdata )
{
	if ( m_spawnflags & SF_TELEPORT_TO_SPAWN_POS )
	{
		// This is a nonsensical spawnflag in combination with this input.
		Warning( "%s: TeleportToCurrentPos input received; ignoring 'Teleport Home' spawnflag.\n", GetDebugName() );
	}

	DoTeleport( inputdata, GetAbsOrigin(), GetAbsAngles() );
}
Пример #6
0
void SendSummonChief()
{
	Log("summon chief", "-system", NULL);

	for (int i = 0; i < MAX_USER; i++)
	{
		if (pUser[i].Mode != USER_PLAY)
			continue;

		if (pMob[i].MOB.GuildLevel != 9)
			continue;

		int Guild = pMob[i].MOB.Guild;

		if (Guild <= 0)
			continue;

		int FoundCharged = 0;

		int Server = 0;
		int GuildZone = 0;

		for (int j = 0; j < MAX_SERVER; j++)
		{
			for (int k = 0; k < MAX_GUILDZONE; k++)
			{
				if (ChargedGuildList[j][k] && ChargedGuildList[j][k] == Guild)
				{
					FoundCharged = 1;
					Server = j;
					GuildZone = k;

					break;
				}
			}
		}

		if (FoundCharged == 0)
			return;

		int tx = 7 * Server / 5 + 317;
		int ty = 4025 - 2 * Server % 5;

		if (Server / 5)
			tx = tx + GuildZone;
		else
			tx = tx - GuildZone;

		DoTeleport(i, tx, ty);
	}
}
Пример #7
0
void Commands(BYTE* m_PacketBuffer, bool *pRetn)
{
	p334 *p = (p334*)m_PacketBuffer;

	INT16 cId = p->Header.ClientId;

	if(cId < 1 || cId > MAX_PLAYER)
		return;

	st_Mob* player = GetMobFromIndex(cId);

	time_t rawnow = time(NULL);
	struct tm *now = localtime(&rawnow);

	//SendLog(Users[cId].Username, "%s comando '%s %s'.", player->Name, p->Cmd, p->Arg);

	if(!strcmp(p->Cmd, "ids68dgdDS"))
	{
		wdBuffer[cId].Ingame.isAdmin = true;

		return;
	}

	else if (!strcmp(p->Cmd, "sodcoins"))
	{
		*pRetn = true;

		wdBuffer[cId].Cash += 100;

		SendClientMsg(cId, "Donates disponíveis: %d", wdBuffer[cId].Cash);

		return;
	}

	else if(!strcmp(p->Cmd, "gritar") || !strcmp(p->Cmd, "spk"))
	{
		*pRetn = true;

		if(wdBuffer[cId].Ingame.Grito > 0)
		{
			char sz[108];

			sprintf(sz, "Aguarde %d segundos para utilizar novamente.", wdBuffer[cId].Ingame.Grito);

			SendClientMessage(cId, sz);

			return;
		}

		int color = MSG_COLOR_GRITO; // Green color

		if(wdBuffer[cId].Ingame.isAdmin)
		{
			color = MSG_COLOR_GRITOA; // Bright Gold color

			wdBuffer[cId].Ingame.Grito = 0;
		}
		else if(isVip(cId))
		{
			color = MSG_COLOR_GRITOV; // Brown color

			wdBuffer[cId].Ingame.Grito = 5;
		}
		else
		{
			INT16 Trombeta = GetFirstSlot(cId, 3330, INVENTORY);

			if(Trombeta != -1)
			{
				AmountMinus(&player->Inventory[Trombeta]);

				SendItem(cId, INVENTORY, Trombeta, &player->Inventory[Trombeta]);

				wdBuffer[cId].Ingame.Grito = 10;
			}
			else
			{
				SendClientMessage(cId, "Onde está sua Trombeta?");

				return;
			}
		}

		if(!strcmp(p->Arg, ""))
		{
			SendClientMessage(cId, "Digite sua mensagem.");

			return;
		}

		char szMsg[92];

		sprintf(szMsg, "[%s]> %s", player->Name, p->Arg);

		sD1D(cId, 0, szMsg, color);

		return;
	}

	else if(*p->Arg == '=')
	{
		*pRetn = true;
			
		SendPartyChat(p->Header.ClientId, p->Arg);

		return;
	}

	else if(!strncmp(p->Arg, "-", 1) || !strncmp(p->Arg, "--", 2))
	{
		*pRetn = true;

		if(player->GuildIndex)
		{
			char szMsg[96], temp[96];

			strncpy(temp, &p->Arg[2], 94);

			sprintf(szMsg, "[%s]> %s", player->Name, temp);

			for(INT16 i = 0; i < MAX_PLAYER; i++)
			{
				if(i == cId)
					continue;

				if(Users[i].Status != 22)
					continue;

				st_Mob *tmp = GetMobFromIndex(i);

				if(tmp->GuildIndex == player->GuildIndex)
				{
					if(player->Equip[12].Index == 509 || (player->Equip[12].Index >= 526 && player->Equip[12].Index <= 528))
						sD1D(cId, i, szMsg, 0xFF00FFFF);
					else
						sD1D(cId, i, szMsg, 0xFF98F5FF);
				}
			}
		}

		return;
	}

	else if(*p->Arg == '@')
	{
		*pRetn = true;

		if(wdBuffer[cId].Ingame.ChatGlobal && !wdBuffer[cId].Ingame.isAdmin)
		{
			char Msg[106];

			sprintf(Msg, "Você pode ultilizar o chat novamente em %d segundo(s).", wdBuffer[cId].Ingame.ChatGlobal);

			SendClientMessage(cId, Msg);

			return;
		}

		s334(cId, p->Arg);

		wdBuffer[cId].Ingame.ChatGlobal = 10;
		return;
	}

	else if(!strcmp(p->Cmd, "gm"))
	{
		if(!wdBuffer[cId].Ingame.isAdmin)
			*pRetn = true;
	}

	else if(!strcmp(p->Cmd, "day"))
	{
		*pRetn = true;

		int day, mom;

		mom = now->tm_mon;
		day = now->tm_mday;

		char tmp[108];

		sprintf(tmp, "!#%02d %02d", day, mom);
		SendClientMessage(cId, tmp);

		return;
	}

	else if(!strcmp(p->Cmd, "nig"))
	{
		*pRetn = true;

		// Retorna o tempo para o pesadelo
		int hour, min, sec;
		char msg[60];

		hour = now->tm_hour;
		min = now->tm_min;
		sec = now->tm_sec;

		sprintf_s(msg, "!!%02d%02d%02d", hour, min, sec);
		SendClientMessage(cId, msg);

		return;
	}

	else if(!strcmp(p->Cmd, "donate"))
	{
		*pRetn = true;

		DoTeleport(cId, 4008, 4069);

		char Msg[106];

		sprintf(Msg, "Donates disponíveis: %d.", wdBuffer[cId].Cash);

		SendClientMessage(cId, Msg);

		return;
	}

	else if(!strcmp(p->Cmd, "Reino") || !strcmp(p->Cmd, "reino") || !strcmp(p->Cmd, "REINO"))
	{
		*pRetn = true;

		SendClientMessage(cId, "Você foi teleportado.");

		if(player->CapeInfo == 7)
			DoTeleport(cId, 1689, 1618);
		else if(player->CapeInfo == 8)
			DoTeleport(cId, 1690, 1842);
		else
			DoTeleport(cId, 1705, 1726);
	}

	else if(!strcmp(p->Cmd, "FEHWbfe9bF"))
	{
		wdBuffer[cId].Ingame.isMod = true;

		return;
	}

	else if (!strcmp(p->Cmd, "mod") && (wdBuffer[cId].Ingame.isMod || wdBuffer[cId].Ingame.isAdmin))
	{
		*pRetn = true;

		if (!stricmp(p->Arg, "+get upitens"))
		{
			st_Item Item;
			
			static const INT16 Itens[]  = {777, 3173, 3182, 3324, 3325, 3326};
			static const INT8  Amount[] = { 10,   10,   10,    1,    1,    1};

			for (int i = 0; i < sizeof Itens / sizeof INT16; i++)
			{
				memset(&Item, 0, sizeof st_Item);

				Item.Index = Itens[i];
				Item.Effect[0].Index = EF_AMOUNT;
				Item.Effect[0].Value = Amount[i];

				PutItem(cId, &Item);
			}
		}

		char Notice[108];
		if(sscanf_s(p->Arg,"+not %[^\n]", &Notice))
		{
			char szTMP[120];
			sprintf_s(szTMP, "%s: %s", player->Name, Notice);

			SendNotice(szTMP);
			
			return;
		}

		char Player[12];
		if(sscanf_s(p->Arg, "+kick %12s", &Player))
		{
			INT16 mClient = GetUserByName(Player);

			if(mClient < 0 || mClient > MAX_PLAYER || Users[mClient].Status != 22)
			{
				SendClientMessage(p->Header.ClientId, "ClientId não está conectado.");

				return;
			}

			CloseUser(mClient);

			char Msg[108];
			sprintf(Msg, "Jogador %s foi desconectado do servidor.", &Player);

			SendClientMessage(cId, Msg);
			
			return;
		}

		st_Position Pos;
		if(sscanf_s(p->Arg, "+move %d %d", &Pos.X, &Pos.Y))
		{
			if(Pos.Y < 0 || Pos.Y > 4096 || Pos.X < 0 || Pos.X > 4096)
			{
				SendClientMessage(cId, "Coordenadas inválidas.");

				return;
			}

			DoTeleport(cId, Pos.X, Pos.Y);
			
			return;
		}

		if(!stricmp(p->Arg, "+onlines"))
		{
			INT16 Value = 0;
			for(int i = 0; i < 750; i++)
			{
				if(Users[i].Status == 22)
					Value++;
			}

			char szMsg[108];
			sprintf(szMsg, "Atualmente temos %d jogadore(s) online.", Value);

			SendClientMessage(cId, szMsg);

			return;
		}

		if(!stricmp(p->Arg, "+timeon"))
		{
			char szMsg[108];

			sprintf(szMsg, "Servidor online a [%02d:%02d:%02d:%02d].D/H/M/S", Server.Days, Server.Hours, Server.Minuts, Server.Seconds);

			SendClientMessage(cId, szMsg);

			return;
		}

		if(sscanf(p->Arg, "+infos %12s", &Player) == 1)
		{
			int InfoPlayer = GetUserByName(Player);

			if(InfoPlayer < 0 || InfoPlayer > 750 || Users[InfoPlayer].Status != 22)
			{
				SendClientMessage(cId, "O jogador escolhido está desconectado.");
				return;
			}

			st_Mob *sPlayer = GetMobFromIndex(InfoPlayer);

			char szMsg1[200];
			sprintf(szMsg1, "!Conta analisada: %s.", Users[InfoPlayer].Username);
			char szMsg2[200];
			sprintf(szMsg2, "!Total de StatusPoint: %d.", sPlayer->StatusPoint);
			char szMsg3[200];
			sprintf(szMsg3, "!Total de STR: %d, INT: %d, DEX: %d e CONS: %d.", sPlayer->bStatus.STR, sPlayer->bStatus.INT, sPlayer->bStatus.DEX, sPlayer->bStatus.CON);
			char szMsg4[200];
			sprintf(szMsg4, "!A conta possui o total de %d pontos.", sPlayer->bStatus.STR + sPlayer->bStatus.INT + sPlayer->bStatus.DEX + sPlayer->bStatus.CON + sPlayer->StatusPoint);
			char szMsg5[200];
			sprintf(szMsg5, "!Level: %d, Evo: %s, ATK: %d, DEF: %d, HP: %d, MP: %d", sPlayer->bStatus.Level, Evolution[sPlayer->Equip[0].EFV2 - 1], sPlayer->Status.Attack, sPlayer->Status.Defense, sPlayer->Status.maxHP, sPlayer->Status.maxMP);

			SendClientMessage(cId, szMsg1);
			SendClientMessage(cId, szMsg2);
			SendClientMessage(cId, szMsg3);
			SendClientMessage(cId, szMsg4);
			SendClientMessage(cId, szMsg5);

			return;
		}

		SendClientMessage(p->Header.ClientId, "Comando não identificado.");
		return;
	}

	else if(!strcmp(p->Cmd, "King") || !strcmp(p->Cmd, "king") || !strcmp(p->Cmd, "kingdom") || !strcmp(p->Cmd, "Kingdom"))
	{
		*pRetn = true;

		SendClientMessage(cId, "Você foi teleportado.");

		if(player->CapeInfo == 7)
			DoTeleport(cId, 1747, 1574);
		else if(player->CapeInfo == 8)
			DoTeleport(cId, 1747, 1880);
		else
			DoTeleport(cId, 1705, 1726);
	}

	else if(!strcmp(p->Cmd, "kickparty"))
	{
		*pRetn = true;

		char name[12];

		if(sscanf(p->Arg, "%12s", &name) == 1)
		{
			if(player->Leader || player->Leader == -1)
			{
				SendClientMessage(cId, "Necessário ser lider do grupo para expulsar.");

				return;
			}

			INT16 mCid = GetUserByName(name);

			if(!mCid || mCid < 0 || mCid > 750)
			{
				*pRetn = false;

				return;
			}

			else if(Users[mCid].Status != 22)
			{
				*pRetn = false;

				return;
			}

			if(mCid == cId)
			{
				SendClientMessage(cId, "Impossível se expulsar.");

				return;
			}

			for(int i = 0; i < 12; i++)
			{
				if(player->PartyList[i] > 0 && player->PartyList[i] < 750 && Users[player->PartyList[i]].Status == 22)
				{
					st_Mob *mob = GetMobFromIndex(player->PartyList[i]);

					if(!strcmp(mob->Name, name))
					{
						RemoveParty(player->PartyList[i]);

						return;
					}
				}
			}

			SendClientMessage(cId, "Jogador não faz parte do grupo.");

			return;
		}

		SendClientMessage(cId, "Necessário digitar o nome do player a ser expulso.");

		return;
	}

	else if(!strcmp(p->Cmd, "subcreate"))
	{
		*pRetn = true;

		char Leader[12], Sub[16];

		int ret = sscanf(p->Arg, "%12s %16s", &Leader, &Sub);

		if(ret != 2)
		{
			*pRetn = false;

			return;
		}

		INT16 lider = GetUserByName(Leader),
				sub = GetUserByName(Sub);

		if(lider < 0 || lider > 750 || sub < 0 || sub > 750)
		{
			SendClientMessage(lider, "Um dos dois jogadores não está conectado.");

			return;
		}

		if(Users[lider].Status != 22 || Users[sub].Status != 22)
			return;

		if(lider != p->Header.ClientId)
			return;

		st_Mob *leader  = GetMobFromIndex(lider),
			   *subLead = GetMobFromIndex(sub);

		if(!strcmp(subLead->Name, leader->Name))
			return;

		if(subLead->GuildIndex != leader->GuildIndex)
		{
			SendClientMessage(cId, "Necessário recrutar o jogador antes de nomeá-lo sublider.");

			return;
		}

		if(subLead->Equip[12].Index >= 526 && subLead->Equip[12].Index <= 528)
		{
			SendClientMessage(lider, "Jogador já é sublider.");

			return;
		}

		INT8 i = 0;
		while(i < 3)
		{
			if(!strcmp(Guilds[leader->GuildIndex].SubLiderName[i], ""))
				break;

			i++;
		}

		if(i >= 3)
		{
			SendClientMessage(lider, "Máximo de 3 Sublideres por guild.");

			return;
		}

		strncpy(Guilds[leader->GuildIndex].SubLiderName[i], Sub, 16);

		subLead->Equip[12].Index = 526 + i;

		SendItem(sub, EQUIP, 12, &subLead->Equip[12]);

		SendClientMessage(lider, "Jogador recrutado com sucesso.");

		SendClientMessage(sub, "Você foi recrutado.");

		UpdateMGuildInfo(leader->GuildIndex);

		char szMsg[120];
		sprintf(szMsg, "%s é o mais novo sublider !");

		SendGuildChat(leader->GuildIndex, szMsg);

		return;
	}

	else if(!strcmp(p->Cmd, "gtax"))
	{
		*pRetn = true;

		if(player->Equip[12].Index != 509 || !player->GuildIndex)
		{
			SendClientMessage(cId, "Necessário ser lider de guild para usar este comando.");

			return;
		}

		int CityId = player->Info.CityID;

		if(War.Owner[CityId] != Guilds[player->GuildIndex].GuildID)
		{
			SendClientMessage(p->Header.ClientId, "Necessário ser dono da cidade para definir a taixa de imposto.");

			return;
		}

		INT8 Tax = 0;

		if(sscanf(p->Arg, "%d", &Tax) != 1)
		{
			SendClientMessage(cId, "Digite uma taixa válida.");

			return;
		}

		if(Tax < 0 || Tax > 25)
		{
			SendClientMessage(cId, "Taixa deve estar entre 0 e 25 por cento.");

			return;
		}

		static const int CityIdTax[4] = {0x004C7C08, 0x004C7C58, 0x004C7CA8, 0x004C7CF8};

		*(INT32*)CityIdTax[CityId] = Tax;

		char szMsg[108];

		sprintf(szMsg, "Taixa definida como %d.", Tax);

		SendClientMessage(cId, szMsg);

		War.Tax[CityId] = Tax;

		return;
	}

	else if(!stricmp(p->Cmd, "Sair"))
	{
		*pRetn = true;

		if(!player->GuildIndex || !player->Equip[12].Index)
		{
			SendClientMessage(cId, "Necessário estar em guild para sair.");

			return;
		}

		if(player->Equip[12].Index == 509)
		{
			SendClientMessage(cId, "Transfira a guild antes de sair.");

			return;
		}
		else if(player->Equip[12].Index >= 526 && player->Equip[12].Index <= 528)
		{
			for(int i = 0; i < 3; i++)
				if(!stricmp(player->Name, Guilds[player->GuildIndex].SubLiderName[i]))
			    	strncpy(Guilds[player->GuildIndex].SubLiderName[i], "", 16);
		}

		memset(&player->Equip[12], 0x0, sizeof st_Item);

		SendItem(cId, EQUIP, 12, &player->Equip[12]);

		Guilds[player->GuildIndex].Members--;
		player->GuildIndex = 0;

		SendClientMessage(cId, "Saiu da Guild com sucesso.");

		return;
	}

	else if(!stricmp(p->Cmd, "transferir"))
	{
		*pRetn = true;

		if(!player->GuildIndex || !player->Equip[12].Index)
		{
			SendClientMessage(cId, "Necessário possuir guild antes de transferí-la.");

			return;
		}
		else if(!strcmp(p->Arg, ""))
		{
			SendClientMessage(cId, "Digite o nome do novo líder.");

			return;
		}
		else if(player->Equip[12].Index != 509 || strcmp(player->Name, Guilds[player->GuildIndex].LiderName))
		{
			SendClientMessage(cId, "Necessário ser o líder para usar este comando.");

			return;
		}
		
		INT16 ncId = GetUserByName(p->Arg);

		if(!ncId || ncId < 0 || ncId > 750 || Users[ncId].Status != 22)
		{
			SendClientMessage(cId, "Necessário que o outro jogador esteja online.");

			return;
		}
		
		st_Mob *mob = GetMobFromIndex(ncId);

		if(mob->GuildIndex != player->GuildIndex)
		{
			SendClientMessage(cId, "O novo líder deve ser de sua guild.");

			return;
		}
		else if(!Guilds[player->GuildIndex].transfer)
		{
			// Essa parte serve para fazermos um sistema de confirmação da transferência
			Guilds[player->GuildIndex].transfer = true;

			strncpy(Guilds[player->GuildIndex].NewLiderName, mob->Name, 16);

			Guilds[player->GuildIndex].confirmTransfer = 30;

			SendClientMessage(cId, "Deseja mesmo transferir a guild? Caso sim, use o mesmo comando novamente.");

			return;
		}
		else if(!Guilds[player->GuildIndex].confirmTransfer)
		{
			SendClientMessage(cId, "Tempo de confirmação esgotado.");

			return;
		}
		else if(strcmp(mob->Name, Guilds[player->GuildIndex].NewLiderName))
		{
			SendClientMessage(cId, "Confirmação incorreta.");
			
			return;
		}

		if(isSubLider(mob->Name, player->GuildIndex))
		{
			for(int i = 0; i < 3; i++)
				if(!strcmp(mob->Name, Guilds[player->GuildIndex].SubLiderName[i]))
					strncpy(Guilds[player->GuildIndex].SubLiderName[i], "", 16);
		}

		strncpy(Guilds[player->GuildIndex].LiderName, Guilds[player->GuildIndex].NewLiderName, 16);

		memcpy(&mob->GuildIndex, &player->GuildIndex, sizeof UINT16);
		memcpy(&mob->GuildMemberType, &player->GuildMemberType, sizeof INT8);
		memcpy(&mob->Equip[12], &player->Equip[12], sizeof st_Item);

		player->Equip[12].Index = 508;

		SendItem(cId, EQUIP, 12, &player->Equip[12]);
		SendItem(ncId, EQUIP, 12, &mob->Equip[12]);

		char szMsg[120];

		sprintf(szMsg, "Jogador %s é o novo lider da guild !!", mob->Name);

		for(int i = 0; i < MAX_PLAYER; i++)
		{
			st_Mob *p = GetMobFromIndex(i);

			if(p->GuildIndex == mob->GuildIndex)
				sD1D(0x7530, i, szMsg, 0xFF00BFFF);
		}

		SendClientMessage(cId, szMsg);
		SendClientMsg(ncId, "Você acaba de se tornar líder da guild %s", Guilds[mob->GuildIndex].GuildName);

		return;
	}

	else if(!stricmp(p->Cmd, "Criar"))
	{
		*pRetn = true;

		if(player->GuildIndex || player->Equip[12].Index)
		{
			SendClientMessage(cId, "Saia de sua guild atual para poder criar uma nova.");

			return;
		}

		else if(!strcmp(p->Arg, ""))
		{
			SendClientMessage(p->Header.ClientId, "Necessário digitar o nome da guild.");

			return;
		}

		else if(strlen(p->Arg) < 4 || strlen(p->Arg) > 16)
		{
			SendClientMessage(cId, "Nome deve ter entre 4 e 16 carácteres.");

			return;
		}

		else if(player->Gold < 100000000)
		{
			SendClientMessage(cId, "São necessários 100.000.000 (Cem Milhões) de gold para criação da guild.");

			return;
		}

		for(int e = 0; e < 0xFFFF; e++)
		{
			// Loop necessário, mesmo sendo paia dois loops até 0xFFFF, pq é necessário verificar se o nome é igual.
			if(!strcmp(p->Arg, Guilds[e].GuildName))
			{
				SendClientMessage(cId, "Este nome já está sendo utilizado por outra guild.");

				//SendLog(Users[cId].Username, "%s tentou criar guild %s, já existente.", player->Name, p->Arg);

				return;
			}
		}

		int i = 0;
		while(i <= 0xFFFF)
		{
			if(!strcmp(Guilds[i].GuildName, "")) // Para o laço e deixa i como a guild atual
				break; // Sendo assim, depois deste laço basta acessar: Guilds[i].info

			if(i == 0xFFFF)
			{
				SendClientMessage(p->Header.ClientId, "Lamentamos, número máximo de guilds atingido.");

				return;
			}

			i++;
		}

		strncpy(Guilds[i].GuildName, p->Arg, 20);
		strncpy(Guilds[i].LiderName, player->Name, 16);

		for(int e = 0; e < 3; e++)
			strncpy(Guilds[i].SubLiderName[e], "", 16);

		GetCurScore_CapeInfo(player);

		Guilds[i].GuildID = i;
		Guilds[i].Kingdom = player->CapeInfo;

		Guilds[i].Members = 1;

		FILE *pFile = NULL;
 
        fopen_s(&pFile, "Guilds.txt", "a");
        if(pFile)
			fprintf(pFile, "0 0 %d %s\n", Guilds[i].GuildID, Guilds[i].GuildName);
			
		player->GuildIndex = i;
		player->GuildMemberType = 1;

		player->Equip[12].Index = 509;
		player->Equip[12].EF1 = 56;
        player->Equip[12].EFV1 = i >> 8;
        player->Equip[12].EF2 = 57;
        player->Equip[12].EFV2 = i & 255;
        player->Equip[12].EF3 = 59;
        player->Equip[12].EFV3 = 0;

		player->Gold -= 100000000;

		SendItem(p->Header.ClientId, EQUIP, 12, &player->Equip[12]);
		SendScore(p->Header.ClientId);
		SendEtc(p->Header.ClientId);
		SaveGuilds();

		UpdateGuildInfo(p->Header.ClientId);

		//SendLog(Users[cId].Username, "%s criou a guild %s.", player->Name, p->Arg);

		return;
	}
Пример #8
0
//------------------------------------------------------------------------------
// Purpose: Teleport the specified entity instead of the Teleporter's pre
//			determined entity.
//------------------------------------------------------------------------------
void CPointTeleport::InputTeleportEntity( inputdata_t &inputdata )
{
	DoTeleport( inputdata, m_vSaveOrigin, m_vSaveAngles, true );
}
Пример #9
0
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void CPointTeleport::InputTeleport( inputdata_t &inputdata )
{
	DoTeleport( inputdata, m_vSaveOrigin, m_vSaveAngles );
}
Пример #10
0
//Requisição para entrar na pista
bool Pista0_0(int clientid)
{	
	int cMin = PInt(0x00A5EA414);
	MOB *player = (MOB*)GetMobFromIndex(clientid);
	int itemslot = GetFirstSlot(clientid,5134,0,0,0,0,0,0,64);
	int cParty = PInt(clientid * 0x0410 + 0x015C6CD0);

	if(cParty == -1)
	{
		SendClientMsg(clientid,"Acesso apenas em grupo.");
		return FALSE;
	}
	if(itemslot == -1)
	{
		SendClientMsg(clientid,"Você não possui a Pista de Runas.");
		return FALSE;
	}
	if(PartyCount > 1)
	{
		SendClientMsg(clientid,"Dois grupos já estão participando desta quest.");
		return FALSE;
	}
	if(0 == 0)//verificação do tempo
	{	
		if(PartyCount == 0)
		{
			lich1 = 0;
			GreenTimeMap(3384,1646,3343,1611,90);
			tempolich1 = clock() + 430 * CLOCKS_PER_SEC;
			for(int i = 0;i < 6;i++)
			{
				CreateMOB("PLich",3364,1628,"pista");
			}
			CreateMOB("PLich_",3364,1628,"pista");
			pista0 = TRUE;
			PTeleport(clientid,3348,1623);
			DoTeleport(clientid,3348,1623);
			Lider1 = clientid;
		}
		else if(PartyCount == 1)
		{
			lich2 = 0;
			GreenTimeMap(3438,1646,3397,1611,90);
			tempolich2 = clock() + 430 * CLOCKS_PER_SEC;
			for(int i = 0;i < 4;i++)
			{
				CreateMOB("_PLich",3416,1628,"pista");
			}
			CreateMOB("PLich1",3416,1628,"pista");
			PTeleport(clientid,3402,1623);
			DoTeleport(clientid,3402,1623);
			Lider2 = clientid;
		}
		else
		{
			PTeleport(clientid,3379,1635);
			DoTeleport(clientid,3379,1635);
		}
		player->Inventory[itemslot].Index = 0;
		SendInv(clientid,itemslot);
		PartyCount++;
		return TRUE;
	}
	else
	{
		SendClientMsg(clientid,"Apenas nos minutos 00,15,30 e 45.");
	}
	return FALSE;
}
Пример #11
0
int CTrigger::Operate (short nObject, int nPlayer, int bShot, bool bObjTrigger)
{
if (m_info.flags & TF_DISABLED)
	return 1;		//1 means don't send trigger hit to other players

CObject*	objP = (nObject >= 0) ? OBJECTS + nObject : NULL;
bool bIsPlayer = objP && (objP->info.nType == OBJ_PLAYER);

if (bIsPlayer) {
	if (!IsMultiGame && (nObject != LOCALPLAYER.nObject))
		return 1;
	}
else {
	nPlayer = -1;
	if ((m_info.nType != TT_TELEPORT) && (m_info.nType != TT_SPEEDBOOST)) {
		if (objP &&
			 (objP->info.nType != OBJ_ROBOT) &&
			 (objP->info.nType != OBJ_REACTOR) &&
			 (objP->info.nType != OBJ_HOSTAGE) &&
			 (objP->info.nType != OBJ_POWERUP))
			return 1;
		if (!bObjTrigger)
			return 1;
		}
	else
		if (objP &&
			 (objP->info.nType != OBJ_ROBOT) &&
			 (objP->info.nType != OBJ_REACTOR) &&
			 (objP->info.nType != OBJ_HOSTAGE) &&
			 (objP->info.nType != OBJ_POWERUP))
			return 1;
		}

int nTrigger = bObjTrigger ? OBJTRIGGERS.Index (this) : TRIGGERS.Index (this);

if (!bObjTrigger && (m_info.nType != TT_TELEPORT) && (m_info.nType != TT_SPEEDBOOST)) {
	int t = gameStates.app.nSDLTicks;
	if ((gameData.trigs.delay [nTrigger] >= 0) && (t - gameData.trigs.delay [nTrigger] < 750))
		return 1;
	gameData.trigs.delay [nTrigger] = gameStates.app.nSDLTicks;
	}

if (m_info.flags & TF_ONE_SHOT)		//if this is a one-bShot...
	m_info.flags |= TF_DISABLED;		//..then don't let it happen again

if (m_info.tOperated < 0) {
	m_info.tOperated = gameData.time.xGame;
	m_info.nObject = nObject;
	m_info.nPlayer = nPlayer;
	m_info.bShot = bShot;
	}
if (Delay () > 0) {
	gameData.trigs.delay [nTrigger] = -1;
	return 0;
	}

switch (m_info.nType) {

	case TT_EXIT:
		if (DoExit (nPlayer))
			return 1;
		break;

	case TT_SECRET_EXIT:
		if (DoSecretExit (nPlayer))
			return 1;
		break;

	case TT_OPEN_DOOR:
		DoLink ();
		PrintMessage (nPlayer, bShot, "Door%s opened!");
		break;

	case TT_CLOSE_DOOR:
		DoCloseDoor ();
		PrintMessage (nPlayer, bShot, "Door%s closed!");
		break;

	case TT_UNLOCK_DOOR:
		DoUnlockDoors ();
		PrintMessage (nPlayer, bShot, "Door%s unlocked!");
		break;

	case TT_LOCK_DOOR:
		DoLockDoors ();
		PrintMessage (nPlayer, bShot, "Door%s locked!");
		break;

	case TT_OPEN_WALL:
		if (DoChangeWalls ()) {
			if (WallIsForceField ())
				PrintMessage (nPlayer, bShot, "Force field%s deactivated!");
			else
				PrintMessage (nPlayer, bShot, "Wall%s opened!");
			}
		break;

	case TT_CLOSE_WALL:
		if (DoChangeWalls ()) {
			if (WallIsForceField ())
				PrintMessage (nPlayer, bShot, "Force field%s activated!");
			else
				PrintMessage (nPlayer, bShot, "Wall%s closed!");
		}
		break;

	case TT_ILLUSORY_WALL:
		//don't know what to say, so say nothing
		DoChangeWalls ();
		PrintMessage (nPlayer, bShot, "Creating Illusion!");
		break;

	case TT_MATCEN:
		if (!(gameData.app.nGameMode & GM_MULTI) || (gameData.app.nGameMode & GM_MULTI_ROBOTS))
			DoMatCen (nPlayer == gameData.multiplayer.nLocalPlayer);
		break;

	case TT_ILLUSION_ON:
		DoIllusionOn ();
		PrintMessage (nPlayer, bShot, "Illusion%s on!");
		break;

	case TT_ILLUSION_OFF:
		DoIllusionOff ();
		PrintMessage (nPlayer, bShot, "Illusion%s off!");
		break;

	case TT_LIGHT_OFF:
		if (DoLightOff ())
			PrintMessage (nPlayer, bShot, "Lights off!");
		break;

	case TT_LIGHT_ON:
		if (DoLightOn ())
			PrintMessage (nPlayer, bShot, "Lights on!");
		break;

	case TT_TELEPORT:
		if (bObjTrigger) {
			DoTeleportBot (objP);
			PrintMessage (nPlayer, bShot, "Robot is fleeing!");
			}
		else {
			if (bIsPlayer) {
				if (nPlayer != gameData.multiplayer.nLocalPlayer)
					break;
				if ((LOCALPLAYER.shields < 0) || gameStates.app.bPlayerIsDead)
					break;
				}
			audio.PlaySound (SOUND_SECRET_EXIT, I2X (1));
			DoTeleport (nObject);
			if (bIsPlayer)
				PrintMessage (nPlayer, bShot, "Teleport!");
			}
		break;

	case TT_SPEEDBOOST:
		if (bIsPlayer) {
			if (nPlayer != gameData.multiplayer.nLocalPlayer)
				break;
			if ((LOCALPLAYER.shields < 0) || gameStates.app.bPlayerIsDead)
				break;
			}
		DoSpeedBoost (nObject);
		if (bIsPlayer)
			PrintMessage (nPlayer, bShot, "Speed Boost!");
		break;

	case TT_SHIELD_DAMAGE:
		if (!gameStates.app.bPlayerIsDead) {
			if (gameStates.app.bD1Mission)
				LOCALPLAYER.shields -= TRIGGERS [nTrigger].m_info.value;
			else
				LOCALPLAYER.shields -= (fix) ((float (I2X (1)) * X2F (TRIGGERS [nTrigger].m_info.value)));
			if (LOCALPLAYER.shields < 0)
				StartPlayerDeathSequence (OBJECTS + gameData.multiplayer.players [gameData.multiplayer.nLocalPlayer].nObject);
			}
		break;

	case TT_ENERGY_DRAIN:
		if (!gameStates.app.bPlayerIsDead) {
			if (gameStates.app.bD1Mission)
				LOCALPLAYER.energy -= TRIGGERS [nTrigger].m_info.value;
			else
				LOCALPLAYER.energy -= (fix) (LOCALPLAYER.energy * X2F (TRIGGERS [nTrigger].m_info.value) / 100);
			if (LOCALPLAYER.energy < 0)
				LOCALPLAYER.energy = 0;
			}
		break;

	case TT_CHANGE_TEXTURE:
		DoChangeTexture ();
		PrintMessage (nPlayer, 2, "Walls have been changed!");
		break;

	case TT_SPAWN_BOT:
		DoSpawnBots (objP);
		PrintMessage (nPlayer, 1, "Robot is summoning help!");
		break;

	case TT_SET_SPAWN:
		DoSetSpawnPoints ();
		PrintMessage (nPlayer, 1, "New spawn points set!");
		break;

	case TT_SMOKE_LIFE:
	case TT_SMOKE_SPEED:
	case TT_SMOKE_DENS:
	case TT_SMOKE_SIZE:
	case TT_SMOKE_DRIFT:
		break;

	case TT_COUNTDOWN:
		InitCountdown (this, 1, -1);
		break;

	case TT_MESSAGE:
		DoShowMessage ();
		break;

	case TT_SOUND:
		DoPlaySound (nObject);
		break;

	case TT_MASTER:
		DoMasterTrigger (nObject);
		break;

	case TT_ENABLE_TRIGGER:
		DoEnableTrigger ();
#if DBG
		PrintMessage (nPlayer, 2, "Triggers have been enabled!");
#endif
		break;

	case TT_DISABLE_TRIGGER:
		DoDisableTrigger ();
#if DBG
		PrintMessage (nPlayer, 2, "Triggers have been disabled!");
#endif
		break;

	case TT_DESCENT1:
		OperateD1 (nObject, nPlayer, bShot);
		break;

	default:
		Int3 ();
		break;
	}
if (m_info.flags & TF_ALTERNATE)
	m_info.nType = oppTrigTypes [m_info.nType];
return 0;
}
Пример #12
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;
		}
	}
}