Ir para conteúdo

Featured Replies

Postado

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)

Resolvido por Tricoder

Ir para solução
  • Respostas 14
  • Visualizações 1.2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Posted Images

Postado
  • 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;
}


 

 

Postado
  • Autor

@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

Postado
  • Autor
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)

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