66 XmlNodeConstPtrConst rootNode = doc.
rootNode();
68 if ((rootNode ==
nullptr) || !xmlNameEqual(rootNode,
"npcs"))
70 logger->
log(
"NPC Database: Error while loading %s!",
79 if (xmlNameEqual(npcNode,
"include"))
87 if (!xmlNameEqual(npcNode,
"npc"))
104 if (currentInfo ==
nullptr)
108 "targetSelection",
true));
114 "deadSortOffsetY", 31));
120 "allowDelete",
true));
123 "allowEquipment",
false));
126 "currency",
"default");
138 if (xmlNameEqual(spriteNode,
"sprite"))
140 if (!XmlHaveChildContent(spriteNode))
144 currentSprite->
sprite = XmlChildContent(spriteNode);
147 display.
sprites.push_back(currentSprite);
149 else if (xmlNameEqual(spriteNode,
"particlefx"))
151 if (!XmlHaveChildContent(spriteNode))
154 display.
particles.push_back(XmlChildContent(spriteNode));
156 else if (xmlNameEqual(spriteNode,
"menu"))
161 currentInfo->
addMenu(name, command);
166 if (currentInfo->
getMenu().empty())
169 currentInfo->
addMenu(
_(
"Talk"),
"talk 'NAME'");
171 currentInfo->
addMenu(
_(
"Buy"),
"buy 'NAME'");
173 currentInfo->
addMenu(
_(
"Sell"),
"sell 'NAME'");
194 reportAlways(
"NPCDB: Warning, unknown NPC ID %d requested",
206 return info->getAvatarId();
static void loadXmlFile(const std::string &file, const std::string &name, BadgesInfos &arr, const SkipError skipError)
#define loadXmlDir(name, function)
BeingInfos::iterator BeingInfoIterator
std::map< BeingTypeId, BeingInfo * > BeingInfos
const BeingTypeId BeingTypeId_zero
#define reportAlways(...)
void setTargetSelection(const bool n)
void setCurrency(const std::string &name)
void setDisplay(const SpriteDisplay &display)
void setAllowEquipment(const bool b)
void setDeadSortOffsetY(const int n)
void setAvatarId(const BeingTypeId id)
void setAllowDelete(const bool b)
void addMenu(const std::string &name, const std::string &command)
const std::vector< BeingMenuItem > & getMenu() const A_CONST
static BeingInfo * unknown
std::string getStringValue(const std::string &key) const
void log(const char *const log_text,...)
void log1(const char *const log_text)
void delete_all(Container &c)
#define fromInt(val, name)
#define for_each_xml_child_node(var, parent)
bool info(InputEvent &event)
AttributesT get(const std::string &key)
void readBasicAttributes(BeingInfo *const info, xmlNode *const node, const std::string &hoverCursor)
void readWalkingAttributes(BeingInfo *const info, xmlNode *const node, const int moreBlockFlags)
BeingInfo * get(const BeingTypeId id)
void loadXmlFile(const std::string &fileName, const SkipError skipError)
BeingTypeId getAvatarFor(const BeingTypeId id)
bool existsCurrency(const std::string &name)
std::string langProperty(const xmlNodePtr node, const char *const name, const std::string &def)
bool getBoolProperty(const xmlNodePtr node, const char *const name, const bool def)
int getProperty(const xmlNodePtr node, const char *const name, int def)
const bool SkipError_false
const bool SkipError_true
std::vector< SpriteReference * > sprites
const bool UseVirtFs_true