Yardım Martysama SDK içeriğinin, Mainline Uyarlanması Hk.

  • Konuyu açan Konuyu açan IFS
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 3
  • Gösterim Gösterim 1K
Konu sahibi bu konuda soru soruyor. Sorusu ile ilgili bilgisi olanların yanıtlamasını bekliyor.

IFS

Yasaklanmış Üye
Cezalı
Mesaj
258
Çözümler
6
Beğeni
214
Puan
779
Ticaret Puanı
0
Merhabalar,

Martysama sistemlerinde çalışabilen özel bir modülümün, Mainline alt yapısında çalışabilmesi için uğraşıyor ve çabalıyorum. Yalnız bir konuda takıldım ve bilgi almak için danışmaya karar verdim.

1. Problem; [input_main.cpp]

C++:
Genişlet Daralt Kopyala
[input_main.cpp]
search ::Chat:

    int len;
    char chatbuf[CHAT_MAX_LEN + 1];
    len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), strContent.c_str());

///replace:
#ifdef ENABLE_RANK_SYSTEM
    int len;
    char chatbuf[CHAT_MAX_LEN + 1];
    char rank[64];
    snprintf(rank, sizeof(rank), "|rank|%s|", ch->RankConvert(ch->GetRank()));
    len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", rank, ch->GetName(), strContent.c_str());
#else
    len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), strContent.c_str());
#endif


Martysama içeriğine ait bu eklenmesi gereken kodun, maalesef benim [input_main.cpp] kaynağımda bulunduğu şekli ise şu tarzda;
C++:
Genişlet Daralt Kopyala
    char chatbuf[CHAT_MAX_LEN + 1];
    int len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), buf);

Bunun [input_main.cpp] Mainline uyarlanmış halini benimle paylaşabilir misiniz?

2. Problemim ise şu şekildedir; [cmd_gm.cpp]

