Jump to content
  • 0

Save Bilds


Scofield

Question


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

My server has the maximum 700 status, this script just put it up to 255. he wanted to fix.

 

 

 

 

 

 

cydonia,116,81,4    script    Salva Bilds    871,{
// == Configurações ==
Set @Npc$,"[ Build Saver ]";    // Nome do Npc.
SetArray @Price[0],1500,200;    // Preço, em Zenys, para utilizar o Npc. O primeiro número é para não Vips e o segundo para Vips.
SetArray @MaxSaves[0],8,20;        // Número máximo de builds a serem salvas. O primeiro número é para não Vips e o segundo para Vips.
Set @CanPrivate,1;                // Nível de GM mínimo para definir build pública/particular.
Set @CanSave,0;                    // Nível de GM mínimo para salvar uma build.
Set @ReqLevel,99;                // Nível de Classe requerido para utilizar o npc.
Set @PopBuilds,10;                // Número de Build Populares para se mostrar.
// ===================
// == Funções ==
function BuildSaver;
// =============
while(true)
{
    Mes @Npc$;
    Mes "Olá "+StrCharInfo(0)+", posso salvar Builds de Stats"+(@Price[(GetGMLevel() ? 1 : 0)]? " por um quantia de "+@Price[(GetGMLevel() ? 1 : 0)]+"z ":"")+" para você!";
    if(Zeny < @Price[(GetGMLevel() ? 1 : 0)])
    {
        Mes "Infelizmente você não tem Zenys para me pagar...";
        close;
    }
    Mes "O que deseja?";
    next;
    switch(select("- Ver Builds Populares","- Ver Minhas Builds","- Salvar Build","- Sair"))
    {
        case 1:
            BuildSaver(0);
            break;
        case 2:
            BuildSaver(1);
            break;
        case 3:
            Mes @Npc$;
            if(GetGMLevel() < @CanSave)
            {
                Mes "Desculpe-me, mas você não está autorizado para salvar Builds.";
                next;
                break;
            }
            query_sql "Select `build_name` From `build_saver` Where `char_id` = "+GetCharID(0),@BName$;
            if(GetArraySize(@BName$) >= @MaxSaves[(GetGMLevel() ? 1 : 0)])
            {
                Mes "Você já salvou o número máximo possível de Builds, por favor apague uma Build se deseja salvar outra.";
                next;
                break;
            }
            if(BaseLevel < @ReqLevel)
            {
                Mes "Desculpe-me, mas você precisa ser, no mínimo, nível "+@ReqLevel+" para poder salvar suas Builds";
                next;
                break;
            }
            Mes "Deseja mesmo salvar sua Build atual?";
            next;
            if(select("- Sim:- Não") == 2)
                break;
            Mes @Npc$;
            Mes "Por favor, digite um nome para sua Build atual:";
            next;
            input @BuildName$,1;
            query_sql "Select `build_name` From `build_saver` Where `build_name` = '"+@BuildName$+"' And `char_id` = "+GetCharID(0),@BName$;
            Mes @Npc$;
            if(@BName$ != "")
            {
                Mes "Você já possui um Build salva com este nome, deseja sobrescrevê-la?";
                next;
                if(select("- Sim:- Não") == 2)
                    break;
                Mes @Npc$;
            }
            if(GetGMLevel() >= @CanPrivate)
            {
                Mes "Deseja que esta Build seja Pública ou Privada?";
                Mes "Se for Pública, qualquer um poderá vê-la e copiá-la, caso seja Particular apenas você a verá.";
                next;
                Set @Public,select("- Pública:- Privada:- Cancelar") - 1;
                if(@Public == 2)
                    break;
                Mes @Npc$;
            }
            Mes "Build Salva com sucesso!";
            Set Zeny, Zeny - @Price[(GetGMLevel() ? 1 : 0)];
            query_sql "Insert Into `build_saver` Values ("+GetCharID(0)+", '"+@BuildName$+"', "+@Public+",'"+StrCharInfo(0)+"', "+Class+", "+BaseLevel+", "+ReadParam(bStr)+", "+ReadParam(bAgi)+", "+ReadParam(bVit)+", "+ReadParam(bInt)+", "+ReadParam(bDex)+", "+ReadParam(bLuk)+",0)";
            next;
            break;
        case 4:
            Mes @Npc$;
            Mes "Até a próxima!";
            close;
    }
}
function    BuildSaver    {
    DeleteArray @BuildName$[0],GetArraySize(@BuildName$);
    DeleteArray @Name$[0],GetArraySize(@Name$);
    DeleteArray @Class[0],GetArraySize(@Class);
    DeleteArray @Lvl[0],GetArraySize(@Lvl);
    DeleteArray @Str[0],GetArraySize(@Str);
    DeleteArray @Agi[0],GetArraySize(@Agi);
    DeleteArray @Vit[0],GetArraySize(@Vit);
    DeleteArray @Int[0],GetArraySize(@Int);
    DeleteArray @Dex[0],GetArraySize(@Dex);
    DeleteArray @Luk[0],GetArraySize(@Luk);
    DeleteArray @Copied[0],GetArraySize(@Copied);
    query_sql "Select `build_name`, `name`, `class`, `lvl`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `copiedtimes` From `build_saver` "+(!GetArg(0,0)?"Where `public` = 0 Order By `copiedtimes` Desc Limit "+@PopBuilds:"Where `char_id` = "+GetCharID(0)),@BuildName$,@Name$,@Class,@Lvl,@Str,@Agi,@Vit,@Int,@Dex,@Luk,@Copied;
    for(Set @i,0; @i < GetArraySize(@BuildName$); Set @i,@i + 1)
    {
        Mes @Npc$;
        Mes "Build \""+@BuildName$[@i]+"\""+(!GetArg(0,0)?" por "+@Name$[@i]+", "+JobName(@Class[@i]):"")+", Lv."+@Lvl[@i];
        Mes "Str: "+@Str[@i];
        Mes "Agi: "+@Agi[@i];
        Mes "Vit: "+@Vit[@i];
        Mes "Int: "+@Int[@i];
        Mes "Dex: "+@Dex[@i];
        Mes "Luk: "+@Luk[@i];
        Mes "Build Copiada "+@Copied[@i]+" vezes.";
        next;
    }
    if(!GetArraySize(@BuildName$))
    {
        Mes @Npc$;
        Mes "Nenhuma Build encontrada.";
        next;
        return;
    }
    if(BaseLevel < @ReqLevel)
        return;
    Mes @Npc$;
    Mes "Deseja aplicar "+(GetArg(0,0)?"ou apagar":"")+" alguma build?";
    next;
    Set @sel1,select((!GetArg(0,0)?"- Sim:- Não":"- Aplicar:- Apagar:- Cancelar")) - 1;
    if(@sel1 == (!GetArg(0,0)? 1 : 2))
        return;
    Mes @Npc$;
    Mes "Qual Build deseja "+(!@sel1?"aplicar":"apagar")+"?";
    next;
    Set @menu$,"";
    for(Set @i,0; @i < GetArraySize(@BuildName$); Set @i,@i + 1)
        if(@menu$ == "") Set @menu$,"Build \""+@BuildName$[@i]+"\" por "+@Name$[@i]+", "+JobName(@Class[@i])+", Lv."+@Lvl[@i];
        else Set @menu$,@menu$+":Build \""+@BuildName$[@i]+"\" por "+@Name$[@i]+", "+JobName(@Class[@i])+", Lv."+@Lvl[@i];
    Set @menu$,@menu$+":Cancelar";
    Set @sel,select(@menu$)-1;
    if(@sel == GetArraySize(@BuildName$))
        return;
    Mes @Npc$;
    if(BaseLevel < @Lvl[@sel])
    {
        Mes "Seu nível é menor do que o da Build \""+@BuildName$[@sel]+"\", portanto você não pode aplicá-la.";
        next;
        return;
    }
    Mes "Deseja mesmo "+(!@sel1?"aplicar":"apagar")+" esta Build?";
    Mes "Build \""+@BuildName$[@sel]+"\""+(!GetArg(0,0)?" por "+@Name$[@i]+", "+JobName(@Class[@i]):"")+", Lv."+@Lvl[@sel];
    Mes "Str: "+@Str[@sel];
    Mes "Agi: "+@Agi[@sel];
    Mes "Vit: "+@Vit[@sel];
    Mes "Int: "+@Int[@sel];
    Mes "Dex: "+@Dex[@sel];
    Mes "Luk: "+@Luk[@sel];
    next;
    if(select("- Sim:- Não") == 2)
        return;
    Mes @Npc$;
    Mes "Build "+(!@sel1?"Aplicada":"Apagada")+"!";
    if(!@sel1)
    {
        if(!GetArg(0,0) && StrCharInfo(0) != @Name$[@sel])
            query_sql "Update `build_saver` Set `copiedtimes` = `copiedtimes` + 1 Where `build_name` = '"+@BuildName$[@sel]+"' And `name` = '"+@Name$[@sel]+"' And `class` = "+@Class[@sel];
        ResetStatus;
        while(ReadParam(bStr) < @Str[@sel] && StatusPoint)
            StatusUp bStr;
        while(ReadParam(bVit) < @Vit[@sel] && StatusPoint)
            StatusUp bVit;
        while(ReadParam(bAgi) < @Agi[@sel] && StatusPoint)
            StatusUp bAgi;
        while(ReadParam(bInt) < @Int[@sel] && StatusPoint)
            StatusUp bInt;
        while(ReadParam(bDex) < @Dex[@sel] && StatusPoint)
            StatusUp bDex;
        while(ReadParam(bLuk) < @Luk[@sel] && StatusPoint)
            StatusUp bLuk;
    }
    else
        query_sql "Delete From `build_saver` Where `build_name` = '"+@BuildName$[@sel]+"' And `char_id` = "+GetCharID(0);
    Set Zeny, Zeny - @Price[(GetGMLevel() ? 1 : 0)];
    next;
    return;
}
OnInit:
    query_sql "Create Table If Not Exists `build_saver` ( `char_id` int(11) unsigned NOT NULL, `build_name` varchar(255) NOT NULL, `public` tinyint(1) unsigned NOT NULL, `name` varchar(255) NOT NULL, `class` mediumint(4) unsigned NOT NULL, `lvl` mediumint(4) unsigned NOT NULL, `str` tinyint(3) unsigned NOT NULL, `agi` tinyint(3) unsigned NOT NULL, `vit` tinyint(3) unsigned NOT NULL, `int` tinyint(3) unsigned NOT NULL, `dex` tinyint(3) unsigned NOT NULL, `luk` tinyint(3) unsigned NOT NULL, `copiedtimes` int(11) unsigned NOT NULL, Primary Key (`char_id`) )";
end;
}
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.01
  • Content Count:  19
  • Reputation:   4
  • Joined:  04/18/23
  • Last Seen:  

On 2/7/2014 at 9:36 AM, Kido said:

You mean builds?

 

i find this pretty useful and simple

 

http://rathena.org/board/topic/68453-utility-build-manager/

 

i also use it for my server lol

would have to make this script work with this function: bypass_max_stat ????

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.01
  • Content Count:  39
  • Reputation:   30
  • Joined:  06/08/23
  • Last Seen:  

On 2/7/2014 at 4:51 AM, cumbe11 said:

My server has the maximum 700 status, this script just put it up to 255. he wanted to fix.

it was the sql table column type that limiting the stats into 255, because it using *tinyint(3)*  change it into *smallint(4)* seem will fix your problem.

On 2/7/2014 at 4:51 AM, cumbe11 said:
OnInit:
    query_sql "Create Table If Not Exists `build_saver` ( `char_id` int(11) unsigned NOT NULL, `build_name` varchar(255) NOT NULL, `public` tinyint(1) unsigned NOT NULL, `name` varchar(255) NOT NULL, `class` mediumint(4) unsigned NOT NULL, `lvl` mediumint(4) unsigned NOT NULL, `str` tinyint(3) unsigned NOT NULL, `agi` tinyint(3) unsigned NOT NULL, `vit` tinyint(3) unsigned NOT NULL, `int` tinyint(3) unsigned NOT NULL, `dex` tinyint(3) unsigned NOT NULL, `luk` tinyint(3) unsigned NOT NULL, `copiedtimes` int(11) unsigned NOT NULL, Primary Key (`char_id`) )";
end;

change into

OnInit:
    query_sql "Create Table If Not Exists `build_saver` ( `char_id` int(11) unsigned NOT NULL, `build_name` varchar(255) NOT NULL, `public` tinyint(1) unsigned NOT NULL, `name` varchar(255) NOT NULL, `class` mediumint(4) unsigned NOT NULL, `lvl` mediumint(4) unsigned NOT NULL, `str` smallint(4) unsigned NOT NULL, `agi` smallint(4) unsigned NOT NULL, `vit` smallint(4) unsigned NOT NULL, `int` smallint(4) unsigned NOT NULL, `dex` smallint(4) unsigned NOT NULL, `luk` smallint(4) unsigned NOT NULL, `copiedtimes` int(11) unsigned NOT NULL, Primary Key (`char_id`) )";
end;

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

You mean builds?

 

i find this pretty useful and simple

 

http://rathena.org/board/topic/68453-utility-build-manager/

 

i also use it for my server lol

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...