查看: 951|回复: 2

【宗达】GMSv62 小馬端寵物中文名稱修復

[复制链接]
  • TA的每日心情

    2022-12-15 19:48
  • 签到天数: 6 天

    [LV.2]偶尔看看I

    74

    主题

    9

    回帖

    355

    积分

    中级会员

    Rank: 3Rank: 3

    积分
    355
    QQ
    发表于 2022-11-21 15:20:59 | 显示全部楼层 |阅读模式
    在小馬端v62中,
    寵物剛創立出來是中文沒錯,不過登出重新登入寵物名稱就直接變成??了。。。
    修正數據庫連線編碼之後,直接Error code 38錯誤,發送寵物名稱那塊也不支援中文。。
    修正方式如下
    本帖隐藏的内容首先至GenericLittleEndianWriter.java

    • public int getlength(String str) {
    •     int i, t = 0;
    •     byte[] bt = str.getBytes();
    •     for (i = 1; i <= bt.length; i++) {
    •         if (bt[i - 1] < 0) {
    •             t = t + 2;
    •             i++;
    •         } else {
    •             t = t + 1;
    •         }
    •     }
    •     return t;
    • }


    [color=rgb(85, 85, 85) !important]复制代码


    取代為
    • public static final int getlength(final String str) {
    •     byte[] bt = str.getBytes(ASCII);
    •     return bt.length;
    • }


    [color=rgb(85, 85, 85) !important]复制代码



    接著在適當位置加入
    • @Override
    • public void writeAsciiString(String s, int length) {
    •     if (getlength(s) > length) {
    •         s = s.substring(0, length);
    •     }
    •     write(s.getBytes(ASCII));
    •     for (int i = getlength(s); i < length; i++) {
    •         write(0);
    •     }
    • }


    [color=rgb(85, 85, 85) !important]复制代码



    LittleEndianWriter.java
    在適當位置加入
    • public void writeAsciiString(String s, int length);


    [color=rgb(85, 85, 85) !important]复制代码



    MaplePacketCreator.java 找到 (有2段要改)
    • if (petname.length() > 13) {
    •     petname = petname.substring(0, 13);
    • }
    • mplew.writeAsciiString(petname);
    • for (int i = petname.length(); i < 13; i++) {
    • mplew.write(0);
    • }


    [color=rgb(85, 85, 85) !important]复制代码


    改為
    • mplew.writeAsciiString(petname, 13);


    [color=rgb(85, 85, 85) !important]复制代码





    最後則是到 db.properties
    將 url=jdbc:mysql://localhost:3306/pony
    改為 url=jdbc:mysql://localhost:3306/pony?characterEncoding=UTF8
    來使數據庫連線時使用UTF8編碼,避免變成??

    专注于GMS研究,有偿调试架设,全网最低,公益群:915210346。
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2024-6-28 07:37
  • 签到天数: 10 天

    [LV.3]偶尔看看II

    2

    主题

    66

    回帖

    71

    积分

    注册会员

    Rank: 2

    积分
    71
    发表于 2024-6-19 18:25:39 | 显示全部楼层

    666666666666666
    回复

    使用道具 举报

  • TA的每日心情
    慵懒
    2024-7-4 11:28
  • 签到天数: 6 天

    [LV.2]偶尔看看I

    0

    主题

    55

    回帖

    168

    积分

    注册会员

    Rank: 2

    积分
    168
    发表于 2024-6-29 07:38:12 | 显示全部楼层
    666666666666666666666
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    快速回复 返回顶部 返回列表