Ignore:
Timestamp:
Jan 16, 2012 7:56:19 AM (4 months ago)
Author:
MELERIX
Message:

STABLE: Sync with BETA [8629]

Location:
trunk/L2J_DataPack
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/L2J_DataPack

  • trunk/L2J_DataPack/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java

    r8406 r8630  
    1515package events.FreyaCelebration; 
    1616 
    17 import com.l2jserver.gameserver.instancemanager.QuestManager; 
    1817import com.l2jserver.gameserver.model.L2Object; 
    1918import com.l2jserver.gameserver.model.L2Skill; 
     19import com.l2jserver.gameserver.model.Location; 
    2020import com.l2jserver.gameserver.model.actor.L2Npc; 
    2121import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; 
     22import com.l2jserver.gameserver.model.itemcontainer.PcInventory; 
    2223import com.l2jserver.gameserver.model.quest.Quest; 
    2324import com.l2jserver.gameserver.model.quest.QuestState; 
     
    3233 
    3334/** 
    34  ** @author Gnacik 
    35  ** 
    36  ** Retail Event : 'Freya Celebration' 
     35 * Retail Event : 'Freya Celebration' 
     36 * @author Gnacik 
    3737 */ 
    3838public class FreyaCelebration extends Quest 
     
    4343        private static final int _hours = 20; 
    4444         
    45         private static final int[] _skills = { 9150, 9151, 9152, 9153, 9154, 9155, 9156 }; 
     45        private static final int[] _skills = 
     46        { 
     47                9150, 9151, 9152, 9153, 9154, 9155, 9156 
     48        }; 
    4649         
    4750        private static final NpcStringId[] _freya_texts = 
     
    5457        }; 
    5558         
    56         private static final int[][] _spawns = { 
    57                 { -119494, 44882, 360, 24576 }, 
    58                 { -117239, 46842, 360, 49151 }, 
    59                 { -84023, 243051, -3728, 4096 }, 
    60                 { -84411, 244813, -3728, 57343 }, 
    61                 { 46908, 50856, -2992, 8192 }, 
    62                 { 45538, 48357, -3056, 18000 }, 
    63                 { -45372, -114104, -240, 16384 }, 
    64                 { -45278, -112766, -240, 0 }, 
    65                 { 9929, 16324, -4568, 62999 }, 
    66                 { 11546, 17599, -4584, 46900 }, 
    67                 { 115096, -178370, -880, 0 }, 
    68                 { -13727, 122117, -2984, 16384 }, 
    69                 { -14129, 123869, -3112, 40959 }, 
    70                 { -83156, 150994, -3120, 0 }, 
    71                 { -81031, 150038, -3040, 0 }, 
    72                 { 16111, 142850, -2696, 16000 }, 
    73                 { 17275, 145000, -3032, 25000 }, 
    74                 { 111004, 218928, -3536, 16384 }, 
    75                 { 81755, 146487, -3528, 32768 }, 
    76                 { 82145, 148609, -3464, 0 }, 
    77                 { 83037, 149324, -3464, 44000 }, 
    78                 { 81987, 53723, -1488, 0 }, 
    79                 { 147200, 25614, -2008, 16384 }, 
    80                 { 148557, 26806, -2200, 32768 }, 
    81                 { 147421, -55435, -2728, 49151 }, 
    82                 { 148206, -55786, -2776, 61439 }, 
    83                 { 85584, -142490, -1336, 0 }, 
    84                 { 86865, -142915, -1336, 26000 }, 
    85                 { 43966, -47709, -792, 49999 }, 
    86                 { 43165, -48461, -792, 17000 } 
     59        private static final Location[] _spawns = 
     60        { 
     61                new Location(-119494, 44882, 360, 24576), 
     62                new Location(-117239, 46842, 360, 49151), 
     63                new Location(-84023, 243051, -3728, 4096), 
     64                new Location(-84411, 244813, -3728, 57343), 
     65                new Location(46908, 50856, -2992, 8192), 
     66                new Location(45538, 48357, -3056, 18000), 
     67                new Location(-45372, -114104, -240, 16384), 
     68                new Location(-45278, -112766, -240, 0), 
     69                new Location(9929, 16324, -4568, 62999), 
     70                new Location(11546, 17599, -4584, 46900), 
     71                new Location(115096, -178370, -880, 0), 
     72                new Location(-13727, 122117, -2984, 16384), 
     73                new Location(-14129, 123869, -3112, 40959), 
     74                new Location(-83156, 150994, -3120, 0), 
     75                new Location(-81031, 150038, -3040, 0), 
     76                new Location(16111, 142850, -2696, 16000), 
     77                new Location(17275, 145000, -3032, 25000), 
     78                new Location(111004, 218928, -3536, 16384), 
     79                new Location(81755, 146487, -3528, 32768), 
     80                new Location(82145, 148609, -3464, 0), 
     81                new Location(83037, 149324, -3464, 44000), 
     82                new Location(81987, 53723, -1488, 0), 
     83                new Location(147200, 25614, -2008, 16384), 
     84                new Location(148557, 26806, -2200, 32768), 
     85                new Location(147421, -55435, -2728, 49151), 
     86                new Location(148206, -55786, -2776, 61439), 
     87                new Location(85584, -142490, -1336, 0), 
     88                new Location(86865, -142915, -1336, 26000), 
     89                new Location(43966, -47709, -792, 49999), 
     90                new Location(43165, -48461, -792, 17000) 
    8791        }; 
    8892         
     
    9195        { 
    9296                QuestState st = player.getQuestState(getName()); 
    93                 Quest q = QuestManager.getInstance().getQuest(getName()); 
    94                 if (st == null || q == null) 
     97                if (st == null) 
     98                { 
    9599                        return null; 
     100                } 
    96101                 
    97102                if (event.equalsIgnoreCase("give_potion")) 
    98103                { 
    99                         if (st.getQuestItemsCount(57) > 1) 
     104                        if (st.getQuestItemsCount(PcInventory.ADENA_ID) > 1) 
    100105                        { 
    101106                                long _curr_time = System.currentTimeMillis(); 
    102                                 String value = q.loadGlobalQuestVar(player.getAccountName()); 
     107                                String value = loadGlobalQuestVar(player.getAccountName()); 
    103108                                long _reuse_time = value == "" ? 0 : Long.parseLong(value); 
    104109                                 
     
    106111                                { 
    107112                                        st.setState(State.STARTED); 
    108                                         st.takeItems(57, 1); 
     113                                        st.takeItems(PcInventory.ADENA_ID, 1); 
    109114                                        st.giveItems(_freya_potion, 1); 
    110                                         q.saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (_hours * 3600000))); 
     115                                        saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (_hours * 3600000))); 
    111116                                } 
    112117                                else 
     
    125130                        { 
    126131                                SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_UNIT_OF_THE_ITEM_S1_REQUIRED); 
    127                                 sm.addItemName(57); 
     132                                sm.addItemName(PcInventory.ADENA_ID); 
    128133                                sm.addNumber(1); 
    129134                                player.sendPacket(sm); 
     
    137142        { 
    138143                if ((caster == null) || (npc == null)) 
     144                { 
    139145                        return null; 
     146                } 
    140147                 
    141148                if ((npc.getNpcId() == _freya) && Util.contains(targets, npc) && Util.contains(_skills, skill.getId())) 
     
    145152                                CreatureSay cs = new CreatureSay(npc.getObjectId(), Say2.ALL, npc.getName(), NpcStringId.DEAR_S1_THINK_OF_THIS_AS_MY_APPRECIATION_FOR_THE_GIFT_TAKE_THIS_WITH_YOU_THERES_NOTHING_STRANGE_ABOUT_IT_ITS_JUST_A_BIT_OF_MY_CAPRICIOUSNESS); 
    146153                                cs.addStringParameter(caster.getName()); 
    147  
     154                                 
    148155                                npc.broadcastPacket(cs); 
    149  
     156                                 
    150157                                caster.addItem("FreyaCelebration", _freya_gift, 1, npc, true); 
    151158                        } 
     
    164171        public String onFirstTalk(L2Npc npc, L2PcInstance player) 
    165172        { 
    166                 QuestState st = player.getQuestState(getName()); 
    167                 if (st == null) 
     173                if (player.getQuestState(getName()) == null) 
    168174                { 
    169                         Quest q = QuestManager.getInstance().getQuest(getName()); 
    170                         st = q.newQuestState(player); 
     175                        newQuestState(player); 
    171176                } 
    172177                return "13296.htm"; 
     
    181186                addTalkId(_freya); 
    182187                addSkillSeeId(_freya); 
    183                 for (int[] _spawn : _spawns) 
     188                for (Location loc : _spawns) 
    184189                { 
    185                         addSpawn(_freya, _spawn[0], _spawn[1], _spawn[2], _spawn[3], false, 0); 
     190                        addSpawn(_freya, loc, false, 0); 
    186191                } 
    187192        } 
Note: See TracChangeset for help on using the changeset viewer.