From 0696125b8269dd87fcb9f7c483064e578e338c60 Mon Sep 17 00:00:00 2001 From: aleos89 Date: Thu, 11 Jun 2015 10:44:13 -0400 Subject: [PATCH 1/6] Script Engine Upgrade * Upgraded the script engine variables to no longer be limited. * Increased array limit from 127 to 2 billion. * Improvement in overall speed and storage size. * All variable types now support arrays. - Merge from HerculesWS/Hercules@82b583b. Thanks to those who worked on it. --- conf/inter_athena.conf | 12 +- doc/script_commands.txt | 59 +- npc/custom/quests/hunting_missions.txt | 8 +- sql-files/main.sql | 82 +- sql-files/upgrades/upgrade_20150610.sql | 66 + src/char/char.c | 42 +- src/char/char.h | 6 +- src/char/char_logif.c | 77 +- src/char/char_logif.h | 4 +- src/char/inter.c | 377 ++++-- src/char/inter.h | 4 +- src/common/db.c | 233 +++- src/common/db.h | 166 ++- src/common/ers.c | 10 +- src/common/ers.h | 24 +- src/common/mmo.h | 40 +- src/login/account.c | 262 +++- src/login/account.h | 5 +- src/login/loginchrif.c | 47 +- src/map/atcommand.c | 16 +- src/map/chrif.c | 26 +- src/map/clif.c | 2 +- src/map/duel.c | 4 +- src/map/instance.c | 12 +- src/map/instance.h | 8 +- src/map/intif.c | 267 ++-- src/map/intif.h | 2 +- src/map/mapreg.c | 343 +++-- src/map/mapreg.h | 24 +- src/map/mob.c | 4 +- src/map/npc.c | 9 +- src/map/pc.c | 551 ++++---- src/map/pc.h | 67 +- src/map/script.c | 1631 +++++++++++++---------- src/map/script.h | 196 ++- src/map/skill.c | 16 +- src/map/trade.c | 2 +- src/map/unit.c | 18 - 38 files changed, 2925 insertions(+), 1797 deletions(-) create mode 100644 sql-files/upgrades/upgrade_20150610.sql diff --git a/conf/inter_athena.conf b/conf/inter_athena.conf index 41ae45ca13..44ed89d45e 100644 --- a/conf/inter_athena.conf +++ b/conf/inter_athena.conf @@ -80,9 +80,12 @@ mysql_reconnect_count: 1 // Login Database Tables login_server_account_db: login -login_server_accreg_db: global_reg_value ipban_table: ipbanlist +// Shared +global_acc_reg_num_table: global_acc_reg_num +global_acc_reg_str_table: global_acc_reg_str + // Char Database Tables char_db: char hotkey_db: hotkey @@ -91,7 +94,6 @@ cart_db: cart_inventory inventory_db: inventory charlog_db: charlog storage_db: storage -reg_db: global_reg_value skill_db: skill interlog_db: interlog memo_db: memo @@ -117,6 +119,10 @@ elemental_db: elemental ragsrvinfo_db: ragsrvinfo skillcooldown_db: skillcooldown bonus_script_db: bonus_script +acc_reg_num_table: acc_reg_num +acc_reg_str_table: acc_reg_str +char_reg_str_table: char_reg_str +char_reg_num_table: char_reg_num // Map Database Tables buyingstore_db: buyingstores @@ -135,7 +141,7 @@ mob_skill_db_db: mob_skill_db mob_skill_db_re_db: mob_skill_db_re mob_skill_db2_db: mob_skill_db2 //mob_skill_db2_db: mob_skill_db2_re -mapreg_db: mapreg +mapreg_table: mapreg vending_db: vendings vending_items_db: vending_items market_table: market diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 93b1bc4111..d7ca908d5c 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -3,7 +3,7 @@ //===== By: ================================================== //= rAthena Dev Team //===== Last Updated: ======================================== -//= 20140313 +//= 20150610 //===== Description: ========================================= //= A reference manual for the rAthena scripting language. //= Commands are sorted depending on their functionality. @@ -616,6 +616,8 @@ same name. You can tell between the specific variables of an array with an [] +All variable types can be used as arrays. + Variables stored in this way, inside an array, are also called 'array elements'. Arrays are specifically useful for storing a set of similar data (like several item IDs for example) and then looping through it. You can address any array @@ -631,8 +633,9 @@ value from an another array) to get at an array value: This will make @arrayofnumbers[100] equal to 10. -Notice that index numbering always starts with 0. Arrays cannot hold more than -128 variables. (So the last one can't have a number higher than 127) +Index numbering always starts with 0 and arrays can hold over 2 billion +variables. As such, the (guaranteed) allowed values for indices are in the +range 0 ~ 2147483647. And array indexes probably can't be negative. Nobody tested what happens when you try to get a negatively numbered variable from an array, but it's not going @@ -644,41 +647,6 @@ Arrays can naturally store strings: the '$', normally denoting a string variable, before the square brackets that denotes an array index. -Resume of the allowed variable and array scopes ------------------------------------------------ - -+==========+======+=======+ -|VarType | Norm | Array | -+==========+======+=======+ -|$Str$ | OK! | OK! | -+----------+------+-------+ -|$@Str$ | OK! | OK! | -+----------+------+-------+ -|@Str$ | OK! | OK! | -+----------+------+-------+ -|#Str$ | OK! | FAIL! | -+----------+------+-------+ -|Str$ | OK! | FAIL! | -+----------+------+-------+ -|$Int | OK! | OK! | -+----------+------+-------+ -|$@Int | OK! | OK! | -+----------+------+-------+ -|@Int | OK! | OK! | -+----------+------+-------+ -|#Int | OK! | FAIL! | -+----------+------+-------+ -|Int | OK! | FAIL! | -+----------+------+-------+ -|.Str$ | OK! | OK! | -+----------+------+-------+ -|.Int | OK! | OK! | -+----------+------+-------+ -|.@Str$ | OK! | OK! | -+----------+------+-------+ -|.@Int | OK! | OK! | -+----------+------+-------+ - Variable References ------------------- @@ -991,6 +959,7 @@ On