forked from metin2/server
Add project files.
This commit is contained in:
24
quest/CMakeLists.txt
Normal file
24
quest/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(quest CXX)
|
||||
|
||||
file(GLOB_RECURSE sources
|
||||
src/*.cc src/*.h
|
||||
src/*.c
|
||||
)
|
||||
|
||||
include_directories(src/)
|
||||
|
||||
# Find dependencies
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${sources})
|
||||
|
||||
# Link dependencies if found
|
||||
if (Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES})
|
||||
endif (Boost_FOUND)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} liblua)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../liblua)
|
135
quest/src/crc32.cc
Normal file
135
quest/src/crc32.cc
Normal file
@ -0,0 +1,135 @@
|
||||
#include "crc32.h"
|
||||
|
||||
static unsigned long CRCTable[256] =
|
||||
{
|
||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
|
||||
0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
|
||||
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
|
||||
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
||||
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
|
||||
0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
|
||||
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
|
||||
0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
||||
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
|
||||
0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
|
||||
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106,
|
||||
0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
||||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
|
||||
0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
|
||||
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
|
||||
0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
||||
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
|
||||
0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
|
||||
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA,
|
||||
0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
||||
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
|
||||
0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
|
||||
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84,
|
||||
0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
||||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
|
||||
0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
|
||||
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
|
||||
0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
||||
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
|
||||
0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
|
||||
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28,
|
||||
0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
||||
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
|
||||
0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
|
||||
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
|
||||
0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
||||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
|
||||
0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
|
||||
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
|
||||
0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
|
||||
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
|
||||
0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
|
||||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
|
||||
};
|
||||
|
||||
#define DO1(buf, i) crc = CRCTable[(crc ^ buf[i]) & 0xff] ^ (crc >> 8)
|
||||
#define DO2(buf, i) DO1(buf, i); DO1(buf, i + 1);
|
||||
#define DO4(buf, i) DO2(buf, i); DO2(buf, i + 2);
|
||||
#define DO8(buf, i) DO4(buf, i); DO4(buf, i + 4);
|
||||
#define DO16(buf, i) DO8(buf, i); DO8(buf, i + 8);
|
||||
|
||||
crc_t get_crc32(const char * buf, size_t len)
|
||||
{
|
||||
crc_t crc = 0xffffffff;
|
||||
|
||||
if (16 <= len)
|
||||
{
|
||||
do
|
||||
{
|
||||
DO16(buf, 0);
|
||||
|
||||
buf += 16;
|
||||
len -= 16;
|
||||
} while (len >= 16);
|
||||
}
|
||||
|
||||
if (0 != len)
|
||||
{
|
||||
do
|
||||
{
|
||||
DO1(buf, 0);
|
||||
|
||||
++buf;
|
||||
--len;
|
||||
} while (len > 0);
|
||||
}
|
||||
|
||||
crc ^= 0xffffffff;
|
||||
return crc;
|
||||
}
|
||||
/*
|
||||
#define DO1CI(buf, i) crc = CRCTable[(crc ^ UPPER(buf[i])) & 0xff] ^ (crc >> 8)
|
||||
#define DO2CI(buf, i) DO1CI(buf, i); DO1CI(buf, i + 1);
|
||||
#define DO4CI(buf, i) DO2CI(buf, i); DO2CI(buf, i + 2);
|
||||
#define DO8CI(buf, i) DO4CI(buf, i); DO4CI(buf, i + 4);
|
||||
#define DO16CI(buf, i) DO8CI(buf, i); DO8CI(buf, i + 8);
|
||||
|
||||
crc_t get_crc32_case(const char * buf, size_t len)
|
||||
{
|
||||
crc_t crc = 0xffffffff;
|
||||
|
||||
if (16 <= len)
|
||||
{
|
||||
do
|
||||
{
|
||||
DO16CI(buf, 0);
|
||||
|
||||
buf += 16;
|
||||
len -= 16;
|
||||
} while (len >= 16);
|
||||
}
|
||||
|
||||
if (0 != len)
|
||||
{
|
||||
do
|
||||
{
|
||||
DO1CI(buf, 0);
|
||||
|
||||
++buf;
|
||||
--len;
|
||||
} while (len > 0);
|
||||
}
|
||||
|
||||
crc ^= 0xffffffff;
|
||||
return crc;
|
||||
}
|
||||
*/
|
||||
crc_t get_fast_hash(const char * key, size_t len)
|
||||
{
|
||||
const char * end = key + len;
|
||||
unsigned long h = 0;
|
||||
|
||||
while (key < end)
|
||||
{
|
||||
h *= 16777619;
|
||||
h ^= *(key++);
|
||||
}
|
||||
|
||||
return (h);
|
||||
}
|
||||
|
17
quest/src/crc32.h
Normal file
17
quest/src/crc32.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef __INC_CRC32_H__
|
||||
#define __INC_CRC32_H__
|
||||
|
||||
#ifndef __WIN32__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
typedef unsigned long crc_t;
|
||||
|
||||
crc_t get_crc32(const char * buffer, size_t count);
|
||||
crc_t get_crc32_case(const char * buffer, size_t count);
|
||||
crc_t get_fast_hash(const char * key, size_t len);
|
||||
|
||||
#define CRC32(buf) get_crc32(buf, strlen(buf))
|
||||
#define CRC32CASE(buf) get_crc32_case(buf, strlen(buf))
|
||||
|
||||
#endif
|
988
quest/src/qc.cc
Normal file
988
quest/src/qc.cc
Normal file
@ -0,0 +1,988 @@
|
||||
#if !defined(_MSC_VER) && defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include <lualib.h>
|
||||
#include "../../../liblua/src/lzio.h"
|
||||
#include "../../../liblua/src/llex.h"
|
||||
#include "../../../liblua/src/lstring.h"
|
||||
#if !defined(_MSC_VER) && defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#ifndef __WIN32__
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
#define typeof(t) BOOST_TYPEOF(t)
|
||||
#include <direct.h>
|
||||
#define mkdir(path, mode) _mkdir(path)
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "crc32.h"
|
||||
|
||||
#define OUTPUT_FOLDER "object"
|
||||
|
||||
using namespace std;
|
||||
|
||||
lua_State* L;
|
||||
|
||||
typedef struct LoadF {
|
||||
FILE *f;
|
||||
char buff[LUAL_BUFFERSIZE];
|
||||
} LoadF;
|
||||
|
||||
char * g_filename;
|
||||
|
||||
unsigned int get_string_crc(const std::string & str)
|
||||
{
|
||||
const unsigned char * s = (const unsigned char*) str.c_str();
|
||||
const unsigned char * end = s + str.size();
|
||||
unsigned int h = 0;
|
||||
|
||||
while (s < end)
|
||||
{
|
||||
h *= 16777619;
|
||||
h ^= (unsigned char) *(unsigned char *) (s++);
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
static const char *getF (lua_State *L, void *ud, size_t *size) {
|
||||
LoadF *lf = (LoadF *)ud;
|
||||
|
||||
if (feof(lf->f))
|
||||
return NULL;
|
||||
|
||||
*size = fread(lf->buff, 1, LUAL_BUFFERSIZE, lf->f);
|
||||
return (*size > 0) ? lf->buff : NULL;
|
||||
}
|
||||
|
||||
static void next (LexState * ls)
|
||||
{
|
||||
ls->lastline = ls->linenumber;
|
||||
|
||||
if (ls->lookahead.token != TK_EOS)
|
||||
{
|
||||
/* is there a look-ahead token? */
|
||||
ls->t = ls->lookahead; /* use this one */
|
||||
ls->lookahead.token = TK_EOS; /* and discharge it */
|
||||
}
|
||||
else
|
||||
ls->t.token = luaX_lex(ls, &ls->t.seminfo); /* read next token */
|
||||
}
|
||||
|
||||
static bool testnext (LexState * ls, int c)
|
||||
{
|
||||
if (ls->t.token == c)
|
||||
{
|
||||
next(ls);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static void lookahead (LexState * ls)
|
||||
{
|
||||
lua_assert(ls->lookahead.token == TK_EOS);
|
||||
ls->lookahead.token = luaX_lex(ls, &ls->lookahead.seminfo);
|
||||
}
|
||||
|
||||
enum parse_state
|
||||
{
|
||||
ST_START,
|
||||
ST_QUEST,
|
||||
ST_QUEST_WITH_OR_BEGIN,
|
||||
ST_STATELIST,
|
||||
ST_STATE_NAME,
|
||||
ST_STATE_BEGIN,
|
||||
ST_WHENLIST_OR_FUNCTION,
|
||||
ST_WHEN_NAME,
|
||||
ST_WHEN_WITH_OR_BEGIN,
|
||||
ST_WHEN_BODY,
|
||||
ST_FUNCTION_NAME,
|
||||
ST_FUNCTION_ARG,
|
||||
ST_FUNCTION_BODY,
|
||||
};
|
||||
|
||||
//#define t2obj(tok) ((tok.token == TK_NAME || tok.token == TK_STRING)?getstr(tok.seminfo.ts):((tok.token==TK_NUMBER)?lexstate.t.seminfo.r:luaX_token2str(&lexstate,tok.token)))
|
||||
|
||||
struct LexState * pls = 0;
|
||||
void errorline(int line , const char * str)
|
||||
{
|
||||
cout.flush();
|
||||
if (g_filename)
|
||||
cerr << g_filename <<":";
|
||||
cerr << line<< ':';
|
||||
cerr << str << endl;
|
||||
abort();
|
||||
}
|
||||
void error(const char * str)
|
||||
{
|
||||
cout.flush();
|
||||
if (g_filename)
|
||||
cout << g_filename <<":";
|
||||
if (pls)
|
||||
{
|
||||
cout << pls->linenumber << ':';
|
||||
}
|
||||
cerr << str << endl;
|
||||
abort();
|
||||
}
|
||||
|
||||
#define assert(exp) if (!(exp)) error("assertion failure : " #exp)
|
||||
#define assert_msg(exp,msg) if (!(exp)) error(msg " : " #exp)
|
||||
|
||||
ostream & operator << (ostream & ostr, const Token& tok)
|
||||
{
|
||||
if (tok.token == TK_NAME)
|
||||
ostr << getstr(tok.seminfo.ts);
|
||||
else if (tok.token == TK_NUMBER)
|
||||
ostr << tok.seminfo.r;
|
||||
else if (tok.token == TK_STRING)
|
||||
ostr << '"' << getstr(tok.seminfo.ts) <<'"';
|
||||
else
|
||||
ostr << luaX_token2str(pls,tok.token);
|
||||
return ostr;
|
||||
}
|
||||
|
||||
bool check_syntax(const string& str, const string& module)
|
||||
{
|
||||
int ret = luaL_loadbuffer(L, str.c_str(), str.size(), module.c_str());
|
||||
|
||||
if (ret)
|
||||
{
|
||||
cerr << str << endl;
|
||||
error((string("syntax error : ")+lua_tostring(L,-1) ).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
lua_pop(L,1);
|
||||
return true;
|
||||
}
|
||||
|
||||
int none_c_function(lua_State* L)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
set<string> function_defs;
|
||||
set<string> function_calls;
|
||||
|
||||
void RegisterDefFunction(const string& fname)
|
||||
{
|
||||
function_defs.insert(fname);
|
||||
}
|
||||
|
||||
void RegisterUsedFunction(const string& fname)
|
||||
{
|
||||
function_calls.insert(fname);
|
||||
}
|
||||
|
||||
void CheckUsedFunction()
|
||||
{
|
||||
bool hasError = false;
|
||||
set<string> error_func;
|
||||
|
||||
for (typeof(function_calls.begin()) it = function_calls.begin(); it != function_calls.end(); ++it)
|
||||
{
|
||||
if (function_defs.find(*it) == function_defs.end())
|
||||
{
|
||||
hasError = true;
|
||||
error_func.insert(*it);
|
||||
}
|
||||
//cout << "Used : " << *it << endl;
|
||||
}
|
||||
|
||||
if (hasError)
|
||||
{
|
||||
cout << "Calls undeclared function! : " << endl;
|
||||
for (typeof(error_func.begin()) it = error_func.begin(); it != error_func.end(); ++it)
|
||||
{
|
||||
cout << *it << endl;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void load_quest_function_list(const char* filename)
|
||||
{
|
||||
ifstream inf(filename);
|
||||
string s;
|
||||
|
||||
while (!inf.eof())
|
||||
{
|
||||
inf >> s;
|
||||
if (inf.fail())
|
||||
break;
|
||||
|
||||
RegisterDefFunction(s);
|
||||
}
|
||||
}
|
||||
|
||||
struct AScript
|
||||
{
|
||||
string when_condition;
|
||||
string when_argument;
|
||||
string script;
|
||||
|
||||
AScript(string a, string b, string c) :
|
||||
when_condition(a),
|
||||
when_argument(b),
|
||||
script(c)
|
||||
{}
|
||||
|
||||
AScript() {}
|
||||
};
|
||||
|
||||
void parse(char * filename)
|
||||
{
|
||||
ifstream inf(filename);
|
||||
LoadF lf;
|
||||
lf.f = fopen(filename,"r");
|
||||
ZIO z;
|
||||
luaZ_init(&z, getF,&lf,"quest");
|
||||
Mbuffer b;
|
||||
struct LexState lexstate;
|
||||
pls = &lexstate;
|
||||
luaZ_initbuffer(L,&b);
|
||||
lexstate.buff = &b;
|
||||
luaX_setinput(L, &lexstate, &z, luaS_new(L, zname(&z)));
|
||||
|
||||
parse_state ps = ST_START;
|
||||
|
||||
int nested = 0;
|
||||
|
||||
string quest_name;
|
||||
string start_condition;
|
||||
|
||||
string current_state_name;
|
||||
string current_when_name;
|
||||
string current_when_condition;
|
||||
|
||||
string current_when_argument;
|
||||
|
||||
set<string> define_state_name_set;
|
||||
map<int,string> used_state_name_map;
|
||||
|
||||
map<string, map<string, string> > state_script_map;
|
||||
map<string, map<string, vector<AScript> > > state_arg_script_map;
|
||||
|
||||
vector<pair<string, string> > when_name_arg_vector;
|
||||
|
||||
string current_function_name;
|
||||
string current_function_arg;
|
||||
string all_functions;
|
||||
|
||||
load_quest_function_list("quest_functions");
|
||||
|
||||
while (1)
|
||||
{
|
||||
next(&lexstate);
|
||||
|
||||
/*/
|
||||
cout << luaX_token2str(&lexstate,lexstate.t.token);
|
||||
if (lexstate.t.token == TK_NAME)
|
||||
cout << '\t' << getstr(lexstate.t.seminfo.ts);
|
||||
else if (lexstate.t.token == TK_NUMBER)
|
||||
cout << '\t' << lexstate.t.seminfo.r;
|
||||
else if (lexstate.t.token == TK_STRING)
|
||||
cout << '\t' << '"' << getstr(lexstate.t.seminfo.ts) <<'"';
|
||||
cout << endl;
|
||||
//*/
|
||||
|
||||
if (lexstate.t.token == TK_EOS) break;
|
||||
|
||||
Token& t= lexstate.t;
|
||||
|
||||
switch(ps)
|
||||
{
|
||||
case ST_START:
|
||||
{
|
||||
assert(nested==0);
|
||||
if (t.token == TK_QUEST)
|
||||
ps = ST_QUEST;
|
||||
else
|
||||
error("must start with 'quest'");
|
||||
}
|
||||
break;
|
||||
case ST_QUEST:
|
||||
{
|
||||
assert(nested==0);
|
||||
if (t.token == TK_NAME || t.token == TK_STRING)
|
||||
{
|
||||
quest_name = getstr(lexstate.t.seminfo.ts);
|
||||
cout << "QUEST : " << quest_name << endl;
|
||||
ps = ST_QUEST_WITH_OR_BEGIN;
|
||||
}
|
||||
else
|
||||
error("quest name must be given");
|
||||
}
|
||||
break;
|
||||
case ST_QUEST_WITH_OR_BEGIN:
|
||||
assert(nested==0);
|
||||
if (t.token == TK_WITH)
|
||||
{
|
||||
assert(nested==0);
|
||||
next(&lexstate);
|
||||
ostringstream os;
|
||||
os << (lexstate.t);
|
||||
//cout << (lexstate.t);
|
||||
next(&lexstate);
|
||||
while (lexstate.t.token!=TK_DO)
|
||||
{
|
||||
os << " " <<(lexstate.t);
|
||||
//cout << TK_DO<<lexstate.t.token << " " <<(lexstate.t) <<endl;
|
||||
next(&lexstate);
|
||||
}
|
||||
start_condition = os.str();
|
||||
check_syntax("if "+start_condition+" then end", quest_name);
|
||||
cout << "\twith ";
|
||||
cout << start_condition;
|
||||
cout << endl;
|
||||
t = lexstate.t;
|
||||
}
|
||||
if (t.token == TK_DO)
|
||||
{
|
||||
ps = ST_STATELIST;
|
||||
nested++;
|
||||
}
|
||||
else
|
||||
{
|
||||
ostringstream os;
|
||||
os << "quest doesn't have begin-end clause. (" << t << ")";
|
||||
error(os.str().c_str());
|
||||
}
|
||||
break;
|
||||
case ST_STATELIST:
|
||||
{
|
||||
assert(nested==1);
|
||||
if (t.token == TK_STATE)
|
||||
{
|
||||
ps = ST_STATE_NAME;
|
||||
}
|
||||
else if (t.token == TK_END)
|
||||
{
|
||||
nested --;
|
||||
ps = ST_START;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("expecting 'state'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ST_STATE_NAME:
|
||||
{
|
||||
assert(nested==1);
|
||||
if (t.token == TK_NAME || t.token == TK_STRING)
|
||||
{
|
||||
current_state_name = getstr(t.seminfo.ts);
|
||||
define_state_name_set.insert(current_state_name);
|
||||
cout << "STATE : " << current_state_name << endl;
|
||||
ps = ST_STATE_BEGIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("state name must be given");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_STATE_BEGIN:
|
||||
{
|
||||
assert(nested==1);
|
||||
|
||||
if (t.token == TK_DO)
|
||||
{
|
||||
nested ++;
|
||||
ps = ST_WHENLIST_OR_FUNCTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("state doesn't have begin-end clause.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_WHENLIST_OR_FUNCTION:
|
||||
{
|
||||
assert(nested==2);
|
||||
|
||||
if (t.token == TK_WHEN)
|
||||
{
|
||||
ps = ST_WHEN_NAME;
|
||||
|
||||
when_name_arg_vector.clear();
|
||||
}
|
||||
else if (t.token == TK_END)
|
||||
{
|
||||
nested--;
|
||||
ps = ST_STATELIST;
|
||||
}
|
||||
else if (t.token == TK_FUNCTION)
|
||||
{
|
||||
ps = ST_FUNCTION_NAME;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("expecting 'when' or 'function'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_WHEN_NAME:
|
||||
{
|
||||
assert(nested==2);
|
||||
if (t.token == TK_NAME || t.token == TK_STRING || t.token == TK_NUMBER)
|
||||
{
|
||||
if (t.token == TK_NUMBER)
|
||||
{
|
||||
ostringstream os;
|
||||
os << (unsigned int)t.seminfo.r;
|
||||
current_when_name = os.str();
|
||||
lexstate.lookahead.token = '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
current_when_name = getstr(t.seminfo.ts);
|
||||
lookahead(&lexstate);
|
||||
}
|
||||
ps = ST_WHEN_WITH_OR_BEGIN;
|
||||
current_when_argument = "";
|
||||
if (lexstate.lookahead.token == '.')
|
||||
{
|
||||
next(&lexstate);
|
||||
current_when_name += '.';
|
||||
next(&lexstate);
|
||||
ostringstream os;
|
||||
t = lexstate.t;
|
||||
os << t;
|
||||
if (os.str() == "target")
|
||||
{
|
||||
current_when_argument = "." + current_when_name;
|
||||
current_when_argument.resize(current_when_argument.size()-1);
|
||||
current_when_name = "target";
|
||||
}
|
||||
else
|
||||
{
|
||||
current_when_name += os.str();
|
||||
}
|
||||
lookahead(&lexstate);
|
||||
}
|
||||
|
||||
{
|
||||
// make when argument
|
||||
ostringstream os;
|
||||
while (lexstate.lookahead.token == '.')
|
||||
{
|
||||
next(&lexstate);
|
||||
os << '.';
|
||||
next(&lexstate);
|
||||
t = lexstate.t;
|
||||
//if (t.token == TK_STRING)
|
||||
//t.token = TK_NAME;
|
||||
os << t;
|
||||
lookahead(&lexstate);
|
||||
}
|
||||
current_when_argument += os.str();
|
||||
}
|
||||
cout << "WHEN : " << current_when_name ;
|
||||
if (!current_when_argument.empty())
|
||||
{
|
||||
cout << " (";
|
||||
cout << current_when_argument.substr(1);
|
||||
cout << ")";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error("when name must be given");
|
||||
}
|
||||
|
||||
if (lexstate.lookahead.token == TK_OR)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> when name
|
||||
// push to somewhere -.-
|
||||
ps = ST_WHEN_NAME;
|
||||
when_name_arg_vector.push_back(make_pair(current_when_name, current_when_argument));
|
||||
|
||||
next(&lexstate);
|
||||
cout << " or" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout <<endl;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ST_WHEN_WITH_OR_BEGIN:
|
||||
{
|
||||
assert(nested==2);
|
||||
current_when_condition = "";
|
||||
if (t.token == TK_WITH)
|
||||
{
|
||||
// here comes <20><><EFBFBD>ǽ<EFBFBD>
|
||||
next(&lexstate);
|
||||
ostringstream os;
|
||||
os << (lexstate.t);
|
||||
//cout << (lexstate.t);
|
||||
next(&lexstate);
|
||||
while (lexstate.t.token!=TK_DO)
|
||||
{
|
||||
os << " " <<(lexstate.t);
|
||||
//cout << TK_DO<<lexstate.t.token << " " <<(lexstate.t) <<endl;
|
||||
next(&lexstate);
|
||||
}
|
||||
current_when_condition = os.str();
|
||||
check_syntax("if "+current_when_condition+" then end", current_state_name+current_when_condition);
|
||||
cout << "\twith ";
|
||||
cout << current_when_condition;
|
||||
cout << endl;
|
||||
t = lexstate.t;
|
||||
}
|
||||
if (t.token == TK_DO)
|
||||
{
|
||||
ps = ST_WHEN_BODY;
|
||||
nested++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//error("when doesn't have begin-end clause.");
|
||||
ostringstream os;
|
||||
os << "when doesn't have begin-end clause. (" << t << ")";
|
||||
error(os.str().c_str());
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case ST_WHEN_BODY:
|
||||
{
|
||||
assert(nested==3);
|
||||
|
||||
// output
|
||||
ostringstream os;
|
||||
int state_check = 0;
|
||||
typeof(lexstate) prev = lexstate;
|
||||
string callname;
|
||||
bool registered = false;
|
||||
if (prev.t.token == '.')
|
||||
prev.t.token == TK_DO; // any token
|
||||
while (1)
|
||||
{
|
||||
if (lexstate.t.token == TK_DO || lexstate.t.token == TK_IF /*|| lexstate.t.token == TK_FOR*/ || lexstate.t.token == TK_BEGIN || lexstate.t.token == TK_FUNCTION)
|
||||
{
|
||||
//cout << ">>>" << endl;
|
||||
nested++;
|
||||
}
|
||||
else if (lexstate.t.token == TK_END)
|
||||
{
|
||||
//cout << "<<<" << endl;
|
||||
nested--;
|
||||
}
|
||||
|
||||
if (!callname.empty())
|
||||
{
|
||||
lookahead(&lexstate);
|
||||
if (lexstate.lookahead.token == '(')
|
||||
{
|
||||
RegisterUsedFunction(callname);
|
||||
registered = true;
|
||||
}
|
||||
callname.clear();
|
||||
}
|
||||
else if (lexstate.t.token == '(')
|
||||
{
|
||||
if (!registered && prev.t.token == TK_NAME)
|
||||
RegisterUsedFunction(getstr(prev.t.seminfo.ts));
|
||||
registered = false;
|
||||
}
|
||||
|
||||
if (lexstate.t.token == '.')
|
||||
{
|
||||
ostringstream fname;
|
||||
lookahead(&lexstate);
|
||||
fname << prev.t << '.' << lexstate.lookahead;
|
||||
callname = fname.str();
|
||||
}
|
||||
|
||||
if (state_check)
|
||||
{
|
||||
state_check--;
|
||||
if (!state_check)
|
||||
{
|
||||
if (lexstate.t.token == TK_NAME || lexstate.t.token == TK_STRING)
|
||||
{
|
||||
used_state_name_map[lexstate.linenumber] = (getstr(lexstate.t.seminfo.ts));
|
||||
lexstate.t.token = TK_STRING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lexstate.t.token == TK_NAME && ((strcmp(getstr(lexstate.t.seminfo.ts),"set_state")==0) || (strcmp(getstr(lexstate.t.seminfo.ts),"newstate")==0) || (strcmp(getstr(lexstate.t.seminfo.ts),"setstate")==0)))
|
||||
{
|
||||
state_check = 2;
|
||||
}
|
||||
if (nested==2) break;
|
||||
os << lexstate.t << ' ';
|
||||
prev = lexstate;
|
||||
next(&lexstate);
|
||||
if (lexstate.linenumber != lexstate.lastline)
|
||||
os << endl;
|
||||
}
|
||||
|
||||
|
||||
//cout << os.str() << endl;
|
||||
|
||||
check_syntax(os.str(), current_state_name+current_when_condition);
|
||||
reverse(when_name_arg_vector.begin(), when_name_arg_vector.end());
|
||||
while (1)
|
||||
{
|
||||
if (current_when_argument.empty())
|
||||
{
|
||||
if (current_when_condition.empty())
|
||||
state_script_map[current_when_name][current_state_name]+=os.str();
|
||||
else
|
||||
state_script_map[current_when_name][current_state_name]+="if "+current_when_condition+" then "+os.str()+" return end ";
|
||||
}
|
||||
else
|
||||
{
|
||||
state_arg_script_map[current_when_name][current_state_name].push_back(AScript(current_when_condition, current_when_argument, os.str()));
|
||||
}
|
||||
|
||||
if (!when_name_arg_vector.empty())
|
||||
{
|
||||
current_when_name = when_name_arg_vector.back().first;
|
||||
current_when_argument = when_name_arg_vector.back().second;
|
||||
when_name_arg_vector.pop_back();
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
ps = ST_WHENLIST_OR_FUNCTION;
|
||||
}
|
||||
break;
|
||||
case ST_FUNCTION_NAME:
|
||||
if (t.token == TK_NAME)
|
||||
{
|
||||
current_function_name = getstr(t.seminfo.ts);
|
||||
RegisterDefFunction(quest_name+"."+current_function_name);
|
||||
ps = ST_FUNCTION_ARG;
|
||||
}
|
||||
break;
|
||||
case ST_FUNCTION_ARG:
|
||||
{
|
||||
assert(t.token == '(');
|
||||
next(&lexstate);
|
||||
current_function_arg = '(';
|
||||
if (t.token != ')')
|
||||
{
|
||||
do
|
||||
{
|
||||
if (t.token == TK_NAME)
|
||||
{
|
||||
current_function_arg += getstr(t.seminfo.ts);
|
||||
next(&lexstate);
|
||||
if (t.token != ')')
|
||||
current_function_arg += ',';
|
||||
}
|
||||
else
|
||||
{
|
||||
ostringstream os;
|
||||
os << "invalud argument name " << getstr(t.seminfo.ts) << " for function " << current_function_name;
|
||||
error(os.str().c_str());
|
||||
}
|
||||
} while (testnext(&lexstate, ','));
|
||||
}
|
||||
current_function_arg += ')';
|
||||
ps = ST_FUNCTION_BODY;
|
||||
nested ++;
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_FUNCTION_BODY:
|
||||
{
|
||||
assert(nested == 3);
|
||||
ostringstream os;
|
||||
typeof(lexstate) prev = lexstate;
|
||||
bool registered = false;
|
||||
if (prev.t.token == '.')
|
||||
prev.t.token = TK_DO;
|
||||
string callname;
|
||||
while (nested >= 3)
|
||||
{
|
||||
if (lexstate.t.token == TK_DO || lexstate.t.token == TK_IF /*|| lexstate.t.token == TK_FOR*/ || lexstate.t.token == TK_BEGIN || lexstate.t.token == TK_FUNCTION)
|
||||
{
|
||||
//cout << ">>>" << endl;
|
||||
nested++;
|
||||
}
|
||||
else if (lexstate.t.token == TK_END)
|
||||
{
|
||||
//cout << "<<<" << endl;
|
||||
nested--;
|
||||
}
|
||||
|
||||
if (!callname.empty())
|
||||
{
|
||||
lookahead(&lexstate);
|
||||
if (lexstate.lookahead.token == '(')
|
||||
{
|
||||
RegisterUsedFunction(callname);
|
||||
registered = true;
|
||||
}
|
||||
callname.clear();
|
||||
}
|
||||
else if (lexstate.t.token == '(')
|
||||
{
|
||||
if (!registered && prev.t.token == TK_NAME)
|
||||
RegisterUsedFunction(getstr(prev.t.seminfo.ts));
|
||||
registered = false;
|
||||
}
|
||||
|
||||
if (lexstate.t.token == '.')
|
||||
{
|
||||
ostringstream fname;
|
||||
lookahead(&lexstate);
|
||||
fname << prev.t << '.' << lexstate.lookahead;
|
||||
callname = fname.str();
|
||||
}
|
||||
|
||||
os << lexstate.t << ' ';
|
||||
if (nested == 2)
|
||||
break;
|
||||
prev = lexstate;
|
||||
next(&lexstate);
|
||||
//cout << lexstate.t << ' ' << lexstate.linenumber << ' ' << lexstate.lastline << endl;
|
||||
if (lexstate.linenumber != lexstate.lastline)
|
||||
os << endl;
|
||||
|
||||
}
|
||||
ps = ST_WHENLIST_OR_FUNCTION;
|
||||
all_functions += ',';
|
||||
all_functions += current_function_name;
|
||||
all_functions += "= function ";
|
||||
all_functions += current_function_arg;
|
||||
all_functions += os.str();
|
||||
cout << "FUNCTION " << current_function_name << current_function_arg << endl;
|
||||
}
|
||||
break;
|
||||
|
||||
} // end of switch
|
||||
|
||||
}
|
||||
assert(nested==0);
|
||||
for (map<int,string>::iterator it = used_state_name_map.begin();it!=used_state_name_map.end();++it)
|
||||
{
|
||||
if (define_state_name_set.find(it->second)==define_state_name_set.end())
|
||||
{
|
||||
errorline(it->first,("state name not found : "+it->second).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (!define_state_name_set.empty())
|
||||
{
|
||||
if (0 != mkdir(OUTPUT_FOLDER "/state", S_IRWXU))
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
perror("cannot create directory");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
ofstream ouf((string(OUTPUT_FOLDER "/state/")+quest_name).c_str());
|
||||
ouf << quest_name << "={[\"start\"]=0";
|
||||
set<string> :: iterator it;
|
||||
|
||||
map<string, int> state_crc;
|
||||
set<int> crc_set;
|
||||
|
||||
state_crc["start"] = 0;
|
||||
for (it = define_state_name_set.begin(); it != define_state_name_set.end(); ++it)
|
||||
{
|
||||
int crc = (int) CRC32((*it).c_str());
|
||||
|
||||
if (crc_set.find(crc) == crc_set.end())
|
||||
{
|
||||
crc_set.insert(crc);
|
||||
}
|
||||
else
|
||||
{
|
||||
++crc;
|
||||
|
||||
while (crc_set.find(crc) != crc_set.end())
|
||||
++crc;
|
||||
|
||||
printf("WARN: state CRC conflict occur! state index may differ in next compile time.\n");
|
||||
crc_set.insert(crc);
|
||||
}
|
||||
state_crc.insert(make_pair(*it, crc));
|
||||
}
|
||||
|
||||
int idx = 1;
|
||||
|
||||
for (it = define_state_name_set.begin(); it!=define_state_name_set.end(); ++it)
|
||||
{
|
||||
if (*it != "start")
|
||||
{
|
||||
ouf << ",[\"" << *it << "\"]=" <<state_crc[*it];
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
|
||||
// quest function<6F><6E><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
ouf << all_functions;
|
||||
|
||||
ouf << "}";
|
||||
}
|
||||
|
||||
if (!start_condition.empty())
|
||||
{
|
||||
if (0 != mkdir(OUTPUT_FOLDER "/begin_condition", S_IRWXU))
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
perror("cannot create directory");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
ofstream ouf((string(OUTPUT_FOLDER "/begin_condition/")+quest_name).c_str());
|
||||
|
||||
ouf << "return " <<start_condition;
|
||||
ouf.close();
|
||||
}
|
||||
|
||||
{
|
||||
map<string, map<string, vector<AScript> > >::iterator it;
|
||||
|
||||
for (it = state_arg_script_map.begin(); it != state_arg_script_map.end(); ++it)
|
||||
{
|
||||
string second_name;
|
||||
string path;
|
||||
|
||||
if (it->first.find('.')==it->first.npos)
|
||||
{
|
||||
// one like login
|
||||
string s(it->first);
|
||||
transform(s.begin(),s.end(),s.begin(),::tolower);
|
||||
mkdir(OUTPUT_FOLDER "/notarget",0755);
|
||||
mkdir((OUTPUT_FOLDER "/notarget/"+s).c_str(),0755);
|
||||
path = OUTPUT_FOLDER "/notarget/"+s+"/";
|
||||
second_name = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
// two like [WHO].Kill
|
||||
string s = it->first;
|
||||
transform(s.begin(),s.end(),s.begin(),::tolower);
|
||||
int i = s.find('.');
|
||||
mkdir((OUTPUT_FOLDER "/"+it->first.substr(0,i)).c_str(),0755);
|
||||
mkdir((OUTPUT_FOLDER "/"+it->first.substr(0,i)+"/"+s.substr(i+1,s.npos)).c_str(),0755);
|
||||
path = OUTPUT_FOLDER "/" + it->first.substr(0,i) + "/"+s.substr(i+1,s.npos)+"/";
|
||||
second_name = s.substr(i+1,s.npos);
|
||||
}
|
||||
|
||||
map<string,vector<AScript> >::iterator it2;
|
||||
for (it2 = it->second.begin(); it2 != it->second.end(); ++it2)
|
||||
{
|
||||
for (int i = 0; i < it2->second.size(); ++i)
|
||||
{
|
||||
ostringstream os;
|
||||
os << i;
|
||||
{
|
||||
ofstream ouf((path+quest_name+"."+it2->first+"."+os.str()+"."+"script").c_str());
|
||||
copy(it2->second[i].script.begin(),it2->second[i].script.end(), ostreambuf_iterator<char>(ouf));
|
||||
}
|
||||
{
|
||||
ofstream ouf((path+quest_name+"."+it2->first+"."+os.str()+"."+"when").c_str());
|
||||
if (!it2->second[i].when_condition.empty())
|
||||
{
|
||||
ouf << "return ";
|
||||
copy(it2->second[i].when_condition.begin(),it2->second[i].when_condition.end(), ostreambuf_iterator<char>(ouf));
|
||||
}
|
||||
}
|
||||
{
|
||||
ofstream ouf((path+quest_name+"."+it2->first+"."+os.str()+"."+"arg").c_str());
|
||||
copy(it2->second[i].when_argument.begin()+1,it2->second[i].when_argument.end(), ostreambuf_iterator<char>(ouf));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
map<string,map<string,string> >::iterator it;
|
||||
|
||||
for (it = state_script_map.begin();it!=state_script_map.end();++it)
|
||||
{
|
||||
string path;
|
||||
if (it->first.find('.')==it->first.npos)
|
||||
{
|
||||
// one
|
||||
string s = it->first;
|
||||
transform(s.begin(),s.end(),s.begin(),::tolower);
|
||||
mkdir(OUTPUT_FOLDER "/notarget",0755);
|
||||
mkdir((OUTPUT_FOLDER "/notarget/"+s).c_str(),0755);
|
||||
path = OUTPUT_FOLDER "/notarget/"+s+"/";
|
||||
}
|
||||
else
|
||||
{
|
||||
// two like [WHO].Kill
|
||||
string s = it->first;
|
||||
transform(s.begin(),s.end(),s.begin(),::tolower);
|
||||
int i = s.find('.');
|
||||
mkdir((OUTPUT_FOLDER "/"+it->first.substr(0,i)).c_str(),0755);
|
||||
mkdir((OUTPUT_FOLDER "/"+it->first.substr(0,i)+"/"+s.substr(i+1,s.npos)).c_str(),0755);
|
||||
path = OUTPUT_FOLDER "/" + it->first.substr(0,i) + "/"+s.substr(i+1,s.npos)+"/";
|
||||
}
|
||||
|
||||
map<string,string>::iterator it2;
|
||||
for (it2 = it->second.begin();it2!=it->second.end();++it2)
|
||||
{
|
||||
ofstream ouf((path+quest_name+"."+it2->first).c_str());
|
||||
copy(it2->second.begin(),it2->second.end(), ostreambuf_iterator<char>(ouf));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckUsedFunction();
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
mkdir(OUTPUT_FOLDER, 0700);
|
||||
L = lua_open();
|
||||
luaX_init(L);
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
g_filename = argv[i];
|
||||
parse(argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
lua_close(L);
|
||||
return 0;
|
||||
}
|
||||
|
357
quest/src/quest_functions
Normal file
357
quest/src/quest_functions
Normal file
@ -0,0 +1,357 @@
|
||||
table.foreachi
|
||||
target.pos
|
||||
target.vid
|
||||
target.npc
|
||||
target.pc
|
||||
target.delete
|
||||
target.clear
|
||||
target.id
|
||||
pc.getlevel
|
||||
pc.get_level
|
||||
pc.getnextexp
|
||||
pc.get_next_exp
|
||||
pc.getexp
|
||||
pc.get_exp
|
||||
pc.getjob
|
||||
pc.get_job
|
||||
pc.gethp
|
||||
pc.get_hp
|
||||
pc.getmaxhp
|
||||
pc.get_max_hp
|
||||
pc.getsp
|
||||
pc.get_sp
|
||||
pc.getmaxsp
|
||||
pc.get_max_sp
|
||||
pc.change_sp
|
||||
pc.getmoney
|
||||
pc.get_money
|
||||
pc.getweapon
|
||||
pc.get_weapon
|
||||
pc.getgold
|
||||
pc.get_gold
|
||||
pc.changegold
|
||||
pc.changemoney
|
||||
pc.changealignment
|
||||
pc.change_gold
|
||||
pc.change_money
|
||||
pc.change_alignment
|
||||
pc.getname
|
||||
pc.get_name
|
||||
pc.getplaytime
|
||||
pc.get_playtime
|
||||
pc.getleadership
|
||||
pc.get_leadership
|
||||
pc.getqf
|
||||
pc.setqf
|
||||
pc.delqf
|
||||
pc.getf
|
||||
pc.setf
|
||||
pc.get_x
|
||||
pc.get_y
|
||||
pc.getx
|
||||
pc.gety
|
||||
pc.get_local_x
|
||||
pc.get_local_y
|
||||
pc.getcurrentmapindex
|
||||
pc.get_map_index
|
||||
pc.give_exp
|
||||
pc.give_exp_perc
|
||||
pc.give_exp2
|
||||
pc.give_item
|
||||
pc.give_item2
|
||||
pc.give_gold
|
||||
pc.count_item
|
||||
pc.remove_item
|
||||
pc.countitem
|
||||
pc.removeitem
|
||||
pc.reset_point
|
||||
pc.reset_skill_point
|
||||
pc.resetpoint
|
||||
pc.resetskillpoint
|
||||
pc.has_guild
|
||||
pc.hasguild
|
||||
pc.get_guild
|
||||
pc.getguild
|
||||
pc.isguildmaster
|
||||
pc.is_guild_master
|
||||
pc.destroy_guild
|
||||
pc.remove_from_guild
|
||||
pc.in_dungeon
|
||||
pc.getempire
|
||||
pc.get_empire
|
||||
pc.get_skill_group
|
||||
pc.set_skill_group
|
||||
pc.getskillgroup
|
||||
pc.setskillgroup
|
||||
pc.warp
|
||||
pc.warp_local
|
||||
pc.warp_exit
|
||||
pc.set_warp_location
|
||||
pc.set_warp_location_local
|
||||
pc.get_start_location
|
||||
pc.has_master_skill
|
||||
pc.set_part
|
||||
pc.get_part
|
||||
pc.is_polymorphed
|
||||
pc.remove_polymorph
|
||||
pc.is_mount
|
||||
pc.polymorph
|
||||
pc.mount
|
||||
pc.unmount
|
||||
pc.warp_to_guild_war_observer_position
|
||||
pc.give_item_from_special_item_group
|
||||
pc.enough_inventory
|
||||
pc.get_horse_level
|
||||
pc.is_horse_alive
|
||||
pc.revive_horse
|
||||
pc.have_pos_scroll
|
||||
pc.have_map_scroll
|
||||
pc.get_war_map
|
||||
pc.get_equip_refine_level
|
||||
pc.refine_equip
|
||||
pc.get_skill_level
|
||||
pc.give_lotto
|
||||
pc.aggregate_monster
|
||||
pc.forget_my_attacker
|
||||
pc.pc_attract_ranger
|
||||
npc.getrace
|
||||
npc.open_shop
|
||||
npc.get_empire
|
||||
npc.is_pc
|
||||
npc.is_quest
|
||||
npc.get_remain_skill_book_count
|
||||
npc.dec_remain_skill_book_count
|
||||
npc.get_remain_hairdye_count
|
||||
npc.dec_remain_hairdye_count
|
||||
game.get_safebox_level
|
||||
game.request_make_guild
|
||||
game.set_safebox_level
|
||||
game.open_safebox
|
||||
game.get_event_flag
|
||||
game.set_event_flag
|
||||
game.get_guild_name
|
||||
game.drop_item
|
||||
d.join
|
||||
d.exit
|
||||
d.exit_all
|
||||
d.purge
|
||||
d.spawn
|
||||
d.spawn_mob
|
||||
d.spawn_name_mob
|
||||
d.spawn_goto_mob
|
||||
d.spawn_group
|
||||
d.spawn_unique
|
||||
d.spawn_move_unique
|
||||
d.spawn_move_group
|
||||
d.spawn_stone_door
|
||||
d.spawn_wooden_door
|
||||
d.purge_unique
|
||||
d.kill_unique
|
||||
d.is_unique_dead
|
||||
d.unique_get_hp_perc
|
||||
d.unique_set_def_grade
|
||||
d.unique_set_hp
|
||||
d.unique_set_maxhp
|
||||
d.get_kill_stone_count
|
||||
d.get_kill_mob_count
|
||||
d.is_use_potion
|
||||
d.revived
|
||||
d.set_dest
|
||||
d.jump_all
|
||||
d.new_jump_all
|
||||
d.new_jump
|
||||
d.regen_file
|
||||
d.set_regen_file
|
||||
d.clear_regen
|
||||
d.set_exit_all_at_eliminate
|
||||
d.set_warp_at_eliminate
|
||||
d.get_map_index
|
||||
d.check_eliminated
|
||||
d.exit_all_to_start_position
|
||||
d.count_monster
|
||||
party.is_leader
|
||||
party.is_party
|
||||
party.setf
|
||||
party.getf
|
||||
party.setqf
|
||||
party.chat
|
||||
party.syschat
|
||||
party.get_near_count
|
||||
party.show_cinematic
|
||||
party.run_cinematic
|
||||
party.get_max_level
|
||||
party.clear_ready
|
||||
member.chat
|
||||
member.set_ready
|
||||
member.clear_ready
|
||||
item.remove
|
||||
item.get_socket
|
||||
item.set_socket
|
||||
item.get_vnum
|
||||
item.has_flag
|
||||
item.get_value
|
||||
item.get_name
|
||||
item.get_size
|
||||
item.get_count
|
||||
item.get_type
|
||||
item.get_sub_type
|
||||
item.get_refine_vnum
|
||||
item.get_level
|
||||
item.next_refine_vnum
|
||||
horse.is_mine
|
||||
horse.is_riding
|
||||
horse.ride
|
||||
horse.unride
|
||||
horse.summon
|
||||
horse.unsummon
|
||||
horse.advance
|
||||
horse.get_level
|
||||
horse.set_level
|
||||
horse.get_health
|
||||
horse.get_health_pct
|
||||
horse.get_stamina
|
||||
horse.get_stamina_pct
|
||||
horse.get_grade
|
||||
horse.is_dead
|
||||
horse.revive
|
||||
horse.feed
|
||||
guild.get_rank
|
||||
guild.get_ladder_point
|
||||
guild.high_ranking_string
|
||||
guild.around_ranking_string
|
||||
guild.name
|
||||
guild.is_war
|
||||
guild.war_enter
|
||||
guild.get_any_war
|
||||
guild.get_reserve_war_table
|
||||
guild.get_name
|
||||
guild.war_bet
|
||||
guild.is_bet
|
||||
guild.get_warp_war_list
|
||||
highscore.register
|
||||
highscore.show
|
||||
mob.spawn
|
||||
mob.spawn_group
|
||||
q.setstate
|
||||
q.set_state
|
||||
q.yield
|
||||
q.set_title
|
||||
q.set_title2
|
||||
q.set_clock_name
|
||||
q.set_clock_value
|
||||
q.set_counter_name
|
||||
q.set_counter_value
|
||||
q.set_icon
|
||||
q.start
|
||||
q.done
|
||||
q.getcurrentquestindex
|
||||
q.no_send
|
||||
affect.add
|
||||
affect.remove
|
||||
affect.remove_bad
|
||||
affect.remove_good
|
||||
game.get_safebox_level
|
||||
game.request_make_guild
|
||||
game.set_safebox_level
|
||||
game.open_safebox
|
||||
game.get_event_flag
|
||||
game.set_event_flag
|
||||
game.get_guild_name
|
||||
game.get_warp_guild_war_list
|
||||
game.drop_item
|
||||
d.join
|
||||
d.exit
|
||||
d.exit_all
|
||||
d.spawn
|
||||
d.spawn_mob
|
||||
d.spawn_name_mob
|
||||
d.spawn_goto_mob
|
||||
d.spawn_group
|
||||
d.spawn_unique
|
||||
d.spawn_move_unique
|
||||
d.spawn_move_group
|
||||
d.spawn_stone_door
|
||||
d.spawn_wooden_door
|
||||
d.purge_unique
|
||||
d.kill_unique
|
||||
d.is_unique_dead
|
||||
d.unique_get_hp_perc
|
||||
d.unique_set_def_grade
|
||||
d.unique_set_hp
|
||||
d.unique_set_maxhp
|
||||
d.get_kill_stone_count
|
||||
d.get_kill_mob_count
|
||||
d.is_use_potion
|
||||
d.revived
|
||||
d.set_dest
|
||||
d.jump_all
|
||||
d.new_jump_all
|
||||
d.new_jump
|
||||
d.regen_file
|
||||
d.set_regen_file
|
||||
d.clear_regen
|
||||
d.set_exit_all_at_eliminate
|
||||
d.set_warp_at_eliminate
|
||||
d.get_map_index
|
||||
d.check_eliminated
|
||||
party.is_leader
|
||||
party.is_party
|
||||
party.setf
|
||||
party.getf
|
||||
party.chat
|
||||
party.syschat
|
||||
party.get_near_count
|
||||
party.show_cinematic
|
||||
party.run_cinematic
|
||||
party.get_max_level
|
||||
party.clear_ready
|
||||
member.chat
|
||||
member.set_ready
|
||||
member.clear_ready
|
||||
item.remove
|
||||
item.get_socket
|
||||
item.set_socket
|
||||
horse.is_mine
|
||||
horse.ride
|
||||
horse.unride
|
||||
horse.summon
|
||||
horse.unsummon
|
||||
horse.get_level
|
||||
horse.set_level
|
||||
horse.get_hp
|
||||
horse.get_stamina
|
||||
horse.is_dead
|
||||
horse.revive
|
||||
horse.feed
|
||||
guild.get_rank
|
||||
guild.get_ladder_point
|
||||
guild.high_ranking_string
|
||||
guild.around_ranking_string
|
||||
guild.name
|
||||
guild.is_war
|
||||
guild.war_enter
|
||||
guild.get_any_war
|
||||
guild.get_reserve_war_table
|
||||
guild.get_name
|
||||
guild.war_bet
|
||||
guild.is_bet
|
||||
highscore.register
|
||||
highscore.show
|
||||
mob.spawn
|
||||
mob.spawn_group
|
||||
q.setstate
|
||||
q.set_quest_state
|
||||
q.yield
|
||||
q.set_title
|
||||
q.set_title2
|
||||
q.set_clock_name
|
||||
q.set_clock_value
|
||||
q.set_counter_name
|
||||
q.set_counter_value
|
||||
q.set_icon
|
||||
q.start
|
||||
q.done
|
||||
q.getcurrentquestindex
|
||||
q.no_send
|
||||
q.set_clock
|
||||
q.set_counter
|
Reference in New Issue
Block a user