summaryrefslogblamecommitdiff
path: root/npc/functions/mobpoint.txt
blob: 339e3026c83a683f51740a5c0ee8448e0eb74d5b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12




                                                                               






                                                      
                                         

                 

                             
 
                                    


                                                                         
                         
        




                               

                                                                    








                                                                  
                             



           
                                            

        

                                        
                                                                                                      

        
               
                        
 
                           
                                                                    
      
      
                                                                 

                                                
     
 

                                        
            
 
                     
                        
                         
                            
                             
                                  
                                         
                             
                            
                         
                      
 

                                                                    
                
        
 
                                                      
                                                                             
                                                                  
              

                       

        
 
// TMW2 Scripts
// Author: Crazyfefe
//         Jesusalva
// Desc:   Mob Points for Aidan & Ishi. You will gain MONSTER-LEVEL mob points.

// fix_mobkill(mobID) → Manual fix for scripted mobs
function	script	fix_mobkill	{
    killedrid=getarg(0);
    doevent "#mobptsys::OnNPCKillEvent";
    return;
}

function	script	mobpoint	{
    if (!MPQUEST)
        return;
    if (!killedrid) // A bug!
        return;

    .@moblv=strmobinfo(3,killedrid);
    // You get MobLv + 20% as MobPoints.
    // So a level 100 monster gives you 120 MobPt. Slimes gives no bonus.
    if (compare("slime", strtolower(strmobinfo(1, killedrid))))
        .@addval=.@moblv;
    else
        .@addval=.@moblv*12/10;

    // Penalty/Bonus
    .@base=(.@moblv-BaseLevel);
    if (BaseLevel < .@moblv) {
        // Target is stronger, +3% per monster level, capped at +75%
        .@addval = .@addval * limit(100, 100+(.@base*3), 175) / 100;
    } else if (BaseLevel > .@moblv) {
        // Target is weaker, -1% per monster level, capped at -50%
        .@addval = .@addval * limit(50, 101+.@base, 100) / 100;
    }

    // Sanitization
    .@addval=max(0, .@addval);

    // Grant you the Monster Points
    Mobpt = Mobpt + .@addval;
    return;

}

-	script	#mobptsys	NPC_HIDDEN,{
    end;

OnUnlock:
    if (checkpcblock() & PCBLOCK_ATTACK)
        setpcblock(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_MOVE|PCBLOCK_COMMANDS, false);
    end;

OnNPCKillEvent:
    $MONSTERS_KILLED+=1;

    // Remove undue Job exp
    // The check is probably correct, but setparam is not working =/
    /*
    */
    if (strmobinfo(7, killedrid) == 0 && readparam(JobExp) > 0) {
        //setparam(JobExp, readparam(JobExp)-1);
        JobExp-=1;
    }

    // killedrid was not set, so we skip
    if (!killedrid)
        end;

    // call functions
    callfunc "mobpoint";
    callfunc "mobhunter";
    callfunc "SQuest_Hasan";
    callfunc "SaggyMobCount";
    callfunc "dausen_mobtutorial";
    callfunc "Guardhouse_RandQuestCheck";
    callfunc "AuroraMobkill";
    callfunc "ChocolateDay";
    callfunc "CoffeeDay";
    callfunc "FSFDay";

    // Unset killedrid. This affects multiple calls of this function
    // But it is in overall more reliable imao
    killedrid=0;
    end;

// When you kill a player, some special care is needed
// Only a few maps will give you experience for PK: Tulimshar's Guards Arena,
// Frostia Imperial PVP Arena, Call Of Dusty, Arena Quirino Voraz.
OnPCKillEvent:
    // call functions
    callfunc "HUB_PvP";
    end;

}