Ir para conteúdo

Featured Replies

Postado

Falar turma do TK, estou precisando de ajudar de vocês pra cria um sisteminha pra o meu servidor que vai chamar Anti-Exiva.

 

Como vai funcionar isso?: 

Citando as palavras mágicas exana exiva, o jogador fica camuflado e ninguém do servidor poderá usar a spell Find Person (Exiva) durante três minutos. (limite de 3 cargas).

 

Quando a spell é ativado vai aparece um mensagem global pra todos. 

 

MSG: "Alguém Acaba de usar a magia Exana Exiva."

 

Quando alguém tentar usar nesse periodo de 3 minuntos.

 

MSG: "Uma enorme nuvem gelada está atrapalhando seu exiva."

 

Quando a spell acaba.

 

MSG: "A estranha névoa que impedia a magia Find Person(exiva) de funcionar a longas distâncias, acabou."

 

Bom tropa já procurei bastante pelo Google e unicas coisa que descobrir foi que tem que mexe nas sources.

 

Spoiler




bool InstantSpell::SearchPlayer(const InstantSpell*, Creature* creature, const std::string& param)
{
	//a. From 1 to 4 sq's [Person] is standing next to you.
	//b. From 5 to 100 sq's [Person] is to the south, north, east, west.
	//c. From 101 to 274 sq's [Person] is far to the south, north, east, west.
	//d. From 275 to infinite sq's [Person] is very far to the south, north, east, west.
	//e. South-west, s-e, n-w, n-e (corner coordinates): this phrase appears if the player you're looking for has moved five squares in any direction from the south, north, east or west.
	//f. Lower level to the (direction): this phrase applies if the person you're looking for is from 1-25 squares up/down the actual floor you're in.
	//g. Higher level to the (direction): this phrase applies if the person you're looking for is from 1-25 squares up/down the actual floor you're in.

	Player* player = creature->getPlayer();
	if (!player) {
		return false;
	}

	enum distance_t {
		DISTANCE_BESIDE,
		DISTANCE_CLOSE,
		DISTANCE_FAR,
		DISTANCE_VERYFAR,
	};

	enum direction_t {
		DIR_N, DIR_S, DIR_E, DIR_W,
		DIR_NE, DIR_NW, DIR_SE, DIR_SW,
	};

	enum level_t {
		LEVEL_HIGHER,
		LEVEL_LOWER,
		LEVEL_SAME,
	};

	Player* playerExiva = g_game.getPlayerByName(param);
	if (!playerExiva) {
		return false;
	}

	if (playerExiva->isAccessPlayer() && !player->isAccessPlayer()) {
		player->sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE);
		g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
		return false;
	}

	const Position& lookPos = player->getPosition();
	const Position& searchPos = playerExiva->getPosition();

	int32_t dx = Position::getOffsetX(lookPos, searchPos);
	int32_t dy = Position::getOffsetY(lookPos, searchPos);
	int32_t dz = Position::getOffsetZ(lookPos, searchPos);

	distance_t distance;

	direction_t direction;

	level_t level;

	//getting floor
	if (dz > 0) {
		level = LEVEL_HIGHER;
	} else if (dz < 0) {
		level = LEVEL_LOWER;
	} else {
		level = LEVEL_SAME;
	}

	//getting distance
	if (std::abs(dx) < 4 && std::abs(dy) < 4) {
		distance = DISTANCE_BESIDE;
	} else {
		int32_t distance2 = dx * dx + dy * dy;
		if (distance2 < 10000) {
			distance = DISTANCE_CLOSE;
		} else if (distance2 < 75076) {
			distance = DISTANCE_FAR;
		} else {
			distance = DISTANCE_VERYFAR;
		}
	}

	//getting direction
	float tan;
	if (dx != 0) {
		tan = static_cast<float>(dy) / dx;
	} else {
		tan = 10.;
	}

	if (std::abs(tan) < 0.4142) {
		if (dx > 0) {
			direction = DIR_W;
		} else {
			direction = DIR_E;
		}
	} else if (std::abs(tan) < 2.4142) {
		if (tan > 0) {
			if (dy > 0) {
				direction = DIR_NW;
			} else {
				direction = DIR_SE;
			}
		} else {
			if (dx > 0) {
				direction = DIR_SW;
			} else {
				direction = DIR_NE;
			}
		}
	} else {
		if (dy > 0) {
			direction = DIR_N;
		} else {
			direction = DIR_S;
		}
	}

	std::ostringstream ss;
	ss << playerExiva->getName();

	if (distance == DISTANCE_BESIDE) {
		if (level == LEVEL_SAME) {
			ss << " is standing next to you.";
		} else if (level == LEVEL_HIGHER) {
			ss << " is above you.";
		} else if (level == LEVEL_LOWER) {
			ss << " is below you.";
		}
	} else {
		switch (distance) {
			case DISTANCE_CLOSE:
				if (level == LEVEL_SAME) {
					ss << " is to the ";
				} else if (level == LEVEL_HIGHER) {
					ss << " is on a higher level to the ";
				} else if (level == LEVEL_LOWER) {
					ss << " is on a lower level to the ";
				}
				break;
			case DISTANCE_FAR:
				ss << " is far to the ";
				break;
			case DISTANCE_VERYFAR:
				ss << " is very far to the ";
				break;
			default:
				break;
		}

		switch (direction) {
			case DIR_N:
				ss << "north.";
				break;
			case DIR_S:
				ss << "south.";
				break;
			case DIR_E:
				ss << "east.";
				break;
			case DIR_W:
				ss << "west.";
				break;
			case DIR_NE:
				ss << "north-east.";
				break;
			case DIR_NW:
				ss << "north-west.";
				break;
			case DIR_SE:
				ss << "south-east.";
				break;
			case DIR_SW:
				ss << "south-west.";
				break;
		}
	}
	player->sendTextMessage(MESSAGE_INFO_DESCR, ss.str());
	g_game.addMagicEffect(player->getPosition(), CONST_ME_MAGIC_BLUE);
	return true;
}

 

 

