Jump to content

Alignment bug


oserra
 Share

Recommended Posts

Olá, estou com um problema no karma e não faço ideia de onde possa vir a sua origem.

O campo "alignment" existe na base de dados e aumenta consoante tempo/matar monstros(como esperado). O problema é que sempre que entro no jogo o char tem 0 pontos de karma. Com o comando /set char alignment x posso temporariamente alterar o karma dele, mas se mudar de mapa, alterar, etc volta ao 0.

Obrigado

Link to comment
Share on other sites

2 horas atrás, Tierri Lopes disse:

O valor da base de dados volta a 0 quando alteras de mapa, ou o que é mostrado na personagem?

Experimenta usar o comando set novamente, muda de mapa, desliga servidor. Vai à base de dados e vê se o valor foi para 0, ou se na base de dados está correcto e no cliente é que não

O valor na base de dados mantém-se o mesmo, se eu mudar de mapa e estiver parado algum tempo sobe um bocado(tudo normal). Quando uso o comando set o valor na base de dados não muda, mas até pensei que fosse porque demora a atualizar, vou experimentar o que sugeriste.

EDIT: Tinha 0 na base de dados, utilizei o comando set para dar 200 de karma, ficou com 260(depois dos passos todos). Depois tentei meter 2000 karma com o comando set, mudei de mapa, desliguei o servidor e continuava com 260.

source:
 

Spoiler

 

ACMD(do_set)
{
    char arg1[256], arg2[256], arg3[256];

    LPCHARACTER tch = NULL;

    int i, len;
    const char* line;

    line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
    one_argument(line, arg3, sizeof(arg3));

    if (!*arg1 || !*arg2 || !*arg3)
    {
        ch->ChatPacket(CHAT_TYPE_INFO, "Usage: set <name> <field> <value>");
        return;
    }

    tch = CHARACTER_MANAGER::instance().FindPC(arg1);

    if (!tch)
    {
        ch->ChatPacket(CHAT_TYPE_INFO, "%s not exist", arg1);
        return;
    }

    len = strlen(arg2);

    for (i = 0; *(set_fields.cmd) != '\n'; i++)
        if (!strncmp(arg2, set_fields.cmd, len))
            break;

    switch (i)
    {
        case 0:    // gold
            {
                int gold = 0;
                str_to_number(gold, arg3);
                DBManager::instance().SendMoneyLog(MONEY_LOG_MISC, 3, gold);
                int before_gold = tch->GetGold();
                tch->PointChange(POINT_GOLD, gold, true);
                int after_gold = tch->GetGold();
                if (0 == after_gold && 0 != before_gold)
                {
                    LogManager::instance().CharLog(tch, gold, "ZERO_GOLD", "GM");
                }
            }
            break;

        case 1: // race
            break;

        case 2: // sex
            break;

        case 3: // exp
            {
                int amount = 0;
                str_to_number(amount, arg3);
                tch->PointChange(POINT_EXP, amount, true);
            }
            break;

        case 4: // max_hp
            {
                int amount = 0;
                str_to_number(amount, arg3);
                tch->PointChange(POINT_MAX_HP, amount, true);
            }
            break;

        case 5: // max_sp
            {
                int amount = 0;
                str_to_number(amount, arg3);
                tch->PointChange(POINT_MAX_SP, amount, true);
            }
            break;

        case 6: // active skill point
            {
                int amount = 0;
                str_to_number(amount, arg3);
                tch->PointChange(POINT_SKILL, amount, true);
            }
            break;

        case 7: // alignment
        case 8: // alignment
            {
                int    amount = 0;
                str_to_number(amount, arg3);
                tch->UpdateAlignment(amount - tch->GetRealAlignment());
            }
            break;
    }

    if (set_fields.type == NUMBER)
    {
        int    amount = 0;
        str_to_number(amount, arg3);
        ch->ChatPacket(CHAT_TYPE_INFO, "%s's %s set to [%d]", tch->GetName(), set_fields.cmd, amount);
    }
}

 

 

Edited by oserra
Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...