隱形天堂

Would you like to react to this message? Create an account in a few clicks or log in to continue.

隱形天堂 一個原汁原味的天堂


    魔法娃娃:希爾黛絲 功能 修正HpRegenerationByDoll

    avatar
    Admin
    Admin


    文章數 : 134
    注冊日期 : 2010-09-27

    魔法娃娃:希爾黛絲 功能 修正HpRegenerationByDoll Empty 魔法娃娃:希爾黛絲 功能 修正HpRegenerationByDoll

    發表  Admin 周一 9月 27, 2010 7:51 am

    魔法娃娃:希爾黛絲 (希爾黛斯)
    功能:

    ‧每60秒,體力恢復40


    資料來源 天堂透視鏡

    新增 HpRegenerationByDoll.java
    修改 L1DollInstance.java
    修改 L1PcInstance.java
    修改 C_ItemUSe.java

    (2009/01/02修正)1.在 model 先新建立一個 HpRegenerationByDoll.java
    代碼:

    package l1j.server.server.model;

    import java.util.TimerTask;
    import java.util.logging.Level;
    import java.util.logging.Logger;

    import l1j.server.server.model.Instance.L1PcInstance;
    import l1j.server.server.model.skill.L1SkillId;
    import l1j.server.server.serverpackets.S_SkillSound; //娃娃回血效果

    public class HpRegenerationByDoll extends TimerTask {
    private static Logger _log = Logger.getLogger(HpRegenerationByDoll.class
    .getName());

    private final L1PcInstance _pc;

    public HpRegenerationByDoll(L1PcInstance pc) {
    _pc = pc;
    }

    @Override
    public void run() {
    try {
    if (_pc.isDead()) {
    return;
    }
    regenHp();
    } catch (Throwable e) {
    _log.log(Level.WARNING, e.getLocalizedMessage(), e);
    }
    }

    public void regenHp() {
    int newHp = _pc.getCurrentHp() + 40;
    if (newHp < 0) {
    newHp = 0;
    }
    //add 娃娃回血效果
    _pc.sendPackets(new S_SkillSound(_pc.getId(), 6506));
    _pc.broadcastPacket(new S_SkillSound(_pc.getId(), 6506));
    //end
    _pc.setCurrentHp(newHp);

    }

    }


    2.打開 Instance 的 L1DollInstance.java
    a.找尋public static final int DOLLTYPE_PRINCESS = 6;//魔法公主
    底下新增
    代碼:

    public static final int DOLLTYPE_SEADANCER = 7;//希爾黛絲

    b.找尋 if (isMpRegeneration()) {
    master.startMpRegenerationByDoll();
    }
    底下新增
    代碼:

    //add 魔法娃娃回血功能
    if (isHpRegeneration()) {
    master.startHpRegenerationByDoll();
    }
    //end

    c.找尋 if (isMpRegeneration()) {
    ((L1PcInstance) _master).stopMpRegenerationByDoll();
    }
    底下新增
    代碼:

    //add 魔法娃娃回血功能
    if (isHpRegeneration()) {
    ((L1PcInstance) _master).stopHpRegenerationByDoll();
    }
    //end

    d.找尋public boolean isMpRegeneration() {...}
    底下新增
    代碼:

    //add 魔法娃娃回血功能
    public boolean isHpRegeneration() {
    boolean isHpRegeneration = false;
    if (getDollType() == DOLLTYPE_SEADANCER) {
    isHpRegeneration = true;
    }
    return isHpRegeneration;
    }
    //end


    3.打開 Instance 的 L1PcInstance.java
    a.找尋 import l1j.server.server.model.MpRegenerationByDoll;
    底下新增
    代碼:

    import l1j.server.server.model.HpRegenerationByDoll;//魔法娃娃回血功能

    b.找尋 public void startMpRegenerationByDoll() {...}
    底下新增
    代碼:

    //add 魔法娃娃回血功能
    public void startHpRegenerationByDoll() {
    final int INTERVAL_BY_DOLL = 60000;
    boolean isExistHprDoll = false;
    Object[] dollList = getDollList().values().toArray();
    for (Object dollObject : dollList) {
    L1DollInstance doll = (L1DollInstance) dollObject;
    if (doll.isHpRegeneration()) {
    isExistHprDoll = true;
    }
    }
    if (!_hpRegenActiveByDoll && isExistHprDoll) {
    _hpRegenByDoll = new HpRegenerationByDoll(this);
    _regenTimer.scheduleAtFixedRate(_hpRegenByDoll, INTERVAL_BY_DOLL,
    INTERVAL_BY_DOLL);
    _hpRegenActiveByDoll = true;
    }
    }
    //end

    c.找尋 public void stopMpRegenerationByDoll() {...}
    底下新增
    代碼:

    //add 魔法娃娃回血功能
    public void stopHpRegenerationByDoll() {
    if (_hpRegenActiveByDoll) {
    _hpRegenByDoll.cancel();
    _hpRegenByDoll = null;
    _hpRegenActiveByDoll = false;
    }
    }
    //end

    d.找尋 private HpRegeneration _hpRegen;
    底下新增
    代碼:

    private HpRegenerationByDoll _hpRegenByDoll;//add 魔法娃娃回血功能

    e.找尋 private boolean _hpRegenActive; (2008-08-21修正)
    底下新增
    代碼:

    private boolean _hpRegenActiveByDoll;//add 魔法娃娃回血功能


    4.打開 clientpackets 的 C_ItemUSe.java
    a.找尋 || itemId == 60005
    改為
    代碼:

    || itemId == 60005 || itemId == 60035

    b.找尋 pc.startMpRegenerationByDoll();
    底下新增
    代碼:

    pc.startHpRegenerationByDoll();//add 魔法娃娃回血功能

    c.找尋 private void useMagicDoll(L1PcInstance pc, int itemId, int itemObjectId) {
    再往下一點找} else if (itemId == 60005) {// 魔法娃娃:魔法公主
    npcId = 100001;
    dollType = L1DollInstance.DOLLTYPE_PRINCESS;
    底下新增
    代碼:

    } else if (itemId == 60035) {// 魔法娃娃:希爾黛絲
    npcId = 200030;
    dollType = L1DollInstance.DOLLTYPE_SEADANCER;


    DB etcitem 新增
    代碼:

    60035魔法娃娃:希爾黛絲魔法娃娃:希爾黛絲othernormalwood12000307061742546000000000105500001

    DB npc 新增
    代碼:

    200030希爾黛絲希爾黛絲魔法娃娃L1Doll6477110000000000small0000104800220032800000000-1-1000000000000000000000-1000

      現在的時間是 周五 11月 22, 2024 2:04 am