e também achei esse codigo.

Spoiler


if(target->noExiva){

player->sendTextMessage(MSG_EVENT,"This player is using anti-Exiva.");

target->sendTextMessage(MSG_EVENT, << player << " used exiva on you.");

target->noExiva = false; // make it only work 1 time after wards it just removes there anti-exiva

 

else

//exiva code//

 

------------------------------------------------------------------------------------------------

 

if(text == "exeva"){

bool removeMana = false;

if(player->mana >= 80){

player->mana -= 80;

player->manaspent += 80;

player->sendStats();

removeMana = true;

}

else {

player->sendTextMessage(MSG_SMALLINFO,"Not enough mana.");

player->sendMagicEffect(player->pos, NM_ME_PUFF);

}

if(removeMana){

player->sendTextMessage(MSG_EVENT,"You are protected");

player->sendMagicEffect(player->pos, NM_ME_ENERGY_AREA);

player->noExiva = true;

}

}

------------------------------------------------------------------------------------------------

noExiva = false;

 

 

 

 

------------------------------------------------------------------------------------------------

bool noExiva;

 

 

@xWhiteWolf  @Vodkart

Bom é isso meu servidor é versão 8.60 uso a sources tfs 0.4.

Editado por BangxD (veja o histórico de edições)

Resolvido por Marvok

Ir para solução
  • 2 weeks later...
  • Respostas 7
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • em spells.cpp logo dps de: Player* playerExiva = g_game.getPlayerByName(param); if (!playerExiva) { return false; } coloca isso std::string stoNamequequiser; playerExiva->getStorage

  • Sim amigo é 0.4, se você observar o code é o mesmo mudando somente a variável..   se você trocar playerExiva (do meu code) para targetPlayer (do seu code), irá funcionar.   teste e

  • Não irá ter problema nenhum, foi um pequeno engano no code que fez gerar o erro, mais já modifiquei..   dessa forma que você fez está correto tb.

Posted Images

Postado
Em 10/04/2021 em 16:56, BangxD disse:

Falar turma do TK, estou precisando de ajudar de vocês pra cria um sisteminha pra o meu servidor que vai chamar Anti-Exiva.

 

Como vai funcionar isso?: 

Citando as palavras mágicas exana exiva, o jogador fica camuflado e ninguém do servidor poderá usar a spell Find Person (Exiva) durante três minutos. (limite de 3 cargas).

 

Quando a spell é ativado vai aparece um mensagem global pra todos. 

 

MSG: "Alguém Acaba de usar a magia Exana Exiva."

 

Quando alguém tentar usar nesse periodo de 3 minuntos.

 

MSG: "Uma enorme nuvem gelada está atrapalhando seu exiva."

 

Quando a spell acaba.

 

MSG: "A estranha névoa que impedia a magia Find Person(exiva) de funcionar a longas distâncias, acabou."

 

Bom tropa já procurei bastante pelo Google e unicas coisa que descobrir foi que tem que mexe nas sources.

 

  Mostrar conteúdo oculto



bool InstantSpell::SearchPlayer(const InstantSpell*, Creature* creature, const std::string& param)
{
	//a. From 1 to 4 sq's [Person] is standing next to you.
	//b. From 5 to 100 sq's [Person] is to the south, north, east, west.
	//c. From 101 to 274 sq's [Person] is far to the south, north, east, west.
	//d. From 275 to infinite sq's [Person] is very far to the south, north, east, west.
	//e. South-west, s-e, n-w, n-e (corner coordinates): this phrase appears if the player you're looking for has moved five squares in any direction from the south, north, east or west.
	//f. Lower level to the (direction): this phrase applies if the person you're looking for is from 1-25 squares up/down the actual floor you're in.
	//g. Higher level to the (direction): this phrase applies if the person you're looking for is from 1-25 squares up/down the actual floor you're in.

	Player* player = creature->getPlayer();
	if (!player) {
		return false;
	}

	enum distance_t {
		DISTANCE_BESIDE,
		DISTANCE_CLOSE,
		DISTANCE_FAR,
		DISTANCE_VERYFAR,
	};

	enum direction_t {
		DIR_N, DIR_S, DIR_E, DIR_W,
		DIR_NE, DIR_NW, DIR_SE, DIR_SW,
	};

	enum level_t {
		LEVEL_HIGHER,
		LEVEL_LOWER,
		LEVEL_SAME,
	};

	Player* playerExiva = g_game.getPlayerByName(param);
	if (!playerExiva) {
		return false;
	}

	if (playerExiva->isAccessPlayer() && !player->isAccessPlayer()) {
		player->sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE);
		g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
		return false;
	}

	const Position& lookPos = player->getPosition();
	const Position& searchPos = playerExiva->getPosition();

	int32_t dx = Position::getOffsetX(lookPos, searchPos);
	int32_t dy = Position::getOffsetY(lookPos, searchPos);
	int32_t dz = Position::getOffsetZ(lookPos, searchPos);

	distance_t distance;

	direction_t direction;

	level_t level;

	//getting floor
	if (dz > 0) {
		level = LEVEL_HIGHER;
	} else if (dz < 0) {
		level = LEVEL_LOWER;
	} else {
		level = LEVEL_SAME;
	}

	//getting distance
	if (std::abs(dx) < 4 && std::abs(dy) < 4) {
		distance = DISTANCE_BESIDE;
	} else {
		int32_t distance2 = dx * dx + dy * dy;
		if (distance2 < 10000) {
			distance = DISTANCE_CLOSE;
		} else if (distance2 < 75076) {
			distance = DISTANCE_FAR;
		} else {
			distance = DISTANCE_VERYFAR;
		}
	}

	//getting direction
	float tan;
	if (dx != 0) {
		tan = static_cast<float>(dy) / dx;
	} else {
		tan = 10.;
	}

	if (std::abs(tan) < 0.4142) {
		if (dx > 0) {
			direction = DIR_W;
		} else {
			direction = DIR_E;
		}
	} else if (std::abs(tan) < 2.4142) {
		if (tan > 0) {
			if (dy > 0) {
				direction = DIR_NW;
			} else {
				direction = DIR_SE;
			}
		} else {
			if (dx > 0) {
				direction = DIR_SW;
			} else {
				direction = DIR_NE;
			}
		}
	} else {
		if (dy > 0) {
			direction = DIR_N;
		} else {
			direction = DIR_S;
		}
	}

	std::ostringstream ss;
	ss << playerExiva->getName();

	if (distance == DISTANCE_BESIDE) {
		if (level == LEVEL_SAME) {
			ss << " is standing next to you.";
		} else if (level == LEVEL_HIGHER) {
			ss << " is above you.";
		} else if (level == LEVEL_LOWER) {
			ss << " is below you.";
		}
	} else {
		switch (distance) {
			case DISTANCE_CLOSE:
				if (level == LEVEL_SAME) {
					ss << " is to the ";
				} else if (level == LEVEL_HIGHER) {
					ss << " is on a higher level to the ";
				} else if (level == LEVEL_LOWER) {
					ss << " is on a lower level to the ";
				}
				break;
			case DISTANCE_FAR:
				ss << " is far to the ";
				break;
			case DISTANCE_VERYFAR:
				ss << " is very far to the ";
				break;
			default:
				break;
		}

		switch (direction) {
			case DIR_N:
				ss << "north.";
				break;
			case DIR_S:
				ss << "south.";
				break;
			case DIR_E:
				ss << "east.";
				break;
			case DIR_W:
				ss << "west.";
				break;
			case DIR_NE:
				ss << "north-east.";
				break;
			case DIR_NW:
				ss << "north-west.";
				break;
			case DIR_SE:
				ss << "south-east.";
				break;
			case DIR_SW:
				ss << "south-west.";
				break;
		}
	}
	player->sendTextMessage(MESSAGE_INFO_DESCR, ss.str());
	g_game.addMagicEffect(player->getPosition(), CONST_ME_MAGIC_BLUE);
	return true;
}

 

 

