summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatheus Macabu <mkbu95@gmail.com>2013-04-20 20:40:46 -0300
committerMatheus Macabu <mkbu95@gmail.com>2013-04-20 20:40:53 -0300
commit5dbbbab3fbba59da139e52da4a09ab93d94b3f27 (patch)
treeac27c6896202ec3f69275c6e781dce1eeb26561e /src
parent37e37c14d95a6246f2f3b6965911fcc48d074dd7 (diff)
downloadhercules-5dbbbab3fbba59da139e52da4a09ab93d94b3f27.tar.gz
hercules-5dbbbab3fbba59da139e52da4a09ab93d94b3f27.tar.bz2
hercules-5dbbbab3fbba59da139e52da4a09ab93d94b3f27.tar.xz
hercules-5dbbbab3fbba59da139e52da4a09ab93d94b3f27.zip
* Added support for up to 32 items in starting items (the items you receive when creating a new character).
Signed-off-by: Matheus Macabu <mkbu95@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/char/char.c b/src/char/char.c
index ce0d067a7..782036647 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -125,8 +125,7 @@ int max_connect_user = -1;
int gm_allow_group = -1;
int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
int start_zeny = 0;
-int start_weapon = 1201;
-int start_armor = 2301;
+int start_items[64]; //32 starting items allowed [mkbu95]
int guild_exp_rate = 100;
//Custom limits for the fame lists. [Skotlex]
@@ -1530,7 +1529,7 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag
char name[NAME_LENGTH];
char esc_name[NAME_LENGTH*2+1];
- int char_id, flag;
+ int char_id, flag, k;
safestrncpy(name, name_, NAME_LENGTH);
normalize_name(name,TRIM_CHARS);
@@ -1594,13 +1593,10 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag
//Retrieve the newly auto-generated char id
char_id = (int)Sql_LastInsertId(sql_handle);
//Give the char the default items
- if (start_weapon > 0) { //add Start Weapon (Knife?)
- if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", inventory_db, char_id, start_weapon, 1, 1) )
- Sql_ShowDebug(sql_handle);
- }
- if (start_armor > 0) { //Add default armor (cotton shirt?)
- if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", inventory_db, char_id, start_armor, 1, 1) )
- Sql_ShowDebug(sql_handle);
+
+ for (k = 0; k < ARRAYLENGTH(start_items) && start_items[k] != 0; k += 2) {
+ if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", inventory_db, char_id, start_items[k], start_items[k + 1], 1) )
+ Sql_ShowDebug(sql_handle);
}
ShowInfo("Created char: account: %d, char: %d, slot: %d, name: %s\n", sd->account_id, char_id, slot, name);
@@ -4812,18 +4808,29 @@ int char_config_read(const char* cfgName)
ShowError("Specified start_point %s not found in map-index cache.\n", map);
start_point.x = x;
start_point.y = y;
+ } else if (strcmpi(w1, "start_items") == 0) {
+ int i;
+ char *split, *split2;
+
+ i = 0;
+ split = strtok(w2, ",");
+ while (split != NULL) {
+ split2 = split;
+ split = strtok(NULL, ",");
+ start_items[i] = atoi(split2);
+ if (start_items[i] < 0)
+ start_items[i] = 0;
+ ++i;
+ }
+
+ if (i%2) { //we know it must be a even number
+ ShowError("Specified 'start_items' is missing a parameter. Removing '%d'.\n", start_items[i - 1]);
+ start_items[i - 1] = 0;
+ }
} else if (strcmpi(w1, "start_zeny") == 0) {
start_zeny = atoi(w2);
if (start_zeny < 0)
start_zeny = 0;
- } else if (strcmpi(w1, "start_weapon") == 0) {
- start_weapon = atoi(w2);
- if (start_weapon < 0)
- start_weapon = 0;
- } else if (strcmpi(w1, "start_armor") == 0) {
- start_armor = atoi(w2);
- if (start_armor < 0)
- start_armor = 0;
} else if(strcmpi(w1,"log_char")==0) { //log char or not [devil]
log_char = atoi(w2);
} else if (strcmpi(w1, "unknown_char_name") == 0) {