- Timestamp:
- Jan 16, 2012 7:56:19 AM (4 months ago)
- Location:
- trunk/L2J_DataPack
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
dist/game/data/scripts/ai/group_template/Chests.java (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/L2J_DataPack
- Property svn:mergeinfo changed
/branches/unstable/L2J_DataPack_BETA merged: 8407-8426,8428-8480,8482-8491,8493-8588,8590-8629
- Property svn:mergeinfo changed
-
trunk/L2J_DataPack/dist/game/data/scripts/ai/group_template/Chests.java
r7665 r8630 34 34 private static final int SKILL_DELUXE_KEY = 2229; 35 35 36 // Base chance for BOX to be opened36 // Base chance for BOX to be opened 37 37 private static final int BASE_CHANCE = 100; 38 38 … … 43 43 private static final int IS_BOX = 40; 44 44 45 private static final int[] NPC_IDS = { 18265,18266,18267,18268,18269,18270,18271, 46 18272,18273,18274,18275,18276,18277,18278,18279,18280,18281, 47 18282,18283,18284,18285,18286,18287,18288,18289,18290,18291, 48 18292,18293,18294,18295,18296,18297,18298,21671,21694,21717, 49 21740,21763,21786,21801,21802,21803,21804,21805,21806,21807, 50 21808,21809,21810,21811,21812,21813,21814,21815,21816,21817, 51 21818,21819,21820,21821,21822 }; 45 private static final int[] NPC_IDS = 46 { 47 18265, 48 18266, 49 18267, 50 18268, 51 18269, 52 18270, 53 18271, 54 18272, 55 18273, 56 18274, 57 18275, 58 18276, 59 18277, 60 18278, 61 18279, 62 18280, 63 18281, 64 18282, 65 18283, 66 18284, 67 18285, 68 18286, 69 18287, 70 18288, 71 18289, 72 18290, 73 18291, 74 18292, 75 18293, 76 18294, 77 18295, 78 18296, 79 18297, 80 18298, 81 21671, 82 21694, 83 21717, 84 21740, 85 21763, 86 21786, 87 21801, 88 21802, 89 21803, 90 21804, 91 21805, 92 21806, 93 21807, 94 21808, 95 21809, 96 21810, 97 21811, 98 21812, 99 21813, 100 21814, 101 21815, 102 21816, 103 21817, 104 21818, 105 21819, 106 21820, 107 21821, 108 21822 109 }; 52 110 53 111 public Chests(int questId, String name, String descr) … … 56 114 // mechanisms etc. 57 115 super(questId, name, descr); 58 this.registerMobs(NPC_IDS, QuestEventType.ON_ATTACK, QuestEventType.ON_SKILL_SEE);116 registerMobs(NPC_IDS, QuestEventType.ON_ATTACK, QuestEventType.ON_SKILL_SEE); 59 117 } 60 118 61 119 @Override 62 public String onSkillSee (L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)120 public String onSkillSee(L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet) 63 121 { 64 122 if (npc instanceof L2ChestInstance) … … 66 124 // this behavior is only run when the target of skill is the passed npc (chest) 67 125 // i.e. when the player is attempting to open the chest using a skill 68 if (!Util.contains(targets, npc))69 { 70 return super.onSkillSee(npc, caster,skill,targets,isPet);71 } 72 L2ChestInstance chest = ((L2ChestInstance) npc);126 if (!Util.contains(targets, npc)) 127 { 128 return super.onSkillSee(npc, caster, skill, targets, isPet); 129 } 130 L2ChestInstance chest = ((L2ChestInstance) npc); 73 131 int npcId = chest.getNpcId(); 74 132 int skillId = skill.getId(); 75 int skillLevel = skill.getLevel();133 int skillLevel = skill.getLevel(); 76 134 77 // check if the chest and skills used are valid for this script. Exit if invalid.78 if (!Util.contains(NPC_IDS, npcId))79 { 80 return super.onSkillSee(npc, caster,skill,targets,isPet);135 // check if the chest and skills used are valid for this script. Exit if invalid. 136 if (!Util.contains(NPC_IDS, npcId)) 137 { 138 return super.onSkillSee(npc, caster, skill, targets, isPet); 81 139 } 82 140 // if this has already been interacted, no further ai decisions are needed … … 91 149 { 92 150 // check the chance to open the box 93 int keyLevelNeeded = chest.getLevel() /10;151 int keyLevelNeeded = chest.getLevel() / 10; 94 152 keyLevelNeeded -= skillLevel; 95 153 if (keyLevelNeeded < 0) … … 97 155 int chance = BASE_CHANCE - keyLevelNeeded * LEVEL_DECREASE; 98 156 99 // success, pretend-death with rewards: chest.reduceCurrentHp(99999999, player)157 // success, pretend-death with rewards: chest.reduceCurrentHp(99999999, player) 100 158 if (Rnd.get(100) < chance) 101 159 { … … 111 169 else 112 170 { 113 L2Character originalCaster = isPet ? caster.getPet(): caster;171 L2Character originalCaster = isPet ? caster.getPet() : caster; 114 172 chest.setRunning(); 115 chest.addDamageHate(originalCaster, 0,999);173 chest.addDamageHate(originalCaster, 0, 999); 116 174 chest.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalCaster); 117 175 } 118 176 } 119 177 } 120 return super.onSkillSee(npc, caster,skill,targets,isPet);178 return super.onSkillSee(npc, caster, skill, targets, isPet); 121 179 } 122 180 123 181 @Override 124 public String onAttack (L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)182 public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet) 125 183 { 126 184 if (npc instanceof L2ChestInstance) 127 185 { 128 L2ChestInstance chest = ((L2ChestInstance) npc);186 L2ChestInstance chest = ((L2ChestInstance) npc); 129 187 int npcId = chest.getNpcId(); 130 // check if the chest and skills used are valid for this script. Exit if invalid.188 // check if the chest and skills used are valid for this script. Exit if invalid. 131 189 if (!Util.contains(NPC_IDS, npcId)) 132 190 { 133 return super.onAttack(npc, attacker,damage,isPet);191 return super.onAttack(npc, attacker, damage, isPet); 134 192 } 135 193 … … 146 204 // if this weren't a box, upon interaction start the mimic behaviors... 147 205 // todo: perhaps a self-buff (skill id 4245) with random chance goes here? 148 L2Character originalAttacker = isPet ? attacker.getPet(): attacker;206 L2Character originalAttacker = isPet ? attacker.getPet() : attacker; 149 207 chest.setRunning(); 150 chest.addDamageHate(originalAttacker, 0,(damage*100)/(chest.getLevel()+7));208 chest.addDamageHate(originalAttacker, 0, (damage * 100) / (chest.getLevel() + 7)); 151 209 chest.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker); 152 210 } 153 211 } 154 212 } 155 return super.onAttack(npc, attacker,damage,isPet);213 return super.onAttack(npc, attacker, damage, isPet); 156 214 } 157 215 … … 159 217 { 160 218 // now call the constructor (starts up the ai) 161 new Chests(-1, "chests","ai");219 new Chests(-1, "chests", "ai"); 162 220 } 163 221 }
Note: See TracChangeset
for help on using the changeset viewer.