e também achei esse codigo.

  Mostrar conteúdo oculto


if(target->noExiva){

player->sendTextMessage(MSG_EVENT,"This player is using anti-Exiva.");

target->sendTextMessage(MSG_EVENT, << player << " used exiva on you.");

target->noExiva = false; // make it only work 1 time after wards it just removes there anti-exiva

 

else

//exiva code//

 

------------------------------------------------------------------------------------------------

 

if(text == "exeva"){

bool removeMana = false;

if(player->mana >= 80){

player->mana -= 80;

player->manaspent += 80;

player->sendStats();

removeMana = true;

}

else {

player->sendTextMessage(MSG_SMALLINFO,"Not enough mana.");

player->sendMagicEffect(player->pos, NM_ME_PUFF);

}

if(removeMana){

player->sendTextMessage(MSG_EVENT,"You are protected");

player->sendMagicEffect(player->pos, NM_ME_ENERGY_AREA);

player->noExiva = true;

}

}

------------------------------------------------------------------------------------------------

noExiva = false;

 

 

 

 

------------------------------------------------------------------------------------------------

bool noExiva;

 

 

@xWhiteWolf  @Vodkart

Bom é isso meu servidor é versão 8.60 uso a sources tfs 0.4.

Cara tu já tentou fazer com storage? Não é nada complicado isso que você está pedindo.

Postado
  • Autor
10 horas atrás, Marvok disse:

Cara tu já tentou fazer com storage? Não é nada complicado isso que você está pedindo.

é o que quero fazer mas nao sei por onde começar. se o script do exiva fosse em lua até conseguia criar o anti-exiva, mas é em C++. não sei por onde começar. Pode me ajudar?

Editado por BangxD (veja o histórico de edições)

Postado
  • Solução
Em 19/04/2021 em 19:29, BangxD disse:

é o que quero fazer mas nao sei por onde começar. se o script do exiva fosse em lua até conseguia criar o anti-exiva, mas é em C++. não sei por onde começar. Pode me ajudar?

em spells.cpp logo dps de:

Player* playerExiva = g_game.getPlayerByName(param);
	if (!playerExiva) {
		return false;
	}

coloca isso

std::string stoNamequequiser;
	playerExiva->getStorage("141414", stoNamequequiser);
	if(atoi(stoNamequequiser.c_str()) > 0){
		std::stringstream ss;
		ss << playerExiva->getName() << " blablabla.";
		player->sendTextMessage(MSG_INFO_DESCR, ss.str().c_str());
		return true;
	}

e dps faz uma talk simples para dar essa storage que esta no script.

Editado por Marvok (veja o histórico de edições)

Postado
  • Autor
22 horas atrás, Marvok disse:

em spells.cpp logo dps de:


Player* playerExiva = g_game.getPlayerByName(param);
	if (!playerExiva) {
		return false;
	}

coloca isso


std::string stoTraining;
	playerExiva->getStorage("141414", stoNamequequiser);
	if(atoi(stoNamequequiser.c_str()) > 0){
		std::stringstream ss;
		ss << playerExiva->getName() << " blablabla.";
		player->sendTextMessage(MSG_INFO_DESCR, ss.str().c_str());
		return true;
	}

e dps faz uma talk simples para dar essa storage que esta no script.

desculpa a demora mas não estou conseguido localizando essa parte de spells.cpp

Player* playerExiva = g_game.getPlayerByName(param);
	if (!playerExiva) {
		return false;
	}

isso é pra tfs 0.4?

 

isso que achei sobre exiva em spells.cpp

 

bool InstantSpell::SearchPlayer(const InstantSpell*, Creature* creature, const std::string& param)
{
	Player* player = creature->getPlayer();
	if(!player || player->isRemoved())
		return false;

	Player* targetPlayer = NULL;
	ReturnValue ret = g_game.getPlayerByNameWildcard(param, targetPlayer);
	if(ret != RET_NOERROR || !targetPlayer || targetPlayer->isRemoved())
	{
		player->sendCancelMessage(ret);
		g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
		return false;
	}

	if(targetPlayer->hasCustomFlag(PlayerCustomFlag_NotSearchable) && !player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges))
	{
		player->sendCancelMessage(RET_PLAYERWITHTHISNAMEISNOTONLINE);
		g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
		return false;
	}

	std::stringstream ss;
	ss << targetPlayer->getName() << " " << g_game.getSearchString(player->getPosition(), targetPlayer->getPosition(), true, true) << ".";
	player->sendTextMessage(MSG_INFO_DESCR, ss.str().c_str());

	g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_WRAPS_BLUE);
	return true;
}

 

Editado por BangxD (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo