2014年6月6日 星期五

【Java教學】新增組隊等級限制

新增組隊等級限制


修改

C_CreateParty.java 

加入 


// 限制玩家組隊等級 
import l1j.server.Config; 
// 限制玩家組隊等級 end 


搜尋 

L1PcInstance targetPc = (L1PcInstance) temp; 


下面加入 

// 限制玩家組隊等級 
// 低組低 
            if (pc.getLevel() <= Config.Party_Lv && targetPc.getLevel() <= Config.Party_Lv) { 
              pc.sendPackets(new S_ServerMessage(166, "等級尚未達到 " + (Config.Party_Lv + 1) + " 級,所以無法組隊")); 
              targetPc.sendPackets(new S_ServerMessage(166, "等級尚未達到 " + (Config.Party_Lv + 1) + " 級,所以無法組隊")); 
            } 
// 低組高 
            if (pc.getLevel() <= Config.Party_Lv && targetPc.getLevel() > Config.Party_Lv) {  
              pc.sendPackets(new S_ServerMessage(166, "等級尚未達到 " + (Config.Party_Lv + 1) + " 級,所以無法組隊")); 
              targetPc.sendPackets(new S_ServerMessage(166, "對方等級尚未達到 " + (Config.Party_Lv + 1) + " 級,所以無法組隊")); 
            } 
// 高組低 
            if (pc.getLevel() > Config.Party_Lv && targetPc.getLevel() <= Config.Party_Lv) { 
              pc.sendPackets(new S_ServerMessage(166, "對方等級尚未達到 " + (Config.Party_Lv + 1) + " 級,所以無法組隊")); 
              targetPc.sendPackets(new S_ServerMessage(166, "等級尚未達到 " + (Config.Party_Lv + 1) + " 級,所以無法組隊")); 
            } 
// 限制玩家組隊等級 end 


搜尋 

if (pc.isInParty()) { 


上面加入 

// 限制玩家組隊等級 
            if (pc.getLevel() > Config.Party_Lv && targetPc.getLevel() > Config.Party_Lv) { 
// 限制玩家組隊等級 end 


搜尋 

targetPc.sendPackets(new S_Message_YN(953, pc.getName())); 


下面加入 

// 限制玩家組隊等級 
} 
// 限制玩家組隊等級 end 


修改

CalcExp.java 

搜尋 

                  if (party_level > 0) { 
                    dist = ((ptMembers[cnt].getLevel() * ptMembers[cnt] 
                          .getLevel()) / party_level); 
                  } 


把這段修改為 

// 限制玩家組隊等級 
                  if (party_level > Config.Party_Lv) { 
                    dist = ((ptMembers[cnt].getLevel() * ptMembers[cnt] 
                          .getLevel()) / party_level); 
                  } else { 
                    party_exp = 0;  
                  } 
// 限制玩家組隊等級 end 


修改

Config.java 

搜尋 

public static int DEFAULT_CHARACTER_SLOT; 


下面加入 

// 限制玩家組隊等級 
  public static int Party_Lv; 
// 限制玩家組隊等級 end 


搜尋 

        DEFAULT_CHARACTER_SLOT = Integer.parseInt(altSettings.getProperty( 
              "DefaultCharacterSlot", "6")); 


下面加入 

// 限制玩家組隊等級 
        Party_Lv = Integer.parseInt(altSettings.getProperty( 
              "PartyLv", "5")); 
// 限制玩家組隊等級 end 


搜尋 

      } else if (pName.equalsIgnoreCase("DefaultCharacterSlot")) { 
        DEFAULT_CHARACTER_SLOT = Integer.valueOf(pValue); 


下面加入 

// 限制玩家組隊等級 
      } else if (pName.equalsIgnoreCase("PartyLv")) { 
        Party_Lv = Integer.parseInt(pValue); 
// 限制玩家組隊等級 end 


修改

altsettings.properties 

最下面新增 

#------------------------------------------------------------- 
#玩家等級高於多少 才能組隊 等級低於設定值 就算組隊 獲得的經驗值為0 
#不限制玩家等級 則設定為 = 0 
PartyLv = 5 
#------------------------------------------------------------- 

沒有留言:

張貼留言