Ir para conteúdo

Como Aumentar O Numero De Outfits!


Beer

Posts Recomendados

Como aumentar o numero de outfits!

 

Antes de começar:

 

- Este tutorial só servirá para servidores que tem as sources abertas.

 

Vamos começar:

 

Abra a pasta Sources do seu servidor e procure o arquivo Outfits(Arquivo CPP)

 

tutooutfitslq4.jpg

 

Abra o arquivo. Estará escrito mais ou menos isto:

//////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
//////////////////////////////////////////////////////////////////////
// 
//////////////////////////////////////////////////////////////////////
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//////////////////////////////////////////////////////////////////////
#include "otpch.h"

#include "definitions.h"
#include "outfit.h"
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include "creature.h"
#include "player.h"
#include "tools.h"

OutfitList::OutfitList()
{
//
}

OutfitList::~OutfitList()
{
OutfitListType::iterator it;
for(it = m_list.begin(); it != m_list.end(); it++)
	delete *it;
m_list.clear();
}

void OutfitList::addOutfit(const Outfit& outfit)
{	
OutfitListType::iterator it;
for(it = m_list.begin(); it != m_list.end(); ++it)
{
	if((*it)->looktype == outfit.looktype)
	{
		(*it)->addons = (*it)->addons | outfit.addons;
		return;
	}
}

//adding a new outfit
Outfit* new_outfit = new Outfit;
new_outfit->looktype = outfit.looktype;
new_outfit->addons = outfit.addons;
new_outfit->premium = outfit.premium;
m_list.push_back(new_outfit);
}

bool OutfitList::remOutfit(const Outfit& outfit)
{
OutfitListType::iterator it;
for(it = m_list.begin(); it != m_list.end(); ++it)
{
	if((*it)->looktype == outfit.looktype)
	{
		if(outfit.addons == 0xFF)
			m_list.erase(it);
		else
			(*it)->addons = (*it)->addons & (~outfit.addons);
		return true;
	}
}
return false;
}

bool OutfitList::isInList(uint32_t looktype, uint32_t addons, bool playerPremium, int32_t playerSex) const
{
OutfitListType::const_iterator it, it_;
const OutfitListType& global_outfits = Outfits::getInstance()->getOutfits(playerSex);
for(it = global_outfits.begin(); it != global_outfits.end(); ++it)
{
	if((*it)->looktype == looktype)
	{
		for(it_ = m_list.begin(); it_ != m_list.end(); ++it_)
		{
			if((*it_)->looktype == looktype)
			{
				if(((*it_)->addons & addons) == addons)
				{
					if((*it)->premium && playerPremium || !(*it)->premium)
						return true;
				}
				return false;
			}
		}
		return false;
	}
}
return false;
}

Outfits::Outfits()
{
Outfit outfit;
//build default outfit lists
outfit.addons = 0;
outfit.premium = false;
for(int32_t i = PLAYER_FEMALE_1; i <= PLAYER_FEMALE_7; i++){
	outfit.looktype = i;
	m_female_list.addOutfit(outfit);
}

for(int32_t i = PLAYER_MALE_1; i <= PLAYER_MALE_7; i++){
	outfit.looktype = i;
	m_male_list.addOutfit(outfit);
}

m_list.resize(10, NULL);
}

Outfits::~Outfits()
{
OutfitsListVector::iterator it;
for(it = m_list.begin(); it != m_list.end(); it++){
	delete *it;
}
m_list.clear();
}

bool Outfits::loadFromXml()
{
std::string filename = "data/XML/outfits.xml";

xmlDocPtr doc = xmlParseFile(filename.c_str());
if(doc){
	xmlNodePtr root, p;
	root = xmlDocGetRootElement(doc);

	if(xmlStrcmp(root->name,(const xmlChar*)"outfits") != 0){
		xmlFreeDoc(doc);
		std::cout << "Warning: outfits.xml not found, using defaults." << std::endl;
		return true;
	}

	p = root->children;

	while(p){
		std::string str;
		int34_t intVal;
		if(xmlStrcmp(p->name, (const xmlChar*)"outfit") == 0)
		{
			if(readXMLInteger(p, "type", intVal))
			{
				if(intVal > 9 || intVal < 0)
					std::cout << "Warning: No valid outfit type " << intVal << std::endl;
				else
				{
					OutfitList* list;
					if(m_list[intVal] != NULL)
						list = m_list[intVal];
					else
					{
						list = new OutfitList;
						m_list[intVal] = list;
					}

					Outfit outfit;
					std::string outfitName;
					readXMLString(p, "name", outfitName);
					if(readXMLInteger(p, "looktype", intVal))
						outfit.looktype = intVal;
					if(readXMLInteger(p, "addons", intVal))
						outfit.addons = intVal;
					if(readXMLInteger(p, "premium", intVal))
						outfit.premium = (intVal == 1);
					outfitNamesMap[outfit.looktype] = outfitName;
					list->addOutfit(outfit);
				}
			}
			else
				std::cout << "Missing outfit type." << std::endl;
		}
		p = p->next;
	}
	xmlFreeDoc(doc);
}
return true;
}

 

 

