2.70C 版整合包 增加元寶功能教學
殺戮kill大大的 2.70C 版整合包 :http://lineage45.com/forum.php?mod=viewthread&tid=46166&extra=page%3D1小弟修改了小小的功能 增加元寶功能
分享給各位
步驟1
=============================
l1j\server\server\datatables\ShopTable.java
找尋:
private final Map<Integer, L1Shop> _allShops = new HashMap<Integer, L1Shop>();
底下加入:
private final Map<Integer, Integer> _allItemSells = new HashMap<Integer, Integer>();
找尋:
private L1Shop loadShop(int npcId, ResultSet rs) throws SQLException {
整段修改為:
private L1Shop loadShop(int npcId, ResultSet rs) throws SQLException {
List<L1ShopItem> sellingList = new ArrayList<L1ShopItem>();
List<L1ShopItem> purchasingList = new ArrayList<L1ShopItem>();
while (rs.next()) {
int itemId = rs.getInt("item_id");
int sellingPrice = rs.getInt("selling_price");
int purchasingPrice = rs.getInt("purchasing_price");
int packCount = rs.getInt("pack_count");
packCount = packCount == 0 ? 1 : packCount;
int yuanbao = rs.getInt("yuanbao");//add liumy
switch(npcId){
case 70068:case 70020:
case 70024:case 70032:
case 80075:
continue;
default:
break;
}
if(0 <= sellingPrice){
if(_allItemSells.get(itemId)==null){
_allItemSells.put(itemId, sellingPrice/2);
}else if(_allItemSells.get(itemId)<sellingPrice/2){
_allItemSells.put(itemId, sellingPrice/2);
}
}else{ //-1
if(0 <= purchasingPrice){
if(_allItemSells.get(itemId)==null){
_allItemSells.put(itemId, purchasingPrice);
}else if(_allItemSells.get(itemId)<purchasingPrice){
_allItemSells.put(itemId, purchasingPrice);
}
}
}
if (0 <= sellingPrice && 0 >= yuanbao ) {
L1ShopItem item = new L1ShopItem(itemId, sellingPrice,
packCount);
sellingList.add(item);
}
if (0 <= purchasingPrice && 0 >= yuanbao ) {
L1ShopItem item = new L1ShopItem(itemId, purchasingPrice,
packCount);
purchasingList.add(item);
}
if (0 < yuanbao ) { //add liumy
L1ShopItem item = new L1ShopItem(itemId, yuanbao,
packCount);
sellingList.add(item);
}//add liumy end
}
return new L1Shop(npcId, sellingList, purchasingList);
}
步驟2
=============================
l1j\server\server\model\shop\L1Shop.java
找尋:
import l1j.server.server.serverpackets.S_ServerMessage;
下方加入:
import l1j.server.server.serverpackets.S_SystemMessage;
找尋:
private boolean ensureSell(L1PcInstance pc, L1ShopBuyOrderList orderList) {
修改為:
private boolean ensureSell(L1PcInstance pc, L1ShopBuyOrderList orderList) {
int price = orderList.getTotalPriceTaxIncluded();
// オーバーフローチェック
if (!IntRange.includes(price, 0, 2000000000)) {
// 總販賣価格は%dアデナを超過できません。
pc.sendPackets(new S_ServerMessage(904, "2000000000"));
return false;
}
// 購入できるかチェック
// add liumy
int bb;
if (_npcId >= 自己設定元寶 && _npcId <= 995000) { //元寶商城專用NPC的ID
bb =61019; //元寶物品編號item_id
}else{
bb =L1ItemId.ADENA;
}//add liumy
if (!pc.getInventory().checkItem(bb, price)) {
// l1j.eric.gui.J_Main.getInstance().addConsolPost(\"\"+price);
// \\f1アデナが不足しています。
if (L1ItemId.ADENA == bb){ //add liumy
pc.sendPackets(new S_ServerMessage(189));
}else{
pc.sendPackets(new S_SystemMessage("元寶不足"));
}
return false;
}
※ 到此地方以上 ※
// 重量チェック
int currentWeight = pc.getInventory().getWeight() * 1000;
找尋:
private void sellItems(L1PcInventory inv, L1ShopBuyOrderList orderList) {
修改為:
private void sellItems(L1PcInventory inv, L1ShopBuyOrderList orderList) {
//add liumy
int bb;
if (_npcId >= 990000 && _npcId <= 995000) {
bb =61019; //元寶物品編號item_id
}else{
bb =L1ItemId.ADENA;
}
if (!inv.consumeItem(bb, orderList
.getTotalPriceTaxIncluded())) {
throw new IllegalStateException("購入に必要なアデナを消費できませんでした。");
}
※ 到此地方以上 ※
for (L1ShopBuyOrder order : orderList.getList()) {
步驟3_DB修改
=============================
db_shop
點選左上角【檔案】→【設計資料表】→ 【新增欄位】
名稱地方輸入:yuanbao ※大小寫需與核心內一模一樣
類型為: int 長度:10 十進位:0 允許空值:打勾取消 下方預設值:0
上方【儲存】到此修改已完成。
yuanbao欄位為元寶價格設定。
NPC編號:990000 至 995000皆可使用。
元寶編號:61019
請將附檔放置在模擬器 l1jserver.jar (壓縮檔開啟,並放置相對路徑下 覆蓋前請前rename原檔案) 載點:
感謝大大分享 並提供寫法獲益良多 感謝大大分享 收藏了,感谢分享
感謝大大無私分享~立馬來看看
謝謝分享囉!!! 謝謝分享囉。 感謝大大的分享,先下載研究看看囉 感謝大大無私分享~立馬來看看
謝謝坂大分享 有人會使用嗎??? 改好了沒效果.... 不知道哪邊沒用到 感謝大大分享 並提供寫法獲益良多 目前學習中,謝謝分享
無權限訪問 發帖數必須10 並且 威望 5 黃金VIP會員 將不受此限制 取得方式請參考下方好可惜呀 謝謝分享阿 很受用的 感謝大大分享 感謝大大分享 很受用的 謝謝分享寶貴新增修改的經騇
謝謝分享
待我威望足夠再來 謝謝分享