Jump to content

GameBlonD

Members
  • Posts

    553
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by GameBlonD

  1. this is the load method:

        // This method loads castle door data from database
        private void loadDoor()
        {
            Connection con = null;
            try
            {
                con = L2DatabaseFactory.getInstance().getConnection();
                PreparedStatement statement = con.prepareStatement("Select * from castle_door where castleId = ?");
                statement.setInt(1, getCastleId());
                ResultSet rs = statement.executeQuery();
                
                while (rs.next())
                {
                    // Create list of the door default for use when respawning dead doors
                    _doorDefault.add(rs.getString("name") + ";" + rs.getInt("id") + ";"
                            + rs.getInt("x") + ";" + rs.getInt("y") + ";" + rs.getInt("z") + ";"
                            + rs.getInt("range_xmin") + ";" + rs.getInt("range_ymin") + ";"
                            + rs.getInt("range_zmin") + ";" + rs.getInt("range_xmax") + ";"
                            + rs.getInt("range_ymax") + ";" + rs.getInt("range_zmax") + ";"
                            + rs.getInt("hp") + ";" + rs.getInt("pDef") + ";" + rs.getInt("mDef"));
                    
                    L2DoorInstance door = DoorTable.parseList(_doorDefault.get(_doorDefault.size() - 1), false);
                    _doors.add(door);
                    DoorTable.getInstance().putDoor(door);
                }
                ResourceUtil.closeResultSet(rs);
                ResourceUtil.closeStatement(statement);
            }
            catch (Exception e)
            {
                _log.log(Level.WARNING, "Exception: loadCastleDoor()", e);
            }
            finally
            {
                            ResourceUtil.closeConnection(con);
            }
        }

    This the spawn method (when i kill doors /start /end siege then works so i am guessing this is the code that works fine:

        /**
         * Respawn all doors on castle grounds<BR>
         * <BR>
         */
        public void spawnDoor(boolean isDoorWeak)
        {
            for (int i = 0; i < getDoors().size(); i++)
            {
                L2DoorInstance door = getDoors().get(i);
                if (door.getCurrentHp() <= 0)
                {
                    door.decayMe(); // Kill current if not killed already
                    door = DoorTable.parseList(_doorDefault.get(i), false);
                    DoorTable.getInstance().putDoor(door); // Readd the new door to the DoorTable By Erb
                    if (isDoorWeak)
                        door.setCurrentHp(door.getMaxHp() / 2);
                    door.spawnMe(door.getX(), door.getY(), door.getZ());
                    getDoors().set(i, door);
                }
                else if (door.getOpen())
                    door.closeMe();
            }
            loadDoorUpgrade(); // Check for any upgrade the doors may have
        }

    How to adjust it so castle doors to work in server start?

     

  2. So i checked l2j last revisions and they use the same code... i dont know if this bug happens and inside the game maybe i test it later.
    So the problem is  here:
            if (getCurrentMp() < getStat().getMpConsume(skill) + getStat().getMpInitialConsume(skill) && !isAttackingNow())
    I added !isAttackingNow  and now it does ->one skill - auto attack player dead but he does skill with 0 mp :P

    I will try to improve it somehow if some1 has a way let me know.
     

  3.                         if (getCurrentMp() < mpConsume)
                            {
                                // If L2PcInstance doesn't have enough MP, stop the attack
                                ThreadPoolManager.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), 1000);
                                sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_MP));
                                sendPacket(ActionFailed.STATIC_PACKET);
                                return;
                            }

            // Check if the caster has enough MP
            if (getCurrentMp() < getStat().getMpConsume(skill) + getStat().getMpInitialConsume(skill))
            {
                // Send a System Message to the caster
                sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_MP));
                
                // Send a Server->Client packet ActionFailed to the L2PcInstance
                sendPacket(ActionFailed.STATIC_PACKET);
                return false;
            }

    This  two are the only one that displays Not Enough mp what should i change?

  4.     public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
        {
            L2PcInstance partyMember = getRandomPartyMember(player, "1");
            if (partyMember == null)
                return null;
            QuestState st = partyMember.getQuestState(getName());

            if (st == null)
                return null;
                    int id = npc.getNpcId();
                    int cond = st.getInt("cond");
            switch (cond)
            {
                case 1:
                                if (id == MOB1 && st.getQuestItemsCount(QITEM1) == 0)
                                {
                    st.giveItems(QITEM1,1);
                                    if (st.getQuestItemsCount(QITEM1) >= 1 && st.getQuestItemsCount(QITEM2) >= 1)
                                    {
                                        st.set("cond","2");
                                        st.playSound("ItemSound.quest_middle");
                                    }


    Is this possibly  to give into whole party? dont mind about }{ 

  5. I am trying to make pets go up to 86 lvl in old gracia pack,
    What i change: red= what i add/change

    Experience.java:
                11844000000L, // level 83
                15472800000L, // level 84
                25314105600L, //level 86
                32211728640L  }; //level 87

     

        public final static byte MAX_LEVEL = 86;

        public final static byte PET_MAX_LEVEL = 87;
    ------------------------------------------------------------------
    Petstat.java:

        public final boolean addLevel(byte value)
        {

            if (getLevel() + value > (Experience.PET_MAX_LEVEL - 1))
                return false;

    -------------------------------------------------------------------
    PlayableStat.java
        public boolean addExp(long value)
        {
            if ((getExp() + value) < 0 || (value > 0 && getExp() == (getExpForLevel(Experience.PET_MAX_LEVEL) - 1)))
                return true;
            
            if (getExp() + value >= getExpForLevel(Experience.PET_MAX_LEVEL))
                value = getExpForLevel(Experience.PET_MAX_LEVEL) - 1 - getExp();
            
            setExp(getExp() + value);
            
            byte minimumLevel = 1;
            if (getActiveChar() instanceof L2PetInstance)
            {
                // get minimum level from L2NpcTemplate
                minimumLevel = ((L2PetInstance) getActiveChar()).getTemplate().level;
            }
            
            byte level = minimumLevel; // minimum level
            
            for (byte tmp = level; tmp <= Experience.PET_MAX_LEVEL; tmp++)
            {
                if (getExp() >= getExpForLevel(tmp))
                    continue;
                level = --tmp;
                break;
            }
            if (level != getLevel() && level >= minimumLevel)
                addLevel((byte) (level - getLevel()));
            
            return true;
        }


        public boolean removeExp(long value)
        {
            if ((getExp() - value) < 0)
                value = getExp() - 1;
            
            setExp(getExp() - value);
            
            byte minimumLevel = 1;
            if (getActiveChar() instanceof L2PetInstance)
            {
                // get minimum level from L2NpcTemplate
                minimumLevel = ((L2PetInstance) getActiveChar()).getTemplate().level;
            }
            byte level = minimumLevel;
            
            for (byte tmp = level; tmp <= Experience.PET_MAX_LEVEL; tmp++)
            {
                if (getExp() >= getExpForLevel(tmp))
                    continue;
                level = --tmp;
                break;
            }
            if (level != getLevel() && level >= minimumLevel)
                addLevel((byte) (level - getLevel()));
            return true;
        }



        public boolean addLevel(byte value)
        {
            if (getLevel() + value > Experience.PET_MAX_LEVEL - 1)
            {
                if (getLevel() < Experience.PET_MAX_LEVEL - 1)
                    value = (byte) (Experience.PET_MAX_LEVEL - 1 - getLevel());
                else
                    return false;
            }
            
            boolean levelIncreased = (getLevel() + value > getLevel());
            value += getLevel();
            setLevel(value);
            
            // Sync up exp with current level
            if (getExp() >= getExpForLevel(getLevel() + 1) || getExpForLevel(getLevel()) > getExp())
                setExp(getExpForLevel(getLevel()));
            
            if (!levelIncreased)
                return false;
            
            getActiveChar().getStatus().setCurrentHp(getActiveChar().getStat().getMaxHp());
            getActiveChar().getStatus().setCurrentMp(getActiveChar().getStat().getMaxMp());
            
            if (getActiveChar() instanceof L2PcInstance)
                CommunityServerThread.getInstance().sendPacket(new WorldInfo((L2PcInstance) getActiveChar(), null, WorldInfo.TYPE_UPDATE_PLAYER_DATA));

            return true;
        }
       

    The problem is after the playableStat.java changes pets can leven up up to 86 lvl but Players can too

    Any ideas what to change in order to PET_MAX_LEVEL apply only to pets?

  6.  in add skill  ,false=?  what false does?

     

    Also

    I want to add some additions

    I tried to send the message in party chat  but with this code the message goes

     

     String name = activeChar.getName();

    activeChar.sendPacket(new CreatureSay(0, Say2.PARTY, name, "Skill Enabled"));
    Player name: Skill Enabled

    How it can be like this:
    System: Skill Enabled
     

  7.  

    - It's not the code he want to add, it's just an code example he found inside EnterWorld, which could be reduced to 2 lines, btw.

    - Yeah, there is no point for new file, since it's like 5 lines code, with brackets. If you want 'external' method, simply create new method inside the class, but not new file, lol.

    if (activeChar.getInventory().getItemByItemId(57) != null)
    {
         activeChar.addSkill(SkillTable.getInstance().getInfo(1323, 1), false);
         activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(1323));
    }
    

    Thanks dude that was excactly what i wanted!

     

    One Question in add skill  ,false=?  what false does?

  8. Kanw mia dokimh me ayto ala den kserw pos na to kano to !=null na diabazei oti ean uparxei 1 tetio item sto inventory

     

           if (activeChar.getInventory().getItemByItemId(9819) != null)
            {
                L2Skill skill = SkillTable.getInstance().getInfo(294, 1);
                if (skill != null && activeChar.getSkillLevel(294) == 1)
                {
                    if (GameTimeController.getInstance().isNowNight())
                    {
                        SystemMessage sm = new SystemMessage(SystemMessageId.NIGHT_EFFECT_S1_APPLIES);
                        sm.addSkillName(294);
                        sendPacket(sm);
                    }
                    else
                    {
                        SystemMessage sm = new SystemMessage(SystemMessageId.DAY_EFFECT_S1_DISAPPEARS);
                        sm.addSkillName(294);
                        sendPacket(sm);
                    }
                }
            }  

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock