Map index numarası ile map'a ışınlanma

  • Konuyu açan Konuyu açan Breacche
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 0
  • Gösterim Gösterim 269

Breacche

Üye
Üye
Mesaj
8
Çözümler
1
Beğeni
13
Puan
408
Ticaret Puanı
0
map'a kordinat ile ışınlama zahmetli geldiği için şöyle bir şey yaptım /goto 72 ( map kodu ile) mapın merkez noktasına ışınlanırsınız




Aç
cmd_gm.cpp
Ara
ACMD(do_goto)

Değiştir


C++:
Genişlet Daralt Kopyala
ACMD(do_goto)
{
    char arg1[256], arg2[256];
    int x = 0, y = 0, z = 0;

    two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));

    if (!*arg1 && !*arg2)
    {
        ch->ChatPacket(CHAT_TYPE_INFO, "Usage: goto <x meter> <y meter>");
        return;
    }

    if (isnhdigit(*arg1) && isnhdigit(*arg2))
    {
        str_to_number(x, arg1);
        str_to_number(y, arg2);

        PIXEL_POSITION p;

        if (SECTREE_MANAGER::instance().GetMapBasePosition(ch->GetX(), ch->GetY(), p))
        {
            x += p.x / 100;
            y += p.y / 100;
        }

        ch->ChatPacket(CHAT_TYPE_INFO, "You goto ( %d, %d )", x, y);
    }
    else if (*arg1 && !*arg2 && isnhdigit(*arg1))
    {
        bool bAllDigits = true;
        for (const char* p = arg1; *p; ++p)
            if (!isdigit(*p)) { bAllDigits = false; break; }

        if (bAllDigits)
        {
            int mapIndexNumber = 0;
            str_to_number(mapIndexNumber, arg1);
            PIXEL_POSITION centerPos;
            if (SECTREE_MANAGER::instance().GetCenterPositionOfMap(mapIndexNumber, centerPos))
            {
                ch->ChatPacket(CHAT_TYPE_INFO, "You goto map %d center ( %d, %d )", mapIndexNumber, centerPos.x, centerPos.y);
                ch->WarpSet(centerPos.x, centerPos.y);
                ch->Stop();
                return;
            }
            else
            {
                ch->ChatPacket(CHAT_TYPE_INFO, "Map %d not found. Usage: /goto <x> <y> | /goto <mapIndex> | /goto <name> [empire]", mapIndexNumber);
                return;
            }
        }
    }
    else
    {
        int mapIndex = 0;
        BYTE empire = 0;

        if (*arg1 == '#')
            str_to_number(mapIndex,  (arg1 + 1));

        if (*arg2 && isnhdigit(*arg2))
        {
            str_to_number(empire, arg2);
            empire = MINMAX(1, empire, 3);
        }
        else
            empire = ch->GetEmpire();

        if (!CHARACTER_GoToName(ch, empire, mapIndex, arg1))
        {
            ch->ChatPacket(CHAT_TYPE_INFO, "Cannot find map. Syntax: /goto <mapname> [empire] | /goto <x> <y> | /goto <mapIndex>");
        }
        return;
    }

    x *= 100;
    y *= 100;

    ch->Show(ch->GetMapIndex(), x, y, z);
    ch->Stop();
}
 
Uyarı: Bu konu açıldığından bu yana baya zaman geçmiş.
Muhtemelen daha fazla tartışma gerekli değildir ki bu durumda yeni bir konu başlatmayı öneririz. Eğer yine de cevabınızın gerekli olduğunu düşünüyorsanız buna rağmen cevap verebilirsiniz.
Geri
Üst