Ir para conteúdo
  • Cadastre-se

(Resolvido)[ERRO] Source?


Ir para solução Resolvido por Tricoder,

Posts Recomendados

Estou com dois problemas, creio que seja easy corrigir.
Imagem Explica tudo.

TFS: 0.4

Tibia: 8.6

Citar

5665c8a463731_2problemas.thumb.jpg.43a7a

 

 

1- Erro das potions, eu tenho mais que 69 potions, mas ele apenas diz o Cento que está sendo utilizado. era para constar todas as pots da backpack.

1- RESOLUÇÃO -

Spoiler

Vá em game.cpp, procure por:


void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	int32_t subType = -1;
	if(item->hasSubType() && !item->hasCharges())
		subType = item->getSubType();
 
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), subType, false);
 
	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

Substitua por:


void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), -1);
 
	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

ACHEI PRA TFS 0.3.6. Não Sei se Rola em TFS 0.4 se Alguém souber configurar para TFS 0.4

separador.thumb.png.9d2ac3e3a921b4dadca4

2- Quando um player recebe dinheiro, ou apenas puxa de um monstro morto, ele não fica juntando automaticamente, sendo ele dinheiro ou não.

2- RESOLUÇÃO -

Spoiler

container.cpp


Cylinder* Container::__queryDestination(int32_t& index, const Thing* thing, Item** destItem, uint32_t&)
{
	if(index == 254 /*move up*/)
	{
		index = INDEX_WHEREEVER;
		*destItem = NULL;
 
		Container* parentContainer = dynamic_cast<Container*>(getParent());
		if(parentContainer)
			return parentContainer;
 
		return this;
	}
	else if(index == 255 /*add wherever*/){
		index = INDEX_WHEREEVER;
		*destItem = NULL;
	}
	else if(index >= (int32_t)capacity()){
			/*
			if you have a container, maximize it to show all 20 slots
			then you open a bag that is inside the container you will have a bag with 8 slots
			and a "grey" area where the other 12 slots where from the container
			if you drop the item on that grey area
			the client calculates the slot position as if the bag has 20 slots
			*/
			index = INDEX_WHEREEVER;
		*destItem = NULL;
	}
 
	const Item* item = thing->getItem();
	if(item == NULL){
		return this;
	}
 
	if(item->isStackable()){
		if(item->getParent() != this){
			//try find a suitable item to stack with
			uint32_t n = 0;
			for(ItemList::iterator cit = itemlist.begin(); cit != itemlist.end(); ++cit){
				if((*cit) != item && (*cit)->getID() == item->getID() && (*cit)->getItemCount() < 100){
					*destItem = (*cit);
					index = n;
					return this;
				}
 
				++n;
			}
		}
	}
 
	if(index != INDEX_WHEREEVER){
		Thing* destThing = __getThing(index);
		if(destThing)
			*destItem = destThing->getItem();
 
		Cylinder* subCylinder = dynamic_cast<Cylinder*>(*destItem);
 
		if(subCylinder){
			index = INDEX_WHEREEVER;
			*destItem = NULL;
			return subCylinder;
		}
	}
 
	return this;
}

item.cpp


void Item::setDefaultSubtype()
{
	setItemCount(1);
	const ItemType& it = items[id];
	if(it.charges)
		setCharges(it.charges);
}

player.cpp


