当我尝试编译源码时,我遇到了这个错误,我尝试修复它,但我不知道如何。这是错误
1>actions.obj : error LNK2001: unresolved external symbol _xmlParseFile
1>actions.obj : error LNK2001: unresolved external symbol _xmlDocGetRootElement
1>actions.obj : error LNK2001: unresolved external symbol _xmlStrcmp
1>actions.obj : error LNK2001: unresolved external symbol _xmlFreeDoc
1>actions.obj : error LNK2001: unresolved external symbol _xmlGetProp
1>actions.obj : error LNK2001: unresolved external symbol __imp__xmlFree
1>actions.obj : error LNK2001: unresolved external symbol _lua_pushstring
1>actions.obj : error LNK2001: unresolved external symbol _lua_gettable
1>actions.obj : error LNK2001: unresolved external symbol _lua_pushnumber
1>actions.obj : error LNK2001: unresolved external symbol _lua_pcallk
1>actions.obj : error LNK2001: unresolved external symbol _luaL_newstate
1>actions.obj : error LNK2001: unresolved external symbol _luaopen_base
1>actions.obj : error LNK2001: unresolved external symbol _luaopen_math
1>actions.obj : error LNK2001: unresolved external symbol _luaopen_string
1>actions.obj : error LNK2001: unresolved external symbol _luaopen_io
1>actions.obj : error LNK2001: unresolved external symbol _lua_pushcclosure
1>actions.obj : error LNK2001: unresolved external symbol _lua_setglobal
1>actions.obj : error LNK2001: unresolved external symbol _lua_getglobal
1>actions.obj : error LNK2001: unresolved external symbol _lua_createtable
1>actions.obj : error LNK2001: unresolved external symbol _lua_tonumberx
1>actions.obj : error LNK2001: unresolved external symbol _lua_tolstring
1>ioaccountxml.obj : error LNK2001: unresolved external symbol _xmlNewMutex
1>ioaccountxml.obj : error LNK2001: unresolved external symbol _xmlMutexLock
1>ioaccountxml.obj : error LNK2001: unresolved external symbol _xmlMutexUnlock
1>iomapxml.obj : error LNK2001: unresolved external symbol _xmlLineNumbersDefault
1>ioplayerxml.obj : error LNK2001: unresolved external symbol _xmlNewNode
1>ioplayerxml.obj : error LNK2001: unresolved external symbol _xmlAddChild
1>ioplayerxml.obj : error LNK2001: unresolved external symbol _xmlNewDoc
1>ioplayerxml.obj : error LNK2001: unresolved external symbol _xmlNewDocNode
1>ioplayerxml.obj : error LNK2001: unresolved external symbol _xmlSetProp
1>ioplayerxml.obj : error LNK2001: unresolved external symbol _xmlSaveFile
1>luascript.obj : error LNK2001: unresolved external symbol _lua_close
1>luascript.obj : error LNK2001: unresolved external symbol _lua_isstring
1>luascript.obj : error LNK2001: unresolved external symbol _lua_rawlen
1>luascript.obj : error LNK2001: unresolved external symbol _lua_settop
1>luascript.obj : error LNK2001: unresolved external symbol _lua_isnumber
1>luascript.obj : error LNK2001: unresolved external symbol _lua_settable
1>networkmessage.obj : error LNK2001: unresolved external symbol _recv@16
1>networkmessage.obj : error LNK2001: unresolved external symbol _WSAGetLastError@0
1>networkmessage.obj : error LNK2001: unresolved external symbol _ioctlsocket@12
1>networkmessage.obj : error LNK2001: unresolved external symbol _send@16
1>npc.obj : error LNK2001: unresolved external symbol _lua_getstack
1>npc.obj : error LNK2001: unresolved external symbol _lua_pushnil
1>otserv.obj : error LNK2001: unresolved external symbol _getpeername@12
1>otserv.obj : error LNK2001: unresolved external symbol _closesocket@4
1>otserv.obj : error LNK2001: unresolved external symbol _WSAStartup@8
1>otserv.obj : error LNK2001: unresolved external symbol _WSACleanup@0
1>otserv.obj : error LNK2001: unresolved external symbol _inet_addr@4
1>otserv.obj : error LNK2001: unresolved external symbol _gethostname@8
1>otserv.obj : error LNK2001: unresolved external symbol _gethostbyname@4
1>otserv.obj : error LNK2001: unresolved external symbol _htons@4
1>otserv.obj : error LNK2001: unresolved external symbol _htonl@4
1>otserv.obj : error LNK2001: unresolved external symbol _socket@12
1>otserv.obj : error LNK2001: unresolved external symbol _bind@12
1>otserv.obj : error LNK2001: unresolved external symbol _listen@8
1>otserv.obj : error LNK2001: unresolved external symbol _select@20
1>otserv.obj : error LNK2001: unresolved external symbol _accept@12
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_pushcclosure(struct lua_State *,int (__cdecl*)(struct lua_State *),int)" (?lua_pushcclosure@@YAXPAUlua_State@@P6AH0@ZH@Z)
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_setglobal(struct lua_State *,char const *)" (?lua_setglobal@@YAXPAUlua_State@@PBD@Z)
1>spells.obj : error LNK2001: unresolved external symbol "char const * __cdecl lua_pushstring(struct lua_State *,char const *)" (?lua_pushstring@@YAPBDPAUlua_State@@PBD@Z)
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_gettable(struct lua_State *,int)" (?lua_gettable@@YAXPAUlua_State@@H@Z)
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_pushnumber(struct lua_State *,double)" (?lua_pushnumber@@YAXPAUlua_State@@N@Z)
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_createtable(struct lua_State *,int,int)" (?lua_createtable@@YAXPAUlua_State@@HH@Z)
1>spells.obj : error LNK2001: unresolved external symbol "int __cdecl lua_pcallk(struct lua_State *,int,int,int,int,int (__cdecl*)(struct lua_State *))" (?lua_pcallk@@YAHPAUlua_State@@HHHHP6AH0@Z@Z)
1>spells.obj : error LNK2001: unresolved external symbol "int __cdecl lua_toboolean(struct lua_State *,int)" (?lua_toboolean@@YAHPAUlua_State@@H@Z)
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_settop(struct lua_State *,int)" (?lua_settop@@YAXPAUlua_State@@H@Z)
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_getglobal(struct lua_State *,char const *)" (?lua_getglobal@@YAXPAUlua_State@@PBD@Z)
1>spells.obj : error LNK2001: unresolved external symbol "double __cdecl lua_tonumberx(struct lua_State *,int,int *)" (?lua_tonumberx@@YANPAUlua_State@@HPAH@Z)
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_pushnil(struct lua_State *)" (?lua_pushnil@@YAXPAUlua_State@@@Z)
1>spells.obj : error LNK2001: unresolved external symbol "int __cdecl lua_next(struct lua_State *,int)" (?lua_next@@YAHPAUlua_State@@H@Z)
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_pushboolean(struct lua_State *,int)" (?lua_pushboolean@@YAXPAUlua_State@@H@Z)
1>spells.obj : error LNK2001: unresolved external symbol "char const * __cdecl lua_tolstring(struct lua_State *,int,unsigned int *)" (?lua_tolstring@@YAPBDPAUlua_State@@HPAI@Z)
1>spells.obj : error LNK2001: unresolved external symbol "void __cdecl lua_settable(struct lua_State *,int)" (?lua_settable@@YAXPAUlua_State@@H@Z)
1>status.obj : error LNK2001: unresolved external symbol _xmlNewTextChild
1>status.obj : error LNK2001: unresolved external symbol _xmlDocDumpMemory
1>C:\Users\Raven\Desktop\Darkness\Darkness\Release\Darkness.exe : fatal error LNK1120: 75 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#ifndef __IOACCOUNTXML_H
#define __IOACCOUNTXML_H
#include <string>
#include "libxml/xmlmemory.h"
#include "libxml/parser.h"
#include "definitions.h"
#include "ioaccount.h"
/** Player-Loaders implemented with XML */
class IOAccountXML : protected IOAccount {
public:
/** Get a textual description of what source is used
* \returns Name of the source*/
virtual char* getSourceDescription(){return "XML";};
virtual Account loadAccount(unsigned long accno);
#ifdef YUR_BUILTIN_AAC
virtual bool saveAccount(const Account& account);
#endif //YUR_BUILTIN_AAC
virtual bool getPassword(unsigned long accno, const std::string &name, std::string &password);
IOAccountXML();
virtual ~IOAccountXML(){};
};
#endif
ioaccountxml.cpp
#include "stdafx.h"
#include "ioaccountxml.h"
#include <algorithm>
#include <functional>
#include <iostream>
#include <sstream>
#include <string.h>
#include "luascript.h"
#include "tools.h"
extern xmlMutexPtr xmlmutex;
extern LuaScript g_config;
IOAccountXML::IOAccountXML(){
if(xmlmutex == NULL){
xmlmutex = xmlNewMutex();
}
}
Account IOAccountXML::loadAccount(unsigned long accno){
Account acc;
std::stringstream accsstr;
std::string datadir = g_config.getGlobalString("datadir");
accsstr << datadir + "accounts/" << accno << ".xml";
std::string filename = accsstr.str();
std::transform(filename.begin(), filename.end(), filename.begin(), tolower);
xmlMutexLock(xmlmutex);
xmlDocPtr doc = xmlParseFile(filename.c_str());
if (doc)
{
xmlNodePtr root, p, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name,(const xmlChar*) "account"))
{
xmlFreeDoc(doc);
xmlMutexUnlock(xmlmutex);
return acc;
}
p = root->children;
// perhaps verify name
char* nodeValue = NULL;
nodeValue = (char*)xmlGetProp(root, (const xmlChar *)"pass");
acc.password = nodeValue;
xmlFreeOTSERV(nodeValue);
nodeValue = (char*)xmlGetProp(root, (xmlChar*)"type");
acc.accType = atoi(nodeValue);
xmlFreeOTSERV(nodeValue);
nodeValue = (char*)xmlGetProp(root, (xmlChar*)"premDays");
acc.premDays = atoi(nodeValue);
xmlFreeOTSERV(nodeValue);
// now load in characters.
while (p)
{
const char* str = (char*)p->name;
if (strcmp(str, "characters") == 0)
{
tmp = p->children;
while(tmp)
{
nodeValue = (char*)xmlGetProp(tmp, (xmlChar*)"name");
if(nodeValue) {
if(strcmp((const char*)tmp->name, "character") == 0) {
acc.charList.push_back(std::string(nodeValue));
}
xmlFreeOTSERV(nodeValue);
}
tmp = tmp->next;
}
}
p = p->next;
}
xmlFreeDoc(doc);
// Organize the char list.
acc.charList.sort();
acc.accnumber = accno;
}
xmlMutexUnlock(xmlmutex);
return acc;
}
bool IOAccountXML::getPassword(unsigned long accno, const std::string &name, std::string &password)
{
std::string acc_password;
std::stringstream accsstr;
std::string datadir = g_config.getGlobalString("datadir");
accsstr << datadir + "accounts/" << accno << ".xml";;
std::string filename = accsstr.str();
std::transform(filename.begin(), filename.end(), filename.begin(), tolower);
xmlMutexLock(xmlmutex);
xmlDocPtr doc = xmlParseFile(filename.c_str());
if (doc)
{
xmlNodePtr root, p, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name,(const xmlChar*) "account"))
{
xmlFreeDoc(doc);
xmlMutexUnlock(xmlmutex);
return false;
}
p = root->children;
char* nodeValue = NULL;
nodeValue = (char*)xmlGetProp(root, (const xmlChar *)"pass");
acc_password = nodeValue;
xmlFreeOTSERV(nodeValue);
// now load in characters.
while (p)
{
const char* str = (char*)p->name;
if (strcmp(str, "characters") == 0)
{
tmp = p->children;
while(tmp)
{
nodeValue = (char*)xmlGetProp(tmp, (xmlChar*)"name");
if(nodeValue) {
if(strcmp((const char*)tmp->name, "character") == 0) {
if(nodeValue == name){
password = acc_password;
xmlFreeOTSERV(nodeValue);
xmlFreeDoc(doc);
xmlMutexUnlock(xmlmutex);
return true;
}
}
xmlFreeOTSERV(nodeValue);
}
tmp = tmp->next;
}
}
p = p->next;
}
xmlFreeDoc(doc);
}
xmlMutexUnlock(xmlmutex);
return false;
}
#ifdef YUR_BUILTIN_AAC
bool IOAccountXML::saveAccount(const Account& account)
{
xmlMutexLock(xmlmutex);
xmlNodePtr root, charsNode, charNode;
xmlDocPtr doc = xmlNewDoc((const xmlChar*)"1.0");
doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"account", NULL);
root = doc->children;
xmlSetProp(root, (const xmlChar*)"pass", (const xmlChar*)account.password.c_str());
xmlSetProp(root, (const xmlChar*)"type", (const xmlChar*)str(account.accType).c_str());
xmlSetProp(root, (const xmlChar*)"premDays", (const xmlChar*)str(account.premDays).c_str());
charsNode = xmlNewNode(NULL, (const xmlChar*)"characters");
xmlAddChild(root, charsNode);
std::list<std::string>::const_iterator iter = account.charList.begin();
while (iter != account.charList.end())
{
charNode = xmlNewNode(NULL, (const xmlChar*)"character");
xmlSetProp(charNode, (const xmlChar*)"name", (const xmlChar*)(*iter).c_str());
xmlAddChild(charsNode, charNode);
++iter;
}
std::ostringstream filename;
filename << g_config.DATA_DIR << "accounts/" << account.accnumber << ".xml";
std::string file = filename.str();
if (xmlSaveFile(file.c_str(), doc))
{
xmlFreeDoc(doc);
xmlMutexUnlock(xmlmutex);
return true;
}
else
{
xmlFreeDoc(doc);
xmlMutexUnlock(xmlmutex);
std::cout << "Failed to save " << file << std::endl;
return false;
}
}
#endif //YUR_BUILTIN_AAC
luascript.cpp
#include "stdafx.h"
#include <string>
#include <iostream>
#include "luascript.h"
#include "player.h"
extern "C"
{
#include "LUA/lua.h"
#include "LUA/lauxlib.h"
#include "LUA/lualib.h"
}
LuaScript::LuaScript()
{
luaState = NULL;
}
LuaScript::~LuaScript()
{
if (luaState)
lua_close(luaState);
}
int LuaScript::OpenFile(const char *filename)
{
luaState = lua_open();
if (lua_dofile(luaState, filename))
return false;
#ifdef YUR_MULTIPLIERS
EXP_MUL = getGlobalNumber("expmul",1);
EXP_MUL_PVP = getGlobalNumber("expmulpvp",1);
HEALTH_TICK_MUL = getGlobalNumber("healthtickmul",1);
MANA_TICK_MUL = getGlobalNumber("manatickmul",1);
CAP_GAIN[VOCATION_NONE] = atoi(getGlobalStringField("capgain", VOCATION_NONE + 1, "10").c_str());
CAP_GAIN[VOCATION_SORCERER] = atoi(getGlobalStringField("capgain", VOCATION_SORCERER + 1, "10").c_str());
CAP_GAIN[VOCATION_DRUID] = atoi(getGlobalStringField("capgain", VOCATION_DRUID + 1, "10").c_str());
CAP_GAIN[VOCATION_PALADIN] = atoi(getGlobalStringField("capgain", VOCATION_PALADIN + 1, "20").c_str());
CAP_GAIN[VOCATION_KNIGHT] = atoi(getGlobalStringField("capgain", VOCATION_KNIGHT + 1, "25").c_str());
MANA_GAIN[VOCATION_NONE] = atoi(getGlobalStringField("managain", VOCATION_NONE + 1, "5").c_str());
MANA_GAIN[VOCATION_SORCERER] = atoi(getGlobalStringField("managain", VOCATION_SORCERER + 1, "30").c_str());
MANA_GAIN[VOCATION_DRUID] = atoi(getGlobalStringField("managain", VOCATION_DRUID + 1, "30").c_str());
MANA_GAIN[VOCATION_PALADIN] = atoi(getGlobalStringField("managain", VOCATION_PALADIN + 1, "15").c_str());
MANA_GAIN[VOCATION_KNIGHT] = atoi(getGlobalStringField("managain", VOCATION_KNIGHT + 1, "5").c_str());
HP_GAIN[VOCATION_NONE] = atoi(getGlobalStringField("hpgain", VOCATION_NONE + 1, "5").c_str());
HP_GAIN[VOCATION_SORCERER] = atoi(getGlobalStringField("hpgain", VOCATION_SORCERER + 1, "5").c_str());
HP_GAIN[VOCATION_DRUID] = atoi(getGlobalStringField("hpgain", VOCATION_DRUID + 1, "5").c_str());
HP_GAIN[VOCATION_PALADIN] = atoi(getGlobalStringField("hpgain", VOCATION_PALADIN + 1, "10").c_str());
HP_GAIN[VOCATION_KNIGHT] = atoi(getGlobalStringField("hpgain", VOCATION_KNIGHT + 1, "15").c_str());
WEAPON_MUL[VOCATION_NONE] = atoi(getGlobalStringField("weaponmul", VOCATION_NONE+1, "1").c_str());
WEAPON_MUL[VOCATION_SORCERER] = atoi(getGlobalStringField("weaponmul", VOCATION_SORCERER+1, "1").c_str());
WEAPON_MUL[VOCATION_DRUID] = atoi(getGlobalStringField("weaponmul", VOCATION_DRUID+1, "1").c_str());
WEAPON_MUL[VOCATION_PALADIN] = atoi(getGlobalStringField("weaponmul", VOCATION_PALADIN+1, "1").c_str());
WEAPON_MUL[VOCATION_KNIGHT] = atoi(getGlobalStringField("weaponmul", VOCATION_KNIGHT+1, "1").c_str());
DIST_MUL[VOCATION_NONE] = atoi(getGlobalStringField("distmul", VOCATION_NONE+1, "1").c_str());
DIST_MUL[VOCATION_SORCERER] = atoi(getGlobalStringField("distmul", VOCATION_SORCERER+1, "1").c_str());
DIST_MUL[VOCATION_DRUID] = atoi(getGlobalStringField("distmul", VOCATION_DRUID+1, "1").c_str());
DIST_MUL[VOCATION_PALADIN] = atoi(getGlobalStringField("distmul", VOCATION_PALADIN+1, "1").c_str());
DIST_MUL[VOCATION_KNIGHT] = atoi(getGlobalStringField("distmul", VOCATION_KNIGHT+1, "1").c_str());
SHIELD_MUL[VOCATION_NONE] = atoi(getGlobalStringField("shieldmul", VOCATION_NONE+1, "1").c_str());
SHIELD_MUL[VOCATION_SORCERER] = atoi(getGlobalStringField("shieldmul", VOCATION_SORCERER+1, "1").c_str());
SHIELD_MUL[VOCATION_DRUID] = atoi(getGlobalStringField("shieldmul", VOCATION_DRUID+1, "1").c_str());
SHIELD_MUL[VOCATION_PALADIN] = atoi(getGlobalStringField("shieldmul", VOCATION_PALADIN+1, "1").c_str());
SHIELD_MUL[VOCATION_KNIGHT] = atoi(getGlobalStringField("shieldmul", VOCATION_KNIGHT+1, "1").c_str());
MANA_MUL[VOCATION_NONE] = atoi(getGlobalStringField("manamul", VOCATION_NONE+1, "1").c_str());
MANA_MUL[VOCATION_SORCERER] = atoi(getGlobalStringField("manamul", VOCATION_SORCERER+1, "1").c_str());
MANA_MUL[VOCATION_DRUID] = atoi(getGlobalStringField("manamul", VOCATION_DRUID+1, "1").c_str());
MANA_MUL[VOCATION_PALADIN] = atoi(getGlobalStringField("manamul", VOCATION_PALADIN+1, "1").c_str());
MANA_MUL[VOCATION_KNIGHT] = atoi(getGlobalStringField("manamul", VOCATION_KNIGHT+1, "1").c_str());
#endif //YUR_MULTIPLIERS
#ifdef TR_ANTI_AFK
KICK_TIME = getGlobalNumber("kicktime",15)*60000;
#endif //TR_ANTI_AFK
#ifdef YUR_LEARN_SPELLS
LEARN_SPELLS = getGlobalString("learnspells") == "yes";
#endif //YUR_LEARN_SPELLS
#ifdef TLM_HOUSE_SYSTEM
ACCESS_HOUSE = getGlobalNumber("accesshouse",3);
MAX_HOUSE_TILE_ITEMS = getGlobalNumber("maxhousetileitems",10);
#endif //TLM_HOUSE_SYSTEM
#ifdef TR_SUMMONS
SUMMONS_ALL_VOC = getGlobalString("summonsallvoc") == "yes";
MAX_SUMMONS = (size_t)getGlobalNumber("maxsummons",2);
#endif //TR_SUMMONS
#ifdef TLM_SKULLS_PARTY
HIT_TIME = getGlobalNumber("hittime",1)*60000;
WHITE_TIME = getGlobalNumber("whitetime",15)*60000;
RED_TIME = getGlobalNumber("redtime",5*60)*60000;
FRAG_TIME = getGlobalNumber("fragtime",10*60)*60000;
RED_UNJUST = getGlobalNumber("redunjust",3);
BAN_UNJUST = getGlobalNumber("banunjust",6);
#endif //TLM_SKULLS_PARTY
#ifdef SD_BURST_ARROW
BURST_DMG_LVL = atof(getGlobalStringField("burstarrowdmg", 1, "2.0").c_str());
BURST_DMG_MLVL = atof(getGlobalStringField("burstarrowdmg", 2, "3.0").c_str());
BURST_DMG_LO = atof(getGlobalStringField("burstarrowdmg", 3, "0.24").c_str());
BURST_DMG_HI = atof(getGlobalStringField("burstarrowdmg", 4, "0.55").c_str());
#endif //SD_BURST_ARROW
#ifdef YUR_CONFIG_CAP
CAP_SYSTEM = getGlobalString("capsystem") == "yes";
#endif //YUR_CONFIG_CAP
#ifdef BDB_REPLACE_SPEARS
SPEAR_LOSE_CHANCE = getGlobalNumber("spearlosechance",50);
#endif //BDB_REPLACE_SPEARS
#ifdef YUR_PREMIUM_PROMOTION
FREE_PREMMY = getGlobalString("freepremmy") == "yes";
QUEUE_PREMMY = getGlobalString("queuepremmy") == "yes";
#endif //YUR_PREMIUM_PROMOTION
#ifdef YUR_CVS_MODS
VOCATIONS[VOCATION_KNIGHT] = getGlobalStringField("vocations",VOCATION_KNIGHT);
VOCATIONS[VOCATION_PALADIN] = getGlobalStringField("vocations",VOCATION_PALADIN);
VOCATIONS[VOCATION_SORCERER] = getGlobalStringField("vocations",VOCATION_SORCERER);
VOCATIONS[VOCATION_DRUID] = getGlobalStringField("vocations",VOCATION_DRUID);
PROMOTED_VOCATIONS[VOCATION_KNIGHT] = getGlobalStringField("promoted_vocations",VOCATION_KNIGHT);
PROMOTED_VOCATIONS[VOCATION_PALADIN] = getGlobalStringField("promoted_vocations",VOCATION_PALADIN);
PROMOTED_VOCATIONS[VOCATION_SORCERER] = getGlobalStringField("promoted_vocations",VOCATION_SORCERER);
PROMOTED_VOCATIONS[VOCATION_DRUID] = getGlobalStringField("promoted_vocations",VOCATION_DRUID);
DIE_PERCENT_EXP = atoi(getGlobalStringField("diepercent",1,"7").c_str());
DIE_PERCENT_MANA = atoi(getGlobalStringField("diepercent",2,"7").c_str());
DIE_PERCENT_SKILL = atoi(getGlobalStringField("diepercent",3,"7").c_str());
DIE_PERCENT_EQ = atoi(getGlobalStringField("diepercent",4,"7").c_str());
DIE_PERCENT_BP = atoi(getGlobalStringField("diepercent",5,"100").c_str());
ACCESS_PROTECT = getGlobalNumber("accessprotect",3);
ACCESS_REMOTE = getGlobalNumber("accessremote",3);
ACCESS_TALK = getGlobalNumber("accesstalk",3);
ACCESS_ENTER = getGlobalNumber("accessenter",3);
ACCESS_LOOK = getGlobalNumber("accesslook",3);
EXHAUSTED = getGlobalNumber("exhausted",0);
EXHAUSTED_ADD = getGlobalNumber("exhaustedadd",0);
EXHAUSTED_HEAL = getGlobalNumber("exhaustedheal",0);
PZ_LOCKED = getGlobalNumber("pzlocked",0);
MAX_DEPOT_ITEMS = getGlobalNumber("maxdepotitem",1000);
DATA_DIR = getGlobalString("datadir");
#endif //YUR_CVS_MODS
#ifdef JD_DEATH_LIST
MAX_DEATH_ENTRIES = getGlobalNumber("maxdeathentries",10);
#endif //JD_DEATH_LIST
#ifdef JD_WANDS
MANA_SNAKEBITE = atoi(getGlobalStringField("rodmana", 1, "2").c_str());
MANA_MOONLIGHT = atoi(getGlobalStringField("rodmana", 2, "3").c_str());
MANA_VOLCANIC = atoi(getGlobalStringField("rodmana", 3, "5").c_str());
MANA_QUAGMIRE = atoi(getGlobalStringField("rodmana", 4, "8").c_str());
MANA_TEMPEST = atoi(getGlobalStringField("rodmana", 5, "13").c_str());
MANA_VORTEX = atoi(getGlobalStringField("wandmana", 1, "2").c_str());
MANA_DRAGONBREATH = atoi(getGlobalStringField("wandmana", 2, "3").c_str());
MANA_PLAGUE = atoi(getGlobalStringField("wandmana", 3, "5").c_str());
MANA_COSMIC = atoi(getGlobalStringField("wandmana", 4, "8").c_str());
MANA_INFERNO = atoi(getGlobalStringField("wandmana", 5, "13").c_str());
RANGE_SNAKEBITE = atoi(getGlobalStringField("rodrange", 1, "4").c_str());
RANGE_MOONLIGHT = atoi(getGlobalStringField("rodrange", 2, "3").c_str());
RANGE_VOLCANIC = atoi(getGlobalStringField("rodrange", 3, "2").c_str());
RANGE_QUAGMIRE = atoi(getGlobalStringField("rodrange", 4, "1").c_str());
RANGE_TEMPEST = atoi(getGlobalStringField("rodrange", 5, "3").c_str());
RANGE_VORTEX = atoi(getGlobalStringField("wandrange", 1, "4").c_str());
RANGE_DRAGONBREATH = atoi(getGlobalStringField("wandrange", 2, "3").c_str());
RANGE_PLAGUE = atoi(getGlobalStringField("wandrange", 3, "2").c_str());
RANGE_COSMIC = atoi(getGlobalStringField("wandrange", 4, "1").c_str());
RANGE_INFERNO = atoi(getGlobalStringField("wandrange", 5, "3").c_str());
#endif //JD_WANDS
#ifdef YUR_BUILTIN_AAC
ACCMAKER = getGlobalString("accmaker") != "none";
ACCMAKER_ROOK = getGlobalString("accmaker") == "rook";
#endif //YUR_BUILTIN_AAC
return true;
}
std::string LuaScript::getGlobalString(std::string var, const std::string &defString)
{
lua_getglobal(luaState, var.c_str());
if(!lua_isstring(luaState, -1))
return defString;
int len = (int)lua_strlen(luaState, -1);
std::string ret(lua_tostring(luaState, -1), len);
lua_pop(luaState,1);
return ret;
}
int LuaScript::getGlobalNumber(std::string var, const int defNum)
{
lua_getglobal(luaState, var.c_str());
if(!lua_isnumber(luaState, -1))
return defNum;
int val = (int)lua_tonumber(luaState, -1);
lua_pop(luaState,1);
return val;
}
int LuaScript::setGlobalString(std::string var, std::string val)
{
return false;
}
int LuaScript::setGlobalNumber(std::string var, int val){
lua_pushnumber(luaState, val);
lua_setglobal(luaState, var.c_str());
return true;
}
std::string LuaScript::getGlobalStringField (std::string var, const int key, const std::string &defString) {
lua_getglobal(luaState, var.c_str());
lua_pushnumber(luaState, key);
lua_gettable(luaState, -2); /* get table[key] */
if(!lua_isstring(luaState, -1))
return defString;
std::string result = lua_tostring(luaState, -1);
lua_pop(luaState, 2); /* remove number and key*/
return result;
}
int LuaScript::getField (const char *key) {
int result;
lua_pushstring(luaState, key);
lua_gettable(luaState, -2); /* get table[key] */
result = (int)lua_tonumber(luaState, -1);
lua_pop(luaState, 1); /* remove number and key*/
return result;
}
void LuaScript::setField (const char *index, int val) {
lua_pushstring(luaState, index);
lua_pushnumber(luaState, (double)val);
lua_settable(luaState, -3);
}
int LuaScript::getField (lua_State *L , const char *key) {
int result;
lua_pushstring(L, key);
lua_gettable(L, -2); /* get table[key] */
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1); /* remove number and key*/
return result;
}
void LuaScript::setField (lua_State *L, const char *index, int val) {
lua_pushstring(L, index);
lua_pushnumber(L, (double)val);
lua_settable(L, -3);
}
luascript.h
#ifndef __LUASCRIPT_H__
#define __LUASCRIPT_H__
#include <string>
extern "C"
{
#include "LUA/lua.h"
#include "LUA/lauxlib.h"
#include "LUA/lualib.h"
_
soemone know how to fix it?
acctions.h
#ifndef __actions_h_
#define __actions_h_
#include "position.h"
#include "libxml/xmlmemory.h"
#include "libxml/parser.h"
#include <map>
#include "luascript.h"
extern "C"
{
#include "LUA/lua.h"
#include "LUA/lauxlib.h"
#include "LUA/lualib.h"
#include "LUA/luaconf.h"
}
actions.cpp
#include "stdafx.h"
#include "definitions.h"
#include "const76.h"
#include "player.h"
#include "monster.h"
#include "npc.h"
#include "game.h"
#include "item.h"
#include "libxml/xmlmemory.h"
#include "libxml/parser.h"
#include "actions.h"
otserv.cpp
#include "stdafx.h"
#include "definitions.h"
#include <string>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <ctime>
#include "otsystem.h"
#include "networkmessage.h"
#include "protocol76.h"
#include <stdlib.h>
#include <time.h>
#include "game.h"
#include "ioaccount.h"
#include "ioplayer.h"
#include "status.h"
#include "spells.h"
#include "monsters.h"
#include "actions.h"
#include "commands.h"
#include "luascript.h"
#include "account.h"
#include "tools.h"
#include "md5.h"
#include "summons.h"
#include "pvparena.h"
#include "readables.h"
#include "aac.h"
npc.cpp
#include "stdafx.h"
#include "definitions.h"
#include <algorithm>
#include <functional>
#include <string>
#include <sstream>
#include <fstream>
#include "libxml/xmlmemory.h"
#include "libxml/parser.h"
#include "npc.h"
#include "luascript.h"
#include "player.h"
npc.h
#ifndef __npc_h_
#define __npc_h_
#include "creature.h"
#include "game.h"
#include "luascript.h"
#include "templates.h"
extern "C"
{
#include "LUA/lua.h"
#include "LUA/lauxlib.h"
#include "LUA/lualib.h"
}
有人知道如何解决这个问题吗? 我使用visual studio 2013
答案 0 :(得分:0)
右键单击解决方案资源管理器中的项目。
选择&#34;链接器&#34;
在&#34;输入部分&#34;说明您尝试使用的Lua(以及xml和所有其他库)库的名称。
在&#34;将军&#34;部分,指定此库在&#34;其他库目录&#34;中的位置。
一般来说,&#34;未解决的外部&#34;消息有几个先前的答案:例如here。各种IDE的细节略有不同。