• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Outfit StorageID

Godely

Member
Joined
Aug 19, 2007
Messages
233
Reaction score
19
In TFS, players can't get new outfits by quest. So, I was thinking about a new function on outfits.xml. It would be " storageid="" ". But I'm getting troubles with outfit.cpp. Look:

Code:
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;
			int32_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;
						bool storageID = true;

						readXMLString(p, "name", outfitName);
						if(readXMLInteger(p, "looktype", intVal))
							outfit.looktype = intVal;
						else
							std::cout << "[Warning] Missing looktype on outfit: " << outfitName << std::endl;

						if(readXMLInteger(p, "addons", intVal))
							outfit.addons = intVal;
						else
							outfit.addons = 0;

						if(readXMLInteger(p, "premium", intVal))
							outfit.premium = (intVal == 1);
							
						if(readXMLInteger(p, "storageid", intVal))
							storageID = getStorageValue(storageID, (int32_t&)value);

						outfitNamesMap[outfit.looktype] = outfitName;
						if(storageID)
						{
							//This way you can add names for outfits without adding them to default list
							list->addOutfit(outfit);
						}
					}
				}
				else
					std::cout << "Missing outfit type." << std::endl;
			}
			p = p->next;
		}
		xmlFreeDoc(doc);
	}
	return true;
}

If someone can help me, thanks =D
 
Have this code any sense? :P If you're loading, you must load all, not only there which have set storageID.

Anyway, wrong is there i think: if(storageID) becouse it can be only statement true(1) or false(0), but im not sure.

I'll try do it.. :) ^^

#Edit
Oh my gosh, i made it ;o
 
Last edited:
Back
Top