Addition of optional GiveXp level and percentage parameters.
This commit is contained in:
		| @@ -18,6 +18,7 @@ package handlers.effecthandlers; | ||||
|  | ||||
| import org.l2jmobius.gameserver.model.StatSet; | ||||
| import org.l2jmobius.gameserver.model.actor.Creature; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.model.effects.AbstractEffect; | ||||
| import org.l2jmobius.gameserver.model.item.instance.Item; | ||||
| import org.l2jmobius.gameserver.model.skill.Skill; | ||||
| @@ -29,10 +30,14 @@ import org.l2jmobius.gameserver.model.skill.Skill; | ||||
| public class GiveXp extends AbstractEffect | ||||
| { | ||||
| 	private final long _xp; | ||||
| 	private final int _level; | ||||
| 	private final double _percentage; | ||||
| 	 | ||||
| 	public GiveXp(StatSet params) | ||||
| 	{ | ||||
| 		_xp = params.getLong("xp", 0); | ||||
| 		_level = params.getInt("level", 0); | ||||
| 		_percentage = params.getDouble("percentage", 0); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| @@ -49,6 +54,17 @@ public class GiveXp extends AbstractEffect | ||||
| 			return; | ||||
| 		} | ||||
| 		 | ||||
| 		effector.getActingPlayer().addExpAndSp(_xp, 0); | ||||
| 		final Player player = effector.getActingPlayer(); | ||||
| 		final double amount; | ||||
| 		if (player.getLevel() < _level) | ||||
| 		{ | ||||
| 			amount = (_xp / 100.0) * _percentage; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			amount = _xp; | ||||
| 		} | ||||
| 		 | ||||
| 		player.addExpAndSp(amount, 0); | ||||
| 	} | ||||
| } | ||||
| @@ -189,9 +189,18 @@ | ||||
| 		<!-- Double-click to obtain 1 billion XP. If character s level is lower than 99, the effectiveness is only 20%. Required level: 85+. --> | ||||
| 		<set name="icon" val="icon.bm_nebit_exp_book" /> | ||||
| 		<set name="default_action" val="SKILL_REDUCE" /> | ||||
| 		<set name="etcitem_type" val="SCROLL" /> | ||||
| 		<set name="material" val="PAPER" /> | ||||
| 		<set name="reuse_delay" val="3000" /> | ||||
| 		<set name="is_sellable" val="false" /> | ||||
| 		<set name="is_stackable" val="true" /> | ||||
| 		<set name="handler" val="ItemSkills" /> | ||||
| 		<cond msgId="113" addName="1"> | ||||
| 			<player level="85" /> | ||||
| 		</cond> | ||||
| 		<skills> | ||||
| 			<skill id="18798" level="1" /> <!-- Shining Scroll of Growth --> | ||||
| 		</skills> | ||||
| 	</item> | ||||
| 	<item id="47920" name="Greater Vital Stone Lv. 1" additionalName="30-day" type="Armor"> | ||||
| 		<!-- Vitality bonus +50%, Vitality Consumption -15%, acquired XP/ SP +10%. Enables the Vital Wind skill. Effects of two identical jewels do not stack, the higher-level jewel takes precedence. --> | ||||
|   | ||||
| @@ -2346,7 +2346,19 @@ | ||||
| 		<icon>icon.bm_nebit_exp_book</icon> | ||||
| 		<operateType>A1</operateType> | ||||
| 		<isMagic>4</isMagic> | ||||
| 		<itemConsumeCount>1</itemConsumeCount> | ||||
| 		<itemConsumeId>47919</itemConsumeId> <!-- Shining Scroll of Growth --> | ||||
| 		<reuseDelay>3000</reuseDelay> | ||||
| 		<staticReuse>true</staticReuse> | ||||
| 		<targetType>SELF</targetType> | ||||
| 		<affectScope>SINGLE</affectScope> | ||||
| 		<effects> | ||||
| 			<effect name="GiveXp"> | ||||
| 				<xp>1000000000</xp> | ||||
| 				<level>99</level> | ||||
| 				<percentage>20</percentage> | ||||
| 			</effect> | ||||
| 		</effects> | ||||
| 	</skill> | ||||
| 	<skill id="18799" toLevel="4" name="First Gift Box"> | ||||
| 		<!-- Double-click for a chance to get a reward. --> | ||||
|   | ||||
| @@ -624,6 +624,7 @@ | ||||
| 																	</xs:sequence> | ||||
| 																</xs:complexType> | ||||
| 															</xs:element> | ||||
| 															<xs:element name="level" type="xs:int" /> | ||||
| 															<xs:element name="ignoreShieldDefence" type="xs:boolean" /> | ||||
| 															<xs:element name="criticalChance"> | ||||
| 																<xs:complexType mixed="true"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment