底比斯天堂
瘋天堂私服發佈網站廣告欄位!
害怕天堂私服倒閉嗎?快使用天堂分析師!
天堂私服抽獎扭蛋物品及機率測試器
天堂私服稱號顏色製造器
瘋天堂私服發佈網站教您註冊推文收藏私服!
天堂私服血量魔力計算器
瘋天堂私服發布網站廣告贊助及爆料私服客服
教您如何不用註冊也可以推文天堂私服!
天堂私服270怪物查詢掉落資料庫
天堂私服盟徽製造器
test0428
2010-12-27 02:02

天堂裝備鑲嵌系統java教學!

最近罎子裡很冷清,小發一帖,全作抛磚引玉之用,人格保證絕對可用,遇到問題觸類旁通。
---頹廢三道


首先,個人包袱和精靈倉庫,個人倉庫,血盟倉庫,都在最後面加兩個欄位。

mountcount 和 addmr

類型int 長度11 默認null

L1ItemInstance.java

搜索
public int getMr() {
int mr = _item.get_mdef()

替換為
public int getMr() {
int mr = _item.get_mdef() + getaddMr(); //鑲嵌

搜索
public void updateAll() {

在上面增加
public int mountcount; //鑲嵌

public int addmr; //鑲嵌

搜索
addhp = getaddHp();
addmp = getaddMp();
addsp = getaddSp();
hpr = getHpr();
mpr = getMpr();

在下面增加
mountcount = getMountCount(); //鑲嵌
addmr = getaddMr(); //鑲嵌


搜索
public void updateHpr() {
hpr = getHpr();
}

public void updateMpr() {
mpr = getMpr();
}

在下面增加
public void updateMountCount() { //鑲嵌
mountcount = getMountCount();
}

public void updateMr() { //鑲嵌
addmr = getaddMr();
}

搜索
if (isEquipped()) {
if (itemType2 == 1) {
name.append(" ($9)"); // 裝備(Armed)
} else if (itemType2 == 2) {
name.append(" ($117)"); // 裝備(Worn)
} else if (itemType2 == 0 && getItem().getType() == 11) { // petitem
name.append(" ($117)"); // 裝備(Worn)
}
}
return name.toString();

在上面增加

// 武器裝備強化系統 BY XCALONE 20100918
int weaponcount = 0;
int armorcount =0;
weaponcount = 20 - getUpdateCount();
armorcount = 3 - getMountCount();
if (isIdentified() && getItem().getType2() == 1) {
name.append("鑲嵌." + weaponcount + " ");
}
if (isIdentified() && getItem().getType2() == 2) {
name.append(" 鑲嵌." + armorcount);
}

搜索
public int getaddMp() {
return _addMp;
}

public void setaddMp(int i) {
_addMp = i;
}


在下面增加
private int _addMr = 0; //鑲嵌

public int getaddMr() {
return _addMr;
}

public void setaddMr(int i) {
_addMr = i;
}
//鑲嵌次數
private int _MountCount = 3;

public int getMountCount() {
return _MountCount;
}

public void setMountCount(int i) {
_MountCount = i;
}


L1DwarfForClanInventory.java (4 個匹配項)

搜索
public synchronized void loadItems()

將 整段替換為
public synchronized void loadItems() { // 同步鎖保證只有1個執行緒跑該程式
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
try {
con = L1DatabaseFactory.getInstance().getConnection();
pstm = con
.prepareStatement("SELECT * FROM clan_warehouse WHERE clan_name = ? order by item_id");
pstm.setString(1, _clan.getClanName());
rs = pstm.executeQuery();
while (rs.next()) {
L1ItemInstance item = new L1ItemInstance();
int objectId = rs.getInt("id");
item.setId(objectId);
int itemId = rs.getInt("item_id");
L1Item itemTemplate = ItemTable.getInstance().getTemplate(
itemId);
if (itemTemplate == null) {
throw new NullPointerException("item_id=" + itemId
+ " not found");
}
item.setItem(itemTemplate);
item.setCount(rs.getInt("count"));
item.setEquipped(false);
item.setEnchantLevel(rs.getInt("enchantlvl"));
item.setIdentified(rs.getInt("is_id") != 0 ? true : false);
item.set_durability(rs.getInt("durability"));
item.setChargeCount(rs.getInt("charge_count"));
item.setRemainingTime(rs.getInt("remaining_time"));
item.setLastUsed(rs.getTimestamp("last_used"));
item.setBless(rs.getInt("bless"));
item.setAttrEnchantKind(rs.getInt("attr_enchant_kind"));
item.setAttrEnchantLevel(rs.getInt("attr_enchant_level"));
item.setFireMr(rs.getInt("firemr"));// 飾品強化卷軸
item.setWaterMr(rs.getInt("watermr"));// 飾品強化卷軸
item.setEarthMr(rs.getInt("earthmr"));// 飾品強化卷軸
item.setWindMr(rs.getInt("windmr"));// 飾品強化卷軸
item.setaddSp(rs.getInt("addsp"));// 飾品強化卷軸
item.setaddHp(rs.getInt("addhp"));// 飾品強化卷軸
item.setaddMp(rs.getInt("addmp"));// 飾品強化卷軸
item.setHpr(rs.getInt("hpr"));// 飾品強化卷軸
item.setMpr(rs.getInt("mpr"));// 飾品強化卷軸
item.setMountCount(rs.getInt("mountcount")); //裝備鑲嵌
item.setaddMr(rs.getInt("addmr")); //裝備鑲嵌
// 武器強化卷
if (ItemUpdate.getInstance().checkItem(item.getId()) != 0) {
ItemUpdate itemUpdate = new ItemUpdate();
for (L1WilliamItemUpdate item_update : itemUpdate.getItemUpdateList()) {
if (item_update.getId() == item.getId()) {
item.setUpdateCount(item_update.getCount()); // 剩餘次數
item.setUpdateDmg(item_update.getAddDmg()); // 基礎攻擊
item.setUpdateDmgModifier(item_update.getAddDmgModifier()); // 額外攻擊
item.setUpdateHitModifier(item_update.getAddHitModifier()); // 攻擊成功
}
}
}

_items.add(item);
L1World.getInstance().storeObject(item);
}
} catch (SQLException e) {
_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
} finally {
SQLUtil.close(rs);
SQLUtil.close(pstm);
SQLUtil.close(con);
}
}

搜索
public synchronized void insertItem(L1ItemInstance item) {


替換整段為
public synchronized void insertItem(L1ItemInstance item) {
Connection con = null;
PreparedStatement pstm = null;
try {
con = L1DatabaseFactory.getInstance().getConnection();
pstm = con
.prepareStatement("INSERT INTO clan_warehouse SET id = ?, clan_name = ?, item_id = ?, item_name = ?, count = ?, is_equipped=0, enchantlvl = ?, is_id= ?, durability = ?, charge_count = ?, remaining_time = ?, last_used = ?, bless = ?, attr_enchant_kind = ?, attr_enchant_level = ?, firemr = ?, watermr = ?, earthmr = ?, windmr = ?, addsp = ?, addhp = ?, addmp = ?, hpr = ?, mpr = ?, mountcount = ?, addmr = ?"); //waja change
pstm.setInt(1, item.getId());
pstm.setString(2, _clan.getClanName());
pstm.setInt(3, item.getItemId());
pstm.setString(4, item.getName());
pstm.setInt(5, item.getCount());
pstm.setInt(6, item.getEnchantLevel());
pstm.setInt(7, item.isIdentified() ? 1 : 0);
pstm.setInt(8, item.get_durability());
pstm.setInt(9, item.getChargeCount());
pstm.setInt(10, item.getRemainingTime());
pstm.setTimestamp(11, item.getLastUsed());
pstm.setInt(12, item.getBless());
pstm.setInt(13, item.getAttrEnchantKind());
pstm.setInt(14, item.getAttrEnchantLevel());
pstm.setInt(15, item.getFireMr());// 飾品強化卷軸
pstm.setInt(16, item.getWaterMr());// 飾品強化卷軸
pstm.setInt(17, item.getEarthMr());// 飾品強化卷軸
pstm.setInt(18, item.getWindMr());// 飾品強化卷軸
pstm.setInt(19, item.getaddSp());// 飾品強化卷軸
pstm.setInt(20, item.getaddHp());// 飾品強化卷軸
pstm.setInt(21, item.getaddMp());// 飾品強化卷軸
pstm.setInt(22, item.getHpr());// 飾品強化卷軸
pstm.setInt(23, item.getMpr());// 飾品強化卷軸
pstm.setInt(24, item.getMountCount()); //裝備鑲嵌
pstm.setInt(25, item.getaddMr()); //裝備鑲嵌
pstm.execute();
} catch (SQLException e) {
_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
} finally {
SQLUtil.close(pstm);
SQLUtil.close(con);
}
}

L1DwarfForElfInventory.java (4 個匹配項)

搜索
public synchronized void loadItems() {

將整段替換為

public synchronized void loadItems() {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
try {
con = L1DatabaseFactory.getInstance().getConnection();
pstm = con
.prepareStatement("SELECT * FROM character_elf_warehouse WHERE account_name = ? order by item_id");
pstm.setString(1, _owner.getAccountName());

rs = pstm.executeQuery();

while (rs.next()) {
L1ItemInstance item = new L1ItemInstance();
int objectId = rs.getInt("id");
item.setId(objectId);
L1Item itemTemplate = ItemTable.getInstance().getTemplate(
rs.getInt("item_id"));
item.setItem(itemTemplate);
item.setCount(rs.getInt("count"));
item.setEquipped(false);
item.setEnchantLevel(rs.getInt("enchantlvl"));
item.setIdentified(rs.getInt("is_id") != 0 ? true : false);
item.set_durability(rs.getInt("durability"));
item.setChargeCount(rs.getInt("charge_count"));
item.setRemainingTime(rs.getInt("remaining_time"));
item.setLastUsed(rs.getTimestamp("last_used"));
item.setBless(rs.getInt("bless"));
item.setAttrEnchantKind(rs.getInt("attr_enchant_kind"));
item.setAttrEnchantLevel(rs.getInt("attr_enchant_level"));
item.setFireMr(rs.getInt("firemr"));// 飾品強化卷軸
item.setWaterMr(rs.getInt("watermr"));// 飾品強化卷軸
item.setEarthMr(rs.getInt("earthmr"));// 飾品強化卷軸
item.setWindMr(rs.getInt("windmr"));// 飾品強化卷軸
item.setaddSp(rs.getInt("addsp"));// 飾品強化卷軸
item.setaddHp(rs.getInt("addhp"));// 飾品強化卷軸
item.setaddMp(rs.getInt("addmp"));// 飾品強化卷軸
item.setHpr(rs.getInt("hpr"));// 飾品強化卷軸
item.setMpr(rs.getInt("mpr"));// 飾品強化卷
item.setMountCount(rs.getInt("mountcount")); //裝備鑲嵌
item.setaddMr(rs.getInt("addmr")); //裝備鑲嵌
// 武器強化卷
if (ItemUpdate.getInstance().checkItem(item.getId()) != 0) {
ItemUpdate itemUpdate = new ItemUpdate();
for (L1WilliamItemUpdate item_update : itemUpdate.getItemUpdateList()) {
if (item_update.getId() == item.getId()) {
item.setUpdateCount(item_update.getCount()); // 剩餘次數
item.setUpdateDmg(item_update.getAddDmg()); // 攻擊力
item.setUpdateDmgModifier(item_update.getAddDmgModifier()); // 額外攻擊
item.setUpdateHitModifier(item_update.getAddHitModifier()); // 攻擊成功
}
}
}
_items.add(item);
L1World.getInstance().storeObject(item);
}

} catch (SQLException e) {
_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
} finally {
SQLUtil.close(rs);
SQLUtil.close(pstm);
SQLUtil.close(con);
}
}

搜索
public synchronized void insertItem(L1ItemInstance item) {

將整段替換為
public synchronized void insertItem(L1ItemInstance item) {
Connection con = null;
PreparedStatement pstm = null;
try {
con = L1DatabaseFactory.getInstance().getConnection();
pstm = con
.prepareStatement("INSERT INTO character_elf_warehouse SET id = ?, account_name = ?, item_id = ?, item_name = ?, count = ?, is_equipped=0, enchantlvl = ?, is_id = ?, durability = ?, charge_count = ?, remaining_time = ?, last_used = ?, bless = ?, attr_enchant_kind = ?, attr_enchant_level = ?, firemr = ?, watermr = ?, earthmr = ?, windmr = ?, addsp = ?, addhp = ?, addmp = ?, hpr = ?, mpr = ?, mountcount = ?, addmr = ?"); //waja change
pstm.setInt(1, item.getId());
pstm.setString(2, _owner.getAccountName());
pstm.setInt(3, item.getItemId());
pstm.setString(4, item.getName());
pstm.setInt(5, item.getCount());
pstm.setInt(6, item.getEnchantLevel());
pstm.setInt(7, item.isIdentified() ? 1 : 0);
pstm.setInt(8, item.get_durability());
pstm.setInt(9, item.getChargeCount());
pstm.setInt(10, item.getRemainingTime());
pstm.setTimestamp(11, item.getLastUsed());
pstm.setInt(12, item.getBless());
pstm.setInt(13, item.getAttrEnchantKind());
pstm.setInt(14, item.getAttrEnchantLevel());
pstm.setInt(15, item.getFireMr());// 飾品強化卷軸
pstm.setInt(16, item.getWaterMr());// 飾品強化卷軸
pstm.setInt(17, item.getEarthMr());// 飾品強化卷軸
pstm.setInt(18, item.getWindMr());// 飾品強化卷軸
pstm.setInt(19, item.getaddSp());// 飾品強化卷軸
pstm.setInt(20, item.getaddHp());// 飾品強化卷軸
pstm.setInt(21, item.getaddMp());// 飾品強化卷軸
pstm.setInt(22, item.getHpr());// 飾品強化卷軸
pstm.setInt(23, item.getMpr());// 飾品強化卷軸
pstm.setInt(24, item.getMountCount()); //裝備鑲嵌
pstm.setInt(25, item.getaddMr()); //裝備鑲嵌
pstm.execute();
} catch (SQLException e) {
_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
} finally {
SQLUtil.close(pstm);
SQLUtil.close(con);
}

}

L1DwarfInventory.java (8 個匹配項)

全部內容
public synchronized void loadItems() {

Connection con = null;

PreparedStatement pstm = null;

ResultSet rs = null;

try {

con = L1DatabaseFactory.getInstance().getConnection();

pstm = con

.prepareStatement("SELECT * FROM character_warehouse WHERE account_name = ? order by item_id");

pstm.setString(1, _owner.getAccountName());

rs = pstm.executeQuery();

while (rs.next()) {

L1ItemInstance item = new L1ItemInstance();

int objectId = rs.getInt("id");

item.setId(objectId);

L1Item itemTemplate = ItemTable.getInstance().getTemplate(

rs.getInt("item_id"));

item.setItem(itemTemplate);

item.setCount(rs.getInt("count"));

item.setEquipped(false);

item.setEnchantLevel(rs.getInt("enchantlvl"));

item.setIdentified(rs.getInt("is_id") != 0 ? true : false);

item.set_durability(rs.getInt("durability"));

item.setChargeCount(rs.getInt("charge_count"));

item.setRemainingTime(rs.getInt("remaining_time"));

item.setLastUsed(rs.getTimestamp("last_used"));

item.setBless(rs.getInt("bless"));

item.setAttrEnchantKind(rs.getInt("attr_enchant_kind"));

item.setAttrEnchantLevel(rs.getInt("attr_enchant_level"));

item.setFireMr(rs.getInt("firemr"));// 飾品強化卷軸

item.setWaterMr(rs.getInt("watermr"));// 飾品強化卷軸

item.setEarthMr(rs.getInt("earthmr"));// 飾品強化卷軸

item.setWindMr(rs.getInt("windmr"));// 飾品強化卷軸

item.setaddSp(rs.getInt("addsp"));// 飾品強化卷軸

item.setaddHp(rs.getInt("addhp"));// 飾品強化卷軸

item.setaddMp(rs.getInt("addmp"));// 飾品強化卷軸

item.setHpr(rs.getInt("hpr"));// 飾品強化卷軸

item.setMpr(rs.getInt("mpr"));// 飾品強化卷軸

item.setMountCount(rs.getInt("mountcount")); //裝備鑲嵌

item.setaddMr(rs.getInt("addmr")); //裝備鑲嵌

// 武器強化卷

if (ItemUpdate.getInstance().checkItem(item.getId()) != 0) {

ItemUpdate itemUpdate = new ItemUpdate();

for (L1WilliamItemUpdate item_update : itemUpdate.getItemUpdateList()) {

if (item_update.getId() == item.getId()) {

item.setUpdateCount(item_update.getCount()); // 剩餘次數

item.setUpdateDmg(item_update.getAddDmg()); // 攻擊力

item.setUpdateDmgModifier(item_update.getAddDmgModifier()); // 額外攻擊

item.setUpdateHitModifier(item_update.getAddHitModifier()); // 攻擊成功

}

}

}

_items.add(item);

L1World.getInstance().storeObject(item);

}

} catch (SQLException e) {

_log.log(Level.SEVERE, e.getLocalizedMessage(), e);

} finally {

SQLUtil.close(rs);

SQLUtil.close(pstm);

SQLUtil.close(con);

}

}

// DBのcharacter_warehouseへ登錄

@Override

public synchronized void insertItem(L1ItemInstance item) {

Connection con = null;

PreparedStatement pstm = null;

try {

con = L1DatabaseFactory.getInstance().getConnection();

pstm = con

.prepareStatement("INSERT INTO character_warehouse SET id = ?, account_name = ?, item_id = ?, item_name = ?, count = ?, is_equipped=0, enchantlvl = ?, is_id = ?, durability = ?, charge_count = ?, remaining_time = ?, last_used = ?, bless = ?, attr_enchant_kind = ?, attr_enchant_level = ?, firemr = ?, watermr = ?, earthmr = ?, windmr = ?, addsp = ?, addhp = ?, addmp = ?, hpr = ?, mpr = ?, mountcount = ?, addmr = ?"); //waja change

pstm.setInt(1, item.getId());

pstm.setString(2, _owner.getAccountName());

pstm.setInt(3, item.getItemId());

pstm.setString(4, item.getName());

pstm.setInt(5, item.getCount());

pstm.setInt(6, item.getEnchantLevel());

pstm.setInt(7, item.isIdentified() ? 1 : 0);

pstm.setInt(8, item.get_durability());

pstm.setInt(9, item.getChargeCount());

pstm.setInt(10, item.getRemainingTime());

pstm.setTimestamp(11, item.getLastUsed());

pstm.setInt(12, item.getBless());

pstm.setInt(13, item.getAttrEnchantKind());

pstm.setInt(14, item.getAttrEnchantLevel());

pstm.setInt(15, item.getFireMr());// 飾品強化卷軸

pstm.setInt(16, item.getWaterMr());// 飾品強化卷軸

pstm.setInt(17, item.getEarthMr());// 飾品強化卷軸

pstm.setInt(18, item.getWindMr());// 飾品強化卷軸

pstm.setInt(19, item.getaddSp());// 飾品強化卷軸

pstm.setInt(20, item.getaddHp());// 飾品強化卷軸

pstm.setInt(21, item.getaddMp());// 飾品強化卷軸

pstm.setInt(22, item.getHpr());// 飾品強化卷軸

pstm.setInt(23, item.getMpr());// 飾品強化卷軸

pstm.setInt(24, item.getMountCount()); //裝備鑲嵌

pstm.setInt(25, item.getaddMr()); //裝備鑲嵌

pstm.execute();

} catch (SQLException e) {

_log.log(Level.SEVERE, e.getLocalizedMessage(), e);

} finally {

SQLUtil.close(pstm);

SQLUtil.close(con);

}
}


private static void present(ArrayList<String> accountList, int itemid,

int enchant, int count) throws Exception {

L1Item temp = ItemTable.getInstance().getTemplate(itemid);

if (temp == null) {

throw new Exception("編號不存在");

}

Connection con = null;

PreparedStatement pstm = null;

try {

con = L1DatabaseFactory.getInstance().getConnection();

con.setAutoCommit(false);

for (String account : accountList) {

if (temp.isStackable()) {

L1ItemInstance item = ItemTable.getInstance().createItem(

itemid);

item.setEnchantLevel(enchant);

item.setCount(count);

pstm = con

.prepareStatement("INSERT INTO character_warehouse SET id = ?, account_name = ?, item_id = ?, item_name = ?, count = ?, is_equipped=0, enchantlvl = ?, is_id = ?, durability = ?, charge_count = ?, remaining_time = ?, last_used = ?, bless = ?, firemr = ?, watermr = ?, earthmr = ?, windmr = ?, addsp = ?, addhp = ?, addmp = ?, hpr = ?, mpr = ?, mountcount = ?, addMr = ?"); //waja change

pstm.setInt(1, item.getId());

pstm.setString(2, account);

pstm.setInt(3, item.getItemId());

pstm.setString(4, item.getName());

pstm.setInt(5, item.getCount());

pstm.setInt(6, item.getEnchantLevel());

pstm.setInt(7, item.isIdentified() ? 1 : 0);

pstm.setInt(8, item.get_durability());

pstm.setInt(9, item.getChargeCount());

pstm.setInt(10, item.getRemainingTime());

//waja add

pstm.setTimestamp(11, item.getLastUsed());

pstm.setInt(12, item.getBless());

pstm.setInt(13, item.getFireMr());// 飾品強化卷軸

pstm.setInt(14, item.getWaterMr());// 飾品強化卷軸

pstm.setInt(15, item.getEarthMr());// 飾品強化卷軸

pstm.setInt(16, item.getWindMr());// 飾品強化卷軸

pstm.setInt(17, item.getaddSp());// 飾品強化卷軸

pstm.setInt(18, item.getaddHp());// 飾品強化卷軸

pstm.setInt(19, item.getaddMp());// 飾品強化卷軸

pstm.setInt(20, item.getHpr());// 飾品強化卷軸

pstm.setInt(21, item.getMpr());// 飾品強化卷軸

pstm.setInt(22, item.getMountCount()); //裝備鑲嵌

pstm.setInt(23, item.getaddMr()); //裝備鑲嵌

//add end

pstm.execute();

} else {

L1ItemInstance item = null;

int createCount;

for (createCount = 0; createCount < count; createCount++) {

item = ItemTable.getInstance().createItem(itemid);

item.setEnchantLevel(enchant);

pstm = con

.prepareStatement("INSERT INTO character_warehouse SET id = ?, account_name = ?, item_id = ?, item_name = ?, count = ?, is_equipped=0, enchantlvl = ?, is_id = ?, durability = ?, charge_count = ?, remaining_time = ?, last_used = ?, bless = ?, firemr = ?, watermr = ?, earthmr = ?, windmr = ?, addsp = ?, addhp = ?, addmp = ?, hpr = ?, mpr = ?, mountcount = ?, addMr = ?"); //waja change

pstm.setInt(1, item.getId());

pstm.setString(2, account);

pstm.setInt(3, item.getItemId());

pstm.setString(4, item.getName());

pstm.setInt(5, item.getCount());

pstm.setInt(6, item.getEnchantLevel());

pstm.setInt(7, item.isIdentified() ? 1 : 0);

pstm.setInt(8, item.get_durability());

pstm.setInt(9, item.getChargeCount());

pstm.setInt(10, item.getRemainingTime());

//waja add

pstm.setTimestamp(11, item.getLastUsed());

pstm.setInt(12, item.getBless());

pstm.setInt(13, item.getFireMr());// 飾品強化卷軸

pstm.setInt(14, item.getWaterMr());// 飾品強化卷軸

pstm.setInt(15, item.getEarthMr());// 飾品強化卷軸

pstm.setInt(16, item.getWindMr());// 飾品強化卷軸

pstm.setInt(17, item.getaddSp());// 飾品強化卷軸

pstm.setInt(18, item.getaddHp());// 飾品強化卷軸

pstm.setInt(19, item.getaddMp());// 飾品強化卷軸

pstm.setInt(20, item.getHpr());// 飾品強化卷軸

pstm.setInt(21, item.getMpr());// 飾品強化卷軸

pstm.setInt(22, item.getMountCount()); //裝備鑲嵌

pstm.setInt(23, item.getaddMr()); //裝備鑲嵌

//add end

pstm.execute();

}

}

}

con.commit();

con.setAutoCommit(true);

} catch (SQLException e) {

try {

con.rollback();

} catch (SQLException ignore) {

// ignore

}

_log.log(Level.SEVERE, e.getLocalizedMessage(), e);

throw new Exception(".present 處理時發生錯誤。");

} finally {

SQLUtil.close(pstm);

SQLUtil.close(con);

}

}

MySqlCharactersItemStorage.java (6 個匹配項)

搜索
item.setaddMp(rs.getInt("addmp"));// 飾品強化卷軸
item.setHpr(rs.getInt("hpr"));// 飾品強化卷軸
item.setMpr(rs.getInt("mpr"));// 飾品強化卷軸

下面加入
item.setMountCount(rs.getInt("mountcount"));// 鑲嵌
item.setaddMr(rs.getInt("addmr"));// 鑲嵌

搜索
pstm.setInt(22, item.getHpr());// 飾品強化卷軸
pstm.setInt(23, item.getMpr());// 飾品強化卷軸

下面加入
pstm.setInt(24, item.getMountCount());// 鑲嵌
pstm.setInt(25, item.getaddMr());// 鑲嵌

搜索
public synchronized void updateMpr(L1ItemInstance item) throws Exception {
executeUpdate(item.getId(),
"UPDATE character_items SET mpr = ? WHERE id = ?", item
.getMpr());
item.getLastStatus().updateMpr();
}

下面加入
public synchronized void updateMountCount(L1ItemInstance item) throws Exception { //鑲嵌
executeUpdate(item.getId(),
"UPDATE character_items SET mountcount = ? WHERE id = ?", item
.getMountCount());
item.getLastStatus().updateMountCount();
}

public synchronized void updateMr(L1ItemInstance item) throws Exception { //鑲嵌
executeUpdate(item.getId(),
"UPDATE character_items SET addmr = ? WHERE id = ?", item
.getaddMr());
item.getLastStatus().updateMr();
}

CharactersItemStorage.java (2 個匹配項)

搜索
public abstract void updateMpr(L1ItemInstance item)
throws Exception;

下面加入
public abstract void updateMountCount(L1ItemInstance item) //鑲嵌
throws Exception;

public abstract void updateMr(L1ItemInstance item) //鑲嵌
throws Exception;

L1Scroll.java (78 個匹配項) 某些版本可能是在c_itemuse.java中
隨便找個位置加入下面
else if (itemId == 90098) { // 攻擊之石
L1ItemInstance check_item = pc.getInventory().getItem(l1iteminstance1.getId());
if (check_item != null && check_item.getItem().getType2() == 1) { // 武器類

if (l1iteminstance1.getUpdateCount() <= 0) { // 次數為0
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 不可再鑲嵌寶石!"));
return;
}

if (RandomArrayList.getInt(100) <= 60) {
l1iteminstance1.setUpdateDmg(l1iteminstance1.getUpdateDmg() + 1); // 攻擊力 +1
//l1iteminstance1.setUpdateDmgModifier(l1iteminstance1.getUpdateDmgModifier() + 1); // 額外攻擊力 +1
//l1iteminstance1.setUpdateHitModifier(l1iteminstance1.getUpdateHitModifier() + 1); // 攻擊成功 +1
l1iteminstance1.setUpdateCount(l1iteminstance1.getUpdateCount() - 1); // 次數減少1
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 寶石鑲嵌成功,武器攻擊力+1."));
} else {
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 寶石鑲嵌失敗."));
}

if (ItemUpdate.getInstance().checkItem(l1iteminstance1.getId()) == 0) {
ItemUpdate.getInstance().storeItem(l1iteminstance1);
} else {
ItemUpdate.getInstance().updateItem(l1iteminstance1);
}

pc.sendPackets(new S_ItemStatus(l1iteminstance1));
pc.getInventory().removeItem(l1iteminstance, 1);
} else {
pc.sendPackets(new S_ServerMessage(79));
}
} else if (itemId == 90099) { // 命中之石
L1ItemInstance check_item = pc.getInventory().getItem(l1iteminstance1.getId());
if (check_item != null && check_item.getItem().getType2() == 1) { // 武器類

if (l1iteminstance1.getUpdateCount() <= 0) { // 次數為0
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 不可再鑲嵌寶石!"));
return;
}

if (RandomArrayList.getInt(100) <= 60) {
//l1iteminstance1.setUpdateDmg(l1iteminstance1.getUpdateDmg() + 1); // 攻擊力 +1
//l1iteminstance1.setUpdateDmgModifier(l1iteminstance1.getUpdateDmgModifier() + 1); // 額外攻擊力 +1
l1iteminstance1.setUpdateHitModifier(l1iteminstance1.getUpdateHitModifier() + 3); // 攻擊成功 +1
l1iteminstance1.setUpdateCount(l1iteminstance1.getUpdateCount() - 1); // 次數減少1
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 寶石鑲嵌成功,武器攻擊成功+3."));
} else {
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 寶石鑲嵌失敗."));
}

if (ItemUpdate.getInstance().checkItem(l1iteminstance1.getId()) == 0) {
ItemUpdate.getInstance().storeItem(l1iteminstance1);
} else {
ItemUpdate.getInstance().updateItem(l1iteminstance1);
}

pc.sendPackets(new S_ItemStatus(l1iteminstance1));
pc.getInventory().removeItem(l1iteminstance, 1);
} else {
pc.sendPackets(new S_ServerMessage(79));
}
} else if (itemId == 90100) { // 額外攻擊之石
L1ItemInstance check_item = pc.getInventory().getItem(l1iteminstance1.getId());
if (check_item != null && check_item.getItem().getType2() == 1) { // 武器類

if (l1iteminstance1.getUpdateCount() <= 0) { // 次數為0
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 不可再鑲嵌寶石!"));
return;
}

if (RandomArrayList.getInt(100) <= 60) {
//l1iteminstance1.setUpdateDmg(l1iteminstance1.getUpdateDmg() + 1); // 攻擊力 +1
l1iteminstance1.setUpdateDmgModifier(l1iteminstance1.getUpdateDmgModifier() + 1); // 額外攻擊力 +1
//l1iteminstance1.setUpdateHitModifier(l1iteminstance1.getUpdateHitModifier() + 1); // 攻擊成功 +1
l1iteminstance1.setUpdateCount(l1iteminstance1.getUpdateCount() - 1); // 次數減少1
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 寶石鑲嵌成功,武器額外攻擊力+1."));
} else {
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 寶石鑲嵌失敗."));
}

if (ItemUpdate.getInstance().checkItem(l1iteminstance1.getId()) == 0) {
ItemUpdate.getInstance().storeItem(l1iteminstance1);
} else {
ItemUpdate.getInstance().updateItem(l1iteminstance1);
}

pc.sendPackets(new S_ItemStatus(l1iteminstance1));
pc.getInventory().removeItem(l1iteminstance, 1);
} else {
pc.sendPackets(new S_ServerMessage(79));
}
} else if (itemId == 30003) { // 100%武器攻擊卷軸
L1ItemInstance check_item = pc.getInventory().getItem(l1iteminstance1.getId());
if (check_item != null && check_item.getItem().getType2() == 1) { // 武器類

if (l1iteminstance1.getUpdateCount() <= 0) { // 次數為0
pc.sendPackets(new S_ServerMessage(79));
return;
}

l1iteminstance1.setUpdateCount(l1iteminstance1.getUpdateCount() - 1); // 次數減少1

if (RandomArrayList.getInt(100) <= 50) {
l1iteminstance1.setUpdateDmgModifier(l1iteminstance1.getUpdateDmgModifier() + 1); // 額外攻擊力 +1
l1iteminstance1.setUpdateHitModifier(l1iteminstance1.getUpdateHitModifier() + 1); // 攻擊成功 +1
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 強化武器屬性成功"));
} else {
l1iteminstance1.setUpdateDmg(l1iteminstance1.getUpdateDmg() + 1); // 攻擊力 +1
l1iteminstance1.setUpdateDmgModifier(l1iteminstance1.getUpdateDmgModifier() + 1); // 額外攻擊力 +1
pc.sendPackets(new S_ServerMessage(166, l1iteminstance1.getLogName() + " 強化武器屬性成功"));
}

if (ItemUpdate.getInstance().checkItem(l1iteminstance1.getId()) == 0) {
ItemUpdate.getInstance().storeItem(l1iteminstance1);
} else {
ItemUpdate.getInstance().updateItem(l1iteminstance1);
}
pc.sendPackets(new S_ItemStatus(l1iteminstance1));
pc.getInventory().removeItem(l1iteminstance, 1);
} else {
pc.sendPackets(new S_ServerMessage(79));
}
}



上一篇文章:天堂彩票中獎系統java教學!
下一篇文章:天堂簡易的仿官方新地龍三段變身java教學!

分享文章:分享到微博! 分享到臉書! 分享到噗浪! 分享到維特! 分享到Google+! 分享到LINE!