summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c910
-rw-r--r--src/map/skill.c76
-rw-r--r--src/map/skill.h4
-rw-r--r--src/map/status.c6
-rw-r--r--src/map/status.h1
-rw-r--r--src/map/trade.c36
-rw-r--r--src/map/unit.c162
-rw-r--r--src/map/vending.c20
8 files changed, 637 insertions, 578 deletions
diff --git a/src/map/script.c b/src/map/script.c
index eebc52a21..3e7db8720 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -72,7 +72,7 @@
//## TODO possible enhancements: [FlavioJS]
// - 'callfunc' supporting labels in the current npc "::LabelName"
// - 'callfunc' supporting labels in other npcs "NpcName::LabelName"
-// - 'function FuncName;' function declarations reverting to global functions
+// - 'function FuncName;' function declarations reverting to global functions
// if local label isn't found
// - join callfunc and callsub's functionality
// - remove dynamic allocation in add_word()
@@ -230,7 +230,7 @@ static int buildin_callsub_ref = 0;
static int buildin_callfunc_ref = 0;
static int buildin_getelementofarray_ref = 0;
-// Caches compiled autoscript item code.
+// Caches compiled autoscript item code.
// Note: This is not cleared when reloading itemdb.
static DBMap* autobonus_db=NULL; // char* script -> char* bytecode
@@ -282,9 +282,9 @@ static struct {
int count;
int flag;
struct linkdb_node *case_label;
- } curly[256]; // ?��E?��J?��b?��R?��̏�?��
- int curly_count; // ?��E?��J?��b?��R?��̐�
- int index; // ?��X?��N?��?��?��v?��g?��?��?��Ŏg?��p?��?��?��?��?��\?��?��?��̐�
+ } curly[256]; // Information right parenthesis
+ int curly_count; // The number of right brackets
+ int index; // Number of the syntax used in the script
} syntax;
const char* parse_curly_close(const char* p);
@@ -337,7 +337,7 @@ struct {
#endif
/*==========================================
- * ?��?��?��[?��J?��?��?��v?��?��?��g?��^?��C?��v?��錾 (?��K?��v?��ȕ�?��̂�)
+ * (Only those needed) local declaration prototype
*------------------------------------------*/
const char* parse_subexpr(const char* p,int limit);
int run_func(struct script_state *st);
@@ -617,7 +617,7 @@ static void script_reportfunc(struct script_state* st)
/*==========================================
- * ?��G?��?��?��[?��?��?��b?��Z?��[?��W?��o?��?��
+ * Output error message
*------------------------------------------*/
static void disp_error_message2(const char *mes,const char *pos,int report)
{
@@ -800,7 +800,7 @@ static void add_scripti(int a)
///
/// @param l The id of the str_data entry
-// ?��ő�16M?��܂�
+// Maximum up to 16M
static void add_scriptl(int l)
{
int backpatch = str_data[l].backpatch;
@@ -815,7 +815,7 @@ static void add_scriptl(int l)
break;
case C_NOP:
case C_USERFUNC:
- // ?��?��?��x?��?��?��̉”\?��?��?��?��?��?��?��?��̂�backpatch?��p?��f?��[?��^?��?��?��ߍ�?��?��
+ // Embedded data backpatch there is a possibility of label
add_scriptc(C_NAME);
str_data[l].backpatch = script_pos;
add_scriptb(backpatch);
@@ -837,7 +837,7 @@ static void add_scriptl(int l)
}
/*==========================================
- * ?��?��?��x?��?��?��?��?��?��?��?��?��?��?��?��
+ * Resolve the label
*------------------------------------------*/
void set_label(int l,int pos, const char* script_pos)
{
@@ -947,7 +947,7 @@ int add_word(const char* p)
word = (char*)aMalloc(len+1);
memcpy(word, p, len);
word[len] = 0;
-
+
// add the word
i = add_str(word);
aFree(word);
@@ -1080,7 +1080,7 @@ const char* parse_variable(const char* p) {
c_op type = C_NOP;
const char *p2 = NULL;
const char *var = p;
-
+
// skip the variable where applicable
p = skip_word(p);
p = skip_space(p);
@@ -1140,7 +1140,7 @@ const char* parse_variable(const char* p) {
if( p == NULL ) {// end of line or invalid buffer
return NULL;
}
-
+
// push the set function onto the stack
add_scriptl(buildin_set_ref);
add_scriptc(C_ARG);
@@ -1152,7 +1152,7 @@ const char* parse_variable(const char* p) {
// increment the total curly count for the position in the script
++ syntax.curly_count;
-
+
// parse the variable currently being modified
word = add_word(var);
@@ -1168,7 +1168,7 @@ const char* parse_variable(const char* p) {
add_scriptl(buildin_getelementofarray_ref);
add_scriptc(C_ARG);
add_scriptl(word);
-
+
// process the sub-expression for this assignment
p3 = parse_subexpr(p2 + 1, 1);
p3 = skip_space(p3);
@@ -1183,10 +1183,10 @@ const char* parse_variable(const char* p) {
} else {// simply push the variable or value onto the stack
add_scriptl(word);
}
-
+
if( type != C_EQ )
add_scriptc(C_REF);
-
+
if( type == C_ADD_PP || type == C_SUB_PP ) {// incremental operator for the method
add_scripti(1);
add_scriptc(type == C_ADD_PP ? C_ADD : C_SUB);
@@ -1201,16 +1201,16 @@ const char* parse_variable(const char* p) {
// decrement the curly count for the position within the script
-- syntax.curly_count;
-
+
// close the script by appending the function operator
add_scriptc(C_FUNC);
-
+
// push the buffer from the method
return p;
}
/*==========================================
- * ?��?��?��̉�?��
+ * Analysis section
*------------------------------------------*/
const char* parse_simpleexpr(const char *p)
{
@@ -1296,7 +1296,7 @@ const char* parse_simpleexpr(const char *p)
add_scriptl(buildin_getelementofarray_ref);
add_scriptc(C_ARG);
add_scriptl(l);
-
+
p=parse_subexpr(p+1,-1);
p=skip_space(p);
if( *p != ']' )
@@ -1312,7 +1312,7 @@ const char* parse_simpleexpr(const char *p)
}
/*==========================================
- * ?��?��?��̉�?��
+ * Analysis of the expression
*------------------------------------------*/
const char* parse_subexpr(const char* p,int limit)
{
@@ -1374,7 +1374,7 @@ const char* parse_subexpr(const char* p,int limit)
}
/*==========================================
- * ?��?��?��̕]?��?��
+ * Evaluation of the expression
*------------------------------------------*/
const char* parse_expr(const char *p)
{
@@ -1388,7 +1388,7 @@ const char* parse_expr(const char *p)
}
/*==========================================
- * ?��s?��̉�?��
+ * Analysis of the line
*------------------------------------------*/
const char* parse_line(const char* p)
{
@@ -1396,7 +1396,7 @@ const char* parse_line(const char* p)
p=skip_space(p);
if(*p==';') {
- // if(); for(); while(); ?��̂�?��߂ɕ‚�?��?��?��?��
+ //Close decision for if(); for(); while();
p = parse_syntax_close(p + 1);
return p;
}
@@ -1413,8 +1413,8 @@ const char* parse_line(const char* p)
} else if(p[0] == '}') {
return parse_curly_close(p);
}
-
- // ?��\?��?��?��֘A?��̏�?��?��
+
+ // Syntax-related processing
p2 = parse_syntax(p);
if(p2 != NULL)
return p2;
@@ -1429,7 +1429,7 @@ const char* parse_line(const char* p)
p = parse_callfunc(p,0,0);
p = skip_space(p);
-
+
if(parse_syntax_for_flag) {
if( *p != ')' )
disp_error_message("parse_line: need ')'",p);
@@ -1438,13 +1438,13 @@ const char* parse_line(const char* p)
disp_error_message("parse_line: need ';'",p);
}
- // if, for , while ?��̕‚�?��?��?��?��
+ //Binding decision for if(), for(), while()
p = parse_syntax_close(p+1);
return p;
}
-// { ... } ?��̕‚�?��?��?��?��
+// { ... } Closing process
const char* parse_curly_close(const char* p)
{
if(syntax.curly_count <= 0) {
@@ -1452,46 +1452,46 @@ const char* parse_curly_close(const char* p)
return p + 1;
} else if(syntax.curly[syntax.curly_count-1].type == TYPE_NULL) {
syntax.curly_count--;
- // if, for , while ?��̕‚�?��?��?��?��
+ //Close decision if, for , while
p = parse_syntax_close(p + 1);
return p;
} else if(syntax.curly[syntax.curly_count-1].type == TYPE_SWITCH) {
- // switch() ?��‚�?��?��?��?��
+ //Closing switch()
int pos = syntax.curly_count-1;
char label[256];
int l;
- // ?��ꎞ�ϐ�?��?��?��?��?��?��
+ // Remove temporary variables
sprintf(label,"set $@__SW%x_VAL,0;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // ?��?��?��?��?��?��?��ŏI?��?��?��|?��C?��?��?��^?��Ɉړ�
+ // Go to the end pointer unconditionally
sprintf(label,"goto __SW%x_FIN;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // ?��?��?��ݒn?���??��?��x?��?��?��?��t?��?��?��?��
+ // You are here labeled
sprintf(label,"__SW%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
l=add_str(label);
set_label(l,script_pos, p);
if(syntax.curly[pos].flag) {
- // default ?��?��?��?��?��݂�?��?��
+ //Exists default
sprintf(label,"goto __SW%x_DEF;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
}
- // ?��I?��?��?��?��?��x?��?��?��?��t?��?��?��?��
+ // Label end
sprintf(label,"__SW%x_FIN",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos, p);
linkdb_final(&syntax.curly[pos].case_label); // free the list of case label
syntax.curly_count--;
- // if, for , while ?��̕‚�?��?��?��?��
+ //Closing decision if, for , while
p = parse_syntax_close(p + 1);
return p;
} else {
@@ -1500,9 +1500,9 @@ const char* parse_curly_close(const char* p)
}
}
-// ?��\?��?��?��֘A?��̏�?��?��
+// Syntax-related processing
// break, case, continue, default, do, for, function,
-// if, switch, while ?��?��?��?��?��̓�?��?��?��ŏ�?��?��?��?��?��܂�?��B
+// if, switch, while ? will handle this internally.
const char* parse_syntax(const char* p)
{
const char *p2 = skip_word(p);
@@ -1511,7 +1511,7 @@ const char* parse_syntax(const char* p)
case 'B':
case 'b':
if(p2 - p == 5 && !strncasecmp(p,"break",5)) {
- // break ?��̏�?��?��
+ // break Processing
char label[256];
int pos = syntax.curly_count - 1;
while(pos >= 0) {
@@ -1540,7 +1540,7 @@ const char* parse_syntax(const char* p)
p = skip_space(p2);
if(*p != ';')
disp_error_message("parse_syntax: need ';'",p);
- // if, for , while ?��̕‚�?��?��?��?��
+ // Closing decision if, for , while
p = parse_syntax_close(p + 1);
return p;
}
@@ -1548,7 +1548,7 @@ const char* parse_syntax(const char* p)
case 'c':
case 'C':
if(p2 - p == 4 && !strncasecmp(p,"case",4)) {
- // case ?��̏�?��?��
+ //Processing case
int pos = syntax.curly_count-1;
if(pos < 0 || syntax.curly[pos].type != TYPE_SWITCH) {
disp_error_message("parse_syntax: unexpected 'case' ",p);
@@ -1558,18 +1558,18 @@ const char* parse_syntax(const char* p)
int l,v;
char *np;
if(syntax.curly[pos].count != 1) {
- // FALLTHRU ?��p?��̃W?��?��?��?��?��v
+ //Jump for FALLTHRU
sprintf(label,"goto __SW%x_%xJ;",syntax.curly[pos].index,syntax.curly[pos].count);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // ?��?��?��ݒn?���??��?��x?��?��?��?��t?��?��?��?��
+ // You are here labeled
sprintf(label,"__SW%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
l=add_str(label);
set_label(l,script_pos, p);
}
- // switch ?��?��?��蕶
+ //Decision statement switch
p = skip_space(p2);
if(p == p2) {
disp_error_message("parse_syntax: expect space ' '",p);
@@ -1597,12 +1597,12 @@ const char* parse_syntax(const char* p)
sprintf(label,"if(%d != $@__SW%x_VAL) goto __SW%x_%x;",
v,syntax.curly[pos].index,syntax.curly[pos].index,syntax.curly[pos].count+1);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
- // ?��Q?��?��parse ?��?��?��Ȃ�?��ƃ_?��?��
+ // Bad I do not parse twice
p2 = parse_line(label);
parse_line(p2);
syntax.curly_count--;
if(syntax.curly[pos].count != 1) {
- // FALLTHRU ?��I?��?��?��?���??��?��x?��?��
+ // Label after the completion of FALLTHRU
sprintf(label,"__SW%x_%xJ",syntax.curly[pos].index,syntax.curly[pos].count);
l=add_str(label);
set_label(l,script_pos,p);
@@ -1614,20 +1614,20 @@ const char* parse_syntax(const char* p)
sprintf(label,"set $@__SW%x_VAL,0;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
-
+
parse_line(label);
syntax.curly_count--;
syntax.curly[pos].count++;
}
return p + 1;
} else if(p2 - p == 8 && !strncasecmp(p,"continue",8)) {
- // continue ?��̏�?��?��
+ // Processing continue
char label[256];
int pos = syntax.curly_count - 1;
while(pos >= 0) {
if(syntax.curly[pos].type == TYPE_DO) {
sprintf(label,"goto __DO%x_NXT;",syntax.curly[pos].index);
- syntax.curly[pos].flag = 1; // continue ?��p?���??��?��?��?��N?��?��?��?��t?��?��?��O
+ syntax.curly[pos].flag = 1; //Flag put the link for continue
break;
} else if(syntax.curly[pos].type == TYPE_FOR) {
sprintf(label,"goto __FR%x_NXT;",syntax.curly[pos].index);
@@ -1648,7 +1648,7 @@ const char* parse_syntax(const char* p)
p = skip_space(p2);
if(*p != ';')
disp_error_message("parse_syntax: need ';'",p);
- // if, for , while ?��̕‚�?��?��?��?��
+ //Closing decision if, for , while
p = parse_syntax_close(p + 1);
return p;
}
@@ -1656,7 +1656,7 @@ const char* parse_syntax(const char* p)
case 'd':
case 'D':
if(p2 - p == 7 && !strncasecmp(p,"default",7)) {
- // switch - default ?��̏�?��?��
+ // Switch - default processing
int pos = syntax.curly_count-1;
if(pos < 0 || syntax.curly[pos].type != TYPE_SWITCH) {
disp_error_message("parse_syntax: unexpected 'default'",p);
@@ -1665,7 +1665,7 @@ const char* parse_syntax(const char* p)
} else {
char label[256];
int l;
- // ?��?��?��ݒn?���??��?��x?��?��?��?��t?��?��?��?��
+ // Put the label location
p = skip_space(p2);
if(*p != ':') {
disp_error_message("parse_syntax: need ':'",p);
@@ -1674,13 +1674,13 @@ const char* parse_syntax(const char* p)
l=add_str(label);
set_label(l,script_pos,p);
- // ?��?��?��?��?��?��?��Ŏ�?���??��?��?��?��N?��ɔ�΂�
+ // Skip to the next link w/o condition
sprintf(label,"goto __SW%x_%x;",syntax.curly[pos].index,syntax.curly[pos].count+1);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // default ?���??��?��x?��?��?��?��t?��?��?��?��
+ // The default label
sprintf(label,"__SW%x_DEF",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
@@ -1698,7 +1698,7 @@ const char* parse_syntax(const char* p)
syntax.curly[syntax.curly_count].count = 1;
syntax.curly[syntax.curly_count].index = syntax.index++;
syntax.curly[syntax.curly_count].flag = 0;
- // ?��?��?��ݒn?���??��?��x?��?��?��`?��?��?��?��?��?��
+ // Label of the (do) form here
sprintf(label,"__DO%x_BGN",syntax.curly[syntax.curly_count].index);
l=add_str(label);
set_label(l,script_pos,p);
@@ -1724,22 +1724,22 @@ const char* parse_syntax(const char* p)
disp_error_message("parse_syntax: need '('",p);
p++;
- // ?��?��?��?��?��?��?��?��?��s?��?��?��?��
+ // Execute the initialization statement
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
p=parse_line(p);
syntax.curly_count--;
- // ?��?��?��?��?��?��?��f?��J?��n?���??��?��x?��?��?��`?��?��?��?��?��?��
+ // Form the start of label decision
sprintf(label,"__FR%x_J",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
p=skip_space(p);
if(*p == ';') {
- // for(;;) ?��̃p?��^?��[?��?��?��Ȃ̂ŕK?��?��?��^
+ // For (; Because the pattern of always true ;)
;
} else {
- // ?��?��?��?��?��?��?��U?��Ȃ�I?��?��?��n?��_?��ɔ�΂�
+ // Skip to the end point if the condition is false
sprintf(label,"__FR%x_FIN",syntax.curly[pos].index);
add_scriptl(add_str("jump_zero"));
add_scriptc(C_ARG);
@@ -1751,33 +1751,33 @@ const char* parse_syntax(const char* p)
if(*p != ';')
disp_error_message("parse_syntax: need ';'",p);
p++;
-
- // ?��?��?��[?��v?��J?��n?��ɔ�΂�
+
+ // Skip to the beginning of the loop
sprintf(label,"goto __FR%x_BGN;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // ?��?��?���??��?��[?��v?��ւ�??��?��x?��?��?��`?��?��?��?��?��?��
+ // Labels to form the next loop
sprintf(label,"__FR%x_NXT",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
-
- // ?��?��?���??��?��[?��v?��ɓ�鎞�̏�?��?��
- // for ?��Ō�?�� ')' ?��?�� ';' ?��Ƃ�?��Ĉ�?��?��?��t?��?��?��O
+
+ // Process the next time you enter the loop
+ // A ')' last for; flag to be treated as'
parse_syntax_for_flag = 1;
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
p=parse_line(p);
syntax.curly_count--;
parse_syntax_for_flag = 0;
- // ?��?��?��?��?��?��?��菈�?��?��ɔ�΂�
+ // Skip to the determination process conditions
sprintf(label,"goto __FR%x_J;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // ?��?��?��[?��v?��J?��n?���??��?��x?��?��?��t?��?��
+ // Loop start labeling
sprintf(label,"__FR%x_BGN",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
@@ -1804,7 +1804,7 @@ const char* parse_syntax(const char* p)
else
disp_error_message("parse_syntax:function: function name is invalid", func_name);
- // if, for , while ?��̕‚�?��?��?��?��
+ // Close condition of if, for, while
p = parse_syntax_close(p2 + 1);
return p;
}
@@ -1849,7 +1849,7 @@ const char* parse_syntax(const char* p)
case 'i':
case 'I':
if(p2 - p == 2 && !strncasecmp(p,"if",2)) {
- // if() ?��̏�?��?��
+ // If process
char label[256];
p=skip_space(p2);
if(*p != '(') { //Prevent if this {} non-c syntax. from Rayce (jA)
@@ -1873,7 +1873,7 @@ const char* parse_syntax(const char* p)
case 's':
case 'S':
if(p2 - p == 6 && !strncasecmp(p,"switch",6)) {
- // switch() ?��̏�?��?��
+ // Processing of switch ()
char label[256];
p=skip_space(p2);
if(*p != '(') {
@@ -1910,12 +1910,12 @@ const char* parse_syntax(const char* p)
syntax.curly[syntax.curly_count].count = 1;
syntax.curly[syntax.curly_count].index = syntax.index++;
syntax.curly[syntax.curly_count].flag = 0;
- // ?��?��?��?��?��?��?��f?��J?��n?���??��?��x?��?��?��`?��?��?��?��?��?��
+ // Form the start of label decision
sprintf(label,"__WL%x_NXT",syntax.curly[syntax.curly_count].index);
l=add_str(label);
set_label(l,script_pos,p);
- // ?��?��?��?��?��?��?��U?��Ȃ�I?��?��?��n?��_?��ɔ�΂�
+ // Skip to the end point if the condition is false
sprintf(label,"__WL%x_FIN",syntax.curly[syntax.curly_count].index);
syntax.curly_count++;
add_scriptl(add_str("jump_zero"));
@@ -1932,7 +1932,7 @@ const char* parse_syntax(const char* p)
}
const char* parse_syntax_close(const char *p) {
- // if(...) for(...) hoge(); ?��̂悤?��ɁA?��P?��x?��‚�?��?��ꂽ?��?��ēx?��‚�?��?��?��邩?��m?��F?��?��?��?��
+ // If (...) for (...) hoge (); as to make sure closed closed once again
int flag;
do {
@@ -1941,9 +1941,9 @@ const char* parse_syntax_close(const char *p) {
return p;
}
-// if, for , while , do ?��̕‚�?��?��?��?��
-// flag == 1 : ?��‚�?��?��ꂽ
-// flag == 0 : ?��‚�?��?��?��Ȃ�
+// Close judgment if, for, while, of do
+// flag == 1 : closed
+// flag == 0 : not closed
const char* parse_syntax_close_sub(const char* p,int* flag)
{
char label[256];
@@ -1961,13 +1961,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
// if-block and else-block end is a new line
parse_nextline(false, p);
- // if ?��ŏI?��ꏊ�֔�΂�
+ // Skip to the last location if
sprintf(label,"goto __IF%x_FIN;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // ?��?��?��ݒn?���??��?��x?��?��?��?��t?��?��?��?��
+ // Put the label of the location
sprintf(label,"__IF%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
l=add_str(label);
set_label(l,script_pos,p);
@@ -2003,14 +2003,14 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
}
}
}
- // if ?��‚�
+ // Close if
syntax.curly_count--;
- // ?��ŏI?��n?���??��?��x?��?��?��?��t?��?��?��?��
+ // Put the label of the final location
sprintf(label,"__IF%x_FIN",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
if(syntax.curly[pos].flag == 1) {
- // ?��?��?��?��if?��ɑ΂�?��?��else?��?��?��?��Ȃ�?��̂Ń|?��C?��?��?��^?��̈ʒu?��͓�?��?��
+ // Because the position of the pointer is the same if not else for this
return bp;
}
return p;
@@ -2020,13 +2020,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
const char *p2;
if(syntax.curly[pos].flag) {
- // ?��?��?��ݒn?���??��?��x?��?��?��`?��?��?��?��?��?��(continue ?��ł�?��?��?��ɗ�?��?��)
+ // (Come here continue) to form the label here
sprintf(label,"__DO%x_NXT",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
}
- // ?��?��?��?��?��?��?��U?��Ȃ�I?��?��?��n?��_?��ɔ�΂�
+ // Skip to the end point if the condition is false
p = skip_space(p);
p2 = skip_word(p);
if(p2 - p != 5 || strncasecmp(p,"while",5))
@@ -2048,13 +2048,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
add_scriptl(add_str(label));
add_scriptc(C_FUNC);
- // ?��J?��n?��n?��_?��ɔ�΂�
+ // Skip to the starting point
sprintf(label,"goto __DO%x_BGN;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // ?��?��?��?��?��I?��?��?��n?��_?���??��?��x?��?��?��`?��?��?��?��?��?��
+ // Form label of the end point conditions
sprintf(label,"__DO%x_FIN",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
@@ -2070,13 +2070,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
// for-block end is a new line
parse_nextline(false, p);
- // ?��?��?���??��?��[?��v?��ɔ�΂�
+ // Skip to the next loop
sprintf(label,"goto __FR%x_NXT;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // for ?��I?��?��?���??��?��x?��?��?��t?��?��
+ // End for labeling
sprintf(label,"__FR%x_FIN",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
@@ -2086,13 +2086,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
// while-block end is a new line
parse_nextline(false, p);
- // while ?��?��?��?��?��?��?��f?��֔�΂�
+ // Skip to the decision while
sprintf(label,"goto __WL%x_NXT;",syntax.curly[pos].index);
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // while ?��I?��?��?���??��?��x?��?��?��t?��?��
+ // End while labeling
sprintf(label,"__WL%x_FIN",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
@@ -2102,13 +2102,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
int pos = syntax.curly_count-1;
char label[256];
int l;
- // ?��߂�
+ // Back
sprintf(label,"return;");
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
parse_line(label);
syntax.curly_count--;
- // ?��?��?��ݒn?���??��?��x?��?��?��?��t?��?��?��?��
+ // Put the label of the location
sprintf(label,"__FN%x_FIN",syntax.curly[pos].index);
l=add_str(label);
set_label(l,script_pos,p);
@@ -2121,7 +2121,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
}
/*==========================================
- * ?��g?��ݍ�?��݊֐�?��̒lj�
+ * Added built-in functions
*------------------------------------------*/
static void add_buildin_func(void)
{
@@ -2151,10 +2151,10 @@ static void add_buildin_func(void)
str_data[n].val = i;
str_data[n].func = buildin_func[i].func;
- if( !strcmp(buildin_func[i].name, "set") ) buildin_set_ref = n; else
- if( !strcmp(buildin_func[i].name, "callsub") ) buildin_callsub_ref = n; else
- if( !strcmp(buildin_func[i].name, "callfunc") ) buildin_callfunc_ref = n; else
- if( !strcmp(buildin_func[i].name, "getelementofarray") ) buildin_getelementofarray_ref = n;
+ if (!strcmp(buildin_func[i].name, "set")) buildin_set_ref = n;
+ else if (!strcmp(buildin_func[i].name, "callsub")) buildin_callsub_ref = n;
+ else if (!strcmp(buildin_func[i].name, "callfunc")) buildin_callfunc_ref = n;
+ else if( !strcmp(buildin_func[i].name, "getelementofarray") ) buildin_getelementofarray_ref = n;
}
}
}
@@ -2194,7 +2194,8 @@ void script_set_constant(const char* name, int value, bool isparameter)
}
/*==========================================
- * ?��萔�f?��[?��^?��x?��[?��X?��̓ǂݍ�?��?��
+ * Reading constant databases
+ * const.txt
*------------------------------------------*/
static void read_constdb(void)
{
@@ -2222,13 +2223,13 @@ static void read_constdb(void)
}
/*==========================================
- * ?��G?��?��?��[?��\?��?��
+ * Display emplacement line of script
*------------------------------------------*/
static const char* script_print_line(StringBuf* buf, const char* p, const char* mark, int line)
{
int i;
if( p == NULL || !p[0] ) return NULL;
- if( line < 0 )
+ if( line < 0 )
StringBuf_Printf(buf, "*% 5d : ", -line);
else
StringBuf_Printf(buf, " % 5d : ", line);
@@ -2244,7 +2245,7 @@ static const char* script_print_line(StringBuf* buf, const char* p, const char*
void script_error(const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos)
{
- // ?��G?��?��?��[?��?��?��?��?��?��?��?��?��?��?��s?��?��?��?��?��߂�
+ // Find the line where the error occurred
int j;
int line = start_line;
const char *p;
@@ -2279,7 +2280,7 @@ void script_error(const char* src, const char* file, int start_line, const char*
}
/*==========================================
- * ?��X?��N?��?��?��v?��g?��̉�?��
+ * Analysis of the script
*------------------------------------------*/
struct script_code* parse_script(const char *src,const char *file,int line,int options)
{
@@ -2375,7 +2376,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
{
if( *p == '\0' )
disp_error_message("unexpected end of script",p);
- // label?��?��?��?��?��?��?��ꏈ�?��
+ // Special handling only label
tmpp=skip_space(skip_word(p));
if(*tmpp==':' && !(!strncasecmp(p,"default:",8) && p + 7 == tmpp)){
i=add_word(p);
@@ -2387,7 +2388,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
continue;
}
- // ?��?��?��͑S?��?��?��ꏏ�?��?��?��
+ // All other lumped
p=parse_line(p);
p=skip_space(p);
@@ -2827,7 +2828,7 @@ int conv_num(struct script_state* st, struct script_data* data)
data->u.num = (int)num;
}
#if 0
- // FIXME this function is being used to retrieve the position of labels and
+ // FIXME this function is being used to retrieve the position of labels and
// probably other stuff [FlavioJS]
else
{// unsupported data type
@@ -2973,7 +2974,7 @@ void pop_stack(struct script_state* st, int start, int end)
///
/*==========================================
- * ?��X?��N?��?��?��v?��g?��ˑ�?��ϐ�?��A?��֐�?��ˑ�?��ϐ�?��̉�?��
+ * Release script dependent variable, dependent variable of function
*------------------------------------------*/
void script_free_vars(struct DBMap* storage)
{
@@ -3038,10 +3039,10 @@ void script_free_state(struct script_state* st)
}
//
-// ?��?��?��s?��?��main
+// Main execution unit
//
/*==========================================
- * ?��R?��}?��?��?��h?��̓ǂݎ�?��
+ * Read command
*------------------------------------------*/
c_op get_com(unsigned char *script,int *pos)
{
@@ -3058,7 +3059,7 @@ c_op get_com(unsigned char *script,int *pos)
}
/*==========================================
- * ?��?��?��l?��̏�?��?��
+ * Income figures
*------------------------------------------*/
int get_num(unsigned char *script,int *pos)
{
@@ -3072,7 +3073,7 @@ int get_num(unsigned char *script,int *pos)
}
/*==========================================
- * ?��X?��^?��b?��N?��?��?��?��l?��?��?��?��?��o?��?��
+ * Remove the value from the stack
*------------------------------------------*/
int pop_val(struct script_state* st)
{
@@ -3533,7 +3534,7 @@ void script_stop_sleeptimers(int id)
}
/*==========================================
- * ?��w?��?��m?��[?��h?��?��sleep_db?��?��?��?��?��
+ * Delete the specified node from sleep_db
*------------------------------------------*/
struct linkdb_node* script_erase_sleepdb(struct linkdb_node *n)
{
@@ -3549,11 +3550,11 @@ struct linkdb_node* script_erase_sleepdb(struct linkdb_node *n)
n->next->prev = n->prev;
retnode = n->next;
aFree( n );
- return retnode; // ?��?��?��̃m?��[?��h?��?��Ԃ�
+ return retnode; // The following; return retnode
}
/*==========================================
- * sleep?��p?��^?��C?��}?��[?��֐�
+ * Timer function for sleep
*------------------------------------------*/
int run_script_timer(int tid, unsigned int tick, int id, intptr_t data)
{
@@ -3657,7 +3658,7 @@ static void script_attach_state(struct script_state* st)
}
/*==========================================
- * ?��X?��N?��?��?��v?��g?��̎�?��s?��?��?��C?��?��?��?��?��?��
+ * The main part of the script execution
*------------------------------------------*/
void run_script_main(struct script_state *st)
{
@@ -3967,89 +3968,89 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle);
int queryThread_timer(int tid, unsigned int tick, int id, intptr_t data) {
int i, cursor = 0;
bool allOk = true;
-
+
EnterSpinLock(&queryThreadLock);
-
+
for( i = 0; i < queryThreadData.count; i++ ) {
struct queryThreadEntry *entry = queryThreadData.entry[i];
-
+
if( !entry->ok ) {
allOk = false;
continue;
}
run_script_main(entry->st);
-
+
entry->st = NULL;/* empty entries */
aFree(entry);
queryThreadData.entry[i] = NULL;
}
-
+
if( allOk ) {
/* cancel the repeating timer -- it'll re-create itself when necessary, dont need to remain looping */
delete_timer(queryThreadData.timer, queryThread_timer);
queryThreadData.timer = INVALID_TIMER;
}
-
+
/* now lets clear the mess. */
for( i = 0; i < queryThreadData.count; i++ ) {
struct queryThreadEntry *entry = queryThreadData.entry[i];
if( entry == NULL )
continue;/* entry on hold */
-
+
/* move */
memmove(&queryThreadData.entry[cursor], &queryThreadData.entry[i], sizeof(struct queryThreadEntry*));
-
+
cursor++;
}
-
+
queryThreadData.count = cursor;
-
+
LeaveSpinLock(&queryThreadLock);
-
+
return 0;
}
void queryThread_add(struct script_state *st, bool type) {
int idx = 0;
struct queryThreadEntry* entry = NULL;
-
+
EnterSpinLock(&queryThreadLock);
-
+
if( queryThreadData.count++ != 0 )
RECREATE(queryThreadData.entry, struct queryThreadEntry* , queryThreadData.count);
-
+
idx = queryThreadData.count-1;
-
+
CREATE(queryThreadData.entry[idx],struct queryThreadEntry,1);
-
+
entry = queryThreadData.entry[idx];
-
+
entry->st = st;
entry->ok = false;
entry->type = type;
if( queryThreadData.timer == INVALID_TIMER ) { /* start the receiver timer */
queryThreadData.timer = add_timer_interval(gettick() + 100, queryThread_timer, 0, 0, 100);
}
-
+
LeaveSpinLock(&queryThreadLock);
-
+
/* unlock the queryThread */
racond_signal(queryThreadCond);
}
/* adds a new log to the queue */
void queryThread_log(char * entry, int length) {
int idx = logThreadData.count;
-
+
EnterSpinLock(&queryThreadLock);
-
+
if( logThreadData.count++ != 0 )
- RECREATE(logThreadData.entry, char* , logThreadData.count);
-
+ RECREATE(logThreadData.entry, char* , logThreadData.count);
+
CREATE(logThreadData.entry[idx], char, length + 1 );
safestrncpy(logThreadData.entry[idx], entry, length + 1 );
-
+
LeaveSpinLock(&queryThreadLock);
/* unlock the queryThread */
@@ -4060,48 +4061,48 @@ void queryThread_log(char * entry, int length) {
static void *queryThread_main(void *x) {
Sql *queryThread_handle = Sql_Malloc();
int i;
-
+
if ( SQL_ERROR == Sql_Connect(queryThread_handle, map_server_id, map_server_pw, map_server_ip, map_server_port, map_server_db) )
exit(EXIT_FAILURE);
-
+
if( strlen(default_codepage) > 0 )
if ( SQL_ERROR == Sql_SetEncoding(queryThread_handle, default_codepage) )
Sql_ShowDebug(queryThread_handle);
if( log_config.sql_logs ) {
logmysql_handle = Sql_Malloc();
-
+
if ( SQL_ERROR == Sql_Connect(logmysql_handle, log_db_id, log_db_pw, log_db_ip, log_db_port, log_db_db) )
exit(EXIT_FAILURE);
-
+
if( strlen(default_codepage) > 0 )
if ( SQL_ERROR == Sql_SetEncoding(logmysql_handle, default_codepage) )
Sql_ShowDebug(logmysql_handle);
}
-
+
while( 1 ) {
-
+
if(queryThreadTerminate > 0)
break;
-
+
EnterSpinLock(&queryThreadLock);
-
+
/* mess with queryThreadData within the lock */
for( i = 0; i < queryThreadData.count; i++ ) {
struct queryThreadEntry *entry = queryThreadData.entry[i];
-
+
if( entry->ok )
continue;
else if ( !entry->st || !entry->st->stack ) {
entry->ok = true;/* dispose */
continue;
}
-
+
buildin_query_sql_sub(entry->st, entry->type ? logmysql_handle : queryThread_handle);
-
+
entry->ok = true;/* we're done with this */
}
-
+
/* also check for any logs in need to be sent */
if( log_config.sql_logs ) {
for( i = 0; i < logThreadData.count; i++ ) {
@@ -4111,26 +4112,26 @@ static void *queryThread_main(void *x) {
}
logThreadData.count = 0;
}
-
+
LeaveSpinLock(&queryThreadLock);
-
+
ramutex_lock( queryThreadMutex );
racond_wait( queryThreadCond, queryThreadMutex, -1 );
ramutex_unlock( queryThreadMutex );
}
-
+
Sql_Free(queryThread_handle);
-
+
if( log_config.sql_logs ) {
Sql_Free(logmysql_handle);
}
-
+
return NULL;
}
#endif
/*==========================================
- * ?��I?��?��
+ * Destructor
*------------------------------------------*/
int do_final_script() {
int i;
@@ -4212,7 +4213,7 @@ int do_final_script() {
for( i = 0; i < atcmd_binding_count; i++ ) {
aFree(atcmd_binding[i]);
}
-
+
if( atcmd_binding_count != 0 )
aFree(atcmd_binding);
#ifdef BETA_THREAD_TEST
@@ -4220,29 +4221,29 @@ int do_final_script() {
InterlockedIncrement(&queryThreadTerminate);
racond_signal(queryThreadCond);
rathread_wait(queryThread, NULL);
-
+
// Destroy cond var and mutex.
racond_destroy( queryThreadCond );
ramutex_destroy( queryThreadMutex );
-
+
/* Clear missing vars */
for( i = 0; i < queryThreadData.count; i++ ) {
aFree(queryThreadData.entry[i]);
}
-
+
aFree(queryThreadData.entry);
-
+
for( i = 0; i < logThreadData.count; i++ ) {
aFree(logThreadData.entry[i]);
}
-
- aFree(logThreadData.entry);
+
+ aFree(logThreadData.entry);
#endif
-
+
return 0;
}
/*==========================================
- * ?��?��?��?��
+ * Initialization
*------------------------------------------*/
int do_init_script() {
userfunc_db=strdb_alloc(DB_OPT_DUP_KEY,0);
@@ -4256,16 +4257,16 @@ int do_init_script() {
CREATE(logThreadData.entry, char *, 1);
logThreadData.count = 0;
/* QueryThread Start */
-
+
InitializeSpinLock(&queryThreadLock);
-
+
queryThreadData.timer = INVALID_TIMER;
queryThreadTerminate = 0;
queryThreadMutex = ramutex_create();
queryThreadCond = racond_create();
-
+
queryThread = rathread_create(queryThread_main, NULL);
-
+
if(queryThread == NULL){
ShowFatalError("do_init_script: cannot spawn Query Thread.\n");
exit(EXIT_FAILURE);
@@ -4282,21 +4283,21 @@ int script_reload() {
#ifdef BETA_THREAD_TEST
/* we're reloading so any queries undergoing should be...exterminated. */
EnterSpinLock(&queryThreadLock);
-
+
for( i = 0; i < queryThreadData.count; i++ ) {
aFree(queryThreadData.entry[i]);
}
queryThreadData.count = 0;
-
+
if( queryThreadData.timer != INVALID_TIMER ) {
delete_timer(queryThreadData.timer, queryThread_timer);
queryThreadData.timer = INVALID_TIMER;
}
-
+
LeaveSpinLock(&queryThreadLock);
#endif
-
+
userfunc_db->clear(userfunc_db, db_script_free_code_sub);
db_clear(scriptlabel_db);
@@ -4305,10 +4306,10 @@ int script_reload() {
for( i = 0; i < atcmd_binding_count; i++ ) {
aFree(atcmd_binding[i]);
}
-
+
if( atcmd_binding_count != 0 )
aFree(atcmd_binding);
-
+
atcmd_binding_count = 0;
if(sleep_db) {
@@ -4518,7 +4519,7 @@ BUILDIN_FUNC(menu)
}
st->state = RERUNLINE;
sd->state.menu_or_input = 1;
-
+
/**
* menus beyond this length crash the client (see bugreport:6402)
**/
@@ -4532,7 +4533,7 @@ BUILDIN_FUNC(menu)
aFree(menu);
} else
clif_scriptmenu(sd, st->oid, StringBuf_Value(&buf));
-
+
StringBuf_Destroy(&buf);
if( sd->npc_menu >= 0xff )
@@ -4609,7 +4610,7 @@ BUILDIN_FUNC(select)
sd->npc_menu = 0;
for( i = 2; i <= script_lastdata(st); ++i ) {
text = script_getstr(st, i);
-
+
if( sd->npc_menu > 0 )
StringBuf_AppendStr(&buf, ":");
@@ -4619,7 +4620,7 @@ BUILDIN_FUNC(select)
st->state = RERUNLINE;
sd->state.menu_or_input = 1;
-
+
/**
* menus beyond this length crash the client (see bugreport:6402)
**/
@@ -4660,7 +4661,7 @@ BUILDIN_FUNC(select)
}
/// Displays a menu with options and returns the selected option.
-/// Behaves like 'menu' without the target labels, except when cancel is
+/// Behaves like 'menu' without the target labels, except when cancel is
/// pressed.
/// When cancel is pressed, the script continues and 255 is returned.
///
@@ -4694,7 +4695,7 @@ BUILDIN_FUNC(prompt)
st->state = RERUNLINE;
sd->state.menu_or_input = 1;
-
+
/**
* menus beyond this length crash the client (see bugreport:6402)
**/
@@ -4965,7 +4966,7 @@ BUILDIN_FUNC(rand)
}
/*==========================================
- *
+ * Warp sd to str,x,y or Random or SavePoint/Save
*------------------------------------------*/
BUILDIN_FUNC(warp)
{
@@ -4997,35 +4998,35 @@ BUILDIN_FUNC(warp)
return 0;
}
/*==========================================
- * ?��G?��?��?��A?��w?��胏�[?��v
+ * Warp a specified area
*------------------------------------------*/
static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
{
int x2,y2,x3,y3;
unsigned int index;
-
+
index = va_arg(ap,unsigned int);
x2 = va_arg(ap,int);
y2 = va_arg(ap,int);
x3 = va_arg(ap,int);
y3 = va_arg(ap,int);
-
+
if(index == 0)
pc_randomwarp((TBL_PC *)bl,CLR_TELEPORT);
else if(x3 && y3) {
int max, tx, ty, j = 0;
-
+
// choose a suitable max number of attempts
if( (max = (y3-y2+1)*(x3-x2+1)*3) > 1000 )
max = 1000;
-
+
// find a suitable map cell
do {
tx = rnd()%(x3-x2+1)+x2;
ty = rnd()%(y3-y2+1)+y2;
j++;
} while( map_getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
-
+
pc_setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
}
else
@@ -5047,7 +5048,7 @@ BUILDIN_FUNC(areawarp)
str = script_getstr(st,7);
x2 = script_getnum(st,8);
y2 = script_getnum(st,9);
-
+
if( script_hasdata(st,10) && script_hasdata(st,11) ) { // Warp area to area
if( (x3 = script_getnum(st,10)) < 0 || (y3 = script_getnum(st,11)) < 0 ){
x3 = 0;
@@ -5105,7 +5106,7 @@ BUILDIN_FUNC(areapercentheal)
/*==========================================
* warpchar [LuzZza]
- * Useful for warp one player from
+ * Useful for warp one player from
* another player npc-session.
* Using: warpchar "mapname",x,y,Char_ID;
*------------------------------------------*/
@@ -5114,7 +5115,7 @@ BUILDIN_FUNC(warpchar)
int x,y,a;
const char *str;
TBL_PC *sd;
-
+
str=script_getstr(st,2);
x=script_getnum(st,3);
y=script_getnum(st,4);
@@ -5131,9 +5132,9 @@ BUILDIN_FUNC(warpchar)
pc_setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
else
pc_setpos(sd, mapindex_name2id(str), x, y, CLR_TELEPORT);
-
+
return 0;
-}
+}
/*==========================================
* Warpparty - [Fredzilla] [Paradox924X]
* Syntax: warpparty "to_mapname",x,y,Party_ID,{"from_mapname"};
@@ -5159,7 +5160,7 @@ BUILDIN_FUNC(warpparty)
p = party_search(p_id);
if(!p)
return 0;
-
+
type = ( strcmp(str,"Random")==0 ) ? 0
: ( strcmp(str,"SavePointAll")==0 ) ? 1
: ( strcmp(str,"SavePoint")==0 ) ? 2
@@ -5216,7 +5217,7 @@ BUILDIN_FUNC(warpparty)
break;
case 3: // Leader
case 4: // m,x,y
- if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
+ if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
pc_setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
break;
}
@@ -5244,7 +5245,7 @@ BUILDIN_FUNC(warpguild)
g = guild_search(gid);
if( g == NULL )
return 0;
-
+
type = ( strcmp(str,"Random")==0 ) ? 0
: ( strcmp(str,"SavePointAll")==0 ) ? 1
: ( strcmp(str,"SavePoint")==0 ) ? 2
@@ -5286,23 +5287,23 @@ BUILDIN_FUNC(warpguild)
return 0;
}
/*==========================================
- *
+ * Force Heal a player (hp and sp)
*------------------------------------------*/
BUILDIN_FUNC(heal)
{
TBL_PC *sd;
int hp,sp;
-
+
sd = script_rid2sd(st);
if (!sd) return 0;
-
+
hp=script_getnum(st,2);
sp=script_getnum(st,3);
status_heal(&sd->bl, hp, sp, 1);
return 0;
}
/*==========================================
- *
+ * Heal a player by item (get vit bonus etc)
*------------------------------------------*/
BUILDIN_FUNC(itemheal)
{
@@ -5317,7 +5318,7 @@ BUILDIN_FUNC(itemheal)
potion_sp = sp;
return 0;
}
-
+
sd = script_rid2sd(st);
if (!sd) return 0;
pc_itemheal(sd,sd->itemid,hp,sp);
@@ -5365,7 +5366,7 @@ BUILDIN_FUNC(jobchange)
if (pcdb_checkid(job))
{
TBL_PC* sd;
-
+
sd = script_rid2sd(st);
if( sd == NULL )
return 0;
@@ -5387,9 +5388,9 @@ BUILDIN_FUNC(jobname)
}
/// Get input from the player.
-/// For numeric inputs the value is capped to the range [min,max]. Returns 1 if
+/// For numeric inputs the value is capped to the range [min,max]. Returns 1 if
/// the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
-/// For string inputs it returns 1 if the string was longer than 'max', -1 is
+/// For string inputs it returns 1 if the string was longer than 'max', -1 is
/// shorter than 'min' and 0 otherwise.
///
/// input(<var>{,<min>{,<max>}}) -> <int>
@@ -5867,7 +5868,7 @@ BUILDIN_FUNC(deletearray)
for( ; start < end; ++start )
set_reg(st, sd, reference_uid(id, start), name, (void *)"", reference_getref(data));
}
- else
+ else
{
for( ; start < end; ++start )
set_reg(st, sd, reference_uid(id, start), name, (void*)0, reference_getref(data));
@@ -5990,7 +5991,7 @@ BUILDIN_FUNC(viewpoint)
y=script_getnum(st,4);
id=script_getnum(st,5);
color=script_getnum(st,6);
-
+
sd = script_rid2sd(st);
if( sd == NULL )
return 0;
@@ -6056,7 +6057,7 @@ BUILDIN_FUNC(countitem2)
int i;
struct item_data* id = NULL;
struct script_data* data;
-
+
TBL_PC* sd = script_rid2sd(st);
if (!sd) {
script_pushint(st,0);
@@ -6106,7 +6107,11 @@ BUILDIN_FUNC(countitem2)
}
/*==========================================
- * ?��d?��ʃ`?��F?��b?��N
+ * Check if item with this amount can fit in inventory
+ * Checking : weight, stack amount >32k, slots amount >(MAX_INVENTORY)
+ * Return
+ * 0 : fail
+ * 1 : success (npc side only)
*------------------------------------------*/
BUILDIN_FUNC(checkweight)
{
@@ -6314,7 +6319,7 @@ BUILDIN_FUNC(getitem2)
c3=(short)script_getnum(st,9);
c4=(short)script_getnum(st,10);
- if(nameid<0) { // ?��?��?��?��?��_?��?��
+ if(nameid<0) { // Invalide nameid
nameid = -nameid;
flag = 1;
}
@@ -6427,7 +6432,7 @@ BUILDIN_FUNC(rentitem)
clif_additem(sd, 0, 0, flag);
return 1;
}
-
+
return 0;
}
@@ -6448,9 +6453,9 @@ BUILDIN_FUNC(getnameditem)
if (sd == NULL)
{ //Player not attached!
script_pushint(st,0);
- return 0;
+ return 0;
}
-
+
data=script_getdata(st,2);
get_val(st,data);
if( data_isstring(data) ){
@@ -6477,7 +6482,7 @@ BUILDIN_FUNC(getnameditem)
tsd=map_nick2sd(conv_str(st,data));
else //Char Id was given
tsd=map_charid2sd(conv_num(st,data));
-
+
if( tsd == NULL )
{ //Failed
script_pushint(st,0);
@@ -6550,7 +6555,7 @@ BUILDIN_FUNC(makeitem)
} else
m=map_mapname2mapid(mapname);
- if(nameid<0) { // ?��?��?��?��?��_?��?��
+ if(nameid<0) {
nameid = -nameid;
flag = 1;
}
@@ -6879,7 +6884,8 @@ BUILDIN_FUNC(disableitemuse)
}
/*==========================================
- *?��L?��?��?��?��?��֌W?��̃p?��?��?��?��?��[?��^?��擾
+ * return the basic stats of sd
+ * chk pc_readparam for available type
*------------------------------------------*/
BUILDIN_FUNC(readparam)
{
@@ -6901,8 +6907,15 @@ BUILDIN_FUNC(readparam)
return 0;
}
+
/*==========================================
- *?��L?��?��?��?��?��֌W?��?��ID?��擾
+ * Return charid identification
+ * return by @num :
+ * 0 : char_id
+ * 1 : party_id
+ * 2 : guild_id
+ * 3 : account_id
+ * 4 : bg_id
*------------------------------------------*/
BUILDIN_FUNC(getcharid)
{
@@ -6931,7 +6944,7 @@ BUILDIN_FUNC(getcharid)
script_pushint(st,0);
break;
}
-
+
return 0;
}
/*==========================================
@@ -6964,8 +6977,10 @@ BUILDIN_FUNC(getnpcid)
return 0;
}
+
/*==========================================
- *?��w?��?��ID?��?��PT?��?��?��擾
+ * Return the name of the party_id
+ * null if not found
*------------------------------------------*/
BUILDIN_FUNC(getpartyname)
{
@@ -6984,8 +6999,14 @@ BUILDIN_FUNC(getpartyname)
}
return 0;
}
+
/*==========================================
- *?��w?��?��ID?��?��PT?��l?��?��?���??��?��?��?��o?��[ID?��擾
+ * Get the information of the members of a party by type
+ * @party_id, @type
+ * return by @type :
+ * - : nom des membres
+ * 1 : char_id des membres
+ * 2 : account_id des membres
*------------------------------------------*/
BUILDIN_FUNC(getpartymember)
{
@@ -6996,7 +7017,7 @@ BUILDIN_FUNC(getpartymember)
if( script_hasdata(st,3) )
type=script_getnum(st,3);
-
+
if(p!=NULL){
for(i=0;i<MAX_PARTY;i++){
if(p->party.member[i].account_id){
@@ -7020,7 +7041,7 @@ BUILDIN_FUNC(getpartymember)
}
/*==========================================
- * Retrieves party leader. if flag is specified,
+ * Retrieves party leader. if flag is specified,
* return some of the leader data. Otherwise, return name.
*------------------------------------------*/
BUILDIN_FUNC(getpartyleader)
@@ -7057,7 +7078,8 @@ BUILDIN_FUNC(getpartyleader)
}
/*==========================================
- *?��w?��?��ID?��̃M?��?��?��h?��?��?��擾
+ * Return the name of the @guild_id
+ * null if not found
*------------------------------------------*/
BUILDIN_FUNC(getguildname)
{
@@ -7078,7 +7100,8 @@ BUILDIN_FUNC(getguildname)
}
/*==========================================
- *?��w?��?��ID?��?��GuildMaster?��?��?��擾
+ * Return the name of the guild master of @guild_id
+ * null if not found
*------------------------------------------*/
BUILDIN_FUNC(getguildmaster)
{
@@ -7117,7 +7140,13 @@ BUILDIN_FUNC(getguildmasterid)
}
/*==========================================
- * ?��L?��?��?��?��?��N?��^?��̖�?��O
+ * Get char string information by type :
+ * Return by @type :
+ * 0 : char_name
+ * 1 : party_name or ""
+ * 2 : guild_name or ""
+ * 3 : map_name
+ * - : ""
*------------------------------------------*/
BUILDIN_FUNC(strcharinfo)
{
@@ -7169,7 +7198,13 @@ BUILDIN_FUNC(strcharinfo)
}
/*==========================================
- * ?��Ăяo?��?��?��?��?��?��NPC?��?��?��?��?��擾?��?��?��?��
+ * Get npc string information by type
+ * return by @type:
+ * 0 : name
+ * 1 : str#
+ * 2 : #str
+ * 3 : ::str
+ * 4 : map name
*------------------------------------------*/
BUILDIN_FUNC(strnpcinfo)
{
@@ -7247,7 +7282,7 @@ BUILDIN_FUNC(getequipid)
script_pushint(st,-1);
return 0;
}
-
+
item = sd->inventory_data[i];
if( item != 0 )
script_pushint(st,item->nameid);
@@ -7258,7 +7293,8 @@ BUILDIN_FUNC(getequipid)
}
/*==========================================
- * ?��?��?��?��?��?��?��?��?��?��?��?��i?��?��?��B?��?��?��j?��?��?��[?��p?��j
+ * Get the equipement name at pos
+ * return item jname or ""
*------------------------------------------*/
BUILDIN_FUNC(getequipname)
{
@@ -7384,7 +7420,7 @@ BUILDIN_FUNC(repairall)
}
/*==========================================
- * ?��?��?��?��?��`?��F?��b?��N
+ * Chk if player have something equiped at pos
*------------------------------------------*/
BUILDIN_FUNC(getequipisequiped)
{
@@ -7407,7 +7443,11 @@ BUILDIN_FUNC(getequipisequiped)
}
/*==========================================
- * ?��?��?��?��?��i?��?��?��B?��”\?��`?��F?��b?��N
+ * Chk if the player have something equiped at pos
+ * if so chk if this item ain't marked not refinable or rental
+ * return (npc)
+ * 1 : true
+ * 0 : false
*------------------------------------------*/
BUILDIN_FUNC(getequipisenableref)
{
@@ -7430,7 +7470,10 @@ BUILDIN_FUNC(getequipisenableref)
}
/*==========================================
- * ?��?��?��?��?��i?��Ӓ�`?��F?��b?��N
+ * Chk if the item equiped at pos is identify (huh ?)
+ * return (npc)
+ * 1 : true
+ * 0 : false
*------------------------------------------*/
BUILDIN_FUNC(getequipisidentify)
{
@@ -7453,7 +7496,10 @@ BUILDIN_FUNC(getequipisidentify)
}
/*==========================================
- * ?��?��?��?��?��i?��?��?��B?��x
+ * Get the item refined value at pos
+ * return (npc)
+ * x : refine amount
+ * 0 : false (not refined)
*------------------------------------------*/
BUILDIN_FUNC(getequiprefinerycnt)
{
@@ -7476,7 +7522,11 @@ BUILDIN_FUNC(getequiprefinerycnt)
}
/*==========================================
- * ?��?��?��?��?��i?��?��?��?��LV
+ * Get the weapon level value at pos
+ * (pos should normally only be EQI_HAND_L or EQI_HAND_R)
+ * return (npc)
+ * x : weapon level
+ * 0 : false
*------------------------------------------*/
BUILDIN_FUNC(getequipweaponlv)
{
@@ -7499,7 +7549,10 @@ BUILDIN_FUNC(getequipweaponlv)
}
/*==========================================
- * ?��?��?��?��?��i?��?��?��B?��?��?��?��?��?��
+ * Get the item refine chance (from refine.txt) for item at pos
+ * return (npc)
+ * x : refine chance
+ * 0 : false (max refine level or unequip..)
*------------------------------------------*/
BUILDIN_FUNC(getequippercentrefinery)
{
@@ -7522,7 +7575,7 @@ BUILDIN_FUNC(getequippercentrefinery)
}
/*==========================================
- * ?��?��?��B?��?��?��?��
+ * Refine +1 item at pos and log and display refine
*------------------------------------------*/
BUILDIN_FUNC(successrefitem)
{
@@ -7576,7 +7629,7 @@ BUILDIN_FUNC(successrefitem)
}
/*==========================================
- * ?��?��?��B?��?��?��s
+ * Show a failed Refine +1 attempt
*------------------------------------------*/
BUILDIN_FUNC(failedrefitem)
{
@@ -7592,13 +7645,12 @@ BUILDIN_FUNC(failedrefitem)
i=pc_checkequip(sd,equip[num-1]);
if(i >= 0) {
sd->status.inventory[i].refine = 0;
- pc_unequipitem(sd,i,3);
- // ?��?��?��B?��?��?��s?��G?��t?��F?��N?��g?��̃p?��P?��b?��g
- clif_refine(sd->fd,1,i,sd->status.inventory[i].refine);
+ pc_unequipitem(sd,i,3); //recalculate bonus
+ clif_refine(sd->fd,1,i,sd->status.inventory[i].refine); //notify client of failure
pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
- // ?��?��?��̐l?��ɂ�?��?��?��s?��?��ʒm
- clif_misceffect(&sd->bl,2);
+
+ clif_misceffect(&sd->bl,2); // display failure effect
}
return 0;
@@ -7998,7 +8050,7 @@ BUILDIN_FUNC(getgdskilllv)
}
/// Returns the 'basic_skill_check' setting.
-/// This config determines if the server checks the skill level of NV_BASIC
+/// This config determines if the server checks the skill level of NV_BASIC
/// before allowing the basic actions.
///
/// basicskillcheck() -> <bool>
@@ -8380,7 +8432,7 @@ BUILDIN_FUNC(gettimetick) /* Asgard Version */
type=script_getnum(st,2);
switch(type){
- case 2:
+ case 2:
//type 2:(Get the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC
// from the system clock.)
script_pushint(st,(int)time(NULL));
@@ -8471,7 +8523,7 @@ BUILDIN_FUNC(gettimestr)
}
/*==========================================
- * ?��J?��v?��?��?��q?��ɂ�?��J?��?��
+ * Open player storage
*------------------------------------------*/
BUILDIN_FUNC(openstorage)
{
@@ -8500,7 +8552,7 @@ BUILDIN_FUNC(guildopenstorage)
}
/*==========================================
- * ?��A?��C?��e?��?��?��ɂ�?��X?��L?��?��?��?��?��?��
+ * Make player use a skill trought item usage
*------------------------------------------*/
/// itemskill <skill id>,<level>
/// itemskill "<skill name>",<level>
@@ -8523,7 +8575,7 @@ BUILDIN_FUNC(itemskill)
return 0;
}
/*==========================================
- * ?��A?��C?��e?��?��?��?��
+ * Attempt to create an item
*------------------------------------------*/
BUILDIN_FUNC(produce)
{
@@ -8555,7 +8607,7 @@ BUILDIN_FUNC(cooking)
return 0;
}
/*==========================================
- * NPC?��Ńy?��b?��g?��?��?��
+ * Create a pet
*------------------------------------------*/
BUILDIN_FUNC(makepet)
{
@@ -8583,7 +8635,7 @@ BUILDIN_FUNC(makepet)
return 0;
}
/*==========================================
- * NPC?��Ōo?��?��?��l?��グ?��?��
+ * Give player exp base,job * quest_exp_rate/100
*------------------------------------------*/
BUILDIN_FUNC(getexp)
{
@@ -8653,7 +8705,12 @@ BUILDIN_FUNC(guildchangegm)
}
/*==========================================
- * ?��?��?��?��?��X?��^?��[?��?��?��?��
+ * Spawn a monster :
+ @mapn,x,y : location
+ @str : monster name
+ @class_ : mob_id
+ @amount : nb to spawn
+ @event : event to attach to mob
*------------------------------------------*/
BUILDIN_FUNC(monster)
{
@@ -8675,7 +8732,7 @@ BUILDIN_FUNC(monster)
event = script_getstr(st, 8);
check_event(st, event);
}
-
+
if (script_hasdata(st, 9))
{
size = script_getnum(st, 9);
@@ -8685,7 +8742,7 @@ BUILDIN_FUNC(monster)
return 1;
}
}
-
+
if (script_hasdata(st, 10))
{
ai = script_getnum(st, 10);
@@ -8758,7 +8815,7 @@ BUILDIN_FUNC(getmobdrops)
return 0;
}
/*==========================================
- * ?��?��?��?��?��X?��^?��[?��?��?��?��
+ * Same as monster but randomize location in x0,x1,y0,y1 area
*------------------------------------------*/
BUILDIN_FUNC(areamonster)
{
@@ -8782,7 +8839,7 @@ BUILDIN_FUNC(areamonster)
event = script_getstr(st, 10);
check_event(st, event);
}
-
+
if (script_hasdata(st, 11))
{
size = script_getnum(st, 11);
@@ -8792,7 +8849,7 @@ BUILDIN_FUNC(areamonster)
return 1;
}
}
-
+
if (script_hasdata(st, 12))
{
ai = script_getnum(st, 12);
@@ -8819,12 +8876,12 @@ BUILDIN_FUNC(areamonster)
}
}
}
-
+
mob_once_spawn_area(sd, m, x0, y0, x1, y1, str, class_, amount, event, size, ai);
return 0;
}
/*==========================================
- * ?��?��?��?��?��X?��^?��[?��?��
+ * KillMonster subcheck, verify if mob to kill ain't got an even to handle, could be force kill by allflag
*------------------------------------------*/
static int buildin_killmonster_sub_strip(struct block_list *bl,va_list ap)
{ //same fix but with killmonster instead - stripping events from mobs.
@@ -8833,7 +8890,7 @@ BUILDIN_FUNC(areamonster)
int allflag=va_arg(ap,int);
md->state.npc_killmonster = 1;
-
+
if(!allflag){
if(strcmp(event,md->npc_event)==0)
status_kill(bl);
@@ -8872,7 +8929,7 @@ BUILDIN_FUNC(killmonster)
if( (m=map_mapname2mapid(mapname))<0 )
return 0;
-
+
if( map[m].flag.src4instance && st->instance_id && (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
return 0;
@@ -8882,7 +8939,7 @@ BUILDIN_FUNC(killmonster)
return 0;
}
}
-
+
map_freeblock_lock();
map_foreachinmap(buildin_killmonster_sub_strip, m, BL_MOB, event ,allflag);
map_freeblock_unlock();
@@ -8892,11 +8949,11 @@ BUILDIN_FUNC(killmonster)
static int buildin_killmonsterall_sub_strip(struct block_list *bl,va_list ap)
{ //Strips the event from the mob if it's killed the old method.
struct mob_data *md;
-
+
md = BL_CAST(BL_MOB, bl);
if (md->npc_event[0])
md->npc_event[0] = 0;
-
+
status_kill(bl);
return 0;
}
@@ -8910,7 +8967,7 @@ BUILDIN_FUNC(killmonsterall)
const char *mapname;
int m;
mapname=script_getstr(st,2);
-
+
if( (m = map_mapname2mapid(mapname))<0 )
return 0;
@@ -8923,7 +8980,7 @@ BUILDIN_FUNC(killmonsterall)
return 0;
}
}
-
+
map_foreachinmap(buildin_killmonsterall_sub_strip,m,BL_MOB);
return 0;
}
@@ -8953,7 +9010,7 @@ BUILDIN_FUNC(clone)
if( script_hasdata(st,9) )
flag=script_getnum(st,9);
-
+
if( script_hasdata(st,10) )
duration=script_getnum(st,10);
@@ -8979,7 +9036,7 @@ BUILDIN_FUNC(clone)
return 0;
}
/*==========================================
- * ?��C?��x?��?��?��g?��?��?��s
+ * Cxgs
*------------------------------------------*/
BUILDIN_FUNC(doevent)
{
@@ -8996,7 +9053,7 @@ BUILDIN_FUNC(doevent)
return 0;
}
/*==========================================
- * NPC?��?��̃C?��x?��?��?��g?��?��?��s
+ * NPC̃Cxgs
*------------------------------------------*/
BUILDIN_FUNC(donpcevent)
{
@@ -9025,7 +9082,7 @@ BUILDIN_FUNC(cmdothernpc) // Added by RoVeRT
}
/*==========================================
- * ?��C?��x?��?��?��g?��^?��C?��}?��[?��lj�
+ * Cxg^C}[lj
*------------------------------------------*/
BUILDIN_FUNC(addtimer)
{
@@ -9042,7 +9099,7 @@ BUILDIN_FUNC(addtimer)
return 0;
}
/*==========================================
- * ?��C?��x?��?��?��g?��^?��C?��}?��[?��?��
+ * Cxg^C}[폜
*------------------------------------------*/
BUILDIN_FUNC(deltimer)
{
@@ -9059,7 +9116,7 @@ BUILDIN_FUNC(deltimer)
return 0;
}
/*==========================================
- * ?��C?��x?��?��?��g?��^?��C?��}?��[?��̃J?��E?��?��?��g?��l?��lj�
+ * Cxg^C}[̃JEgllj
*------------------------------------------*/
BUILDIN_FUNC(addtimercount)
{
@@ -9079,7 +9136,7 @@ BUILDIN_FUNC(addtimercount)
}
/*==========================================
- * NPC?��^?��C?��}?��[?��?��?��?��
+ * NPC^C}[
*------------------------------------------*/
BUILDIN_FUNC(initnpctimer)
{
@@ -9128,7 +9185,7 @@ BUILDIN_FUNC(initnpctimer)
return 0;
}
/*==========================================
- * NPC?��^?��C?��}?��[?��J?��n
+ * NPC^C}[Jn
*------------------------------------------*/
BUILDIN_FUNC(startnpctimer)
{
@@ -9175,7 +9232,7 @@ BUILDIN_FUNC(startnpctimer)
return 0;
}
/*==========================================
- * NPC?��^?��C?��}?��[?��?��~
+ * NPC^C}[~
*------------------------------------------*/
BUILDIN_FUNC(stopnpctimer)
{
@@ -9217,7 +9274,7 @@ BUILDIN_FUNC(stopnpctimer)
return 0;
}
/*==========================================
- * NPC?��^?��C?��}?��[?��?��?����
+ * NPC^C}[񏊓
*------------------------------------------*/
BUILDIN_FUNC(getnpctimer)
{
@@ -9230,7 +9287,7 @@ BUILDIN_FUNC(getnpctimer)
nd = npc_name2id(script_getstr(st,3));
else
nd = (struct npc_data *)map_id2bl(st->oid);
-
+
if( !nd || nd->bl.type != BL_NPC )
{
script_pushint(st,0);
@@ -9262,7 +9319,7 @@ BUILDIN_FUNC(getnpctimer)
return 0;
}
/*==========================================
- * NPC?��^?��C?��}?��[?��l?��ݒ�
+ * NPC^C}[lݒ
*------------------------------------------*/
BUILDIN_FUNC(setnpctimer)
{
@@ -9358,7 +9415,7 @@ BUILDIN_FUNC(playerattached)
}
/*==========================================
- * ?��V?��̐�?��A?��i?��E?��?��?��X
+ * V̐AiEX
*------------------------------------------*/
BUILDIN_FUNC(announce)
{
@@ -9369,14 +9426,14 @@ BUILDIN_FUNC(announce)
int fontSize = script_hasdata(st,6) ? script_getnum(st,6) : 12; // default fontSize
int fontAlign = script_hasdata(st,7) ? script_getnum(st,7) : 0; // default fontAlign
int fontY = script_hasdata(st,8) ? script_getnum(st,8) : 0; // default fontY
-
+
if (flag&0x0f) // Broadcast source or broadcast region defined
{
send_target target;
struct block_list *bl = (flag&0x08) ? map_id2bl(st->oid) : (struct block_list *)script_rid2sd(st); // If bc_npc flag is set, use NPC as broadcast source
if (bl == NULL)
return 0;
-
+
flag &= 0x07;
target = (flag == 1) ? ALL_SAMEMAP :
(flag == 2) ? AREA :
@@ -9397,7 +9454,7 @@ BUILDIN_FUNC(announce)
return 0;
}
/*==========================================
- * ?��V?��̐�?��A?��i?��E?��?��?��X?��i?��?��?��?��}?��b?��v?��j
+ * V̐AiEXi}bvj
*------------------------------------------*/
static int buildin_announce_sub(struct block_list *bl, va_list ap)
{
@@ -9436,7 +9493,7 @@ BUILDIN_FUNC(mapannounce)
return 0;
}
/*==========================================
- * ?��V?��̐�?��A?��i?��E?��?��?��X?��i?��?��?��?��G?��?��?��A?��j
+ * V̐AiEXiGAj
*------------------------------------------*/
BUILDIN_FUNC(areaannounce)
{
@@ -9463,7 +9520,7 @@ BUILDIN_FUNC(areaannounce)
}
/*==========================================
- * ?��?��?��[?��U?��[?��?��?��?��?��?��
+ * [U[
*------------------------------------------*/
BUILDIN_FUNC(getusers)
{
@@ -9526,7 +9583,7 @@ BUILDIN_FUNC(getusersname)
clif_scriptmes(sd,st->oid,pl_sd->status.name);
}
mapit_free(iter);
-
+
return 0;
}
/*==========================================
@@ -9558,7 +9615,7 @@ BUILDIN_FUNC(getmapguildusers)
return 0;
}
/*==========================================
- * ?��}?��b?��v?��w?���??��[?��U?��[?��?��?��?��?��?��
+ * }bvw胆[U[
*------------------------------------------*/
BUILDIN_FUNC(getmapusers)
{
@@ -9573,7 +9630,7 @@ BUILDIN_FUNC(getmapusers)
return 0;
}
/*==========================================
- * ?��G?��?��?��A?��w?���??��[?��U?��[?��?��?��?��?��?��
+ * GAw胆[U[
*------------------------------------------*/
static int buildin_getareausers_sub(struct block_list *bl,va_list ap)
{
@@ -9601,7 +9658,7 @@ BUILDIN_FUNC(getareausers)
}
/*==========================================
- * ?��G?��?��?��A?��w?��?��h?��?��?��b?��v?��A?��C?��e?��?��?��?��?��?��?��?��
+ * GAwhbvACe
*------------------------------------------*/
static int buildin_getareadropitem_sub(struct block_list *bl,va_list ap)
{
@@ -9647,7 +9704,7 @@ BUILDIN_FUNC(getareadropitem)
return 0;
}
/*==========================================
- * NPC?��̗L?��?��
+ * NPC̗L
*------------------------------------------*/
BUILDIN_FUNC(enablenpc)
{
@@ -9657,7 +9714,7 @@ BUILDIN_FUNC(enablenpc)
return 0;
}
/*==========================================
- * NPC?��̖�?��?��
+ * NPC̖
*------------------------------------------*/
BUILDIN_FUNC(disablenpc)
{
@@ -9668,7 +9725,7 @@ BUILDIN_FUNC(disablenpc)
}
/*==========================================
- * ?��B?��?��Ă�?��?��NPC?��̕\?��?��
+ * BĂNPC̕\
*------------------------------------------*/
BUILDIN_FUNC(hideoffnpc)
{
@@ -9678,7 +9735,7 @@ BUILDIN_FUNC(hideoffnpc)
return 0;
}
/*==========================================
- * NPC?��?��?��n?��C?��f?��B?��?��?��O
+ * NPCnCfBO
*------------------------------------------*/
BUILDIN_FUNC(hideonnpc)
{
@@ -9818,7 +9875,7 @@ BUILDIN_FUNC(sc_end)
bl = map_id2bl(script_getnum(st,3));
else
bl = map_id2bl(st->rid);
-
+
if( potion_flag==1 && potion_target )
{//##TODO how does this work [FlavioJS]
bl = map_id2bl(potion_target);
@@ -9840,7 +9897,7 @@ BUILDIN_FUNC(sc_end)
}
/*==========================================
- * ?��?��Ԉُ�ϐ�?��?��?��v?��Z?��?��?��?��?��m?��?��?��?��Ԃ�
+ * @FIXME atm will return reduced tick, 0 immune, 1 no tick
*------------------------------------------*/
BUILDIN_FUNC(getscrate)
{
@@ -9849,7 +9906,7 @@ BUILDIN_FUNC(getscrate)
type=script_getnum(st,2);
rate=script_getnum(st,3);
- if( script_hasdata(st,4) ) //?��w?��肵?��?��?��L?��?��?��?��?��̑ϐ�?��?��?��v?��Z?��?��?��?��
+ if( script_hasdata(st,4) ) //get for the bl assigned
bl = map_id2bl(script_getnum(st,4));
else
bl = map_id2bl(st->rid);
@@ -9888,7 +9945,7 @@ BUILDIN_FUNC(getstatus)
script_pushint(st, 0);
return 0;
}
-
+
switch( type )
{
case 1: script_pushint(st, sd->sc.data[id]->val1); break;
@@ -9923,7 +9980,7 @@ BUILDIN_FUNC(debugmes)
}
/*==========================================
- *?��ߊl?��A?��C?��e?��?��?��g?��p
+ *ߊlACegp
*------------------------------------------*/
BUILDIN_FUNC(catchpet)
{
@@ -9981,7 +10038,7 @@ BUILDIN_FUNC(homunculus_mutate)
if(merc_is_hom_active(sd->hd)) {
m_class = hom_class2mapid(sd->hd->homunculus.class_);
m_id = hom_class2mapid(homun_id);
-
+
if ( m_class != -1 && m_id != -1 && m_class&HOM_EVO && m_id&HOM_S && sd->hd->homunculus.level >= 99 )
hom_mutate(sd->hd, homun_id);
else
@@ -10077,7 +10134,7 @@ BUILDIN_FUNC(resetlvl)
return 0;
}
/*==========================================
- * ?��X?��e?��[?��^?��X?��?��?��Z?��b?��g
+ * Xe[^XZbg
*------------------------------------------*/
BUILDIN_FUNC(resetstatus)
{
@@ -10130,7 +10187,7 @@ BUILDIN_FUNC(changebase)
{
if (!battle_config.wedding_modifydisplay || //Do not show the wedding sprites
sd->class_&JOBL_BABY //Baby classes screw up when showing wedding sprites. [Skotlex] They don't seem to anymore.
- )
+ )
return 0;
}
@@ -10148,7 +10205,7 @@ BUILDIN_FUNC(changebase)
}
/*==========================================
- * ?��?��?��ʕϊ�
+ * Unequip all item and request for a changesex to char-serv
*------------------------------------------*/
BUILDIN_FUNC(changesex)
{
@@ -10173,16 +10230,16 @@ BUILDIN_FUNC(globalmes)
struct npc_data *nd = (struct npc_data *)bl;
const char *name=NULL,*mes;
- mes=script_getstr(st,2); // ?��?��?��b?��Z?��[?��W?��̎擾
+ mes=script_getstr(st,2);
if(mes==NULL) return 0;
-
- if(script_hasdata(st,3)){ // NPC?��?��?��̎擾(123#456)
+
+ if(script_hasdata(st,3)){ // npc name to display
name=script_getstr(st,3);
} else {
- name=nd->name;
+ name=nd->name; //use current npc name
}
- npc_globalmessage(name,mes); // ?��O?��?��?��[?��o?��?��?��?��?��b?��Z?��[?��W?��?��?��M
+ npc_globalmessage(name,mes); // broadcast to all players connected
return 0;
}
@@ -10417,7 +10474,7 @@ static void script_detach_rid(struct script_state* st)
}
/*==========================================
- * RID?��̃A?��^?��b?��`
+ * Attach sd char id to script and detach current one if any
*------------------------------------------*/
BUILDIN_FUNC(attachrid)
{
@@ -10435,7 +10492,7 @@ BUILDIN_FUNC(attachrid)
return 0;
}
/*==========================================
- * RID?��̃f?��^?��b?��`
+ * Detach script to rid
*------------------------------------------*/
BUILDIN_FUNC(detachrid)
{
@@ -10443,7 +10500,7 @@ BUILDIN_FUNC(detachrid)
return 0;
}
/*==========================================
- * ?��?��?��݃`?��F?��b?��N
+ * Chk if account connected, (and charid from account if specified)
*------------------------------------------*/
BUILDIN_FUNC(isloggedin)
{
@@ -10471,7 +10528,7 @@ BUILDIN_FUNC(setmapflagnosave)
y=script_getnum(st,5);
m = map_mapname2mapid(str);
mapindex = mapindex_name2id(str2);
-
+
if(m >= 0 && mapindex) {
map[m].flag.nosave=1;
map[m].save.map=mapindex;
@@ -10801,7 +10858,7 @@ BUILDIN_FUNC(pvpoff)
if(battle_config.pk_mode) // disable ranking options if pk_mode is on [Valaris]
return 0;
-
+
map_foreachinmap(buildin_pvpoff_sub, m, BL_PC);
return 0;
}
@@ -10843,14 +10900,14 @@ BUILDIN_FUNC(emotion)
{
int type;
int player=0;
-
+
type=script_getnum(st,2);
if(type < 0 || type > 100)
return 0;
if( script_hasdata(st,3) )
player=script_getnum(st,3);
-
+
if (player) {
TBL_PC *sd = NULL;
if( script_hasdata(st,4) )
@@ -11067,7 +11124,7 @@ BUILDIN_FUNC(setcastledata)
}
/* =====================================================================
- * ?��M?��?��?��h?��?��?��?��v?��?��?��?��?��?��
+ * ?M???h????v??????
* ---------------------------------------------------------------------*/
BUILDIN_FUNC(requestguildinfo)
{
@@ -11133,7 +11190,7 @@ BUILDIN_FUNC(successremovecards) {
return 0;
}
- if(itemdb_isspecial(sd->status.inventory[i].card[0]))
+ if(itemdb_isspecial(sd->status.inventory[i].card[0]))
return 0;
for( c = sd->inventory_data[i]->slot - 1; c >= 0; --c ) {
@@ -11145,18 +11202,18 @@ BUILDIN_FUNC(successremovecards) {
item_tmp.nameid = sd->status.inventory[i].card[c];
item_tmp.identify = 1;
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // ?��?��?��ĂȂ�?��Ȃ�h?��?��?��b?��v
+ if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
- if(cardflag == 1) {// ?��J?��[?��h?��?��?��?��菜�?��?��?��?��A?��C?��e?��?��?��?��?��?��
+ if(cardflag == 1) {//if card was remove remplace item with no card
int flag;
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
-
+
item_tmp.nameid = sd->status.inventory[i].nameid;
item_tmp.identify = 1;
item_tmp.refine = sd->status.inventory[i].refine;
@@ -11167,7 +11224,7 @@ BUILDIN_FUNC(successremovecards) {
item_tmp.card[j]=sd->status.inventory[i].card[j];
pc_delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // ?��?��?��ĂȂ�?��Ȃ�h?��?��?��b?��v
+ if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -11203,12 +11260,12 @@ BUILDIN_FUNC(failedremovecards) {
if( sd->status.inventory[i].card[c] && itemdb_type(sd->status.inventory[i].card[c]) == IT_CARD ) {
cardflag = 1;
- if(typefail == 2) {// add cards to inventory, clear
+ if(typefail == 2) {// add cards to inventory, clear
int flag;
struct item item_tmp;
-
+
memset(&item_tmp,0,sizeof(item_tmp));
-
+
item_tmp.nameid = sd->status.inventory[i].card[c];
item_tmp.identify = 1;
@@ -11221,15 +11278,15 @@ BUILDIN_FUNC(failedremovecards) {
}
if(cardflag == 1) {
- if(typefail == 0 || typefail == 2){ // ?��?��?��?��?��?��
+ if(typefail == 0 || typefail == 2){ // destroy the item
pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
}
- if(typefail == 1){ // ?��J?��[?��h?��̂ݑ�?��?��?��i?��?��?��?��?��Ԃ�?��j
+ if(typefail == 1){ // destroy the card
int flag;
struct item item_tmp;
-
+
memset(&item_tmp,0,sizeof(item_tmp));
-
+
item_tmp.nameid = sd->status.inventory[i].nameid;
item_tmp.identify = 1;
item_tmp.refine = sd->status.inventory[i].refine;
@@ -11238,7 +11295,7 @@ BUILDIN_FUNC(failedremovecards) {
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];
-
+
pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
@@ -11344,7 +11401,7 @@ BUILDIN_FUNC(mobcount) // Added by RoVeRT
script_pushint(st,-1);
return 0;
}
-
+
if( map[m].flag.src4instance && map[m].instance_id == 0 && st->instance_id && (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
{
script_pushint(st,-1);
@@ -11563,7 +11620,7 @@ BUILDIN_FUNC(setwall)
const char *map, *name;
int x, y, m, size, dir;
bool shootable;
-
+
map = script_getstr(st,2);
x = script_getnum(st,3);
y = script_getnum(st,4);
@@ -11628,7 +11685,7 @@ BUILDIN_FUNC(guardianinfo)
}
/*==========================================
- * ID?��?��?��?��Item?��?��
+ * Get the item name by item_id or null
*------------------------------------------*/
BUILDIN_FUNC(getitemname)
{
@@ -11839,7 +11896,7 @@ BUILDIN_FUNC(petloot)
int max;
struct pet_data *pd;
TBL_PC *sd=script_rid2sd(st);
-
+
if(sd==NULL || sd->pd==NULL)
return 0;
@@ -11849,7 +11906,7 @@ BUILDIN_FUNC(petloot)
max = 1; //Let'em loot at least 1 item.
else if (max > MAX_PETLOOT_SIZE)
max = MAX_PETLOOT_SIZE;
-
+
pd = sd->pd;
if (pd->loot != NULL)
{ //Release whatever was there already and reallocate memory
@@ -11860,7 +11917,7 @@ BUILDIN_FUNC(petloot)
pd->loot = (struct pet_loot *)aMalloc(sizeof(struct pet_loot));
pd->loot->item = (struct item *)aCalloc(max,sizeof(struct item));
-
+
pd->loot->max=max;
pd->loot->count = 0;
pd->loot->weight = 0;
@@ -11868,13 +11925,17 @@ BUILDIN_FUNC(petloot)
return 0;
}
/*==========================================
- * PC?��̏�?��?��?��i?��?��?��ǂݎ�?��
+ * Set arrays with info of all sd inventory :
+ * @inventorylist_id, @inventorylist_amount, @inventorylist_equip,
+ * @inventorylist_refine, @inventorylist_identify, @inventorylist_attribute,
+ * @inventorylist_card(0..3), @inventorylist_expire
+ * @inventorylist_count = scalar
*------------------------------------------*/
BUILDIN_FUNC(getinventorylist)
{
TBL_PC *sd=script_rid2sd(st);
char card_var[NAME_LENGTH];
-
+
int i,j=0,k;
if(!sd) return 0;
for(i=0;i<MAX_INVENTORY;i++){
@@ -11966,9 +12027,8 @@ BUILDIN_FUNC(undisguise)
}
/*==========================================
- * NPC?��N?��?��?��X?��`?��F?��?��?��W
- * class?��͕ς�肽?��?��class
- * type?��͒ʏ�0?��Ȃ̂�?��ȁH
+ * Transform a bl to another _class,
+ * @type unused
*------------------------------------------*/
BUILDIN_FUNC(classchange)
{
@@ -11984,7 +12044,7 @@ BUILDIN_FUNC(classchange)
}
/*==========================================
- * NPC?��?��?��甭?��?��?��?��?��?��G?��t?��F?��N?��g
+ * Display an effect
*------------------------------------------*/
BUILDIN_FUNC(misceffect)
{
@@ -12071,7 +12131,7 @@ BUILDIN_FUNC(playBGMall)
}
/*==========================================
- * ?��T?��E?��?��?��h?��G?��t?��F?��N?��g
+ * Play a .wav sound for sd
*------------------------------------------*/
BUILDIN_FUNC(soundeffect)
{
@@ -12154,14 +12214,14 @@ BUILDIN_FUNC(petrecovery)
return 0;
pd=sd->pd;
-
+
if (pd->recovery)
{ //Halt previous bonus
if (pd->recovery->timer != INVALID_TIMER)
delete_timer(pd->recovery->timer, pet_recovery_timer);
} else //Init
pd->recovery = (struct pet_recovery *)aMalloc(sizeof(struct pet_recovery));
-
+
pd->recovery->type = (sc_type)script_getnum(st,2);
pd->recovery->delay = script_getnum(st,3);
pd->recovery->timer = INVALID_TIMER;
@@ -12191,8 +12251,8 @@ BUILDIN_FUNC(petheal)
delete_timer(pd->s_skill->timer, pet_heal_timer);
}
} else //init memory
- pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
-
+ pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
+
pd->s_skill->id=0; //This id identifies that it IS petheal rather than pet_skillsupport
//Use the lv as the amount to heal
pd->s_skill->lv=script_getnum(st,2);
@@ -12225,7 +12285,7 @@ BUILDIN_FUNC(petskillattack)
pd=sd->pd;
if (pd->a_skill == NULL)
pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack));
-
+
pd->a_skill->id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
pd->a_skill->lv=script_getnum(st,3);
pd->a_skill->div_ = 0;
@@ -12251,7 +12311,7 @@ BUILDIN_FUNC(petskillattack2)
pd=sd->pd;
if (pd->a_skill == NULL)
pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack));
-
+
pd->a_skill->id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
pd->a_skill->lv=script_getnum(st,3);
pd->a_skill->div_ = script_getnum(st,4);
@@ -12285,8 +12345,8 @@ BUILDIN_FUNC(petskillsupport)
delete_timer(pd->s_skill->timer, pet_heal_timer);
}
} else //init memory
- pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
-
+ pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
+
pd->s_skill->id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
pd->s_skill->lv=script_getnum(st,3);
pd->s_skill->delay=script_getnum(st,4);
@@ -12485,7 +12545,7 @@ BUILDIN_FUNC(recovery)
return 0;
}
/*==========================================
- * Get your pet info: getpetinfo(n)
+ * Get your pet info: getpetinfo(n)
* n -> 0:pet_id 1:pet_class 2:pet_name
* 3:friendly 4:hungry, 5: rename flag.
*------------------------------------------*/
@@ -12494,7 +12554,7 @@ BUILDIN_FUNC(getpetinfo)
TBL_PC *sd=script_rid2sd(st);
TBL_PET *pd;
int type=script_getnum(st,2);
-
+
if(!sd || !sd->pd) {
if (type == 2)
script_pushconststr(st,"null");
@@ -12518,7 +12578,7 @@ BUILDIN_FUNC(getpetinfo)
}
/*==========================================
- * Get your homunculus info: gethominfo(n)
+ * Get your homunculus info: gethominfo(n)
* n -> 0:hom_id 1:class 2:name
* 3:friendly 4:hungry, 5: rename flag.
* 6: level
@@ -12944,7 +13004,7 @@ BUILDIN_FUNC(getmapxy)
x= bl->x;
y= bl->y;
safestrncpy(mapname, map[bl->m].name, MAP_NAME_LENGTH);
-
+
//Set MapName$
num=st->stack->stack_data[st->start+2].u.num;
name=get_str(num&0x00ffffff);
@@ -13010,7 +13070,7 @@ BUILDIN_FUNC(summon)
sd=script_rid2sd(st);
if (!sd) return 0;
-
+
str =script_getstr(st,2);
_class=script_getnum(st,3);
if( script_hasdata(st,4) )
@@ -13066,12 +13126,12 @@ BUILDIN_FUNC(isequippedcnt)
script_pushint(st,0);
return 0;
}
-
+
for (i=0; id!=0; i++) {
FETCH (i+2, id) else id = 0;
if (id <= 0)
continue;
-
+
for (j=0; j<EQI_MAX; j++) {
int index;
index = sd->equip_index[j];
@@ -13079,7 +13139,7 @@ BUILDIN_FUNC(isequippedcnt)
if(j == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index) continue;
if(j == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index) continue;
if(j == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == index || sd->equip_index[EQI_HEAD_LOW] == index)) continue;
-
+
if(!sd->inventory_data[index])
continue;
@@ -13090,13 +13150,13 @@ BUILDIN_FUNC(isequippedcnt)
if (itemdb_isspecial(sd->status.inventory[index].card[0]))
continue; //No cards
for(k=0; k<sd->inventory_data[index]->slot; k++) {
- if (sd->status.inventory[index].card[k] == id)
+ if (sd->status.inventory[index].card[k] == id)
ret++; //[Lupus]
}
}
}
}
-
+
script_pushint(st,ret);
return 0;
}
@@ -13117,7 +13177,7 @@ BUILDIN_FUNC(isequipped)
unsigned int setitem_hash = 0, setitem_hash2 = 0;
sd = script_rid2sd(st);
-
+
if (!sd) { //If the player is not attached it is a script error anyway... but better prevent the map server from crashing...
script_pushint(st,0);
return 0;
@@ -13136,10 +13196,10 @@ BUILDIN_FUNC(isequipped)
if(j == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index) continue;
if(j == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index) continue;
if(j == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == index || sd->equip_index[EQI_HEAD_LOW] == index)) continue;
-
+
if(!sd->inventory_data[index])
continue;
-
+
if (itemdb_type(id) != IT_CARD) {
if (sd->inventory_data[index]->nameid != id)
continue;
@@ -13199,15 +13259,15 @@ BUILDIN_FUNC(cardscnt)
int index;
sd = script_rid2sd(st);
-
+
for (i=0; id!=0; i++) {
FETCH (i+2, id) else id = 0;
if (id <= 0)
continue;
-
+
index = current_equip_item_index; //we get CURRENT WEAPON inventory index from status.c [Lupus]
if(index < 0) continue;
-
+
if(!sd->inventory_data[index])
continue;
@@ -13326,7 +13386,7 @@ BUILDIN_FUNC(setbattleflag)
flag = script_getstr(st,2);
value = script_getstr(st,3); // HACK: Retrieve number as string (auto-converted) for battle_set_value
-
+
if (battle_set_value(flag, value) == 0)
ShowWarning("buildin_setbattleflag: unknown battle_config flag '%s'\n",flag);
else
@@ -13404,7 +13464,7 @@ BUILDIN_FUNC(charislower)
BUILDIN_FUNC(charat) {
const char *str = script_getstr(st,2);
int pos = script_getnum(st,3);
-
+
if( pos >= 0 && (unsigned int)pos < strlen(str) ) {
char output[2];
output[0] = str[pos];
@@ -13537,7 +13597,7 @@ BUILDIN_FUNC(substr)
len = end - start + 1;
output = (char*)aMalloc(len + 1);
memcpy(output, &str[start], len);
- } else
+ } else
output = (char*)aMalloc(1);
output[len] = '\0';
@@ -13559,7 +13619,7 @@ BUILDIN_FUNC(explode)
size_t len = strlen(str);
int i = 0, j = 0;
int start;
-
+
char *temp;
const char* name;
@@ -14004,8 +14064,8 @@ BUILDIN_FUNC(strpos) {
//===============================================================
// replacestr <input>, <search>, <replace>{, <usecase>{, <count>}}
//
-// Note: Finds all instances of <search> in <input> and replaces
-// with <replace>. If specified will only replace as many
+// Note: Finds all instances of <search> in <input> and replaces
+// with <replace>. If specified will only replace as many
// instances as specified in <count>. By default will be case
// sensitive.
//---------------------------------------------------------------
@@ -14090,7 +14150,7 @@ BUILDIN_FUNC(replacestr)
//========================================================
// countstr <input>, <search>{, <usecase>}
//
-// Note: Counts the number of times <search> occurs in
+// Note: Counts the number of times <search> occurs in
// <input>. By default will be case sensitive.
//--------------------------------------------------------
BUILDIN_FUNC(countstr)
@@ -14301,7 +14361,7 @@ BUILDIN_FUNC(setd)
} else {
setd_sub(st, sd, varname, elem, (void *)__64BPRTSIZE(script_getnum(st, 3)), NULL);
}
-
+
return 0;
}
@@ -14389,7 +14449,7 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
// Free data
Sql_FreeResult(handle);
script_pushint(st, i);
-
+
return 0;
}
@@ -14401,7 +14461,7 @@ BUILDIN_FUNC(query_sql) {
st->state = RERUNLINE;/* will continue when the query is finished running. */
} else
st->state = RUN;
-
+
return 0;
#else
return buildin_query_sql_sub(st, mmysql_handle);
@@ -14417,12 +14477,12 @@ BUILDIN_FUNC(query_logsql) {
#ifdef BETA_THREAD_TEST
if( st->state != RERUNLINE ) {
queryThread_add(st,true);
-
+
st->state = RERUNLINE;/* will continue when the query is finished running. */
} else
st->state = RUN;
-
- return 0;
+
+ return 0;
#else
return buildin_query_sql_sub(st, logmysql_handle);
#endif
@@ -14510,7 +14570,7 @@ BUILDIN_FUNC(callshop)
script_pushint(st,0);
return 1;
}
-
+
if( nd->subtype == SHOP )
{
// flag the user as using a valid script call for opening the shop (for floating NPCs)
@@ -15063,7 +15123,7 @@ BUILDIN_FUNC(unitwarp)
mapname = script_getstr(st, 3);
x = (short)script_getnum(st,4);
y = (short)script_getnum(st,5);
-
+
if (!unit_id) //Warp the script's runner
bl = map_id2bl(st->rid);
else
@@ -15083,7 +15143,7 @@ BUILDIN_FUNC(unitwarp)
}
/// Makes the unit attack the target.
-/// If the unit is a player and <action type> is not 0, it does a continuous
+/// If the unit is a player and <action type> is not 0, it does a continuous
/// attack instead of a single attack.
/// Returns if the request was successfull.
///
@@ -15102,7 +15162,7 @@ BUILDIN_FUNC(unitattack)
script_pushint(st, 0);
return 0;
}
-
+
data = script_getdata(st, 3);
get_val(st, data);
if( data_isstring(data) )
@@ -15118,7 +15178,7 @@ BUILDIN_FUNC(unitattack)
script_pushint(st, 0);
return 0;
}
-
+
// get actiontype
if( script_hasdata(st,4) )
actiontype = script_getnum(st,4);
@@ -15271,7 +15331,7 @@ BUILDIN_FUNC(unitskillusepos)
BUILDIN_FUNC(sleep)
{
int ticks;
-
+
ticks = script_getnum(st,2);
// detach the player
@@ -15300,7 +15360,7 @@ BUILDIN_FUNC(sleep)
BUILDIN_FUNC(sleep2)
{
int ticks;
-
+
ticks = script_getnum(st,2);
if( ticks <= 0 )
@@ -15532,7 +15592,7 @@ BUILDIN_FUNC(mercenary_create)
if( (sd = script_rid2sd(st)) == NULL || sd->md || sd->status.mer_id != 0 )
return 0;
-
+
class_ = script_getnum(st,2);
if( !merc_class(class_) )
@@ -15931,7 +15991,7 @@ BUILDIN_FUNC(bg_monster_set_team)
struct block_list *mbl;
int id = script_getnum(st,2),
bg_id = script_getnum(st,3);
-
+
if( (mbl = map_id2bl(id)) == NULL || mbl->type != BL_MOB )
return 0;
md = (TBL_MOB *)mbl;
@@ -15950,7 +16010,7 @@ BUILDIN_FUNC(bg_leave)
struct map_session_data *sd = script_rid2sd(st);
if( sd == NULL || !sd->bg_id )
return 0;
-
+
bg_team_leave(sd,0);
return 0;
}
@@ -16068,7 +16128,7 @@ BUILDIN_FUNC(instance_create)
script_pushint(st, -2);
return 0;
}
-
+
script_pushint(st, res);
return 0;
}
@@ -16103,7 +16163,7 @@ BUILDIN_FUNC(instance_attachmap)
int m;
int instance_id;
bool usebasename = false;
-
+
name = script_getstr(st,2);
instance_id = script_getnum(st,3);
if( script_hasdata(st,4) && script_getnum(st,4) > 0)
@@ -16116,7 +16176,7 @@ BUILDIN_FUNC(instance_attachmap)
return 0;
}
script_pushconststr(st, map[m].name);
-
+
return 0;
}
@@ -16126,7 +16186,7 @@ BUILDIN_FUNC(instance_detachmap)
struct party_data *p;
const char *str;
int m, instance_id;
-
+
str = script_getstr(st, 2);
if( script_hasdata(st, 3) )
instance_id = script_getnum(st, 3);
@@ -16135,7 +16195,7 @@ BUILDIN_FUNC(instance_detachmap)
else if( (sd = script_rid2sd(st)) != NULL && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
instance_id = p->instance_id;
else return 0;
-
+
if( (m = map_mapname2mapid(str)) < 0 || (m = instance_map2imap(m,instance_id)) < 0 )
{
ShowError("buildin_instance_detachmap: Trying to detach invalid map %s\n", str);
@@ -16149,11 +16209,11 @@ BUILDIN_FUNC(instance_detachmap)
BUILDIN_FUNC(instance_attach)
{
int instance_id;
-
+
instance_id = script_getnum(st, 2);
if( instance_id <= 0 || instance_id >= MAX_INSTANCE )
return 0;
-
+
st->instance_id = instance_id;
return 0;
}
@@ -16163,7 +16223,7 @@ BUILDIN_FUNC(instance_id)
int type, instance_id;
struct map_session_data *sd;
struct party_data *p;
-
+
if( script_hasdata(st, 2) )
{
type = script_getnum(st, 2);
@@ -16187,7 +16247,7 @@ BUILDIN_FUNC(instance_set_timeout)
int instance_id;
struct map_session_data *sd;
struct party_data *p;
-
+
progress_timeout = script_getnum(st, 2);
idle_timeout = script_getnum(st, 3);
@@ -16201,7 +16261,7 @@ BUILDIN_FUNC(instance_set_timeout)
if( instance_id > 0 )
instance_set_timeout(instance_id, progress_timeout, idle_timeout);
-
+
return 0;
}
@@ -16245,7 +16305,7 @@ BUILDIN_FUNC(instance_announce)
if( instance_id <= 0 || instance_id >= MAX_INSTANCE )
return 0;
-
+
for( i = 0; i < instance[instance_id].num_map; i++ )
map_foreachinmap(buildin_announce_sub, instance[instance_id].map[i], BL_PC,
mes, strlen(mes)+1, flag&0xf0, fontColor, fontType, fontSize, fontAlign, fontY);
@@ -16261,7 +16321,7 @@ BUILDIN_FUNC(instance_npcname)
struct map_session_data *sd;
struct party_data *p;
struct npc_data *nd;
-
+
str = script_getstr(st, 2);
if( script_hasdata(st, 3) )
instance_id = script_getnum(st, 3);
@@ -16292,7 +16352,7 @@ BUILDIN_FUNC(has_instance)
struct party_data *p;
const char *str;
int m, instance_id = 0;
-
+
str = script_getstr(st, 2);
if( script_hasdata(st, 3) )
instance_id = script_getnum(st, 3);
@@ -16382,21 +16442,21 @@ BUILDIN_FUNC(instance_check_party)
}
for( i = 0; i < MAX_PARTY; i++ )
- if( (pl_sd = p->data[i].sd) )
- if(map_id2bl(pl_sd->bl.id)){
+ if( (pl_sd = p->data[i].sd) )
+ if(map_id2bl(pl_sd->bl.id)){
if(pl_sd->status.base_level < min){
script_pushint(st, 0);
- return 0;
+ return 0;
}else if(pl_sd->status.base_level > max){
script_pushint(st, 0);
return 0;
}
c++;
}
-
+
if(c < amount){
script_pushint(st, 0); // Not enough Members in the Party to join Instance.
- }else
+ }else
script_pushint(st, 1);
return 0;
@@ -16416,7 +16476,7 @@ BUILDIN_FUNC(setfont)
sd->user_font = font;
else
sd->user_font = 0;
-
+
clif_font(sd);
return 0;
}
@@ -16490,7 +16550,7 @@ BUILDIN_FUNC(areamobuseskill)
cancel = script_getnum(st,10);
emotion = script_getnum(st,11);
target = script_getnum(st,12);
-
+
map_foreachinrange(buildin_mobuseskill_sub, &center, range, BL_MOB, mobid, skillid, skilllv, casttime, cancel, emotion, target);
return 0;
}
@@ -16797,19 +16857,19 @@ BUILDIN_FUNC(bindatcmd) {
const char* eventName;
int i, level = 0, level2 = 0;
bool create = false;
-
+
atcmd = script_getstr(st,2);
eventName = script_getstr(st,3);
if( *atcmd == atcommand_symbol || *atcmd == charcommand_symbol )
atcmd++;
-
+
if( script_hasdata(st,4) ) level = script_getnum(st,4);
if( script_hasdata(st,5) ) level2 = script_getnum(st,5);
if( atcmd_binding_count == 0 ) {
CREATE(atcmd_binding,struct atcmd_binding_data*,1);
-
+
create = true;
} else {
ARR_FIND(0, atcmd_binding_count, i, strcmp(atcmd_binding[i]->command,atcmd) == 0);
@@ -16820,21 +16880,21 @@ BUILDIN_FUNC(bindatcmd) {
} else
create = true;
}
-
+
if( create ) {
i = atcmd_binding_count;
-
+
if( atcmd_binding_count++ != 0 )
RECREATE(atcmd_binding,struct atcmd_binding_data*,atcmd_binding_count);
-
+
CREATE(atcmd_binding[i],struct atcmd_binding_data,1);
-
+
safestrncpy(atcmd_binding[i]->command, atcmd, 50);
safestrncpy(atcmd_binding[i]->npc_event, eventName, 50);
atcmd_binding[i]->level = level;
atcmd_binding[i]->level2 = level2;
}
-
+
return 0;
}
@@ -16846,12 +16906,12 @@ BUILDIN_FUNC(unbindatcmd) {
if( *atcmd == atcommand_symbol || *atcmd == charcommand_symbol )
atcmd++;
-
+
if( atcmd_binding_count == 0 ) {
script_pushint(st, 0);
return 0;
}
-
+
ARR_FIND(0, atcmd_binding_count, i, strcmp(atcmd_binding[i]->command, atcmd) == 0);
if( i < atcmd_binding_count ) {
int cursor = 0;
@@ -16861,21 +16921,21 @@ BUILDIN_FUNC(unbindatcmd) {
for( i = 0, cursor = 0; i < atcmd_binding_count; i++ ) {
if( atcmd_binding[i] == NULL )
continue;
-
+
if( cursor != i ) {
memmove(&atcmd_binding[cursor], &atcmd_binding[i], sizeof(struct atcmd_binding_data*));
}
-
+
cursor++;
}
if( (atcmd_binding_count = cursor) == 0 )
aFree(atcmd_binding);
-
+
script_pushint(st, 1);
} else
script_pushint(st, 0);/* not found */
-
+
return 0;
}
@@ -16987,10 +17047,10 @@ BUILDIN_FUNC(getrandgroupitem) {
TBL_PC* sd;
int i, get_count = 0, flag, nameid, group = script_getnum(st, 2), qty = script_getnum(st,3);
struct item item_tmp;
-
+
if( !( sd = script_rid2sd(st) ) )
return 0;
-
+
if( qty <= 0 ) {
ShowError("getrandgroupitem: qty is <= 0!\n");
return 1;
@@ -16998,18 +17058,18 @@ BUILDIN_FUNC(getrandgroupitem) {
if( (nameid = itemdb_searchrandomid(group)) == UNKNOWN_ITEM_ID ) {
return 1;/* itemdb_searchrandomid will already scream a error */
}
-
+
memset(&item_tmp,0,sizeof(item_tmp));
-
+
item_tmp.nameid = nameid;
item_tmp.identify = itemdb_isidentified(nameid);
-
+
//Check if it's stackable.
if (!itemdb_isstackable(nameid))
get_count = 1;
else
get_count = qty;
-
+
for (i = 0; i < qty; i += get_count) {
// if not pet egg
if (!pet_create_egg(sd, nameid)) {
@@ -17020,7 +17080,7 @@ BUILDIN_FUNC(getrandgroupitem) {
}
}
}
-
+
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 5ebb7a59c..35d213f93 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4668,7 +4668,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case HLIF_HEAL: //[orn]
if (bl->type != BL_HOM) {
if (sd) clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0) ;
- break ;
+ break ;
}
case AL_HEAL:
case ALL_RESURRECTION:
@@ -5994,7 +5994,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
}
if(!battle_config.duel_allow_teleport && sd->duel_group && skilllv <= 2) { // duel restriction [LuzZza]
- char output[128]; sprintf(output, msg_txt(365), skill_get_name(AL_TELEPORT));
+ char output[128]; sprintf(output, msg_txt(365), skill_get_name(AL_TELEPORT));
clif_displaymessage(sd->fd, output); //"Duel: Can't use %s in duel."
break;
}
@@ -8382,7 +8382,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if( src->id != bl->id && battle_check_target(src,bl,BCT_ENEMY) > 0 )
status_fix_damage(src,bl,9999,clif_damage(src,bl,tick,0,0,9999,0,0,0));
} else if( sd ) {
- short chance = sstatus->int_/6 + sd->status.job_level/5 + skilllv*4;
+ short chance = sstatus->int_/6 + sd->status.job_level/5 + skilllv*4;
if( !sd->status.party_id || (rnd()%100 > chance)) {
clif_skill_fail(sd,skillid,USESKILL_FAIL_NEED_HELPER,0);
break;
@@ -9133,18 +9133,16 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
if( ((TBL_MOB*)target)->class_ == MOBID_EMPERIUM )
break;
}
- else
- if (inf && battle_check_target(src, target, inf) <= 0){
+ else if (inf && battle_check_target(src, target, inf) <= 0){
if (sd) clif_skill_fail(sd,ud->skillid,USESKILL_FAIL_LEVEL,0);
break;
}
if(inf&BCT_ENEMY && (sc = status_get_sc(target)) &&
sc->data[SC_FOGWALL] &&
- rnd()%100 < 75)
- { //Fogwall makes all offensive-type targetted skills fail at 75%
- if (sd) clif_skill_fail(sd,ud->skillid,USESKILL_FAIL_LEVEL,0);
- break;
+ rnd() % 100 < 75) { //Fogwall makes all offensive-type targetted skills fail at 75%
+ if (sd) clif_skill_fail(sd, ud->skillid, USESKILL_FAIL_LEVEL, 0);
+ break;
}
}
@@ -10976,19 +10974,19 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un
if (!sce)
sc_start4(bl,type,100,sg->skill_lv,sg->group_id,0,0,sg->limit);
break;
- case UNT_BLOODYLUST:
- if (sg->src_id == bl->id)
- break; //Does not affect the caster.
- if (!sce) {
- TBL_PC *sd = BL_CAST(BL_PC, bl); //prevent fullheal exploit
- if (sd && sd->bloodylust_tick && DIFF_TICK(gettick(), sd->bloodylust_tick) < skill_get_time2(SC_BLOODYLUST, 1))
- sc_start4(bl, type, 100, sg->skill_lv, 1, 0, 0, skill_get_time(LK_BERSERK, sg->skill_lv)); //do not refull heal
- else {
- if (sd) sd->bloodylust_tick = gettick();
- sc_start4(bl, type, 100, sg->skill_lv, 0, 0, 0, skill_get_time(LK_BERSERK, sg->skill_lv));
- }
- }
- break;
+ case UNT_BLOODYLUST:
+ if (sg->src_id == bl->id)
+ break; //Does not affect the caster.
+ if (!sce) {
+ TBL_PC *sd = BL_CAST(BL_PC, bl); //prevent fullheal exploit
+ if (sd && sd->bloodylust_tick && DIFF_TICK(gettick(), sd->bloodylust_tick) < skill_get_time2(SC_BLOODYLUST, 1))
+ sc_start4(bl, type, 100, sg->skill_lv, 1, 0, 0, skill_get_time(LK_BERSERK, sg->skill_lv)); //do not refull heal
+ else {
+ if (sd) sd->bloodylust_tick = gettick();
+ sc_start4(bl, type, 100, sg->skill_lv, 0, 0, 0, skill_get_time(LK_BERSERK, sg->skill_lv));
+ }
+ }
+ break;
case UNT_WARP_WAITING: {
int working = sg->val1&0xffff;
@@ -12428,7 +12426,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh
break;
case AL_WARP:
if(!battle_config.duel_allow_teleport && sd->duel_group) { // duel restriction [LuzZza]
- char output[128]; sprintf(output, msg_txt(365), skill_get_name(AL_WARP));
+ char output[128]; sprintf(output, msg_txt(365), skill_get_name(AL_WARP));
clif_displaymessage(sd->fd, output); //"Duel: Can't use %s in duel."
return 0;
}
@@ -13436,10 +13434,10 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short
case SO_SUMMON_AQUA:
case SO_SUMMON_VENTUS:
case SO_SUMMON_TERA:
- case SO_WATER_INSIGNIA:
- case SO_FIRE_INSIGNIA:
- case SO_WIND_INSIGNIA:
- case SO_EARTH_INSIGNIA:
+ case SO_WATER_INSIGNIA:
+ case SO_FIRE_INSIGNIA:
+ case SO_WIND_INSIGNIA:
+ case SO_EARTH_INSIGNIA:
if( i < 3 )
continue;
break;
@@ -13480,10 +13478,10 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short
case SO_SUMMON_AQUA:
case SO_SUMMON_VENTUS:
case SO_SUMMON_TERA:
- case SO_WATER_INSIGNIA:
- case SO_FIRE_INSIGNIA:
- case SO_WIND_INSIGNIA:
- case SO_EARTH_INSIGNIA:
+ case SO_WATER_INSIGNIA:
+ case SO_FIRE_INSIGNIA:
+ case SO_WIND_INSIGNIA:
+ case SO_EARTH_INSIGNIA:
req.itemid[lv-1] = skill_db[j].itemid[lv-1];
req.amount[lv-1] = skill_db[j].amount[lv-1];
break;
@@ -13708,8 +13706,8 @@ int skill_vfcastfix (struct block_list *bl, double time, int skill_id, int skill
VARCAST_REDUCTION(sc->data[SC_POEMBRAGI]->val2);
if (sc->data[SC_IZAYOI])
VARCAST_REDUCTION(50);
- if (sc->data[SC_WATER_INSIGNIA] && sc->data[SC_WATER_INSIGNIA]->val1 == 3 && (skill_get_ele(skill_id, skill_lv) == ELE_WATER))
- VARCAST_REDUCTION(30); //Reduces 30% Variable Cast Time of Water spells.
+ if (sc->data[SC_WATER_INSIGNIA] && sc->data[SC_WATER_INSIGNIA]->val1 == 3 && (skill_get_ele(skill_id, skill_lv) == ELE_WATER))
+ VARCAST_REDUCTION(30); //Reduces 30% Variable Cast Time of Water spells.
// Fixed cast reduction bonuses
if( sc->data[SC__LAZINESS] )
fixcast_r = max(fixcast_r, sc->data[SC__LAZINESS]->val2);
@@ -13816,8 +13814,8 @@ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv)
if (sc && sc->count) {
if (sc->data[SC_POEMBRAGI])
time -= time * sc->data[SC_POEMBRAGI]->val3 / 100;
- if (sc->data[SC_WIND_INSIGNIA] && sc->data[SC_WIND_INSIGNIA]->val1 == 3 && (skill_get_ele(skill_id, skill_lv) == ELE_WIND))
- time /= 2; // After Delay of Wind element spells reduced by 50%.
+ if (sc->data[SC_WIND_INSIGNIA] && sc->data[SC_WIND_INSIGNIA]->val1 == 3 && (skill_get_ele(skill_id, skill_lv) == ELE_WIND))
+ time /= 2; // After Delay of Wind element spells reduced by 50%.
}
}
@@ -13829,8 +13827,8 @@ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv)
time = time * battle_config.delay_rate / 100;
//min delay
- time = max(time, status_get_amotion(bl)); // Delay can never be below amotion [Playtester]
- time = max(time, battle_config.min_skill_delay_limit);
+ time = max(time, status_get_amotion(bl)); // Delay can never be below amotion [Playtester]
+ time = max(time, battle_config.min_skill_delay_limit);
// ShowInfo("Delay delayfix = %d\n",time);
return time;
@@ -17445,7 +17443,7 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current)
else if( strcmpi(split[10],"mado")==0 ) skill_db[i].state = ST_MADO;
else if( strcmpi(split[10],"elementalspirit")==0 ) skill_db[i].state = ST_ELEMENTALSPIRIT;
else if (strcmpi(split[10], "poisonweapon") == 0) skill_db[i].state = ST_POISONINGWEAPON;
- else if (strcmpi(split[10], "rollingcutter") == 0) skill_db[i].state = ST_ROLLINGCUTTER;
+ else if (strcmpi(split[10], "rollingcutter") == 0) skill_db[i].state = ST_ROLLINGCUTTER;
/**
* Unknown or no state
@@ -17456,7 +17454,7 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current)
for( j = 0; j < MAX_SKILL_ITEM_REQUIRE; j++ ) {
skill_db[i].itemid[j] = atoi(split[12+ 2*j]);
skill_db[i].amount[j] = atoi(split[13+ 2*j]);
- }
+ }
return true;
}
diff --git a/src/map/skill.h b/src/map/skill.h
index a1ca832a3..b94fd836d 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -400,8 +400,8 @@ enum {
ST_RIDINGWUG,
ST_MADO,
ST_ELEMENTALSPIRIT,
- ST_POISONINGWEAPON,
- ST_ROLLINGCUTTER,
+ ST_POISONINGWEAPON,
+ ST_ROLLINGCUTTER,
};
enum e_skill {
diff --git a/src/map/status.c b/src/map/status.c
index 282e2313b..70ec22af3 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1309,7 +1309,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
((TBL_MOB*)target)->state.rebirth = 1;
return hp+sp;
- }
+ }
if(target->type == BL_PC){
TBL_PC *sd = BL_CAST(BL_PC,target);
TBL_HOM *hd = sd->hd;
@@ -1321,7 +1321,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
}
}
if (target->type == BL_MOB && sc && sc->data[SC_REBIRTH] && !((TBL_MOB*) target)->state.rebirth) {// Ensure the monster has not already rebirthed before doing so.
- status_revive(target, sc->data[SC_REBIRTH]->val2, 0);
+ status_revive(target, sc->data[SC_REBIRTH]->val2, 0);
status_change_clear(target,0);
((TBL_MOB*)target)->state.rebirth = 1;
@@ -10443,7 +10443,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
sc_timer_next(1000+tick, status_change_timer, bl->id, data);
return 0;
}
- break;
+ break;
case SC_ANGRIFFS_MODUS:
if(--(sce->val4) >= 0) { //drain hp/sp
if( !status_charge(bl,100,20) ) break;
diff --git a/src/map/status.h b/src/map/status.h
index d96fdd0b1..402dfc690 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -646,6 +646,7 @@ typedef enum sc_type {
SC_PARALYSIS,
SC_PAIN_KILLER,
+
#ifdef RENEWAL
SC_EXTREMITYFIST2,
#endif
diff --git a/src/map/trade.c b/src/map/trade.c
index 0b6431c07..ac23b047e 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -74,15 +74,15 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
clif_displaymessage(sd->fd, msg_txt(246));
clif_tradestart(sd, 2); // GM is not allowed to trade
return;
- }
-
+ }
+
// Players can not request trade from far away, unless they are allowed to use @trade.
if (!pc_can_use_command(sd, "trade", COMMAND_ATCOMMAND) &&
(sd->bl.m != target_sd->bl.m || !check_distance_bl(&sd->bl, &target_sd->bl, TRADE_DISTANCE))) {
clif_tradestart(sd, 0); // too far
return ;
}
-
+
target_sd->trade_partner = sd->status.account_id;
sd->trade_partner = target_sd->status.account_id;
clif_traderequest(target_sd, sd->status.name);
@@ -106,7 +106,7 @@ void trade_tradeack(struct map_session_data *sd, int type)
if (sd->state.trading || !sd->trade_partner)
return; //Already trading or no partner set.
-
+
if ((tsd = map_id2sd(sd->trade_partner)) == NULL) {
clif_tradestart(sd, 1); // character does not exist
sd->trade_partner=0;
@@ -177,7 +177,7 @@ int impossible_trade_check(struct map_session_data *sd)
int i, index;
nullpo_retr(1, sd);
-
+
if(sd->deal.zeny > sd->status.zeny)
{
pc_setglobalreg(sd,"ZENY_HACKER",1);
@@ -220,7 +220,7 @@ int impossible_trade_check(struct map_session_data *sd)
} else
// message about the ban
strcpy(message_to_gm, msg_txt(508)); // This player hasn't been banned (Ban option is disabled).
-
+
intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
return 1;
}
@@ -257,7 +257,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
n = sd->deal.item[trade_i].index;
if (amount > inventory[n].amount)
return 0; //qty Exploit?
-
+
data = itemdb_search(inventory[n].nameid);
i = MAX_INVENTORY;
if (itemdb_isstackable2(data)) { //Stackable item.
@@ -272,7 +272,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
break;
}
}
-
+
if (i == MAX_INVENTORY) {// look for an empty slot.
for(i = 0; i < MAX_INVENTORY && inventory2[i].nameid; i++);
if (i == MAX_INVENTORY)
@@ -439,7 +439,7 @@ void trade_tradeok(struct map_session_data *sd)
if(sd->state.deal_locked || !sd->state.trading)
return;
-
+
if ((target_sd = map_id2sd(sd->trade_partner)) == NULL) {
trade_tradecancel(sd);
return;
@@ -470,7 +470,7 @@ void trade_tradecancel(struct map_session_data *sd)
clif_tradecancelled(sd);
return;
}
-
+
for(trade_i = 0; trade_i < 10; trade_i++) { // give items back (only virtual)
if (!sd->deal.item[trade_i].amount)
continue;
@@ -498,7 +498,7 @@ void trade_tradecancel(struct map_session_data *sd)
target_sd->deal.item[trade_i].index = 0;
target_sd->deal.item[trade_i].amount = 0;
}
-
+
if (target_sd->deal.zeny) {
clif_updatestatus(target_sd, SP_ZENY);
target_sd->deal.zeny = 0;
@@ -525,9 +525,9 @@ void trade_tradecommit(struct map_session_data *sd)
trade_tradecancel(sd);
return;
}
-
+
sd->state.deal_locked = 2;
-
+
if (tsd->state.deal_locked < 2)
return; //Not yet time for trading.
@@ -547,7 +547,7 @@ void trade_tradecommit(struct map_session_data *sd)
trade_tradecancel(sd);
return;
}
-
+
// trade is accepted and correct.
for( trade_i = 0; trade_i < 10; trade_i++ )
{
@@ -586,22 +586,22 @@ void trade_tradecommit(struct map_session_data *sd)
sd->deal.zeny = 0;
tsd->deal.zeny = 0;
}
-
+
sd->state.deal_locked = 0;
sd->trade_partner = 0;
sd->state.trading = 0;
-
+
tsd->state.deal_locked = 0;
tsd->trade_partner = 0;
tsd->state.trading = 0;
-
+
clif_tradecompleted(sd, 0);
clif_tradecompleted(tsd, 0);
// save both player to avoid crash: they always have no advantage/disadvantage between the 2 players
if (save_settings&1)
{
- chrif_save(sd,0);
+ chrif_save(sd,0);
chrif_save(tsd,0);
}
}
diff --git a/src/map/unit.c b/src/map/unit.c
index 11a7b5898..7e3990e3a 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -73,7 +73,7 @@ int unit_walktoxy_sub(struct block_list *bl)
return 0;
memcpy(&ud->walkpath,&wpd,sizeof(wpd));
-
+
if (ud->target_to && ud->chaserange>1) {
//Generally speaking, the walk path is already to an adjacent tile
//so we only need to shorten the path if the range is greater than 1.
@@ -129,7 +129,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
md = BL_CAST(BL_MOB, bl);
mrd = BL_CAST(BL_MER, bl);
ud = unit_bl2ud(bl);
-
+
if(ud == NULL) return 0;
if(ud->walktimer != tid){
@@ -155,7 +155,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
if(map_getcell(bl->m,x+dx,y+dy,CELL_CHKNOPASS))
return unit_walktoxy_sub(bl);
-
+
//Refresh view for all those we lose sight
map_foreachinmovearea(clif_outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
@@ -171,7 +171,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
ud->walktimer = -2; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
map_foreachinmovearea(clif_insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
ud->walktimer = INVALID_TIMER;
-
+
if(sd) {
if( sd->touching_id )
npc_touchnext_areanpc(sd,false);
@@ -244,7 +244,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
if(tid == INVALID_TIMER) //A directly invoked timer is from battle_stop_walking, therefore the rest is irrelevant.
return 0;
-
+
if(ud->state.change_walk_target)
return unit_walktoxy_sub(bl);
@@ -318,9 +318,9 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
struct status_change* sc = NULL;
nullpo_ret(bl);
-
+
ud = unit_bl2ud(bl);
-
+
if( ud == NULL) return 0;
// disabled until we find the correct algorithm. [malufett]
//#ifdef OFFICIAL_WALKPATH
@@ -335,12 +335,12 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
if(!(flag&2) && (!(status_get_mode(bl)&MD_CANMOVE) || !unit_can_move(bl)))
return 0;
-
+
ud->state.walk_easy = flag&1;
ud->to_x = x;
ud->to_y = y;
unit_set_target(ud, 0);
-
+
sc = status_get_sc(bl);
if (sc && sc->data[SC_CONFUSION]) //Randomize the target position
map_random_dir(bl, &ud->to_x, &ud->to_y);
@@ -395,13 +395,13 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
struct status_change *sc = NULL;
nullpo_ret(bl);
nullpo_ret(tbl);
-
+
ud = unit_bl2ud(bl);
if( ud == NULL) return 0;
if (!(status_get_mode(bl)&MD_CANMOVE))
return 0;
-
+
if (!unit_can_reach_bl(bl, tbl, distance_bl(bl, tbl)+1, flag&1, &ud->to_x, &ud->to_y)) {
ud->to_x = bl->x;
ud->to_y = bl->y;
@@ -455,12 +455,12 @@ int unit_run(struct block_list *bl)
if (!(sc && sc->data[SC_RUN]))
return 0;
-
+
if (!unit_can_move(bl)) {
status_change_end(bl, SC_RUN, INVALID_TIMER);
return 0;
}
-
+
lv = sc->data[SC_RUN]->val1;
dir_x = dirx[sc->data[SC_RUN]->val2];
dir_y = diry[sc->data[SC_RUN]->val2];
@@ -476,7 +476,7 @@ int unit_run(struct block_list *bl)
//if sprinting and there's a PC/Mob/NPC, block the path [Kevin]
if(sc->data[SC_RUN] && map_count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
break;
-
+
to_x += dir_x;
to_y += dir_y;
}
@@ -525,7 +525,7 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
int i;
if (!(sc && sc->data[SC_WUGDASH]))
return 0;
-
+
nullpo_ret(sd);
nullpo_ret(bl);
@@ -533,7 +533,7 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
status_change_end(bl,SC_WUGDASH,INVALID_TIMER);
return 0;
}
-
+
lv = sc->data[SC_WUGDASH]->val1;
dir_x = dirx[sc->data[SC_WUGDASH]->val2];
dir_y = diry[sc->data[SC_WUGDASH]->val2];
@@ -547,7 +547,7 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
if(sc->data[SC_WUGDASH] && map_count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
break;
-
+
to_x += dir_x;
to_y += dir_y;
}
@@ -573,7 +573,7 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
unit_bl2ud(bl)->state.running = 0;
status_change_end(bl,SC_WUGDASH,INVALID_TIMER);
-
+
if( sd ){
clif_fixpos(bl);
skill_castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, gettick(), SD_LEVEL);
@@ -624,11 +624,11 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool
map_foreachinmovearea(clif_outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
map_moveblock(bl, dst_x, dst_y, gettick());
-
+
ud->walktimer = -2; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
map_foreachinmovearea(clif_insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
ud->walktimer = INVALID_TIMER;
-
+
if(sd) {
if( sd->touching_id )
npc_touchnext_areanpc(sd,false);
@@ -664,7 +664,7 @@ int unit_setdir(struct block_list *bl,unsigned char dir)
ud = unit_bl2ud(bl);
if (!ud) return 0;
ud->dir = dir;
- if (bl->type == BL_PC)
+ if (bl->type == BL_PC)
((TBL_PC *)bl)->head_dir = 0;
clif_changed_dir(bl, AREA);
return 0;
@@ -689,7 +689,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
struct map_session_data* sd;
struct skill_unit* su = NULL;
int nx, ny, result;
-
+
sd = BL_CAST(BL_PC, bl);
su = BL_CAST(BL_SKILL, bl);
@@ -701,12 +701,12 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
if(!su) {
unit_stop_walking(bl, 0);
}
-
+
if( sd ) {
sd->ud.to_x = nx;
sd->ud.to_y = ny;
}
-
+
dx = nx-bl->x;
dy = ny-bl->y;
@@ -743,7 +743,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
return count; // return amount of knocked back cells
}
-//Warps a unit/ud to a given map/position.
+//Warps a unit/ud to a given map/position.
//In the case of players, pc_setpos is used.
//it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks.
int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
@@ -751,17 +751,17 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
struct unit_data *ud;
nullpo_ret(bl);
ud = unit_bl2ud(bl);
-
+
if(bl->prev==NULL || !ud)
return 1;
if (type == CLR_DEAD)
- //Type 1 is invalid, since you shouldn't warp a bl with the "death"
+ //Type 1 is invalid, since you shouldn't warp a bl with the "death"
//animation, it messes up with unit_remove_map! [Skotlex]
return 1;
-
+
if( m<0 ) m=bl->m;
-
+
switch (bl->type) {
case BL_MOB:
if (map[bl->m].flag.monster_noteleport && ((TBL_MOB*)bl)->master_id == 0)
@@ -774,18 +774,18 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
return 1;
break;
}
-
+
if (x<0 || y<0)
{ //Random map position.
if (!map_search_freecell(NULL, m, &x, &y, -1, -1, 1)) {
ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y);
return 2;
-
+
}
} else if (map_getcell(m,x,y,CELL_CHKNOREACH))
{ //Invalid target cell
ShowWarning("unit_warp: Specified non-walkable target cell: %d (%s) at [%d,%d]\n", m, map[m].name, x,y);
-
+
if (!map_search_freecell(NULL, m, &x, &y, 4, 4, 1))
{ //Can't find a nearby cell
ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y);
@@ -795,10 +795,10 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
if (bl->type == BL_PC) //Use pc_setpos
return pc_setpos((TBL_PC*)bl, map_id2index(m), x, y, type);
-
+
if (!unit_remove_map(bl, type))
return 3;
-
+
if (bl->m != m && battle_config.clear_unit_onwarp &&
battle_config.clear_unit_onwarp&bl->type)
skill_clear_unitgroup(bl);
@@ -832,8 +832,8 @@ int unit_stop_walking(struct block_list *bl,int type)
ud = unit_bl2ud(bl);
if(!ud || ud->walktimer == INVALID_TIMER)
return 0;
- //NOTE: We are using timer data after deleting it because we know the
- //delete_timer function does not messes with it. If the function's
+ //NOTE: We are using timer data after deleting it because we know the
+ //delete_timer function does not messes with it. If the function's
//behaviour changes in the future, this code could break!
td = get_timer(ud->walktimer);
delete_timer(ud->walktimer, unit_walktoxy_timer);
@@ -849,7 +849,7 @@ int unit_stop_walking(struct block_list *bl,int type)
if(type&0x01)
clif_fixpos(bl);
-
+
ud->walkpath.path_len = 0;
ud->walkpath.path_pos = 0;
ud->to_x = bl->x;
@@ -892,21 +892,21 @@ int unit_can_move(struct block_list *bl)
struct map_session_data *sd;
struct unit_data *ud;
struct status_change *sc;
-
+
nullpo_ret(bl);
ud = unit_bl2ud(bl);
sc = status_get_sc(bl);
sd = BL_CAST(BL_PC, bl);
-
+
if (!ud)
return 0;
-
+
if (ud->skilltimer != INVALID_TIMER && ud->skillid != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill_get_inf2(ud->skillid)&INF2_GUILD_SKILL))
return 0; // prevent moving while casting
-
+
if (DIFF_TICK(ud->canmove_tick, gettick()) > 0)
return 0;
-
+
if (sd && (
pc_issit(sd) ||
sd->state.vending ||
@@ -914,7 +914,7 @@ int unit_can_move(struct block_list *bl)
sd->state.blockedmove
))
return 0; //Can't move
-
+
if (sc) {
if( sc->cant.move /* status placed here are ones that cannot be cached by sc->cant.move for they depend on other conditions other than their availability */
|| (sc->data[SC_FEAR] && sc->data[SC_FEAR]->val2 > 0)
@@ -928,7 +928,7 @@ int unit_can_move(struct block_list *bl)
sc->data[SC_CLOAKING]->val1 < 3 && !(sc->data[SC_CLOAKING]->val4&1))
)
return 0;
-
+
if (sc->opt1 > 0 && sc->opt1 != OPT1_STONEWAIT && sc->opt1 != OPT1_BURNING && (sc->opt1 != OPT1_CRYSTALIZE && bl->type != BL_MOB))
return 0;
@@ -964,7 +964,7 @@ int unit_resume_running(int tid, unsigned int tick, int id, intptr_t data)
/*==========================================
- * Applies walk delay to character, considering that
+ * Applies walk delay to character, considering that
* if type is 0, this is a damage induced delay: if previous delay is active, do not change it.
* if type is 1, this is a skill induced delay: walk-delay may only be increased, not decreased.
*------------------------------------------*/
@@ -972,7 +972,7 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int
{
struct unit_data *ud = unit_bl2ud(bl);
if (delay <= 0 || !ud) return 0;
-
+
/**
* MvP mobs have no walk delay
**/
@@ -1051,7 +1051,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
target_id = ud->target; //Auto-select target. [Skotlex]
temp = 1;
}
-
+
if (sd) {
//Target_id checking.
if(skillnotok(skill_num, sd)) // [MouseJstr]
@@ -1121,7 +1121,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
}
break;
case BD_ENCORE:
- //Prevent using the dance skill if you no longer have the skill in your tree.
+ //Prevent using the dance skill if you no longer have the skill in your tree.
if(!sd->skillid_dance || pc_checkskill(sd,sd->skillid_dance)<=0){
clif_skill_fail(sd,skill_num,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -1188,12 +1188,12 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
unit_stop_attack(src);
else if(ud->attacktimer != INVALID_TIMER) //Elsewise, delay current attack sequence
ud->attackabletime = tick + status_get_adelay(src);
-
+
ud->state.skillcastcancel = castcancel;
//temp: Used to signal force cast now.
temp = 0;
-
+
switch(skill_num){
case ALL_RESURRECTION:
if(battle_check_undead(tstatus->race,tstatus->def_ele)) {
@@ -1239,7 +1239,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
{
unsigned int k = (distance_bl(src,target)-1)/3; //+100% every 3 cells of distance
if( k > 2 ) k = 2; // ...but hard-limited to 300%.
- casttime += casttime * k;
+ casttime += casttime * k;
}
break;
case GD_EMERGENCYCALL: //Emergency Call double cast when the user has learned Leap [Daegaladh]
@@ -1251,19 +1251,19 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
casttime = -1;
break;
}
-
+
// moved here to prevent Suffragium from ending if skill fails
#ifndef RENEWAL_CAST
if (!(skill_get_castnodex(skill_num, skill_lv)&2))
casttime = skill_castfix_sc(src, casttime);
#else
- casttime = skill_vfcastfix(src, casttime, skill_num, skill_lv);
+ casttime = skill_vfcastfix(src, casttime, skill_num, skill_lv);
#endif
-
+
// in official this is triggered even if no cast time.
clif_skillcasting(src, src->id, target_id, 0,0, skill_num, skill_get_ele(skill_num, skill_lv), casttime);
if( casttime > 0 || temp )
- {
+ {
unit_stop_walking(src,1);
if (sd && target->type == BL_MOB)
@@ -1371,11 +1371,11 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh
if(ud->skilltimer != INVALID_TIMER) //Normally not needed since clif.c checks for it, but at/char/script commands don't! [Skotlex]
return 0;
-
+
sc = status_get_sc(src);
if (sc && !sc->count)
sc = NULL;
-
+
if( sd )
{
if( skillnotok(skill_num, sd) || !skill_check_condition_castbegin(sd, skill_num, skill_lv) )
@@ -1422,7 +1422,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh
#else
casttime = skill_vfcastfix(src, casttime, skill_num, skill_lv );
#endif
-
+
ud->state.skillcastcancel = castcancel&&casttime>0?1:0;
if( !sd || sd->skillitem != skill_num || skill_get_cast(skill_num,skill_lv) )
@@ -1513,7 +1513,7 @@ int unit_unattackable(struct block_list *bl)
ud->state.attack_continue = 0;
unit_set_target(ud, 0);
}
-
+
if(bl->type == BL_MOB)
mob_unlocktarget((struct mob_data*)bl, gettick()) ;
else if(bl->type == BL_PET)
@@ -1576,7 +1576,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous)
return 0;
}
-//Cancels an ongoing combo, resets attackable time and restarts the
+//Cancels an ongoing combo, resets attackable time and restarts the
//attack timer to resume attacking after amotion time. [Skotlex]
int unit_cancel_combo(struct block_list *bl)
{
@@ -1592,7 +1592,7 @@ int unit_cancel_combo(struct block_list *bl)
if (ud->attacktimer == INVALID_TIMER)
return 1; //Nothing more to do.
-
+
delete_timer(ud->attacktimer, unit_attack_timer);
ud->attacktimer=add_timer(ud->attackabletime,unit_attack_timer,bl->id,0);
return 1;
@@ -1622,7 +1622,7 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range,
if( bl->m != tbl->m)
return false;
-
+
if( bl->x==tbl->x && bl->y==tbl->y )
return true;
@@ -1634,7 +1634,7 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range,
dy=tbl->y - bl->y;
dx=(dx>0)?1:((dx<0)?-1:0);
dy=(dy>0)?1:((dy<0)?-1:0);
-
+
if (map_getcell(tbl->m,tbl->x-dx,tbl->y-dy,CELL_CHKNOPASS))
{ //Look for a suitable cell to place in.
for(i=0;i<9 && map_getcell(tbl->m,tbl->x-dirx[i],tbl->y-diry[i],CELL_CHKNOPASS);i++);
@@ -1701,7 +1701,7 @@ int unit_calc_pos(struct block_list *bl, int tx, int ty, int dir)
}
ud->to_x = x;
ud->to_y = y;
-
+
return 0;
}
@@ -1716,7 +1716,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
struct map_session_data *sd = NULL;
struct mob_data *md = NULL;
int range;
-
+
if( (ud=unit_bl2ud(src))==NULL )
return 0;
if( ud->attacktimer != tid )
@@ -1750,7 +1750,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
if( ud->skilltimer != INVALID_TIMER && !(sd && pc_checkskill(sd,SA_FREECAST) > 0) )
return 0; // can't attack while casting
-
+
if( !battle_config.sdelay_attack_enable && DIFF_TICK(ud->canact_tick,tick) > 0 && !(sd && pc_checkskill(sd,SA_FREECAST) > 0) )
{ // attacking when under cast delay has restrictions:
if( tid == INVALID_TIMER )
@@ -1810,7 +1810,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
}
if(src->type == BL_PET && pet_attackskill((TBL_PET*)src, target->id))
return 1;
-
+
map_freeblock_lock();
ud->attacktarget_lv = battle_weapon_attack(src,target,tick,0);
@@ -1823,7 +1823,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
**/
if( ud->attacktarget_lv == ATK_NONE )
return 1;
-
+
ud->attackabletime = tick + sstatus->adelay;
// You can't move if you can't attack neither.
if (src->type&battle_config.attack_walk_delay)
@@ -1856,7 +1856,7 @@ int unit_skillcastcancel(struct block_list *bl,int type)
struct unit_data *ud = unit_bl2ud( bl);
unsigned int tick=gettick();
int ret=0, skill;
-
+
nullpo_ret(bl);
if (!ud || ud->skilltimer == INVALID_TIMER)
return 0; //Nothing to cancel.
@@ -1872,14 +1872,14 @@ int unit_skillcastcancel(struct block_list *bl,int type)
(sd->special_state.no_castcancel && !map_flag_gvg(bl->m) && !map[bl->m].flag.battleground))) //fixed flags being read the wrong way around [blackhole89]
return 0;
}
-
+
ud->canact_tick = tick;
if(type&1 && sd)
skill = sd->skillid_old;
else
skill = ud->skillid;
-
+
if (skill_get_inf(skill) & INF_GROUND_SKILL)
ret=delete_timer( ud->skilltimer, skill_castend_pos );
else
@@ -1919,8 +1919,8 @@ void unit_dataset(struct block_list *bl)
ud->walktimer = INVALID_TIMER;
ud->skilltimer = INVALID_TIMER;
ud->attacktimer = INVALID_TIMER;
- ud->attackabletime =
- ud->canact_tick =
+ ud->attackabletime =
+ ud->canact_tick =
ud->canmove_tick = gettick();
}
@@ -1944,7 +1944,7 @@ int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int
if(damage+damage2 <= 0)
return 0;
-
+
return status_fix_damage(src,target,damage+damage2,clif_damage(target,target,tick,sdelay,ddelay,damage,div,type,damage2));
}
@@ -1971,7 +1971,7 @@ int unit_changeviewsize(struct block_list *bl,short size)
/*==========================================
* Removes a bl/ud from the map.
* Returns 1 on success. 0 if it couldn't be removed or the bl was free'd
- * if clrtype is 1 (death), appropiate cleanup is performed.
+ * if clrtype is 1 (death), appropiate cleanup is performed.
* Otherwise it is assumed bl is being warped.
* On-Kill specific stuff is not performed here, look at status_damage for that.
*------------------------------------------*/
@@ -2187,7 +2187,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
return 0;
}
break;
- }
+ }
default: break;// do nothing
}
/**
@@ -2252,13 +2252,13 @@ int unit_free(struct block_list *bl, clr_type clrtype)
pc_delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),false);
pc_delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),false);
pc_delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),false);
-
+
if( sd->followtimer != INVALID_TIMER )
pc_stop_following(sd);
-
+
if( sd->duel_invite > 0 )
duel_reject(sd->duel_invite, sd);
-
+
// Notify friends that this char logged out. [Skotlex]
map_foreachpc(clif_friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 0);
party_send_logout(sd);
@@ -2454,10 +2454,10 @@ int unit_free(struct block_list *bl, clr_type clrtype)
}
if( sd )
sd->ed = NULL;
-
+
elemental_summon_stop(ed);
break;
- }
+ }
}
skill_clear_unitgroup(bl);
diff --git a/src/map/vending.c b/src/map/vending.c
index 723cb014f..0f8255788 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -59,7 +59,7 @@ void vending_vendinglistreq(struct map_session_data* sd, int id)
{ // GM is not allowed to trade
clif_displaymessage(sd->fd, msg_txt(246));
return;
- }
+ }
sd->vended_id = vsd->vender_id; // register vending uid
@@ -139,11 +139,11 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
clif_buyvending(sd, idx, amount, 2); // you can not buy, because overweight
return;
}
-
+
//Check to see if cart/vend info is in sync.
if( vending[j].amount > vsd->status.cart[idx].amount )
vending[j].amount = vsd->status.cart[idx].amount;
-
+
// if they try to add packets (example: get twice or more 2 apples if marchand has only 3 apples).
// here, we check cumulative amounts
if( vending[j].amount < amount )
@@ -152,7 +152,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
clif_buyvending(sd, idx, vsd->vending[j].amount, 4); // not enough quantity
return;
}
-
+
vending[j].amount -= amount;
switch( pc_checkadditem(sd, vsd->status.cart[idx].nameid, amount) ) {
@@ -199,7 +199,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
{
if( vsd->vending[i].amount == 0 )
continue;
-
+
if( cursor != i ) // speedup
{
vsd->vending[cursor].index = vsd->vending[i].index;
@@ -233,18 +233,18 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
}
static int vending_checknearnpc_sub(struct block_list* bl, va_list args) {
struct npc_data *nd = (struct npc_data*)bl;
-
+
if( nd->sc.option & (OPTION_HIDE|OPTION_INVISIBLE) )
return 0;
return 1;
}
bool vending_checknearnpc(struct block_list * bl) {
-
+
if( battle_config.min_npc_vending_distance > 0 &&
map_foreachinrange(vending_checknearnpc_sub,bl, battle_config.min_npc_vending_distance, BL_NPC) )
return true;
-
+
return false;
}
/*==========================================
@@ -284,8 +284,8 @@ void vending_openvending(struct map_session_data* sd, const char* message, bool
clif_skill_fail(sd, MC_VENDING, USESKILL_FAIL_LEVEL, 0);
return;
}
-
-
+
+
// filter out invalid items
i = 0;
for( j = 0; j < count; j++ )