Jump to content
  • 0

[L2jServer H5] Premium account


Question

Posted (edited)

Hello,

i'm working on premium account and i need a little help.

 

I created a database table with premium account data and this data is loaded on player login.

As i saw in L2Attackable.java there is a method doItemDrop and line

 

deathItems = npcTemplate.calculateDrops(DropListScope.DEATH, this, player);

 

so i added

if (player.hasPremium()) {
      deathItems = npcTemplate.calculateDrops(DropListScope.PREMIUMDEATH, this, player);
}
else{
      deathItems = npcTemplate.calculateDrops(DropListScope.DEATH, this, player);
 }

 

To DropListScope i added

PREMIUMDEATH((itemId, min, max, chance) -> new GeneralDropItem(itemId, min, max, chance, IAmountMultiplierStrategy.PREMIUMDROP, IChanceMultiplierStrategy.PREMIUMDROP), GroupedGeneralDropItem::new),

 

To IAmountMultiplierStrategy.java i added

IAmountMultiplierStrategy PREMIUMDROP = DEFAULT_STRATEGY(rates().getDeathDropAmountMultiplier() + rates().getDeathDropAmountMultiplier()/2);

 

To IChanceMultiplierStrategy.java added

IChanceMultiplierStrategy PREMIUMDROP = DEFAULT_STRATEGY(rates().getCorpseDropChanceMultiplier() + rates().getCorpseDropChanceMultiplier()/2);

 

 

Now there is no drop for premium users at all but still works for users w/o premium.
Am I miss something or it's impossible to make it in this way?

 

Best Wishes

 

Update: Problem solved.

I used standard DropListScope Death but i made changes in IChanceMultiplierStrategy DEFAULT_STRATEGY and IAmountMultiplierStrategy DEFAULT_STRATEGY methods.

The trick was to add public property L2PcInstance killer (initialized before call getChanceMultiplier) and read data about premium using victim.killer in DEFAULT_STRATEGY

 

Edited by sylwuu

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Guest
This topic is now closed to further replies.
×
×
  • Create New...