Cylinder* Player::__queryDestination(int32_t& index, const Thing* thing, Item** destItem,
	uint32_t& flags)
{
	if(index == 0 /*drop to capacity window*/ || index == INDEX_WHEREEVER){
		*destItem = NULL;
 
		const Item* item = thing->getItem();
		if(item == NULL){
			return this;
		}
 
		//find an appropiate slot
		std::list<Container*> containerList;
		for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){
			Item* inventoryItem = inventory[i];
 
			if(inventoryItem == tradeItem){
				continue;
			}
 
			if(inventoryItem == tradeItem){
				continue;
			}
 
				if(inventoryItem){
					//try find an already existing item to stack with
				if(inventoryItem != item && item->isStackable() && inventoryItem->getID() == item->getID() && inventoryItem->getItemCount() < 100){
					*destItem = inventoryItem;
					index = i;
					return this;
				}
				//check sub-containers
				else if(Container* subContainer = inventoryItem->getContainer()){
					Cylinder* tmpCylinder = NULL;
					int32_t tmpIndex = INDEX_WHEREEVER;
					Item* tmpDestItem = NULL;
 
					tmpCylinder = subContainer->__queryDestination(tmpIndex, item, &tmpDestItem, flags);
					if(tmpCylinder && tmpCylinder->__queryAdd(tmpIndex, item, item->getItemCount(), flags) == RET_NOERROR){
						index = tmpIndex;
						*destItem = tmpDestItem;
						return tmpCylinder;
					}
 
					containerList.push_back(subContainer);
				}
			}
			//empty slot
			else if(__queryAdd(i, item, item->getItemCount(), flags) == RET_NOERROR){
				index = i;
				*destItem = NULL;
				return this;
			}
		}
 
		//check deeper in the containers
		for(std::list<Container*>::iterator it = containerList.begin(); it != containerList.end(); ++it){
			for(ContainerIterator iit = (*it)->begin(); iit != (*it)->end(); ++iit){
				if(Container* subContainer = (*iit)->getContainer()){
 
					if(subContainer == tradeItem){
						continue;
					}
 
					Cylinder* tmpCylinder = NULL;
					int32_t tmpIndex = INDEX_WHEREEVER;
					Item* tmpDestItem = NULL;
 
					tmpCylinder = subContainer->__queryDestination(tmpIndex, item, &tmpDestItem, flags);
					if(tmpCylinder && tmpCylinder->__queryAdd(tmpIndex, item, item->getItemCount(), flags) == RET_NOERROR){
						index = tmpIndex;
						*destItem = tmpDestItem;
						return tmpCylinder;
					}
				}
			}
		}
		return this;
	}
 
	Thing* destThing = __getThing(index);
	if(destThing)
		*destItem = destThing->getItem();
 
	Cylinder* subCylinder = dynamic_cast<Cylinder*>(destThing);
 
	if(subCylinder){
		index = INDEX_WHEREEVER;
		*destItem = NULL;
		return subCylinder;
	}
	else
		return this;
}

separador.thumb.png.9d2ac3e3a921b4dadca4

 

Identificado apenas que o erro pode ser contido as Sources. @ciroc

Se possível passar resolução adiciono os nomes e as Reps++.

 

Não Fechem este tópico que assim que resolver o Problema irei postar como Resolver o mesmo.

Para que Todos que tenham a mesma dúvida consigam encontrar respostas.

 

REP++ @Azhaurn

Editado por Andre Felipe de Azev (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

1. Não é erro, isso é um bug do 8.60 mesmo.

Spoiler

 

 

Vá em game.cpp, procure por:


void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	int32_t subType = -1;
	if(item->hasSubType() && !item->hasCharges())
		subType = item->getSubType();
 
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), subType, false);
 
	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

Substitua por:


void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), -1);
 
	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}


 

 

 

2. Porque nessa versão de TFS só é possível alterando as sources. Faça o seguinte:
 

Spoiler

 

 

container.cpp