C++:
Genişlet Daralt Kopyala
///search:
namespace DoSetTypes{
typedef enum do_set_types_s {GOLD, RACE, SEX, JOB, EXP, MAX_HP, MAX_SP, SKILL, ALIGNMENT, ALIGN

///add:
#ifdef ENABLE_RANK_SYSTEM
    , RANK, RANK_POINT
#endif

///search:
    { "align",        NUMBER,    NULL    },

///add:
#ifdef ENABLE_RANK_SYSTEM
    { "rank",        NUMBER,    NULL    },
    { "rank_point",    NUMBER,    NULL    },
#endif

///search:
        case DoSetTypes::ALIGN: // alignment
        case DoSetTypes::ALIGNMENT: // alignment
            {
                int    amount = 0;
                str_to_number(amount, arg3);
#ifdef ENABLE_UPDATE_ALIGNMENT_FIX
                tch->UpdateAlignment(amount - tch->GetRealAlignment());
#else
                tch->UpdateAlignment(amount - ch->GetRealAlignment());
#endif
            }
            break;

///add:
#ifdef ENABLE_RANK_SYSTEM
        case DoSetTypes::RANK:
            {
                int rank = 0;
                str_to_number(rank, arg3);
                tch->SetRank(rank);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
          
        case DoSetTypes::RANK_POINT:
            {
                int rank_point = 0;
                str_to_number(rank_point, arg3);
                tch->SetRankPoint(rank_point);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
#endif

Bu kısımda ise DoSetTypes:: bölümünde takılıyorum.
Martysama içeriğine ait bu eklenmesi gereken kodun, maalesef benim [cmd_gm.cpp] kaynağımda bulunduğu şekle göre uyarlamaya çalıştığım düzen ise şu tarzda;

UYARLANMASI GEREKEN;
C++:
Genişlet Daralt Kopyala
///search:
namespace DoSetTypes{
typedef enum do_set_types_s {GOLD, RACE, SEX, JOB, EXP, MAX_HP, MAX_SP, SKILL, ALIGNMENT, ALIGN

///add:
#ifdef ENABLE_RANK_SYSTEM
    , RANK, RANK_POINT
#endif

///search:
    { "align",        NUMBER,    NULL    },

///add:
#ifdef ENABLE_RANK_SYSTEM
    { "rank",        NUMBER,    NULL    },
    { "rank_point",    NUMBER,    NULL    },
#endif

///search:
        case DoSetTypes::ALIGN: // alignment
        case DoSetTypes::ALIGNMENT: // alignment
            {
                int    amount = 0;
                str_to_number(amount, arg3);
#ifdef ENABLE_UPDATE_ALIGNMENT_FIX
                tch->UpdateAlignment(amount - tch->GetRealAlignment());
#else
                tch->UpdateAlignment(amount - ch->GetRealAlignment());
#endif
            }
            break;

///add:
#ifdef ENABLE_RANK_SYSTEM
        case DoSetTypes::RANK:
            {
                int rank = 0;
                str_to_number(rank, arg3);
                tch->SetRank(rank);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
          
        case DoSetTypes::RANK_POINT:
            {
                int rank_point = 0;
                str_to_number(rank_point, arg3);
                tch->SetRankPoint(rank_point);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
#endif

UYARLAMAYA ÇALIŞTIĞIM:

1. Bölüm: (Maalesef bu kısmı atlamak zorunda kalıyorum)

C++:
Genişlet Daralt Kopyala
#ifdef ENABLE_RANK_SYSTEM
    , RANK, RANK_POINT
#endif

C++:
Genişlet Daralt Kopyala
#define MISC    0
#define BINARY  1
#define NUMBER  2

const struct set_struct
{
    const char *cmd;
    const char type;
} set_fields[] = {
    { "gold",        NUMBER    },
    { "race",        BINARY    },
    { "sex",        BINARY    },
    { "exp",        NUMBER    },
    { "max_hp",        NUMBER    },
    { "max_sp",        NUMBER    },
    { "skill",        NUMBER    },
    { "alignment",    NUMBER    },
    { "align",        NUMBER    },
#ifdef ENABLE_RANK_SYSTEM
    { "rank",        NUMBER    },
    { "rank_point",    NUMBER    },
#endif
    { "wp",            NUMBER    },
    { "evolution",    NUMBER    },
    #ifdef ENABLE_CHEQUE_SYSTEM
    { "cheque",        NUMBER    },
    #endif
    #ifdef __GAYA_SYSTEM__
    { "gaya",        NUMBER    },
    #endif
    #ifdef ENABLE_REBIRT_SYSTEM
    { "rebirt",        NUMBER    },
    #endif
    #ifdef ENABLE_YOUTUBER_TAG_SYSTEM
    { "youtuber",    NUMBER    },
    #endif
    #ifdef ENABLE_TWITCHER_TAG_SYSTEM
    { "twitcher",    NUMBER    },
    #endif
    { "\n",        MISC    }
};

C++:
Genişlet Daralt Kopyala
#ifdef ENABLE_RANK_SYSTEM
        case 16:
            {
                int rank = 0;
                str_to_number(rank, arg3);
                tch->SetRank(rank);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
          
        case 17:
            {
                int rank_point = 0;
                str_to_number(rank_point, arg3);
                tch->SetRankPoint(rank_point);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
#endif
    }

UYARLANMASI GEREKEN;
C++:
Genişlet Daralt Kopyala
#ifdef ENABLE_RANK_SYSTEM
        case DoSetTypes::RANK:
            {
                int rank = 0;
                str_to_number(rank, arg3);
                tch->SetRank(rank);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
          
        case DoSetTypes::RANK_POINT:
            {
                int rank_point = 0;
                str_to_number(rank_point, arg3);
                tch->SetRankPoint(rank_point);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
#endif

UYARLAMAYA ÇALIŞTIĞIM [SON]:

C++:
Genişlet Daralt Kopyala
#ifdef ENABLE_RANK_SYSTEM
        case 16:
            {
                int rank = 0;
                str_to_number(rank, arg3);
                tch->SetRank(rank);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
          
        case 17:
            {
                int rank_point = 0;
                str_to_number(rank_point, arg3);
                tch->SetRankPoint(rank_point);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
#endif
    }


UYARLAMAK İSTEYENLER İÇİN HAZIR DOSYALAR;

input_main.cpp

Anlatım Kod:

C++:
Genişlet Daralt Kopyala
///search ::Chat:
    int len;
    char chatbuf[CHAT_MAX_LEN + 1];
    len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), strContent.c_str());

///replace:
#ifdef ENABLE_RANK_SYSTEM
    int len;
    char chatbuf[CHAT_MAX_LEN + 1];
    char rank[64];
    snprintf(rank, sizeof(rank), "|rank|%s|", ch->RankConvert(ch->GetRank()));
    len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", rank, ch->GetName(), strContent.c_str());
#else
    len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), strContent.c_str());
#endif


Uyarlanacak Kod:
Linkleri görebilmek için giriş yap veya kayıt ol.


cmd_gm.cpp

Anlatım Kod;

C++:
Genişlet Daralt Kopyala
///search:
namespace DoSetTypes{
typedef enum do_set_types_s {GOLD, RACE, SEX, JOB, EXP, MAX_HP, MAX_SP, SKILL, ALIGNMENT, ALIGN

///add:
#ifdef ENABLE_RANK_SYSTEM
    , RANK, RANK_POINT
#endif

///search:
    { "align",        NUMBER,    NULL    },

///add:
#ifdef ENABLE_RANK_SYSTEM
    { "rank",        NUMBER,    NULL    },
    { "rank_point",    NUMBER,    NULL    },
#endif

///search:
        case DoSetTypes::ALIGN: // alignment
        case DoSetTypes::ALIGNMENT: // alignment
            {
                int    amount = 0;
                str_to_number(amount, arg3);
#ifdef ENABLE_UPDATE_ALIGNMENT_FIX
                tch->UpdateAlignment(amount - tch->GetRealAlignment());
#else
                tch->UpdateAlignment(amount - ch->GetRealAlignment());
#endif
            }
            break;

///add:
#ifdef ENABLE_RANK_SYSTEM
        case DoSetTypes::RANK:
            {
                int rank = 0;
                str_to_number(rank, arg3);
                tch->SetRank(rank);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
          
        case DoSetTypes::RANK_POINT:
            {
                int rank_point = 0;
                str_to_number(rank_point, arg3);
                tch->SetRankPoint(rank_point);
                tch->ComputePoints();
                tch->PointsPacket();
                tch->UpdatePacket();
            }
            break;
#endif

Uyarlanacak Kod;
Linkleri görebilmek için giriş yap veya kayıt ol.


Çok dağınık oldu galiba, ancak kafamdaki dağınıklığı da anlayacağınızı düşünüyorum gerçekten aklımı yitirmek üzereyim, yardımcı olabilirseniz çok sevinirim.

Keyifli forumlar dilerim.
 
En son bir moderatör tarafından düzenlenmiş:
İçeriğiniz düzenlendi, sonraki seferlerde "</>" şeklinde olan icon'a basıp kod editörüyle eklerseniz daha okunur bir konu olur.
 
Marty uyumlu bir sistemi mi eklemeye çalışıyorsunuz? Şayet öyleyse böyle uyarlamak yerine mainline vb. için olan versiyonlarını ekleyebilirsiniz.

Konuyu tam kavrayamadım, çünkü kodda farklılık olarak gördüğüm bölümlerden bir tanesini "strContent.c_str" denemek için elimdeki sıfır marty source da arattım ve 0 sonuç. Sanırım bunun marty ile de bir alakası yok, kişisel bir düzenleme olabilir. Ancak yinede strContent.c_str yerine sizde olduğu gibi buf kullanmayı deneyebilirsiniz.

Diğer kısımları da, yukarıda yazdığım gibi temel yapıyı değiştirmeden aktarmayı deneyin.
 
Üst