| 赞 | 168 |
| VIP | |
| 好人卡 | |
| 积分 | 229 |
| 经验 | |
| 最后登录 | 2025-4-1 |
| 在线时间 | 8598 小时 |
- 梦石
- 0
- 星屑
- 22879
- 在线时间
- 8598 小时
- 注册时间
- 2011-12-31
- 回帖
- 3270
|
发表于 2016-2-24 17:26:46
|
显示全部楼层
本帖最后由 tseyik 于 2016-2-24 17:27 编辑
锡城彭于晏 发表于 2016-2-24 16:45 
中文说明链接进不去了,请问还有别的链接吗
任務系統.js
GameusQuestSystem.rar
(9.1 KB, 下载次数: 254)
獨立的任務編輯器
GameusQuestEditor.rar
(247.68 KB, 下载次数: 231)
如果要使用這個插件,
記得在開始遊戲前記得將它的任務編輯器打開一遍(任務編輯器需先放在項目目録),json檔才會建立,
否則會出現「找不到$gameQuest.json」的錯誤。
任務系統的指令翻譯。更完整的翻譯在插件中。
Quest Add 3
在任務介面新增3號任務。
Quest NextStep 4
讓4號任務進行到下一步。
Quest BackStep 5
讓5號任務退回到上一步。現在正在進行的步驟會被回退,不管此步進行到何處。
Quest Complete 6
讓6號任務完成。如果自動報酬是開著的,那麼這個指令同時也會給出報酬。
Quest Fail 7
讓7號任務失敗。
Quest Remove 8
將8號任務從任務清單中移出。
Quest Reset 9
重置9號任務。這個任務的一切都會回到最開始接下的狀態。
特別注意到,你為這個任務自己安排的開關和變數要自己重置!
Quest Open
打開任務視窗。
這個指令只是實作了腳本中的SceneManager.push(Scene_Quest)。
Gameus Quest System- //=============================================================================
- // Gameus Quest System
- // Author gameus
- // Version 1.0
- // CHT version fixed by JEK.
- //-----------------------------------------------------------------------------
- // Intro:
- // This is a (for the most part) basic quest system. Has a basic layout to help
- // players keep track of all the different quests they might encounter. Also
- // gives you plenty of commands and script calls to keep track of said quests
- // behind the scenes.
- //
- // Features:
- // Simple UI to keep track of quests with some customization options
- // Friendly commands to track/complete/fail/reset/count/progress quests
- // Auto rewards upon quest completion (optional)
- // Quest categories (optional)
- // Full blown quest editor included
- //
- //
- // Instructions:
- // Place in your plugins folder and save as 'GameusQuestSystem.js'
- // Configure the options as you please.
- //
- // I highly recommend checking out the demo (includes Quest Editor)
- // [url]http://jugglingcode.com/scripts/MV/QuestSystem/Demo.zip[/url]
- //
- // Credits:
- // gameus ~ For creating it.
- //-----------------------------------------------------------------------------
- // 简介
- // 这是一个(大多情况下)基础的任务系统。这个系统拥有基本的输出方式,帮助玩家们
- // 追踪并关注各种他们可能遭遇到的不同任务。本系统也同样给予一些实用的脚本指令
- // 和插件命令,帮助使用者在场景之间取得、维护、控制这些任务的流程。
- //
- // 功能和特色:
- // 简单的使用者介面,方便追踪那些有着自定义选项的任务。
- // 提供友善的指令以追踪、控制、重置和计算各种任务
- // 任务完成自动提供报酬(可选)
- // 提供任务类别(可选)
- // 包括了完善独立的任务编辑器
- //
- //
- // 安装指示
- // 将程式码放置在插件资料夹下并另存为'GameusQuestSystem.js',
- // 按照你的需求配置选项即可。
- //
- // 我非常建议你可以参看本插件的范例档(附带任务编辑器):
- // [url]http://jugglingcode.com/scripts/MV/QuestSystem/Demo.zip[/url]
- //
- // 致谢名单
- // gameus ~ 本插件制作者
- //=============================================================================
- /*:
- * @plugindesc v1.0 - 一个简单的,具有许多可自行设定选项的任务系统。
- * @author gameus
- *
- * @param Auto Rewards
- * @desc 自动报酬,是否在完成任务最後一步时自动给予报酬。预设为true。
- * @default true
- *
- * @param ---------------
- *
- * @param ---文字翻译---
- *
- * @param ---------------
- *
- * @param Hidden Reward Text
- * @desc 用来显示未知报酬,预设:??????
- * @default ??????
- *
- * @param No Quests Text
- * @desc 预设:没有任务
- * @default 没有任务
- *
- * @param All Word
- * @desc 预设:全部
- * @default 全部
- *
- * @param Completed Word
- * @desc 预设:已完成
- * @default 已完成
- *
- * @param Failed Word
- * @desc 预设:已失败
- * @default 已失败
- *
- * @param In-Progress Word
- * @desc 预设:进行中
- * @default 进行中
- *
- * @param Steps Word
- * @desc 预设:阶段
- * @default 阶段
- *
- * @param Rewards Word
- * @desc 预设:报酬
- * @default 报酬
- *
- * @param ---------------
- *
- * @param ---显示选项---
- *
- * @param ---------------
- *
- * @param Reverse Layout
- * @desc 是否反转任务清单顺序,预设为false
- * @default false
- *
- * @param Filter Position
- * @desc 过滤视窗(预设显示"全部")的位置。可以选择上(Top)或下(Bottom)。
- * @default Top
- *
- * @param Use Categories
- * @desc 是否使用自订子类别,例如"支线", "特殊", "隐藏"等任务类。预设为true
- * @default true
- *
- * @param Show Empty Categories
- * @desc 是否显示空类别。0:不显示,1:灰阶显示,2:显示,但在其下显示"没有任务"
- * @default 0
- *
- * @param Show Quest Count
- * @desc 是否显示每类的任务数量。预设为true
- * @default true
- *
- * @param Bullet Character
- * @desc 用於显示在阶段和报酬之前的角色。例如直接输入「疾风丸」,不需引号。
- * @default -
- *
- * @param Max Steps
- * @desc 定义一个任务一次所显示的最大阶段。
- * 只会显示已完成或进行中的阶段。当然是从後往前显示。
- * @default 3
- *
- * @param ---------------
- *
- * @param ---图片和图示选项---
- *
- * @param ---------------
- *
- * @param Use Icons
- * @desc 是否允许显示任务图示。预设为true
- * @default true
- *
- * @param Completed Image
- * @desc 用於绘制在已完成任务上的图片。如果没有图片请留白。
- *
- * @param Completed Image Opacity
- * @desc 已完成图片的透明度。
- * @default 128
- *
- * @param Failed Image
- * @desc 用於绘制在已失败任务上的图片。如果没有图片请留白。
- *
- * @param Failed Image Opacity
- * @desc 已完成图片的透明度。
- * @default 128
- *
- * @help
- * 回报与插件和编辑器有关的Bug,请至:
- * [url]http://forums.rpgmakerweb.com/index.php?/topic/49234-gameus-quest-system/[/url]
- * 在回报之前,请先确认你是否使用了过期的插件。
- *
- * 我非常建议你可以参看本插件的范例档(附带任务编辑器):
- * [url]http://jugglingcode.com/scripts/MV/QuestSystem/Demo.zip[/url]
- * ----------------------------------------------------
- * 插件指令清单
- * QuestID:任务编号
- * ----------------------------------------------------
- * Quest Add QuestID
- * 在任务介面新增任务。
- *
- * Quest NextStep QuestID
- * 让任务进行到下一步。
- *
- * Quest BackStep QuestID
- * 让任务退回到上一步。现在正在进行的步骤会被回退,不管此步进行到何处。
- *
- * Quest Complete QuestID
- * 让任务完成。如果自动报酬是开着的,那麽这个指令同时也会给出报酬。
- *
- * Quest Fail QuestID
- * 让任务失败。
- *
- * Quest Remove QuestID
- * 将任务从任务清单中移出。
- *
- * Quest Reset QuestID
- * 重置任务。这个任务的一切都会回到最开始接下的状态。
- * 特别注意到,你为这个任务自己安排的开关和变数要自己重置!
- *
- * Quest Open
- * 打开任务视窗。意义等同於SceneManager.push(Scene_Quest)。
- *
- * ----------------------------------------------------
- * 这里是可以使用在条件分歧里的脚本指令清单
- * ----------------------------------------------------
- * SceneManager.push(Scene_Quest)
- * 打开任务视窗。与Quest Open相同但适用於跨插件呼叫,或对SceneManager.push特别喜爱者。
- *
- * $gameQuests.get(quest_id).completed()
- * $gameQuests.get(quest_id).failed()
- * $gameQuests.get(quest_id).inProgress()
- * 用於取得某个任务的状态和进度。
- * 注意:即使队伍在可能并没有该任务的情形下,依然会回传true/false!
- *
- * $gameParty.hasQuest(quest_id)
- * 用於取得队伍是否开启了这项任务。请与上面的指令合并使用以避免误判。
- *
- * $gameParty.hasQuests([quest ids], filter)
- * 此指令一次检测队伍是否开启了某些任务,以及它们是否全部在某个类别中。请勿与上面的指令搞混。
- * 过滤子可以是"progress"(进行中)、"completed"(已完成)或"failed"(已失败)。
- * 如果以上条件都满足,则回传true。
- * 例如,可以使用在接取某任务前,确认该任务必须完成的一海票前置任务。
- *
- * $gameQuests.get(quest_id).currentStep === step_number
- * 用於取得某个任务正进行到哪个阶段。阶段数从0开始。
- * 注意:即使该任务并未开启,此指令仍然会回传数字!请与$gameParty.hasQuest(quest_id)并用!
- *
- * $gameQuests.get(quest_id).status === "status"
- * 用於取得某个任务的状态。
- * "status"可以是"progress"(进行中)、"completed"(已完成)或"failed"(已失败)。
- *
- * $gameQuests.totalQuests(filter)
- * 用於取得某状态下有多少任务。
- * 过滤子可以是"progress"(进行中)、"completed"(已完成)或"failed"(已失败)。
- * 这个指令会取得该状态所有类别的任务,不管队伍是否拥有!
- *
- * $gameParty.totalQuests(filter)
- * 与上面指令相同,但只会取得队伍拥有的任务。
- *
- */
-
- // Import 'Quest System'
- var GameusScripts = GameusScripts || {};
- GameusScripts["Config"] = GameusScripts["Config"] || {};
- GameusScripts["QuestSystem"] = 1.0;
- GameusScripts["Config"]["QuestSystem"] = PluginManager.parameters("GameusQuestSystem");
- // Initialize global quest variables
- var $dataQuests = null;
- var $gameQuests = null;
- // Load quest data
- DataManager._databaseFiles.push(
- {name: "$dataQuests", src: "Quests.json"}
-
- );
- //---------------------------------------------------------------------------------------------
- // Alias methods
- //---------------------------------------------------------------------------------------------
- gameus_Quest_Party_Initialize = Game_Party.prototype.initialize;
- gameus_Quest_Data_Initialize = DataManager.createGameObjects;
- gameus_Quest_Save_Data = DataManager.makeSaveContents;
- gameus_Quest_Load_Data = DataManager.extractSaveContents;
- gameus_Quest_Plugin_Commands = Game_Interpreter.prototype.pluginCommand;
-
- //---------------------------------------------------------------------------------------------
- // Plugin Commands
- //---------------------------------------------------------------------------------------------
- Game_Interpreter.prototype.pluginCommand = function(command, args) {
- gameus_Quest_Plugin_Commands.call(this, command, args);
- if (command.toLowerCase() === "quest") {
- switch (args[0].toLowerCase()) {
- case 'open':
- SceneManager.push(Scene_Quest);
- break;
- case 'add':
- $gameParty.addQuest(Number(args[1]));
- break;
- case 'remove':
- $gameParty.removeQuest(Number(args[1]));
- break;
- case 'complete':
- $gameQuests.get(Number(args[1])).complete();
- break;
- case 'fail':
- $gameQuests.get(Number(args[1])).fail();
- break;
- case 'reset':
- $gameQuests.get(Number(args[1])).reset();
- break;
- case 'nextstep':
- $gameQuests.get(Number(args[1])).nextStep();
- break;
- case 'backstep':
- $gameQuests.get(Number(args[1])).backStep();
- break;
- }
- }
- };
- //---------------------------------------------------------------------------------------------
- // DataManager
- //---------------------------------------------------------------------------------------------
- DataManager.makeSaveContents = function() {
- contents = gameus_Quest_Save_Data.call(this);
- // Include the quests in the save file
- contents.quests = $gameQuests;
- return contents;
- };
-
- DataManager.extractSaveContents = function(contents) {
- gameus_Quest_Load_Data.call(this, contents);
- // Then take them back because we really don't trust banks
- $gameQuests = contents.quests;
- };
-
- DataManager.createGameObjects = function() {
- gameus_Quest_Data_Initialize.call(this);
- // Create global quests
- $gameQuests = new Game_Quests();
- };
-
- //---------------------------------------------------------------------------------------------
- // Game_Party
- //---------------------------------------------------------------------------------------------
- Game_Party.prototype.initialize = function() {
- gameus_Quest_Party_Initialize.call(this);
- // Initialize quest data
- this.quests = [];
- };
-
- Game_Party.prototype.addQuest = function(quest_id) {
- // Does party already have quest?
- if (this.quests.indexOf(quest_id) < 0) {
- // If not, give that crap to them. They don't have a choice now.
- this.quests.push(quest_id);
- }
- };
-
- // Removes the quest from the party. NOTE: This does NOT reset the quest
- Game_Party.prototype.removeQuest = function(quest_id) {
- // Check if quest exists
- if (this.quests.indexOf(quest_id) > -1) {
- // I was wrong...
- var index = this.quests.indexOf(quest_id);
- this.quests.splice(index, 1);
- }
- };
-
- // Returns total number of quests the party has
- // filter can be "all", "progress" "completed" or "failed"
- Game_Party.prototype.totalQuests = function(filter) {
- // Returns a list of ALL quests
- if (filter === undefined || filter === "all")
- return this.quests.length;
- // Time to cycle through quests....(dammit, I did this exact thing in the quest list window)
- var count = 0;
- for (var i = 0; i < this.quests.length; i += 1) {
- var q = $gameQuest.get(this.quests[i]);
- if (q.status === filter.toLowerCase())
- count += 1;
- }
- return count;
- };
-
- // Gets all quest id's
- Game_Party.prototype.getQuests = function(filter) {
- // Returns a list of ALL quests
- if (filter === undefined || filter === "all")
- return this.quests;
- // Time to cycle through quests....(dammit, I did this exact thing in the quest list window)
- var data = [];
- for (var i = 0; i < this.quests.length; i += 1) {
- var q = $gameQuest.get(this.quests[i]);
- if (q.status === filter.toLowerCase())
- data.push(q.questId);
- }
- return data;
- };
-
- // This method is actually extremely useless. Ignore it for now.
- Game_Party.prototype.getQuest = function(index) {
- return $gameQuests.get(this.quests[index]);
- };
-
- Game_Party.prototype.hasQuest = function(quest_id){
- // Returns whether or not they have the quest
- return this.quests.indexOf(quest_id) > -1;
- };
-
- // This checks a list of quests and its status.
- // If the party has all and they match the input filter, it returns true
- // Used to check a range of quests completion
- Game_Party.prototype.hasQuests = function(quests, filter) {
- flag = true;
- for (var i = 0; i < quests.length; i += 1) {
- if (!this.hasQuest(quests[i]))
- flag = false;
- if ($gameQuests.get(quests[i]).status !== filter)
- flag = false;
- }
- return flag;
- }
-
- //---------------------------------------------------------------------------------------------
- // Game_Quest
- //---------------------------------------------------------------------------------------------
- function Game_Quest() {
- this.initialize.apply(this, arguments);
- };
-
- Game_Quest.prototype.initialize = function(questId) {
- var questData = $dataQuests[questId];
- this.questId = questId;
- this.rawData = questData;
- this.cat = questData.cat;
- this.name = questData.name;
- this.desc = questData.desc;
- this.rewards = questData.rewards;
- this.icon = questData.icon;
- this.steps = questData.steps;
- this.maxSteps = this.steps.length;
- this.currentStep = 0;
- this.status = "progress";
- };
-
- Game_Quest.prototype.giveRewards = function() {
- for (var i = 0; i < this.rewards.length; i += 1) {
- var reward = this.rewards[i];
- switch (reward[0]) {
- case "item":
- item = $dataItems[reward[1]];
- $gameParty.gainItem(item, Number(reward[2]));
- break;
- case "armor":
- item = $dataArmors[reward[1]];
- $gameParty.gainItem(item, Number(reward[2]));
- break;
- case "weapon":
- item = $dataWeapons[reward[1]];
- $gameParty.gainItem(item, Number(reward[2]));
- break;
- case "xp":
- for (var j = 0; j < $gameParty.members().length; j++) {
- $gameParty.members()[j].gainExp(reward[1]);
- };
- break;
- case "gold":
- $gameParty.gainGold(Number(reward[1]));
- break;
- }
- }
- };
-
- Game_Quest.prototype.completed = function() {
- return this.status == "completed";
- }
-
- Game_Quest.prototype.inProgress = function() {
- return this.status == "progress";
- }
-
- Game_Quest.prototype.failed = function() {
- return this.status == "failed";
- }
-
- Game_Quest.prototype.nextStep = function() {
- this.currentStep = this.currentStep + 1 > this.maxSteps - 1 ? this.maxSteps - 1 : this.currentStep + 1;
- };
-
- Game_Quest.prototype.backStep = function() {
- this.currentStep = this.currentStep - 1 < 0 ? 0 : this.currentStep - 1;
- };
-
- Game_Quest.prototype.currentStep = function() {
- return this.currentStep;
- };
-
- Game_Quest.prototype.fail = function() {
- this.status = "failed";
- };
-
- Game_Quest.prototype.complete = function() {
- if ((GameusScripts["Config"]["QuestSystem"]["Auto Rewards"] || "false").toLowerCase() === "true") {
- this.giveRewards();
- }
- this.currentStep = this.maxSteps - 1;
- this.status = "completed";
- };
-
- Game_Quest.prototype.reset = function() {
- this.status = "progress";
- this.currentStep = 0;
- };
- //---------------------------------------------------------------------------------------------
- // Game_Quests
- //---------------------------------------------------------------------------------------------
- function Game_Quests() {
- this.initialize.apply(this, arguments);
- };
-
- Game_Quests.prototype.initialize = function() {
- this.data = [];
- };
-
- Game_Quests.prototype.get = function(quest_id) {
- if ($dataQuests[quest_id]) {
- if (!this.data[quest_id]) {
- this.data[quest_id] = new Game_Quest(quest_id);
- }
- return this.data[quest_id];
- }
- return null;
- };
-
- Game_Quests.prototype.categories = function() {
- if ($dataQuests[0])
- return $dataQuests[0];
- return null;
- };
-
- Game_Quests.prototype.totalQuests = function(filter) {
- // Returns a list of ALL quests
- if (filter === undefined || filter === "all")
- return $dataQuests.length;
- // Time to cycle through quests....(dammit, I did this exact thing in the quest list window)
- var count = 0;
- for (var i = 0; i < $dataQuests.length; i += 1) {
- var q = this.get(this.quests[i]);
- if (q.status === filter.toLowerCase())
- count += 1;
- }
- return data;
- };
- //---------------------------------------------------------------------------------------------
- // Window_Base
- //---------------------------------------------------------------------------------------------
- Window_Base.prototype.sliceText = function(text, width) {
- var words = text.split(" ");
- if (words.length === 1)
- return words;
- var result = [];
- var current_text = words.shift();
- for (var i = 0; i < words.length; i += 1) {
- var word = words[i];
- var textW = this.contents.measureTextWidth(current_text + " " + word);
- if (textW > width) {
- result.push(current_text);
- current_text = word;
- } else {
- current_text += " " + word;
- }
- if (i >= words.length - 1)
- result.push(current_text)
- }
- return result
- }
- //---------------------------------------------------------------------------------------------
- // Window_QuestInfo
- //---------------------------------------------------------------------------------------------
- function Window_QuestInfo() {
- this.initialize.apply(this, arguments);
- }
-
- Window_QuestInfo.prototype = Object.create(Window_Selectable.prototype);
- Window_QuestInfo.prototype.constructor = Window_QuestInfo;
-
- Window_QuestInfo.prototype.initialize = function() {
- var xx = (GameusScripts["Config"]["QuestSystem"]["Reverse Layout"] || "false").toLowerCase() === "true" ? 0 : 320;
- this.failedImg = GameusScripts["Config"]["QuestSystem"]["Failed Image"] || '';
- this.completedImg = GameusScripts["Config"]["QuestSystem"]["Completed Image"] || '';
- if (this.failedImg !== '')
- this.failedImg = ImageManager.loadPicture(this.failedImg, 0);
- if (this.completedImg !== '')
- this.completedImg = ImageManager.loadPicture(this.completedImg, 0);
- this.quest = 0;
- this.offY = 0;
- this.lineY = 0;
- this.resizeFlag = false;
- Window_Selectable.prototype.initialize.call(this, xx, 0, Graphics.boxWidth - 320, Graphics.boxHeight);
- this.questBitmap = new Bitmap(this.contentsWidth(), this.contentsHeight());
- this.refresh();
- };
-
- Window_QuestInfo.prototype.setQuest = function(quest_id) {
- this.quest = quest_id;
- this.offY = 0;
- this.resizeFlag = false;
- this.createQuestBitmap();
- this.refresh();
- };
-
- Window_QuestInfo.prototype.refresh = function() {
- this.contents.clear();
- if (this.quest > 0) {
- this.contents.blt(this.questBitmap, 0, this.offY, this.contentsWidth(), this.contentsHeight(), 0, 0, this.contentsWidth(), this.contentsHeight());
- }
- }
-
- // This function is used to keep track of the height of the bitmap, has to be called after every line of text drawn
- Window_QuestInfo.prototype.write = function() {
- this.lineY += this.lineHeight() + this.textPadding();
- if (this.lineY > this.questBitmap.height) {
- this.questBitmap.resize(this.questBitmap.width, this.lineY);
- this.resizeFlag = true;
- }
- }
-
- Window_QuestInfo.prototype.createQuestBitmap = function() {
- this.questBitmap.clear();
- if (this.quest > 0) {
- this.questBitmap.paintOpacity = 255;
- var q = $gameQuests.get(this.quest);
- this.drawQuestInfo(q);
- this.drawQuestSteps(q);
- this.drawQuestRewards(q);
- // Check for resize, then redraw
- if (this.resizeFlag) {
- this.resizeFlag = false;
- this.createQuestBitmap();
- }
- if (this.failedImg !== '' && q.status === "failed") {
- this.questBitmap.paintOpacity = Number(GameusScripts["Config"]["QuestSystem"]["Failed Image Opacity"] || 128);
- this.questBitmap.blt(this.failedImg, 0, 0, this.failedImg.width, this.failedImg.height,
- this.contentsWidth() / 2 - this.failedImg.width / 2,
- this.contentsHeight() / 2 - this.failedImg.height / 2);
- }
- if (this.completedImg !== '' && q.status === "completed") {
- this.questBitmap.paintOpacity = Number(GameusScripts["Config"]["QuestSystem"]["Completed Image Opacity"] || 128);
- this.questBitmap.blt(this.completedImg, 0, 0, this.completedImg.width, this.completedImg.height,
- this.contentsWidth() / 2 - this.completedImg.width / 2,
- this.contentsHeight() / 2 - this.completedImg.height / 2);
- }
- }
- };
-
- Window_QuestInfo.prototype.drawQuestInfo = function(q) {
- var headerX = 0;
- this.questBitmap.paintOpacity = 255;
- this.lineY = 0;
- if (q.icon > -1) {
- this.drawIcon(q.icon, 0, this.lineY);
- headerX = 40;
- }
- this.questBitmap.textColor = this.systemColor();
- this.questBitmap.drawText(q.name, headerX, this.lineY, this.contentsWidth() - headerX, this.lineHeight());
- this.write();
- this.questBitmap.textColor = this.normalColor();
- var lines = this.sliceText(q.desc, this.contentsWidth());
- for (var i = 0; i < lines.length; i += 1) {
- this.questBitmap.drawText(lines[i], 0, this.lineY, this.contentsWidth(), this.lineHeight());
- this.write();
- }
- this.drawHorzLine(this.lineY);
- this.write();
- }
-
- Window_QuestInfo.prototype.drawQuestSteps = function(q) {
- // Draw the quest steps
- var bullet = String(GameusScripts["Config"]["QuestSystem"]["Bullet Character"] || "-" ) + " ";
- this.questBitmap.textColor = this.systemColor();
- this.questBitmap.drawText("进度", 0, this.lineY, this.contentsWidth(), this.lineHeight());
- this.write();
- this.questBitmap.textColor = this.normalColor();
- var maxSteps = Number(GameusScripts["Config"]["QuestSystem"]["Max Steps"] || 3);
- if (maxSteps === 0)
- maxSteps = q.steps.length;
- if (q.currentStep >= q.steps.length)
- q.currentStep = q.steps.length - 1;
- var startStep = Math.max(0, q.currentStep - maxSteps + 1);
- var drawableSteps = q.steps.slice(startStep, q.currentStep + 1);
- for (var i = 0; i < drawableSteps.length; i += 1) {
- var step = drawableSteps[i];
- var stepText = bullet + step[0];
- if (step[1] === true) {
- var varVal = $gameVariables.value(step[2]);
- var maxVal = step[3];
- if (step[4])
- stepText += " " + String(Math.floor(varVal / maxVal * 100)) + "%";
- else
- stepText += " " + String(varVal) + " / " + String(maxVal);
- }
- lines = this.sliceText(stepText, this.contentsWidth());
- var done = i + startStep < q.currentStep || (q.status === "completed" || q.status === "failed");
- this.questBitmap.paintOpacity = done ? 160 : 255
- for (var j = 0; j < lines.length; j += 1) {
- var bulletOffset = 0;
- if (j > 0)
- bulletOffset += this.contents.measureTextWidth(bullet);
- this.questBitmap.drawText(lines[j], bulletOffset, this.lineY, this.contentsWidth(), this.lineHeight());
- this.write();
- }
- }
- this.drawHorzLine(this.lineY);
- this.write();
- }
-
- Window_QuestInfo.prototype.drawQuestRewards = function(q) {
- var bullet = String(GameusScripts["Config"]["QuestSystem"]["Bullet Character"] || "-" ) + " ";
- // Draw Rewards
- this.questBitmap.textColor = this.systemColor();
- this.questBitmap.drawText("奖励", 0, this.lineY, this.contentsWidth(), this.lineHeight());
- this.write();
- this.questBitmap.textColor = this.normalColor();
- for (var i = 0; i < q.rewards.length; i += 1) {
- var reward = q.rewards[i];
- // If the reward is hidden and quest not completed yet...
- if (reward[3] === true && q.status !== "completed") {
- // Draw this shit as hidden
- var hidden = bullet + (GameusScripts["Config"]["QuestSystem"]["Hidden Reward Text"] || "??????");
- this.questBitmap.drawText(hidden, 0, this.lineY, this.contentsWidth(), this.lineHeight());
- this.write();
- continue;
- }
- var item = null;
- var amount = null;
- var done = (q.status === "completed" || q.status === "failed");
- this.questBitmap.paintOpacity = done ? 160 : 255
- switch (reward[0]) {
- case "item":
- item = $dataItems[reward[1]];
- amount = reward[2];
- this.questBitmap.drawText(bullet, 0, this.lineY, this.contentsWidth(), this.lineHeight());
- this.drawItemName(item, this.contents.measureTextWidth(bullet), this.lineY, this.contentsWidth());
- this.questBitmap.drawText("x" + String(amount), 0, this.lineY, this.contentsWidth(), this.lineHeight(), "right");
- this.write();
- break;
- case "armor":
- item = $dataArmors[reward[1]];
- amount = reward[2];
- this.questBitmap.drawText(bullet, 0, this.lineY, this.contentsWidth(), this.lineHeight());
- this.drawItemName(item, this.contents.measureTextWidth(bullet), this.lineY, this.contentsWidth());
- this.questBitmap.drawText("x" + String(amount), 0, this.lineY, this.contentsWidth(), this.lineHeight(), "right");
- this.write();
- break;
- case "weapon":
- item = $dataWeapons[reward[1]];
- amount = reward[2];
- this.questBitmap.drawText(bullet, 0, this.lineY, this.contentsWidth(), this.lineHeight());
- this.drawItemName(item, this.contents.measureTextWidth(bullet), this.lineY, this.contentsWidth());
- this.questBitmap.drawText("x" + String(amount), 0, this.lineY, this.contentsWidth(), this.lineHeight(), "right");
- this.write();
- break;
- case "xp":
- amount = reward[1];
- this.questBitmap.drawText(bullet + TextManager.exp, 0, this.lineY, this.contentsWidth(), this.lineHeight());
- this.questBitmap.drawText("x" + String(amount), 0, this.lineY, this.contentsWidth(), this.lineHeight(), "right");
- this.write();
- break;
- case "gold":
- amount = reward[1];
- this.questBitmap.drawText(bullet + TextManager.currencyUnit, 0, this.lineY, this.contentsWidth(), this.lineHeight());
- this.questBitmap.drawText("x" + String(amount), 0, this.lineY, this.contentsWidth(), this.lineHeight(), "right");
- this.write();
- break;
- case "custom":
- amount = this.sliceText(bullet + reward[1], this.contentsWidth());
- for (var j = 0; j < amount.length; j += 1) {
- var bulletOffset = 0;
- if (j > 0)
- bulletOffset += this.contents.measureTextWidth(bullet);
- this.questBitmap.drawText(amount[j], bulletOffset, this.lineY, this.contentsWidth(), this.lineHeight());
- this.write();
- }
- break;
- }
- }
- }
-
- // Borrow some drawing methods since we're drawing to a secondary bitmap
- Window_QuestInfo.prototype.drawItemName = function(item, x, y, width) {
- width = width || 312;
- if (item) {
- var iconBoxWidth = Window_Base._iconWidth + 8;
- this.questBitmap.textColor = this.normalColor();
- this.drawIcon(item.iconIndex, x - 2, y + 2);
- this.questBitmap.drawText(item.name, x + iconBoxWidth, y, width - iconBoxWidth, this.lineHeight());
- }
- };
-
- Window_QuestInfo.prototype.drawIcon = function(iconIndex, x, y) {
- var bitmap = ImageManager.loadSystem('IconSet');
- var pw = Window_Base._iconWidth;
- var ph = Window_Base._iconHeight;
- var sx = iconIndex % 16 * pw;
- var sy = Math.floor(iconIndex / 16) * ph;
- this.questBitmap.blt(bitmap, sx, sy, pw, ph, x, y);
- };
-
- Window_QuestInfo.prototype.drawHorzLine = function(y) {
- var lineY = y + this.lineHeight() / 2 - 1;
- this.questBitmap.paintOpacity = 48;
- this.questBitmap.fillRect(0, lineY, this.contentsWidth(), 2, this.normalColor());
- this.questBitmap.paintOpacity = 255;
- };
-
- // Update the up/down arrows to indicate scrolling is available
- Window_QuestInfo.prototype.updateArrows = function() {
- this.downArrowVisible = (this.questBitmap.height > this.contentsHeight() && this.offY < this.questBitmap.height - this.contentsHeight());
- this.upArrowVisible = this.offY > 0;
- };
-
- // Override the arrow key controls so we can scroll instead, let's be honest, that's way cooler
- Window_QuestInfo.prototype.isCursorMovable = function() {
- return (this.isOpenAndActive());
- };
- Window_QuestInfo.prototype.cursorDown = function(wrap) {
- if (this.questBitmap.height > this.contentsHeight() && this.offY < this.questBitmap.height - this.contentsHeight()) {
- SoundManager.playCursor();
- this.offY += this.lineHeight() + this.textPadding();
- this.refresh();
- }
- };
- Window_QuestInfo.prototype.cursorUp = function(wrap) {
- if (this.offY > 0) {
- SoundManager.playCursor();
- this.offY -= this.lineHeight() + this.textPadding();
- if (this.offY < 0)
- this.offY = 0;
- this.refresh();
- }
- };
-
- Window_QuestInfo.prototype.cursorPagedown = function() {
- this.cursorDown();
- };
- Window_QuestInfo.prototype.cursorPageup = function() {
- this.cursorUp();
- };
- Window_QuestInfo.prototype.cursorRight = function(wrap) {
- // We are basically...
- };
- Window_QuestInfo.prototype.cursorLeft = function(wrap) {
- // ...screwing the system
- };
-
- //---------------------------------------------------------------------------------------------
- // Window_Quests
- //---------------------------------------------------------------------------------------------
- function Window_Quests() {
- this.initialize.apply(this, arguments);
- };
- Window_Quests.prototype = Object.create(Window_Command.prototype);
- Window_Quests.prototype.constructor = Window_Quests;
-
- Window_Quests.prototype.initialize = function() {
- var xx = (GameusScripts["Config"]["QuestSystem"]["Reverse Layout"] || "false").toLowerCase() === "true" ? Graphics.boxWidth - 320 : 0;
- var yy = String(GameusScripts["Config"]["QuestSystem"]["Filter Position"]).toLowerCase() === "top" ? this.fittingHeight(1) : 0;
- // Stores all quests available from $gameParty
- this.qFilters = ["all", "progress", "completed", "failed"];
- this.filterIndex = 0;
- this.data = [];
- this.cats = $gameQuests.categories();
- this.expanded = [];
- for (var i = 0; i < this.cats.length; i += 1)
- this.expanded[i] = false;
- this.filter = "all";
- this.refreshQuests();
- Window_Command.prototype.initialize.call(this, xx, yy);
- };
-
- Window_Quests.prototype.windowWidth = function() {
- return 320;
- };
- Window_Quests.prototype.numVisibleRows = function() {
- return 10;
- };
-
- Window_Quests.prototype.windowHeight = function() {
- return Graphics.boxHeight - this.fittingHeight(1)
- }
-
- Window_Quests.prototype.drawItem = function(index) {
- var item = this._list[index];
- var rect = this.itemRectForText(index);
- var align = this.itemTextAlign();
- this.resetTextColor();
- this.changePaintOpacity(this.isCommandEnabled(index));
- var tempX = 0;
- if (item.symbol === "quest") {
- var q = $gameQuests.get(Number(item.ext));
- if (q.icon > -1 && (GameusScripts["Config"]["QuestSystem"]["Use Icons"]).toLowerCase() === "true") {
- this.drawIcon(q.icon, rect.x + 8, rect.y + 2);
- tempX = 40;
- }
- }
- this.drawText(this.commandName(index), rect.x + tempX / 2, rect.y, rect.width, align);
- };
-
-
- Window_Quests.prototype.questData = function(quest_id) {
- return $gameQuests.get(quest_id);
- };
-
- Window_Quests.prototype.refreshQuests = function() {
- this.data = $gameParty.getQuests();
- this.cats = $gameQuests.categories();
- this.counter = [];
- for (var i = 0; i < this.cats.length; i += 1)
- this.expanded[i] = false;
- for (var i = 0; i < this.cats.length; i += 1) {
- this.counter[i] = 0;
- for (var j = 0; j < this.data.length; j += 1) {
- var q = $gameQuests.get(this.data[j]);
- if (q.cat == i && (this.filter == q.status || this.filter == "all"))
- this.counter[i] += 1;
- }
- }
- };
- Window_Quests.prototype.setFilter = function(filter) {
- this.filter = filter;
- };
- Window_Quests.prototype.toggle = function(cat) {
- this.expanded[cat] = !this.expanded[cat];
- this.refresh();
- };
-
- Window_Quests.prototype.makeCommandList = function() {
- var q;
- var flag = false;
- var count = "";
- var useCats = (GameusScripts["Config"]["QuestSystem"]['Use Categories'] || "false").toLowerCase();
- var catMode = Number(GameusScripts["Config"]["QuestSystem"]["Show Empty Categories"] || 0);
- var showCount = (GameusScripts["Config"]["QuestSystem"]["Show Quest Count"] || "false").toLowerCase();
- if (useCats === "true") {
- for (var i = 0; i < this.cats.length; i += 1) {
- flag = true;
- if (showCount === "true")
- count = " (" + String(this.counter[i]) + ")";
- if (catMode == 1 && this.counter[i] == 0)
- flag = false;
- if (catMode > 0 || this.counter[i] > 0)
- this.addCommand(this.cats[i] + count, "cat", flag, String(i));
- if (this.expanded[i]) {
- flag = false;
- for (var j = 0; j < this.data.length; j += 1) {
- q = $gameQuests.get(this.data[j]);
- if ((q.status == this.filter || this.filter == "all") && i == q.cat) {
- flag = true;
- this.addCommand(" " + q.name, "quest", true, q.questId);
- }
- }
- if (!flag)
- this.addCommand(" " + GameusScripts["Config"]["QuestSystem"]["No Quests Text"] || "No Quests", "none");
- }
- }
- } else {
- for (var i = 0; i < this.data.length; i += 1) {
- q = $gameQuests.get(this.data[i]);
- if (q.status == this.filter || this.filter == "all")
- this.addCommand(q.name, "quest", true, q.questId);
- }
- }
- if (this._list.length < 1) {
- this.addCommand(GameusScripts["Config"]["QuestSystem"]["No Quests Text"] || "No Quests", "none");
- }
- };
-
- Window_Quests.prototype.cursorRight = function(wrap) {
- this.filterIndex = this.filterIndex + 1 > 3 ? 0 : this.filterIndex + 1;
- this.filter = this.qFilters[this.filterIndex];
- this.refreshQuests();
- this.refresh();
- this.select(0);
- };
- Window_Quests.prototype.cursorLeft = function(wrap) {
- this.filterIndex = this.filterIndex - 1 < 0 ? 3 : this.filterIndex - 1;
- this.filter = this.qFilters[this.filterIndex];
- this.refreshQuests();
- this.refresh();
- this.select(0);
- };
- //---------------------------------------------------------------------------------------------
- // Window_QuestFilter
- //---------------------------------------------------------------------------------------------
- function Window_QuestFilter() {
- this.initialize.apply(this, arguments);
- }
- Window_QuestFilter.prototype = Object.create(Window_Base.prototype);
- Window_QuestFilter.prototype.constructor = Window_QuestFilter;
- Window_QuestFilter.prototype.initialize = function() {
- this.qFilters = [
- GameusScripts["Config"]["QuestSystem"]["All Word"],
- GameusScripts["Config"]["QuestSystem"]["In-Progress Word"],
- GameusScripts["Config"]["QuestSystem"]["Completed Word"],
- GameusScripts["Config"]["QuestSystem"]["Failed Word"],
- ];
- var xx = (GameusScripts["Config"]["QuestSystem"]["Reverse Layout"] || "false").toLowerCase() === "true" ? Graphics.boxWidth - 320 : 0;
- var yy = String(GameusScripts["Config"]["QuestSystem"]["Filter Position"]).toLowerCase() === "top" ? 0 : Graphics.boxHeight - this.windowHeight();
- this.filterIndex = 0;
- this.filter = "";
- var width = this.windowWidth();
- var height = this.windowHeight();
- Window_Base.prototype.initialize.call(this, xx, yy, width, height);
- this.refresh();
- };
- Window_QuestFilter.prototype.windowWidth = function() {
- return 320;
- };
- Window_QuestFilter.prototype.windowHeight = function() {
- return this.fittingHeight(1);
- };
- Window_QuestFilter.prototype.refresh = function() {
- if (this.filter == this.qFilters[this.filterIndex])
- return;
- this.filter = this.qFilters[this.filterIndex];
- this.contents.clear();
- this.drawText(this.filter, 0, 0, this.contentsWidth(), "center");
- };
- //---------------------------------------------------------------------------------------------
- // Scene_Quest
- //---------------------------------------------------------------------------------------------
- function Scene_Quest() {
- this.initialize.apply(this, arguments);
- };
- Scene_Quest.prototype = Object.create(Scene_MenuBase.prototype);
- Scene_Quest.prototype.constructor = Scene_Quest;
- Scene_Quest.prototype.initialize = function() {
- Scene_MenuBase.prototype.initialize.call(this);
- };
-
- Scene_Quest.prototype.create = function() {
- Scene_MenuBase.prototype.create.call(this);
- this.qFilters = ["all", "progress", "completed", "failed"];
- this.createQuestWindow();
- };
-
- Scene_Quest.prototype.createQuestWindow = function() {
- this.oldIndex = 0;
- this.questWindow = new Window_Quests();
- this.questWindow.setHandler("cat", this.handleCategory.bind(this));
- this.questWindow.setHandler("quest", this.handleQuest.bind(this));
- this.questWindow.setHandler("cancel", this.popScene.bind(this));
- this.addWindow(this.questWindow);
- this.questInfo = new Window_QuestInfo();
- this.questInfo.setHandler("cancel", this.cancelInfo.bind(this));
- this.addWindow(this.questInfo);
- this.questFilter = new Window_QuestFilter();
- this.addWindow(this.questFilter);
- };
-
- Scene_Quest.prototype.update = function() {
- var index = this.questWindow.index();
- if (this.oldIndex != index) {
- var q = this.questWindow._list[index];
- if (q.symbol === "quest")
- this.questInfo.setQuest(q.ext);
- else
- this.questInfo.setQuest(-1);
- this.oldIndex = index;
- }
- this.questFilter.filterIndex = this.questWindow.filterIndex;
- this.questFilter.refresh();
- Scene_Base.prototype.update.call(this);
- };
-
- Scene_Quest.prototype.cancelInfo = function() {
- this.questWindow.activate();
- this.questInfo.deactivate();
- }
-
- Scene_Quest.prototype.handleQuest = function() {
- this.questWindow.deactivate();
- this.questInfo.activate();
- };
-
- Scene_Quest.prototype.handleCategory = function() {
- var catIndex = this.questWindow.currentExt();
- this.questWindow.toggle(catIndex);
- this.questWindow.refresh();
- this.questWindow.activate();
- };
- // This is used to open up the Quest Log from the menu
- // Used in conjunction with Yanfly's Menu plugin
- Scene_Menu.prototype.commandQuest = function() {
- SceneManager.push(Scene_Quest);
- };
-
- // TextManager.quest = "任务";
复制代码 |
|