Cylinder* Container::__queryDestination(int32_t& index, const Thing* thing, Item** destItem, uint32_t&)
{
	if(index == 254 /*move up*/)
	{
		index = INDEX_WHEREEVER;
		*destItem = NULL;
 
		Container* parentContainer = dynamic_cast<Container*>(getParent());
		if(parentContainer)
			return parentContainer;
 
		return this;
	}
	else if(index == 255 /*add wherever*/){
		index = INDEX_WHEREEVER;
		*destItem = NULL;
	}
	else if(index >= (int32_t)capacity()){
			/*
			if you have a container, maximize it to show all 20 slots
			then you open a bag that is inside the container you will have a bag with 8 slots
			and a "grey" area where the other 12 slots where from the container
			if you drop the item on that grey area
			the client calculates the slot position as if the bag has 20 slots
			*/
			index = INDEX_WHEREEVER;
		*destItem = NULL;
	}
 
	const Item* item = thing->getItem();
	if(item == NULL){
		return this;
	}
 
	if(item->isStackable()){
		if(item->getParent() != this){
			//try find a suitable item to stack with
			uint32_t n = 0;
			for(ItemList::iterator cit = itemlist.begin(); cit != itemlist.end(); ++cit){
				if((*cit) != item && (*cit)->getID() == item->getID() && (*cit)->getItemCount() < 100){
					*destItem = (*cit);
					index = n;
					return this;
				}
 
				++n;
			}
		}
	}
 
	if(index != INDEX_WHEREEVER){
		Thing* destThing = __getThing(index);
		if(destThing)
			*destItem = destThing->getItem();
 
		Cylinder* subCylinder = dynamic_cast<Cylinder*>(*destItem);
 
		if(subCylinder){
			index = INDEX_WHEREEVER;
			*destItem = NULL;
			return subCylinder;
		}
	}
 
	return this;
}

item.cpp


void Item::setDefaultSubtype()
{
	setItemCount(1);
	const ItemType& it = items[id];
	if(it.charges)
		setCharges(it.charges);
}

player.cpp


Cylinder* Player::__queryDestination(int32_t& index, const Thing* thing, Item** destItem,
	uint32_t& flags)
{
	if(index == 0 /*drop to capacity window*/ || index == INDEX_WHEREEVER){
		*destItem = NULL;
 
		const Item* item = thing->getItem();
		if(item == NULL){
			return this;
		}
 
		//find an appropiate slot
		std::list<Container*> containerList;
		for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){
			Item* inventoryItem = inventory[i];
 
			if(inventoryItem == tradeItem){
				continue;
			}
 
			if(inventoryItem == tradeItem){
				continue;
			}
 
				if(inventoryItem){
					//try find an already existing item to stack with
				if(inventoryItem != item && item->isStackable() && inventoryItem->getID() == item->getID() && inventoryItem->getItemCount() < 100){
					*destItem = inventoryItem;
					index = i;
					return this;
				}
				//check sub-containers
				else if(Container* subContainer = inventoryItem->getContainer()){
					Cylinder* tmpCylinder = NULL;
					int32_t tmpIndex = INDEX_WHEREEVER;
					Item* tmpDestItem = NULL;
 
					tmpCylinder = subContainer->__queryDestination(tmpIndex, item, &tmpDestItem, flags);
					if(tmpCylinder && tmpCylinder->__queryAdd(tmpIndex, item, item->getItemCount(), flags) == RET_NOERROR){
						index = tmpIndex;
						*destItem = tmpDestItem;
						return tmpCylinder;
					}
 
					containerList.push_back(subContainer);
				}
			}
			//empty slot
			else if(__queryAdd(i, item, item->getItemCount(), flags) == RET_NOERROR){
				index = i;
				*destItem = NULL;
				return this;
			}
		}
 
		//check deeper in the containers
		for(std::list<Container*>::iterator it = containerList.begin(); it != containerList.end(); ++it){
			for(ContainerIterator iit = (*it)->begin(); iit != (*it)->end(); ++iit){
				if(Container* subContainer = (*iit)->getContainer()){
 
					if(subContainer == tradeItem){
						continue;
					}
 
					Cylinder* tmpCylinder = NULL;
					int32_t tmpIndex = INDEX_WHEREEVER;
					Item* tmpDestItem = NULL;
 
					tmpCylinder = subContainer->__queryDestination(tmpIndex, item, &tmpDestItem, flags);
					if(tmpCylinder && tmpCylinder->__queryAdd(tmpIndex, item, item->getItemCount(), flags) == RET_NOERROR){
						index = tmpIndex;
						*destItem = tmpDestItem;
						return tmpCylinder;
					}
				}
			}
		}
		return this;
	}
 
	Thing* destThing = __getThing(index);
	if(destThing)
		*destItem = destThing->getItem();
 
	Cylinder* subCylinder = dynamic_cast<Cylinder*>(destThing);
 
	if(subCylinder){
		index = INDEX_WHEREEVER;
		*destItem = NULL;
		return subCylinder;
	}
	else
		return this;
}


 

 

