summaryrefslogblamecommitdiff
path: root/npc/003-10/arnea.txt
blob: d2f6979e6ba6dc6ce6f998501a96db18e0f64dab (plain) (tree)
1
2
3
4
5
6
7
8
9




               
                                            
 
                                           
                         

                                                                                    
 

           

                                                       
        
                                            
                                              
                                                         







                                                            
                    
     
 




                                                                      
                                                                                       
                                       
                                                           
                                                   





                                                                        
                                         
                                         





                                                                                 
                       
                                                                      


                                                                           


                     
                                                                  
                                                  

           
                                                           
                                           
                                                                          
         
 
                

 
            
            

                          

           


                                                                                                   
                                                    
                  
                                             








                                                                                      



          









                                            
 
       




                                                             






                                                                                                    

          
       
                               
                                               
                                                      

                                                     




                                            
                                                                        
                
           
 

                       

        









                                                                                          
 
 
// TMW2 Scripts
// Author:
//    4144
//    Jesusalva
// Description:
//    Arena for Duels and PVP (003-13,31,31)

003-10,26,60,0	script	Arnea	NPC_ELF_F,{
    npctalk3 l("Hello!");
	if (gettime(GETTIME_MONTH) == DECEMBER)
		mes("It's December! The arena will close for new year, be warned!");

L_Menu:
    mes "";
    mesn;
    mesq l("Welcome to the Arena. Select your action");
    menu
        //l("Create new arena"), L_NewArena,
        l("Join existing arena"), L_JoinArena,
        rif(is_staff(), l("Debug Information")), L_Debug,
        l("Information"), L_Info,
        l("Leave"), L_Quit;

L_NewArena:
    mes "";
    mesn;
    if (Zeny < .price) {
        mesq l("You need @@ GP to use this arena.", .price);
        goto L_Menu;
    }

    mesq l("Okay, which arena will you rent? Cost is @@ GP.", .price);
    menu
        rif(Zeny > .price, l("Rent arena")), -,
        l("Give Up"), L_Quit;

    // Register to HTTable $@ARENAS (or override existing entry) your ID and a password
    //.@PASSWORD=(getcharid(0)**1.137);
    .@PASSWORD=(gettime(7)*4)+24+getcharid(0)+getcharid(3);
    htput($@ARENAS, str(.@PASSWORD), getcharid(0));

    // XXX - Important Note - XXX
    // map name MUST be only 4 chars long (eg. "abcd") on char instances
    .@ID=getcharid(0);
    .@MAP$="AREN@"+str(.@ID);

    // Check if arena was already created
    if(has_instance2("AREN@"+.@ID) < 0) {
        mesn;
        mesq l("You already purchased an arena, and password is @@", .@PASSWORD);
        next;
        goto L_Menu;
    }

    // Create the arena
    .@INSTID = instance_create("ARX@"+(.@ID), getcharid(3), IOT_CHAR);
    .@instanceMapName$ = instance_attachmap("003-13", .@INSTID, 0, .@MAP$);
    instance_set_timeout(1800, 1800, .@INSTID);
    instance_init(.@INSTID);

    Zeny=Zeny-.price;

    dispbottom l("Arena created, it can be used for 30 minutes.");
    dispbottom l("Room password: @@", .@PASSWORD);
    mes "";
    mesn;
    mes l("Arena created, it can be used for 30 minutes.");
    mes l("Room password: @@", .@PASSWORD);
    if (is_staff()) mes l("Inst @@ Map @@", .@INSTID, .@instanceMapName$);
    next;

    goto L_Menu;


L_JoinArena:
    // FIXME
    warp "003-13", 31, 31;
    close;
    mes "";
    mesn;
    mesq l("Okay, to join an arena, you need the unique password. Leave blank if you don't know.");

    input .@user_password;
    .@m = htget($@ARENAS, str(.@user_password), -1);
    if (.@m > 0) {
        if(has_instance2("AREN@"+.@m) >= 0) {
            warp "AREN@"+str(.@m), 31,31;
        } else {
            mes "";
            mesn;
            mesq l("Sorry, that arena is already closed.");
            next;
            mesn;
            mesq l("All arenas stay open for only 30 minutes after being purchased.");
        }
    }
    close;


L_Debug:
    mes "npc name: " + .name$;
    mes "npc ext name: " + .extname$;
    mes "npc id: " + .id;
    mes "npc parent id: " + .parent;
    mes "npc src id: " + .srcId;
    mes "char id 3: " + getcharid(3);
    if (instance_id() >= 0)
        mes "instance id: " + instance_id();
    goto L_Menu;

L_Info:
    mesn;
    mesq lg("Hello darling.");
    next;
    mesq l("I am @@, and I take care of the Arena.", .name$);
    next;
    mesq l("Guards use it to spar against each other on friendly matches, to see who is stronger.");
    next;
    mesq l("We arranged a small underground room for that, while the Colliseum doesn't get done.");
    next;
    goto L_Menu;

L_Quit:
    close;

OnInit:
    .@npcId = getnpcid(.name$);
    setunitdata(.@npcId, UDT_HEADTOP, Darkelm);
    setunitdata(.@npcId, UDT_HEADMIDDLE, CopperArmor);
    setunitdata(.@npcId, UDT_HEADBOTTOM, JeansChaps);
    setunitdata(.@npcId, UDT_WEAPON, RockKnife);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 18);

    .sex = G_FEMALE;
    .distance = 5;
    //.alwaysVisible = true; // This is dumb, why Jesusalva put it here?
    .price=1000;
    npcsit;

    // create hashtable
    $@ARENAS = htnew();
    end;

// Protect bugs by disabling NPC on new year. This NPC have two days off for vacations B-)
OnDay1231:
OnDay0101:
    disablenpc(.name$);
    end;

OnDay0102:
    enablenpc(.name$);
    end;

}