Aperte Ctrl+F ou F3

 

Irá abrir uma janela de procura digite o numero 32.

 

Obs:Depende da versão do servidor aqui estou usando o TFS como base ele tem 16 Outfits para Male e Female Somando 32.

 

Para saber o numero a ser digitado va na pasta data do servidor e abra o arquivo Outfits.xml e conte os outfits de Male e Female.

 

Substitua o numeros 32 pelo numero desejado de outfits.

 

Ex:50 Irá aumentar para 25 Outfits male e 25 outfits female somando da 50.

 

 

Depois só adicionar outfits novos no arquivo Outfits.xml que esta dentro da pasta data do seu servidor.

 

- Clique aqui e aprenda a adicionar Outfits (Otfits.xml)

 

----Fim---

 

Descobri isto fuçando nas sources ;)

 

Comentem!

 

 

RedZl desculpe por não ter arrumado o outro topico estou sem Microsoft World ;/

Editado por Beer
Link para o comentário
Compartilhar em outros sites

Tá, então vou lhe ajudar em relação à acentuação:

 

- Este tutorial só servira para servidores que tem as sources abertas.

Correto: só servirá (está no futuro a frase, quando sem acento o verbo passa pro passado).

 

Estara escrito mais ou menos isto:

Correto: Estará (mesma coisa que na frase anterior)

 

Ira abrir uma janela de procura digite o numero 32.

Correto: Irá (não preciso nem dizer :p)

 

Ex:50 Ira almentar para 25 Outfits male e 25 outfits female somando da 50.

Correto: "Irá aumentar para..."

 

Corrija utilizando o botão Editar para que eu possa aprovar seu tutorial.

 

Você tem 3 dias para fazer as devidas alterações.

Link para o comentário
Compartilhar em outros sites

@RedZL

 

Brigadaum pela ajuda so meio ruim com português.

 

@Fusion32

 

Eu testei aqui e funciono perfeitamente.

 

funcionou porque provavelmente não ultrapassou os 25 outfits...

 

fusion

creio q ai seja a quantidade a ser MOSTRADA

 

 

se vc não sabe por favor fique queto.

 

		const OutfitListType& player_outfits = player->getPlayerOutfits();
	int32_t count_outfits = player_outfits.size();

 

Se voce soubece, 'OutfitListType' é um 'std::list<Outfit*>' e como o 'list' pode ter infinitas(2^64 é o maximo acho) variaveis, então é ai que vem a 'restrição'

 

		if(count_outfits > MAX_NUMBER_OF_OUTFITS){
		count_outfits = MAX_NUMBER_OF_OUTFITS;
	}
	else if(count_outfits <= 0){
		return;
	}

 

Pois como os outfits podem ser infinitos, é necessária a restrição para que o cliente do Tibia não receba um debug. Por isso eu ja pesso para que algum moderador ja feche o topico pois caso realmente haja a necessidade do aumento de outfits, o cliente do tibia tera suporte e o opentibia também atualizara em suas fontes.

Link para o comentário
Compartilhar em outros sites

Aki tb naum tem os arquivos no meu source...

tentei tb procurar protocolgame.cpp, mas num acho nada....

por favor vejaum o q esta acontecendo...

quero adicionar novas outfits e tals...

e num sou bom com scripits...

 

Vlw pelo tutorial,pena q num me adiantou em nada...

Flws

Link para o comentário
Compartilhar em outros sites

  • 4 weeks later...
×
×
  • Criar Novo...