Link para o post
Compartilhar em outros sites

@Azhaurn Irei Testar sim, Obrigado, é só substituir tudo né?

29 minutos atrás, Azhaurn disse:

1. Não é erro, isso é um bug do 8.60 mesmo.

  Mostrar conteúdo oculto

 

 

Vá em game.cpp, procure por:



void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	int32_t subType = -1;
	if(item->hasSubType() && !item->hasCharges())
		subType = item->getSubType();
 
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), subType, false);
 
	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

Substitua por:



void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), -1);
 
	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());
 
	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

 

 

 

 

2. Porque nessa versão de TFS só é possível alterando as sources. Faça o seguinte:
 

  Mostrar conteúdo oculto

 

 

container.cpp



Cylinder* Container::__queryDestination(int32_t& index, const Thing* thing, Item** destItem, uint32_t&)
{
	if(index == 254 /*move up*/)
	{
		index = INDEX_WHEREEVER;
		*destItem = NULL;
 
		Container* parentContainer = dynamic_cast<Container*>(getParent());
		if(parentContainer)
			return parentContainer;
 
		return this;
	}
	else if(index == 255 /*add wherever*/){
		index = INDEX_WHEREEVER;
		*destItem = NULL;
	}
	else if(index >= (int32_t)capacity()){
			/*
			if you have a container, maximize it to show all 20 slots
			then you open a bag that is inside the container you will have a bag with 8 slots
			and a "grey" area where the other 12 slots where from the container
			if you drop the item on that grey area
			the client calculates the slot position as if the bag has 20 slots
			*/
			index = INDEX_WHEREEVER;
		*destItem = NULL;
	}
 
	const Item* item = thing->getItem();
	if(item == NULL){
		return this;
	}
 
	if(item->isStackable()){
		if(item->getParent() != this){
			//try find a suitable item to stack with
			uint32_t n = 0;
			for(ItemList::iterator cit = itemlist.begin(); cit != itemlist.end(); ++cit){
				if((*cit) != item && (*cit)->getID() == item->getID() && (*cit)->getItemCount() < 100){
					*destItem = (*cit);
					index = n;
					return this;
				}
 
				++n;
			}
		}
	}
 
	if(index != INDEX_WHEREEVER){
		Thing* destThing = __getThing(index);
		if(destThing)
			*destItem = destThing->getItem();
 
		Cylinder* subCylinder = dynamic_cast<Cylinder*>(*destItem);
 
		if(subCylinder){
			index = INDEX_WHEREEVER;
			*destItem = NULL;
			return subCylinder;
		}
	}
 
	return this;
}

item.cpp



void Item::setDefaultSubtype()
{
	setItemCount(1);
	const ItemType& it = items[id];
	if(it.charges)
		setCharges(it.charges);
}

player.cpp



