- 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/events/HeavyMedal/HeavyMedal.java (modified) (5 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/events/HeavyMedal/HeavyMedal.java
r8406 r8630 15 15 package events.HeavyMedal; 16 16 17 import com.l2jserver.gameserver. instancemanager.QuestManager;17 import com.l2jserver.gameserver.model.Location; 18 18 import com.l2jserver.gameserver.model.actor.L2Npc; 19 19 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; … … 23 23 24 24 /** 25 ** @author Gnacik 26 ** 27 ** Retail Event : 'Heavy Medals' 25 * Retail Event : 'Heavy Medals' 26 * @author Gnacik 28 27 */ 29 28 public class HeavyMedal extends Quest 30 29 { 31 private final static int CAT_ROY = 31228; 32 private final static int CAT_WINNIE = 31229; 33 private final static int GLITTERING_MEDAL = 6393; 34 35 private final static int WIN_CHANCE = 50; 36 37 private final static int[] MEDALS = { 5,10,20,40 }; 38 private final static int[] BADGES = { 6399,6400,6401,6402 }; 39 40 private static final int[][] _spawns_winnie = 41 { 42 {-44342,-113726,-240,0}, 43 {-44671,-115437,-240,22500}, 44 {-13073,122841,-3117,0}, 45 {-13972,121893,-2988,32768}, 46 {-14843,123710,-3117,8192}, 47 {11327,15682,-4584,25000}, 48 {11243,17712,-4574,57344}, 49 {18154,145192,-3054,7400}, 50 {19214,144327,-3097,32768}, 51 {19459,145775,-3086,48000}, 52 {17418,170217,-3507,36000}, 53 {47146,49382,-3059,32000}, 54 {44157,50827,-3059,57344}, 55 {79798,55629,-1560,0}, 56 {83328,55769,-1525,32768}, 57 {80986,54452,-1525,32768}, 58 {83329,149095,-3405,49152}, 59 {82277,148564,-3467,0}, 60 {81620,148689,-3464,32768}, 61 {81691,145610,-3467,32768}, 62 {114719,-178742,-821,0}, 63 {115708,-182422,-1449,0}, 64 {-80731,151152,-3043,28672}, 65 {-84097,150171,-3129,4096}, 66 {-82678,151666,-3129,49152}, 67 {117459,76664,-2695,38000}, 68 {115936,76488,-2711,59000}, 69 {119576,76940,-2275,40960}, 70 {-84516,243015,-3730,34000}, 71 {-86031,243153,-3730,60000}, 72 {147124,27401,-2192,40960}, 73 {147985,25664,-2000,16384}, 74 {111724,221111,-3543,16384}, 75 {107899,218149,-3675,0}, 76 {114920,220080,-3632,32768}, 77 {147924,-58052,-2979,49000}, 78 {147285,-56461,-2776,33000}, 79 {44176,-48688,-800,33000}, 80 {44294,-47642,-792,50000} 81 }; 82 83 private static final int[][] _spawns_roy = 84 { 85 {-44337,-113669,-224,0}, 86 {-44628,-115409,-240,22500}, 87 {-13073,122801,-3117,0}, 88 {-13949,121934,-2988,32768}, 89 {-14786,123686,-3117,8192}, 90 {11281,15652,-4584,25000}, 91 {11303,17732,-4574,57344}, 92 {18178,145149,-3054,7400}, 93 {19208,144380,-3097,32768}, 94 {19508,145775,-3086,48000}, 95 {17396,170259,-3507,36000}, 96 {47151,49436,-3059,32000}, 97 {44122,50784,-3059,57344}, 98 {79806,55570,-1560,0}, 99 {83328,55824,-1525,32768}, 100 {80986,54504,-1525,32768}, 101 {83332,149160,-3405,49152}, 102 {82277,148598,-3467,0}, 103 {81621,148725,-3467,32768}, 104 {81680,145656,-3467,32768}, 105 {114733,-178691,-821,0}, 106 {115708,-182362,-1449,0}, 107 {-80789,151073,-3043,28672}, 108 {-84049,150176,-3129,4096}, 109 {-82623,151666,-3129,49152}, 110 {117498,76630,-2695,38000}, 111 {115914,76449,-2711,59000}, 112 {119536,76988,-2275,40960}, 113 {-84516,242971,-3730,34000}, 114 {-86003,243205,-3730,60000}, 115 {147184,27405,-2192,17000}, 116 {147920,25664,-2000,16384}, 117 {111776,221104,-3543,16384}, 118 {107904,218096,-3675,0}, 119 {114920,220020,-3632,32768}, 120 {147888,-58048,-2979,49000}, 121 {147262,-56450,-2776,33000}, 122 {44176,-48732,-800,33000}, 123 {44319,-47640,-792,50000} 30 private final static int CAT_ROY = 31228; 31 private final static int CAT_WINNIE = 31229; 32 private final static int GLITTERING_MEDAL = 6393; 33 34 private final static int WIN_CHANCE = 50; 35 36 private final static int[] MEDALS = 37 { 38 5, 10, 20, 40 39 }; 40 private final static int[] BADGES = 41 { 42 6399, 6400, 6401, 6402 43 }; 44 45 private static final Location[] _spawns_winnie = 46 { 47 new Location(-44342, -113726, -240, 0), 48 new Location(-44671, -115437, -240, 22500), 49 new Location(-13073, 122841, -3117, 0), 50 new Location(-13972, 121893, -2988, 32768), 51 new Location(-14843, 123710, -3117, 8192), 52 new Location(11327, 15682, -4584, 25000), 53 new Location(11243, 17712, -4574, 57344), 54 new Location(18154, 145192, -3054, 7400), 55 new Location(19214, 144327, -3097, 32768), 56 new Location(19459, 145775, -3086, 48000), 57 new Location(17418, 170217, -3507, 36000), 58 new Location(47146, 49382, -3059, 32000), 59 new Location(44157, 50827, -3059, 57344), 60 new Location(79798, 55629, -1560, 0), 61 new Location(83328, 55769, -1525, 32768), 62 new Location(80986, 54452, -1525, 32768), 63 new Location(83329, 149095, -3405, 49152), 64 new Location(82277, 148564, -3467, 0), 65 new Location(81620, 148689, -3464, 32768), 66 new Location(81691, 145610, -3467, 32768), 67 new Location(114719, -178742, -821, 0), 68 new Location(115708, -182422, -1449, 0), 69 new Location(-80731, 151152, -3043, 28672), 70 new Location(-84097, 150171, -3129, 4096), 71 new Location(-82678, 151666, -3129, 49152), 72 new Location(117459, 76664, -2695, 38000), 73 new Location(115936, 76488, -2711, 59000), 74 new Location(119576, 76940, -2275, 40960), 75 new Location(-84516, 243015, -3730, 34000), 76 new Location(-86031, 243153, -3730, 60000), 77 new Location(147124, 27401, -2192, 40960), 78 new Location(147985, 25664, -2000, 16384), 79 new Location(111724, 221111, -3543, 16384), 80 new Location(107899, 218149, -3675, 0), 81 new Location(114920, 220080, -3632, 32768), 82 new Location(147924, -58052, -2979, 49000), 83 new Location(147285, -56461, -2776, 33000), 84 new Location(44176, -48688, -800, 33000), 85 new Location(44294, -47642, -792, 50000) 86 }; 87 88 private static final Location[] _spawns_roy = 89 { 90 new Location(-44337, -113669, -224, 0), 91 new Location(-44628, -115409, -240, 22500), 92 new Location(-13073, 122801, -3117, 0), 93 new Location(-13949, 121934, -2988, 32768), 94 new Location(-14786, 123686, -3117, 8192), 95 new Location(11281, 15652, -4584, 25000), 96 new Location(11303, 17732, -4574, 57344), 97 new Location(18178, 145149, -3054, 7400), 98 new Location(19208, 144380, -3097, 32768), 99 new Location(19508, 145775, -3086, 48000), 100 new Location(17396, 170259, -3507, 36000), 101 new Location(47151, 49436, -3059, 32000), 102 new Location(44122, 50784, -3059, 57344), 103 new Location(79806, 55570, -1560, 0), 104 new Location(83328, 55824, -1525, 32768), 105 new Location(80986, 54504, -1525, 32768), 106 new Location(83332, 149160, -3405, 49152), 107 new Location(82277, 148598, -3467, 0), 108 new Location(81621, 148725, -3467, 32768), 109 new Location(81680, 145656, -3467, 32768), 110 new Location(114733, -178691, -821, 0), 111 new Location(115708, -182362, -1449, 0), 112 new Location(-80789, 151073, -3043, 28672), 113 new Location(-84049, 150176, -3129, 4096), 114 new Location(-82623, 151666, -3129, 49152), 115 new Location(117498, 76630, -2695, 38000), 116 new Location(115914, 76449, -2711, 59000), 117 new Location(119536, 76988, -2275, 40960), 118 new Location(-84516, 242971, -3730, 34000), 119 new Location(-86003, 243205, -3730, 60000), 120 new Location(147184, 27405, -2192, 17000), 121 new Location(147920, 25664, -2000, 16384), 122 new Location(111776, 221104, -3543, 16384), 123 new Location(107904, 218096, -3675, 0), 124 new Location(114920, 220020, -3632, 32768), 125 new Location(147888, -58048, -2979, 49000), 126 new Location(147262, -56450, -2776, 33000), 127 new Location(44176, -48732, -800, 33000), 128 new Location(44319, -47640, -792, 50000) 124 129 }; 125 130 … … 133 138 addFirstTalkId(CAT_ROY); 134 139 addFirstTalkId(CAT_WINNIE); 135 for(int[] _spawn : _spawns_roy) 136 addSpawn(CAT_ROY, _spawn[0], _spawn[1], _spawn[2], _spawn[3], false, 0); 137 for(int[] _spawn : _spawns_winnie) 138 addSpawn(CAT_WINNIE, _spawn[0], _spawn[1], _spawn[2], _spawn[3], false, 0); 140 for (Location loc : _spawns_roy) 141 { 142 addSpawn(CAT_ROY, loc, false, 0); 143 } 144 for (Location loc : _spawns_winnie) 145 { 146 addSpawn(CAT_WINNIE, loc, false, 0); 147 } 139 148 } 140 149 … … 142 151 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) 143 152 { 144 String htmltext = ""; 145 QuestState st = player.getQuestState(getName()); 146 htmltext = event; 147 153 String htmltext = event; 154 final QuestState st = player.getQuestState(getName()); 148 155 int level = checkLevel(st); 149 156 150 157 if (event.equalsIgnoreCase("game")) 151 158 { 159 htmltext = st.getQuestItemsCount(GLITTERING_MEDAL) < MEDALS[level] ? "31229-no.htm" : "31229-game.htm"; 160 } 161 else if (event.equalsIgnoreCase("heads") || event.equalsIgnoreCase("tails")) 162 { 152 163 if (st.getQuestItemsCount(GLITTERING_MEDAL) < MEDALS[level]) 153 return "31229-no.htm";154 else155 return "31229-game.htm";156 }157 else if (event.equalsIgnoreCase("heads") || event.equalsIgnoreCase("tails"))158 {159 if (st.getQuestItemsCount(GLITTERING_MEDAL) < MEDALS[level])160 return "31229-"+event.toLowerCase()+"-10.htm";161 162 st.takeItems(GLITTERING_MEDAL, MEDALS[level]);163 164 if(Rnd.get(100) > WIN_CHANCE)165 164 { 166 level = 0;165 htmltext = "31229-" + event.toLowerCase() + "-10.htm"; 167 166 } 168 167 else 169 168 { 170 if (level>0) 171 st.takeItems(BADGES[level-1], -1); 172 st.giveItems(BADGES[level], 1); 173 st.playSound("Itemsound.quest_itemget"); 174 level++; 169 st.takeItems(GLITTERING_MEDAL, MEDALS[level]); 170 171 if (Rnd.get(100) > WIN_CHANCE) 172 { 173 level = 0; 174 } 175 else 176 { 177 if (level > 0) 178 { 179 st.takeItems(BADGES[level - 1], -1); 180 } 181 st.giveItems(BADGES[level], 1); 182 st.playSound("Itemsound.quest_itemget"); 183 level++; 184 } 185 htmltext = "31229-" + event.toLowerCase() + "-" + String.valueOf(level) + ".htm"; 175 186 } 176 return "31229-"+event.toLowerCase()+"-"+String.valueOf(level)+".htm";177 187 } 178 188 else if (event.equalsIgnoreCase("talk")) 179 189 { 180 return String.valueOf(npc.getNpcId())+ "-lvl-"+String.valueOf(level)+".htm";190 htmltext = String.valueOf(npc.getNpcId()) + "-lvl-" + String.valueOf(level) + ".htm"; 181 191 } 182 192 return htmltext; … … 186 196 public String onFirstTalk(L2Npc npc, L2PcInstance player) 187 197 { 188 QuestState st = player.getQuestState(getName()); 198 if (player.getQuestState(getName()) == null) 199 { 200 newQuestState(player); 201 } 202 return npc.getNpcId() + ".htm"; 203 } 204 205 public int checkLevel(QuestState st) 206 { 207 int _lev = 0; 189 208 if (st == null) 190 209 { 191 Quest q = QuestManager.getInstance().getQuest(getName());192 st = q.newQuestState(player);193 }194 return npc.getNpcId()+".htm";195 }196 197 public int checkLevel(QuestState st)198 {199 int _lev = 0;200 if(st == null)201 210 return 0; 202 else if (st.getQuestItemsCount(6402) > 0) 211 } 212 if (st.hasQuestItems(6402)) 213 { 203 214 _lev = 4; 204 else if (st.getQuestItemsCount(6401) > 0) 215 } 216 else if (st.hasQuestItems(6401)) 217 { 205 218 _lev = 3; 206 else if (st.getQuestItemsCount(6400) > 0) 219 } 220 else if (st.hasQuestItems(6400)) 221 { 207 222 _lev = 2; 208 else if (st.getQuestItemsCount(6399) > 0) 223 } 224 else if (st.hasQuestItems(6399)) 225 { 209 226 _lev = 1; 210 227 } 211 228 return _lev; 212 229 }
Note: See TracChangeset
for help on using the changeset viewer.
