Index: conf/char_athena.conf
===================================================================
--- conf/char_athena.conf (revision 17128)
+++ conf/char_athena.conf (working copy)
@@ -99,12 +99,9 @@
// Start point, Map name followed by coordinates (x,y)
start_point: new_1-1,53,111
-// Starting weapon for new characters
-start_weapon: 1201
+// Starting items for new characters
+start_items: 1201,2301
-// Starting armor for new characters
-start_armor: 2301
-
// Starting zeny for new characters
start_zeny: 0
Index: src/char/char.c
===================================================================
--- src/char/char.c (revision 17128)
+++ src/char/char.c (working copy)
@@ -137,8 +137,7 @@
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[100];
int guild_exp_rate = 100;
//Custom limits for the fame lists. [Skotlex]
@@ -1474,7 +1473,8 @@
char name[NAME_LENGTH];
char esc_name[NAME_LENGTH*2+1];
- int char_id, flag;
+ int char_id, flag, i;
+ StringBuf buf;
safestrncpy(name, name_, NAME_LENGTH);
normalize_name(name,TRIM_CHARS);
@@ -1545,14 +1545,18 @@
//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);
+
+ StringBuf_Init(&buf);
+ StringBuf_Printf(&buf, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ", inventory_db);
+ for( i = 0; start_items[i]; ++i )
+ {
+ if( i > 0 )
+ StringBuf_AppendStr(&buf, ", ");
+ StringBuf_Printf(&buf, "('%d', '%d', '%d', '%d')", char_id, start_items[i], 1, 1);
}
- 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);
- }
+ if( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) )
+ Sql_ShowDebug(sql_handle);
+ StringBuf_Destroy(&buf);
ShowInfo("Created char: account: %d, char: %d, slot: %d, name: %s\n", sd->account_id, char_id, slot, name);
return char_id;
@@ -4613,14 +4617,18 @@
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, "start_items") == 0) {
+ char *tmp = w2;
+ int i, k = 0;
+ for( i = 0; i < sizeof(start_items) && tmp; i++ )
+ {
+ if( !sscanf(tmp, "%d", &start_items[k]) && !sscanf(tmp, ",%d", &start_items[k]) )
+ { tmp = strchr(tmp+1,',');
+ continue;
+ }
+ tmp = strchr(tmp+1,',');
+ k++;
+ }
} else if(strcmpi(w1,"log_char")==0) { //log char or not [devil]
log_char = atoi(w2);
} else if (strcmpi(w1, "unknown_char_name") == 0) {