Jump to content
  • 0

[Help]Rebirth system


Question

Posted

Xreiazomai tin boitheia apo atomo pou na kserei Java gia ena script gia rebirth

Opoios mporei kai thelei na boithisei i as me kanei add sto msn dimis_87@hotmail.com

i as postarei edw

 

Thanks in advance

4 answers to this question

Recommended Posts

  • 0
Posted

l2jfree

 

ndex: L2PcInstance.java

===================================================================

--- L2PcInstance.java (revision 3713)

+++ L2PcInstance.java (working copy)

@@ -260,8 +260,8 @@

    private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE charId=? AND class_index=?";

 

    // Character Character SQL String Definitions:

-    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=? WHERE charId=?";

-    private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level FROM characters WHERE charId=?";

+    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=?,rebirths=? WHERE charId=?";

+    private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level,rebirths FROM characters WHERE charId=?";

 

    // Character Subclass SQL String Definitions:

    private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE charId=? ORDER BY class_index ASC";

@@ -693,6 +693,9 @@

    //Death Penalty Buff Level

    private int _deathPenaltyBuffLevel = 0;

 

+    // Rebirth limit support

+    private int _rebirths = 0;

+

    private boolean _hero = false;

    private boolean _noble = false;

    private boolean _inOlympiadMode = false;

@@ -6197,6 +6200,7 @@

                player.setLvlJoinedAcademy(rset.getInt("lvl_joined_academy"));

                player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally"));

                player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));

+ player.setRebirths(rset.getInt("rebirths");

 

               

                // Add the L2PcInstance object in _allObjects

@@ -6565,7 +6569,8 @@

            statement.setLong(48, getBanChatTimer());

            statement.setString(49, getName());

            statement.setLong(50, getDeathPenaltyBuffLevel());

-            statement.setInt(51, getObjectId());

+            statement.setInt(51, getRebirths());

+            statement.setInt(52, getObjectId());

            statement.execute();

            statement.close();

        }

@@ -11655,6 +11660,16 @@

_deathPenaltyBuffLevel = level;

}

 

+ public int getRebirths()

+ {

+ return _rebirths;

+ }

+

+ public void setRebirths(int rebirths)

+ {

+ _rebirths = rebirths;

+ }

+

public void calculateDeathPenaltyBuffLevel(L2Character killer)

{

if( !(killer instanceof L2PlayableInstance)

 

 

------------------  end -----------

 

and

 

/* This program is free software: you can redistribute it and/or modify it under

* the terms of the GNU General Public License as published by the Free Software

* Foundation, either version 3 of the License, or (at your option) any later

* version.

*

* This program is distributed in the hope that it will be useful, but WITHOUT

* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS

* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more

* details.

*

* You should have received a copy of the GNU General Public License along with

* this program. If not, see <http://www.gnu.org/licenses/>.

*/

package com.l2jfree.gameserver.model.actor.instance;

 

import com.l2jfree.gameserver.datatables.ItemTable;

import com.l2jfree.gameserver.model.L2ItemInstance;

import com.l2jfree.gameserver.model.L2Skill;

import com.l2jfree.gameserver.model.base.ClassId;

import com.l2jfree.gameserver.model.base.Experience;

import com.l2jfree.gameserver.network.SystemMessageId;

import com.l2jfree.gameserver.network.serverpackets.SystemMessage;

import com.l2jfree.gameserver.network.serverpackets.NpcHtmlMessage;

import com.l2jfree.gameserver.templates.chars.L2NpcTemplate;

 

/**

* Rebirth Npc's Instance

*

* @author HanWik

*/

 

public class L2RebirthMasterInstance extends L2NpcInstance

{

  int itemId; // item ID which should be given

  int count; // how many of the item should be given?

 

  public L2RebirthMasterInstance(int objectId, L2NpcTemplate template)

  {

      super(objectId, template);

  }

 

  @Override

  public void onBypassFeedback(L2PcInstance player, String command)

  {

      if (command.startsWith("Rebirth"))

      {

        ClassId classId = player.getClassId();

        int jobLevel = classId.level();

 

        if (player.getLevel() >= 85 && jobLevel == 3)

        {

            L2ItemInstance item = ItemTable.getInstance().createItem("Rebirth Item", 8569, 1, player);

            player.getInventory().addItem("Rebirth Item", item.getItemId(), 1, player, null);

 

            ClassId _baseClass = classId;

                    for (ClassId child : ClassId.values())

            {

                        if (classId.childOf(child))

              {

                  _baseClass = child;

                  for (ClassId child2 : ClassId.values())

                  {

                    if (_baseClass.childOf(child2))

                    {

                        _baseClass = child2;

                        for (ClassId child3 : ClassId.values())

                        {

                          if (_baseClass.childOf(child3))

                              _baseClass = child3;

                        }

                    }

                  }

              }

            }

 

            for (L2Skill skill : player.getAllSkills())

              player.removeSkill(skill);

            player.sendSkillList();

 

            player.setClassId(_baseClass.getId());

       

            if (player.isSubClassActive()) player.getSubClasses().get(player.getClassIndex()).setClassId(player.getActiveClass());

            else player.setBaseClass(player.getActiveClass());

 

            player.broadcastUserInfo();

 

            player.rewardSkills();

 

            // system sound for 1st and 2nd occupation

            player.sendPacket(new SystemMessage(SystemMessageId.CLASS_TRANSFER));

            // Update the overloaded status of the L2PcInstance

            player.refreshOverloaded();

            // Update the expertise status of the L2PcInstance

            player.refreshExpertisePenalty();

 

            player.setClassId(_baseClass.getId());

       

            if (player.isSubClassActive()) player.getSubClasses().get(player.getClassIndex()).setClassId(player.getActiveClass());

            else player.setBaseClass(player.getActiveClass());

 

                    long pXp = player.getExp();

                    long tXp = Experience.LEVEL[1];

 

                    player.removeExpAndSp(pXp - tXp, 0);

           

            player.sendMessage("환생을 축하합니다!.");

        }

        else

            player.sendMessage("환생은 85레벨이 되어야만 가능합니다.");

 

      }

  }

}

Guest
This topic is now closed to further replies.


×
×
  • Create New...