- UID
- 137702
- 閱讀權限
- 20
- 主題
- 32
- 帖子
- 64
- 精華
- 1
- A幣
- 338
- 在線時間
- 111 小時
- 最後登錄
- 2024-11-12
初窺門道
- 主題
- 32
- 帖子
- 64
- 精華
- 1
- 綜合社群主題發文量
- 0
- 電玩社群主題發文量
- 0
- 娛樂社群主題發文量
- 0
- 技術社群主題發文量
- 32
- 閱讀權限
- 20
- 註冊時間
- 2021-11-15
TA的每日心情 | 奮鬥 2024-1-28 13:17 |
---|
簽到天數: 1 天 連續簽到: 1 天 [LV.1]初來乍到
|
本帖最後由 chenhui540 於 2023-12-26 10:40 編輯
recvops包頭 每個版本的值不同,需要推算
# 任務道具
QUEST_ITEM = 0x19E
# 使用任務道具
USE_ITEM_QUEST = 0x1A0
源碼部分
搜索:
//QUEST_ITEM, //header -> questid(int) -> 1/0(byte, open or close)
USE_ITEM_QUEST,
替換:
QUEST_ITEM,
USE_ITEM_QUEST,
搜索:
case USE_ITEM_QUEST:
NPCHandler.UseItemQuest(slea, c);
break;
替換:
case USE_ITEM_QUEST:
NPCHandler.UseItemQuest(slea, c);
break;
case QUEST_ITEM:
NPCHandler.QuestItem(slea, c);
break;
搜索:
public static final void UseItemQuest(final LittleEndianAccessor slea, final MapleClient c) {
final short slot = slea.readShort();
final int itemId = slea.readInt();
final Item item = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem(slot);
final int qid = slea.readInt();
final MapleQuest quest = MapleQuest.getInstance(qid);
final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
Pair<Integer, List<Integer>> questItemInfo = null;
boolean found = false;
for (Item i : c.getPlayer().getInventory(MapleInventoryType.ETC)) {
if (i.getItemId() / 10000 == 422) {
questItemInfo = ii.questItemInfo(i.getItemId());
if (questItemInfo != null && questItemInfo.getLeft() == qid && questItemInfo.getRight() != null && questItemInfo.getRight().contains(itemId)) {
found = true;
break; //i believe it's any order
}
}
}
if (quest != null && found && item != null && item.getQuantity() > 0 && item.getItemId() == itemId) {
final int newData = slea.readInt();
final MapleQuestStatus stats = c.getPlayer().getQuestNoAdd(quest);
if (stats != null && stats.getStatus() == 1) {
stats.setCustomData(String.valueOf(newData));
c.getPlayer().updateQuest(stats, true);
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, slot, (short) 1, false);
}
}
}
替換:
public static final void UseItemQuest(final LittleEndianAccessor slea, final MapleClient c) {
slea.readByte();
final short slot = slea.readByte();
slea.readByte();
final int itemId = slea.readInt();
final Item item = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem(slot);
final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
int qid = ii.questItemInfo(itemId).left;
final MapleQuest quest = MapleQuest.getInstance(qid);
if (quest != null && item != null && item.getQuantity() > 0) {
final MapleQuestStatus stats = c.getPlayer().getQuestNoAdd(quest);
if (stats != null && stats.getStatus() == 1) {
if (stats.getCustomData()== null){
stats.setCustomData(String.valueOf(0));
}
int num = 100;
stats.setCustomData(String.valueOf(Long.parseLong(stats.getCustomData()) + num));
c.getPlayer().updateQuest(stats, true);
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, slot, (short) 1, false);
c.announce(MaplePacketCreator.enableActions());
}
}
}
public static final void QuestItem(final LittleEndianAccessor slea, final MapleClient c) {
final int qid = slea.readShort();
final MapleQuest quest = MapleQuest.getInstance(qid);
final MapleQuestStatus stats = c.getPlayer().getQuestNoAdd(quest);
c.getPlayer().updateQuest(stats, true);
c.announce(MaplePacketCreator.enableActions());
}
搜索:
if (attacker.getInventory(MapleInventoryType.EQUIPPED).findById(1122017) != null && attacker.getPendantExp() > 0 || attacker.getInventory(MapleInventoryType.EQUIPPED).findById(1122156) != null && attacker.getPendantExp() > 0) {
Equipment_Bonus_EXP += (int) exp / 10 * attacker.getPendantExp();
}
attacker.getTrait(MapleTraitType.charisma).addExp(stats.getCharismaEXP(), attacker);
attacker.gainExpMonster(exp, true, highestDamage, pty, Class_Bonus_EXP, Equipment_Bonus_EXP, Premium_Bonus_EXP, stats.isPartyBonus(), stats.getPartyBonusRate());
}
attacker.mobKilled(getId(), lastskillID);
}
替換:
if (attacker.getInventory(MapleInventoryType.EQUIPPED).findById(1122017) != null && attacker.getPendantExp() > 0 || attacker.getInventory(MapleInventoryType.EQUIPPED).findById(1122156) != null && attacker.getPendantExp() > 0) {
Equipment_Bonus_EXP += (int) exp / 10 * attacker.getPendantExp();
}
if ((attacker.getQuestStatus(20522) == 1 || attacker.getQuestStatus(20526) == 1) && attacker.getQuestStatus(20514) == 1 && attacker.itemQuantity(4220137) > 0) {
final int mobexp = Integer.parseInt(attacker.getQuestNAdd(MapleQuest.getInstance(20514)).getCustomData()) + exp;
attacker.getQuestNAdd(MapleQuest.getInstance(20514)).setCustomData(mobexp + "");
attacker.updateQuest(attacker.getQuestNAdd(MapleQuest.getInstance(20514)), true);
exp = (int) (exp * 0.9);
}
if (attacker.getQuestStatus(23961) == 1 && attacker.getQuestStatus(23980) == 1 && attacker.itemQuantity(4220178) > 0) {
final int mobexp = Integer.parseInt(attacker.getQuestNAdd(MapleQuest.getInstance(23980)).getCustomData()) + exp;
attacker.getQuestNAdd(MapleQuest.getInstance(23980)).setCustomData(mobexp + "");
attacker.updateQuest(attacker.getQuestNAdd(MapleQuest.getInstance(23980)), true);
exp = (int) (exp * 0.9);
}
if (attacker.getQuestStatus(23968) == 1 && attacker.getQuestStatus(23981) == 1 && attacker.itemQuantity(4220179) > 0) {
final int mobexp = Integer.parseInt(attacker.getQuestNAdd(MapleQuest.getInstance(23981)).getCustomData()) + exp;
attacker.getQuestNAdd(MapleQuest.getInstance(23981)).setCustomData(mobexp + "");
attacker.updateQuest(attacker.getQuestNAdd(MapleQuest.getInstance(23981)), true);
exp = (int) (exp * 0.9);
}
attacker.getTrait(MapleTraitType.charisma).addExp(stats.getCharismaEXP(), attacker);
attacker.gainExpMonster(exp, true, highestDamage, pty, Class_Bonus_EXP, Equipment_Bonus_EXP, Premium_Bonus_EXP, stats.isPartyBonus(), stats.getPartyBonusRate());
}
attacker.mobKilled(getId(), lastskillID);
}
頁首添加:
import server.quest.MapleQuest;
腳本部分在開始任務的時候需要給予完成條件的開始項
/*
名字: 作戰3階段:可愛的小鳥
地圖: 遺忘的時間之路<1>
描述: 220070000
*/
var status = -1;
function start(mode, type, selection) {
switch (mode) {
case -1:
qm.dispose();
return;
case 0:
if (status > 1) {
qm.sendOk("哼……看來你好像不是很喜歡動物。這麼可愛的動物……我寧願不吃漢堡,也要給牠們吃。");
qm.dispose();
return;
}
status--;
break;
case 1:
status++;
break;
}
switch (status) {
case 0:
qm.sendNext("哇!這個喂過了,這個也喂過了,這個喂過了嗎?啊!第3個還沒喂過!來,快吃吧!唉~都張著嘴巴,我都不知道到底哪個肚子餓了……啊,你來啦?");
break;
case 1:
qm.sendNextPrev("唉……太忙了。不久前我聽研究員們說,咕咕鐘是受到了拉圖斯的支配才會變成那樣的。只要好好馴養,牠們就會變成可愛又聽話的鳥。所以趁現在有空,我正在試著飼養牠們。");
break;
case 2:
qm.sendYesNo("不過……一下子養了十隻,讓我覺得很累……食物也很難收集到……雖然我很喜歡牠們。你能幫我養一隻嗎?我送給你。");
break;
case 3:
if (qm.getPlayer().getInventory(Packages.client.inventory.MapleInventoryType.ETC).getNumFreeSlot() < 1) {
qm.getClient().getSession().write(Packages.tools.packet.MaplePacketCreator.serverNotice(1, "其他道具視窗的欄位不足"));
qm.dispose();
return;
}
Packages.server.quest.MapleQuest.getInstance(3250).forceStart(qm.getPlayer(), qm.getNpc(), null);
Packages.server.quest.MapleQuest.getInstance(7067).forceStart(qm.getPlayer(), qm.getNpc(), 0);//給予讀取任務完成的條件
qm.gainItem(4220046, qm.getPlayer().itemQuantity(4220046) ? 0 : 1);
qm.dispose();
}
}
function end(mode, type, selection) {
switch (mode) {
case -1:
qm.dispose();
return;
case 0:
status--;
break;
case 1:
status++;
break;
}
switch (status) {
case 0:
qm.sendNext("小鳥這麼快就長大了,看來你有好好照顧牠哦。好了,小鳥交給我吧。");
break;
case 1:
qm.sendPrev("牠們本來都不屬於這裡,我會將它們送回到原來的世界。辛苦你了。\r\n\r\n#fUI/UIWindow.img/QuestIcon/4/0# \r\n\r\n#fUI/UIWindow.img/QuestIcon/8/0# 100000 exp");
break;
case 2:
Packages.server.quest.MapleQuest.getInstance(3250).forceComplete(qm.getPlayer(), qm.getNpc());
qm.gainItem(4220046, -1);
qm.gainExp(100000);
qm.dispose();
}
}
空白的卷軸.rar
(2.13 KB, 下載次數: 881)
|
|