Cylinder* Player::__queryDestination(int32_t& index, const Thing* thing, Item** destItem,
	uint32_t& flags)
{
	if(index == 0 /*drop to capacity window*/ || index == INDEX_WHEREEVER){
		*destItem = NULL;
 
		const Item* item = thing->getItem();
		if(item == NULL){
			return this;
		}
 
		//find an appropiate slot
		std::list<Container*> containerList;
		for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){
			Item* inventoryItem = inventory[i];
 
			if(inventoryItem == tradeItem){
				continue;
			}
 
			if(inventoryItem == tradeItem){
				continue;
			}
 
				if(inventoryItem){
					//try find an already existing item to stack with
				if(inventoryItem != item && item->isStackable() && inventoryItem->getID() == item->getID() && inventoryItem->getItemCount() < 100){
					*destItem = inventoryItem;
					index = i;
					return this;
				}
				//check sub-containers
				else if(Container* subContainer = inventoryItem->getContainer()){
					Cylinder* tmpCylinder = NULL;
					int32_t tmpIndex = INDEX_WHEREEVER;
					Item* tmpDestItem = NULL;
 
					tmpCylinder = subContainer->__queryDestination(tmpIndex, item, &tmpDestItem, flags);
					if(tmpCylinder && tmpCylinder->__queryAdd(tmpIndex, item, item->getItemCount(), flags) == RET_NOERROR){
						index = tmpIndex;
						*destItem = tmpDestItem;
						return tmpCylinder;
					}
 
					containerList.push_back(subContainer);
				}
			}
			//empty slot
			else if(__queryAdd(i, item, item->getItemCount(), flags) == RET_NOERROR){
				index = i;
				*destItem = NULL;
				return this;
			}
		}
 
		//check deeper in the containers
		for(std::list<Container*>::iterator it = containerList.begin(); it != containerList.end(); ++it){
			for(ContainerIterator iit = (*it)->begin(); iit != (*it)->end(); ++iit){
				if(Container* subContainer = (*iit)->getContainer()){
 
					if(subContainer == tradeItem){
						continue;
					}
 
					Cylinder* tmpCylinder = NULL;
					int32_t tmpIndex = INDEX_WHEREEVER;
					Item* tmpDestItem = NULL;
 
					tmpCylinder = subContainer->__queryDestination(tmpIndex, item, &tmpDestItem, flags);
					if(tmpCylinder && tmpCylinder->__queryAdd(tmpIndex, item, item->getItemCount(), flags) == RET_NOERROR){
						index = tmpIndex;
						*destItem = tmpDestItem;
						return tmpCylinder;
					}
				}
			}
		}
		return this;
	}
 
	Thing* destThing = __getThing(index);
	if(destThing)
		*destItem = destThing->getItem();
 
	Cylinder* subCylinder = dynamic_cast<Cylinder*>(destThing);
 
	if(subCylinder){
		index = INDEX_WHEREEVER;
		*destItem = NULL;
		return subCylinder;
	}
	else
		return this;
}

 

 

 

Vixe o Problema agora conplicou não sei onde fica isso ae ;s

Link para o post
Compartilhar em outros sites
57 minutos atrás, Azhaurn disse:

Na sua pasta que contém todas as sources. 

sources.thumb.jpg.100e32c5ed677ef8d67ddc

Não contenho as sources ? :S

 

Meu Servidor é Este Vem Só DLL e Distro, nada de Source: STYLLER ULTIMATE.

 

DEVO EDITAR UMA SOURCE 0.4 - Editar os parametros com o DEV C++ com os que você passou. e compilar um novo ExE?
Se eu não tenho as sources do meu como consigo elas?

 

Editado por Andre Felipe de Azev (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
49 minutos atrás, Azhaurn disse:

Eu vi que você me reputou, você conseguiu resolver e achar as sources? Ou quer que te passe o download delas?

Eu não sei fazer nada do tipo, cheguei a procurar sobre o assunto, e baixei o Dev C++, e verifiquei que meu ot não contem as source se tiver como me passar uma que não de problema no meu servidor agradeço.

Link para o post
Compartilhar em outros sites
Em 07/12/2015 21:17:57, Azhaurn disse:

Vou tentar ler sobre o assunto mas pelo que percebi tenho que compilar correto?

Link para o post
Compartilhar em outros sites
Em 07/12/2015 21:17:57, Azhaurn disse:

Algum problema ou só percepção incorreta do Antivirus ???
Link

Link para o post
Compartilhar em outros sites
Agora, fireelement disse:

normal, nd demais

ta acabando minhas reps estou tentando fazer um tutorial pra galera ta meio caminho andado tudo explicadinho sobre o erro quer me ajudar? você está no grupo do Skype? se não passa o seu e montamos um pra ajudar geral com este erro!

Link para o post
Compartilhar em outros sites
1 minuto atrás, fireelement disse:

qual grupo? provavelmente n

sobre os bugs, tenho todos fixados nessa source aq: https://github.com/fir3element/forgottenserver036/archive/master.zip

me adiciona no skype então: andre.felipe.de.azevedo Foto: preta e branca com minha mulher;

Não Consigo Resolver o erro sozinho se puder me explicar @Azhaurn eu Agradeceria. tem como? tentei de tudo já, todas as vezes que compilo da erro, ME AJUDA!

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo