[MANUAL] Npc Lvl Up Manager

Тема в разделе "Установка и настройка (Setup and configuration)", создана пользователем root, 27 сен 2014.

  1. root

    root Administrator Команда форума Administrator Moderator Developers Team

    Регистрация:
    23 авг 2014
    Сообщения:
    253
    Симпатии:
    56
    Баллы:
    11
    AI:
    Код:
    class 1 lvl_up : citizenparameter_define_begin
        string fnHi "lvl_up_main.htm"
        string failed "lvl_up_fail.htm"
    parameter_define_end
    handler 3 38    //  TALKED
        variable_begin
            "talker"
            "myself"
            "_choiceN"
            "_code"
            "_from_choice"
        variable_end
    
    
        push_event    //  talker
        push_const 40
        add
        fetch_i    //  karma
        push_const 468
        add
        fetch_i4
        push_const 0
        equal
        branch_false L2
    L1
        push_event    //  myself
        push_const 704
        add
        fetch_i
        push_event    //  talker
        push_const 40
        add
        fetch_i
        push_parameter fnHi
        func_call 184680516    //  func[ShowPage]
        shift_sp -2
        shift_sp -1
        jump L3
    L2
        push_event    //  myself
        push_const 704
        add
        fetch_i
        push_event    //  talker
        push_const 40
        add
        fetch_i
        push_parameter failed
        func_call 184680516    //  func[ShowPage]
        shift_sp -2
        shift_sp -1
    L3
    handler_end
    
    
    handler 32 165    //  MENU_SELECTED
        variable_begin
            "talker"
            "ask"
            "reply"
            "myself"
            "_choiceN"
            "_code"
            "_from_choice"
        variable_end
    
    
        push_event    //  ask
        push_const 160
        add
        fetch_i4
        push_const 1
        equal
        push_reg_sp
        fetch_i
        branch_false L6
        push_event    //  reply
        push_const 164
        add
        fetch_i4
        push_const 1
        equal
        and
    L6
        branch_false L5
    L4
        push_event    //  myself
        push_const 704
        add
        fetch_i
        push_event    //  talker
        push_const 40
        add
        fetch_i
        push_const 0
        push_const 15422851
        func_call 184746219    //  func[IncrementParam]
        shift_sp -3
        shift_sp -1
    L5
        push_event    //  ask
        push_const 160
        add
        fetch_i4
        push_const 1
        equal
        push_reg_sp
        fetch_i
        branch_false L9
        push_event    //  reply
        push_const 164
        add
        fetch_i4
        push_const 2
        equal
        and
    L9
        branch_false L8
    L7
        push_event    //  myself
        push_const 704
        add
        fetch_i
        push_event    //  talker
        push_const 40
        add
        fetch_i
        push_const 0
        push_const 63907585
        func_call 184746219    //  func[IncrementParam]
        shift_sp -3
        shift_sp -1
    L8
        push_event    //  ask
        push_const 160
        add
        fetch_i4
        push_const 1
        equal
        push_reg_sp
        fetch_i
        branch_false L12
        push_event    //  reply
        push_const 164
        add
        fetch_i4
        push_const 3
        equal
        and
    L12
        branch_false L11
    L10
        push_event    //  myself
        push_const 704
        add
        fetch_i
        push_event    //  talker
        push_const 40
        add
        fetch_i
        push_const 0
        push_const 146307211
        func_call 184746219    //  func[IncrementParam]
        shift_sp -3
        shift_sp -1
    L11
        push_event    //  ask
        push_const 160
        add
        fetch_i4
        push_const 1
        equal
        push_reg_sp
        fetch_i
        branch_false L15
        push_event    //  reply
        push_const 164
        add
        fetch_i4
        push_const 4
        equal
        and
    L15
        branch_false L14
    L13
        push_event    //  myself
        push_const 704
        add
        fetch_i
        push_event    //  talker
        push_const 40
        add
        fetch_i
        push_const 0
        push_const 931275828
        func_call 184746219    //  func[IncrementParam]
        shift_sp -3
        shift_sp -1
    L14
        push_event    //  ask
        push_const 160
        add
        fetch_i4
        push_const 1
        equal
        push_reg_sp
        fetch_i
        branch_false L18
        push_event    //  reply
        push_const 164
        add
        fetch_i4
        push_const 5
        equal
        and
    L18
        branch_false L17
    L16
        push_event    //  myself
        push_const 704
        add
        fetch_i
        push_event    //  talker
        push_const 40
        add
        fetch_i
        push_const 0
        push_const 4200000000
        func_call 184746219    //  func[IncrementParam]
        shift_sp -3
        shift_sp -1
    L17
    handler_end
    
    
    class_end
    NASC:
    Код:
    class 1 lvl_up : citizen{
    parameter:
      string  fnHi = "lvl_up_main.htm";
      string  failed = "lvl_up_fail.htm";
    
    
    handler:
      EventHandler TALKED( talker )
      {
        if( talker.karma == 0 )
        {
          myself::ShowPage( talker, fnHi );
        }
        else
        {
          myself::ShowPage( talker, failed );
        }
      }
    
    
      EventHandler MENU_SELECTED( talker, ask, reply )
      {
        if( ask == 1 && reply == 1 )
        {
          myself::IncrementParam( talker, 0, 15422851 );
        }
        if( ask == 1 && reply == 2 )
        {
          myself::IncrementParam( talker, 0, 63907585 );
        }
        if( ask == 1 && reply == 3 )
        {
          myself::IncrementParam( talker, 0, 146307211 );
        }
        if( ask == 1 && reply == 4 )
        {
          myself::IncrementParam( talker, 0, 931275828 );
        }
        if( ask == 1 && reply == 5 )
        {
          myself::IncrementParam( talker, 0, 2147483647 );
        }
      }
    }