braianlomas
New Member
- Joined
- Feb 6, 2015
- Messages
- 51
- Reaction score
- 4
Hi, i have a problem with my server, i use OTX and have a system auras in my server, but don't work this xD
if i no select a outfit the aura does not appear. auras only work if I select an outfit
Likewise, the speed of the aura does not work, I think the script is missing something, can someone help me?

this is my auras.cpp
in player.cpp have this
if i no select a outfit the aura does not appear. auras only work if I select an outfit
Likewise, the speed of the aura does not work, I think the script is missing something, can someone help me?

this is my auras.cpp
C++:
#include "otpch.h"
#include <iostream>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include "auras.h"
#include "tools.h"
void Auras::clear()
{
for(AurasMap::iterator it = aurasMap.begin(); it != aurasMap.end(); ++it)
delete it->second;
aurasMap.clear();
}
bool Auras::reload()
{
clear();
return loadFromXml();
}
bool Auras::loadFromXml()
{
xmlDocPtr doc = xmlParseFile(getFilePath(FILE_TYPE_XML, "auras.xml").c_str());
if(!doc)
{
std::cout << "[Warning - Auras::loadFromXml] Cannot load auras file." << std::endl;
std::cout << getLastXMLError() << std::endl;
return false;
}
xmlNodePtr p, root = xmlDocGetRootElement(doc);
if(xmlStrcmp(root->name,(const xmlChar*)"auras"))
{
std::cout << "[Error - Auras::loadFromXml] Malformed auras file." << std::endl;
xmlFreeDoc(doc);
return false;
}
p = root->children;
while(p)
{
parseAuraNode(p);
p = p->next;
}
xmlFreeDoc(doc);
return true;
}
bool Auras::parseAuraNode(xmlNodePtr p)
{
if(xmlStrcmp(p->name, (const xmlChar*)"aura"))
return false;
int32_t auraId;
if(!readXMLInteger(p, "id", auraId))
{
std::cout << "[Warning - Auras::parseAuraNode] Missing aura id." << std::endl;
return false;
}
int32_t auraClientId;
if(!readXMLInteger(p, "clientid", auraClientId))
{
std::cout << "[Warning - Auras::parseAuraNode] Missing aura clientid." << std::endl;
return false;
}
std::string auraName;
if(!readXMLString(p, "name", auraName))
{
std::cout << "[Warning - Auras::parseAuraNode] Missing aura name." << std::endl;
return false;
}
Aura* aura = new Aura(auraId, auraClientId, auraName);
aurasMap[aura->id] = aura;
return true;
}
uint32_t Auras::getAuraId(const std::string& name)
{
for(AurasMap::iterator it = aurasMap.begin(); it != aurasMap.end(); ++it)
{
if(!strcasecmp(it->second->name.c_str(), name.c_str()))
return it->first;
}
return -1;
}
Aura* Auras::getAura(uint32_t auraId) {
AurasMap::iterator it = aurasMap.find(auraId);
if (it == aurasMap.end())
return NULL;
return it->second;
}
Aura* Auras::getAuraByType(uint32_t auraType) {
for(AurasMap::iterator it = aurasMap.begin(); it != aurasMap.end(); ++it)
{
if(it->second->clientId == auraType)
return it->second;
}
return NULL;
}
in player.cpp have this
C++:
bool Player::canWearAura(uint32_t auraId)
{
std::map<uint32_t, Aura*>::iterator it = auras.find(auraId);
if(it == auras.end())
return false;
return true;
}
bool Player::addAura(uint32_t auraId)
{
Aura* aura = Auras::getInstance()->getAura(auraId);
if(!aura)
return false;
std::map<uint32_t, Aura*>::iterator it = auras.find(auraId);
if(it != auras.end())
return false;
auras[auraId] = aura;
return true;
}
bool Player::removeAura(uint32_t auraId)
{
std::map<uint32_t, Aura*>::iterator it = auras.find(auraId);
if(it == auras.end())
return false;
auras.erase(it);
return true;
}
bool Player::canWearWing(uint32_t wingId)
{
std::map<uint32_t, Wing*>::iterator it = wings.find(wingId);
if(it == wings.end())
return false;
return true;
}