viewing paste Startring Items | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
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) {
Viewed 1477 times, submitted by Lilith.