viewing paste langtype upd | Diff

Posted on the | Last edited on
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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
Index: conf/msg_conf/map_msg.conf
===================================================================
--- conf/msg_conf/map_msg.conf  (revision 17251)
+++ conf/msg_conf/map_msg.conf  (working copy)
@@ -448,6 +448,7 @@
 461: Langtype is now = %s=>%d
 462: The choosen langage is currently disable please choose another
 463: Msg_conf have been reloaded
+464: Available langages:
 
 // Messages of others (not for GM commands)
 // ----------------------------------------
Index: src/common/msg_conf.c
===================================================================
--- src/common/msg_conf.c   (revision 17251)
+++ src/common/msg_conf.c   (working copy)
@@ -77,18 +77,32 @@
  */
 int msg_langstr2langtype(char * langtype){
    int lang=-1;
-   if(!strncmp(langtype, "eng",2)) lang=0;
-   else if (!strncmp(langtype, "rus",2)) lang = 1;
-   else if (!strncmp(langtype, "spn",2)) lang = 2;
-   else if (!strncmp(langtype, "grm",2)) lang = 3;
-   else if (!strncmp(langtype, "chn",2)) lang = 4;
-   else if (!strncmp(langtype, "mal",2)) lang = 5;
-   else if (!strncmp(langtype, "idn",2)) lang = 6;
-   else if (!strncmp(langtype, "frn",2)) lang = 7;
+   if(!strncmpi(langtype, "eng",2)) lang=0;
+   else if (!strncmpi(langtype, "rus",2)) lang = 1;
+   else if (!strncmpi(langtype, "spn",2)) lang = 2;
+   else if (!strncmpi(langtype, "grm",2)) lang = 3;
+   else if (!strncmpi(langtype, "chn",2)) lang = 4;
+   else if (!strncmpi(langtype, "mal",2)) lang = 5;
+   else if (!strncmpi(langtype, "idn",2)) lang = 6;
+   else if (!strncmpi(langtype, "frn",2)) lang = 7;
 
    return lang;
 }
 
+const char* msg_langtype2langstr(int langtype){
+   switch(langtype){
+       case 0: return "English (ENG)";
+       case 1: return "Russian (RUS)";
+       case 2: return "Spanish (SPN)";
+       case 3: return "German (GRM)";
+       case 4: return "Chinese (CHN)";
+       case 5: return "Malasian (MAL)";
+       case 6: return "Indonesian (IDN)";
+       case 7: return "French (FRN)";
+       default: return "??";
+   }
+}
+
 /*
  * verify that the choosen langtype is enable
  * return
@@ -97,10 +111,10 @@
  * -2 : disable
  */
 int msg_checklangtype(int lang, bool display){
-   uint16 test=1;
+   uint16 test= (1<<(lang-1));
    if(!lang) return 1; //default english
-   else if(lang < 0 && (test<<(lang-1)) > LANG_MAX ) return -1; //false range
-   else if (LANG_ENABLE&(test<<(lang-1)) ) return 1;
+   else if(lang < 0 || test > LANG_MAX) return -1; //false range
+   else if (LANG_ENABLE&test) return 1;
    else if(display) {
        ShowDebug("Unsuported langtype=%d\n",lang);
    }
Index: src/common/msg_conf.h
===================================================================
--- src/common/msg_conf.h   (revision 17251)
+++ src/common/msg_conf.h   (working copy)
@@ -26,6 +26,7 @@
 int _msg_config_read(const char* cfgName,int size, char ** msg_table);
 void _do_final_msg(int size, char ** msg_table);
 int msg_langstr2langtype(char * langtype);
+const char* msg_langtype2langstr(int langtype);
 //verify that the choosen langtype is enable
 int msg_checklangtype(int lang, bool display);
 
Index: src/map/skill.c
===================================================================
--- src/map/skill.c (revision 17251)
+++ src/map/skill.c (working copy)
@@ -1045,7 +1045,7 @@
        if(sd && (skill=pc_checkskill(sd,DC_DANCINGLESSON)))
            rate += 5+skill;
        status_zap(bl, 0, rate);
-       break;
+       break;
    case SL_STUN:
        if (tstatus->size==SZ_MEDIUM) //Only stuns mid-sized mobs.
            sc_start(src,bl,SC_STUN,(30+10*skill_lv),skill_lv,skill_get_time(skill_id,skill_lv));
@@ -15666,7 +15666,7 @@
            {
                struct map_session_data *sd = NULL;
                if(group->val1) {
-                   sd = map_charid2sd(group->val1);
+                   sd = map_charid2sd(group->val1);
                    group->val1 = 0;
                    if (sd && !map[sd->bl.m].flag.nowarp)
                        pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
Index: src/map/battle.c
===================================================================
--- src/map/battle.c    (revision 17251)
+++ src/map/battle.c    (working copy)
@@ -1200,7 +1200,7 @@
    }
 
    if (battle_config.pk_mode && sd && bl->type == BL_PC && damage && map[bl->m].flag.pvp)
-   {
+   {
        if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex]
            if (flag&BF_WEAPON)
                DAMAGE_RATE(battle_config.pk_weapon_damage_rate)
Index: src/map/unit.c
===================================================================
--- src/map/unit.c  (revision 17251)
+++ src/map/unit.c  (working copy)
@@ -924,10 +924,10 @@
            || (sc->data[SC_FEAR] && sc->data[SC_FEAR]->val2 > 0)
            || (sc->data[SC_SPIDERWEB] && sc->data[SC_SPIDERWEB]->val1)
            || (sc->data[SC_DANCING] && sc->data[SC_DANCING]->val4 && (
-                                                                   !sc->data[SC_LONGING] ||
-                                                                   (sc->data[SC_DANCING]->val1&0xFFFF) == CG_MOONLIT ||
-                                                                   (sc->data[SC_DANCING]->val1&0xFFFF) == CG_HERMODE
-                                                                   ) )
+               !sc->data[SC_LONGING] ||
+               (sc->data[SC_DANCING]->val1&0xFFFF) == CG_MOONLIT ||
+               (sc->data[SC_DANCING]->val1&0xFFFF) == CG_HERMODE
+               ) )
            || (sc->data[SC_CLOAKING] && //Need wall at level 1-2
                sc->data[SC_CLOAKING]->val1 < 3 && !(sc->data[SC_CLOAKING]->val4&1))
            )
Index: src/map/atcommand.c
===================================================================
--- src/map/atcommand.c (revision 17251)
+++ src/map/atcommand.c (working copy)
@@ -9088,7 +9088,16 @@
        clif_displaymessage(fd,output); //"English is now set as default language"
    }
    else {
+       int i=0, test=0; char output[512]; //shoud be fine for 50 lang
        clif_displaymessage(fd,msg_txt(sd,462));
+       clif_displaymessage(fd,msg_txt(sd,464));
+       while(test!=-1){ //out of range
+           test = msg_checklangtype(i,false);
+           if(test == 1)
+               sprintf(output,"%s%s => %d\n",output,msg_langtype2langstr(i),i);
+           i++;
+       }
+       clif_displaymessage(fd,output);
    }
 
    return 0;
Viewed 1682 times, submitted by lighta.