A Code that gives NPE and dont know why ( Incorrect code to)
Posted: Sun Jul 10, 2011 9:55 pm
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Last IL:
L2JDP Revision Last IL:
Hello a friend of mine just created this code:
i added this but it gives x44444 dmgs and also it gives hit on every side
what i want from the code?
if attacker hits target and target is behind (like backstab) to give +1000 more dmg than the current
» Find Revision
L2J Revision Last IL:
L2JDP Revision Last IL:
Code: Select all
### Eclipse Workspace Patch 1.0 #P TEST_GAMESERVER Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 4699) +++ java/net/sf/l2j/Config.java (working copy) @@ -881,6 +881,11 @@ public static boolean L2JMOD_WEDDING_SAMESEX; public static boolean L2JMOD_WEDDING_FORMALWEAR; public static int L2JMOD_WEDDING_DIVORCE_COSTS; + + //Specific weapon critical raise + public static boolean ALLOW_SPECIFIC_WEAP_CRIT_RAISE; + public static int MAGIC_CRITICAL_WEAPON_ID; + public static int PHYSIC_CRITICAL_WEAPON_ID; // Packet information /** Count the amount of packets per minute ? */ @@ -1859,6 +1864,11 @@ L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True")); L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20")); + + //Specific critical raise + ALLOW_SPECIFIC_WEAP_CRIT_RAISE = Boolean.parseBoolean(L2JModSettings.getProperty("AllowSpecificWeapCrit","False")); + MAGIC_CRITICAL_WEAPON_ID = Integer.parseInt(L2JModSettings.getProperty("MagicCriticalId","65535")); + PHYSIC_CRITICAL_WEAPON_ID = Integer.parseInt(L2JModSettings.getProperty("PhysicCriticalId","65535")); if (TVT_EVENT_PARTICIPATION_NPC_ID == 0) { TVT_EVENT_ENABLED = false; Index: java/config/l2jmods.properties =================================================================== --- java/config/l2jmods.properties (revision 4699) +++ java/config/l2jmods.properties (working copy) @@ -37,6 +37,14 @@ # Specified reward item rnd qty ChampionRewardItemQty = 1 +#Allow Specific weapon Increase +#Critical/Magic critical damages +#Allow Or Dissallow This function +AllowSpecificWeapCrit = False +#Choose item Id For Magic Critical +MagicCriticalId = 65535 +#Choose item Id For Physical Critical +PhysicCriticalId = 65535 #--------------------------------------------------------------- # Wedding System (by evill33t) #--------------------------------------------------------------- Index: java/net/sf/l2j/gameserver/skills/Formulas.java =================================================================== --- java/net/sf/l2j/gameserver/skills/Formulas.java (revision 4699) +++ java/net/sf/l2j/gameserver/skills/Formulas.java (working copy) @@ -27,6 +27,7 @@ import net.sf.l2j.gameserver.instancemanager.SiegeManager; import net.sf.l2j.gameserver.model.Inventory; import net.sf.l2j.gameserver.model.L2Character; +import net.sf.l2j.gameserver.model.L2ItemInstance; import net.sf.l2j.gameserver.model.L2SiegeClan; import net.sf.l2j.gameserver.model.L2Skill; import net.sf.l2j.gameserver.model.L2Summon; @@ -1156,8 +1157,19 @@ } } - - if (crit) damage += attacker.getCriticalDmg(target, damage); + L2ItemInstance pramatia = ((L2PcInstance) attacker).getInventory().getPaperdollItem(9); + if (crit) + { + if (Config.ALLOW_SPECIFIC_WEAP_CRIT_RAISE) + { + if(pramatia.getItemId() == Config.PHYSIC_CRITICAL_WEAPON_ID ) + if(attacker.isBehindTarget()) + damage = damage + 2 + attacker.getCriticalDmg(target, damage); + else + damage += attacker.getCriticalDmg(target, damage); + } + else + damage += attacker.getCriticalDmg(target, damage); + } if (shld && !Config.ALT_GAME_SHIELD_BLOCKS) { defence += target.getShldDef(); @@ -1326,7 +1338,21 @@ } } } - else if (mcrit) damage *= 4; + + L2ItemInstance pramatia = ((L2PcInstance) attacker).getInventory().getPaperdollItem(9); + if (mcrit) + { + if (Config.ALLOW_SPECIFIC_WEAP_CRIT_RAISE) + { + if(pramatia.getItemId() == Config.MAGIC_CRITICAL_WEAPON_ID) + if (attacker.isBehindTarget()) + damage *= 4; + else + damage *= 2; + + } + else + damage *= 2; + } // Pvp bonusses for dmg if((attacker instanceof L2PcInstance || attacker instanceof L2Summon)
i added this but it gives x44444 dmgs and also it gives hit on every side
what i want from the code?
if attacker hits target and target is behind (like backstab) to give +1000 more dmg than the current