Format js files

main
xian18 1 year ago
parent 276e6fa118
commit 709bcb5135
Signed by: SaltedFish
GPG Key ID: B0C26448E9EF40CA

@ -15,4 +15,4 @@
"exclude": [
"plugins_dev/*"
]
}
}

@ -1,15 +1,403 @@
/*! FPSMeter 0.3.1 - 9th May 2013 | https://github.com/Darsain/fpsmeter */
(function(m,j){function s(a,e){for(var g in e)try{a.style[g]=e[g]}catch(j){}return a}function H(a){return null==a?String(a):"object"===typeof a||"function"===typeof a?Object.prototype.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase()||"object":typeof a}function R(a,e){if("array"!==H(e))return-1;if(e.indexOf)return e.indexOf(a);for(var g=0,j=e.length;g<j;g++)if(e[g]===a)return g;return-1}function I(){var a=arguments,e;for(e in a[1])if(a[1].hasOwnProperty(e))switch(H(a[1][e])){case "object":a[0][e]=
I({},a[0][e],a[1][e]);break;case "array":a[0][e]=a[1][e].slice(0);break;default:a[0][e]=a[1][e]}return 2<a.length?I.apply(null,[a[0]].concat(Array.prototype.slice.call(a,2))):a[0]}function N(a){a=Math.round(255*a).toString(16);return 1===a.length?"0"+a:a}function S(a,e,g,j){if(a.addEventListener)a[j?"removeEventListener":"addEventListener"](e,g,!1);else if(a.attachEvent)a[j?"detachEvent":"attachEvent"]("on"+e,g)}function D(a,e){function g(a,b,d,c){return y[0|a][Math.round(Math.min((b-d)/(c-d)*J,J))]}
function r(){f.legend.fps!==q&&(f.legend.fps=q,f.legend[T]=q?"FPS":"ms");K=q?b.fps:b.duration;f.count[T]=999<K?"999+":K.toFixed(99<K?0:d.decimals)}function m(){z=A();L<z-d.threshold&&(b.fps-=b.fps/Math.max(1,60*d.smoothing/d.interval),b.duration=1E3/b.fps);for(c=d.history;c--;)E[c]=0===c?b.fps:E[c-1],F[c]=0===c?b.duration:F[c-1];r();if(d.heat){if(w.length)for(c=w.length;c--;)w[c].el.style[h[w[c].name].heatOn]=q?g(h[w[c].name].heatmap,b.fps,0,d.maxFps):g(h[w[c].name].heatmap,b.duration,d.threshold,
0);if(f.graph&&h.column.heatOn)for(c=u.length;c--;)u[c].style[h.column.heatOn]=q?g(h.column.heatmap,E[c],0,d.maxFps):g(h.column.heatmap,F[c],d.threshold,0)}if(f.graph)for(p=0;p<d.history;p++)u[p].style.height=(q?E[p]?Math.round(O/d.maxFps*Math.min(E[p],d.maxFps)):0:F[p]?Math.round(O/d.threshold*Math.min(F[p],d.threshold)):0)+"px"}function k(){20>d.interval?(x=M(k),m()):(x=setTimeout(k,d.interval),P=M(m))}function G(a){a=a||window.event;a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.returnValue=
!1,a.cancelBubble=!0);b.toggle()}function U(){d.toggleOn&&S(f.container,d.toggleOn,G,1);a.removeChild(f.container)}function V(){f.container&&U();h=D.theme[d.theme];y=h.compiledHeatmaps||[];if(!y.length&&h.heatmaps.length){for(p=0;p<h.heatmaps.length;p++){y[p]=[];for(c=0;c<=J;c++){var b=y[p],e=c,g;g=0.33/J*c;var j=h.heatmaps[p].saturation,m=h.heatmaps[p].lightness,n=void 0,k=void 0,l=void 0,t=l=void 0,v=n=k=void 0,v=void 0,l=0.5>=m?m*(1+j):m+j-m*j;0===l?g="#000":(t=2*m-l,k=(l-t)/l,g*=6,n=Math.floor(g),
v=g-n,v*=l*k,0===n||6===n?(n=l,k=t+v,l=t):1===n?(n=l-v,k=l,l=t):2===n?(n=t,k=l,l=t+v):3===n?(n=t,k=l-v):4===n?(n=t+v,k=t):(n=l,k=t,l-=v),g="#"+N(n)+N(k)+N(l));b[e]=g}}h.compiledHeatmaps=y}f.container=s(document.createElement("div"),h.container);f.count=f.container.appendChild(s(document.createElement("div"),h.count));f.legend=f.container.appendChild(s(document.createElement("div"),h.legend));f.graph=d.graph?f.container.appendChild(s(document.createElement("div"),h.graph)):0;w.length=0;for(var q in f)f[q]&&
h[q].heatOn&&w.push({name:q,el:f[q]});u.length=0;if(f.graph){f.graph.style.width=d.history*h.column.width+(d.history-1)*h.column.spacing+"px";for(c=0;c<d.history;c++)u[c]=f.graph.appendChild(s(document.createElement("div"),h.column)),u[c].style.position="absolute",u[c].style.bottom=0,u[c].style.right=c*h.column.width+c*h.column.spacing+"px",u[c].style.width=h.column.width+"px",u[c].style.height="0px"}s(f.container,d);r();a.appendChild(f.container);f.graph&&(O=f.graph.clientHeight);d.toggleOn&&("click"===
d.toggleOn&&(f.container.style.cursor="pointer"),S(f.container,d.toggleOn,G))}"object"===H(a)&&a.nodeType===j&&(e=a,a=document.body);a||(a=document.body);var b=this,d=I({},D.defaults,e||{}),f={},u=[],h,y,J=100,w=[],W=0,B=d.threshold,Q=0,L=A()-B,z,E=[],F=[],x,P,q="fps"===d.show,O,K,c,p;b.options=d;b.fps=0;b.duration=0;b.isPaused=0;b.tickStart=function(){Q=A()};b.tick=function(){z=A();W=z-L;B+=(W-B)/d.smoothing;b.fps=1E3/B;b.duration=Q<L?B:z-Q;L=z};b.pause=function(){x&&(b.isPaused=1,clearTimeout(x),
C(x),C(P),x=P=0);return b};b.resume=function(){x||(b.isPaused=0,k());return b};b.set=function(a,c){d[a]=c;q="fps"===d.show;-1!==R(a,X)&&V();-1!==R(a,Y)&&s(f.container,d);return b};b.showDuration=function(){b.set("show","ms");return b};b.showFps=function(){b.set("show","fps");return b};b.toggle=function(){b.set("show",q?"ms":"fps");return b};b.hide=function(){b.pause();f.container.style.display="none";return b};b.show=function(){b.resume();f.container.style.display="block";return b};b.destroy=function(){b.pause();
U();b.tick=b.tickStart=function(){}};V();k()}var A,r=m.performance;A=r&&(r.now||r.webkitNow)?r[r.now?"now":"webkitNow"].bind(r):function(){return+new Date};for(var C=m.cancelAnimationFrame||m.cancelRequestAnimationFrame,M=m.requestAnimationFrame,r=["moz","webkit","o"],G=0,k=0,Z=r.length;k<Z&&!C;++k)M=(C=m[r[k]+"CancelAnimationFrame"]||m[r[k]+"CancelRequestAnimationFrame"])&&m[r[k]+"RequestAnimationFrame"];C||(M=function(a){var e=A(),g=Math.max(0,16-(e-G));G=e+g;return m.setTimeout(function(){a(e+
g)},g)},C=function(a){clearTimeout(a)});var T="string"===H(document.createElement("div").textContent)?"textContent":"innerText";D.extend=I;window.FPSMeter=D;D.defaults={interval:100,smoothing:10,show:"fps",toggleOn:"click",decimals:1,maxFps:60,threshold:100,position:"absolute",zIndex:10,left:"5px",top:"5px",right:"auto",bottom:"auto",margin:"0 0 0 0",theme:"dark",heat:0,graph:0,history:20};var X=["toggleOn","theme","heat","graph","history"],Y="position zIndex left top right bottom margin".split(" ")})(window);(function(m,j){j.theme={};var s=j.theme.base={heatmaps:[],container:{heatOn:null,heatmap:null,padding:"5px",minWidth:"95px",height:"30px",lineHeight:"30px",textAlign:"right",textShadow:"none"},count:{heatOn:null,heatmap:null,position:"absolute",top:0,right:0,padding:"5px 10px",height:"30px",fontSize:"24px",fontFamily:"Consolas, Andale Mono, monospace",zIndex:2},legend:{heatOn:null,heatmap:null,position:"absolute",top:0,left:0,padding:"5px 10px",height:"30px",fontSize:"12px",lineHeight:"32px",fontFamily:"sans-serif",
textAlign:"left",zIndex:2},graph:{heatOn:null,heatmap:null,position:"relative",boxSizing:"padding-box",MozBoxSizing:"padding-box",height:"100%",zIndex:1},column:{width:4,spacing:1,heatOn:null,heatmap:null}};j.theme.dark=j.extend({},s,{heatmaps:[{saturation:0.8,lightness:0.8}],container:{background:"#222",color:"#fff",border:"1px solid #1a1a1a",textShadow:"1px 1px 0 #222"},count:{heatOn:"color"},column:{background:"#3f3f3f"}});j.theme.light=j.extend({},s,{heatmaps:[{saturation:0.5,lightness:0.5}],
container:{color:"#666",background:"#fff",textShadow:"1px 1px 0 rgba(255,255,255,.5), -1px -1px 0 rgba(255,255,255,.5)",boxShadow:"0 0 0 1px rgba(0,0,0,.1)"},count:{heatOn:"color"},column:{background:"#eaeaea"}});j.theme.colorful=j.extend({},s,{heatmaps:[{saturation:0.5,lightness:0.6}],container:{heatOn:"backgroundColor",background:"#888",color:"#fff",textShadow:"1px 1px 0 rgba(0,0,0,.2)",boxShadow:"0 0 0 1px rgba(0,0,0,.1)"},column:{background:"#777",backgroundColor:"rgba(0,0,0,.2)"}});j.theme.transparent=
j.extend({},s,{heatmaps:[{saturation:0.8,lightness:0.5}],container:{padding:0,color:"#fff",textShadow:"1px 1px 0 rgba(0,0,0,.5)"},count:{padding:"0 5px",height:"40px",lineHeight:"40px"},legend:{padding:"0 5px",height:"40px",lineHeight:"42px"},graph:{height:"40px"},column:{width:5,background:"#999",heatOn:"backgroundColor",opacity:0.5}})})(window,FPSMeter);
(function (m, j) {
function s(a, e) {
for (var g in e)
try {
a.style[g] = e[g];
} catch (j) {}
return a;
}
function H(a) {
return null == a
? String(a)
: "object" === typeof a || "function" === typeof a
? Object.prototype.toString
.call(a)
.match(/\s([a-z]+)/i)[1]
.toLowerCase() || "object"
: typeof a;
}
function R(a, e) {
if ("array" !== H(e)) return -1;
if (e.indexOf) return e.indexOf(a);
for (var g = 0, j = e.length; g < j; g++) if (e[g] === a) return g;
return -1;
}
function I() {
var a = arguments,
e;
for (e in a[1])
if (a[1].hasOwnProperty(e))
switch (H(a[1][e])) {
case "object":
a[0][e] = I({}, a[0][e], a[1][e]);
break;
case "array":
a[0][e] = a[1][e].slice(0);
break;
default:
a[0][e] = a[1][e];
}
return 2 < a.length ? I.apply(null, [a[0]].concat(Array.prototype.slice.call(a, 2))) : a[0];
}
function N(a) {
a = Math.round(255 * a).toString(16);
return 1 === a.length ? "0" + a : a;
}
function S(a, e, g, j) {
if (a.addEventListener) a[j ? "removeEventListener" : "addEventListener"](e, g, !1);
else if (a.attachEvent) a[j ? "detachEvent" : "attachEvent"]("on" + e, g);
}
function D(a, e) {
function g(a, b, d, c) {
return y[0 | a][Math.round(Math.min(((b - d) / (c - d)) * J, J))];
}
function r() {
f.legend.fps !== q && ((f.legend.fps = q), (f.legend[T] = q ? "FPS" : "ms"));
K = q ? b.fps : b.duration;
f.count[T] = 999 < K ? "999+" : K.toFixed(99 < K ? 0 : d.decimals);
}
function m() {
z = A();
L < z - d.threshold &&
((b.fps -= b.fps / Math.max(1, (60 * d.smoothing) / d.interval)), (b.duration = 1e3 / b.fps));
for (c = d.history; c--; ) (E[c] = 0 === c ? b.fps : E[c - 1]), (F[c] = 0 === c ? b.duration : F[c - 1]);
r();
if (d.heat) {
if (w.length)
for (c = w.length; c--; )
w[c].el.style[h[w[c].name].heatOn] = q
? g(h[w[c].name].heatmap, b.fps, 0, d.maxFps)
: g(h[w[c].name].heatmap, b.duration, d.threshold, 0);
if (f.graph && h.column.heatOn)
for (c = u.length; c--; )
u[c].style[h.column.heatOn] = q
? g(h.column.heatmap, E[c], 0, d.maxFps)
: g(h.column.heatmap, F[c], d.threshold, 0);
}
if (f.graph)
for (p = 0; p < d.history; p++)
u[p].style.height =
(q
? E[p]
? Math.round((O / d.maxFps) * Math.min(E[p], d.maxFps))
: 0
: F[p]
? Math.round((O / d.threshold) * Math.min(F[p], d.threshold))
: 0) + "px";
}
function k() {
20 > d.interval ? ((x = M(k)), m()) : ((x = setTimeout(k, d.interval)), (P = M(m)));
}
function G(a) {
a = a || window.event;
a.preventDefault
? (a.preventDefault(), a.stopPropagation())
: ((a.returnValue = !1), (a.cancelBubble = !0));
b.toggle();
}
function U() {
d.toggleOn && S(f.container, d.toggleOn, G, 1);
a.removeChild(f.container);
}
function V() {
f.container && U();
h = D.theme[d.theme];
y = h.compiledHeatmaps || [];
if (!y.length && h.heatmaps.length) {
for (p = 0; p < h.heatmaps.length; p++) {
y[p] = [];
for (c = 0; c <= J; c++) {
var b = y[p],
e = c,
g;
g = (0.33 / J) * c;
var j = h.heatmaps[p].saturation,
m = h.heatmaps[p].lightness,
n = void 0,
k = void 0,
l = void 0,
t = (l = void 0),
v = (n = k = void 0),
v = void 0,
l = 0.5 >= m ? m * (1 + j) : m + j - m * j;
0 === l
? (g = "#000")
: ((t = 2 * m - l),
(k = (l - t) / l),
(g *= 6),
(n = Math.floor(g)),
(v = g - n),
(v *= l * k),
0 === n || 6 === n
? ((n = l), (k = t + v), (l = t))
: 1 === n
? ((n = l - v), (k = l), (l = t))
: 2 === n
? ((n = t), (k = l), (l = t + v))
: 3 === n
? ((n = t), (k = l - v))
: 4 === n
? ((n = t + v), (k = t))
: ((n = l), (k = t), (l -= v)),
(g = "#" + N(n) + N(k) + N(l)));
b[e] = g;
}
}
h.compiledHeatmaps = y;
}
f.container = s(document.createElement("div"), h.container);
f.count = f.container.appendChild(s(document.createElement("div"), h.count));
f.legend = f.container.appendChild(s(document.createElement("div"), h.legend));
f.graph = d.graph ? f.container.appendChild(s(document.createElement("div"), h.graph)) : 0;
w.length = 0;
for (var q in f) f[q] && h[q].heatOn && w.push({ name: q, el: f[q] });
u.length = 0;
if (f.graph) {
f.graph.style.width = d.history * h.column.width + (d.history - 1) * h.column.spacing + "px";
for (c = 0; c < d.history; c++)
(u[c] = f.graph.appendChild(s(document.createElement("div"), h.column))),
(u[c].style.position = "absolute"),
(u[c].style.bottom = 0),
(u[c].style.right = c * h.column.width + c * h.column.spacing + "px"),
(u[c].style.width = h.column.width + "px"),
(u[c].style.height = "0px");
}
s(f.container, d);
r();
a.appendChild(f.container);
f.graph && (O = f.graph.clientHeight);
d.toggleOn &&
("click" === d.toggleOn && (f.container.style.cursor = "pointer"), S(f.container, d.toggleOn, G));
}
"object" === H(a) && a.nodeType === j && ((e = a), (a = document.body));
a || (a = document.body);
var b = this,
d = I({}, D.defaults, e || {}),
f = {},
u = [],
h,
y,
J = 100,
w = [],
W = 0,
B = d.threshold,
Q = 0,
L = A() - B,
z,
E = [],
F = [],
x,
P,
q = "fps" === d.show,
O,
K,
c,
p;
b.options = d;
b.fps = 0;
b.duration = 0;
b.isPaused = 0;
b.tickStart = function () {
Q = A();
};
b.tick = function () {
z = A();
W = z - L;
B += (W - B) / d.smoothing;
b.fps = 1e3 / B;
b.duration = Q < L ? B : z - Q;
L = z;
};
b.pause = function () {
x && ((b.isPaused = 1), clearTimeout(x), C(x), C(P), (x = P = 0));
return b;
};
b.resume = function () {
x || ((b.isPaused = 0), k());
return b;
};
b.set = function (a, c) {
d[a] = c;
q = "fps" === d.show;
-1 !== R(a, X) && V();
-1 !== R(a, Y) && s(f.container, d);
return b;
};
b.showDuration = function () {
b.set("show", "ms");
return b;
};
b.showFps = function () {
b.set("show", "fps");
return b;
};
b.toggle = function () {
b.set("show", q ? "ms" : "fps");
return b;
};
b.hide = function () {
b.pause();
f.container.style.display = "none";
return b;
};
b.show = function () {
b.resume();
f.container.style.display = "block";
return b;
};
b.destroy = function () {
b.pause();
U();
b.tick = b.tickStart = function () {};
};
V();
k();
}
var A,
r = m.performance;
A =
r && (r.now || r.webkitNow)
? r[r.now ? "now" : "webkitNow"].bind(r)
: function () {
return +new Date();
};
for (
var C = m.cancelAnimationFrame || m.cancelRequestAnimationFrame,
M = m.requestAnimationFrame,
r = ["moz", "webkit", "o"],
G = 0,
k = 0,
Z = r.length;
k < Z && !C;
++k
)
M =
(C = m[r[k] + "CancelAnimationFrame"] || m[r[k] + "CancelRequestAnimationFrame"]) &&
m[r[k] + "RequestAnimationFrame"];
C ||
((M = function (a) {
var e = A(),
g = Math.max(0, 16 - (e - G));
G = e + g;
return m.setTimeout(function () {
a(e + g);
}, g);
}),
(C = function (a) {
clearTimeout(a);
}));
var T = "string" === H(document.createElement("div").textContent) ? "textContent" : "innerText";
D.extend = I;
window.FPSMeter = D;
D.defaults = {
interval: 100,
smoothing: 10,
show: "fps",
toggleOn: "click",
decimals: 1,
maxFps: 60,
threshold: 100,
position: "absolute",
zIndex: 10,
left: "5px",
top: "5px",
right: "auto",
bottom: "auto",
margin: "0 0 0 0",
theme: "dark",
heat: 0,
graph: 0,
history: 20,
};
var X = ["toggleOn", "theme", "heat", "graph", "history"],
Y = "position zIndex left top right bottom margin".split(" ");
})(window);
(function (m, j) {
j.theme = {};
var s = (j.theme.base = {
heatmaps: [],
container: {
heatOn: null,
heatmap: null,
padding: "5px",
minWidth: "95px",
height: "30px",
lineHeight: "30px",
textAlign: "right",
textShadow: "none",
},
count: {
heatOn: null,
heatmap: null,
position: "absolute",
top: 0,
right: 0,
padding: "5px 10px",
height: "30px",
fontSize: "24px",
fontFamily: "Consolas, Andale Mono, monospace",
zIndex: 2,
},
legend: {
heatOn: null,
heatmap: null,
position: "absolute",
top: 0,
left: 0,
padding: "5px 10px",
height: "30px",
fontSize: "12px",
lineHeight: "32px",
fontFamily: "sans-serif",
textAlign: "left",
zIndex: 2,
},
graph: {
heatOn: null,
heatmap: null,
position: "relative",
boxSizing: "padding-box",
MozBoxSizing: "padding-box",
height: "100%",
zIndex: 1,
},
column: { width: 4, spacing: 1, heatOn: null, heatmap: null },
});
j.theme.dark = j.extend({}, s, {
heatmaps: [{ saturation: 0.8, lightness: 0.8 }],
container: { background: "#222", color: "#fff", border: "1px solid #1a1a1a", textShadow: "1px 1px 0 #222" },
count: { heatOn: "color" },
column: { background: "#3f3f3f" },
});
j.theme.light = j.extend({}, s, {
heatmaps: [{ saturation: 0.5, lightness: 0.5 }],
container: {
color: "#666",
background: "#fff",
textShadow: "1px 1px 0 rgba(255,255,255,.5), -1px -1px 0 rgba(255,255,255,.5)",
boxShadow: "0 0 0 1px rgba(0,0,0,.1)",
},
count: { heatOn: "color" },
column: { background: "#eaeaea" },
});
j.theme.colorful = j.extend({}, s, {
heatmaps: [{ saturation: 0.5, lightness: 0.6 }],
container: {
heatOn: "backgroundColor",
background: "#888",
color: "#fff",
textShadow: "1px 1px 0 rgba(0,0,0,.2)",
boxShadow: "0 0 0 1px rgba(0,0,0,.1)",
},
column: { background: "#777", backgroundColor: "rgba(0,0,0,.2)" },
});
j.theme.transparent = j.extend({}, s, {
heatmaps: [{ saturation: 0.8, lightness: 0.5 }],
container: { padding: 0, color: "#fff", textShadow: "1px 1px 0 rgba(0,0,0,.5)" },
count: { padding: "0 5px", height: "40px", lineHeight: "40px" },
legend: { padding: "0 5px", height: "40px", lineHeight: "42px" },
graph: { height: "40px" },
column: { width: 5, background: "#999", heatOn: "backgroundColor", opacity: 0.5 },
});
})(window, FPSMeter);

@ -1,3 +1,190 @@
/*! npm.im/iphone-inline-video */
var makeVideoPlayableInline=function(){"use strict";/*! npm.im/intervalometer */
function e(e,n,r,i){function t(r){d=n(t,i),e(r-(a||r)),a=r}var d,a;return{start:function(){d||t(0)},stop:function(){r(d),d=null,a=0}}}function n(n){return e(n,requestAnimationFrame,cancelAnimationFrame)}function r(e,n,r,i){function t(n){Boolean(e[r])===Boolean(i)&&n.stopImmediatePropagation(),delete e[r]}return e.addEventListener(n,t,!1),t}function i(e,n,r,i){function t(){return r[n]}function d(e){r[n]=e}i&&d(e[n]),Object.defineProperty(e,n,{get:t,set:d})}function t(e,n,r){r.addEventListener(n,function(){return e.dispatchEvent(new Event(n))})}function d(e,n){Promise.resolve().then(function(){e.dispatchEvent(new Event(n))})}function a(e){var n=new Audio;return t(e,"play",n),t(e,"playing",n),t(e,"pause",n),n.crossOrigin=e.crossOrigin,n.src=e.src||e.currentSrc||"data:",n}function o(e,n,r){(m||0)+200<Date.now()&&(e[g]=!0,m=Date.now()),r||(e.currentTime=n),A[++k%3]=100*n|0}function u(e){return e.driver.currentTime>=e.video.duration}function s(e){var n=this;n.video.readyState>=n.video.HAVE_FUTURE_DATA?(n.hasAudio||(n.driver.currentTime=n.video.currentTime+e*n.video.playbackRate/1e3,n.video.loop&&u(n)&&(n.driver.currentTime=0)),o(n.video,n.driver.currentTime)):n.video.networkState!==n.video.NETWORK_IDLE||n.video.buffered.length||n.video.load(),n.video.ended&&(delete n.video[g],n.video.pause(!0))}function c(){var e=this,n=e[b];return e.webkitDisplayingFullscreen?void e[E]():("data:"!==n.driver.src&&n.driver.src!==e.src&&(o(e,0,!0),n.driver.src=e.src),void(e.paused&&(n.paused=!1,e.buffered.length||e.load(),n.driver.play(),n.updater.start(),n.hasAudio||(d(e,"play"),n.video.readyState>=n.video.HAVE_ENOUGH_DATA&&d(e,"playing")))))}function v(e){var n=this,r=n[b];r.driver.pause(),r.updater.stop(),n.webkitDisplayingFullscreen&&n[T](),r.paused&&!e||(r.paused=!0,r.hasAudio||d(n,"pause"),n.ended&&(n[g]=!0,d(n,"ended")))}function p(e,r){var i=e[b]={};i.paused=!0,i.hasAudio=r,i.video=e,i.updater=n(s.bind(i)),r?i.driver=a(e):(e.addEventListener("canplay",function(){e.paused||d(e,"playing")}),i.driver={src:e.src||e.currentSrc||"data:",muted:!0,paused:!0,pause:function(){i.driver.paused=!0},play:function(){i.driver.paused=!1,u(i)&&o(e,0)},get ended(){return u(i)}}),e.addEventListener("emptied",function(){var n=!i.driver.src||"data:"===i.driver.src;i.driver.src&&i.driver.src!==e.src&&(o(e,0,!0),i.driver.src=e.src,n?i.driver.play():i.updater.stop())},!1),e.addEventListener("webkitbeginfullscreen",function(){e.paused?r&&!i.driver.buffered.length&&i.driver.load():(e.pause(),e[E]())}),r&&(e.addEventListener("webkitendfullscreen",function(){i.driver.currentTime=e.currentTime}),e.addEventListener("seeking",function(){A.indexOf(100*e.currentTime|0)<0&&(i.driver.currentTime=e.currentTime)}))}function l(e){var n=e[b];e[E]=e.play,e[T]=e.pause,e.play=c,e.pause=v,i(e,"paused",n.driver),i(e,"muted",n.driver,!0),i(e,"playbackRate",n.driver,!0),i(e,"ended",n.driver),i(e,"loop",n.driver,!0),r(e,"seeking"),r(e,"seeked"),r(e,"timeupdate",g,!1),r(e,"ended",g,!1)}function f(e,n,r){void 0===n&&(n=!0),void 0===r&&(r=!0),r&&!h||e[b]||(p(e,n),l(e),e.classList.add("IIV"),!n&&e.autoplay&&e.play(),/iPhone|iPod|iPad/.test(navigator.platform)||console.warn("iphone-inline-video is not guaranteed to work in emulated environments"))}var m,y="undefined"==typeof Symbol?function(e){return"@"+(e||"@")+Math.random()}:Symbol,h="object-fit"in document.head.style&&/iPhone|iPod/i.test(navigator.userAgent)&&!matchMedia("(-webkit-video-playable-inline)").matches,b=y(),g=y(),E=y("nativeplay"),T=y("nativepause"),A=[],k=0;return f.isWhitelisted=h,f}();
var makeVideoPlayableInline = (function () {
"use strict"; /*! npm.im/intervalometer */
function e(e, n, r, i) {
function t(r) {
(d = n(t, i)), e(r - (a || r)), (a = r);
}
var d, a;
return {
start: function () {
d || t(0);
},
stop: function () {
r(d), (d = null), (a = 0);
},
};
}
function n(n) {
return e(n, requestAnimationFrame, cancelAnimationFrame);
}
function r(e, n, r, i) {
function t(n) {
Boolean(e[r]) === Boolean(i) && n.stopImmediatePropagation(), delete e[r];
}
return e.addEventListener(n, t, !1), t;
}
function i(e, n, r, i) {
function t() {
return r[n];
}
function d(e) {
r[n] = e;
}
i && d(e[n]), Object.defineProperty(e, n, { get: t, set: d });
}
function t(e, n, r) {
r.addEventListener(n, function () {
return e.dispatchEvent(new Event(n));
});
}
function d(e, n) {
Promise.resolve().then(function () {
e.dispatchEvent(new Event(n));
});
}
function a(e) {
var n = new Audio();
return (
t(e, "play", n),
t(e, "playing", n),
t(e, "pause", n),
(n.crossOrigin = e.crossOrigin),
(n.src = e.src || e.currentSrc || "data:"),
n
);
}
function o(e, n, r) {
(m || 0) + 200 < Date.now() && ((e[g] = !0), (m = Date.now())),
r || (e.currentTime = n),
(A[++k % 3] = (100 * n) | 0);
}
function u(e) {
return e.driver.currentTime >= e.video.duration;
}
function s(e) {
var n = this;
n.video.readyState >= n.video.HAVE_FUTURE_DATA
? (n.hasAudio ||
((n.driver.currentTime = n.video.currentTime + (e * n.video.playbackRate) / 1e3),
n.video.loop && u(n) && (n.driver.currentTime = 0)),
o(n.video, n.driver.currentTime))
: n.video.networkState !== n.video.NETWORK_IDLE || n.video.buffered.length || n.video.load(),
n.video.ended && (delete n.video[g], n.video.pause(!0));
}
function c() {
var e = this,
n = e[b];
return e.webkitDisplayingFullscreen
? void e[E]()
: ("data:" !== n.driver.src && n.driver.src !== e.src && (o(e, 0, !0), (n.driver.src = e.src)),
void (
e.paused &&
((n.paused = !1),
e.buffered.length || e.load(),
n.driver.play(),
n.updater.start(),
n.hasAudio || (d(e, "play"), n.video.readyState >= n.video.HAVE_ENOUGH_DATA && d(e, "playing")))
));
}
function v(e) {
var n = this,
r = n[b];
r.driver.pause(),
r.updater.stop(),
n.webkitDisplayingFullscreen && n[T](),
(r.paused && !e) || ((r.paused = !0), r.hasAudio || d(n, "pause"), n.ended && ((n[g] = !0), d(n, "ended")));
}
function p(e, r) {
var i = (e[b] = {});
(i.paused = !0),
(i.hasAudio = r),
(i.video = e),
(i.updater = n(s.bind(i))),
r
? (i.driver = a(e))
: (e.addEventListener("canplay", function () {
e.paused || d(e, "playing");
}),
(i.driver = {
src: e.src || e.currentSrc || "data:",
muted: !0,
paused: !0,
pause: function () {
i.driver.paused = !0;
},
play: function () {
(i.driver.paused = !1), u(i) && o(e, 0);
},
get ended() {
return u(i);
},
})),
e.addEventListener(
"emptied",
function () {
var n = !i.driver.src || "data:" === i.driver.src;
i.driver.src &&
i.driver.src !== e.src &&
(o(e, 0, !0), (i.driver.src = e.src), n ? i.driver.play() : i.updater.stop());
},
!1
),
e.addEventListener("webkitbeginfullscreen", function () {
e.paused ? r && !i.driver.buffered.length && i.driver.load() : (e.pause(), e[E]());
}),
r &&
(e.addEventListener("webkitendfullscreen", function () {
i.driver.currentTime = e.currentTime;
}),
e.addEventListener("seeking", function () {
A.indexOf((100 * e.currentTime) | 0) < 0 && (i.driver.currentTime = e.currentTime);
}));
}
function l(e) {
var n = e[b];
(e[E] = e.play),
(e[T] = e.pause),
(e.play = c),
(e.pause = v),
i(e, "paused", n.driver),
i(e, "muted", n.driver, !0),
i(e, "playbackRate", n.driver, !0),
i(e, "ended", n.driver),
i(e, "loop", n.driver, !0),
r(e, "seeking"),
r(e, "seeked"),
r(e, "timeupdate", g, !1),
r(e, "ended", g, !1);
}
function f(e, n, r) {
void 0 === n && (n = !0),
void 0 === r && (r = !0),
(r && !h) ||
e[b] ||
(p(e, n),
l(e),
e.classList.add("IIV"),
!n && e.autoplay && e.play(),
/iPhone|iPod|iPad/.test(navigator.platform) ||
console.warn("iphone-inline-video is not guaranteed to work in emulated environments"));
}
var m,
y =
"undefined" == typeof Symbol
? function (e) {
return "@" + (e || "@") + Math.random();
}
: Symbol,
h =
"object-fit" in document.head.style &&
/iPhone|iPod/i.test(navigator.userAgent) &&
!matchMedia("(-webkit-video-playable-inline)").matches,
b = y(),
g = y(),
E = y("nativeplay"),
T = y("nativepause"),
A = [],
k = 0;
return (f.isWhitelisted = h), f;
})();

File diff suppressed because one or more lines are too long

@ -1,8 +1,12 @@
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __extends =
(this && this.__extends) ||
function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
var PIXI;
(function (PIXI) {
var extras;
@ -12,30 +16,34 @@ var PIXI;
vertUniforms: "",
vertCode: "vTextureCoord = aTextureCoord;",
fragUniforms: "uniform vec4 uTextureClamp;",
fragCode: "vec2 textureCoord = clamp(vTextureCoord, uTextureClamp.xy, uTextureClamp.zw);"
fragCode: "vec2 textureCoord = clamp(vTextureCoord, uTextureClamp.xy, uTextureClamp.zw);",
},
{
vertUniforms: "uniform mat3 uTransform;",
vertCode: "vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;",
fragUniforms: "",
fragCode: "vec2 textureCoord = vTextureCoord;"
fragCode: "vec2 textureCoord = vTextureCoord;",
},
{
vertUniforms: "uniform mat3 uTransform;",
vertCode: "vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;",
fragUniforms: "uniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;",
fragCode: "vec2 textureCoord = mod(vTextureCoord - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;" +
fragCode:
"vec2 textureCoord = mod(vTextureCoord - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;" +
"\ntextureCoord = (uMapCoord * vec3(textureCoord, 1.0)).xy;" +
"\ntextureCoord = clamp(textureCoord, uClampFrame.xy, uClampFrame.zw);"
}
"\ntextureCoord = clamp(textureCoord, uClampFrame.xy, uClampFrame.zw);",
},
];
var PictureShader = (function (_super) {
__extends(PictureShader, _super);
function PictureShader(gl, vert, frag, tilingMode) {
var lib = shaderLib[tilingMode];
_super.call(this, gl, vert.replace(/%SPRITE_UNIFORMS%/gi, lib.vertUniforms)
.replace(/%SPRITE_CODE%/gi, lib.vertCode), frag.replace(/%SPRITE_UNIFORMS%/gi, lib.fragUniforms)
.replace(/%SPRITE_CODE%/gi, lib.fragCode));
_super.call(
this,
gl,
vert.replace(/%SPRITE_UNIFORMS%/gi, lib.vertUniforms).replace(/%SPRITE_CODE%/gi, lib.vertCode),
frag.replace(/%SPRITE_UNIFORMS%/gi, lib.fragUniforms).replace(/%SPRITE_CODE%/gi, lib.fragCode)
);
this.bind();
this.tilingMode = tilingMode;
this.tempQuad = new PIXI.Quad(gl);
@ -43,77 +51,92 @@ var PIXI;
this.uniforms.uColor = new Float32Array([1, 1, 1, 1]);
this.uniforms.uSampler = [0, 1];
}
PictureShader.blendVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 mapMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n vMapCoord = (mapMatrix * vec3(aVertexPosition, 1.0)).xy;\n}\n";
PictureShader.blendVert =
"\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 mapMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n vMapCoord = (mapMatrix * vec3(aVertexPosition, 1.0)).xy;\n}\n";
return PictureShader;
}(PIXI.Shader));
})(PIXI.Shader);
extras.PictureShader = PictureShader;
})(extras = PIXI.extras || (PIXI.extras = {}));
})((extras = PIXI.extras || (PIXI.extras = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
var extras;
(function (extras) {
var overlayFrag = "\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cs2 = Cs * 2.0 - 1.0;\n vec3 screen = Cb + Cs2 - Cb * Cs2;\n vec3 B;\n if (Cb.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cb.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cb.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n";
var overlayFrag =
"\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cs2 = Cs * 2.0 - 1.0;\n vec3 screen = Cb + Cs2 - Cb * Cs2;\n vec3 B;\n if (Cb.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cb.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cb.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n";
var HardLightShader = (function (_super) {
__extends(HardLightShader, _super);
function HardLightShader(gl, tilingMode) {
_super.call(this, gl, extras.PictureShader.blendVert, overlayFrag, tilingMode);
}
return HardLightShader;
}(extras.PictureShader));
})(extras.PictureShader);
extras.HardLightShader = HardLightShader;
})(extras = PIXI.extras || (PIXI.extras = {}));
})((extras = PIXI.extras || (PIXI.extras = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
var extras;
(function (extras) {
function mapFilterBlendModesToPixi(gl, array) {
if (array === void 0) { array = []; }
array[PIXI.BLEND_MODES.OVERLAY] = [new extras.OverlayShader(gl, 0), new extras.OverlayShader(gl, 1), new extras.OverlayShader(gl, 2)];
array[PIXI.BLEND_MODES.HARD_LIGHT] = [new extras.HardLightShader(gl, 0), new extras.HardLightShader(gl, 1), new extras.HardLightShader(gl, 2)];
if (array === void 0) {
array = [];
}
array[PIXI.BLEND_MODES.OVERLAY] = [
new extras.OverlayShader(gl, 0),
new extras.OverlayShader(gl, 1),
new extras.OverlayShader(gl, 2),
];
array[PIXI.BLEND_MODES.HARD_LIGHT] = [
new extras.HardLightShader(gl, 0),
new extras.HardLightShader(gl, 1),
new extras.HardLightShader(gl, 2),
];
return array;
}
extras.mapFilterBlendModesToPixi = mapFilterBlendModesToPixi;
})(extras = PIXI.extras || (PIXI.extras = {}));
})((extras = PIXI.extras || (PIXI.extras = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
var extras;
(function (extras) {
var normalFrag = "\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n\n vec4 sample = texture2D(uSampler[0], textureCoord);\n gl_FragColor = sample * uColor;\n}\n";
var normalVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n}\n";
var normalFrag =
"\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n\n vec4 sample = texture2D(uSampler[0], textureCoord);\n gl_FragColor = sample * uColor;\n}\n";
var normalVert =
"\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n}\n";
var NormalShader = (function (_super) {
__extends(NormalShader, _super);
function NormalShader(gl, tilingMode) {
_super.call(this, gl, normalVert, normalFrag, tilingMode);
}
return NormalShader;
}(extras.PictureShader));
})(extras.PictureShader);
extras.NormalShader = NormalShader;
})(extras = PIXI.extras || (PIXI.extras = {}));
})((extras = PIXI.extras || (PIXI.extras = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
var extras;
(function (extras) {
var overlayFrag = "\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cb2 = Cb * 2.0 - 1.0;\n vec3 screen = Cb2 + Cs - Cb2 * Cs;\n vec3 B;\n if (Cs.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cs.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cs.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n";
var overlayFrag =
"\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cb2 = Cb * 2.0 - 1.0;\n vec3 screen = Cb2 + Cs - Cb2 * Cs;\n vec3 B;\n if (Cs.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cs.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cs.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n";
var OverlayShader = (function (_super) {
__extends(OverlayShader, _super);
function OverlayShader(gl, tilingMode) {
_super.call(this, gl, extras.PictureShader.blendVert, overlayFrag, tilingMode);
}
return OverlayShader;
}(extras.PictureShader));
})(extras.PictureShader);
extras.OverlayShader = OverlayShader;
})(extras = PIXI.extras || (PIXI.extras = {}));
})((extras = PIXI.extras || (PIXI.extras = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
var extras;
(function (extras) {
function nextPow2(v) {
v += (v === 0) ? 1 : 0;
v += v === 0 ? 1 : 0;
--v;
v |= v >>> 1;
v |= v >>> 2;
@ -130,7 +153,11 @@ var PIXI;
PictureRenderer.prototype.onContextChange = function () {
var gl = this.renderer.gl;
this.drawModes = extras.mapFilterBlendModesToPixi(gl);
this.normalShader = [new extras.NormalShader(gl, 0), new extras.NormalShader(gl, 1), new extras.NormalShader(gl, 2)];
this.normalShader = [
new extras.NormalShader(gl, 0),
new extras.NormalShader(gl, 1),
new extras.NormalShader(gl, 2),
];
this._tempClamp = new Float32Array(4);
this._tempColor = new Float32Array(4);
this._tempRect = new PIXI.Rectangle();
@ -141,13 +168,10 @@ var PIXI;
this._bigBuf = new Uint8Array(1 << 20);
this._renderTexture = new PIXI.BaseRenderTexture(1024, 1024);
};
PictureRenderer.prototype.start = function () {
};
PictureRenderer.prototype.flush = function () {
};
PictureRenderer.prototype.start = function () {};
PictureRenderer.prototype.flush = function () {};
PictureRenderer.prototype._getRenderTexture = function (minWidth, minHeight) {
if (this._renderTexture.width < minWidth ||
this._renderTexture.height < minHeight) {
if (this._renderTexture.width < minWidth || this._renderTexture.height < minHeight) {
minHeight = nextPow2(minWidth);
minHeight = nextPow2(minHeight);
this._renderTexture.resize(minWidth, minHeight);
@ -174,8 +198,7 @@ var PIXI;
var blendShader = this.drawModes[sprite.blendMode];
if (blendShader) {
this._renderBlend(sprite, blendShader[tilingMode]);
}
else {
} else {
this._renderNormal(sprite, this.normalShader[tilingMode]);
}
};
@ -200,7 +223,8 @@ var PIXI;
screen.width = fr.width;
screen.height = fr.height;
var bounds = this._tempRect2;
var fbw = fr.width * resolution, fbh = fr.height * resolution;
var fbw = fr.width * resolution,
fbh = fr.height * resolution;
bounds.x = (spriteBounds.x + matrix.tx / matrix.a) * resolution + fbw / 2;
bounds.y = (spriteBounds.y + matrix.ty / matrix.d) * resolution + fbh / 2;
bounds.width = spriteBounds.width * resolution;
@ -227,9 +251,18 @@ var PIXI;
if (renderer.renderingToScreen && renderTarget.root) {
var buf = this._getBuf(pixelsWidth * pixelsHeight * 4);
gl.readPixels(x_1, y_1, pixelsWidth, pixelsHeight, gl.RGBA, gl.UNSIGNED_BYTE, this._bigBuf);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, pixelsWidth, pixelsHeight, gl.RGBA, gl.UNSIGNED_BYTE, this._bigBuf);
}
else {
gl.texSubImage2D(
gl.TEXTURE_2D,
0,
0,
0,
pixelsWidth,
pixelsHeight,
gl.RGBA,
gl.UNSIGNED_BYTE,
this._bigBuf
);
} else {
gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x_1, y_1, pixelsWidth, pixelsHeight);
}
renderer.bindShader(shader);
@ -239,17 +272,17 @@ var PIXI;
mapMatrix.a = bounds.width / rt.width / spriteBounds.width;
if (flipX) {
mapMatrix.a = -mapMatrix.a;
mapMatrix.tx = (bounds.x - x_1) / rt.width - (spriteBounds.x + spriteBounds.width) * mapMatrix.a;
}
else {
mapMatrix.tx =
(bounds.x - x_1) / rt.width - (spriteBounds.x + spriteBounds.width) * mapMatrix.a;
} else {
mapMatrix.tx = (bounds.x - x_1) / rt.width - spriteBounds.x * mapMatrix.a;
}
mapMatrix.d = bounds.height / rt.height / spriteBounds.height;
if (flipY) {
mapMatrix.d = -mapMatrix.d;
mapMatrix.ty = (bounds.y - y_1) / rt.height - (spriteBounds.y + spriteBounds.height) * mapMatrix.d;
}
else {
mapMatrix.ty =
(bounds.y - y_1) / rt.height - (spriteBounds.y + spriteBounds.height) * mapMatrix.d;
} else {
mapMatrix.ty = (bounds.y - y_1) / rt.height - spriteBounds.y * mapMatrix.d;
}
shader.uniforms.mapMatrix = mapMatrix.toArray(true);
@ -260,8 +293,7 @@ var PIXI;
var renderer = this.renderer;
if (shader.tilingMode > 0) {
this._renderWithShader(sprite, shader.tilingMode === 1, shader);
}
else {
} else {
this._renderSprite(sprite, shader);
}
};
@ -285,14 +317,14 @@ var PIXI;
var d = wt.d;
var tx = wt.tx;
var ty = wt.ty;
vertices[0] = (a * w1) + (c * h1) + tx;
vertices[1] = (d * h1) + (b * w1) + ty;
vertices[2] = (a * w0) + (c * h1) + tx;
vertices[3] = (d * h1) + (b * w0) + ty;
vertices[4] = (a * w0) + (c * h0) + tx;
vertices[5] = (d * h0) + (b * w0) + ty;
vertices[6] = (a * w1) + (c * h0) + tx;
vertices[7] = (d * h0) + (b * w1) + ty;
vertices[0] = a * w1 + c * h1 + tx;
vertices[1] = d * h1 + b * w1 + ty;
vertices[2] = a * w0 + c * h1 + tx;
vertices[3] = d * h1 + b * w0 + ty;
vertices[4] = a * w0 + c * h0 + tx;
vertices[5] = d * h0 + b * w0 + ty;
vertices[6] = a * w1 + c * h0 + tx;
vertices[7] = d * h0 + b * w1 + ty;
vertices = quad.uvs;
vertices[0] = vertices[6] = -ts.anchor.x;
vertices[1] = vertices[3] = -ts.anchor.y;
@ -310,12 +342,11 @@ var PIXI;
var W = _width;
var H = _height;
var tempMat = this._tempMatrix2;
tempMat.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H);
tempMat.set((lt.a * w) / W, (lt.b * w) / H, (lt.c * h) / W, (lt.d * h) / H, lt.tx / W, lt.ty / H);
tempMat.invert();
if (isSimple) {
tempMat.append(mapCoord);
}
else {
} else {
shader.uniforms.uMapCoord = mapCoord.toArray(true);
shader.uniforms.uClampFrame = uClampFrame;
shader.uniforms.uClampOffset = uClampOffset;
@ -375,25 +406,25 @@ var PIXI;
var renderer = this.renderer;
var tex = ts._texture;
var baseTex = tex.baseTexture;
var isSimple = baseTex.isPowerOfTwo && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;
var isSimple =
baseTex.isPowerOfTwo && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;
if (isSimple) {
if (!baseTex._glTextures[renderer.CONTEXT_UID]) {
if (baseTex.wrapMode === PIXI.WRAP_MODES.CLAMP) {
baseTex.wrapMode = PIXI.WRAP_MODES.REPEAT;
}
}
else {
} else {
isSimple = baseTex.wrapMode !== PIXI.WRAP_MODES.CLAMP;
}
}
return isSimple;
};
return PictureRenderer;
}(PIXI.ObjectRenderer));
})(PIXI.ObjectRenderer);
extras.PictureRenderer = PictureRenderer;
PIXI.WebGLRenderer.registerPlugin('picture', PictureRenderer);
PIXI.CanvasRenderer.registerPlugin('picture', PIXI.CanvasSpriteRenderer);
})(extras = PIXI.extras || (PIXI.extras = {}));
PIXI.WebGLRenderer.registerPlugin("picture", PictureRenderer);
PIXI.CanvasRenderer.registerPlugin("picture", PIXI.CanvasSpriteRenderer);
})((extras = PIXI.extras || (PIXI.extras = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
@ -403,12 +434,12 @@ var PIXI;
__extends(PictureSprite, _super);
function PictureSprite(texture) {
_super.call(this, texture);
this.pluginName = 'picture';
this.pluginName = "picture";
}
return PictureSprite;
}(PIXI.Sprite));
})(PIXI.Sprite);
extras.PictureSprite = PictureSprite;
})(extras = PIXI.extras || (PIXI.extras = {}));
})((extras = PIXI.extras || (PIXI.extras = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
@ -418,11 +449,11 @@ var PIXI;
__extends(PictureTilingSprite, _super);
function PictureTilingSprite(texture) {
_super.call(this, texture);
this.pluginName = 'picture';
this.pluginName = "picture";
}
return PictureTilingSprite;
}(extras.TilingSprite));
})(extras.TilingSprite);
extras.PictureTilingSprite = PictureTilingSprite;
})(extras = PIXI.extras || (PIXI.extras = {}));
})((extras = PIXI.extras || (PIXI.extras = {})));
})(PIXI || (PIXI = {}));
//# sourceMappingURL=pixi-picture.js.map
//# sourceMappingURL=pixi-picture.js.map

@ -10,21 +10,31 @@ var PIXI;
this.tileAnim = [0, 0];
}
return CanvasTileRenderer;
}());
})();
tilemap.CanvasTileRenderer = CanvasTileRenderer;
PIXI.CanvasRenderer.registerPlugin('tilemap', CanvasTileRenderer);
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
PIXI.CanvasRenderer.registerPlugin("tilemap", CanvasTileRenderer);
})((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __extends =
(this && this.__extends) ||
(function () {
var extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
};
return function (d, b) {
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
var PIXI;
(function (PIXI) {
var tilemap;
@ -60,12 +70,13 @@ var PIXI;
this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);
}
for (i = len1; i < len2; i++) {
this.addChild(new tilemap.RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)));
this.addChild(
new tilemap.RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild))
);
}
};
CompositeRectTileLayer.prototype.clear = function () {
for (var i = 0; i < this.children.length; i++)
this.children[i].clear();
for (var i = 0; i < this.children.length; i++) this.children[i].clear();
this.modificationMarker = 0;
};
CompositeRectTileLayer.prototype.addRect = function (num, u, v, x, y, tileWidth, tileHeight) {
@ -74,10 +85,11 @@ var PIXI;
};
CompositeRectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY) {
var texture;
var layer = null, ind = 0;
var layer = null,
ind = 0;
var children = this.children;
if (typeof texture_ === "number") {
var childIndex = texture_ / this.texPerChild >> 0;
var childIndex = (texture_ / this.texPerChild) >> 0;
layer = children[childIndex];
if (!layer) {
layer = children[0];
@ -85,16 +97,13 @@ var PIXI;
return false;
}
ind = 0;
}
else {
} else {
ind = texture_ % this.texPerChild;
}
texture = layer.textures[ind];
}
else if (typeof texture_ === "string") {
} else if (typeof texture_ === "string") {
texture = PIXI.Texture.fromImage(texture_);
}
else {
} else {
texture = texture_;
for (var i = 0; i < children.length; i++) {
var child = children[i];
@ -121,25 +130,39 @@ var PIXI;
}
}
if (!layer) {
children.push(layer = new tilemap.RectTileLayer(this.zIndex, texture));
children.push((layer = new tilemap.RectTileLayer(this.zIndex, texture)));
ind = 0;
}
}
}
layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.frame.width, texture.frame.height, animX, animY);
layer.addRect(
ind,
texture.frame.x,
texture.frame.y,
x,
y,
texture.frame.width,
texture.frame.height,
animX,
animY
);
return true;
};
;
CompositeRectTileLayer.prototype.renderCanvas = function (renderer) {
if (!renderer.plugins.tilemap.dontUseTransform) {
var wt = this.worldTransform;
renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
renderer.context.setTransform(
wt.a,
wt.b,
wt.c,
wt.d,
wt.tx * renderer.resolution,
wt.ty * renderer.resolution
);
}
var layers = this.children;
for (var i = 0; i < layers.length; i++)
layers[i].renderCanvas(renderer);
for (var i = 0; i < layers.length; i++) layers[i].renderCanvas(renderer);
};
;
CompositeRectTileLayer.prototype.renderWebGL = function (renderer) {
var gl = renderer.gl;
var shader = renderer.plugins.tilemap.getShader(this.useSquare);
@ -150,16 +173,15 @@ var PIXI;
shader.uniforms.projectionMatrix = this._globalMat.toArray(true);
shader.uniforms.shadowColor = this.shadowColor;
if (this.useSquare) {
var tempScale = this._tempScale = (this._tempScale || [0, 0]);
var tempScale = (this._tempScale = this._tempScale || [0, 0]);
tempScale[0] = this._globalMat.a >= 0 ? 1 : -1;
tempScale[1] = this._globalMat.d < 0 ? 1 : -1;
var ps = shader.uniforms.pointScale = tempScale;
var ps = (shader.uniforms.pointScale = tempScale);
shader.uniforms.projectionScale = Math.abs(this.worldTransform.a) * renderer.resolution;
}
var af = shader.uniforms.animationFrame = renderer.plugins.tilemap.tileAnim;
var af = (shader.uniforms.animationFrame = renderer.plugins.tilemap.tileAnim);
var layers = this.children;
for (var i = 0; i < layers.length; i++)
layers[i].renderWebGL(renderer, this.useSquare);
for (var i = 0; i < layers.length; i++) layers[i].renderWebGL(renderer, this.useSquare);
};
CompositeRectTileLayer.prototype.isModified = function (anim) {
var layers = this.children;
@ -168,8 +190,7 @@ var PIXI;
}
for (var i = 0; i < layers.length; i++) {
var layer = layers[i];
if (layer.modificationMarker != layer.pointsBuf.length ||
anim && layer.hasAnim) {
if (layer.modificationMarker != layer.pointsBuf.length || (anim && layer.hasAnim)) {
return true;
}
}
@ -184,9 +205,9 @@ var PIXI;
}
};
return CompositeRectTileLayer;
}(PIXI.Container));
})(PIXI.Container);
tilemap.CompositeRectTileLayer = CompositeRectTileLayer;
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
@ -212,18 +233,16 @@ var PIXI;
renderer.context.globalAlpha = 1.0;
};
GraphicsLayer.prototype.renderWebGL = function (renderer) {
if (!this._webGL[renderer.CONTEXT_UID])
this.dirty = true;
if (!this._webGL[renderer.CONTEXT_UID]) this.dirty = true;
_super.prototype.renderWebGL.call(this, renderer);
};
GraphicsLayer.prototype.isModified = function (anim) {
return false;
};
GraphicsLayer.prototype.clearModify = function () {
};
GraphicsLayer.prototype.clearModify = function () {};
return GraphicsLayer;
}(PIXI.Graphics));
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})(PIXI.Graphics);
})((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
@ -250,8 +269,7 @@ var PIXI;
RectTileLayer.prototype.initialize = function (zIndex, textures) {
if (!textures) {
textures = [];
}
else if (!(textures instanceof Array) && textures.baseTexture) {
} else if (!(textures instanceof Array) && textures.baseTexture) {
textures = [textures];
}
this.textures = textures;
@ -264,22 +282,32 @@ var PIXI;
this.hasAnim = false;
};
RectTileLayer.prototype.renderCanvas = function (renderer) {
if (this.textures.length === 0)
return;
if (this.textures.length === 0) return;
var points = this.pointsBuf;
renderer.context.fillStyle = '#000000';
renderer.context.fillStyle = "#000000";
for (var i = 0, n = points.length; i < n; i += 9) {
var x1 = points[i], y1 = points[i + 1];
var x2 = points[i + 2], y2 = points[i + 3];
var x1 = points[i],
y1 = points[i + 1];
var x2 = points[i + 2],
y2 = points[i + 3];
var w = points[i + 4];
var h = points[i + 5];
x1 += points[i + 6] * renderer.plugins.tilemap.tileAnim[0];
y1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[1];
var textureId = points[i + 8];
if (textureId >= 0) {
renderer.context.drawImage(this.textures[textureId].baseTexture.source, x1, y1, w, h, x2, y2, w, h);
}
else {
renderer.context.drawImage(
this.textures[textureId].baseTexture.source,
x1,
y1,
w,
h,
x2,
y2,
w,
h
);
} else {
renderer.context.globalAlpha = 0.5;
renderer.context.fillRect(x2, y2, w, h);
renderer.context.globalAlpha = 1;
@ -287,8 +315,12 @@ var PIXI;
}
};
RectTileLayer.prototype.addRect = function (textureId, u, v, x, y, tileWidth, tileHeight, animX, animY) {
if (animX === void 0) { animX = 0; }
if (animY === void 0) { animY = 0; }
if (animX === void 0) {
animX = 0;
}
if (animY === void 0) {
animY = 0;
}
var pb = this.pointsBuf;
this.hasAnim = this.hasAnim || animX > 0 || animY > 0;
if (tileWidth == tileHeight) {
@ -301,8 +333,7 @@ var PIXI;
pb.push(animX | 0);
pb.push(animY | 0);
pb.push(textureId);
}
else {
} else {
var i;
if (tileWidth % tileHeight === 0) {
for (i = 0; i < tileWidth / tileHeight; i++) {
@ -316,8 +347,7 @@ var PIXI;
pb.push(animY | 0);
pb.push(textureId);
}
}
else if (tileHeight % tileWidth === 0) {
} else if (tileHeight % tileWidth === 0) {
for (i = 0; i < tileHeight / tileWidth; i++) {
pb.push(u);
pb.push(v + i * tileWidth);
@ -329,8 +359,7 @@ var PIXI;
pb.push(animY | 0);
pb.push(textureId);
}
}
else {
} else {
pb.push(u);
pb.push(v);
pb.push(x);
@ -343,12 +372,12 @@ var PIXI;
}
}
};
;
RectTileLayer.prototype.renderWebGL = function (renderer, useSquare) {
if (useSquare === void 0) { useSquare = false; }
if (useSquare === void 0) {
useSquare = false;
}
var points = this.pointsBuf;
if (points.length === 0)
return;
if (points.length === 0) return;
var rectsCount = points.length / 9;
var tile = renderer.plugins.tilemap;
var gl = renderer.gl;
@ -357,16 +386,14 @@ var PIXI;
}
var shader = tile.getShader(useSquare);
var textures = this.textures;
if (textures.length === 0)
return;
if (textures.length === 0) return;
var len = textures.length;
if (this._tempTexSize < shader.maxTextures) {
this._tempTexSize = shader.maxTextures;
this._tempSize = new Float32Array(2 * shader.maxTextures);
}
for (var i = 0; i < len; i++) {
if (!textures[i] || !textures[i].valid)
return;
if (!textures[i] || !textures[i].valid) return;
var texture = textures[i].baseTexture;
}
tile.bindTextures(renderer, shader, textures);
@ -382,8 +409,7 @@ var PIXI;
var vertexBuf = vb.vb;
vertexBuf.bind();
var vertices = rectsCount * shader.vertPerQuad;
if (vertices === 0)
return;
if (vertices === 0) return;
if (this.modificationMarker != vertices) {
this.modificationMarker = vertices;
var vs = shader.stride * vertices;
@ -397,12 +423,13 @@ var PIXI;
this.vbInts = new Uint32Array(this.vbBuffer);
vertexBuf.upload(this.vbBuffer, 0, true);
}
var arr = this.vbArray, ints = this.vbInts;
var arr = this.vbArray,
ints = this.vbInts;
var sz = 0;
var textureId, shiftU, shiftV;
if (useSquare) {
for (i = 0; i < points.length; i += 9) {
textureId = (points[i + 8] >> 2);
textureId = points[i + 8] >> 2;
shiftU = 1024 * (points[i + 8] & 1);
shiftV = 1024 * ((points[i + 8] >> 1) & 1);
arr[sz++] = points[i + 2];
@ -414,18 +441,21 @@ var PIXI;
arr[sz++] = points[i + 7];
arr[sz++] = textureId;
}
}
else {
} else {
var tint = -1;
for (i = 0; i < points.length; i += 9) {
var eps = 0.5;
textureId = (points[i + 8] >> 2);
textureId = points[i + 8] >> 2;
shiftU = 1024 * (points[i + 8] & 1);
shiftV = 1024 * ((points[i + 8] >> 1) & 1);
var x = points[i + 2], y = points[i + 3];
var w = points[i + 4], h = points[i + 5];
var u = points[i] + shiftU, v = points[i + 1] + shiftV;
var animX = points[i + 6], animY = points[i + 7];
var x = points[i + 2],
y = points[i + 3];
var w = points[i + 4],
h = points[i + 5];
var u = points[i] + shiftU,
v = points[i + 1] + shiftV;
var animX = points[i + 6],
animY = points[i + 7];
arr[sz++] = x;
arr[sz++] = y;
arr[sz++] = u;
@ -474,22 +504,22 @@ var PIXI;
}
vertexBuf.upload(arr, 0, true);
}
if (useSquare)
gl.drawArrays(gl.POINTS, 0, vertices);
else
gl.drawElements(gl.TRIANGLES, rectsCount * 6, gl.UNSIGNED_SHORT, 0);
if (useSquare) gl.drawArrays(gl.POINTS, 0, vertices);
else gl.drawElements(gl.TRIANGLES, rectsCount * 6, gl.UNSIGNED_SHORT, 0);
};
return RectTileLayer;
}(PIXI.Container));
})(PIXI.Container);
tilemap.RectTileLayer = RectTileLayer;
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
var tilemap;
(function (tilemap) {
var rectShaderFrag = "varying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}";
var rectShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 anim = aAnim * animationFrame;\n vTextureCoord = aTextureCoord + anim;\n vFrame = aFrame + vec4(anim, anim);\n vTextureId = aTextureId;\n}\n";
var rectShaderFrag =
"varying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}";
var rectShaderVert =
"\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 anim = aAnim * animationFrame;\n vTextureCoord = aTextureCoord + anim;\n vFrame = aFrame + vec4(anim, anim);\n vTextureId = aTextureId;\n}\n";
var TilemapShader = (function (_super) {
__extends(TilemapShader, _super);
function TilemapShader(gl, maxTextures, shaderVert, shaderFrag) {
@ -500,12 +530,19 @@ var PIXI;
return _this;
}
return TilemapShader;
}(PIXI.Shader));
})(PIXI.Shader);
tilemap.TilemapShader = TilemapShader;
var RectTileShader = (function (_super) {
__extends(RectTileShader, _super);
function RectTileShader(gl, maxTextures) {
var _this = _super.call(this, gl, maxTextures, rectShaderVert, tilemap.shaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)) || this;
var _this =
_super.call(
this,
gl,
maxTextures,
rectShaderVert,
tilemap.shaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)
) || this;
_this.vertSize = 11;
_this.vertPerQuad = 4;
_this.stride = _this.vertSize * 4;
@ -514,7 +551,8 @@ var PIXI;
}
RectTileShader.prototype.createVao = function (renderer, vb) {
var gl = renderer.gl;
return renderer.createVao()
return renderer
.createVao()
.addIndex(this.indexBuffer)
.addAttribute(vb, this.attributes.aVertexPosition, gl.FLOAT, false, this.stride, 0)
.addAttribute(vb, this.attributes.aTextureCoord, gl.FLOAT, false, this.stride, 2 * 4)
@ -523,9 +561,9 @@ var PIXI;
.addAttribute(vb, this.attributes.aTextureId, gl.FLOAT, false, this.stride, 10 * 4);
};
return RectTileShader;
}(TilemapShader));
})(TilemapShader);
tilemap.RectTileShader = RectTileShader;
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
@ -549,44 +587,54 @@ var PIXI;
}
shaderGenerator.fillSamplers = fillSamplers;
function generateFragmentSrc(maxTextures, fragmentSrc) {
return fragmentSrc.replace(/%count%/gi, maxTextures + "")
return fragmentSrc
.replace(/%count%/gi, maxTextures + "")
.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));
}
shaderGenerator.generateFragmentSrc = generateFragmentSrc;
function generateSampleSrc(maxTextures) {
var src = '';
src += '\n';
src += '\n';
src += 'if(vTextureId <= -1.0) {';
src += '\n\tcolor = shadowColor;';
src += '\n}';
var src = "";
src += "\n";
src += "\n";
src += "if(vTextureId <= -1.0) {";
src += "\n\tcolor = shadowColor;";
src += "\n}";
for (var i = 0; i < maxTextures; i++) {
src += '\nelse ';
src += "\nelse ";
if (i < maxTextures - 1) {
src += 'if(textureId == ' + i + '.0)';
src += "if(textureId == " + i + ".0)";
}
src += '\n{';
src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);';
src += '\n}';
src += "\n{";
src += "\n\tcolor = texture2D(uSamplers[" + i + "], textureCoord * uSamplerSize[" + i + "]);";
src += "\n}";
}
src += '\n';
src += '\n';
src += "\n";
src += "\n";
return src;
}
shaderGenerator.generateSampleSrc = generateSampleSrc;
})(shaderGenerator = tilemap.shaderGenerator || (tilemap.shaderGenerator = {}));
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})((shaderGenerator = tilemap.shaderGenerator || (tilemap.shaderGenerator = {})));
})((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
var tilemap;
(function (tilemap) {
var squareShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aAnim;\nattribute float aTextureId;\nattribute float aSize;\n\nuniform mat3 projectionMatrix;\nuniform vec2 samplerSize;\nuniform vec2 animationFrame;\nuniform float projectionScale;\n\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition + aSize * 0.5, 1.0)).xy, 0.0, 1.0);\n gl_PointSize = aSize * projectionScale;\n vTextureCoord = aTextureCoord + aAnim * animationFrame;\n vTextureId = aTextureId;\n vSize = aSize;\n}\n";
var squareShaderFrag = "\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\nuniform vec2 pointScale;\n\nvoid main(void){\n float margin = 0.5 / vSize;\n vec2 pointCoord = (gl_PointCoord - 0.5) * pointScale + 0.5;\n vec2 clamped = vec2(clamp(pointCoord.x, margin, 1.0 - margin), clamp(pointCoord.y, margin, 1.0 - margin));\n vec2 textureCoord = pointCoord * vSize + vTextureCoord;\n float textureId = vTextureId;\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n\n";
var squareShaderVert =
"\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aAnim;\nattribute float aTextureId;\nattribute float aSize;\n\nuniform mat3 projectionMatrix;\nuniform vec2 samplerSize;\nuniform vec2 animationFrame;\nuniform float projectionScale;\n\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition + aSize * 0.5, 1.0)).xy, 0.0, 1.0);\n gl_PointSize = aSize * projectionScale;\n vTextureCoord = aTextureCoord + aAnim * animationFrame;\n vTextureId = aTextureId;\n vSize = aSize;\n}\n";
var squareShaderFrag =
"\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\nuniform vec2 pointScale;\n\nvoid main(void){\n float margin = 0.5 / vSize;\n vec2 pointCoord = (gl_PointCoord - 0.5) * pointScale + 0.5;\n vec2 clamped = vec2(clamp(pointCoord.x, margin, 1.0 - margin), clamp(pointCoord.y, margin, 1.0 - margin));\n vec2 textureCoord = pointCoord * vSize + vTextureCoord;\n float textureId = vTextureId;\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n\n";
var SquareTileShader = (function (_super) {
__extends(SquareTileShader, _super);
function SquareTileShader(gl, maxTextures) {
var _this = _super.call(this, gl, maxTextures, squareShaderVert, tilemap.shaderGenerator.generateFragmentSrc(maxTextures, squareShaderFrag)) || this;
var _this =
_super.call(
this,
gl,
maxTextures,
squareShaderVert,
tilemap.shaderGenerator.generateFragmentSrc(maxTextures, squareShaderFrag)
) || this;
_this.vertSize = 8;
_this.vertPerQuad = 1;
_this.stride = _this.vertSize * 4;
@ -596,7 +644,8 @@ var PIXI;
}
SquareTileShader.prototype.createVao = function (renderer, vb) {
var gl = renderer.gl;
return renderer.createVao()
return renderer
.createVao()
.addIndex(this.indexBuffer)
.addAttribute(vb, this.attributes.aVertexPosition, gl.FLOAT, false, this.stride, 0)
.addAttribute(vb, this.attributes.aTextureCoord, gl.FLOAT, false, this.stride, 2 * 4)
@ -604,11 +653,10 @@ var PIXI;
.addAttribute(vb, this.attributes.aAnim, gl.FLOAT, false, this.stride, 5 * 4)
.addAttribute(vb, this.attributes.aTextureId, gl.FLOAT, false, this.stride, 7 * 4);
};
;
return SquareTileShader;
}(tilemap.TilemapShader));
})(tilemap.TilemapShader);
tilemap.SquareTileShader = SquareTileShader;
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
@ -619,10 +667,28 @@ var PIXI;
var gl = tex.gl;
var baseTex = sprite.texture.baseTexture;
if (clearBuffer && clearWidth > 0 && clearHeight > 0) {
gl.texSubImage2D(gl.TEXTURE_2D, 0, sprite.position.x, sprite.position.y, clearWidth, clearHeight, tex.format, tex.type, clearBuffer);
gl.texSubImage2D(
gl.TEXTURE_2D,
0,
sprite.position.x,
sprite.position.y,
clearWidth,
clearHeight,
tex.format,
tex.type,
clearBuffer
);
}
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
gl.texSubImage2D(gl.TEXTURE_2D, 0, sprite.position.x, sprite.position.y, tex.format, tex.type, baseTex.source);
gl.texSubImage2D(
gl.TEXTURE_2D,
0,
sprite.position.x,
sprite.position.y,
tex.format,
tex.type,
baseTex.source
);
}
var TileRenderer = (function (_super) {
__extends(TileRenderer, _super);
@ -651,7 +717,7 @@ var PIXI;
};
TileRenderer.prototype.initBounds = function () {
var gl = this.renderer.gl;
var tempCanvas = document.createElement('canvas');
var tempCanvas = document.createElement("canvas");
tempCanvas.width = 2048;
tempCanvas.height = 2048;
for (var i = 0; i < this.maxTextures; i++) {
@ -686,18 +752,21 @@ var PIXI;
var i;
for (i = 0; i < len; i++) {
var texture = textures[i];
if (!texture || !textures[i].valid)
continue;
if (!texture || !textures[i].valid) continue;
var bs = bounds[i >> 2][i & 3];
if (!bs.texture ||
bs.texture.baseTexture !== texture.baseTexture) {
if (!bs.texture || bs.texture.baseTexture !== texture.baseTexture) {
bs.texture = texture;
var glt = glts[i >> 2];
renderer.bindTexture(glt, 0, true);
if (doClear) {
_hackSubImage(glt.baseTexture._glTextures[renderer.CONTEXT_UID], bs, this._clearBuffer, 1024, 1024);
}
else {
_hackSubImage(
glt.baseTexture._glTextures[renderer.CONTEXT_UID],
bs,
this._clearBuffer,
1024,
1024
);
} else {
_hackSubImage(glt.baseTexture._glTextures[renderer.CONTEXT_UID], bs);
}
}
@ -711,8 +780,7 @@ var PIXI;
TileRenderer.prototype.checkLeaks = function () {
var now = Date.now();
var old = now - 10000;
if (this.lastTimeCheck < old ||
this.lastTimeCheck > now) {
if (this.lastTimeCheck < old || this.lastTimeCheck > now) {
this.lastTimeCheck = now;
var vbs = this.vbs;
for (var key in vbs) {
@ -722,7 +790,6 @@ var PIXI;
}
}
};
;
TileRenderer.prototype.start = function () {
this.renderer.state.setBlendMode(PIXI.BLEND_MODES.NORMAL);
};
@ -746,7 +813,7 @@ var PIXI;
vao: shader.createVao(this.renderer, vb),
lastTimeAccess: Date.now(),
useSquare: useSquare,
shader: shader
shader: shader,
};
this.vbs[id] = stuff;
return stuff;
@ -780,8 +847,7 @@ var PIXI;
}
if (this.indexBuffer) {
this.indexBuffer.upload(indices);
}
else {
} else {
var gl = this.renderer.gl;
this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);
}
@ -796,15 +862,14 @@ var PIXI;
this.rectShader = null;
this.squareShader = null;
};
;
return TileRenderer;
}(PIXI.ObjectRenderer));
})(PIXI.ObjectRenderer);
TileRenderer.vbAutoincrement = 0;
TileRenderer.SCALE_MODE = PIXI.SCALE_MODES.LINEAR;
TileRenderer.DO_CLEAR = false;
tilemap.TileRenderer = TileRenderer;
PIXI.WebGLRenderer.registerPlugin('tilemap', TileRenderer);
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
PIXI.WebGLRenderer.registerPlugin("tilemap", TileRenderer);
})((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
@ -821,8 +886,7 @@ var PIXI;
}
ZLayer.prototype.clear = function () {
var layers = this.children;
for (var i = 0; i < layers.length; i++)
layers[i].clear();
for (var i = 0; i < layers.length; i++) layers[i].clear();
this._previousLayers = 0;
};
ZLayer.prototype.cacheIfDirty = function () {
@ -833,13 +897,12 @@ var PIXI;
var buf = this.canvasBuffer;
var tempRender = this._tempRender;
if (!buf) {
buf = this.canvasBuffer = document.createElement('canvas');
buf = this.canvasBuffer = document.createElement("canvas");
tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, { view: buf });
tempRender.context = tempRender.rootContext;
tempRender.plugins.tilemap.dontUseTransform = true;
}
if (buf.width != tilemap._layerWidth ||
buf.height != tilemap._layerHeight) {
if (buf.width != tilemap._layerWidth || buf.height != tilemap._layerHeight) {
buf.width = tilemap._layerWidth;
buf.height = tilemap._layerHeight;
modified = true;
@ -870,18 +933,23 @@ var PIXI;
break;
}
};
;
ZLayer.prototype.renderCanvas = function (renderer) {
this.cacheIfDirty();
var wt = this.layerTransform;
renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
renderer.context.setTransform(
wt.a,
wt.b,
wt.c,
wt.d,
wt.tx * renderer.resolution,
wt.ty * renderer.resolution
);
var tilemap = this.tilemap;
renderer.context.drawImage(this.canvasBuffer, 0, 0);
};
;
return ZLayer;
}(PIXI.Container));
})(PIXI.Container);
tilemap_1.ZLayer = ZLayer;
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
})((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
//# sourceMappingURL=pixi-tilemap.js.map
//# sourceMappingURL=pixi-tilemap.js.map

File diff suppressed because it is too large Load Diff

@ -22331,4 +22331,4 @@ declare var $gameMap: Game_Map;
* @type {Game_Player}
*/
declare var $gamePlayer: Game_Player;
declare var $testEvent: Array<rm.types.EventCommand>;
declare var $testEvent: Array<rm.types.EventCommand>;

@ -6,4 +6,4 @@ PluginManager.setup($plugins);
window.onload = function () {
SceneManager.run(Scene_Boot);
};
};

@ -1,5 +1,5 @@
//=============================================================================
/*:
/*:
* @plugindesc ------------------------------------------------------------
* @author Yanfly Engine Plugins
*/

@ -86,22 +86,21 @@ const ATBConfig = {};
const ATBAlias = {};
{
"use strict";
("use strict");
const param = PluginManager.parameters("ATB");
ATBConfig.waitCommandSelection = (param["waitCommandSelection"] === "true" ? true : false);
ATBConfig.waitSelectSkillOrItem = (param["waitSelectSkillOrItem"] === "true" ? true : false);
ATBConfig.waitAnimation = (param["waitAnimation"] === "true" ? true : false);
ATBConfig.drawEnemyUnderGauge = (param["drawEnemyUnderGauge"] === "true" ? true : false);
ATBConfig.waitCommandSelection = param["waitCommandSelection"] === "true" ? true : false;
ATBConfig.waitSelectSkillOrItem = param["waitSelectSkillOrItem"] === "true" ? true : false;
ATBConfig.waitAnimation = param["waitAnimation"] === "true" ? true : false;
ATBConfig.drawEnemyUnderGauge = param["drawEnemyUnderGauge"] === "true" ? true : false;
ATBConfig.baseGaugeSpeed = parseInt(param["baseGaugeSpeed"]);
ATBConfig.maxActionCount = parseInt(param["maxActionCount"]);
ATBConfig.baseSkillWaitGaugeSpeed = parseInt(param["baseSkillWaitGaugeSpeed"]);
ATBConfig.fastForward = parseInt(param["fastForward"]);
ATBConfig.enableChangeSelectActor = (param["enableChangeSelectActor"] === "true" ? true : false);
ATBConfig.enableYEP_BattleEngineCore = (param["enableYEP_BattleEngineCore"] === "true" ? true : false);
ATBConfig.enableChangeSelectActor = param["enableChangeSelectActor"] === "true" ? true : false;
ATBConfig.enableYEP_BattleEngineCore = param["enableYEP_BattleEngineCore"] === "true" ? true : false;
ATBConfig.drawUnderGauge = false;
class ATBTimer {
constructor(maxValue) {
this._maxValue = maxValue;
@ -137,7 +136,6 @@ const ATBAlias = {};
}
}
class ATBGauge {
static get PURPOSE_TIME() {
return "PURPOSE_TIME";
@ -244,7 +242,6 @@ const ATBAlias = {};
}
}
class ActorGauge extends ATBGauge {
constructor(battler) {
super(battler);
@ -252,30 +249,29 @@ const ATBAlias = {};
this._commandSelected = false;
if (ATBConfig.drawUnderGauge) BattleManager.spriteset().createGaugeLine(battler);
}
setCommandSelecting(commandSelecting) {
this._commandSelecting = commandSelecting;
}
isCommandSelecting() {
return this._commandSelecting;
}
setCommandSelected(commandSelected) {
this._commandSelected = commandSelected;
}
isCommandSelected() {
return this._commandSelected;
}
commandSelectCancel() {
this._commandSelecting = false;
this._commandSelected = false;
}
}
class EnemyGauge extends ATBGauge {
constructor(battler) {
super(battler);
@ -283,7 +279,6 @@ const ATBAlias = {};
}
}
class GainHpTimer extends ATBTimer {
constructor(maxValue, gainValue, battler, stateId) {
super(maxValue);
@ -309,7 +304,6 @@ const ATBAlias = {};
}
}
class ATBManager {
static get GAUGE_MAX() {
return 1000;
@ -397,7 +391,7 @@ const ATBAlias = {};
if (members.indexOf(battler) === -1) {
let i = this._holdAllBattleMembers.indexOf(battler);
this._holdAllBattleMembers.splice(i, 1);
i = this._gauges.indexOf(battler.gauge())
i = this._gauges.indexOf(battler.gauge());
this._gauges.splice(i, 1);
}
}
@ -450,7 +444,7 @@ const ATBAlias = {};
startSkillWait(battler) {
battler.gauge().clear();
const action = battler.currentAction();
let skillWaitSpeed = (battler.speed() + action.item().speed);
let skillWaitSpeed = battler.speed() + action.item().speed;
if (battler.currentAction().isAttack()) skillWaitSpeed += battler.attackSpeed();
this.resetGaugeSpeed(battler, skillWaitSpeed * ATBConfig.baseSkillWaitGaugeSpeed, null);
battler.gauge().purpose = ATBGauge.PURPOSE_SKILL_WAIT;
@ -476,11 +470,13 @@ const ATBAlias = {};
getNextHighPrioritySubject() {
for (let i = 0; i < this._canActionMembers.length; i++) {
let subject = this._canActionMembers[i];
if (subject instanceof Game_Actor && subject.gauge().isCommandSelected()
|| subject instanceof Game_Enemy
|| !subject.canInput()) {
this._canActionMembers.splice(i, 1);
return subject;
if (
(subject instanceof Game_Actor && subject.gauge().isCommandSelected()) ||
subject instanceof Game_Enemy ||
!subject.canInput()
) {
this._canActionMembers.splice(i, 1);
return subject;
}
}
return null;
@ -499,22 +495,28 @@ const ATBAlias = {};
if (lambda(array[i])) return array[i];
}
return null;
}
};
const currentActorIdx = this._canActionMembers.indexOf(currentActor);
if (currentActorIdx === -1) return null;
let nextActors = this._canActionMembers.filter(member => member instanceof Game_Actor);
let nextActors = this._canActionMembers.filter((member) => member instanceof Game_Actor);
if (reverse) {
nextActors = nextActors.sort((a, b) => $gameParty.members().indexOf(b) - $gameParty.members().indexOf(a));
nextActors = nextActors.sort(
(a, b) => $gameParty.members().indexOf(b) - $gameParty.members().indexOf(a)
);
} else {
nextActors = nextActors.sort((a, b) => $gameParty.members().indexOf(a) - $gameParty.members().indexOf(b));
nextActors = nextActors.sort(
(a, b) => $gameParty.members().indexOf(a) - $gameParty.members().indexOf(b)
);
}
const nextActor = cycleFild(nextActors, nextActors.indexOf(currentActor) + 1, (actor) => {
if (actor === currentActor) return false;
if (!actor.gauge().isCommandSelected()
&& actor.canInput()
&& actor.gauge().purpose === ATBGauge.PURPOSE_TIME) {
return true;
if (
!actor.gauge().isCommandSelected() &&
actor.canInput() &&
actor.gauge().purpose === ATBGauge.PURPOSE_TIME
) {
return true;
}
return false;
});
@ -578,7 +580,7 @@ const ATBAlias = {};
applyReduceGaugeState(battler, state) {
let matchData;
if (state._reduceGauge === undefined) {
if (matchData = state.note.match(/<\s*ReduceGauge\s+value=(\d+)\s*>/)) {
if ((matchData = state.note.match(/<\s*ReduceGauge\s+value=(\d+)\s*>/))) {
state._reduceGauge = parseInt(matchData[1]);
} else {
state._reduceGauge = null;
@ -593,15 +595,17 @@ const ATBAlias = {};
applyIntervalGainHp(battler, state) {
let matchData;
if (state._intervalGainHp === undefined) {
if (matchData = state.note.match(/<\s*IntervalGainHp\s+gainValue=(\-?\d+)\s+duration=(\d+)\s*>/)) {
if ((matchData = state.note.match(/<\s*IntervalGainHp\s+gainValue=(\-?\d+)\s+duration=(\d+)\s*>/))) {
state._intervalGainHp = [parseInt(matchData[1]), parseInt(matchData[2])];
} else {
state._intervalGainHp = null;
state._intervalGainHp
state._intervalGainHp;
}
}
if (state._intervalGainHp) {
this._timers.push(new GainHpTimer(state._intervalGainHp[1], state._intervalGainHp[0], battler, state.id));
this._timers.push(
new GainHpTimer(state._intervalGainHp[1], state._intervalGainHp[0], battler, state.id)
);
}
}
@ -659,10 +663,9 @@ const ATBAlias = {};
}
}
/* class Game_BattlerBase */
ATBAlias._Game_BattlerBase_clearStates = Game_BattlerBase.prototype.clearStates;
Game_BattlerBase.prototype.clearStates = function() {
Game_BattlerBase.prototype.clearStates = function () {
if (SceneManager._scene instanceof Scene_Battle) {
for (let stateId of this._states) {
BattleManager.eraseStateApply(this, stateId);
@ -672,7 +675,7 @@ const ATBAlias = {};
};
ATBAlias._Game_BattlerBase_addNewState = Game_BattlerBase.prototype.addNewState;
Game_BattlerBase.prototype.addNewState = function(stateId) {
Game_BattlerBase.prototype.addNewState = function (stateId) {
ATBAlias._Game_BattlerBase_addNewState.call(this, stateId);
if (SceneManager._scene instanceof Scene_Battle) {
BattleManager.addStateApply(this, stateId);
@ -680,7 +683,7 @@ const ATBAlias = {};
};
ATBAlias._Game_BattlerBase_eraseState = Game_BattlerBase.prototype.eraseState;
Game_BattlerBase.prototype.eraseState = function(stateId) {
Game_BattlerBase.prototype.eraseState = function (stateId) {
ATBAlias._Game_BattlerBase_eraseState.call(this, stateId);
if (SceneManager._scene instanceof Scene_Battle) {
BattleManager.eraseStateApply(this, stateId);
@ -689,7 +692,7 @@ const ATBAlias = {};
// timing 1: 行動終了時
// timing 2: ターン終了時
Game_BattlerBase.prototype.updateStateTurns = function(timing = 2) {
Game_BattlerBase.prototype.updateStateTurns = function (timing = 2) {
for (let stateId of this._states) {
if (this._stateTurns[stateId] > 0) {
let state = $dataStates[stateId];
@ -698,59 +701,56 @@ const ATBAlias = {};
}
};
/* class Game_Battler */
ATBAlias._Game_Battler_initMembers = Game_Battler.prototype.initMembers;
Game_Battler.prototype.initMembers = function() {
Game_Battler.prototype.initMembers = function () {
ATBAlias._Game_Battler_initMembers.call(this);
this._gauge = null;
};
Game_Battler.prototype.getSprite = function() {
Game_Battler.prototype.getSprite = function () {
for (let sprite of BattleManager._spriteset.battlerSprites()) {
if (sprite._battler === this) return sprite;
}
return null;
};
Game_Battler.prototype.setGauge = function(gauge) {
return this._gauge = gauge;
Game_Battler.prototype.setGauge = function (gauge) {
return (this._gauge = gauge);
};
Game_Battler.prototype.gauge = function() {
Game_Battler.prototype.gauge = function () {
return this._gauge;
};
// 行動終了時のステート解除判定後にステート経過ターンを更新する
ATBAlias._Game_Battler_onAllActionsEnd = Game_Battler.prototype.onAllActionsEnd;
Game_Battler.prototype.onAllActionsEnd = function() {
Game_Battler.prototype.onAllActionsEnd = function () {
ATBAlias._Game_Battler_onAllActionsEnd.call(this);
this.updateStateTurns(1);
};
// 行動完了時にdoneさせない
Game_Battler.prototype.performActionEnd = function() {
Game_Battler.prototype.performActionEnd = function () {
this.setActionState("undecided");
};
// speedの生成にactionを用いない
Game_Battler.prototype.makeSpeed = function() {
Game_Battler.prototype.makeSpeed = function () {
this._speed = this.agi + Math.randomInt(Math.floor(5 + this.agi / 4));
this._speed += this.attackSpeed();
};
/* class Game_Actor */
ATBAlias._Game_BattlerBase_die = Game_BattlerBase.prototype.die;
Game_Actor.prototype.die = function() {
Game_Actor.prototype.die = function () {
this.gauge().commandSelectCancel();
BattleManager._atbManager.endAction(this);
ATBAlias._Game_BattlerBase_die.call(this);
};
/* class Game_Item */
Game_Item.prototype.isSkillWait = function() {
Game_Item.prototype.isSkillWait = function () {
const skill = this.object();
if (!skill) return null;
if (skill._skillWait === undefined) {
@ -763,16 +763,14 @@ const ATBAlias = {};
return skill._skillWait;
};
/* class Game_Action */
Game_Action.prototype.isSkillWait = function() {
Game_Action.prototype.isSkillWait = function () {
return this._item.isSkillWait();
};
/* singleton class BattleManager */
ATBAlias._BattleManager_initMembers = BattleManager.initMembers;
BattleManager.initMembers = function() {
BattleManager.initMembers = function () {
ATBAlias._BattleManager_initMembers.call(this);
this._turnStarted = false;
this._beforeActionFinish = false;
@ -780,20 +778,20 @@ const ATBAlias = {};
this._atbManager = new ATBManager();
};
BattleManager.spriteset = function() {
BattleManager.spriteset = function () {
return this._spriteset;
}
};
BattleManager.startInputPhase = function() {
BattleManager.startInputPhase = function () {
this._phase = "input";
};
BattleManager.setActor = function(actor) {
BattleManager.setActor = function (actor) {
this._actorIndex = $gameParty.members().indexOf(actor);
};
ATBAlias._BattleManager_startBattle = BattleManager.startBattle;
BattleManager.startBattle = function() {
BattleManager.startBattle = function () {
ATBAlias._BattleManager_startBattle.call(this);
this._atbManager.startBattle();
if (this._surprise) {
@ -804,12 +802,12 @@ const ATBAlias = {};
};
// startInput時は、すぐにターンを開始する
BattleManager.startInput = function() {
BattleManager.startInput = function () {
this.startTurn();
};
ATBAlias._BattleManager_startTurn = BattleManager.startTurn;
BattleManager.startTurn = function() {
BattleManager.startTurn = function () {
if (this._turnStarted) {
this._phase = "turn";
this._logWindow.startTurn();
@ -833,7 +831,7 @@ const ATBAlias = {};
}
};
BattleManager.updateTurn = function() {
BattleManager.updateTurn = function () {
// CTBの場合は、BattleManager.updateTurn内でゲージを更新する
if (ATBConfig.waitCommandSelection) {
this._atbManager.updateGauge();
@ -860,10 +858,9 @@ const ATBAlias = {};
};
// clearActorを無効化する
BattleManager.clearActor = function() {
};
BattleManager.clearActor = function () {};
BattleManager.beforeAction = function(action) {
BattleManager.beforeAction = function (action) {
const gauge = this._subject.gauge();
if (gauge.purpose === ATBGauge.PURPOSE_SKILL_WAIT) {
if (this._subject instanceof Game_Actor) gauge.setCommandSelected(true);
@ -883,14 +880,14 @@ const ATBAlias = {};
}
};
BattleManager.afterAction = function() {
BattleManager.afterAction = function () {
this._atbManager.toActive("turn");
if (this._subject instanceof Game_Actor && this._subject.gauge().purpose === ATBGauge.PURPOSE_TIME) {
this._subject.gauge().setCommandSelected(false);
}
};
BattleManager.processTurn = function() {
BattleManager.processTurn = function () {
if (ATBConfig.enableYEP_BattleEngineCore) this._processTurn = true;
const subject = this._subject;
const action = subject.currentAction();
@ -925,7 +922,7 @@ const ATBAlias = {};
};
ATBAlias._BattleManager_startAction = BattleManager.startAction;
BattleManager.startAction = function() {
BattleManager.startAction = function () {
if (this._subject instanceof Game_Actor) {
if (this._subject.gauge().isCommandSelected()) {
if (ATBConfig.waitAnimation) this._atbManager.toWait("turn");
@ -940,53 +937,49 @@ const ATBAlias = {};
};
ATBAlias._BattleManager_endAction = BattleManager.endAction;
BattleManager.endAction = function() {
BattleManager.endAction = function () {
ATBAlias._BattleManager_endAction.call(this);
this._atbManager.endAction(this._subject);
};
ATBAlias._BattleManager_endTurn = BattleManager.endTurn;
BattleManager.endTurn = function() {
BattleManager.endTurn = function () {
if (ATBConfig.enableYEP_BattleEngineCore) {
if (this.isTurnBased() && this._enteredEndPhase) {
this._phase = "turnEnd";
this._preemptive = false;
this._surprise = false;
return;
this._phase = "turnEnd";
this._preemptive = false;
this._surprise = false;
return;
}
this._enteredEndPhase = true;
Yanfly.BEC.BattleManager_endTurn.call(this);
BattleManager.refreshAllMembers();
this.actor().gauge().commandSelectCancel();
this._turnStarted = false;
} else {
ATBAlias._BattleManager_endTurn.call(this);
this._turnStarted = false;
}
};
BattleManager.selectNextCommand = function() {
BattleManager.selectNextCommand = function () {
this.actor().gauge().setCommandSelected(true);
this.actor().gauge().setCommandSelecting(false);
this.toActiveSelectSkillOrItem();
this.startTurnReserve();
};
BattleManager.getNextSubject = function() {
BattleManager.getNextSubject = function () {
if (this._subject && this._subject.gauge().isActionEnd()) {
return null;
}
return this._atbManager.getNextSubject();
};
BattleManager.processEscape = function() {
BattleManager.processEscape = function () {
$gameParty.performEscape();
SoundManager.playEscape();
const success = this._preemptive ? true : (Math.random() < this._escapeRatio);
const success = this._preemptive ? true : Math.random() < this._escapeRatio;
if (success) {
this.displayEscapeSuccessMessage();
this._escaped = true;
@ -1006,76 +999,72 @@ const ATBAlias = {};
};
ATBAlias._BattleManager_isInputting = BattleManager.isInputting;
BattleManager.isInputting = function() {
BattleManager.isInputting = function () {
return ATBAlias._BattleManager_isInputting.call(this) && !this._turnStartReserve;
};
BattleManager.update = function() {
BattleManager.update = function () {
if (ATBConfig.enableChangeSelectActor) this.updateChangeSelectActor();
if (ATBConfig.enableYEP_BattleEngineCore) {
if (!this.isBusy() && !this.updateEvent()) {
switch (this._phase) {
case "start":
this.startInput();
break;
case "input":
case "turn":
this.startTurnAwait();
this.updateTurn();
break;
case "action":
this.updateAction();
break;
case "phaseChange":
this.updatePhase();
break;
case "actionList":
this.updateActionList()
break;
case "actionTargetList":
this.updateActionTargetList()
break;
case "turnEnd":
this.updateTurnEnd();
break;
case "battleEnd":
this.updateBattleEnd();
break;
case "start":
this.startInput();
break;
case "input":
case "turn":
this.startTurnAwait();
this.updateTurn();
break;
case "action":
this.updateAction();
break;
case "phaseChange":
this.updatePhase();
break;
case "actionList":
this.updateActionList();
break;
case "actionTargetList":
this.updateActionTargetList();
break;
case "turnEnd":
this.updateTurnEnd();
break;
case "battleEnd":
this.updateBattleEnd();
break;
}
}
} else {
if (!this.isBusy() && !this.updateEvent()) {
switch (this._phase) {
case "start":
this.startInput();
break;
// ATBの場合は、input phaseの間でもターン更新を行う
case "input":
case "turn":
this.startTurnAwait();
this.updateTurn();
break;
case "action":
this.updateAction();
break;
case "turnEnd":
this.updateTurnEnd();
break;
case "battleEnd":
this.updateBattleEnd();
break;
case "start":
this.startInput();
break;
// ATBの場合は、input phaseの間でもターン更新を行う
case "input":
case "turn":
this.startTurnAwait();
this.updateTurn();
break;
case "action":
this.updateAction();
break;
case "turnEnd":
this.updateTurnEnd();
break;
case "battleEnd":
this.updateBattleEnd();
break;
}
}
}
// バトルイベントを実行する場合、アクターコマンド選択中を解除する
if ($gameTroop.isEventRunning()) this.actor().gauge().setCommandSelecting(false);
};
BattleManager.updateChangeSelectActor = function() {
BattleManager.updateChangeSelectActor = function () {
if (!this._subject) return;
const actorCommandWindow = SceneManager._scene._actorCommandWindow;
if (actorCommandWindow.active) {
@ -1087,22 +1076,24 @@ const ATBAlias = {};
}
};
BattleManager.changeSelectActor = function(reverse = false) {
BattleManager.changeSelectActor = function (reverse = false) {
const scene = SceneManager._scene;
const currentActor = this.actor();
if (!currentActor) return;
let nextActor = null;
if (this._subject instanceof Game_Actor
&& this._subject === currentActor
&& this._subject.canInput()
&& this._subject.gauge().purpose === ATBGauge.PURPOSE_TIME
&& !this._subject.gauge().isActionEnd()) {
this._atbManager.addNextSubject(this._subject);
nextActor = this._atbManager.changeNextActor(currentActor, reverse);
this._subject = this._atbManager.getNextSubject();
if (!nextActor) return;
currentActor.gauge().commandSelectCancel();
this.setActor(nextActor);
if (
this._subject instanceof Game_Actor &&
this._subject === currentActor &&
this._subject.canInput() &&
this._subject.gauge().purpose === ATBGauge.PURPOSE_TIME &&
!this._subject.gauge().isActionEnd()
) {
this._atbManager.addNextSubject(this._subject);
nextActor = this._atbManager.changeNextActor(currentActor, reverse);
this._subject = this._atbManager.getNextSubject();
if (!nextActor) return;
currentActor.gauge().commandSelectCancel();
this.setActor(nextActor);
} else {
nextActor = this._atbManager.changeNextActor(currentActor, reverse);
if (!nextActor) return;
@ -1114,7 +1105,7 @@ const ATBAlias = {};
};
// アクターコマンドの選択が完了してからターンを開始するようにする
BattleManager.startTurnReserve = function() {
BattleManager.startTurnReserve = function () {
if (this._subject && !this._subject.gauge().isActionEnd()) {
this._turnStartReserve = true;
SceneManager._scene.changeInputWindow();
@ -1124,7 +1115,7 @@ const ATBAlias = {};
}
};
BattleManager.startTurnAwait = function() {
BattleManager.startTurnAwait = function () {
if (this._phase === "battleEnd") return;
if (this._subject && this._subject.gauge().isActionEnd) {
if (this._turnStartReserve) {
@ -1134,47 +1125,45 @@ const ATBAlias = {};
}
};
BattleManager.updateGauge = function() {
BattleManager.updateGauge = function () {
this._atbManager.updateGauge();
};
BattleManager.startPause = function() {
BattleManager.startPause = function () {
this._atbManager.toWait("pause");
};
BattleManager.endPause = function() {
BattleManager.endPause = function () {
this._atbManager.toActive("pause");
};
BattleManager.toActiveSelectSkillOrItem = function() {
BattleManager.toActiveSelectSkillOrItem = function () {
this._atbManager.toActive("selectSkillOrItem");
};
BattleManager.toWaitSelectSkillOrItem = function() {
BattleManager.toWaitSelectSkillOrItem = function () {
this._atbManager.toWait("selectSkillOrItem");
};
BattleManager.addStateApply = function(battler, stateId) {
BattleManager.addStateApply = function (battler, stateId) {
this._atbManager.addStateApply(battler, stateId);
};
BattleManager.eraseStateApply = function(battler, stateId) {
BattleManager.eraseStateApply = function (battler, stateId) {
this._atbManager.eraseStateApply(battler, stateId);
};
/* class Scene_Battle */
ATBAlias._Scene_Battle_update = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function() {
Scene_Battle.prototype.update = function () {
ATBAlias._Scene_Battle_update.call(this);
this.updateActorCommandWindow();
};
Scene_Battle.prototype.updateBattleProcess = function() {
Scene_Battle.prototype.updateBattleProcess = function () {
// CTBの場合は、BattleManager.updateTurn内でゲージを更新する
if (!ATBConfig.waitCommandSelection) {
if (ATBConfig.enableYEP_BattleEngineCore) {
switch (BattleManager._phase) {
case "input":
case "turn":
@ -1184,20 +1173,16 @@ const ATBAlias = {};
case "actionTargetList":
BattleManager.updateGauge();
}
} else {
switch (BattleManager._phase) {
case "input":
case "turn":
case "action":
BattleManager.updateGauge();
}
}
}
if (!this.isAnyInputWindowActive() || BattleManager.isAborting() ||
BattleManager.isBattleEnd()) {
if (!this.isAnyInputWindowActive() || BattleManager.isAborting() || BattleManager.isBattleEnd()) {
BattleManager.update();
if (!BattleManager.actor() || !BattleManager.actor().gauge().isCommandSelected()) {
this.changeInputWindow();
@ -1205,7 +1190,7 @@ const ATBAlias = {};
}
};
Scene_Battle.prototype.updateActorCommandWindow = function() {
Scene_Battle.prototype.updateActorCommandWindow = function () {
if (BattleManager.actor() && !BattleManager.actor().gauge().isCommandSelecting()) {
this._actorCommandWindow.close();
this._skillWindow.hide();
@ -1216,20 +1201,20 @@ const ATBAlias = {};
};
// ターンを再開する
Scene_Battle.prototype.commandFight = function() {
Scene_Battle.prototype.commandFight = function () {
BattleManager.endPause();
BattleManager.actor().gauge().setCommandSelecting(false);
this.changeInputWindow();
};
// キャンセルでパーティウィンドウに戻す
Scene_Battle.prototype.selectPreviousCommand = function() {
Scene_Battle.prototype.selectPreviousCommand = function () {
this.startPartyCommandSelection();
};
// パーティコマンド選択時はポーズする
ATBAlias._Scene_Battle_startPartyCommandSelection = Scene_Battle.prototype.startPartyCommandSelection;
Scene_Battle.prototype.startPartyCommandSelection = function() {
Scene_Battle.prototype.startPartyCommandSelection = function () {
BattleManager.startPause();
if (ATBConfig.enableYEP_BattleEngineCore) {
Yanfly.BEC.Scene_Battle_startPartyCommandSelection.call(this);
@ -1239,26 +1224,22 @@ const ATBAlias = {};
};
ATBAlias._Scene_Battle_startActorCommandSelection = Scene_Battle.prototype.startActorCommandSelection;
Scene_Battle.prototype.startActorCommandSelection = function() {
Scene_Battle.prototype.startActorCommandSelection = function () {
if (ATBConfig.enableYEP_BattleEngineCore) {
if (!BattleManager.actor().gauge().isCommandSelecting()) {
Yanfly.BEC.Scene_Battle_startActorCommandSelection.call(this);
this._statusWindow.refresh();
BattleManager.actor().gauge().setCommandSelecting(true);
}
} else {
if (!BattleManager.actor().gauge().isCommandSelecting()) {
ATBAlias._Scene_Battle_startActorCommandSelection.call(this);
BattleManager.actor().gauge().setCommandSelecting(true);
}
}
};
Scene_Battle.prototype.changeInputWindow = function() {
Scene_Battle.prototype.changeInputWindow = function () {
if (BattleManager.isInputting()) {
if (BattleManager.actor()) {
this.startActorCommandSelection();
@ -1275,7 +1256,7 @@ const ATBAlias = {};
// ATB時は、ステータスウィンドウを移動しないようにする
ATBAlias._Scene_Battle_updateWindowPositions = Scene_Battle.prototype.updateWindowPositions;
Scene_Battle.prototype.updateWindowPositions = function() {
Scene_Battle.prototype.updateWindowPositions = function () {
statusX = this._partyCommandWindow.width;
if (this._statusWindow.x < statusX) {
this._statusWindow.x += 16;
@ -1293,15 +1274,15 @@ const ATBAlias = {};
// ATB時は、パーティコマンドが開いているとき以外は時間を進める
ATBAlias._Scene_Battle_isAnyInputWindowActive = Scene_Battle.prototype.isAnyInputWindowActive;
Scene_Battle.prototype.isAnyInputWindowActive = function() {
Scene_Battle.prototype.isAnyInputWindowActive = function () {
if (ATBConfig.waitCommandSelection) {
return ATBAlias._Scene_Battle_isAnyInputWindowActive.call(this);
}
return this._partyCommandWindow.active;
};
ATBAlias._Scene_Battle_commandSkill = Scene_Battle.prototype.commandSkill;
Scene_Battle.prototype.commandSkill = function() {
ATBAlias._Scene_Battle_commandSkill = Scene_Battle.prototype.commandSkill;
Scene_Battle.prototype.commandSkill = function () {
if (!ATBConfig.waitCommandSelection && ATBConfig.waitSelectSkillOrItem) {
BattleManager.toWaitSelectSkillOrItem();
}
@ -1309,7 +1290,7 @@ const ATBAlias = {};
};
ATBAlias._Scene_Battle_commandItem = Scene_Battle.prototype.commandItem;
Scene_Battle.prototype.commandItem = function() {
Scene_Battle.prototype.commandItem = function () {
if (!ATBConfig.waitCommandSelection && ATBConfig.waitSelectSkillOrItem) {
BattleManager.toWaitSelectSkillOrItem();
}
@ -1317,7 +1298,7 @@ const ATBAlias = {};
};
ATBAlias._Scene_Battle_onSkillCancel = Scene_Battle.prototype.onSkillCancel;
Scene_Battle.prototype.onSkillCancel = function() {
Scene_Battle.prototype.onSkillCancel = function () {
if (!ATBConfig.waitCommandSelection && ATBConfig.waitSelectSkillOrItem) {
BattleManager.toActiveSelectSkillOrItem();
}
@ -1325,17 +1306,16 @@ const ATBAlias = {};
};
ATBAlias._Scene_Battle_onItemCancel = Scene_Battle.prototype.onItemCancel;
Scene_Battle.prototype.onItemCancel = function() {
Scene_Battle.prototype.onItemCancel = function () {
if (!ATBConfig.waitCommandSelection && ATBConfig.waitSelectSkillOrItem) {
BattleManager.toActiveSelectSkillOrItem();
}
ATBAlias._Scene_Battle_onItemCancel.call(this);
};
/* class Window_BattleStatus */
ATBAlias._Window_BattleStatus_drawGaugeAreaWithTp = Window_BattleStatus.prototype.drawGaugeAreaWithTp;
Window_BattleStatus.prototype.drawGaugeAreaWithTp = function(rect, actor) {
Window_BattleStatus.prototype.drawGaugeAreaWithTp = function (rect, actor) {
if (ATBConfig.drawUnderGauge) {
ATBAlias._Window_BattleStatus_drawGaugeAreaWithTp.call(this, rect, actor);
} else {
@ -1347,7 +1327,7 @@ const ATBAlias = {};
};
ATBAlias._Window_BattleStatus_drawGaugeAreaWithoutTp = Window_BattleStatus.prototype.drawGaugeAreaWithoutTp;
Window_BattleStatus.prototype.drawGaugeAreaWithoutTp = function(rect, actor) {
Window_BattleStatus.prototype.drawGaugeAreaWithoutTp = function (rect, actor) {
if (ATBConfig.drawUnderGauge) {
ATBAlias._Window_BattleStatus_drawGaugeAreaWithoutTp.call(this, rect, actor);
} else {
@ -1356,7 +1336,7 @@ const ATBAlias = {};
}
};
Window_BattleStatus.prototype.drawActorCt = function(actor, x, y, width) {
Window_BattleStatus.prototype.drawActorCt = function (actor, x, y, width) {
width = width || 96;
const gauge = actor.gauge();
let color1, color2;
@ -1375,10 +1355,13 @@ const ATBAlias = {};
this.changeTextColor(this.normalColor());
};
class Sprite_GaugeLine extends Sprite {
get GAUGE_WIDTH() { return 50 };
get GAUGE_HEIGHT() { return 5 };
get GAUGE_WIDTH() {
return 50;
}
get GAUGE_HEIGHT() {
return 5;
}
initialize(battler) {
const bitmap = new Bitmap(this.GAUGE_WIDTH, this.GAUGE_HEIGHT);
@ -1420,13 +1403,11 @@ const ATBAlias = {};
}
}
/* class Spriteset_Battle */
Spriteset_Battle.prototype.createGaugeLine = function(battler) {
Spriteset_Battle.prototype.createGaugeLine = function (battler) {
this._baseSprite.addChild(new Sprite_GaugeLine(battler));
};
// クラス名のエイリアス
ATBAlias.ATBTimer = ATBTimer;
ATBAlias.ATBGauge = ATBGauge;
@ -1434,5 +1415,4 @@ const ATBAlias = {};
ATBAlias.EnemyGauge = EnemyGauge;
ATBAlias.ATBManager = ATBManager;
ATBAlias.Sprite_GaugeLine = Sprite_GaugeLine;
};
}

@ -57,7 +57,7 @@ v1.0.0 新規作成
{
const param = PluginManager.parameters("ATBLine");
const viewMode = param["viewMode"];
const useLineImage = (param["useLineImage"] === "true" ? true : false);
const useLineImage = param["useLineImage"] === "true" ? true : false;
const lineImageFileName = param["lineImageFileName"];
const defaultEnemyIconFileName = param["defaultEnemyIconFileName"];
const defaultEnemyIconX = parseInt(param["defaultEnemyIconX"]);
@ -66,36 +66,33 @@ v1.0.0 新規作成
ATBConfig.drawEnemyUnderGauge = true;
ATBConfig.drawUnderGauge = true;
Game_Actor.prototype.battlerIconName = function() {
Game_Actor.prototype.battlerIconName = function () {
return this.characterName();
};
Game_Actor.prototype.characterBlockX = function() {
return this.characterIndex() % 4 * 3;
Game_Actor.prototype.characterBlockX = function () {
return (this.characterIndex() % 4) * 3;
};
Game_Actor.prototype.characterBlockY = function() {
Game_Actor.prototype.characterBlockY = function () {
return Math.floor(this.characterIndex() / 4) * 4;
};
Game_Enemy.prototype.battlerIconName = function() {
Game_Enemy.prototype.battlerIconName = function () {
if (!this.enemy().meta.battlerIcon) return defaultEnemyIconFileName;
return JSON.parse(this.enemy().meta.battlerIcon)[0];
};
Game_Enemy.prototype.characterBlockX = function() {
Game_Enemy.prototype.characterBlockX = function () {
if (!this.enemy().meta.battlerIcon) return defaultEnemyIconX;
return JSON.parse(this.enemy().meta.battlerIcon)[1];
};
Game_Enemy.prototype.characterBlockY = function() {
Game_Enemy.prototype.characterBlockY = function () {
if (!this.enemy().meta.battlerIcon) return defaultEnemyIconY;
return JSON.parse(this.enemy().meta.battlerIcon)[2];
};
class Sprite_ATBLine extends Sprite {
static get LINE_WIDTH() {
if (viewMode === "wide") {
@ -103,7 +100,7 @@ v1.0.0 新規作成
} else {
return 32;
}
};
}
static get LINE_HEIGHT() {
if (viewMode === "wide") {
@ -111,7 +108,7 @@ v1.0.0 新規作成
} else {
return Graphics.height - 240;
}
};
}
initialize() {
const bitmap = this.createBitmap();
@ -142,14 +139,16 @@ v1.0.0 新規作成
}
class Sprite_LineIcon extends Sprite {
static get BATTLER_ICON_WIDTH() { return 48 };
static get BATTLER_ICON_WIDTH() {
return 48;
}
static get BATTLER_ICON_HEIGHT() {
if (viewMode === "wide") {
return Sprite_ATBLine.LINE_HEIGHT;
} else {
return 32;
}
};
}
initialize(gauge, x, y) {
this._gauge = gauge;
@ -170,9 +169,13 @@ v1.0.0 新規作成
updatePosition() {
if (viewMode === "wide") {
this.x = this._baseX + (this._gauge.value / 1000) * (Sprite_ATBLine.LINE_WIDTH - Sprite_LineIcon.BATTLER_ICON_WIDTH);
this.x =
this._baseX +
(this._gauge.value / 1000) * (Sprite_ATBLine.LINE_WIDTH - Sprite_LineIcon.BATTLER_ICON_WIDTH);
} else {
this.y = this._baseY - (this._gauge.value / 1000) * (Sprite_ATBLine.LINE_HEIGHT - Sprite_LineIcon.BATTLER_ICON_HEIGHT / 2);
this.y =
this._baseY -
(this._gauge.value / 1000) * (Sprite_ATBLine.LINE_HEIGHT - Sprite_LineIcon.BATTLER_ICON_HEIGHT / 2);
}
}
@ -189,17 +192,19 @@ v1.0.0 新規作成
/* class Spriteset_Battle */
const _Spriteset_Battle_initialize = Spriteset_Battle.prototype.initialize;
Spriteset_Battle.prototype.initialize = function() {
Spriteset_Battle.prototype.initialize = function () {
_Spriteset_Battle_initialize.call(this);
this._atbLine = new Sprite_ATBLine();
this._baseSprite.addChild(this._atbLine);
}
};
Spriteset_Battle.prototype.createGaugeLine = function(battler) {
Spriteset_Battle.prototype.createGaugeLine = function (battler) {
if (viewMode === "wide") {
this._baseSprite.addChild(new Sprite_LineIcon(battler.gauge(), this._atbLine.x, this._atbLine.y - 8));
} else {
this._baseSprite.addChild(new Sprite_LineIcon(battler.gauge(), this._atbLine.x - 12, Sprite_ATBLine.LINE_HEIGHT));
this._baseSprite.addChild(
new Sprite_LineIcon(battler.gauge(), this._atbLine.x - 12, Sprite_ATBLine.LINE_HEIGHT)
);
}
};
};
}

@ -3,19 +3,19 @@
//=============================================================================
/*:
* @plugindesc Actor Equip Slots
* @author Morpho(dongdongDJH)
*
* @help
* 在角色备注栏添加相应备注可自定义装备栏装备类型序号参考系统设置
* 用途自由定义装备栏
* 格式<equipSlots:装备类型序号,装备类型序号,装备类型序号,装备类型序号,装备类型序号>
* <equipSlots:1,1,1,2,3>
* 备注不要填入不存在的装备类型序号
* windows.js 2295行Window_EquipStatus.prototype.numVisibleRows
*/
(function() {
Game_Actor.prototype.equipSlots = function() {
* @plugindesc Actor Equip Slots
* @author Morpho(dongdongDJH)
*
* @help
* 在角色备注栏添加相应备注可自定义装备栏装备类型序号参考系统设置
* 用途自由定义装备栏
* 格式<equipSlots:装备类型序号,装备类型序号,装备类型序号,装备类型序号,装备类型序号>
* <equipSlots:1,1,1,2,3>
* 备注不要填入不存在的装备类型序号
* windows.js 2295行Window_EquipStatus.prototype.numVisibleRows
*/
(function () {
Game_Actor.prototype.equipSlots = function () {
var slots = [];
for (var i = 1; i < $dataSystem.equipTypes.length; i++) {
slots.push(i);
@ -24,14 +24,13 @@
slots[1] = 1;
}
if (this.actor().meta.equipSlots) {
var n = 0
var n = 0;
do {
slots[n] = Number(this.actor().meta.equipSlots.split(",")[n]);
n += 1;
} while (this.actor().meta.equipSlots.split(",")[n] != null);
slots.length = n;
};
}
return slots;
};
}());
})();

@ -16,47 +16,46 @@
* @help このプラグインにはプラグインコマンドはありません
*/
(function() {
(function () {
var _Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
Scene_Menu.prototype.create = function () {
_Scene_Menu_create.call(this);
this._statusWindow.x = 0;
this._statusWindow.y = this._commandWindow.height;
this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width;
};
Window_MenuCommand.prototype.windowWidth = function() {
Window_MenuCommand.prototype.windowWidth = function () {
return Graphics.boxWidth;
};
Window_MenuCommand.prototype.maxCols = function() {
Window_MenuCommand.prototype.maxCols = function () {
return 4;
};
Window_MenuCommand.prototype.numVisibleRows = function() {
Window_MenuCommand.prototype.numVisibleRows = function () {
return 2;
};
Window_MenuStatus.prototype.windowWidth = function() {
Window_MenuStatus.prototype.windowWidth = function () {
return Graphics.boxWidth;
};
Window_MenuStatus.prototype.windowHeight = function() {
Window_MenuStatus.prototype.windowHeight = function () {
var h1 = this.fittingHeight(1);
var h2 = this.fittingHeight(2);
return Graphics.boxHeight - h1 - h2;
};
Window_MenuStatus.prototype.maxCols = function() {
Window_MenuStatus.prototype.maxCols = function () {
return 4;
};
Window_MenuStatus.prototype.numVisibleRows = function() {
Window_MenuStatus.prototype.numVisibleRows = function () {
return 1;
};
Window_MenuStatus.prototype.drawItemImage = function(index) {
Window_MenuStatus.prototype.drawItemImage = function (index) {
var actor = $gameParty.members()[index];
var rect = this.itemRectForText(index);
var w = Math.min(rect.width, 144);
@ -67,7 +66,7 @@
this.changePaintOpacity(true);
};
Window_MenuStatus.prototype.drawItemStatus = function(index) {
Window_MenuStatus.prototype.drawItemStatus = function (index) {
var actor = $gameParty.members()[index];
var rect = this.itemRectForText(index);
var x = rect.x;
@ -84,9 +83,8 @@
};
var _Window_MenuActor_initialize = Window_MenuActor.prototype.initialize;
Window_MenuActor.prototype.initialize = function() {
Window_MenuActor.prototype.initialize = function () {
_Window_MenuActor_initialize.call(this);
this.y = this.fittingHeight(2);
};
})();

@ -16,10 +16,9 @@
* @help このプラグインにはプラグインコマンドはありません
*/
(function() {
(function () {
var _Scene_File_create = Scene_File.prototype.create;
Scene_File.prototype.create = function() {
Scene_File.prototype.create = function () {
_Scene_File_create.call(this);
this._listWindow.height = this._listWindow.fittingHeight(8);
var x = 0;
@ -34,35 +33,34 @@
};
var _Scene_File_start = Scene_File.prototype.start;
Scene_File.prototype.start = function() {
Scene_File.prototype.start = function () {
_Scene_File_start.call(this);
this._listWindow.ensureCursorVisible();
this._listWindow.callUpdateHelp();
};
Window_SavefileList.prototype.windowWidth = function() {
Window_SavefileList.prototype.windowWidth = function () {
return Graphics.boxWidth;
};
Window_SavefileList.prototype.maxCols = function() {
Window_SavefileList.prototype.maxCols = function () {
return 4;
};
Window_SavefileList.prototype.numVisibleRows = function() {
Window_SavefileList.prototype.numVisibleRows = function () {
return 5;
};
Window_SavefileList.prototype.spacing = function() {
Window_SavefileList.prototype.spacing = function () {
return 8;
};
Window_SavefileList.prototype.itemHeight = function() {
Window_SavefileList.prototype.itemHeight = function () {
return this.lineHeight() * 2;
};
var _Window_SavefileList_callUpdateHelp =
Window_SavefileList.prototype.callUpdateHelp;
Window_SavefileList.prototype.callUpdateHelp = function() {
var _Window_SavefileList_callUpdateHelp = Window_SavefileList.prototype.callUpdateHelp;
Window_SavefileList.prototype.callUpdateHelp = function () {
_Window_SavefileList_callUpdateHelp.call(this);
if (this.active && this.statusWindow) {
this.statusWindow.setId(this.index() + 1);
@ -76,28 +74,28 @@
Window_SavefileStatus.prototype = Object.create(Window_Base.prototype);
Window_SavefileStatus.prototype.constructor = Window_SavefileStatus;
Window_SavefileStatus.prototype.initialize = function(x, y, width, height) {
Window_SavefileStatus.prototype.initialize = function (x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._id = 1;
};
Window_SavefileStatus.prototype.setMode = function(mode) {
Window_SavefileStatus.prototype.setMode = function (mode) {
this._mode = mode;
};
Window_SavefileStatus.prototype.setId = function(id) {
Window_SavefileStatus.prototype.setId = function (id) {
this._id = id;
this.refresh();
};
Window_SavefileStatus.prototype.refresh = function() {
Window_SavefileStatus.prototype.refresh = function () {
this.contents.clear();
var id = this._id;
var valid = DataManager.isThisGameFile(id);
var info = DataManager.loadSavefileInfo(id);
var rect = this.contents.rect;
this.resetTextColor();
if (this._mode === 'load') {
if (this._mode === "load") {
this.changePaintOpacity(valid);
}
this.drawFileId(id, rect.x, rect.y);
@ -108,21 +106,21 @@
}
};
Window_SavefileStatus.prototype.drawFileId = function(id, x, y) {
this.drawText(TextManager.file + ' ' + id, x, y, 180);
Window_SavefileStatus.prototype.drawFileId = function (id, x, y) {
this.drawText(TextManager.file + " " + id, x, y, 180);
};
Window_SavefileStatus.prototype.drawContents = function(info, rect, valid) {
Window_SavefileStatus.prototype.drawContents = function (info, rect, valid) {
var bottom = rect.y + rect.height;
var playtimeY = bottom - this.lineHeight();
this.drawText(info.title, rect.x + 192, rect.y, rect.width - 192);
if (valid) {
this.drawPartyfaces(info, rect.x, bottom - 144);
}
this.drawText(info.playtime, rect.x, playtimeY, rect.width, 'right');
this.drawText(info.playtime, rect.x, playtimeY, rect.width, "right");
};
Window_SavefileStatus.prototype.drawPartyfaces = function(info, x, y) {
Window_SavefileStatus.prototype.drawPartyfaces = function (info, x, y) {
if (info && info.faces) {
for (var i = 0; i < info.faces.length; i++) {
var data = info.faces[i];
@ -130,5 +128,4 @@
}
}
};
})();

@ -4,12 +4,12 @@
*
* @help This plugin does not provide plugin commands.
*
* @param cacheLimit
* @param cacheLimit
* @desc For setting the upper limit of image memory cache. (MPix)
* @default 10
*
* @param screenWidth
* @desc For setting the screen width.
* @desc For setting the screen width.
* @default 816
*
* @param screenHeight
@ -64,67 +64,65 @@
* @default off
*/
(function() {
(function () {
function toNumber(str, def) {
return isNaN(str) ? def : +(str || def);
}
var parameters = PluginManager.parameters('Community_Basic');
var cacheLimit = toNumber(parameters['cacheLimit'], 10);
var screenWidth = toNumber(parameters['screenWidth'], 816);
var screenHeight = toNumber(parameters['screenHeight'], 624);
var renderingMode = parameters['renderingMode'].toLowerCase();
var alwaysDash = parameters['alwaysDash'].toLowerCase() === 'on';
var windowWidthTo = toNumber(parameters['changeWindowWidthTo'], 0);
var windowHeightTo = toNumber(parameters['changeWindowHeightTo'], 0);
var parameters = PluginManager.parameters("Community_Basic");
var cacheLimit = toNumber(parameters["cacheLimit"], 10);
var screenWidth = toNumber(parameters["screenWidth"], 816);
var screenHeight = toNumber(parameters["screenHeight"], 624);
var renderingMode = parameters["renderingMode"].toLowerCase();
var alwaysDash = parameters["alwaysDash"].toLowerCase() === "on";
var windowWidthTo = toNumber(parameters["changeWindowWidthTo"], 0);
var windowHeightTo = toNumber(parameters["changeWindowHeightTo"], 0);
var windowWidth;
var windowHeight;
if(windowWidthTo){
if (windowWidthTo) {
windowWidth = windowWidthTo;
}else if(screenWidth !== SceneManager._screenWidth){
} else if (screenWidth !== SceneManager._screenWidth) {
windowWidth = screenWidth;
}
if(windowHeightTo){
if (windowHeightTo) {
windowHeight = windowHeightTo;
}else if(screenHeight !== SceneManager._screenHeight){
} else if (screenHeight !== SceneManager._screenHeight) {
windowHeight = screenHeight;
}
ImageCache.limit = cacheLimit * 1000 * 1000;
SceneManager._screenWidth = screenWidth;
SceneManager._screenHeight = screenHeight;
SceneManager._boxWidth = screenWidth;
SceneManager._boxHeight = screenHeight;
SceneManager.preferableRendererType = function() {
if (Utils.isOptionValid('canvas')) {
return 'canvas';
} else if (Utils.isOptionValid('webgl')) {
return 'webgl';
} else if (renderingMode === 'canvas') {
return 'canvas';
} else if (renderingMode === 'webgl') {
return 'webgl';
SceneManager.preferableRendererType = function () {
if (Utils.isOptionValid("canvas")) {
return "canvas";
} else if (Utils.isOptionValid("webgl")) {
return "webgl";
} else if (renderingMode === "canvas") {
return "canvas";
} else if (renderingMode === "webgl") {
return "webgl";
} else {
return 'auto';
return "auto";
}
};
var _ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function(config) {
ConfigManager.applyData = function (config) {
_ConfigManager_applyData.apply(this, arguments);
if (config['alwaysDash'] === undefined) {
if (config["alwaysDash"] === undefined) {
this.alwaysDash = alwaysDash;
}
};
var _SceneManager_initNwjs = SceneManager.initNwjs;
SceneManager.initNwjs = function() {
SceneManager.initNwjs = function () {
_SceneManager_initNwjs.apply(this, arguments);
if (Utils.isNwjs() && windowWidth && windowHeight) {
@ -134,4 +132,4 @@
window.resizeBy(dw, dh);
}
};
})();
})();

@ -48,61 +48,59 @@
* <book:no> # 図鑑に載せない場合
*/
(function() {
(function () {
var parameters = PluginManager.parameters("EnemyBook");
var unknownData = String(parameters["Unknown Data"] || "??????");
var parameters = PluginManager.parameters('EnemyBook');
var unknownData = String(parameters['Unknown Data'] || '??????');
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'EnemyBook') {
if (command === "EnemyBook") {
switch (args[0]) {
case 'open':
SceneManager.push(Scene_EnemyBook);
break;
case 'add':
$gameSystem.addToEnemyBook(Number(args[1]));
break;
case 'remove':
$gameSystem.removeFromEnemyBook(Number(args[1]));
break;
case 'complete':
$gameSystem.completeEnemyBook();
break;
case 'clear':
$gameSystem.clearEnemyBook();
break;
case "open":
SceneManager.push(Scene_EnemyBook);
break;
case "add":
$gameSystem.addToEnemyBook(Number(args[1]));
break;
case "remove":
$gameSystem.removeFromEnemyBook(Number(args[1]));
break;
case "complete":
$gameSystem.completeEnemyBook();
break;
case "clear":
$gameSystem.clearEnemyBook();
break;
}
}
};
Game_System.prototype.addToEnemyBook = function(enemyId) {
Game_System.prototype.addToEnemyBook = function (enemyId) {
if (!this._enemyBookFlags) {
this.clearEnemyBook();
}
this._enemyBookFlags[enemyId] = true;
};
Game_System.prototype.removeFromEnemyBook = function(enemyId) {
Game_System.prototype.removeFromEnemyBook = function (enemyId) {
if (this._enemyBookFlags) {
this._enemyBookFlags[enemyId] = false;
}
};
Game_System.prototype.completeEnemyBook = function() {
Game_System.prototype.completeEnemyBook = function () {
this.clearEnemyBook();
for (var i = 1; i < $dataEnemies.length; i++) {
this._enemyBookFlags[i] = true;
}
};
Game_System.prototype.clearEnemyBook = function() {
Game_System.prototype.clearEnemyBook = function () {
this._enemyBookFlags = [];
};
Game_System.prototype.isInEnemyBook = function(enemy) {
Game_System.prototype.isInEnemyBook = function (enemy) {
if (this._enemyBookFlags && enemy) {
return !!this._enemyBookFlags[enemy.id];
} else {
@ -111,9 +109,9 @@
};
var _Game_Troop_setup = Game_Troop.prototype.setup;
Game_Troop.prototype.setup = function(troopId) {
Game_Troop.prototype.setup = function (troopId) {
_Game_Troop_setup.call(this, troopId);
this.members().forEach(function(enemy) {
this.members().forEach(function (enemy) {
if (enemy.isAppeared()) {
$gameSystem.addToEnemyBook(enemy.enemyId());
}
@ -121,13 +119,13 @@
};
var _Game_Enemy_appear = Game_Enemy.prototype.appear;
Game_Enemy.prototype.appear = function() {
Game_Enemy.prototype.appear = function () {
_Game_Enemy_appear.call(this);
$gameSystem.addToEnemyBook(this._enemyId);
};
var _Game_Enemy_transform = Game_Enemy.prototype.transform;
Game_Enemy.prototype.transform = function(enemyId) {
Game_Enemy.prototype.transform = function (enemyId) {
_Game_Enemy_transform.call(this, enemyId);
$gameSystem.addToEnemyBook(enemyId);
};
@ -139,14 +137,14 @@
Scene_EnemyBook.prototype = Object.create(Scene_MenuBase.prototype);
Scene_EnemyBook.prototype.constructor = Scene_EnemyBook;
Scene_EnemyBook.prototype.initialize = function() {
Scene_EnemyBook.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_EnemyBook.prototype.create = function() {
Scene_EnemyBook.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
this._indexWindow = new Window_EnemyBookIndex(0, 0);
this._indexWindow.setHandler('cancel', this.popScene.bind(this));
this._indexWindow.setHandler("cancel", this.popScene.bind(this));
var wy = this._indexWindow.height;
var ww = Graphics.boxWidth;
var wh = Graphics.boxHeight - wy;
@ -164,9 +162,9 @@
Window_EnemyBookIndex.prototype.constructor = Window_EnemyBookIndex;
Window_EnemyBookIndex.lastTopRow = 0;
Window_EnemyBookIndex.lastIndex = 0;
Window_EnemyBookIndex.lastIndex = 0;
Window_EnemyBookIndex.prototype.initialize = function(x, y) {
Window_EnemyBookIndex.prototype.initialize = function (x, y) {
var width = Graphics.boxWidth;
var height = this.fittingHeight(6);
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
@ -176,36 +174,36 @@
this.activate();
};
Window_EnemyBookIndex.prototype.maxCols = function() {
Window_EnemyBookIndex.prototype.maxCols = function () {
return 3;
};
Window_EnemyBookIndex.prototype.maxItems = function() {
Window_EnemyBookIndex.prototype.maxItems = function () {
return this._list ? this._list.length : 0;
};
Window_EnemyBookIndex.prototype.setStatusWindow = function(statusWindow) {
Window_EnemyBookIndex.prototype.setStatusWindow = function (statusWindow) {
this._statusWindow = statusWindow;
this.updateStatus();
};
Window_EnemyBookIndex.prototype.update = function() {
Window_EnemyBookIndex.prototype.update = function () {
Window_Selectable.prototype.update.call(this);
this.updateStatus();
};
Window_EnemyBookIndex.prototype.updateStatus = function() {
Window_EnemyBookIndex.prototype.updateStatus = function () {
if (this._statusWindow) {
var enemy = this._list[this.index()];
this._statusWindow.setEnemy(enemy);
}
};
Window_EnemyBookIndex.prototype.refresh = function() {
Window_EnemyBookIndex.prototype.refresh = function () {
this._list = [];
for (var i = 1; i < $dataEnemies.length; i++) {
var enemy = $dataEnemies[i];
if (enemy.name && enemy.meta.book !== 'no') {
if (enemy.name && enemy.meta.book !== "no") {
this._list.push(enemy);
}
}
@ -213,7 +211,7 @@
this.drawAllItems();
};
Window_EnemyBookIndex.prototype.drawItem = function(index) {
Window_EnemyBookIndex.prototype.drawItem = function (index) {
var enemy = this._list[index];
var rect = this.itemRectForText(index);
var name;
@ -225,7 +223,7 @@
this.drawText(name, rect.x, rect.y, rect.width);
};
Window_EnemyBookIndex.prototype.processCancel = function() {
Window_EnemyBookIndex.prototype.processCancel = function () {
Window_Selectable.prototype.processCancel.call(this);
Window_EnemyBookIndex.lastTopRow = this.topRow();
Window_EnemyBookIndex.lastIndex = this.index();
@ -238,7 +236,7 @@
Window_EnemyBookStatus.prototype = Object.create(Window_Base.prototype);
Window_EnemyBookStatus.prototype.constructor = Window_EnemyBookStatus;
Window_EnemyBookStatus.prototype.initialize = function(x, y, width, height) {
Window_EnemyBookStatus.prototype.initialize = function (x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._enemy = null;
this._enemySprite = new Sprite();
@ -250,14 +248,14 @@
this.refresh();
};
Window_EnemyBookStatus.prototype.setEnemy = function(enemy) {
Window_EnemyBookStatus.prototype.setEnemy = function (enemy) {
if (this._enemy !== enemy) {
this._enemy = enemy;
this.refresh();
}
};
Window_EnemyBookStatus.prototype.update = function() {
Window_EnemyBookStatus.prototype.update = function () {
Window_Base.prototype.update.call(this);
if (this._enemySprite.bitmap) {
var bitmapHeight = this._enemySprite.bitmap.height;
@ -271,7 +269,7 @@
}
};
Window_EnemyBookStatus.prototype.refresh = function() {
Window_EnemyBookStatus.prototype.refresh = function () {
var enemy = this._enemy;
var x = 0;
var y = 0;
@ -304,7 +302,7 @@
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(i), x, y, 160);
this.resetTextColor();
this.drawText(enemy.params[i], x + 160, y, 60, 'right');
this.drawText(enemy.params[i], x + 160, y, 60, "right");
y += lineHeight;
}
@ -317,7 +315,7 @@
x += this.textWidth(enemy.exp) + 6;
this.changeTextColor(this.systemColor());
this.drawText(TextManager.expA, x, y);
x += this.textWidth(TextManager.expA + ' ');
x += this.textWidth(TextManager.expA + " ");
this.resetTextColor();
this.drawText(enemy.gold, x, y);
@ -343,5 +341,4 @@
this.drawTextEx(enemy.meta.desc1, x, y + lineHeight * 0, descWidth);
this.drawTextEx(enemy.meta.desc2, x, y + lineHeight * 1, descWidth);
};
})();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -72,40 +72,38 @@
* <book:no> # 図鑑に載せない場合
*/
(function() {
var parameters = PluginManager.parameters('ItemBook');
var unknownData = String(parameters['Unknown Data'] || '??????');
var priceText = String(parameters['Price Text'] || 'Price');
var equipText = String(parameters['Equip Text'] || 'Equip');
var typeText = String(parameters['Type Text'] || 'Type');
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
(function () {
var parameters = PluginManager.parameters("ItemBook");
var unknownData = String(parameters["Unknown Data"] || "??????");
var priceText = String(parameters["Price Text"] || "Price");
var equipText = String(parameters["Equip Text"] || "Equip");
var typeText = String(parameters["Type Text"] || "Type");
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'ItemBook') {
if (command === "ItemBook") {
switch (args[0]) {
case 'open':
SceneManager.push(Scene_ItemBook);
break;
case 'add':
$gameSystem.addToItemBook(args[1], Number(args[2]));
break;
case 'remove':
$gameSystem.removeFromItemBook(args[1], Number(args[2]));
break;
case 'complete':
$gameSystem.completeItemBook();
break;
case 'clear':
$gameSystem.clearItemBook();
break;
case "open":
SceneManager.push(Scene_ItemBook);
break;
case "add":
$gameSystem.addToItemBook(args[1], Number(args[2]));
break;
case "remove":
$gameSystem.removeFromItemBook(args[1], Number(args[2]));
break;
case "complete":
$gameSystem.completeItemBook();
break;
case "clear":
$gameSystem.clearItemBook();
break;
}
}
};
Game_System.prototype.addToItemBook = function(type, dataId) {
Game_System.prototype.addToItemBook = function (type, dataId) {
if (!this._ItemBookFlags) {
this.clearItemBook();
}
@ -115,7 +113,7 @@
}
};
Game_System.prototype.removeFromItemBook = function(type, dataId) {
Game_System.prototype.removeFromItemBook = function (type, dataId) {
if (this._ItemBookFlags) {
var typeIndex = this.itemBookTypeToIndex(type);
if (typeIndex >= 0) {
@ -124,20 +122,20 @@
}
};
Game_System.prototype.itemBookTypeToIndex = function(type) {
Game_System.prototype.itemBookTypeToIndex = function (type) {
switch (type) {
case 'item':
return 0;
case 'weapon':
return 1;
case 'armor':
return 2;
default:
return -1;
case "item":
return 0;
case "weapon":
return 1;
case "armor":
return 2;
default:
return -1;
}
};
Game_System.prototype.completeItemBook = function() {
Game_System.prototype.completeItemBook = function () {
var i;
this.clearItemBook();
for (i = 1; i < $dataItems.length; i++) {
@ -151,11 +149,11 @@
}
};
Game_System.prototype.clearItemBook = function() {
Game_System.prototype.clearItemBook = function () {
this._ItemBookFlags = [[], [], []];
};
Game_System.prototype.isInItemBook = function(item) {
Game_System.prototype.isInItemBook = function (item) {
if (this._ItemBookFlags && item) {
var typeIndex = -1;
if (DataManager.isItem(item)) {
@ -176,16 +174,16 @@
};
var _Game_Party_gainItem = Game_Party.prototype.gainItem;
Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
Game_Party.prototype.gainItem = function (item, amount, includeEquip) {
_Game_Party_gainItem.call(this, item, amount, includeEquip);
if (item && amount > 0) {
var type;
if (DataManager.isItem(item)) {
type = 'item';
type = "item";
} else if (DataManager.isWeapon(item)) {
type = 'weapon';
type = "weapon";
} else if (DataManager.isArmor(item)) {
type = 'armor';
type = "armor";
}
$gameSystem.addToItemBook(type, item.id);
}
@ -198,14 +196,14 @@
Scene_ItemBook.prototype = Object.create(Scene_MenuBase.prototype);
Scene_ItemBook.prototype.constructor = Scene_ItemBook;
Scene_ItemBook.prototype.initialize = function() {
Scene_ItemBook.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_ItemBook.prototype.create = function() {
Scene_ItemBook.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
this._indexWindow = new Window_ItemBookIndex(0, 0);
this._indexWindow.setHandler('cancel', this.popScene.bind(this));
this._indexWindow.setHandler("cancel", this.popScene.bind(this));
var wy = this._indexWindow.height;
var ww = Graphics.boxWidth;
var wh = Graphics.boxHeight - wy;
@ -223,9 +221,9 @@
Window_ItemBookIndex.prototype.constructor = Window_ItemBookIndex;
Window_ItemBookIndex.lastTopRow = 0;
Window_ItemBookIndex.lastIndex = 0;
Window_ItemBookIndex.lastIndex = 0;
Window_ItemBookIndex.prototype.initialize = function(x, y) {
Window_ItemBookIndex.prototype.initialize = function (x, y) {
var width = Graphics.boxWidth;
var height = this.fittingHeight(6);
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
@ -235,49 +233,49 @@
this.activate();
};
Window_ItemBookIndex.prototype.maxCols = function() {
Window_ItemBookIndex.prototype.maxCols = function () {
return 3;
};
Window_ItemBookIndex.prototype.maxItems = function() {
Window_ItemBookIndex.prototype.maxItems = function () {
return this._list ? this._list.length : 0;
};
Window_ItemBookIndex.prototype.setStatusWindow = function(statusWindow) {
Window_ItemBookIndex.prototype.setStatusWindow = function (statusWindow) {
this._statusWindow = statusWindow;
this.updateStatus();
};
Window_ItemBookIndex.prototype.update = function() {
Window_ItemBookIndex.prototype.update = function () {
Window_Selectable.prototype.update.call(this);
this.updateStatus();
};
Window_ItemBookIndex.prototype.updateStatus = function() {
Window_ItemBookIndex.prototype.updateStatus = function () {
if (this._statusWindow) {
var item = this._list[this.index()];
this._statusWindow.setItem(item);
}
};
Window_ItemBookIndex.prototype.refresh = function() {
Window_ItemBookIndex.prototype.refresh = function () {
var i, item;
this._list = [];
for (i = 1; i < $dataItems.length; i++) {
item = $dataItems[i];
if (item.name && item.itypeId === 1 && item.meta.book !== 'no') {
if (item.name && item.itypeId === 1 && item.meta.book !== "no") {
this._list.push(item);
}
}
for (i = 1; i < $dataWeapons.length; i++) {
item = $dataWeapons[i];
if (item.name && item.meta.book !== 'no') {
if (item.name && item.meta.book !== "no") {
this._list.push(item);
}
}
for (i = 1; i < $dataArmors.length; i++) {
item = $dataArmors[i];
if (item.name && item.meta.book !== 'no') {
if (item.name && item.meta.book !== "no") {
this._list.push(item);
}
}
@ -285,7 +283,7 @@
this.drawAllItems();
};
Window_ItemBookIndex.prototype.drawItem = function(index) {
Window_ItemBookIndex.prototype.drawItem = function (index) {
var item = this._list[index];
var rect = this.itemRect(index);
var width = rect.width - this.textPadding();
@ -297,7 +295,7 @@
}
};
Window_ItemBookIndex.prototype.processCancel = function() {
Window_ItemBookIndex.prototype.processCancel = function () {
Window_Selectable.prototype.processCancel.call(this);
Window_ItemBookIndex.lastTopRow = this.topRow();
Window_ItemBookIndex.lastIndex = this.index();
@ -310,18 +308,18 @@
Window_ItemBookStatus.prototype = Object.create(Window_Base.prototype);
Window_ItemBookStatus.prototype.constructor = Window_ItemBookStatus;
Window_ItemBookStatus.prototype.initialize = function(x, y, width, height) {
Window_ItemBookStatus.prototype.initialize = function (x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
};
Window_ItemBookStatus.prototype.setItem = function(item) {
Window_ItemBookStatus.prototype.setItem = function (item) {
if (this._item !== item) {
this._item = item;
this.refresh();
}
};
Window_ItemBookStatus.prototype.refresh = function() {
Window_ItemBookStatus.prototype.refresh = function () {
var item = this._item;
var x = 0;
var y = 0;
@ -338,11 +336,11 @@
x = this.textPadding();
y = lineHeight + this.textPadding();
var price = item.price > 0 ? item.price : '-';
var price = item.price > 0 ? item.price : "-";
this.changeTextColor(this.systemColor());
this.drawText(priceText, x, y, 120);
this.resetTextColor();
this.drawText(price, x + 120, y, 120, 'right');
this.drawText(price, x + 120, y, 120, "right");
y += lineHeight;
if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {
@ -350,7 +348,7 @@
this.changeTextColor(this.systemColor());
this.drawText(equipText, x, y, 120);
this.resetTextColor();
this.drawText(etype, x + 120, y, 120, 'right');
this.drawText(etype, x + 120, y, 120, "right");
y += lineHeight;
var type;
@ -362,7 +360,7 @@
this.changeTextColor(this.systemColor());
this.drawText(typeText, x, y, 120);
this.resetTextColor();
this.drawText(type, x + 120, y, 120, 'right');
this.drawText(type, x + 120, y, 120, "right");
x = this.textPadding() + 300;
y = lineHeight + this.textPadding();
@ -370,7 +368,7 @@
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(i), x, y, 160);
this.resetTextColor();
this.drawText(item.params[i], x + 160, y, 60, 'right');
this.drawText(item.params[i], x + 160, y, 60, "right");
y += lineHeight;
}
}
@ -379,5 +377,4 @@
y = this.textPadding() * 2 + lineHeight * 7;
this.drawTextEx(item.description, x, y);
};
})();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -28,8 +28,8 @@
*
* @param Custom Image
* @desc The image to use when showing "Made with MV"
* Default:
* @default
* Default:
* @default
* @require 1
* @dir img/system/
* @type file
@ -59,7 +59,7 @@
* @help このプラグインにはプラグインコマンドはありません
*
* @param Show Made With MV
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします
* OFF - false ON - true
* デフォルト: ON
* @default true
@ -73,15 +73,15 @@
* @type file
*
* @param Show Custom Splash
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします
* OFF - false ON - true
* デフォルト: OFF
* @default false
*
* @param Custom Image
* @desc "Made with MV"を表示する際に使用する画像
* デフォルト:
* @default
* デフォルト:
* @default
* @require 1
* @dir img/system/
* @type file
@ -104,7 +104,7 @@
*/
var Liquidize = Liquidize || {};
Liquidize.MadeWithMV = {};
Liquidize.MadeWithMV.Parameters = PluginManager.parameters('MadeWithMv');
Liquidize.MadeWithMV.Parameters = PluginManager.parameters("MadeWithMv");
Liquidize.MadeWithMV.ShowMV = JSON.parse(Liquidize.MadeWithMV.Parameters["Show Made With MV"]);
Liquidize.MadeWithMV.MVImage = String(Liquidize.MadeWithMV.Parameters["Made with MV Image"]);
@ -114,7 +114,6 @@ Liquidize.MadeWithMV.FadeOutTime = Number(Liquidize.MadeWithMV.Parameters["Fade
Liquidize.MadeWithMV.FadeInTime = Number(Liquidize.MadeWithMV.Parameters["Fade In Time"]) || 120;
Liquidize.MadeWithMV.WaitTime = Number(Liquidize.MadeWithMV.Parameters["Wait Time"]) || 160;
//-----------------------------------------------------------------------------
// Scene_Splash
//
@ -124,15 +123,14 @@ function Scene_Splash() {
this.initialize.apply(this, arguments);
}
(function() {
(function () {
//-----------------------------------------------------------------------------
// Scene_Boot
//
// The scene class for dealing with the game boot.
var _Scene_Boot_loadSystemImages = Scene_Boot.prototype.loadSystemImages;
Scene_Boot.prototype.loadSystemImages = function() {
Scene_Boot.prototype.loadSystemImages = function () {
_Scene_Boot_loadSystemImages.call(this);
if (Liquidize.MadeWithMV.ShowMV) {
ImageManager.loadSystem(Liquidize.MadeWithMV.MVImage);
@ -143,8 +141,12 @@ function Scene_Splash() {
};
var _Scene_Boot_start = Scene_Boot.prototype.start;
Scene_Boot.prototype.start = function() {
if ((Liquidize.MadeWithMV.ShowMV || Liquidize.MadeWithMV.ShowCustom) && !DataManager.isBattleTest() && !DataManager.isEventTest()) {
Scene_Boot.prototype.start = function () {
if (
(Liquidize.MadeWithMV.ShowMV || Liquidize.MadeWithMV.ShowCustom) &&
!DataManager.isBattleTest() &&
!DataManager.isEventTest()
) {
SceneManager.goto(Scene_Splash);
} else {
_Scene_Boot_start.call(this);
@ -159,7 +161,7 @@ function Scene_Splash() {
Scene_Splash.prototype = Object.create(Scene_Base.prototype);
Scene_Splash.prototype.constructor = Scene_Splash;
Scene_Splash.prototype.initialize = function() {
Scene_Splash.prototype.initialize = function () {
Scene_Base.prototype.initialize.call(this);
this._mvSplash = null;
this._customSplash = null;
@ -171,12 +173,12 @@ function Scene_Splash() {
this._customFadeIn = false;
};
Scene_Splash.prototype.create = function() {
Scene_Splash.prototype.create = function () {
Scene_Base.prototype.create.call(this);
this.createSplashes();
};
Scene_Splash.prototype.start = function() {
Scene_Splash.prototype.start = function () {
Scene_Base.prototype.start.call(this);
SceneManager.clearStack();
if (this._mvSplash != null) {
@ -187,7 +189,7 @@ function Scene_Splash() {
}
};
Scene_Splash.prototype.update = function() {
Scene_Splash.prototype.update = function () {
if (Liquidize.MadeWithMV.ShowMV) {
if (!this._mvFadeIn) {
this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false);
@ -254,7 +256,7 @@ function Scene_Splash() {
Scene_Base.prototype.update.call(this);
};
Scene_Splash.prototype.createSplashes = function() {
Scene_Splash.prototype.createSplashes = function () {
if (Liquidize.MadeWithMV.ShowMV) {
this._mvSplash = new Sprite(ImageManager.loadSystem(Liquidize.MadeWithMV.MVImage));
this.addChild(this._mvSplash);
@ -266,14 +268,14 @@ function Scene_Splash() {
}
};
Scene_Splash.prototype.centerSprite = function(sprite) {
Scene_Splash.prototype.centerSprite = function (sprite) {
sprite.x = Graphics.width / 2;
sprite.y = Graphics.height / 2;
sprite.anchor.x = 0.5;
sprite.anchor.y = 0.5;
};
Scene_Splash.prototype.gotoTitleOrTest = function() {
Scene_Splash.prototype.gotoTitleOrTest = function () {
Scene_Base.prototype.start.call(this);
SoundManager.preloadImportantSounds();
if (DataManager.isBattleTest()) {
@ -291,14 +293,13 @@ function Scene_Splash() {
this.updateDocumentTitle();
};
Scene_Splash.prototype.updateDocumentTitle = function() {
Scene_Splash.prototype.updateDocumentTitle = function () {
document.title = $dataSystem.gameTitle;
};
Scene_Splash.prototype.checkPlayerLocation = function() {
Scene_Splash.prototype.checkPlayerLocation = function () {
if ($dataSystem.startMapId === 0) {
throw new Error('Player\'s starting position is not set');
throw new Error("Player's starting position is not set");
}
};
})();
})();

@ -1,65 +1,64 @@
/*:
* @plugindesc Namepop Ver 1.03 NPC名称显示
* @author Morpho(dongdongDJH)
*
* @help
*
* @help
* 在地图事件注释栏内填入 NAMEPOP|高度修正值|字体Size|字体颜色;
* 高度修正值单位为1格不填默认为1,字体大小不填默认为18;
* NAMEPOP|1|18|#00FF00 ; NAMEPOP||20 ;
* NAMEPOP|1|18|#00FF00 ; NAMEPOP||20 ;
* :一定要用|分隔高度修正值和字体Size;
* 若要调整描边 请直接在下方代码中调整 ps0.8是颜色的透明度0-1
*/
(function() {
_Sprite_Character_prototype_initialize = Sprite_Character.prototype.initialize;
Sprite_Character.prototype.initialize = function(character) {
_Sprite_Character_prototype_initialize.call(this, character);
this._tempCharacter = character;
if (character instanceof Game_Event) {
if (character.event().note.match("NAMEPOP") != null) {
var notetext = character.event().note.split("|");
this._namepopY = Number(notetext[1]) || 1;
this._fontSize = Number(notetext[2]) || 18;
this._BYcolor = notetext[3] || "#FFFFFF";
this.createNamepopSet();
}
}
};
(function () {
_Sprite_Character_prototype_initialize = Sprite_Character.prototype.initialize;
Sprite_Character.prototype.initialize = function (character) {
_Sprite_Character_prototype_initialize.call(this, character);
this._tempCharacter = character;
if (character instanceof Game_Event) {
if (character.event().note.match("NAMEPOP") != null) {
var notetext = character.event().note.split("|");
this._namepopY = Number(notetext[1]) || 1;
this._fontSize = Number(notetext[2]) || 18;
this._BYcolor = notetext[3] || "#FFFFFF";
this.createNamepopSet();
}
}
};
Sprite_Character.prototype.createNamepopSet = function() {
var h = this._fontSize;
this._namepopSprite = new Sprite();
this._namepopSprite.bitmap = new Bitmap(h * 10, h);
this._namepopSprite.bitmap.fontSize = h;
this._namepopSprite.bitmap.outlineColor = "rgba(0, 0, 0, 0.8)"//描边颜色
this._namepopSprite.bitmap.outlineWidth = 4;//字体描边
this._namepopSprite.bitmap.textColor = this._BYcolor;//字体颜色
this._namepopSprite.bitmap.drawText(this._tempCharacter.event().name, 0, 0, h * 10, h, 'center');
this._namepopSprite.anchor.x = 0.5;
this._namepopSprite.anchor.y = 1;
this._namepopSprite.y = this.y - this._namepopY * 48;
this.addChild(this._namepopSprite);
};
// ---- 新增跟随事件显示 ----
_Sprite_Character_prototype_setCharacterBitmap = Sprite_Character.prototype.setCharacterBitmap;
Sprite_Character.prototype.setCharacterBitmap = function() {
_Sprite_Character_prototype_setCharacterBitmap.call(this);
if (this._tempCharacter instanceof Game_Event) {
this._BYconditions = this._tempCharacter.findProperPageIndex();
if(this._BYconditions >= 0 && this._namepopSprite){
this._namepopSprite.visible = true;
}else if(this._namepopSprite){
this._namepopSprite.visible = false;
}
Sprite_Character.prototype.createNamepopSet = function () {
var h = this._fontSize;
this._namepopSprite = new Sprite();
this._namepopSprite.bitmap = new Bitmap(h * 10, h);
this._namepopSprite.bitmap.fontSize = h;
this._namepopSprite.bitmap.outlineColor = "rgba(0, 0, 0, 0.8)"; //描边颜色
this._namepopSprite.bitmap.outlineWidth = 4; //字体描边
this._namepopSprite.bitmap.textColor = this._BYcolor; //字体颜色
this._namepopSprite.bitmap.drawText(this._tempCharacter.event().name, 0, 0, h * 10, h, "center");
this._namepopSprite.anchor.x = 0.5;
this._namepopSprite.anchor.y = 1;
this._namepopSprite.y = this.y - this._namepopY * 48;
this.addChild(this._namepopSprite);
};
}
};
// ---- 新增跟随事件显示 ----
_Sprite_Character_prototype_setCharacterBitmap = Sprite_Character.prototype.setCharacterBitmap;
Sprite_Character.prototype.setCharacterBitmap = function () {
_Sprite_Character_prototype_setCharacterBitmap.call(this);
if (this._tempCharacter instanceof Game_Event) {
this._BYconditions = this._tempCharacter.findProperPageIndex();
if (this._BYconditions >= 0 && this._namepopSprite) {
this._namepopSprite.visible = true;
} else if (this._namepopSprite) {
this._namepopSprite.visible = false;
}
}
};
// ---- Game_Event ----
// -------------------------------
// _Game_Event_prototype_refresh = Game_Event.prototype.refresh;
// Game_Event.prototype.refresh = function() {
// _Game_Event_prototype_refresh.call(this);
// ---- Game_Event ----
// -------------------------------
// _Game_Event_prototype_refresh = Game_Event.prototype.refresh;
// Game_Event.prototype.refresh = function() {
// _Game_Event_prototype_refresh.call(this);
// };
}());
// };
})();

@ -11,46 +11,46 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc v1.0.0 - Automatically revive dead party members.
* @author Salted Fish
*
* @help
*
* ===========================================================================
* Introduction
* ===========================================================================
*
* This plugin automatically revives dead party members before Game Over.
*
* ===========================================================================
* Map Notetags
* ===========================================================================
*
* You can use the following notetags to specify the position of the revive
*
* <Revive Position:x,y,d>
* - x and y are the coordinates of the revive position.
* - x and y are relative to the map.
* - d is the direction the revive will face.
* - 0 is same as before.
* - 1 is down.
* - 2 is left.
* - 3 is right.
* - 4 is up.
*
* ===========================================================================
* Plugin Commands
* ===========================================================================
*
* You can use the following plugin commands to change the settings.
*
* SF_AutoRevive_Enable
* - Enables the revive system.
*
* SF_AutoRevive_Disable
* - Disables the revive system.
*
*/
* @plugindesc v1.0.0 - Automatically revive dead party members.
* @author Salted Fish
*
* @help
*
* ===========================================================================
* Introduction
* ===========================================================================
*
* This plugin automatically revives dead party members before Game Over.
*
* ===========================================================================
* Map Notetags
* ===========================================================================
*
* You can use the following notetags to specify the position of the revive
*
* <Revive Position:x,y,d>
* - x and y are the coordinates of the revive position.
* - x and y are relative to the map.
* - d is the direction the revive will face.
* - 0 is same as before.
* - 1 is down.
* - 2 is left.
* - 3 is right.
* - 4 is up.
*
* ===========================================================================
* Plugin Commands
* ===========================================================================
*
* You can use the following plugin commands to change the settings.
*
* SF_AutoRevive_Enable
* - Enables the revive system.
*
* SF_AutoRevive_Disable
* - Disables the revive system.
*
*/
//=============================================================================
(function () {
@ -71,15 +71,15 @@ var SF_Plugins = SF_Plugins || {};
Game_System.prototype.isAutoReviveEnabled = function () {
return this._autoRevive;
}
};
Game_System.prototype.setAutoReviveEnabled = function (value) {
this._autoRevive = value;
}
};
Game_System.prototype.isSupportAutoRevive = function () {
return this.isAutoReviveEnabled && $gameMap.getRevivePosition();
}
};
//=============================================================================
// Game_Map
@ -101,11 +101,11 @@ var SF_Plugins = SF_Plugins || {};
this._revivePosition = {
x: Number(position[0]),
y: Number(position[1]),
d: Number(position[2])
d: Number(position[2]),
};
}
return this._revivePosition;
}
};
//=============================================================================
// Game_Interpreter
@ -114,9 +114,9 @@ var SF_Plugins = SF_Plugins || {};
SF_AutoRevive.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
SF_AutoRevive.Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'SF_AutoRevive_Enable') {
if (command === "SF_AutoRevive_Enable") {
$gameSystem.setAutoReviveEnabled(true);
} else if (command === 'SF_AutoRevive_Disable') {
} else if (command === "SF_AutoRevive_Disable") {
$gameSystem.setAutoReviveEnabled(false);
}
};
@ -127,7 +127,7 @@ var SF_Plugins = SF_Plugins || {};
Game_BattlerBase.prototype.reviveFull = function () {
this.recoverAll();
}
};
//=============================================================================
// Game_Party
@ -141,7 +141,7 @@ var SF_Plugins = SF_Plugins || {};
member.reviveFull();
}
});
}
};
//=============================================================================
// Game_Player
@ -152,7 +152,7 @@ var SF_Plugins = SF_Plugins || {};
if (revive_position) {
this.reserveTransfer($gameMap.mapId(), revive_position.x, revive_position.y, revive_position.d);
}
}
};
//=============================================================================
// BattleManager
@ -178,7 +178,7 @@ var SF_Plugins = SF_Plugins || {};
SceneManager.pop();
}
this._phase = null;
}
};
//=============================================================================
// Scene_Base
@ -194,5 +194,5 @@ var SF_Plugins = SF_Plugins || {};
SceneManager.goto(Scene_Gameover);
}
}
}
})();
};
})();

@ -11,70 +11,70 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc v1.0.0 - Automatically update the game.
* @author Salted Fish
*
* @help
*
* ===========================================================================
* Introduction
* ===========================================================================
*
* This plugin automatically updates the game.
*
* ===========================================================================
* Requires
* ===========================================================================
*
* You need use ycrpg2-android-client to run on android.
* otherwise, you can use ycrpg2-pc-client to run on pc.
* This is not supported on ios and web, but web also use the newest version.
*
* ===========================================================================
* How to use
* ===========================================================================
*
* ycrpg2-android-client provide FileUtils and UpdateUtils.
* FileUtils is used to read and write Text files, and UpdateUtils is used to
* update the game.
*
* FileUtils provide the following functions:
* public void evaluateJavascript(String script)
* public boolean canExecute(String fileName)
* public boolean canRead(String fileName)
* public boolean canWrite(String fileName)
* public boolean createNewFile(String fileName)
* public boolean delete(String fileName)
* public boolean exists(String fileName)
* public String getAbsolutePath(String fileName)
* public String getCanonicalPath(String fileName)
* public String getName(String fileName)
* public String getParent(String fileName)
* public String getPath(String fileName)
* public boolean isAbsolute(String fileName)
* public boolean isDirectory(String fileName)
* public boolean isFile(String fileName)
* public long lastModified(String fileName)
* public long length(String fileName)
* public String list(String fileName)
* public boolean mkdir(String fileName)
* public boolean mkdirs(String fileName)
* public boolean renameTo(String srcName, String dstName)
* public String toString(String fileName)
* public String readTextFile(String fileName)
* public boolean writeTextFile(String fileName,String content)
* public String getFileHashHex(String fileName, String algorithm)
* public String getFileHashHex(String fileName)
*
* UpdateUtils provide the following functions:
* public void evaluateJavascript(String script)
* public void downloadFullUrl(String fileName, String urlString, String success, String fail)
* public void downloadRelativeUrl(String fileName, String urlString, String success, String fail)
* public void startUpdateFiles()
* public void updateFileCompleted(boolean bool)
* public String getHashInfoJson()
* public void updateFile(String fileName, String success, String fail)
*/
* @plugindesc v1.0.0 - Automatically update the game.
* @author Salted Fish
*
* @help
*
* ===========================================================================
* Introduction
* ===========================================================================
*
* This plugin automatically updates the game.
*
* ===========================================================================
* Requires
* ===========================================================================
*
* You need use ycrpg2-android-client to run on android.
* otherwise, you can use ycrpg2-pc-client to run on pc.
* This is not supported on ios and web, but web also use the newest version.
*
* ===========================================================================
* How to use
* ===========================================================================
*
* ycrpg2-android-client provide FileUtils and UpdateUtils.
* FileUtils is used to read and write Text files, and UpdateUtils is used to
* update the game.
*
* FileUtils provide the following functions:
* public void evaluateJavascript(String script)
* public boolean canExecute(String fileName)
* public boolean canRead(String fileName)
* public boolean canWrite(String fileName)
* public boolean createNewFile(String fileName)
* public boolean delete(String fileName)
* public boolean exists(String fileName)
* public String getAbsolutePath(String fileName)
* public String getCanonicalPath(String fileName)
* public String getName(String fileName)
* public String getParent(String fileName)
* public String getPath(String fileName)
* public boolean isAbsolute(String fileName)
* public boolean isDirectory(String fileName)
* public boolean isFile(String fileName)
* public long lastModified(String fileName)
* public long length(String fileName)
* public String list(String fileName)
* public boolean mkdir(String fileName)
* public boolean mkdirs(String fileName)
* public boolean renameTo(String srcName, String dstName)
* public String toString(String fileName)
* public String readTextFile(String fileName)
* public boolean writeTextFile(String fileName,String content)
* public String getFileHashHex(String fileName, String algorithm)
* public String getFileHashHex(String fileName)
*
* UpdateUtils provide the following functions:
* public void evaluateJavascript(String script)
* public void downloadFullUrl(String fileName, String urlString, String success, String fail)
* public void downloadRelativeUrl(String fileName, String urlString, String success, String fail)
* public void startUpdateFiles()
* public void updateFileCompleted(boolean bool)
* public String getHashInfoJson()
* public void updateFile(String fileName, String success, String fail)
*/
//=============================================================================
(function () {
@ -95,21 +95,27 @@ var SF_Plugins = SF_Plugins || {};
SF_AutoUpdate.isAndroid = function () {
return !!window.FileUtils && !!window.UpdateUtils && !SF_AutoUpdate.isPC();
}
};
SF_AutoUpdate.isPC = function () {
return !!Utils.isNwjs();
}
};
SF_AutoUpdate.isWeb = function () {
return !SF_AutoUpdate.isPC() && !SF_AutoUpdate.isAndroid();
}
};
SF_AutoUpdate.isSupported = function () {
return SF_AutoUpdate.enableAutoUpdate && (SF_AutoUpdate.isAndroid() || SF_AutoUpdate.isPC()) && !Utils.isOptionValid('test');
}
return (
SF_AutoUpdate.enableAutoUpdate &&
(SF_AutoUpdate.isAndroid() || SF_AutoUpdate.isPC()) &&
!Utils.isOptionValid("test")
);
};
if (!SF_AutoUpdate.isSupported()) { return; }
if (!SF_AutoUpdate.isSupported()) {
return;
}
SF_AutoUpdate.FileUtils = window.FileUtils || {};
SF_AutoUpdate.UpdateUtils = window.UpdateUtils || {};
@ -118,11 +124,11 @@ var SF_Plugins = SF_Plugins || {};
window.FileUtils = SF_AutoUpdate.FileUtils;
window.UpdateUtils = SF_AutoUpdate.UpdateUtils;
var fs = require('fs');
var path = require('path');
var os = require('os');
var crypto = require('crypto');
var https = require('https');
var fs = require("fs");
var path = require("path");
var os = require("os");
var crypto = require("crypto");
var https = require("https");
var httpsAgent = new https.Agent({
keepAlive: true,
@ -133,8 +139,8 @@ var SF_Plugins = SF_Plugins || {};
};
SF_AutoUpdate.FileUtils.evaluateJavascript = function (script) {
(new Function(script)).call(window);
}
new Function(script).call(window);
};
SF_AutoUpdate.FileUtils.canExecute = function (fileName) {
try {
@ -143,7 +149,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
SF_AutoUpdate.FileUtils.canRead = function (fileName) {
try {
@ -152,7 +158,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
SF_AutoUpdate.FileUtils.canWrite = function (fileName) {
try {
@ -161,7 +167,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
SF_AutoUpdate.FileUtils.createNewFile = function (fileName) {
try {
@ -170,7 +176,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
SF_AutoUpdate.FileUtils.delete = function (fileName) {
try {
@ -179,7 +185,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
SF_AutoUpdate.FileUtils.exists = function (fileName) {
try {
@ -188,47 +194,47 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
SF_AutoUpdate.FileUtils.getAbsolutePath = function (fileName) {
return path.resolve(fileName);
}
};
SF_AutoUpdate.FileUtils.getCanonicalPath = function (fileName) {
return path.resolve(fileName);
}
};
SF_AutoUpdate.FileUtils.getName = function (fileName) {
return path.basename(fileName);
}
};
SF_AutoUpdate.FileUtils.getParent = function (fileName) {
return path.dirname(fileName);
}
};
SF_AutoUpdate.FileUtils.getPath = function (fileName) {
return path.resolve(fileName);
}
};
SF_AutoUpdate.FileUtils.isAbsolute = function (fileName) {
return path.isAbsolute(fileName);
}
};
SF_AutoUpdate.FileUtils.isDirectory = function (fileName) {
return fs.statSync(fileName).isDirectory();
}
};
SF_AutoUpdate.FileUtils.isFile = function (fileName) {
return fs.statSync(fileName).isFile();
}
};
SF_AutoUpdate.FileUtils.lastModified = function (fileName) {
return fs.statSync(fileName).mtime.getTime();
}
};
SF_AutoUpdate.FileUtils.length = function (fileName) {
return fs.statSync(fileName).size;
}
};
SF_AutoUpdate.FileUtils.mkdir = function (fileName) {
try {
@ -237,7 +243,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
SF_AutoUpdate.FileUtils.mkdirs = function (fileName) {
try {
@ -246,7 +252,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
SF_AutoUpdate.FileUtils.reanmeTo = function (srcName, dstName) {
try {
@ -255,46 +261,50 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
SF_AutoUpdate.FileUtils.toString = function (fileName) {
return path.resolve(fileName);
}
};
SF_AutoUpdate.FileUtils.readTextFile = function (fileName) {
return fs.readFileSync(fileName, 'utf-8');
}
return fs.readFileSync(fileName, "utf-8");
};
SF_AutoUpdate.FileUtils.writeTextFile = function (fileName, text) {
return fs.writeFileSync(fileName, text, 'utf-8');
}
return fs.writeFileSync(fileName, text, "utf-8");
};
SF_AutoUpdate.FileUtils.getFileHashHex = function (fileName, algorithm) {
var hash = crypto.createHash(algorithm || 'SHA512');
var hash = crypto.createHash(algorithm || "SHA512");
var data = fs.readFileSync(fileName);
hash.update(data);
return hash.digest('hex');
}
return hash.digest("hex");
};
SF_AutoUpdate.UpdateUtils.evaluateJavascript = function (script) {
(new Function(script)).call(window);
}
new Function(script).call(window);
};
SF_AutoUpdate.UpdateUtils.downloadFullUrl = function (fileName, url, success, fail) {
var file = fs.createWriteStream(fileName);
https.get(url, options, function (response) {
response.pipe(file);
file.on('finish', function () {
file.close(SF_AutoUpdate.UpdateUtils.evaluateJavascript.bind(SF_AutoUpdate.UpdateUtils, success));
https
.get(url, options, function (response) {
response.pipe(file);
file.on("finish", function () {
file.close(
SF_AutoUpdate.UpdateUtils.evaluateJavascript.bind(SF_AutoUpdate.UpdateUtils, success)
);
});
})
.on("error", function (err) {
SF_AutoUpdate.UpdateUtils.evaluateJavascript.bind(SF_AutoUpdate.UpdateUtils, fail)(err.message);
});
}).on('error', function (err) {
SF_AutoUpdate.UpdateUtils.evaluateJavascript.bind(SF_AutoUpdate.UpdateUtils, fail)(err.message);
});
}
};
SF_AutoUpdate.UpdateUtils.downloadRelativeUrl = function (fileName, url, success, fail) {
SF_AutoUpdate.UpdateUtils.downloadFullUrl(fileName, SF_AutoUpdate.remoteUrlRoot + url, success, fail);
}
};
SF_AutoUpdate.UpdateUtils.updateFileCompleted = function (isSuccess, needReload) {
localStorage.setItem(SF_AutoUpdate.localStorageKey, JsonEx.stringify(isSuccess));
@ -302,7 +312,7 @@ var SF_Plugins = SF_Plugins || {};
nw.Window.open(`chrome-extension://${chrome.runtime.id}/index.html`, { new_instance: true });
nw.Window.get().close();
}
}
};
SF_AutoUpdate.UpdateUtils.getHashInfoJson = function () {
try {
@ -310,16 +320,15 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return SF_AutoUpdate.emptyFileInfoStr;
}
}
};
SF_AutoUpdate.UpdateUtils.updateFile = function (fileName, success, fail) {
SF_AutoUpdate.UpdateUtils.downloadRelativeUrl(fileName, fileName, success, fail);
}
};
SF_AutoUpdate.UpdateUtils.startUpdateFiles = function () {
localStorage.setItem(SF_AutoUpdate.localStorageKey, 'false');
}
localStorage.setItem(SF_AutoUpdate.localStorageKey, "false");
};
}
//=============================================================================
@ -359,24 +368,26 @@ var SF_Plugins = SF_Plugins || {};
Scene_AutoUpdate.prototype.create = function () {
Scene_Base.prototype.create.call(this);
}
};
Scene_AutoUpdate.prototype.start = function () {
Scene_Base.prototype.start.call(this);
}
};
Scene_AutoUpdate.prototype.update = function () {
Scene_Base.prototype.update.call(this);
this.updateJob();
this.updateLoading();
}
};
Scene_AutoUpdate.prototype.updateLoading = function () {
console.log(this._job, this._status);
}
};
Scene_AutoUpdate.prototype.updateJob = function () {
if (this._status === "working") { return; }
if (this._status === "working") {
return;
}
if (this._nextJob === "") {
CallBack.clear();
SceneManager.pop();
@ -407,18 +418,18 @@ var SF_Plugins = SF_Plugins || {};
UpdateUtils.updateFileCompleted(this._updateSuccess, this._updateFileCount > 0);
break;
}
}
};
Scene_AutoUpdate.prototype.fetchRemoteFileInfo = function () {
var success = (function () {
var success = function () {
this._remoteFileInfo = JsonEx.parse(FileUtils.readTextFile(SF_AutoUpdate.remoteFileInfoName));
this._status = "completed";
}).bind(this);
}.bind(this);
var fail = (function () {
var fail = function () {
this._status = "completed";
this._nextJob = "";
}).bind(this);
}.bind(this);
var callBacks = CallBack.registerOneTimeList([success, fail]);
@ -428,36 +439,36 @@ var SF_Plugins = SF_Plugins || {};
callBacks[0],
callBacks[1]
);
}
};
Scene_AutoUpdate.prototype.compareFileInfo = function () {
this._compareWorker.postMessage({
"command": "compare",
"local_file_info": this._localFileInfo,
"remote_file_info": this._remoteFileInfo
command: "compare",
local_file_info: this._localFileInfo,
remote_file_info: this._remoteFileInfo,
});
}
};
Scene_AutoUpdate.prototype._onCompareWorkerMessage = function (e) {
var result = e.data;
if (result.command === 'delete') {
if (result.command === "delete") {
this._deleteFileList = this._deleteFileList.concat(result.file_list);
} else if (result.command === 'update') {
} else if (result.command === "update") {
this._updateFileList = this._updateFileList.concat(result.file_list);
} else {
this._status = "completed";
}
}
};
Scene_AutoUpdate.prototype.deleteFile = function () {
UpdateUtils.startUpdateFiles();
this._deleteFileList.forEach(function (file_info) {
FileUtils.delete(file_info.file_name)
FileUtils.delete(file_info.file_name);
});
this._status = "completed";
}
};
Scene_AutoUpdate.prototype.updateFile = function () {
this._updateFileIndex = 0;
@ -468,10 +479,10 @@ var SF_Plugins = SF_Plugins || {};
}
this._updateFile = this._updateFileList[this._updateFileIndex];
this.updateFileNext();
}
};
Scene_AutoUpdate.prototype.updateFileNext = function () {
var success = (function () {
var success = function () {
this._updateFileIndex++;
if (this._updateFileIndex >= this._updateFileCount) {
this._status = "completed";
@ -480,12 +491,12 @@ var SF_Plugins = SF_Plugins || {};
this._updateFile = this._updateFileList[this._updateFileIndex];
this.updateFileNext();
}
}).bind(this);
}.bind(this);
var fail = (function () {
var fail = function () {
// auto try again
this.updateFileNext();
}).bind(this);
}.bind(this);
var file = this._updateFile;
if (file.is_dir) {
@ -499,13 +510,8 @@ var SF_Plugins = SF_Plugins || {};
var callBacks = CallBack.registerOneTimeList([success, fail]);
UpdateUtils.downloadRelativeUrl(
file.file_name,
file.file_name,
callBacks[0],
callBacks[1]
);
}
UpdateUtils.downloadRelativeUrl(file.file_name, file.file_name, callBacks[0], callBacks[1]);
};
//=============================================================================
// SceneManager
//=============================================================================
@ -514,6 +520,5 @@ var SF_Plugins = SF_Plugins || {};
SceneManager.initialize = function () {
SF_AutoUpdate.SceneManager_initialize.call(this);
this.addSceneBefore(Scene_AutoUpdate, Scene_Title);
}
})();
};
})();

@ -6,17 +6,17 @@ onmessage = function (e) {
result_files.update_list = [];
switch (request.command) {
case 'compare':
case "compare":
compare_file_info(request.local_file_info, request.remote_file_info, result_files);
send_command('delete', result_files.delete_list);
send_command('update', result_files.update_list);
send_command('finish', []);
send_command("delete", result_files.delete_list);
send_command("update", result_files.update_list);
send_command("finish", []);
break;
case 'finish':
send_command('finish');
case "finish":
send_command("finish");
break;
}
}
};
function compare_file_info(local_file_info, remote_file_info, result_files) {
if (!remote_file_info) {
@ -35,7 +35,9 @@ function compare_file_info(local_file_info, remote_file_info, result_files) {
}
for (var i in remote_file_info.children) {
if (!visited_children.has(i)) {
result_files.update_list = result_files.update_list.concat(generate_file_list(remote_file_info.children[i]));
result_files.update_list = result_files.update_list.concat(
generate_file_list(remote_file_info.children[i])
);
}
}
} else {
@ -44,9 +46,10 @@ function compare_file_info(local_file_info, remote_file_info, result_files) {
}
}
function generate_file_list(file_info) {
if (!file_info) { return []; }
if (!file_info) {
return [];
}
var file_list = [];
if (file_info.is_dir) {
@ -55,10 +58,10 @@ function generate_file_list(file_info) {
}
}
file_list.push({
"file_name": file_info.file_name,
"is_dir": file_info.is_dir,
"is_file": file_info.is_file,
"sha_512": file_info.sha_512
file_name: file_info.file_name,
is_dir: file_info.is_dir,
is_file: file_info.is_file,
sha_512: file_info.sha_512,
});
return file_list;
}
@ -67,7 +70,7 @@ function generate_file_list(file_info) {
function send_command(command, file_list) {
var command_data = {
command: command,
file_list: file_list
file_list: file_list,
};
postMessage(command_data);
}
}

@ -10,18 +10,18 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc Allows you to add a click event to object.
* @author Salted Fish
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin allows you to add a click event to object.
*
* Use as a dependency.
*/
* @plugindesc Allows you to add a click event to object.
* @author Salted Fish
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin allows you to add a click event to object.
*
* Use as a dependency.
*/
//=============================================================================
(function () {
@ -30,8 +30,6 @@ var SF_Plugins = SF_Plugins || {};
SF_ClickEvent.version = 1.0;
//=============================================================================
// Scene_Base
//=============================================================================
@ -42,13 +40,13 @@ var SF_Plugins = SF_Plugins || {};
this._clickEvent = {};
this._clicking = false;
this._clickingName = null;
}
};
SF_ClickEvent.Scene_Base_update = Scene_Base.prototype.update;
Scene_Base.prototype.update = function () {
SF_ClickEvent.Scene_Base_update.call(this);
this.updateClickEvent();
}
};
// register click event
// @param {String} name
@ -63,37 +61,34 @@ var SF_Plugins = SF_Plugins || {};
mousedown: mousedown,
mouseup: mouseup,
mouseclick: mouseclick,
enabled: true
enabled: true,
};
}
};
// unregister click event
// @param {String} name
Scene_Base.prototype.unregisterClickEvent = function (name) {
delete this._clickEvent[name];
}
};
// enable click event
// @param {String} name
Scene_Base.prototype.enableClickEvent = function (name) {
this._clickEvent[name].enabled = true;
}
};
// disable click event
// @param {String} name
Scene_Base.prototype.disableClickEvent = function (name) {
this._clickEvent[name].enabled = false;
}
};
// update click event
Scene_Base.prototype.updateClickEvent = function () {
var touch_x = TouchInput.x;
var touch_y = TouchInput.y;
if (this._clicking) {
if (
this._clickingName &&
this._clickEvent[this._clickingName]
) {
if (this._clickingName && this._clickEvent[this._clickingName]) {
var clickEvent = this._clickEvent[this._clickingName];
var isContain = clickEvent.hitArea.contains(touch_x, touch_y);
if (!isContain || !clickEvent.enabled) {
@ -137,9 +132,5 @@ var SF_Plugins = SF_Plugins || {};
}
}
}
}
};
})();

@ -42,8 +42,7 @@ SF_Plugins.SF_CommonAttack.version = 1.0;
// DataManager
//=============================================================================
SF_Plugins.SF_CommonAttack.DataManager_isDatabaseLoaded =
DataManager.isDatabaseLoaded;
SF_Plugins.SF_CommonAttack.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function () {
if (!SF_Plugins.SF_CommonAttack.DataManager_isDatabaseLoaded.call(this)) {
return false;
@ -79,11 +78,9 @@ DataManager.SF_CommonAttack_isDatabaseLoaded = function (group) {
//=============================================================================
// Game_Actor
//=============================================================================
SF_Plugins.SF_CommonAttack.Game_Actor_attackSkillId =
Game_Actor.prototype.attackSkillId;
SF_Plugins.SF_CommonAttack.Game_Actor_attackSkillId = Game_Actor.prototype.attackSkillId;
Game_Actor.prototype.attackSkillId = function () {
var normalId =
SF_Plugins.SF_CommonAttack.Game_Actor_attackSkillId.call(this);
var normalId = SF_Plugins.SF_CommonAttack.Game_Actor_attackSkillId.call(this);
var maxPriority = 0;
// 职业
@ -115,8 +112,7 @@ Game_Actor.prototype.attackSkillId = function () {
//=============================================================================
// SceneBattle
//=============================================================================
SF_Plugins.SF_CommonAttack.Scene_Battle_commandAttack =
Scene_Battle.prototype.commandAttack;
SF_Plugins.SF_CommonAttack.Scene_Battle_commandAttack = Scene_Battle.prototype.commandAttack;
Scene_Battle.prototype.commandAttack = function () {
BattleManager.inputtingAction().setAttack();
this.onSelectAction();

@ -9,9 +9,9 @@ Imported.SF_Core = true;
var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc core lib for salted fish plugins
* @author Salted Fish
*/
* @plugindesc core lib for salted fish plugins
* @author Salted Fish
*/
//=============================================================================
(function () {
@ -61,77 +61,77 @@ var SF_Plugins = SF_Plugins || {};
this.event = [];
this.ext = null;
this.user = null;
}
};
Pointer.prototype.set = function (x, y) {
this.x = x;
this.y = y;
}
};
Pointer.prototype.setEvents = function (events) {
this.event = events;
}
};
Pointer.prototype.addEvent = function (event) {
this.event.push(event);
}
};
Pointer.prototype.clearEvent = function () {
this.event = [];
}
};
Pointer.prototype.getEvents = function () {
return this.event;
}
};
Pointer.prototype.setExt = function (ext) {
this.ext = ext;
}
};
Pointer.prototype.getExt = function () {
return this.ext;
}
};
Pointer.prototype.setUser = function (user) {
this.user = user;
}
};
Pointer.prototype.getUser = function () {
return this.user;
}
};
Pointer.prototype.removeUser = function () {
this.user = null;
}
};
Pointer.prototype.isEmpty = function () {
return this.event.length === 0;
}
};
Pointer.prototype.clear = function () {
this.event = [];
this.ext = null;
}
};
Pointer.prototype.isDown = function () {
return this.event.indexOf('pointer-down') >= 0;
}
return this.event.indexOf("pointer-down") >= 0;
};
Pointer.prototype.isUp = function () {
return this.event.indexOf('pointer-up') >= 0;
}
return this.event.indexOf("pointer-up") >= 0;
};
Pointer.prototype.isMove = function () {
return this.event.indexOf('pointer-move') >= 0;
}
return this.event.indexOf("pointer-move") >= 0;
};
Pointer.prototype.isCancel = function () {
return this.event.indexOf('pointer-cancel') >= 0;
}
return this.event.indexOf("pointer-cancel") >= 0;
};
Pointer.prototype.isCanUsed = function (user) {
return this.user === user || this.user === null;
}
};
//=============================================================================
// TouchInput
@ -151,7 +151,7 @@ var SF_Plugins = SF_Plugins || {};
this._events.event = null;
this._events._pointer = {};
this._events._losedPointer = [];
}
};
SF_Core.TouchInput_update = TouchInput.update;
TouchInput.update = function () {
@ -188,19 +188,18 @@ var SF_Plugins = SF_Plugins || {};
for (var i in this._events._pointer) {
var pointer = this._events._pointer[i];
if (pointer.isCancel() || pointer.isUp()) {
SF_Core.Utils.error('pointer cancel or up');
SF_Core.Utils.error("pointer cancel or up");
}
var p = this._pointer[i];
if (p) {
p.set(pointer.x, pointer.y);
p.setEvents(pointer.getEvents());
p.setExt(pointer.getExt());
} else {
this._pointer[i] = pointer;
}
}
}
};
SF_Core.TouchInput_onMouseDown = TouchInput._onMouseDown;
TouchInput._onMouseDown = function (event) {
@ -211,8 +210,8 @@ var SF_Plugins = SF_Plugins || {};
var x = Graphics.pageToCanvasX(event.pageX);
var y = Graphics.pageToCanvasY(event.pageY);
this._events._mouse.set(x, y);
this._events._mouse.addEvent('pointer-down');
}
this._events._mouse.addEvent("pointer-down");
};
SF_Core.TouchInput__onMouseMove = TouchInput._onMouseMove;
TouchInput._onMouseMove = function (event) {
@ -223,8 +222,8 @@ var SF_Plugins = SF_Plugins || {};
var x = Graphics.pageToCanvasX(event.pageX);
var y = Graphics.pageToCanvasY(event.pageY);
this._events._mouse.set(x, y);
this._events._mouse.addEvent('pointer-move');
}
this._events._mouse.addEvent("pointer-move");
};
SF_Core.TouchInput__onMouseUp = TouchInput._onMouseUp;
TouchInput._onMouseUp = function (event) {
@ -235,29 +234,29 @@ var SF_Plugins = SF_Plugins || {};
var x = Graphics.pageToCanvasX(event.pageX);
var y = Graphics.pageToCanvasY(event.pageY);
this._events._mouse.set(x, y);
this._events._mouse.addEvent('pointer-up');
}
this._events._mouse.addEvent("pointer-up");
};
SF_Core.TouchInput__onMouseWheel = TouchInput._onMouseWheel;
TouchInput._onMouseWheel = function (event) {
SF_Core.TouchInput__onMouseWheel.call(this, event);
this._events.event = event;
}
};
SF_Core.TouchInput__onTouchStart = TouchInput._onTouchStart;
TouchInput._onTouchStart = function (event) {
SF_Core.TouchInput__onTouchStart.call(this, event);
this._events.event = event;
this._pointerFromTouch(event, "pointer-down");
}
};
SF_Core.TouchInput__onTouchMove = TouchInput._onTouchMove;
TouchInput._onTouchMove = function (event) {
SF_Core.TouchInput__onTouchMove.call(this, event);
this._events.event = event;
this._pointerFromTouch(event, "pointer-move");
}
};
SF_Core.TouchInput__onTouchEnd = TouchInput._onTouchEnd;
TouchInput._onTouchEnd = function (event) {
@ -265,14 +264,14 @@ var SF_Plugins = SF_Plugins || {};
//console.log(event.changedTouches);
this._events.event = event;
this._pointerFromTouch(event, "pointer-up");
}
};
SF_Core.TouchInput__onTouchCancel = TouchInput._onTouchCancel;
TouchInput._onTouchCancel = function (event) {
SF_Core.TouchInput__onTouchCancel.call(this, event);
this._events.event = event;
this._pointerFromTouch(event, "pointer-cancel");
}
};
TouchInput._pointerFromTouch = function (event, type) {
for (var i = 0; i < event.changedTouches.length; i++) {
@ -297,9 +296,8 @@ var SF_Plugins = SF_Plugins || {};
this._events._losedPointer.push(pointer);
break;
}
}
}
};
TouchInput.getPointers = function (user) {
var result = [];
@ -319,7 +317,7 @@ var SF_Plugins = SF_Plugins || {};
}
}
return result;
}
};
TouchInput.removeUsers = function () {
for (var i in this._pointer) {
@ -331,7 +329,7 @@ var SF_Plugins = SF_Plugins || {};
pointer.removeUser();
}
this._mouse.removeUser();
}
};
//=============================================================================
// PIXI.Container
@ -352,14 +350,14 @@ var SF_Plugins = SF_Plugins || {};
}
return lastUsePointer || inFramePointer || pointers[0] || null;
}
};
PIXI.Container.prototype.releasePointer = function () {
var pointer = this.getPointer();
if (pointer) {
pointer.removeUser();
}
}
};
//=============================================================================
// SF_Utils
@ -382,15 +380,15 @@ var SF_Plugins = SF_Plugins || {};
SF_Core.Utils.isPC = function () {
return !!Utils.isNwjs();
}
};
SF_Core.Utils.isAndroid = function () {
return !!window.FileUtils && !SF_Core.Utils.isPC();
}
};
SF_Core.Utils.isWeb = function () {
return !SF_Core.Utils.isPC() && !SF_Core.Utils.isAndroid();
}
};
//=============================================================================
// CallBack Scope Transport
@ -403,42 +401,48 @@ var SF_Plugins = SF_Plugins || {};
CallBack.initialize = function () {
this.clear();
}
};
// Return closureIndex
CallBack.getNew = function () {
var closureIndex = this._closureIndex++;
return closureIndex;
}
};
CallBack.setByClosureIndex = function (closureIndex, closureFunction) {
this._closureFunction[closureIndex] = closureFunction;
}
};
CallBack.unregister = function (closureIndex) {
delete this._closureFunction[closureIndex];
}
};
CallBack.callByClosureIndex = function (closureIndex) {
if (this._closureFunction[closureIndex]) {
this._closureFunction[closureIndex]();
}
}
};
CallBack.convertToString = function (closureIndex) {
return "CallBack.callByClosureIndex(" + closureIndex + ")";
}
};
CallBack.clear = function () {
this._closureFunction = {};
this._closureIndex = 0;
}
};
CallBack.registerOneTime = function (closureFunction) {
var closureIndex = this.getNew();
this.setByClosureIndex(closureIndex, (function () { closureFunction(); this.unregister(closureIndex); }).bind(this));
this.setByClosureIndex(
closureIndex,
function () {
closureFunction();
this.unregister(closureIndex);
}.bind(this)
);
return this.convertToString(closureIndex);
}
};
CallBack.registerOneTimeList = function (closureFunctionList) {
var indexList = [];
@ -449,21 +453,27 @@ var SF_Plugins = SF_Plugins || {};
indexList.push(index);
}
var removeAllFunc = (function () {
var removeAllFunc = function () {
for (var i = 0; i < indexList.length; i++) {
this.unregister(indexList[i]);
}
}).bind(this);
}.bind(this);
for (var i = 0; i < indexList.length; i++) {
this.setByClosureIndex(indexList[i], (function (i) {
return (function () { closureFunctionList[i](); removeAllFunc(); });
})(i).bind(this));
this.setByClosureIndex(
indexList[i],
(function (i) {
return function () {
closureFunctionList[i]();
removeAllFunc();
};
})(i).bind(this)
);
result.push(this.convertToString(indexList[i]));
}
return result;
}
};
//=============================================================================
// FileUtils
@ -473,13 +483,13 @@ var SF_Plugins = SF_Plugins || {};
var FileUtils = window.FileUtils || {};
window.FileUtils = FileUtils;
var fs = require('fs');
var path = require('path');
var crypto = require('crypto');
var fs = require("fs");
var path = require("path");
var crypto = require("crypto");
FileUtils.evaluateJavascript = function (script) {
(new Function(script)).call(window);
}
new Function(script).call(window);
};
FileUtils.canExecute = function (fileName) {
try {
@ -488,7 +498,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
FileUtils.canRead = function (fileName) {
try {
@ -497,7 +507,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
FileUtils.canWrite = function (fileName) {
try {
@ -506,7 +516,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
FileUtils.createNewFile = function (fileName) {
try {
@ -515,7 +525,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
FileUtils.delete = function (fileName) {
try {
@ -524,7 +534,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
FileUtils.exists = function (fileName) {
try {
@ -533,51 +543,51 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
FileUtils.getAbsolutePath = function (fileName) {
return path.resolve(fileName);
}
};
FileUtils.getCanonicalPath = function (fileName) {
return path.resolve(fileName);
}
};
FileUtils.getName = function (fileName) {
return path.basename(fileName);
}
};
FileUtils.getParent = function (fileName) {
return path.dirname(fileName);
}
};
FileUtils.getPath = function (fileName) {
return path.resolve(fileName);
}
};
FileUtils.isAbsolute = function (fileName) {
return path.isAbsolute(fileName);
}
};
FileUtils.isDirectory = function (fileName) {
return fs.statSync(fileName).isDirectory();
}
};
FileUtils.isFile = function (fileName) {
return fs.statSync(fileName).isFile();
}
};
FileUtils.lastModified = function (fileName) {
return fs.statSync(fileName).mtime.getTime();
}
};
FileUtils.length = function (fileName) {
return fs.statSync(fileName).size;
}
};
FileUtils.list = function (dirName) {
return fs.readdirSync(dirName);
}
};
FileUtils.mkdir = function (fileName) {
try {
@ -586,7 +596,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
FileUtils.mkdirs = function (fileName) {
try {
@ -595,7 +605,7 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
FileUtils.reanmeTo = function (srcName, dstName) {
try {
@ -604,33 +614,32 @@ var SF_Plugins = SF_Plugins || {};
} catch (e) {
return false;
}
}
};
FileUtils.toString = function (fileName) {
return path.resolve(fileName);
}
};
FileUtils.readTextFile = function (fileName) {
return fs.readFileSync(fileName, 'utf-8');
}
return fs.readFileSync(fileName, "utf-8");
};
FileUtils.writeTextFile = function (fileName, text) {
return fs.writeFileSync(fileName, text, 'utf-8');
}
return fs.writeFileSync(fileName, text, "utf-8");
};
FileUtils.getFileHashHex = function (fileName, algorithm) {
var hash = crypto.createHash(algorithm || 'SHA512');
var hash = crypto.createHash(algorithm || "SHA512");
var data = fs.readFileSync(fileName);
hash.update(data);
return hash.digest('hex');
}
return hash.digest("hex");
};
}
if (SF_Core.Utils.isAndroid()) {
var FileUtils_List = FileUtils.list;
FileUtils.list = function (name) {
return JsonEx.parse(FileUtils_List.call(this, arguments));
}
};
}
})();

@ -12,55 +12,55 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc v1.0 support add anf remove input event listener
* @author SaltedFish
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin support add and remove input event listener.
*
* ============================================================================
* Plugin Commands
* ============================================================================
*
* SF_InputBind Remove TouchInput
* SF_InputBind Remove Input
*
* to remove input / touchinput event listener
*
* -----------------------------------------------------------------------------
*
* SF_InputBind Setup TouchInput
* SF_InputBind Setup Input
*
* to rebind input / touchinput event listener
*
* ============================================================================
* Script Calls
* ============================================================================
*
* TouchInput.removeEventHandlers()
* Input.removeEventHandlers()
*
* to remove input / touchinput event listener
*
* -----------------------------------------------------------------------------
*
* TouchInput._setupEventHandlers()
* Input._setupEventHandlers()
*
* to rebind input / touchinput event listener
*
* ============================================================================
* Changelog
* ============================================================================
*
* Version 1.0:
* - Finished plugin
*/
* @plugindesc v1.0 support add anf remove input event listener
* @author SaltedFish
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin support add and remove input event listener.
*
* ============================================================================
* Plugin Commands
* ============================================================================
*
* SF_InputBind Remove TouchInput
* SF_InputBind Remove Input
*
* to remove input / touchinput event listener
*
* -----------------------------------------------------------------------------
*
* SF_InputBind Setup TouchInput
* SF_InputBind Setup Input
*
* to rebind input / touchinput event listener
*
* ============================================================================
* Script Calls
* ============================================================================
*
* TouchInput.removeEventHandlers()
* Input.removeEventHandlers()
*
* to remove input / touchinput event listener
*
* -----------------------------------------------------------------------------
*
* TouchInput._setupEventHandlers()
* Input._setupEventHandlers()
*
* to rebind input / touchinput event listener
*
* ============================================================================
* Changelog
* ============================================================================
*
* Version 1.0:
* - Finished plugin
*/
//=============================================================================
(function () {
@ -74,16 +74,16 @@ var SF_Plugins = SF_Plugins || {};
//remove touch input event listener
TouchInput.removeEventHandlers = function () {
document.removeEventListener('mousedown', this._onMouseDownBind);
document.removeEventListener('mousemove', this._onMouseMoveBind);
document.removeEventListener('mouseup', this._onMouseUpBind);
document.removeEventListener('wheel', this._onWheelBind);
document.removeEventListener('touchstart', this._onTouchStartBind);
document.removeEventListener('touchmove', this._onTouchMoveBind);
document.removeEventListener('touchend', this._onTouchEndBind);
document.removeEventListener('touchcancel', this._onTouchCancelBind);
document.removeEventListener('pointerdown', this._onPointerDownBind);
}
document.removeEventListener("mousedown", this._onMouseDownBind);
document.removeEventListener("mousemove", this._onMouseMoveBind);
document.removeEventListener("mouseup", this._onMouseUpBind);
document.removeEventListener("wheel", this._onWheelBind);
document.removeEventListener("touchstart", this._onTouchStartBind);
document.removeEventListener("touchmove", this._onTouchMoveBind);
document.removeEventListener("touchend", this._onTouchEndBind);
document.removeEventListener("touchcancel", this._onTouchCancelBind);
document.removeEventListener("pointerdown", this._onPointerDownBind);
};
//setup touch input event listener
TouchInput._setupEventHandlers = function () {
@ -97,16 +97,16 @@ var SF_Plugins = SF_Plugins || {};
this._onTouchEndBind = this._onTouchEnd.bind(this);
this._onTouchCancelBind = this._onTouchCancel.bind(this);
this._onPointerDownBind = this._onPointerDown.bind(this);
document.addEventListener('mousedown', this._onMouseDownBind);
document.addEventListener('mousemove', this._onMouseMoveBind);
document.addEventListener('mouseup', this._onMouseUpBind);
document.addEventListener('wheel', this._onWheelBind, isSupportPassive ? { passive: false } : false);
document.addEventListener('touchstart', this._onTouchStartBind, isSupportPassive ? { passive: false } : false);
document.addEventListener('touchmove', this._onTouchMoveBind, isSupportPassive ? { passive: false } : false);
document.addEventListener('touchend', this._onTouchEndBind);
document.addEventListener('touchcancel', this._onTouchCancelBind);
document.addEventListener('pointerdown', this._onPointerDownBind);
}
document.addEventListener("mousedown", this._onMouseDownBind);
document.addEventListener("mousemove", this._onMouseMoveBind);
document.addEventListener("mouseup", this._onMouseUpBind);
document.addEventListener("wheel", this._onWheelBind, isSupportPassive ? { passive: false } : false);
document.addEventListener("touchstart", this._onTouchStartBind, isSupportPassive ? { passive: false } : false);
document.addEventListener("touchmove", this._onTouchMoveBind, isSupportPassive ? { passive: false } : false);
document.addEventListener("touchend", this._onTouchEndBind);
document.addEventListener("touchcancel", this._onTouchCancelBind);
document.addEventListener("pointerdown", this._onPointerDownBind);
};
//=============================================================================
// Input
@ -114,21 +114,20 @@ var SF_Plugins = SF_Plugins || {};
//remove input event listener
Input.removeEventHandlers = function () {
document.removeEventListener('keydown', this._onKeyDownBind);
document.removeEventListener('keyup', this._onKeyUpBind);
window.removeEventListener('blur', this._onLostFocusBind);
}
document.removeEventListener("keydown", this._onKeyDownBind);
document.removeEventListener("keyup", this._onKeyUpBind);
window.removeEventListener("blur", this._onLostFocusBind);
};
//setup input event listener
Input._setupEventHandlers = function () {
this._onKeyDownBind = this._onKeyDown.bind(this);
this._onKeyUpBind = this._onKeyUp.bind(this);
this._onLostFocusBind = this._onLostFocus.bind(this);
document.addEventListener('keydown', this._onKeyDownBind);
document.addEventListener('keyup', this._onKeyUpBind);
window.addEventListener('blur', this._onLostFocusBind);
}
document.addEventListener("keydown", this._onKeyDownBind);
document.addEventListener("keyup", this._onKeyUpBind);
window.addEventListener("blur", this._onLostFocusBind);
};
//=============================================================================
// Plugin Command
@ -137,31 +136,31 @@ var SF_Plugins = SF_Plugins || {};
SF_InputBindControl.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
SF_InputBindControl.Game_Interpreter_pluginCommand.call(this, command, args);
if (command.toLowerCase() === 'sf_inputbind') {
if (command.toLowerCase() === "sf_inputbind") {
switch (args[0].toLowerCase()) {
case 'remove':
case "remove":
switch (args[1].toLowerCase()) {
case 'touchinput':
case "touchinput":
TouchInput.removeEventHandlers();
break;
case 'input':
case "input":
Input.removeEventHandlers();
break;
}
break;
case 'setup':
case "setup":
switch (args[1].toLowerCase()) {
case 'touchinput':
case "touchinput":
TouchInput._setupEventHandlers();
break;
case 'input':
case "input":
Input._setupEventHandlers();
break;
}
break;
}
}
}
};
//=============================================================================
// TouchInput
@ -172,13 +171,12 @@ var SF_Plugins = SF_Plugins || {};
SF_InputBindControl.TouchInput__onMouseMove.call(this, event);
this._mouseOverX = Graphics.pageToCanvasX(event.pageX);
this._mouseOverY = Graphics.pageToCanvasY(event.pageY);
}
};
SF_InputBindControl.TouchInput_clear = TouchInput.clear;
TouchInput.clear = function () {
SF_InputBindControl.TouchInput_clear.call(this);
this._mouseOverX = -1;
this._mouseOverY = -1;
}
})()
};
})();

@ -11,103 +11,103 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*~struct~tip:
* @param tips
* @desc The text to display in the tip.
* @type text[]
* @default []
*
* @param initialize
* @text initialize function
* @desc The function to call when the tip is initialized.
* This function is called with the tip as the only argument.
* This function is called only once when game started
* @type note
* @default ""
*
* @param create
* @text create function
* @desc The function to call when the tip is created.
* This function is called when start loading
* @type note
* @default ""
*
* @param update
* @text update function
* @desc The function to call each frame.
* @type note
* @default ""
*
* @param terminate
* @text terminate function
* @desc The function to call when the tip is terminated.
* @type note
* @default ""
*
* @param canExit
* @text can exit function
* @desc The function to call to check if loading can be exited.
* @type note
* @default ""
*
*/
* @param tips
* @desc The text to display in the tip.
* @type text[]
* @default []
*
* @param initialize
* @text initialize function
* @desc The function to call when the tip is initialized.
* This function is called with the tip as the only argument.
* This function is called only once when game started
* @type note
* @default ""
*
* @param create
* @text create function
* @desc The function to call when the tip is created.
* This function is called when start loading
* @type note
* @default ""
*
* @param update
* @text update function
* @desc The function to call each frame.
* @type note
* @default ""
*
* @param terminate
* @text terminate function
* @desc The function to call when the tip is terminated.
* @type note
* @default ""
*
* @param canExit
* @text can exit function
* @desc The function to call to check if loading can be exited.
* @type note
* @default ""
*
*/
/*~struct~gif:
* @param gifs
* @desc The gif to display.
* @default
* @type file[]
*
* @param initialize
* @text initialize function
* @desc The function to call when the tip is initialized.
* This function is called with the tip as the only argument.
* This function is called only once when game started
* @type note
* @default ""
*
* @param create
* @text create function
* @desc The function to call when the tip is created.
* This function is called when start loading
* @type note
* @default ""
*
* @param update
* @text update function
* @desc The function to call each frame.
* @type note
* @default ""
*
* @param terminate
* @text terminate function
* @desc The function to call when the tip is terminated.
* @type note
* @default ""
*
* @param canExit
* @text can exit function
* @desc The function to call to check if loading can be exited.
* @type note
* @default "return true;"
*
*/
* @param gifs
* @desc The gif to display.
* @default
* @type file[]
*
* @param initialize
* @text initialize function
* @desc The function to call when the tip is initialized.
* This function is called with the tip as the only argument.
* This function is called only once when game started
* @type note
* @default ""
*
* @param create
* @text create function
* @desc The function to call when the tip is created.
* This function is called when start loading
* @type note
* @default ""
*
* @param update
* @text update function
* @desc The function to call each frame.
* @type note
* @default ""
*
* @param terminate
* @text terminate function
* @desc The function to call when the tip is terminated.
* @type note
* @default ""
*
* @param canExit
* @text can exit function
* @desc The function to call to check if loading can be exited.
* @type note
* @default "return true;"
*
*/
/*:
* @plugindesc v1.0.0 - Adds a loading gif to the game.
* @author Salted Fish
*
* @param Loading Gif
* @text Loading Gif
* @desc The gif to display.
* @default []
* @type struct<gif>
*
* @param Tips
* @text Tips
* @desc The tips to display.
* @default []
* @type struct<tip>
*
*
*/
* @plugindesc v1.0.0 - Adds a loading gif to the game.
* @author Salted Fish
*
* @param Loading Gif
* @text Loading Gif
* @desc The gif to display.
* @default []
* @type struct<gif>
*
* @param Tips
* @text Tips
* @desc The tips to display.
* @default []
* @type struct<tip>
*
*
*/
(function () {
var SF_LoadingGif = {};
@ -118,10 +118,10 @@ var SF_Plugins = SF_Plugins || {};
// Parameters
//=============================================================================
SF_LoadingGif.Parameters = PluginManager.parameters('SF_LoadingGif');
SF_LoadingGif.Parameters = PluginManager.parameters("SF_LoadingGif");
SF_LoadingGif.Param = SF_LoadingGif.Param || {};
SF_LoadingGif.Param.LoadingGif = JSON.parse(SF_LoadingGif.Parameters['Loading Gif'] || '[]');
SF_LoadingGif.Param.Tips = JSON.parse(SF_LoadingGif.Parameters['Tips'] || '[]');
SF_LoadingGif.Param.LoadingGif = JSON.parse(SF_LoadingGif.Parameters["Loading Gif"] || "[]");
SF_LoadingGif.Param.Tips = JSON.parse(SF_LoadingGif.Parameters["Tips"] || "[]");
//=============================================================================
// Loading_Tip
@ -139,29 +139,29 @@ var SF_Plugins = SF_Plugins || {};
this.tip = tip.tips;
this.customFunc = {};
this.customFunc.initialize = (new Function("tip", JsonEx.parse(tip.initialize))).bind(this, this);
this.customFunc.create = (new Function("tip", JsonEx.parse(tip.create))).bind(this, this);
this.customFunc.update = (new Function("tip", JsonEx.parse(tip.update))).bind(this, this);
this.customFunc.terminate = (new Function("tip", JsonEx.parse(tip.terminate))).bind(this, this);
this.customFunc.canExit = (new Function("tip", JsonEx.parse(tip.canExit))).bind(this, this);
this.customFunc.initialize = new Function("tip", JsonEx.parse(tip.initialize)).bind(this, this);
this.customFunc.create = new Function("tip", JsonEx.parse(tip.create)).bind(this, this);
this.customFunc.update = new Function("tip", JsonEx.parse(tip.update)).bind(this, this);
this.customFunc.terminate = new Function("tip", JsonEx.parse(tip.terminate)).bind(this, this);
this.customFunc.canExit = new Function("tip", JsonEx.parse(tip.canExit)).bind(this, this);
this.customFunc.initialize();
}
};
Loading_Tip.prototype.create = function () {
this.customFunc.create();
}
};
Loading_Tip.prototype.update = function () {
this.customFunc.update();
}
};
Loading_Tip.prototype.terminate = function () {
this.customFunc.terminate();
}
};
Loading_Tip.prototype.canExit = function () {
return this.customFunc.canExit();
}
};
//=============================================================================
// Loading_Gif
@ -170,6 +170,4 @@ var SF_Plugins = SF_Plugins || {};
function Loading_Gif() {
this.initialize.apply(this, arguments);
}
})()
})();

@ -14,110 +14,110 @@ var SF_Plugins = SF_Plugins || {};
* @desc random show when loading
* @type text[]
* @default []
*
*
* @param initialize
* @text initialize function
* @desc run this only once time when game started
* @type note
* @default ""
*
*
* @param create
* @text create function
* @desc run this once when start loading
* @type note
* @default ""
*
*
* @param update
* @text update function
* @desc run this each frame when in loading.
* so you can use this to make animation
* @type note
* @default ""
*
*
* @param terminate
* @text terminate function
* @desc run this when removed
* @type note
* @default ""
*
*
* @param canExit
* @text can Exit function
* @desc call this each update after new scene loaded
* @type note
* @default "return true;"
*
*
*/
/*~struct~picture:
*
*
* @param pictures
* @desc loop as gif files
* @type file[]
* @default []
*
*
* @param initialize
* @text initilize function
* @desc run this only once time when game started
* @type note
* @default ""
*
*
*
*
* @param create
* @text create function
* @desc run this once when start loading
* @type note
* @default ""
*
*
* @param update
* @text update function
* @desc run this each frame when in loading.
* so you can use this to make animation
* @type note
* @default ""
*
*
* @param terminate
* @text terminate function
* @desc run this when removed
* @type note
* @default ""
*
*
* @param canExit
* @text can Exit function
* @desc call this in each update after new scene loaded
* @type note
* @default "return true;"
*
*
*/
/*:
* @plugindesc Show Loading when loading
* @author SaltedFish
*
* @help
*
* @help
*
* ============================================================================
* Introduction
* ============================================================================
*
*
* require SF_InputBindControl.js and SF_SkipLoadError.js
* loop these pictures as gif on loading game resource
*
*
* ============================================================================
* Changelog
* ============================================================================
*
*
* v1.0 - initial release
*
*
* ============================================================================
* End of Helpfile
* ============================================================================
*
*
*
*
* @param loading picture
* @desc SHow when loading
* @type struct<picture>[]
* @default []
*
*
* @param fade speed
* @desc the nunmber of speed that alpha(0~1) change per frame
* @type number
@ -125,21 +125,21 @@ var SF_Plugins = SF_Plugins || {};
* @max 1
* @decimals 4
* @default 0.1000
*
*
* @param fading in
* @desc loading scene fading in or not
* @on enable
* @off disable
* @default true
* @type boolean
*
*
* @param fading out
* @desc loading scene fading out or not
* @on enable
* @off disable
* @default true
* @type boolean
*
*
* @param alpha min
* @desc Scene fade alpha minimum
* @type number
@ -147,16 +147,16 @@ var SF_Plugins = SF_Plugins || {};
* @min 0
* @max 1
* @default 0.5000
*
*
* @param all tips
* @desc show tips when animation loops
* @type struct<tip>[]
*
*
* @param disabled fade scene
* @desc these scene may be not faded
* @type text[]
* @default ["Scene_Boot"]
*
*
*/
//=============================================================================
@ -166,7 +166,6 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
}
(function () {
var SF_LoadingScene = {};
SF_Plugins.SF_LoadingScene = SF_LoadingScene;
SF_LoadingScene.version = 1.0;
@ -175,21 +174,23 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
// Parameter
//=============================================================================
SF_LoadingScene.parameters = PluginManager.parameters('SF_LoadingScene');
SF_LoadingScene.fadeSpeed = Number(SF_LoadingScene.parameters['fade speed']) || 0.1;
SF_LoadingScene.needLoopSceneFadeIn = String(SF_LoadingScene.parameters['fade in']).toLowerCase() === "true";
SF_LoadingScene.needLoopSceneFadeOut = String(SF_LoadingScene.parameters['fade out']).toLowerCase() === "true";
SF_LoadingScene.alphaMin = Number(SF_LoadingScene.parameters['alpha min']);
SF_LoadingScene.loadingTips = JsonEx.parse(SF_LoadingScene.parameters['all tips'])
.map(function (tip) { return JsonEx.parse(tip); });
SF_LoadingScene.loadingPictures = JsonEx.parse(SF_LoadingScene.parameters['loading picture'])
.map(function (picture) { return JsonEx.parse(picture); });
SF_LoadingScene.disabledFadeScene = JsonEx.parse(SF_LoadingScene.parameters['disabled fade scene']);
// fading_out_old_scene
SF_LoadingScene.parameters = PluginManager.parameters("SF_LoadingScene");
SF_LoadingScene.fadeSpeed = Number(SF_LoadingScene.parameters["fade speed"]) || 0.1;
SF_LoadingScene.needLoopSceneFadeIn = String(SF_LoadingScene.parameters["fade in"]).toLowerCase() === "true";
SF_LoadingScene.needLoopSceneFadeOut = String(SF_LoadingScene.parameters["fade out"]).toLowerCase() === "true";
SF_LoadingScene.alphaMin = Number(SF_LoadingScene.parameters["alpha min"]);
SF_LoadingScene.loadingTips = JsonEx.parse(SF_LoadingScene.parameters["all tips"]).map(function (tip) {
return JsonEx.parse(tip);
});
SF_LoadingScene.loadingPictures = JsonEx.parse(SF_LoadingScene.parameters["loading picture"]).map(function (
picture
) {
return JsonEx.parse(picture);
});
SF_LoadingScene.disabledFadeScene = JsonEx.parse(SF_LoadingScene.parameters["disabled fade scene"]);
// fading_out_old_scene
// fading_in_loading_scene
// loop_loading_scene
// fading_out_loading_scene
@ -212,11 +213,11 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
PIXI.Text.call(this);
this.allTips = JsonEx.parse(tip.tips);
this.customFunc = {};
this.customFunc.initialize = (new Function("tip", JsonEx.parse(tip.initialize))).bind(this, this);
this.customFunc.create = (new Function("tip", JsonEx.parse(tip.create))).bind(this, this);
this.customFunc.update = (new Function("tip", JsonEx.parse(tip.update))).bind(this, this);
this.customFunc.terminate = (new Function("tip", JsonEx.parse(tip.terminate))).bind(this, this);
this.customFunc.canExit = (new Function("tip", JsonEx.parse(tip.canExit))).bind(this, this);
this.customFunc.initialize = new Function("tip", JsonEx.parse(tip.initialize)).bind(this, this);
this.customFunc.create = new Function("tip", JsonEx.parse(tip.create)).bind(this, this);
this.customFunc.update = new Function("tip", JsonEx.parse(tip.update)).bind(this, this);
this.customFunc.terminate = new Function("tip", JsonEx.parse(tip.terminate)).bind(this, this);
this.customFunc.canExit = new Function("tip", JsonEx.parse(tip.canExit)).bind(this, this);
this.customFunc.initialize();
};
@ -252,14 +253,14 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
Sprite.prototype.initialize.apply(this, null);
this.loopBitmaps = [];
JsonEx.parse(picture.pictures).forEach(function (fileName) {
this.loopBitmaps.push(Bitmap.load(fileName + '.png'));
this.loopBitmaps.push(Bitmap.load(fileName + ".png"));
}, this);
this.customFunc = {};
this.customFunc.initialize = (new Function("picture", JsonEx.parse(picture.initialize))).bind(this, this);
this.customFunc.create = (new Function("picture", JsonEx.parse(picture.create))).bind(this, this);
this.customFunc.update = (new Function("picture", JsonEx.parse(picture.update))).bind(this, this);
this.customFunc.terminate = (new Function("picture", JsonEx.parse(picture.terminate))).bind(this, this);
this.customFunc.canExit = (new Function("picture", JsonEx.parse(picture.canExit))).bind(this, this);
this.customFunc.initialize = new Function("picture", JsonEx.parse(picture.initialize)).bind(this, this);
this.customFunc.create = new Function("picture", JsonEx.parse(picture.create)).bind(this, this);
this.customFunc.update = new Function("picture", JsonEx.parse(picture.update)).bind(this, this);
this.customFunc.terminate = new Function("picture", JsonEx.parse(picture.terminate)).bind(this, this);
this.customFunc.canExit = new Function("picture", JsonEx.parse(picture.canExit)).bind(this, this);
this.customFunc.initialize();
};
@ -271,9 +272,7 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
this.customFunc.update();
};
LoadingScene_Picture.prototype.fadingInEnded = function () {
};
LoadingScene_Picture.prototype.fadingInEnded = function () {};
LoadingScene_Picture.prototype.canExit = function () {
return this.customFunc.canExit();
@ -289,7 +288,6 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
SF_LoadingScene.Graphics_setLoadingImage = Graphics.setLoadingImage;
Graphics.setLoadingImage = function (src) {
SF_LoadingScene.previousSceneSprite = new Sprite();
SF_LoadingScene.nextSceneSprite = new Sprite();
SF_LoadingScene.loadingScene = new PIXI.Container();
@ -312,7 +310,7 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
view: Graphics._upperCanvas,
transparent: true,
preserveDrawingBuffer: true,
clearBeforeRender: true
clearBeforeRender: true,
});
SF_LoadingScene.upperCanvasStatues = "";
@ -360,7 +358,6 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
SF_LoadingScene.newSceneLoaded = false;
SF_LoadingScene.animationFrameId = window.requestAnimationFrame(SF_LoadingScene.animationOnUpperCanvas);
return;
};
SF_LoadingScene.animationOnUpperCanvas = function () {
@ -372,11 +369,11 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
SF_LoadingScene.pixiRender.render(SF_LoadingScene.previousSceneSprite);
if (SF_LoadingScene.globalAlpha <= SF_LoadingScene.alphaMin) {
if (SF_LoadingScene.needLoopSceneFadeIn) {
SF_LoadingScene.upperCanvasStatues = 'fading_in_loading_scene';
SF_LoadingScene.upperCanvasStatues = "fading_in_loading_scene";
SF_LoadingScene.fadingIn = true;
SF_LoadingScene.fadingOut = false;
} else {
SF_LoadingScene.upperCanvasStatues = 'loop_loading_scene';
SF_LoadingScene.upperCanvasStatues = "loop_loading_scene";
SF_LoadingScene.fadingIn = false;
SF_LoadingScene.fadingOut = false;
SF_LoadingScene.globalAlpha = 1;
@ -430,7 +427,7 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
SF_LoadingScene.needContinue = false;
}
} else {
throw new SyntaxError('some error happen in SF_LoadingScene plugins');
throw new SyntaxError("some error happen in SF_LoadingScene plugins");
}
SF_LoadingScene.updateUpperCanvasAlpha();
@ -459,11 +456,14 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
};
SF_LoadingScene.canExitLoadingScene = function () {
return SF_LoadingScene.newSceneLoaded && SF_LoadingScene.loadingScene.children.every(function (child) {
return child.children.every(function (child) {
return child.canExit();
});
});
return (
SF_LoadingScene.newSceneLoaded &&
SF_LoadingScene.loadingScene.children.every(function (child) {
return child.children.every(function (child) {
return child.canExit();
});
})
);
};
SF_LoadingScene.terminateLoadingScene = function () {
@ -482,7 +482,6 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
}
};
SF_LoadingScene.Graphics_endLoading = Graphics.endLoading;
Graphics.endLoading = function () {
if (SceneManager._nextScene || isNaN(SF_LoadingScene.animationFrameId)) return;
@ -493,7 +492,7 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
};
SF_LoadingScene.Graphics_updateLoading = Graphics.updateLoading;
Graphics.updateLoading = function () { };
Graphics.updateLoading = function () {};
SF_LoadingScene.Graphics_clearUpperCanvas = Graphics._clearUpperCanvas;
Graphics._clearUpperCanvas = function () {
@ -503,5 +502,4 @@ if (!Imported.SF_InputBindControl || !Imported.SF_SkipLoadError) {
SF_LoadingScene.Graphics_clearUpperCanvas.apply(this, arguments);
}
};
})();

@ -11,49 +11,49 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc v1.0 Adds a window to the map screen that displays the name of the map.
* @author SaltedFish
*
* @param Map Name Window
*
* @param Map Name Window X
* @desc The X position of the map name window.
* @default 0
* @type text
* @parent Map Name Window
*
* @param Map Name Window Y
* @desc The Y position of the map name window.
* @default 0
* @type text
* @parent Map Name Window
*
* @param Map Name Window Width
* @desc The width of the map name window.
* @default Graphics.boxWidth
* @type text
* @parent Map Name Window
*
* @param Map Name Window Height
* @desc The height of the map name window.
* @default Graphics.boxHeight
* @type text
* @parent Map Name Window
*
* @param Map Name Window Font Size
* @desc The font size of the map name window.
* @default 28
* @type text
* @parent Map Name Window
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin adds a window to the map screen that displays the name of the map.
*
*/
* @plugindesc v1.0 Adds a window to the map screen that displays the name of the map.
* @author SaltedFish
*
* @param Map Name Window
*
* @param Map Name Window X
* @desc The X position of the map name window.
* @default 0
* @type text
* @parent Map Name Window
*
* @param Map Name Window Y
* @desc The Y position of the map name window.
* @default 0
* @type text
* @parent Map Name Window
*
* @param Map Name Window Width
* @desc The width of the map name window.
* @default Graphics.boxWidth
* @type text
* @parent Map Name Window
*
* @param Map Name Window Height
* @desc The height of the map name window.
* @default Graphics.boxHeight
* @type text
* @parent Map Name Window
*
* @param Map Name Window Font Size
* @desc The font size of the map name window.
* @default 28
* @type text
* @parent Map Name Window
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin adds a window to the map screen that displays the name of the map.
*
*/
//=============================================================================
(function () {
@ -65,24 +65,23 @@ var SF_Plugins = SF_Plugins || {};
// Parameters
//=============================================================================
SF_MapNameWindow.Parameters = PluginManager.parameters('SF_MapNameWindow');
SF_MapNameWindow.Parameters = PluginManager.parameters("SF_MapNameWindow");
SF_MapNameWindow.MapNameWindow_X = SF_MapNameWindow.Parameters['Map Name Window X'] || 0;
SF_MapNameWindow.MapNameWindow_Y = SF_MapNameWindow.Parameters['Map Name Window Y'] || 0;
SF_MapNameWindow.MapNameWindow_Width = SF_MapNameWindow.Parameters['Map Name Window Width'] || Graphics.boxWidth;
SF_MapNameWindow.MapNameWindow_Height = SF_MapNameWindow.Parameters['Map Name Window Height'] || Graphics.boxHeight;
SF_MapNameWindow.MapNameWindow_FontSize = SF_MapNameWindow.Parameters['Map Name Window Font Size'] || 28;
SF_MapNameWindow.MapNameWindow_X = SF_MapNameWindow.Parameters["Map Name Window X"] || 0;
SF_MapNameWindow.MapNameWindow_Y = SF_MapNameWindow.Parameters["Map Name Window Y"] || 0;
SF_MapNameWindow.MapNameWindow_Width = SF_MapNameWindow.Parameters["Map Name Window Width"] || Graphics.boxWidth;
SF_MapNameWindow.MapNameWindow_Height = SF_MapNameWindow.Parameters["Map Name Window Height"] || Graphics.boxHeight;
SF_MapNameWindow.MapNameWindow_FontSize = SF_MapNameWindow.Parameters["Map Name Window Font Size"] || 28;
SF_MapNameWindow.MapNameWindow_ShowOpacity = 180;
SF_MapNameWindow.MapNameWindow_HideOpacity = 50;
//=============================================================================
// Winddow_SFMapName
// Winddow_SFMapName
//=============================================================================
/**
* The window that displays the name of the map.
*
*
* this._mapNameBitmap:
* The bitmap that displays the name of the map.
* -----------------------------------------------------------------------------
@ -110,28 +109,27 @@ var SF_Plugins = SF_Plugins || {};
Window_Base.prototype.initialize.call(this, this._x, this._y, this._width, this._height);
this.opacity = SF_MapNameWindow.MapNameWindow_ShowOpacity;
}
};
Window_SFMapName.prototype.windowWidth = function () {
return this._width;
}
};
Window_SFMapName.prototype.windowHeight = function () {
return this._height;
}
};
Window_SFMapName.prototype.standardFontSize = function () {
return this._fontSize;
}
};
Window_SFMapName.prototype.lineHeight = function () {
return this.standardFontSize() + 8;
}
};
Window_SFMapName.prototype.standardPadding = function () {
return 8;
}
};
Window_SFMapName.prototype.refresh = function () {
this.contents.clear();
@ -139,22 +137,26 @@ var SF_Plugins = SF_Plugins || {};
//this._windowContentsSprite.setFrame(this._mapNameOffset, 0, this.contentsWidth(), this.contentsHeight());
this.contents.blt(
this._mapNameBitmap,
this._mapNameOffset, 0,
this._mapNameOffset,
0,
this.contentsWidth(),
this.contentsHeight(),
0, 0
0,
0
);
} else {
//this.contents.setFrame(-this._mapNameOffset, 0, this.contentsWidth(), this.contentsHeight());
this.contents.blt(
this._mapNameBitmap,
this.contentsWidth(), 0,
this.contentsWidth(),
0,
this._mapNameBitmap.width - this.contentsWidth() * 2,
this._mapNameBitmap.height,
this._mapNameOffset, 0
this._mapNameOffset,
0
);
}
}
};
Window_SFMapName.prototype.update = function () {
Window_Base.prototype.update.call(this);
@ -166,7 +168,7 @@ var SF_Plugins = SF_Plugins || {};
this.refresh();
}
this.updatePlayerTouched();
}
};
Window_SFMapName.prototype.setMapName = function (mapName) {
this._mapName = mapName;
@ -188,7 +190,7 @@ var SF_Plugins = SF_Plugins || {};
this.contents = tmp_bitmap;
this.refresh();
}
};
Window_SFMapName.prototype.isPlayerTouched = function () {
var lx = $gamePlayer.screenX() - 40;
@ -196,8 +198,8 @@ var SF_Plugins = SF_Plugins || {};
var ty = $gamePlayer.screenY() - 80;
var by = $gamePlayer.screenY() + 20;
if (rx < this._x || by < this._y) return false;
if (lx > (this._x + this._width)) return false;
if (ty > (this._y + this._height)) return false;
if (lx > this._x + this._width) return false;
if (ty > this._y + this._height) return false;
return true;
};
@ -207,7 +209,7 @@ var SF_Plugins = SF_Plugins || {};
} else {
this.opacity = SF_MapNameWindow.MapNameWindow_ShowOpacity;
}
}
};
//=============================================================================
// Scene_Map
//=============================================================================
@ -222,5 +224,5 @@ var SF_Plugins = SF_Plugins || {};
this._sfmapNameWindow.open();
this._sfmapNameWindow.deactivate();
}
}
})();
};
})();

@ -13,164 +13,164 @@ var $dataQuests = null;
//=============================================================================
/*~struct~Quest:
* @param name
* @text Quest Name
* @desc The name of the quest.
* @type text
* @default
*
* @param desc
* @text Quest Description
* @desc The description of the quest.
* @type note
* @default
*
*/
* @param name
* @text Quest Name
* @desc The name of the quest.
* @type text
* @default
*
* @param desc
* @text Quest Description
* @desc The description of the quest.
* @type note
* @default
*
*/
/*:
* @plugindesc v1.0 Allows you to show quests.
* @author SaltedFish
*
* @param Quest List Window
*
* @param Quest List Window X
* @desc The X position of the quest list window.
* @default 0
* @type number
* @parent Quest List Window
*
* @param Quest List Window Y
* @desc The Y position of the quest list window.
* @default 0
* @type number
* @parent Quest List Window
*
* @param Quest List Window Width
* @desc The width of the quest list window.
* @default 240
* @type number
* @parent Quest List Window
*
* @param Quest List Window Height
* @desc The height of the quest list window.
* @default 480
* @type number
* @parent Quest List Window
*
* @param Quest List Window Font Size
* @desc The font size of the quest list window.
* @default 28
* @type number
* @parent Quest List Window
* @min 1
*
* @param Quest Detail Window
*
* @param Quest Detail Window X
* @desc The X position of the quest detail window.
* @default 0
* @type number
* @parent Quest Detail Window
*
* @param Quest Detail Window Y
* @desc The Y position of the quest detail window.
* @default 0
* @type number
* @parent Quest Detail Window
*
* @param Quest Detail Window Width
* @desc The width of the quest detail window.
* @default 240
* @type number
* @parent Quest Detail Window
*
* @param Quest Detail Window Height
* @desc The height of the quest detail window.
* @default 480
* @type number
* @parent Quest Detail Window
*
* @param Quest Detail Window Font Size
* @desc The font size of the quest detail window.
* @default 28
* @type number
* @parent Quest Detail Window
* @min 1
*
* @param Quest Editor
*
* @param Quest Editor Enable
* @desc Enable the quest editor.
* @default false
* @type boolean
* @parent Quest Editor
*
* @param Quest List Info X
* @desc The X position of the quest list info.
* @default 0
* @type number
* @parent Quest Editor
*
* @param Quest List Info Y
* @desc The Y position of the quest list info.
* @default 0
* @type number
* @parent Quest Editor
*
* @param Quest List Info Width
* @desc The width of the quest list info.
* @default 240
* @type number
* @parent Quest Editor
*
* @param Quest List Info Height
* @desc The height of the quest list info.
* @default 480
* @type number
* @parent Quest Editor
*
* @param Quest List Info Font Size
* @desc The font size of the quest list info.
* @default 28
* @type number
* @parent Quest Editor
* @min 1
*
*
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* plugin requirement:
* - SF_WindowScrollCommand
*
* Modified from Gameus's Quest System plugin.
* This plugin allows you to show quests.
*
* ============================================================================
* Plugin Commands
* ============================================================================
*
* SF_Quest Add QuestID
* Adds a quest to the player's quest list.
*
* SF_Quest Complete QuestID
* Marks a quest as completed.
*
* SF_Quest Open
* Opens the quest scene.
*
* ============================================================================
* Script Calls
* ============================================================================
*
* $gameParty.addQuest(questId)
* Adds a quest to the player's quest list.
*
* $gameParty.removeQuest(questId)
* Removes a quest from the player's quest list.
*/
* @plugindesc v1.0 Allows you to show quests.
* @author SaltedFish
*
* @param Quest List Window
*
* @param Quest List Window X
* @desc The X position of the quest list window.
* @default 0
* @type number
* @parent Quest List Window
*
* @param Quest List Window Y
* @desc The Y position of the quest list window.
* @default 0
* @type number
* @parent Quest List Window
*
* @param Quest List Window Width
* @desc The width of the quest list window.
* @default 240
* @type number
* @parent Quest List Window
*
* @param Quest List Window Height
* @desc The height of the quest list window.
* @default 480
* @type number
* @parent Quest List Window
*
* @param Quest List Window Font Size
* @desc The font size of the quest list window.
* @default 28
* @type number
* @parent Quest List Window
* @min 1
*
* @param Quest Detail Window
*
* @param Quest Detail Window X
* @desc The X position of the quest detail window.
* @default 0
* @type number
* @parent Quest Detail Window
*
* @param Quest Detail Window Y
* @desc The Y position of the quest detail window.
* @default 0
* @type number
* @parent Quest Detail Window
*
* @param Quest Detail Window Width
* @desc The width of the quest detail window.
* @default 240
* @type number
* @parent Quest Detail Window
*
* @param Quest Detail Window Height
* @desc The height of the quest detail window.
* @default 480
* @type number
* @parent Quest Detail Window
*
* @param Quest Detail Window Font Size
* @desc The font size of the quest detail window.
* @default 28
* @type number
* @parent Quest Detail Window
* @min 1
*
* @param Quest Editor
*
* @param Quest Editor Enable
* @desc Enable the quest editor.
* @default false
* @type boolean
* @parent Quest Editor
*
* @param Quest List Info X
* @desc The X position of the quest list info.
* @default 0
* @type number
* @parent Quest Editor
*
* @param Quest List Info Y
* @desc The Y position of the quest list info.
* @default 0
* @type number
* @parent Quest Editor
*
* @param Quest List Info Width
* @desc The width of the quest list info.
* @default 240
* @type number
* @parent Quest Editor
*
* @param Quest List Info Height
* @desc The height of the quest list info.
* @default 480
* @type number
* @parent Quest Editor
*
* @param Quest List Info Font Size
* @desc The font size of the quest list info.
* @default 28
* @type number
* @parent Quest Editor
* @min 1
*
*
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* plugin requirement:
* - SF_WindowScrollCommand
*
* Modified from Gameus's Quest System plugin.
* This plugin allows you to show quests.
*
* ============================================================================
* Plugin Commands
* ============================================================================
*
* SF_Quest Add QuestID
* Adds a quest to the player's quest list.
*
* SF_Quest Complete QuestID
* Marks a quest as completed.
*
* SF_Quest Open
* Opens the quest scene.
*
* ============================================================================
* Script Calls
* ============================================================================
*
* $gameParty.addQuest(questId)
* Adds a quest to the player's quest list.
*
* $gameParty.removeQuest(questId)
* Removes a quest from the player's quest list.
*/
//=============================================================================
//=============================================================================
@ -182,7 +182,6 @@ if (!Imported.SF_WindowScrollCommand) {
alert("SF_QuestSystem requires SF_WindowScrollCommand.");
}
(function () {
var SF_QuestSystem = {};
SF_Plugins.SF_QuestSystem = SF_QuestSystem;
SF_QuestSystem.version = 1.0;
@ -191,7 +190,7 @@ if (!Imported.SF_WindowScrollCommand) {
// Parameters
//=============================================================================
SF_QuestSystem.Parameters = PluginManager.parameters('SF_QuestSystem');
SF_QuestSystem.Parameters = PluginManager.parameters("SF_QuestSystem");
SF_QuestSystem.QuestListWindow_X = Number(SF_QuestSystem.Parameters["Quest List Window X"]);
SF_QuestSystem.QuestListWindow_Y = Number(SF_QuestSystem.Parameters["Quest List Window Y"]);
@ -217,7 +216,7 @@ if (!Imported.SF_WindowScrollCommand) {
quest.name = "";
quest.desc = "";
return quest;
}
};
//=============================================================================
// DataManager
@ -228,19 +227,19 @@ if (!Imported.SF_WindowScrollCommand) {
var contents = SF_QuestSystem.DataManager_makeSaveContents.call(this);
contents.quests = $gameQuests;
return contents;
}
};
SF_QuestSystem.DataManager_extractSaveContents = DataManager.extractSaveContents;
DataManager.extractSaveContents = function (contents) {
SF_QuestSystem.DataManager_extractSaveContents.call(this, contents);
$gameQuests = contents.quests;
}
};
SF_QuestSystem.DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function () {
SF_QuestSystem.DataManager_createGameObjects.call(this);
$gameQuests = new Game_Quests();
}
};
//=============================================================================
// Game_Quest
@ -257,15 +256,15 @@ if (!Imported.SF_WindowScrollCommand) {
this.name = questData.name;
this.desc = questData.desc;
this.status = "progress";
}
};
Game_Quest.prototype.completed = function () {
return this.status == "completed";
}
};
Game_Quest.prototype.inProgress = function () {
return this.status == "progress";
}
};
Game_Quest.prototype.complete = function () {
this.status = "completed";
@ -275,13 +274,12 @@ if (!Imported.SF_WindowScrollCommand) {
this.status = "progress";
};
//---------------------------------------------------------------------------------------------
// Game_Quests
//---------------------------------------------------------------------------------------------
function Game_Quests() {
this.initialize.apply(this, arguments);
};
}
Game_Quests.prototype.initialize = function () {
this.data = [];
@ -301,7 +299,7 @@ if (!Imported.SF_WindowScrollCommand) {
if (this.get(quest_id)) {
this.get(quest_id).complete();
}
}
};
//=============================================================================
// Game_Party
@ -347,8 +345,6 @@ if (!Imported.SF_WindowScrollCommand) {
return $gameQuests.get(quest_id);
};
//=============================================================================
// Window_QuestList
//=============================================================================
@ -365,30 +361,30 @@ if (!Imported.SF_WindowScrollCommand) {
Window_ScrollCommand.prototype.initialize.call(this, arguments);
this.x = SF_QuestSystem.QuestListWindow_X;
this.y = SF_QuestSystem.QuestListWindow_Y;
}
};
Window_QuestList.prototype.standardFontSize = function () {
return SF_QuestSystem.QuestListWindow_FontSize;
}
};
Window_QuestList.prototype.lineHeight = function () {
return this.standardFontSize() + 8;
}
};
// Sets the filter for the quest list
// "completed" - Completed quests
// "progress" - In progress quests
Window_QuestList.prototype.setFilter = function (filter) {
this._filter = filter;
}
};
Window_QuestList.prototype.windowWidth = function () {
return SF_QuestSystem.QuestListWindowWidth;
}
};
Window_QuestList.prototype.windowHeight = function () {
return SF_QuestSystem.QuestListWindowHeight;
}
};
Window_QuestList.prototype.makeCommandList = function () {
for (var i = 0; i < $gameParty.quests.length; i += 1) {
@ -397,14 +393,14 @@ if (!Imported.SF_WindowScrollCommand) {
this.addCommand(quest.name, "quest", true, $gameParty.quests[i]);
}
}
}
};
Window_QuestList.prototype.updateHelp = function () {
Window_ScrollCommand.prototype.updateHelp.call(this);
if (this._helpWindow) {
this._helpWindow.setQuest(this.currentExt());
}
}
};
//=============================================================================
// Window_QuestDetail
@ -418,29 +414,31 @@ if (!Imported.SF_WindowScrollCommand) {
Window_QuestDetail.prototype.constructor = Window_QuestDetail;
Window_QuestDetail.prototype.initialize = function () {
Window_ScrollHelp.prototype.initialize.call(this,
Window_ScrollHelp.prototype.initialize.call(
this,
SF_QuestSystem.QuestDetailWindowX,
SF_QuestSystem.QuestDetailWindowY,
SF_QuestSystem.QuestDetailWindowWidth,
SF_QuestSystem.QuestDetailWindowHeight);
SF_QuestSystem.QuestDetailWindowHeight
);
this._questId = null;
}
};
Window_QuestDetail.prototype.windowWidth = function () {
return SF_QuestSystem.QuestDetailWindowWidth;
}
};
Window_QuestDetail.prototype.lineHeight = function () {
return this.standardFontSize() + 8;
}
};
Window_QuestDetail.prototype.standardFontSize = function () {
return SF_QuestSystem.QuestDetailWindowFontSize;
}
};
Window_QuestDetail.prototype.windowHeight = function () {
return SF_QuestSystem.QuestDetailWindowHeight;
}
};
Window_QuestDetail.prototype.setQuest = function (questId) {
this._questId = questId;
@ -448,7 +446,7 @@ if (!Imported.SF_WindowScrollCommand) {
var quest = $gameQuests.get(this._questId);
this.setText(quest.desc);
}
}
};
//=============================================================================
// Scene_Quest
@ -465,33 +463,33 @@ if (!Imported.SF_WindowScrollCommand) {
Scene_Quest.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
}
};
Scene_Quest.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
this.createQuestDetailWindow();
this.createQuestListWindow();
this._questListWindow.setHelpWindow(this._questDetailWindow);
}
};
Scene_Quest.prototype.createQuestListWindow = function () {
this._questListWindow = new Window_QuestList();
this._questListWindow.setHandler("quest", this.onQuestListOk.bind(this));
this._questListWindow.setHandler("cancel", this.popScene.bind(this));
this.addWindow(this._questListWindow);
}
};
Scene_Quest.prototype.createQuestDetailWindow = function () {
this._questDetailWindow = new Window_QuestDetail();
//this._questDetailWindow.setHandler("cancel", this.popScene.bind(this));
this.addWindow(this._questDetailWindow);
}
};
Scene_Quest.prototype.onQuestListOk = function () {
//var questId = this._questListWindow.currentExt();
//this._questDetailWindow.setQuest(questId);
this._questListWindow.activate();
}
};
//=============================================================================
// Game_Interpreter
@ -514,17 +512,16 @@ if (!Imported.SF_WindowScrollCommand) {
break;
}
}
}
};
if (Utils.isNwjs() && SF_QuestSystem.QuestEditorEnable) {
var fs = require('fs');
var path = require('path');
var process = require('process');
var quest_path = path.join(process.cwd(), 'data/Quests.json');
var fs = require("fs");
var path = require("path");
var process = require("process");
var quest_path = path.join(process.cwd(), "data/Quests.json");
var quest_data = null;
if (fs.existsSync(quest_path)) {
quest_data = JsonEx.parse(fs.readFileSync(quest_path, 'utf8'));
quest_data = JsonEx.parse(fs.readFileSync(quest_path, "utf8"));
} else {
quest_data = [SF_QuestSystem.default_quest()];
}
@ -544,45 +541,50 @@ if (!Imported.SF_WindowScrollCommand) {
Window_ScrollCommand.prototype.initialize.call(this);
this.x = SF_QuestSystem.QuestListInfoX;
this.y = SF_QuestSystem.QuestListInfoY;
}
};
Window_QuestListInfo.prototype.windowWidth = function () {
return SF_QuestSystem.QuestListInfoWidth;
}
};
Window_QuestListInfo.prototype.windowHeight = function () {
return SF_QuestSystem.QuestListInfoHeight;
}
};
Window_QuestListInfo.prototype.standardFontSize = function () {
return SF_QuestSystem.QuestListInfoFontSize;
}
};
Window_QuestListInfo.prototype.lineHeight = function () {
return this.standardFontSize() + 8;
}
};
Window_QuestListInfo.prototype.makeCommandList = function () {
var i;
for (i = 0; i * quest_one_page + 1 < quest_data.length; i++) {
this.addCommand(`${i * quest_one_page + 1}-${i * quest_one_page + quest_one_page}`, 'quest_page', true, i);
this.addCommand(
`${i * quest_one_page + 1}-${i * quest_one_page + quest_one_page}`,
"quest_page",
true,
i
);
}
if (i * quest_one_page + 1 == quest_data.length) {
this.addCommand('newpage', 'newpage');
this.addCommand("newpage", "newpage");
}
}
};
Window_QuestListInfo.prototype.select = function (index) {
Window_ScrollCommand.prototype.select.call(this, index);
if (index >= 0 && this.currentSymbol() == 'quest_page' && this._questListWindow) {
if (index >= 0 && this.currentSymbol() == "quest_page" && this._questListWindow) {
this._questListWindow.setPage(this.currentExt());
}
}
};
Window_QuestListInfo.prototype.newPage = function () {
quest_data.push(SF_QuestSystem.default_quest());
this.refresh();
}
};
//=============================================================================
// Window_QuestList
//=============================================================================
@ -592,43 +594,42 @@ if (!Imported.SF_WindowScrollCommand) {
this.x = SF_QuestSystem.QuestListWindow_X;
this.y = SF_QuestSystem.QuestListWindow_Y;
this._page = null;
}
};
Window_QuestList.prototype.setPage = function (page) {
this._page = page;
this.refresh();
}
};
Window_QuestList.prototype.makeCommandList = function () {
if (this._page >= 0) {
for (var i = this._page * quest_one_page + 1; i <= (this._page + 1) * quest_one_page; i++) {
if (i >= quest_data.length) {
this.addCommand('newquest', 'newquest');
this.addCommand("newquest", "newquest");
break;
}
this.addCommand(quest_data[i].name, 'quest', true, i);
this.addCommand(quest_data[i].name, "quest", true, i);
}
}
}
};
Window_QuestList.prototype.newQuest = function () {
quest_data.splice(quest_data.length, 0, SF_QuestSystem.default_quest());
this.refresh();
var i;
for (i = 0; i * quest_one_page + 1 < quest_data.length; i++) {
}
for (i = 0; i * quest_one_page + 1 < quest_data.length; i++) {}
if (i * quest_one_page + 1 == quest_data.length) {
this._questListInfoWindow.addCommand('newpage', 'newpage');
this._questListInfoWindow.addCommand("newpage", "newpage");
this._questListInfoWindow.refresh();
}
}
};
Window_QuestList.prototype.updateHelp = function () {
Window_ScrollCommand.prototype.updateHelp.call(this);
if (this._helpWindow) {
this._helpWindow.setQuest(this.currentExt());
}
}
};
//=============================================================================
// Window_QuestDetail
@ -636,7 +637,7 @@ if (!Imported.SF_WindowScrollCommand) {
Window_QuestDetail.prototype.clear = function () {
this.contents.clear();
}
};
Window_QuestDetail.prototype.setQuest = function (questId) {
this._questId = questId;
@ -664,7 +665,7 @@ if (!Imported.SF_WindowScrollCommand) {
}
this.refresh();
}
};
//=============================================================================
// Scene_Quest_Editor
@ -681,7 +682,7 @@ if (!Imported.SF_WindowScrollCommand) {
Scene_QuestEditor.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
this.createEditorDiv();
}
};
Scene_QuestEditor.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
@ -694,7 +695,7 @@ if (!Imported.SF_WindowScrollCommand) {
this._questListWindow._questListInfoWindow = this._questListInfoWindow;
this._questListInfoWindow.select(0);
this._questListWindow.select(0);
}
};
Scene_QuestEditor.prototype.createQuestListWindow = function () {
this._questListWindow = new Window_QuestList();
@ -702,20 +703,20 @@ if (!Imported.SF_WindowScrollCommand) {
this._questListWindow.setHandler("newquest", this.onQuestListNewQuest.bind(this));
//this._questListWindow.setHandler("cancel", this.onQuestListCancel.bind(this));
this.addWindow(this._questListWindow);
}
};
Scene_QuestEditor.prototype.createQuestListInfoWindow = function () {
this._questListInfoWindow = new Window_QuestListInfo();
// this._questListInfoWindow.setHandler("cancel", this.popScene.bind(this));
this._questListInfoWindow.setHandler('quest_page', this.onQuestListInfoPage.bind(this));
this._questListInfoWindow.setHandler('newpage', this.onQuestListInfoNewPage.bind(this));
this._questListInfoWindow.setHandler("quest_page", this.onQuestListInfoPage.bind(this));
this._questListInfoWindow.setHandler("newpage", this.onQuestListInfoNewPage.bind(this));
this.addWindow(this._questListInfoWindow);
}
};
Scene_QuestEditor.prototype.createQuestDetailWindow = function () {
this._questDetailWindow = new Window_QuestDetail();
this.addWindow(this._questDetailWindow);
}
};
Scene_QuestEditor.prototype.onQuestListOk = function () {
this._questListWindow.deactivate();
@ -729,32 +730,37 @@ if (!Imported.SF_WindowScrollCommand) {
this._editor_desc = document.getElementById("quest_editor_desc");
this._editor_save = document.getElementById("quest_editor_save");
this._editor_cancel = document.getElementById("quest_editor_cancel");
this._editor_save.addEventListener('click', this._editor_save_bind);
this._editor_cancel.addEventListener('click', this._editor_cancel_bind);
this._editor_save.addEventListener("click", this._editor_save_bind);
this._editor_cancel.addEventListener("click", this._editor_cancel_bind);
this._editor_name.value = quest_data[this._questListWindow._questId].name;
this._editor_desc.value = quest_data[this._questListWindow._questId].desc;
}
};
Scene_QuestEditor.prototype.onQuestListNewQuest = function () {
this._questListWindow.newQuest();
this._questListWindow.activate();
}
};
Scene_QuestEditor.prototype.onQuestListInfoPage = function () {
this._questListInfoWindow.activate();
}
};
Scene_QuestEditor.prototype.onQuestListInfoNewPage = function () {
this._questListInfoWindow.newPage();
this._questListInfoWindow.activate();
}
};
Scene_QuestEditor.prototype.createEditorDiv = function () {
var canvas = document.getElementById("UpperCanvas");
this._editor_div = this._editor_div || document.createElement("div");
this._editor_div.setAttribute("style", "position: absolute;margin: auto; top: 0px; left: 0px; right: 0px; bottom: 0px;z-index: 1000; height:" +
canvas.offsetHeight + "px; width:" + canvas.offsetWidth + "px; background-color: rgba(0, 0, 0, 0.3); color: #FFFFFF; user-select:text;");
this._editor_div.setAttribute(
"style",
"position: absolute;margin: auto; top: 0px; left: 0px; right: 0px; bottom: 0px;z-index: 1000; height:" +
canvas.offsetHeight +
"px; width:" +
canvas.offsetWidth +
"px; background-color: rgba(0, 0, 0, 0.3); color: #FFFFFF; user-select:text;"
);
this._editor_div.setAttribute("id", "quest_editor");
this._editor_div.innerHTML = `
@ -768,7 +774,7 @@ if (!Imported.SF_WindowScrollCommand) {
`;
this._editor_save_bind = this.onEditorSave.bind(this);
this._editor_cancel_bind = this.onEditorCancel.bind(this);
}
};
Scene_QuestEditor.prototype.onEditorSave = function () {
var quest = quest_data[this._questListWindow._questId];
@ -776,7 +782,7 @@ if (!Imported.SF_WindowScrollCommand) {
quest.desc = this._editor_desc.value;
fs.writeFileSync(quest_path, JsonEx.stringify(quest_data));
this.onEditorCancel();
}
};
Scene_QuestEditor.prototype.onEditorCancel = function () {
this._editor_div.remove();
@ -790,7 +796,7 @@ if (!Imported.SF_WindowScrollCommand) {
this._questListInfoWindow.activate();
this._questListWindow.refresh();
this._questListWindow.selectExt(this._questListWindow._questId);
}
};
//=============================================================================
// Scene_Title
@ -798,13 +804,12 @@ if (!Imported.SF_WindowScrollCommand) {
Scene_Title.prototype.start = function () {
SceneManager.goto(Scene_QuestEditor);
}
};
} else {
//=============================================================================
// DataManager
//=============================================================================
DataManager._databaseFiles.push({ name: '$dataQuests', src: 'Quests.json' });
DataManager._databaseFiles.push({ name: "$dataQuests", src: "Quests.json" });
}
})();
})();

@ -10,9 +10,9 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc Scene Actor
* @author Salted Fish
*/
* @plugindesc Scene Actor
* @author Salted Fish
*/
//=============================================================================
(function () {
@ -53,15 +53,15 @@ var SF_Plugins = SF_Plugins || {};
Game_Actor.prototype.equipSlots = function () {
var slots = [1, 2, 3, 4, 5, 6, 7, 7];
slots = slots.map(function (id) { return id; });
slots = slots.map(function (id) {
return id;
});
if (slots.length >= 2 && this.isDualWield()) {
slots[1] = 1;
}
return slots;
};
//=============================================================================
// Window_ActorSelect
//=============================================================================
@ -75,15 +75,15 @@ var SF_Plugins = SF_Plugins || {};
Window_ActorSelect.prototype._refreshBack = function () {
// nothing to do
}
};
Window_ActorSelect.prototype._refreshFrame = function () {
// nothing to do
}
};
Window_ActorSelect.prototype.standardPadding = function () {
return 0;
}
};
Window_ActorSelect.prototype.initialize = function () {
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Graphics.boxHeight);
@ -99,7 +99,7 @@ var SF_Plugins = SF_Plugins || {};
this._pageNumber = 0;
this._pageSize = 12;
this._maxPage = Math.ceil(this._actorList.length / this._pageSize);
this._faceBackBitmap = ImageManager.loadSceneActorSelect('face_back');
this._faceBackBitmap = ImageManager.loadSceneActorSelect("face_back");
this._handler = null;
};
@ -117,33 +117,39 @@ var SF_Plugins = SF_Plugins || {};
}
index++;
}
}
};
Window_ActorSelect.prototype.drawItem = function (index) {
var actor = this._actorList[index];
var rect = this.itemRect(index);
this.contents.blt(this._faceBackBitmap,
0, 0, this._faceBackBitmap.width, this._faceBackBitmap.height,
rect.x, rect.y)
this.contents.blt(
this._faceBackBitmap,
0,
0,
this._faceBackBitmap.width,
this._faceBackBitmap.height,
rect.x,
rect.y
);
this.drawActorFace(actor, rect.x, rect.y, rect.width, rect.width);
this.drawActorName(actor, rect.x, rect.y + rect.width, rect.width, rect.height - rect.width);
}
};
Window_ActorSelect.prototype.drawActorFace = function (actor, x, y, width, height) {
var faceIndex = actor.faceIndex();
var bitmap = this._actorBitmap[actor.faceName()];
var pw = Window_Base._faceWidth;
var ph = Window_Base._faceHeight;
var sx = faceIndex % 4 * pw;
var sx = (faceIndex % 4) * pw;
var sy = Math.floor(faceIndex / 4) * ph;
this.contents.blt(bitmap, sx, sy, pw, ph, x, y, width, height);
}
};
Window_ActorSelect.prototype.drawActorName = function (actor, x, y, width, height) {
this.changeTextColor(this.normalColor());
this.contents.fontSize = 20;
this.contents.drawText(actor.name(), x, y, width, height, 'center');
}
this.contents.drawText(actor.name(), x, y, width, height, "center");
};
Window_ActorSelect.prototype.itemRect = function (index) {
var rect = new Rectangle();
@ -153,27 +159,27 @@ var SF_Plugins = SF_Plugins || {};
rect.x = (i % 6) * (rect.width + 33) + 58;
rect.y = Math.floor(i / 6) * (rect.height + 40) + 93;
return rect;
}
};
Window_ActorSelect.prototype.maxPage = function () {
return this._maxPage;
}
};
Window_ActorSelect.prototype.pageNumber = function () {
return this._pageNumber;
}
};
Window_ActorSelect.prototype.setPageNumber = function (pageNumber) {
this._pageNumber = pageNumber;
this.refresh();
}
};
Window_ActorSelect.prototype.update = function () {
Window_Base.prototype.update.call(this);
if (this.isOpenAndActive()) {
this.updateInput();
}
}
};
Window_ActorSelect.prototype.updateInput = function () {
if (TouchInput.isTriggered()) {
@ -184,7 +190,7 @@ var SF_Plugins = SF_Plugins || {};
this.callHandler(index + this._pageNumber * this._pageSize);
}
}
}
};
Window_ActorSelect.prototype.hitTest = function (x, y) {
x = x - 58;
@ -200,7 +206,7 @@ var SF_Plugins = SF_Plugins || {};
return -1;
}
return row * 6 + col;
}
};
Window_ActorSelect.prototype.callHandler = function (index) {
if (index >= 0 && index < this._actorList.length) {
@ -208,12 +214,11 @@ var SF_Plugins = SF_Plugins || {};
this._handler(this._actorList[index]);
}
}
}
};
Window_ActorSelect.prototype.setHandler = function (handler) {
this._handler = handler;
}
};
//=============================================================================
// Scene_ActorSelect
@ -230,53 +235,53 @@ var SF_Plugins = SF_Plugins || {};
Scene_ActorSelect.prototype.createBackground = function () {
this._backgroundSprite = new Sprite();
this._backgroundSprite.bitmap = ImageManager.loadSceneActorSelect('background');
this._backgroundSprite.bitmap = ImageManager.loadSceneActorSelect("background");
this.addChild(this._backgroundSprite);
}
};
Scene_ActorSelect.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
}
};
Scene_ActorSelect.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
this.createActorSelectWindow();
this.createCancelButton();
this.createPageButtons();
}
};
Scene_ActorSelect.prototype.start = function () {
Scene_MenuBase.prototype.start.call(this);
this._actorSelectWindow.setPageNumber(0);
this.updatePageButtons();
this.updatePageNumber();
}
};
Scene_ActorSelect.prototype.createActorSelectWindow = function () {
this._actorSelectWindow = new Window_ActorSelect();
this._actorSelectWindow.setHandler(this.onActorSelect.bind(this));
this.addChild(this._actorSelectWindow);
}
};
Scene_ActorSelect.prototype.onActorSelect = function (actor) {
SF_SceneActor._actorSelected = actor;
SceneManager.push(Scene_Actor);
}
};
Scene_ActorSelect.prototype.createCancelButton = function () {
this._cancelButton = new Sprite_SFButton();
var bitmap = ImageManager.loadSceneActorSelect('cancel');
var bitmap = ImageManager.loadSceneActorSelect("cancel");
this._cancelButton.setColdBitmap(bitmap);
this._cancelButton.setHotBitmap(bitmap);
this._cancelButton.setClickHandler(this.onCancelButtonClick.bind(this));
this._cancelButton.refresh();
this._cancelButton.move(21, 7);
this.addChild(this._cancelButton);
}
};
Scene_ActorSelect.prototype.onCancelButtonClick = function () {
this.popScene();
}
};
Scene_ActorSelect.prototype.updatePageButtons = function () {
var num = this._actorSelectWindow.pageNumber();
@ -296,20 +301,19 @@ var SF_Plugins = SF_Plugins || {};
this._pageDownButton.activate();
this._pageDownButton.visible = true;
}
}
};
Scene_ActorSelect.prototype.updatePageNumber = function () {
var num = this._actorSelectWindow.pageNumber();
var bitmap = this._pageNumberText.bitmap;
bitmap.clear();
bitmap.fontSize = 16;
bitmap.drawText(num + 1, 0, 0, bitmap.width, bitmap.height, 'center');
}
bitmap.drawText(num + 1, 0, 0, bitmap.width, bitmap.height, "center");
};
Scene_ActorSelect.prototype.createPageButtons = function () {
this._pageUpButton = new Sprite_SFButton();
var bitmap = ImageManager.loadSceneActorSelect('page_up');
var bitmap = ImageManager.loadSceneActorSelect("page_up");
this._pageUpButton.setColdBitmap(bitmap);
this._pageUpButton.setHotBitmap(bitmap);
this._pageUpButton.setClickHandler(this.onPageUpButtonClick.bind(this));
@ -318,7 +322,7 @@ var SF_Plugins = SF_Plugins || {};
this.addChild(this._pageUpButton);
this._pageDownButton = new Sprite_SFButton();
var bitmap = ImageManager.loadSceneActorSelect('page_down');
var bitmap = ImageManager.loadSceneActorSelect("page_down");
this._pageDownButton.setColdBitmap(bitmap);
this._pageDownButton.setHotBitmap(bitmap);
this._pageDownButton.setClickHandler(this.onPageDownButtonClick.bind(this));
@ -328,27 +332,26 @@ var SF_Plugins = SF_Plugins || {};
this._pageNumberContainer = new PIXI.Container();
this._pageNumberContainer.position.set(493, 493);
this._pageNumberBackSprite = new Sprite(ImageManager.loadSceneActorSelect('num_back'));
this._pageNumberBackSprite = new Sprite(ImageManager.loadSceneActorSelect("num_back"));
this.addChild(this._pageNumberContainer);
this._pageNumberContainer.addChild(this._pageNumberBackSprite);
this._pageNumberText = new Sprite(new Bitmap(40, 40));
this._pageNumberText.move(0, 0);
this._pageNumberContainer.addChild(this._pageNumberText);
}
};
Scene_ActorSelect.prototype.onPageUpButtonClick = function () {
this._actorSelectWindow.setPageNumber(this._actorSelectWindow.pageNumber() - 1);
this.updatePageButtons();
this.updatePageNumber();
}
};
Scene_ActorSelect.prototype.onPageDownButtonClick = function () {
this._actorSelectWindow.setPageNumber(this._actorSelectWindow.pageNumber() + 1);
this.updatePageButtons();
this.updatePageNumber();
}
};
//=============================================================================
// Window_ActorProps
@ -363,51 +366,52 @@ var SF_Plugins = SF_Plugins || {};
Window_ActorProps.prototype._refreshBack = function () {
// nothing to do here
}
};
Window_ActorProps.prototype._refreshFrame = function () {
this._windowFrameSprite.bitmap = ImageManager.loadSceneActor('actor_prop');
}
this._windowFrameSprite.bitmap = ImageManager.loadSceneActor("actor_prop");
};
Window_ActorProps.prototype.initialize = function () {
Window_Base.prototype.initialize.apply(this, arguments);
this._key_position = {
"mhp": [70, 96],
"mmp": [300, 96],
"atk": [70, 120],
"mat": [300, 120],
"def": [70, 144],
"mdf": [300, 144],
"agi": [70, 168],
"cri": [300, 168],
"hit": [70, 192],
"eva": [300, 192],
}
mhp: [70, 96],
mmp: [300, 96],
atk: [70, 120],
mat: [300, 120],
def: [70, 144],
mdf: [300, 144],
agi: [70, 168],
cri: [300, 168],
hit: [70, 192],
eva: [300, 192],
};
this._actor = null;
this._states = [];
this._statePage = 0;
this._stateMaxPage = 0;
this._stateMaxInPage = 6;
this._iconBitmap = ImageManager.loadSystem('IconSet');
this._iconBitmap = ImageManager.loadSystem("IconSet");
this._stateWidth = 133;
this._stateHeight = 44;
this._statePaddingX = 35;
this._statePaddingY = 18;
}
};
Window_ActorProps.prototype.standardPadding = function () {
return 0;
}
};
Window_ActorProps.prototype.setActor = function (actor) {
this._actor = actor;
this.refresh();
}
};
Window_ActorProps.prototype.refresh = function () {
if (!this._actor) { return; }
if (!this._actor) {
return;
}
this.contents.clear();
this.contents.fontSize = 18;
for (var key in this._key_position) {
@ -418,7 +422,7 @@ var SF_Plugins = SF_Plugins || {};
this._statePage = 0;
this._stateMaxPage = Math.floor(this._states.length / this._stateMaxInPage);
this.drawActorStatePage();
}
};
Window_ActorProps.prototype.drawActorParam = function (actor, key) {
var x = this._key_position[key][0];
@ -430,10 +434,8 @@ var SF_Plugins = SF_Plugins || {};
} else {
text = value.toString();
}
this.contents.drawText(text, x, y, 180, 24, 'right');
}
this.contents.drawText(text, x, y, 180, 24, "right");
};
Window_ActorProps.prototype.getStateRect = function (index) {
var i = index - this._statePage * this._stateMaxInPage;
@ -442,7 +444,7 @@ var SF_Plugins = SF_Plugins || {};
var x = 23 + (i % 3) * (sw + this._statePaddingX);
var y = 278 + Math.floor(i / 3) * (sh + this._statePaddingY);
return new Rectangle(x, y, sw, sh);
}
};
Window_ActorProps.prototype.drawActorStatePage = function () {
var pw = Window_Base._iconWidth;
@ -455,15 +457,32 @@ var SF_Plugins = SF_Plugins || {};
if (index < this._states.length) {
var state = this._states[index];
var iconIndex = state.iconIndex;
var sx = iconIndex % 116 * pw;
var sx = (iconIndex % 116) * pw;
var sy = Math.floor(iconIndex / 16) * ph;
this.contents.blt(this._iconBitmap, sx, sy, pw, ph, rect.x, rect.y, this._stateHeight, this._stateHeight);
this.contents.blt(
this._iconBitmap,
sx,
sy,
pw,
ph,
rect.x,
rect.y,
this._stateHeight,
this._stateHeight
);
var text = state.name;
this.contents.drawText(text, rect.x + this._stateHeight, rect.y, rect.width - this._stateHeight, this._stateHeight, 'left');
this.contents.drawText(
text,
rect.x + this._stateHeight,
rect.y,
rect.width - this._stateHeight,
this._stateHeight,
"left"
);
}
}
}
};
//=============================================================================
// Window_ActorSkill
@ -478,11 +497,11 @@ var SF_Plugins = SF_Plugins || {};
Window_ActorSkill.prototype._refreshBack = function () {
// nothing to do here
}
};
Window_ActorSkill.prototype._refreshFrame = function () {
this._windowFrameSprite.bitmap = ImageManager.loadSceneActor('actor_skill');
}
this._windowFrameSprite.bitmap = ImageManager.loadSceneActor("actor_skill");
};
Window_ActorSkill.prototype.initialize = function () {
Window_Base.prototype.initialize.apply(this, arguments);
@ -497,20 +516,20 @@ var SF_Plugins = SF_Plugins || {};
this._skillPaddingX = 9;
this._skillPaddingY = 17;
this._iconBitmap = ImageManager.loadSystem('IconSet');
this._skillBackBitmap = ImageManager.loadSceneActor('skill_back');
this._iconBitmap = ImageManager.loadSystem("IconSet");
this._skillBackBitmap = ImageManager.loadSceneActor("skill_back");
this._skillHandler = null;
this.createPageButtons();
}
};
Window_ActorSkill.prototype.standardPadding = function () {
return 0;
}
};
Window_ActorSkill.prototype.createPageButtons = function () {
var bitmap = null;
bitmap = ImageManager.loadSceneActor('skill_page_up');
bitmap = ImageManager.loadSceneActor("skill_page_up");
this._pageUpButton = new Sprite_SFButton();
this._pageUpButton.setColdBitmap(bitmap);
this._pageUpButton.setHotBitmap(bitmap);
@ -519,7 +538,7 @@ var SF_Plugins = SF_Plugins || {};
this._pageUpButton.move(214, 372);
this.addChild(this._pageUpButton);
bitmap = ImageManager.loadSceneActor('skill_page_down');
bitmap = ImageManager.loadSceneActor("skill_page_down");
this._pageDownButton = new Sprite_SFButton();
this._pageDownButton.setColdBitmap(bitmap);
this._pageDownButton.setHotBitmap(bitmap);
@ -533,7 +552,7 @@ var SF_Plugins = SF_Plugins || {};
this._pageNumberContainer = new PIXI.Container();
this._pageNumberContainer.position.set(236, 372);
this._pageNumberBackSprite = new Sprite(ImageManager.loadSceneActor('skill_page_number_back'));
this._pageNumberBackSprite = new Sprite(ImageManager.loadSceneActor("skill_page_number_back"));
this.addChild(this._pageNumberContainer);
this._pageNumberContainer.addChild(this._pageNumberBackSprite);
@ -541,17 +560,17 @@ var SF_Plugins = SF_Plugins || {};
this._pageNumberText.move(0, 0);
this._pageNumberText.bitmap.fontSize = 14;
this._pageNumberContainer.addChild(this._pageNumberText);
}
};
Window_ActorSkill.prototype.onPageUpButtonClick = function () {
this._skillPage--;
this.refresh();
}
};
Window_ActorSkill.prototype.onPageDownButtonClick = function () {
this._skillPage++;
this.refresh();
}
};
Window_ActorSkill.prototype.setActor = function (actor) {
this._actor = actor;
@ -561,16 +580,18 @@ var SF_Plugins = SF_Plugins || {};
this._skillPage = 0;
this._skillMaxPage = Math.ceil(this._skillList.length / this._skillMaxInPage);
this.refresh();
}
};
Window_ActorSkill.prototype.refresh = function () {
if (!this._actor) { return; }
if (!this._actor) {
return;
}
this.contents.clear();
this.drawActorSkillPage();
this.updatePageButtons();
this.updatePageNumber();
}
};
Window_ActorSkill.prototype.updatePageButtons = function () {
this._pageUpButton.visible = this._skillPage > 0;
@ -587,12 +608,12 @@ var SF_Plugins = SF_Plugins || {};
} else {
this._pageDownButton.deactivate();
}
}
};
Window_ActorSkill.prototype.updatePageNumber = function () {
this._pageNumberText.bitmap.clear();
this._pageNumberText.bitmap.drawText(this._skillPage + 1, 0, 0, 22, 22, 'center');
}
this._pageNumberText.bitmap.drawText(this._skillPage + 1, 0, 0, 22, 22, "center");
};
Window_ActorSkill.prototype.getSkillRect = function (index) {
var i = index - this._skillPage * this._skillMaxInPage;
@ -601,7 +622,7 @@ var SF_Plugins = SF_Plugins || {};
var x = 23 + (i % 3) * (sw + this._skillPaddingX);
var y = 62 + Math.floor(i / 3) * (sh + this._skillPaddingY);
return new Rectangle(x, y, sw, sh);
}
};
Window_ActorSkill.prototype.drawActorSkillPage = function () {
var pw = Window_Base._iconWidth;
@ -613,26 +634,39 @@ var SF_Plugins = SF_Plugins || {};
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
this.contents.blt(
this._skillBackBitmap,
0, 0, this._skillBackBitmap.width, this._skillBackBitmap.height,
rect.x, rect.y, rect.width, rect.height
0,
0,
this._skillBackBitmap.width,
this._skillBackBitmap.height,
rect.x,
rect.y,
rect.width,
rect.height
);
var skill = this._skillList[index];
var iconIndex = skill.iconIndex;
var sx = iconIndex % 16 * pw;
var sx = (iconIndex % 16) * pw;
var sy = Math.floor(iconIndex / 16) * ph;
this.contents.blt(this._iconBitmap, sx, sy, pw, ph, rect.x, rect.y, this._skillHeight, this._skillHeight);
var text = skill.name;
this.contents.drawText(text, rect.x + this._skillHeight, rect.y, rect.width - this._skillHeight, this._skillHeight, 'left');
this.contents.drawText(
text,
rect.x + this._skillHeight,
rect.y,
rect.width - this._skillHeight,
this._skillHeight,
"left"
);
}
}
};
Window_ActorSkill.prototype.update = function () {
Window_Base.prototype.update.apply(this, arguments);
if (this.isOpenAndActive()) {
this.updateInput();
}
}
};
Window_ActorSkill.prototype.updateInput = function () {
if (TouchInput.isTriggered()) {
@ -647,35 +681,35 @@ var SF_Plugins = SF_Plugins || {};
}
}
}
}
};
Window_ActorSkill.prototype.callSkillHandler = function (skill) {
if (skill && this._skillHandler) {
this._skillHandler(skill);
}
}
};
Window_ActorSkill.prototype.setSkillHandler = function (handler) {
this._skillHandler = handler;
}
};
Window_ActorSkill.prototype.hitTest = function (x, y) {
x = x - 23;
y = y - 62;
if (x < 0 || y < 0) { return -1; }
if (x < 0 || y < 0) {
return -1;
}
var row = Math.floor(y / (this._skillHeight + this._skillPaddingY));
var col = Math.floor(x / (this._skillWidth + this._skillPaddingX));
var dx = x - col * (this._skillWidth + this._skillPaddingX);
var dy = y - row * (this._skillHeight + this._skillPaddingY);
if (
dx < 0 || dy < 0 ||
dx > this._skillWidth || dy > this._skillHeight ||
row >= 6 || col >= 3
) { return -1; }
if (dx < 0 || dy < 0 || dx > this._skillWidth || dy > this._skillHeight || row >= 6 || col >= 3) {
return -1;
}
var index = row * 3 + col;
return index;
}
};
//=============================================================================
// Window_SkillPopup
@ -690,11 +724,11 @@ var SF_Plugins = SF_Plugins || {};
Window_SkillPopup.prototype._refreshBack = function () {
// nothing to do
}
};
Window_SkillPopup.prototype._refreshFrame = function () {
this._windowFrameSprite.bitmap = ImageManager.loadSceneActor('skill_pop_window_back');
}
this._windowFrameSprite.bitmap = ImageManager.loadSceneActor("skill_pop_window_back");
};
Window_SkillPopup.prototype.initialize = function () {
Window_Base.prototype.initialize.apply(this, arguments);
@ -705,69 +739,71 @@ var SF_Plugins = SF_Plugins || {};
this._cancelHandler = null;
this._useHandler = null;
this._faceBackBitmap = ImageManager.loadSceneActor('skill_pop_face_back');
this._faceBackBitmap = ImageManager.loadSceneActor("skill_pop_face_back");
this.createCancelButton();
this.createUseButton();
}
};
Window_SkillPopup.prototype.standardPadding = function () {
return 0;
}
};
Window_SkillPopup.prototype.setActor = function (actor) {
this._actor = actor;
this._action = new Game_Action(actor);
}
};
Window_SkillPopup.prototype.setSkill = function (skill) {
this._skill = skill;
this._action.setItemObject(skill);
this.refresh();
}
};
Window_SkillPopup.prototype.setCancelHandler = function (handler) {
this._cancelHandler = handler;
this._cancelButton.setClickHandler(this._cancelHandler);
}
};
Window_SkillPopup.prototype.setUseHandler = function (handler) {
this._useHandler = handler;
this._useButton.setClickHandler(this.callUseHandler.bind(this));
}
};
Window_SkillPopup.prototype.callUseHandler = function () {
if (this._useHandler) {
this._useHandler();
}
}
};
Window_SkillPopup.prototype.createCancelButton = function () {
this._cancelButton = new Sprite_SFButton();
var bitmap = ImageManager.loadSceneActor('skill_pop_cancel');
var bitmap = ImageManager.loadSceneActor("skill_pop_cancel");
this._cancelButton.setColdBitmap(bitmap);
this._cancelButton.setHotBitmap(bitmap);
this._cancelButton.setClickHandler(this._cancelHandler);
this._cancelButton.move(670, 0);
this._cancelButton.refresh();
this.addChild(this._cancelButton);
}
};
Window_SkillPopup.prototype.createUseButton = function () {
this._useButton = new Sprite_SFButton();
var bitmap = ImageManager.loadSceneActor('skill_pop_use');
var bitmap = ImageManager.loadSceneActor("skill_pop_use");
this._useButton.setColdBitmap(bitmap);
this._useButton.setHotBitmap(bitmap);
this._useButton.setClickHandler(this._useHandler);
this._useButton.move(592, 313);
this._useButton.refresh();
this.addChild(this._useButton);
}
};
Window_SkillPopup.prototype.refresh = function () {
this._cancelButton.refresh();
this._useButton.refresh();
this.contents.clear();
if (!this._actor || !this._skill) { return; }
if (!this._actor || !this._skill) {
return;
}
this.refreshSkill();
if (this._actor.canUse(this._skill)) {
@ -777,23 +813,22 @@ var SF_Plugins = SF_Plugins || {};
this._useButton.visible = false;
this._useButton.deactivate();
}
}
};
Window_SkillPopup.prototype.refreshSkill = function () {
var text = this._skill.name;
this.contents.fontSize = 20;
this.contents.drawText(text, 18, 17, this.contentsWidth(), 20, 'left');
this.contents.drawText(text, 18, 17, this.contentsWidth(), 20, "left");
this.contents.fontSize = 16;
text = this._skill.description;
var lines = text.split('\n');
var lines = text.split("\n");
var y = 60;
for (var i = 0; i < lines.length; i++) {
this.contents.drawText(lines[i], 36, y, this.contentsWidth(), 20, 'left');
this.contents.drawText(lines[i], 36, y, this.contentsWidth(), 20, "left");
y += 20;
}
}
};
//=============================================================================
// Scene_Actor
@ -810,9 +845,9 @@ var SF_Plugins = SF_Plugins || {};
Scene_Actor.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
this._iconBitmap = ImageManager.loadSystem('IconSet');
this._childStatus = 'prop'; // prop skill equip skill_popup
}
this._iconBitmap = ImageManager.loadSystem("IconSet");
this._childStatus = "prop"; // prop skill equip skill_popup
};
Scene_Actor.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
@ -824,7 +859,7 @@ var SF_Plugins = SF_Plugins || {};
this.createSkillWindow();
//this.createEquipWindow();
//this.createTabButton();
}
};
Scene_Actor.prototype.start = function () {
Scene_MenuBase.prototype.start.call(this);
@ -832,23 +867,23 @@ var SF_Plugins = SF_Plugins || {};
this._skillWindow.setActor(this._actor);
this._skillPopup.setActor(this._actor);
this._childStatus = 'skill';
this._childStatus = "skill";
this.updateChildrenList();
}
};
Scene_Actor.prototype.createBackground = function () {
this._backgroundSprite = new Sprite();
this._backgroundSprite.bitmap = ImageManager.loadSceneActor('background');
}
this._backgroundSprite.bitmap = ImageManager.loadSceneActor("background");
};
Scene_Actor.prototype.createNameSprite = function () {
this._nameSprite = new Sprite();
this._nameSprite.bitmap = new Bitmap(230, 47);
this._nameSprite.bitmap.fontSize = 32;
this._nameSprite.bitmap.textColor = '#ffffff';
this._nameSprite.bitmap.textColor = "#ffffff";
this._nameSprite.move(45, 73);
this._nameSprite.bitmap.drawText(this._actor.name(), 0, 0, 230, 47, 'center');
}
this._nameSprite.bitmap.drawText(this._actor.name(), 0, 0, 230, 47, "center");
};
Scene_Actor.prototype.createActorContainer = function () {
this._actorContainer = new PIXI.Container();
@ -858,12 +893,11 @@ var SF_Plugins = SF_Plugins || {};
for (var i = 0; i < slots; i++) {
// not completely sure what this does
}
}
};
Scene_Actor.prototype.createStatusWindow = function () {
this._statusWindow = new Window_ActorProps(487, 86, 495, 417);
}
};
Scene_Actor.prototype.createSkillWindow = function () {
this._skillWindow = new Window_ActorSkill(487, 86, 495, 417);
@ -874,77 +908,85 @@ var SF_Plugins = SF_Plugins || {};
this._skillPopup.setUseHandler(this.onSkillUse.bind(this));
this._skillPopBack = new Sprite();
this._skillPopBackBitmap = ImageManager.loadSceneActor('skill_pop_back');
}
this._skillPopBackBitmap = ImageManager.loadSceneActor("skill_pop_back");
};
Scene_Actor.prototype.createCancelButton = function () {
this._cancelButton = new Sprite_SFButton();
var bitmap = ImageManager.loadSceneActor('cancel');
var bitmap = ImageManager.loadSceneActor("cancel");
this._cancelButton.setColdBitmap(bitmap);
this._cancelButton.setHotBitmap(bitmap);
this._cancelButton.setClickHandler(this.onCancelButtonClick.bind(this));
this._cancelButton.move(21, 7);
this._cancelButton.refresh();
}
};
Scene_Actor.prototype.onCancelButtonClick = function () {
this.popScene();
}
};
Scene_Actor.prototype.onSkillOk = function (skill) {
this._skillPopBack.bitmap = Bitmap.snap(this);
this._skillPopBack.bitmap.blt(this._skillPopBackBitmap, 0, 0, this._skillPopBackBitmap.width, this._skillPopBackBitmap.height, 0, 0);
this._skillPopBack.bitmap.blt(
this._skillPopBackBitmap,
0,
0,
this._skillPopBackBitmap.width,
this._skillPopBackBitmap.height,
0,
0
);
this._skillPopup.setSkill(skill);
this._childStatus = 'skill_popup';
this._childStatus = "skill_popup";
this.updateChildrenList();
}
};
Scene_Actor.prototype.onSkillCancel = function () {
this._childStatus = 'skill';
this._childStatus = "skill";
this.updateChildrenList();
}
};
Scene_Actor.prototype.onSkillUse = function (skill) {
var action = new Game_Action(this._actor);
this._childStatus = 'skill';
this._childStatus = "skill";
this.updateChildrenList();
}
};
Scene_Actor.prototype.useSkill = function (action) {
this._actor.useItem(action.item());
this.a
}
this.a;
};
Scene_Actor.prototype.updateChildrenList = function () {
this.removeChildren();
switch (this._childStatus) {
case 'prop':
case "prop":
this.addBackChildren();
this.addChild(this._statusWindow);
break;
case 'skill':
case "skill":
this.addBackChildren();
this.addChild(this._skillWindow);
break;
case 'equip':
case "equip":
this.addBackChildren();
this.addChild(this._equipWindow);
break;
case 'skill_popup':
case "skill_popup":
this.addChild(this._skillPopBack);
this.addChild(this._skillPopup);
break;
default:
this.popScene();
}
}
};
Scene_Actor.prototype.addBackChildren = function () {
this.addChild(this._backgroundSprite);
this.addChild(this._cancelButton);
this.addChild(this._nameSprite);
this.addChild(this._actorContainer);
}
})();
};
})();

@ -9,9 +9,9 @@ Imported.SF_SceneActorSelect = true;
var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc v1.0.0 Allows you to select an actor from the scene.
* @author Salted Fish
*/
* @plugindesc v1.0.0 Allows you to select an actor from the scene.
* @author Salted Fish
*/
//=============================================================================
(function () {
@ -49,77 +49,77 @@ var SF_Plugins = SF_Plugins || {};
this._actorFaceSprites[i].y = rect.y + 42 + 4;
this.addChild(this._actorFaceSprites[i]);
}
}
};
Window_ActorSelect.prototype._refreshFrame = function () {
// nothing to do
}
};
Window_ActorSelect.prototype._refreshBack = function () {
// nothing to do
}
};
Window_ActorSelect.prototype.windowWidth = function () {
return Graphics.boxWidth;
}
};
Window_ActorSelect.prototype.windowHeight = function () {
return Graphics.boxHeight;
}
};
Window_ActorSelect.prototype.windowX = function () {
return 0;
}
};
Window_ActorSelect.prototype.windowY = function () {
return 0;
}
};
Window_ActorSelect.prototype.itemWidth = function () {
return 142;
}
};
Window_ActorSelect.prototype.itemHeight = function () {
return 209;
}
};
Window_ActorSelect.prototype.maxCols = function () {
return 5;
}
};
Window_ActorSelect.prototype.maxRows = function () {
return 2;
}
};
Window_ActorSelect.prototype.itemPadding = function () {
return new Point(20, 14);
}
};
Window_ActorSelect.prototype.itemStartPosition = function () {
return new Point(109, 76);
}
};
Window_ActorSelect.prototype.pageUpPosition = function () {
return new Point(46, 288);
}
};
Window_ActorSelect.prototype.pageDownPosition = function () {
return new Point(943, 288);
}
};
Window_ActorSelect.prototype.pageUpBitmap = function () {
var bitmap = ImageManager.loadSceneActorSelect("page_up");
return { cold: bitmap, hot: bitmap };
}
};
Window_ActorSelect.prototype.pageDownBitmap = function () {
var bitmap = ImageManager.loadSceneActorSelect("page_down");
return { cold: bitmap, hot: bitmap };
}
};
Window_PagingBase.prototype.isShowPageNumber = function () {
return false;
}
};
Window_ActorSelect.prototype.makeItemList = function () {
var list = [];
@ -130,7 +130,7 @@ var SF_Plugins = SF_Plugins || {};
}
}
return list;
}
};
Window_ActorSelect.prototype.drawItem = function (index) {
if (index >= this.maxItems()) {
@ -140,33 +140,57 @@ var SF_Plugins = SF_Plugins || {};
this._actorFaceSprites[index % this.maxPageItems()].visible = true;
var rect = this.itemRect(index);
this.contents.blt(this._actorBackBitmap, 0, 0, this._actorBackBitmap.width, this._actorBackBitmap.height, rect.x, rect.y);
this.contents.blt(this._faceBackBitmap, 0, 0, this._faceBackBitmap.width, this._faceBackBitmap.height, rect.x + 3, rect.y + 42);
this.contents.blt(this._levelBackBitmap, 0, 0, this._levelBackBitmap.width, this._levelBackBitmap.height, rect.x, rect.y + 172);
this.contents.blt(
this._actorBackBitmap,
0,
0,
this._actorBackBitmap.width,
this._actorBackBitmap.height,
rect.x,
rect.y
);
this.contents.blt(
this._faceBackBitmap,
0,
0,
this._faceBackBitmap.width,
this._faceBackBitmap.height,
rect.x + 3,
rect.y + 42
);
this.contents.blt(
this._levelBackBitmap,
0,
0,
this._levelBackBitmap.width,
this._levelBackBitmap.height,
rect.x,
rect.y + 172
);
this.drawActorFace(index);
this.drawActorName(index);
this.drawActorLevel(index);
}
};
Window_ActorSelect.prototype.getFaceRect = function (faceIndex) {
var pw = Window_Base._faceWidth;
var ph = Window_Base._faceHeight;
var sw = this._faceBackBitmap.width - 8;
var sh = this._faceBackBitmap.height - 8;
var sx = faceIndex % 4 * pw + (pw - sw) / 2;
var sx = (faceIndex % 4) * pw + (pw - sw) / 2;
var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2;
return new Rectangle(sx, sy, sw, sh);
}
};
Window_ActorSelect.prototype.drawActorLevel = function (index) {
var actor = this.getItem(index);
var rect = this.itemRect(index);
var levelText = 'LV. ' + actor.level.toString();
var levelText = "LV. " + actor.level.toString();
this.contents.fontSize = 18;
this.contents.textColor = 'white';
this.contents.drawText(levelText, rect.x, rect.y + 172, rect.width, 37, 'center');
}
this.contents.textColor = "white";
this.contents.drawText(levelText, rect.x, rect.y + 172, rect.width, 37, "center");
};
Window_ActorSelect.prototype.drawActorFace = function (index) {
var actor = this.getItem(index);
@ -175,49 +199,48 @@ var SF_Plugins = SF_Plugins || {};
index = index % this._actorFaceSprites.length;
this._actorFaceSprites[index].bitmap = ImageManager.loadFace(actor.faceName());
this._actorFaceSprites[index].setFrame(faceRect.x, faceRect.y, faceRect.width, faceRect.height);
}
};
Window_ActorSelect.prototype.drawActorName = function (index) {
var actor = this.getItem(index);
var rect = this.itemRect(index);
var nameText = actor.name();
this.contents.fontSize = 24;
this.contents.textColor = 'white';
this.contents.drawText(nameText, rect.x, rect.y + 10, rect.width, 32, 'center');
}
this.contents.textColor = "white";
this.contents.drawText(nameText, rect.x, rect.y + 10, rect.width, 32, "center");
};
Window_ActorSelect.prototype.onItemPointerDown = function (index) {
console.log(`onItemPointerDown: ${index}`);
}
};
Window_ActorSelect.prototype.onItemPointerUp = function (index) {
console.log(`onItemPointerUp: ${index}`);
}
};
Window_ActorSelect.prototype.onItemPointerMove = function (index) {
console.log(`onItemPointerMove: ${index}`);
}
};
Window_ActorSelect.prototype.onItemPointerCancel = function (index) {
console.log(`onItemPointerCancel: ${index}`);
}
};
Window_ActorSelect.prototype.onItemPointerLeave = function (index) {
console.log(`onItemPointerLeave: ${index}`);
}
};
Window_ActorSelect.prototype.onItemPointerEnter = function (index) {
console.log(`onItemPointerEnter: ${index}`);
}
};
Window_ActorSelect.prototype.onItemPointerOver = function (index) {
// console.log(`onItemPointerOver: ${index}`);
}
};
Window_ActorSelect.prototype.onItemClick = function (index) {
console.log(`onItemClick: ${index}`);
}
};
//=============================================================================
// Scene_ActorSelect
//=============================================================================
@ -234,13 +257,13 @@ var SF_Plugins = SF_Plugins || {};
Scene_ActorSelect.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
}
};
Scene_ActorSelect.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
this.createWindowActorSelect();
this.createButtons();
}
};
Scene_ActorSelect.prototype.start = function () {
Scene_MenuBase.prototype.start.call(this);
@ -249,22 +272,22 @@ var SF_Plugins = SF_Plugins || {};
this._homeButton.refresh();
this._cancelButton.activate();
this._homeButton.activate();
}
};
Scene_ActorSelect.prototype.createBackground = function () {
this._backgroundSprite = new Sprite();
this._backgroundSprite.bitmap = ImageManager.loadSceneActorSelect('background');
this._backgroundSprite.bitmap = ImageManager.loadSceneActorSelect("background");
this.addChild(this._backgroundSprite);
}
};
Scene_ActorSelect.prototype.createWindowActorSelect = function () {
this._windowActorSelect = new Window_ActorSelect();
this.addWindow(this._windowActorSelect);
}
};
Scene_ActorSelect.prototype.createButtons = function () {
this._cancelButton = new Sprite_SFButton();
var bitmap = ImageManager.loadSceneActorSelect('cancel');
var bitmap = ImageManager.loadSceneActorSelect("cancel");
this._cancelButton.setColdBitmap(bitmap);
this._cancelButton.setHotBitmap(bitmap);
this._cancelButton.setClickHandler(this.onCancelButtonClick.bind(this));
@ -273,24 +296,24 @@ var SF_Plugins = SF_Plugins || {};
this._cancelButton.move(30, 12);
this._homeButton = new Sprite_SFButton();
bitmap = ImageManager.loadSceneActorSelect('home');
bitmap = ImageManager.loadSceneActorSelect("home");
this._homeButton.setColdBitmap(bitmap);
this._homeButton.setHotBitmap(bitmap);
this._homeButton.setClickHandler(this.onHomeButtonClick.bind(this));
this.addChild(this._homeButton);
this._homeButton.deactivate();
this._homeButton.move(108, 12);
}
};
Scene_ActorSelect.prototype.onCancelButtonClick = function () {
this.popScene();
}
};
Scene_ActorSelect.prototype.onHomeButtonClick = function () {
SceneManager.goto(Scene_Map);
}
};
Scene_ActorSelect.prototype.update = function () {
Scene_MenuBase.prototype.update.call(this);
}
})();
};
})();

@ -10,13 +10,13 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc Scene Equip
* @author SaltedFish
*
* @help
*
* This plugin does not provide plugin commands.
*/
* @plugindesc Scene Equip
* @author SaltedFish
*
* @help
*
* This plugin does not provide plugin commands.
*/
//=============================================================================
(function () {
@ -44,37 +44,37 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
SF_SceneEquip.ActorStatus = {
"hp": "血量",
"mp": "魔力",
"tp": "怒气",
"mhp": "血量上限",
"mmp": "魔法上限",
"atk": "攻击力",
"def": "防御力",
"mat": "魔法攻击力",
"mdf": "魔法防御力",
"agi": "敏捷",
"luk": "幸运",
"hit": "命中率",
"eva": "回避率",
"cri": "会心率",
"cev": "会心回避率",
"mev": "魔法回避率",
"mrf": "魔法反射率",
"cnt": "反击率",
"hrg": "生命自动回复率",
"mrg": "魔法自动回复率",
"trg": "TP自动回复率",
"tgr": "受到攻击机率",
"grd": "防御有效率",
"rec": "回复效果",
"pha": "药品有效率",
"mcr": "魔法消耗率",
"tcr": "TP消耗率",
"pdr": "物理伤害率",
"mdr": "魔法伤害率",
"fdr": "地形伤害率",
"exr": "经验值率",
hp: "血量",
mp: "魔力",
tp: "怒气",
mhp: "血量上限",
mmp: "魔法上限",
atk: "攻击力",
def: "防御力",
mat: "魔法攻击力",
mdf: "魔法防御力",
agi: "敏捷",
luk: "幸运",
hit: "命中率",
eva: "回避率",
cri: "会心率",
cev: "会心回避率",
mev: "魔法回避率",
mrf: "魔法反射率",
cnt: "反击率",
hrg: "生命自动回复率",
mrg: "魔法自动回复率",
trg: "TP自动回复率",
tgr: "受到攻击机率",
grd: "防御有效率",
rec: "回复效果",
pha: "药品有效率",
mcr: "魔法消耗率",
tcr: "TP消耗率",
pdr: "物理伤害率",
mdr: "魔法伤害率",
fdr: "地形伤害率",
exr: "经验值率",
};
function Window_EquipStatus() {
@ -100,15 +100,15 @@ var SF_Plugins = SF_Plugins || {};
Window_EquipStatus.prototype.standardFontSize = function () {
return 18;
}
};
Window_EquipStatus.prototype.lineHeight = function () {
return this.standardFontSize() + 8;
}
};
Window_EquipStatus.prototype.measureContentHeight = function () {
return this.fittingHeight(this.numVisibleRows());
}
};
Window_EquipStatus.prototype.measureContentWidth = function () {
var max_w = 0;
@ -119,8 +119,8 @@ var SF_Plugins = SF_Plugins || {};
max_w = w;
}
}
return max_w
}
return max_w;
};
Window_EquipStatus.prototype.numVisibleRows = function () {
return 28;
@ -132,18 +132,18 @@ var SF_Plugins = SF_Plugins || {};
this.drawItem(key, y);
y += this.lineHeight();
}
}
};
Window_EquipStatus.prototype.drawRightArrow = function (x, y) {
this.changeTextColor(this.systemColor());
return this.drawTextEx('\u2192', x, y);
return this.drawTextEx("\u2192", x, y);
};
Window_EquipStatus.prototype.drawItem = function (key, y) {
var text = SF_SceneEquip.ActorStatus[key];
var x = 0;
this.changeTextColor(this.systemColor());
x += this.drawTextEx(text + ': ', x, y);
x += this.drawTextEx(text + ": ", x, y);
if (this._actor) {
this.resetTextColor();
x += this.drawTextEx(this._actor[key], x, y) + 10;
@ -156,11 +156,11 @@ var SF_Plugins = SF_Plugins || {};
x += this.drawTextEx(newValue, x, y);
}
return x;
}
};
Window_EquipStatus.prototype.isHaveContent = function () {
return true;
}
};
Window_EquipStatus.prototype.windowWidth = function () {
return 440;
@ -186,26 +186,23 @@ var SF_Plugins = SF_Plugins || {};
//this.createItemWindow();
//this.createActorWindow();
//this.createEquipWindow();
}
};
Scene_Equip.prototype.createCommandInBackground = function () {
this._commandBackground = new Sprite(SF_Plugins.SF_SceneMenu.commandBitmap);
this._commandBackground.x = 0;
this._commandBackground.y = 0;
this.addChild(this._commandBackground);
}
};
// 380,90 440,370
Scene_Equip.prototype.createBackgroundWindow = function () {
this._backgroundWindow = new Window_BackGround();
this.addChild(this._backgroundWindow);
}
};
Scene_Equip.prototype.createStatusWindow = function () {
this._statusWindow = new Window_EquipStatus();
this._backgroundWindow.addChild(this._statusWindow);
};
})();
})();

@ -10,13 +10,13 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc Scene Menu
* @author SaltedFish
*
* @help
*
* This plugin does not provide plugin commands.
*/
* @plugindesc Scene Menu
* @author SaltedFish
*
* @help
*
* This plugin does not provide plugin commands.
*/
//=============================================================================
(function () {
@ -24,8 +24,7 @@ var SF_Plugins = SF_Plugins || {};
SF_Plugins.SF_SceneMenu = SF_SceneMenu;
SF_SceneMenu.version = 1.0;
SF_SceneMenu.dialogContents = ['文本文本文本文本文本'];
SF_SceneMenu.dialogContents = ["文本文本文本文本文本"];
//=============================================================================
// Sprite Dialog
@ -40,12 +39,12 @@ var SF_Plugins = SF_Plugins || {};
Sprite_Dialog.prototype.initialize = function () {
Sprite.prototype.initialize.call(this);
this._backgroundSprite = new Sprite(ImageManager.loadSceneMenu('dialog_background'));
this._backgroundSprite = new Sprite(ImageManager.loadSceneMenu("dialog_background"));
this._textSprite = new Sprite();
this._textSprite.bitmap = new Bitmap(300, 180);
this._textSprite.move(10, 10);
this._textSprite.bitmap.fontSize = 24;
this._textSprite.bitmap.textColor = '#ffffff';
this._textSprite.bitmap.textColor = "#ffffff";
this.addChild(this._backgroundSprite);
this.addChild(this._textSprite);
@ -55,17 +54,25 @@ var SF_Plugins = SF_Plugins || {};
this._tmpWindow.opacity = 0;
this._needFadeIn = false;
this._needMoveIn = false;
}
};
Sprite_Dialog.prototype.setText = function (text) {
this._tmpWindow.contents.clear();
this._tmpWindow.drawTextEx(text, 0, 0);
this._textSprite.bitmap.blt(this._tmpWindow.contents, 0, 0, this._textSprite.width, this._textSprite.height, 0, 0);
}
this._textSprite.bitmap.blt(
this._tmpWindow.contents,
0,
0,
this._textSprite.width,
this._textSprite.height,
0,
0
);
};
Sprite_Dialog.prototype.update = function () {
Sprite.prototype.update.call(this);
}
};
//=============================================================================
// Scene Menu
@ -73,20 +80,21 @@ var SF_Plugins = SF_Plugins || {};
Scene_Menu.prototype.initialize = function () {
Scene_Base.prototype.initialize.call(this);
this.button_name = {// button name: [x, y]
'title': [897, 278],
'actor': [438, 175],
'formation': [645, 94],
'save': [868, 94],
"quest": [756, 278],
'options': [746, 33],
'achivement': [645, 278],
'help': [814, 33],
'cancel': [678, 463],
'database': [438, 348],
'skill': [438, 94]
this.button_name = {
// button name: [x, y]
title: [897, 278],
actor: [438, 175],
formation: [645, 94],
save: [868, 94],
quest: [756, 278],
options: [746, 33],
achivement: [645, 278],
help: [814, 33],
cancel: [678, 463],
database: [438, 348],
skill: [438, 94],
};
}
};
Scene_Menu.prototype.create = function () {
Scene_Base.prototype.create.call(this);
@ -97,29 +105,26 @@ var SF_Plugins = SF_Plugins || {};
this.createDialog();
this.createCommandButton();
}
};
Scene_Menu.prototype.createRotateContainer = function () {
this._rotateContainer = new Sprite();
this.addChild(this._rotateContainer);
}
};
Scene_Menu.prototype.createBackSprite = function () {
this._backSprite = new Sprite(ImageManager.loadSceneMenu('background'));
this._backSprite = new Sprite(ImageManager.loadSceneMenu("background"));
this.addChild(this._backSprite);
}
};
Scene_Menu.prototype.createDialog = function () {
this._dialogSprite = new Sprite_Dialog();
this._rotateContainer.addChild(this._dialogSprite);
this._dialogSprite.move(37, 167);
this._dialogSprite.setText(
SF_SceneMenu.dialogContents[
Math.floor(Math.random() * SF_SceneMenu.dialogContents.length)
]
SF_SceneMenu.dialogContents[Math.floor(Math.random() * SF_SceneMenu.dialogContents.length)]
);
}
};
Scene_Menu.prototype.createCommandButton = function () {
for (var key in this.button_name) {
@ -127,77 +132,78 @@ var SF_Plugins = SF_Plugins || {};
this._rotateContainer.addChild(button);
button.move(this.button_name[key][0], this.button_name[key][1]);
button.setHotBitmap(ImageManager.loadSceneMenu(key + '_hot'));
button.setColdBitmap(ImageManager.loadSceneMenu(key + '_cold'));
button.setClickHandler(this['on_' + key + "_button"].bind(this));
button.setHotBitmap(ImageManager.loadSceneMenu(key + "_hot"));
button.setColdBitmap(ImageManager.loadSceneMenu(key + "_cold"));
button.setClickHandler(this["on_" + key + "_button"].bind(this));
button.deactivate();
button.refresh();
this['_' + key + '_buttonSprite'] = button;
this["_" + key + "_buttonSprite"] = button;
}
}
};
Scene_Menu.prototype.start = function () {
Scene_MenuBase.prototype.start.call(this);
for (var key in this.button_name) {
this['_' + key + '_buttonSprite'].activate();
this["_" + key + "_buttonSprite"].activate();
}
this._backSprite.move(Graphics.boxWidth - this._backSprite.bitmap.width, (Graphics.boxHeight - this._backSprite.bitmap.height) / 2);
this._backSprite.move(
Graphics.boxWidth - this._backSprite.bitmap.width,
(Graphics.boxHeight - this._backSprite.bitmap.height) / 2
);
this.pivot.x = Graphics.boxWidth / 2;
this.pivot.y = Graphics.boxHeight / 2;
this.x = Graphics.boxWidth / 2;
this.y = Graphics.boxHeight / 2;
// this.rotation = -0.03;
}
};
Scene_Menu.prototype.update = function () {
Scene_MenuBase.prototype.update.call(this);
}
};
Scene_Menu.prototype.on_title_button = function () {
this.fadeOutAll();
SceneManager.goto(Scene_Title);
}
};
Scene_Menu.prototype.on_actor_button = function () {
SceneManager.push(Scene_Actor);
}
};
Scene_Menu.prototype.on_formation_button = function () {
SceneManager.push(Scene_Formation);
}
};
Scene_Menu.prototype.on_save_button = function () {
SceneManager.push(Scene_Save);
}
};
Scene_Menu.prototype.on_quest_button = function () {
SceneManager.push(Scene_Quest);
}
};
Scene_Menu.prototype.on_options_button = function () {
SceneManager.push(Scene_Options);
}
};
Scene_Menu.prototype.on_achivement_button = function () {
SceneManager.push(Scene_Achievement);
}
};
Scene_Menu.prototype.on_help_button = function () {
SceneManager.push(Scene_Help);
}
};
Scene_Menu.prototype.on_cancel_button = function () {
this.popScene();
}
};
Scene_Menu.prototype.on_database_button = function () {
SceneManager.push(Scene_Database);
}
};
Scene_Menu.prototype.on_skill_button = function () {
SceneManager.push(Scene_Skill);
}
})();
};
})();

@ -11,20 +11,20 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc v1.0.0 - Scene Skill
* @author Salted Fish
*
*
* @help
*
* ===========================================================================
* Introduction
* ===========================================================================
*
* This plugin is used to show the skill list.
* Any config just change the file.
*
*/
* @plugindesc v1.0.0 - Scene Skill
* @author Salted Fish
*
*
* @help
*
* ===========================================================================
* Introduction
* ===========================================================================
*
* This plugin is used to show the skill list.
* Any config just change the file.
*
*/
//=============================================================================
(function () {
@ -50,11 +50,9 @@ var SF_Plugins = SF_Plugins || {};
Window_UserSelect.prototype.initialize = function () {
Window_PagingBase.prototype.initialize.apply(this, arguments);
this.refresh();
}
};
//=============================================================================
// Scene_Skill
//=============================================================================
})();
})();

@ -11,17 +11,17 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc v1.0.0 - Scene Splash
* @author Salted Fish
*
* @help
*
* ===========================================================================
* Introduction
* ===========================================================================
*
* This plugin adds a splash scene after Scene_Boot.
*/
* @plugindesc v1.0.0 - Scene Splash
* @author Salted Fish
*
* @help
*
* ===========================================================================
* Introduction
* ===========================================================================
*
* This plugin adds a splash scene after Scene_Boot.
*/
//=============================================================================
(function () {
@ -31,8 +31,8 @@ var SF_Plugins = SF_Plugins || {};
SF_SceneSplash.version = 1.0;
SF_SceneSplash.FADE_IN_FRAMES = 60; // Number of frames for the fade in effect.
SF_SceneSplash.FADE_OUT_FRAMES = 60;// Number of frames for the fade out effect.
SF_SceneSplash.SHOW_TIME = 150;// Number of frames for the splash to be shown.
SF_SceneSplash.FADE_OUT_FRAMES = 60; // Number of frames for the fade out effect.
SF_SceneSplash.SHOW_TIME = 150; // Number of frames for the splash to be shown.
//=============================================================================
// Sprite_SplashBase
@ -47,14 +47,14 @@ var SF_Plugins = SF_Plugins || {};
Sprite_SplashBase.prototype.initialize = function (index) {
Sprite.prototype.initialize.call(this);
this.state = "fadeIn";// "fadeIn", "show", "fadeOut"
this.state = "fadeIn"; // "fadeIn", "show", "fadeOut"
this.FADE_IN_FRAMES = SF_SceneSplash.FADE_IN_FRAMES;
this.FADE_OUT_FRAMES = SF_SceneSplash.FADE_OUT_FRAMES;
this.SHOW_TIME = SF_SceneSplash.SHOW_TIME;
this.index = index;
this.showTime = 0;
this.opacity = 0;
}
};
Sprite_SplashBase.prototype.update = function () {
Sprite.prototype.update.call(this);
@ -70,7 +70,7 @@ var SF_Plugins = SF_Plugins || {};
} else if (this.state === "fadeOut") {
this.updateFadeOut();
}
}
};
Sprite_SplashBase.prototype.updateFadeIn = function () {
this.opacity += 255 / this.FADE_IN_FRAMES;
@ -78,19 +78,19 @@ var SF_Plugins = SF_Plugins || {};
this.opacity = 255;
this.state = "show";
}
}
};
Sprite_SplashBase.prototype.updateShow = function () {
this.opacity = 255;
this.updateShowTime();
}
};
Sprite_SplashBase.prototype.updateShowTime = function () {
this.showTime++;
if (this.showTime >= this.SHOW_TIME) {
this.state = "fadeOut";
}
}
};
Sprite_SplashBase.prototype.updateFadeOut = function () {
this.opacity -= 255 / this.FADE_OUT_FRAMES;
@ -109,14 +109,14 @@ var SF_Plugins = SF_Plugins || {};
this.parent.removeChild(this);
}
}
};
Sprite_SplashBase.prototype.centerSelf = function () {
this.anchor.x = 0.5;
this.anchor.y = 0.5;
this.x = Graphics.width / 2;
this.y = Graphics.height / 2;
}
};
//=============================================================================
// Sprite_SplashLogo
@ -133,7 +133,7 @@ var SF_Plugins = SF_Plugins || {};
Sprite_SplashBase.prototype.initialize.call(this, index);
this.bitmap = ImageManager.loadSceneSplash("spalsh_logo");
this.centerSelf();
}
};
//=============================================================================
// Sprite_SplashHealthTip
@ -150,7 +150,7 @@ var SF_Plugins = SF_Plugins || {};
Sprite_SplashBase.prototype.initialize.call(this, index);
this.bitmap = ImageManager.loadSceneSplash("spalsh_health_tip");
this.centerSelf();
}
};
//=============================================================================
// Sprite_SplashAdapted
@ -167,7 +167,7 @@ var SF_Plugins = SF_Plugins || {};
Sprite_SplashBase.prototype.initialize.call(this, index);
this.bitmap = ImageManager.loadSceneSplash("splash_adapted");
this.centerSelf();
}
};
//=============================================================================
// Sprite_SplashEnd
@ -183,14 +183,17 @@ var SF_Plugins = SF_Plugins || {};
Sprite_SplashEnd.prototype.initialize = function (index) {
Sprite_SplashBase.prototype.initialize.call(this, index);
SceneManager.pop();
}
};
//=============================================================================
// Sprite Class for Scene Splash
//=============================================================================
SF_SceneSplash.SpriteClassList = [
Sprite_SplashLogo, Sprite_SplashHealthTip, Sprite_SplashAdapted, Sprite_SplashEnd
Sprite_SplashLogo,
Sprite_SplashHealthTip,
Sprite_SplashAdapted,
Sprite_SplashEnd,
];
//=============================================================================
@ -208,34 +211,34 @@ var SF_Plugins = SF_Plugins || {};
Scene_Splash.prototype.initialize = function () {
Scene_Base.prototype.initialize.call(this);
}
};
Scene_Splash.prototype.create = function () {
Scene_Base.prototype.create.call(this);
this.createBackground();
this.createSplash();
}
};
Scene_Splash.prototype.createBackground = function () {
var bitmap = new Bitmap(Graphics.width, Graphics.height);
bitmap.fillAll("white");
this._backgroundSprite = new Sprite(bitmap);
this.addChild(this._backgroundSprite);
}
};
Scene_Splash.prototype.createSplash = function () {
var spriteClass = SF_SceneSplash.SpriteClassList[0];
var sprite = new spriteClass(0);
this.addChild(sprite);
}
};
Scene_Splash.prototype.start = function () {
Scene_Base.prototype.start.call(this);
}
};
Scene_Splash.prototype.update = function () {
Scene_Base.prototype.update.call(this);
}
};
//=============================================================================
// SceneManager
@ -245,6 +248,5 @@ var SF_Plugins = SF_Plugins || {};
SceneManager.initialize = function () {
SF_SceneSplash.SceneManager_initialize.apply(this, arguments);
this.addSceneBefore(Scene_Splash, Scene_Title);
}
})();
};
})();

@ -11,27 +11,24 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc Scene Title
* @author SaltedFish
*
* @help
*
* This plugin does not provide plugin commands.
*
* overwrite:
* Scene_Title
*/
* @plugindesc Scene Title
* @author SaltedFish
*
* @help
*
* This plugin does not provide plugin commands.
*
* overwrite:
* Scene_Title
*/
//=============================================================================
(function () {
var SF_SceneTitle = {};
SF_Plugins.SF_SceneTitle = SF_SceneTitle;
SF_SceneTitle.version = 1.0;
//=============================================================================
// Scene_Title
//=============================================================================
@ -39,14 +36,14 @@ var SF_Plugins = SF_Plugins || {};
Scene_Title.prototype.initialize = function () {
Scene_Base.prototype.initialize.call(this);
this.button_name = {
"start": [195, 400],
"load": [405, 400],
"exit": [605, 400],
"cg": [285, 452],
"music": [495, 452],
"qq_group": [756, 490],
start: [195, 400],
load: [405, 400],
exit: [605, 400],
cg: [285, 452],
music: [495, 452],
qq_group: [756, 490],
};
}
};
SF_SceneTitle.Scene_Title_create = Scene_Title.prototype.create;
Scene_Title.prototype.create = function () {
@ -55,22 +52,21 @@ var SF_Plugins = SF_Plugins || {};
this.createWindowLayer();
this.createGameTitle();
this.createTitleButton();
}
};
Scene_Title.prototype.createBackground = function () {
this._backgroundSprite = new Sprite(ImageManager.loadSceneTitle("back_ground"));
this.addChild(this._backgroundSprite);
this._backgroundSprite.move(0, 0);
}
};
Scene_Title.prototype.createGameTitle = function () {
this._titleSprite = new Sprite(ImageManager.loadSceneTitle("game_title"));
this.addChild(this._titleSprite);
this._titleSprite.move(280, 122);
}
};
Scene_Title.prototype.createTitleButton = function () {
for (var key in this.button_name) {
var x = this.button_name[key][0];
var y = this.button_name[key][1];
@ -83,41 +79,40 @@ var SF_Plugins = SF_Plugins || {};
this["_" + key + "_buttonSprite"] = button;
this.addChild(button);
}
}
};
Scene_Title.prototype.on_start_button = function () {
this._start_buttonSprite.releasePointer();
DataManager.setupNewGame();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
}
};
Scene_Title.prototype.on_load_button = function () {
this._load_buttonSprite.releasePointer();
SceneManager.push(Scene_Load);
}
};
Scene_Title.prototype.on_exit_button = function () {
this._exit_buttonSprite.releasePointer();
SceneManager.exit();
window.close();
}
};
Scene_Title.prototype.on_cg_button = function () {
this._cg_buttonSprite.releasePointer();
SceneManager.push(Scene_CG);
}
};
Scene_Title.prototype.on_music_button = function () {
this._music_buttonSprite.releasePointer();
SceneManager.push(Scene_Music);
}
};
Scene_Title.prototype.on_qq_group_button = function () {
this._qq_group_buttonSprite.releasePointer();
window.open("https://qm.qq.com/cgi-bin/qm/qr?k=4eiJfzkMBKVqv3ufNyOUjL_gbAC_7rcn&jump_from=webapi", "_blank");
}
};
Scene_Title.prototype.start = function () {
Scene_Base.prototype.start.call(this);
@ -133,16 +128,13 @@ var SF_Plugins = SF_Plugins || {};
}
this._cg_buttonSprite.deactivate();
this._music_buttonSprite.deactivate();
}
};
Scene_Title.prototype.update = function () {
Scene_Base.prototype.update.call(this);
};
Scene_Title.prototype.isBusy = function () {
return Scene_Base.prototype.isBusy.call(this);
};
})();
})();

@ -10,9 +10,9 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc scenes lib for salted fish plugins
* @author Salted Fish
*/
* @plugindesc scenes lib for salted fish plugins
* @author Salted Fish
*/
//=============================================================================
(function () {
@ -29,5 +29,5 @@ var SF_Plugins = SF_Plugins || {};
Scene_Base.prototype.terminate = function () {
SF_Scenes.Scene_Base_terminate.call(this);
TouchInput.removeUsers();
}
})();
};
})();

@ -11,16 +11,15 @@ var SF_Plugins = SF_Plugins || {};
//=============================================================================
/*:
* @plugindesc try to skip load errors
* @author SaltedFish
*
* @help
* just put it on the top of plugins list.
*
*/
* @plugindesc try to skip load errors
* @author SaltedFish
*
* @help
* just put it on the top of plugins list.
*
*/
//=============================================================================
(function () {
var SF_SkipLoadError = {};
SF_Plugins.SF_SkipLoadError = SF_SkipLoadError;
@ -31,16 +30,16 @@ var SF_Plugins = SF_Plugins || {};
PluginManager.checkErrors = function () {
var url = this._errorUrls.shift();
if (url) {
alert('Failed to load: ' + url);
alert("Failed to load: " + url);
}
}
};
SF_SkipLoadError.ImageManager_isReady = ImageManager.isReady;
ImageManager.isReady = function () {
for (var key in this.cache._inner) {
var bitmap = this.cache._inner[key].item;
if (bitmap.isError()) {
alert('Failed to load: ' + bitmap.url);
alert("Failed to load: " + bitmap.url);
bitmap = ImageManager.loadEmptyBitmap();
this.cache.setItem(key, bitmap);
}
@ -54,7 +53,7 @@ var SF_Plugins = SF_Plugins || {};
SF_SkipLoadError.AudioManager_checkWebAudioError = AudioManager.checkWebAudioError;
AudioManager.checkWebAudioError = function (webAudio) {
if (webAudio && webAudio.isError()) {
alert('Failed to load: ' + webAudio.url);
alert("Failed to load: " + webAudio.url);
webAudio.initialize("");
}
};
@ -93,17 +92,27 @@ var SF_Plugins = SF_Plugins || {};
SceneManager.stop();
if (this._errorPrinter.innerHTML !== "") {
let tempht = this._errorPrinter.innerHTML.match(/<font color="white">(.*)<\/font>/i)[1] + "<br/>";
this._errorPrinter.innerHTML = '<font color="yellow"><b>' + '文件加载失败,请上报问题附带截图:' + '</b></font><br>' +
'<font color="white">' + tempht + 'Failed to load: ' + url + '</font><br>';
this._errorPrinter.innerHTML =
'<font color="yellow"><b>' +
"文件加载失败,请上报问题附带截图:" +
"</b></font><br>" +
'<font color="white">' +
tempht +
"Failed to load: " +
url +
"</font><br>";
} else {
this._errorPrinter.innerHTML = this._makeErrorHtml('文件加载失败,请上报问题附带截图:', 'Failed to load: ' + url);
this._errorPrinter.innerHTML = this._makeErrorHtml(
"文件加载失败,请上报问题附带截图:",
"Failed to load: " + url
);
}
var button = document.createElement('button');
var button = document.createElement("button");
SF_SkipLoadError.FileLoadErrorList.push(url);
button.innerHTML = '继续';
button.style.fontSize = '24px';
button.style.color = '#ffffff';
button.style.backgroundColor = '#000000';
button.innerHTML = "继续";
button.style.fontSize = "24px";
button.style.color = "#ffffff";
button.style.backgroundColor = "#000000";
button.onmousedown = button.ontouchstart = function (event) {
Graphics.eraseLoadingError();
SceneManager.resume();
@ -113,7 +122,6 @@ var SF_Plugins = SF_Plugins || {};
this._loadingCount = -Infinity;
return;
}
};
SF_SkipLoadError.ResourceHandler_retry = ResourceHandler.retry;
@ -127,8 +135,8 @@ var SF_Plugins = SF_Plugins || {};
SF_SkipLoadError.Bitmap_onError = Bitmap.prototype._onError;
Bitmap.prototype._onError = function () {
this._image.removeEventListener('load', this._loadListener);
this._image.removeEventListener('error', this._errorListener);
this._image.removeEventListener("load", this._loadListener);
this._image.removeEventListener("error", this._errorListener);
this._loadListener();
};
@ -136,7 +144,7 @@ var SF_Plugins = SF_Plugins || {};
Graphics._paintUpperCanvas = function () {
this._clearUpperCanvas();
if (this._loadingImage) {
var context = this._upperCanvas.getContext('2d');
var context = this._upperCanvas.getContext("2d");
var dx = (this._width - this._loadingImage.width) / 2;
var dy = (this._height - this._loadingImage.height) / 2;
var alpha = ((this._loadingCount - 20) / 30).clamp(0, 1);
@ -157,7 +165,11 @@ var SF_Plugins = SF_Plugins || {};
SF_SkipLoadError.Graphics_playVideo = Graphics.playVideo;
Graphics.playVideo = function (src) {
this._videoLoader = ResourceHandler.createLoader(src, this._playVideo.bind(this, src), this._onVideoError.bind(this));
this._videoLoader = ResourceHandler.createLoader(
src,
this._playVideo.bind(this, src),
this._onVideoError.bind(this)
);
this._playVideo(src);
};
@ -188,11 +200,10 @@ var SF_Plugins = SF_Plugins || {};
SF_SkipLoadError.DataManager_loadDataFile = DataManager.loadDataFile;
DataManager.loadDataFile = function (name, src) {
var xhr = new XMLHttpRequest();
var url = 'data/' + src;
xhr.open('GET', url);
xhr.overrideMimeType('application/json');
var url = "data/" + src;
xhr.open("GET", url);
xhr.overrideMimeType("application/json");
xhr.onload = function () {
if (xhr.status < 400) {
window[name] = JSON.parse(xhr.responseText);
DataManager.onLoad(window[name]);
@ -202,9 +213,11 @@ var SF_Plugins = SF_Plugins || {};
if (index >= 0) SF_SkipLoadError.FileLoadingList.splice(index, 1);
if (xhr.status == 404) Graphics.printLoadingError(url);
};
xhr.onerror = this._mapLoader || function () {
DataManager._errorUrl = DataManager._errorUrl || url;
};
xhr.onerror =
this._mapLoader ||
function () {
DataManager._errorUrl = DataManager._errorUrl || url;
};
window[name] = null;
xhr.send();
};
@ -214,8 +227,8 @@ var SF_Plugins = SF_Plugins || {};
if (WebAudio._context) {
var xhr = new XMLHttpRequest();
if (Decrypter.hasEncryptedAudio) url = Decrypter.extToEncryptExt(url);
xhr.open('GET', url);
xhr.responseType = 'arraybuffer';
xhr.open("GET", url);
xhr.responseType = "arraybuffer";
xhr.onload = function () {
if (xhr.status < 400) {
this._onXhrLoad(xhr);
@ -224,15 +237,17 @@ var SF_Plugins = SF_Plugins || {};
if (index >= 0) SF_SkipLoadError.FileLoadingList.splice(index, 1);
if (xhr.status == 404) Graphics.printLoadingError(url);
}.bind(this);
xhr.onerror = this._loader || function () { this._hasError = true; }.bind(this);
xhr.onerror =
this._loader ||
function () {
this._hasError = true;
}.bind(this);
xhr.send();
}
};
SF_SkipLoadError.Scene_Base_isReady = Scene_Base.prototype.isReady;
Scene_Base.prototype.isReady = function () {
return SF_SkipLoadError.FileLoadingList.length === 0 && SF_SkipLoadError.Scene_Base_isReady.call(this);
};
})()
})();

@ -57,7 +57,7 @@ var SF_Plugins = SF_Plugins || {};
* 1. 添加状态 125
* 如果目标已经拥有状态 124则删除状态 124添加状态 125
* 否则添加状态 125
*
*
* <SF_StatesCustomAddtion_Before>
* var result = {
* "result": false,
@ -81,7 +81,7 @@ var SF_Plugins = SF_Plugins || {};
* 2. 添加状态60前
* 生成整随机数1~10如果随机数小于等于5则添加状态148
* 随机数结果不影响状态60的添加
*
*
* <SF_StatesCustomAddtion_Before>
* var result = {
* "result": false,
@ -97,7 +97,7 @@ var SF_Plugins = SF_Plugins || {};
* return result;
* </SF_StatesCustomAddtion_Before>
*
*
*
* ============================================================================
* 已知问题
* ============================================================================

@ -13,17 +13,17 @@ SF_Plugins.SF_WindowScrollCommand.version = 1.0;
//=============================================================================
/*:
* @plugindesc v1.0 Allows you to scroll text in selected commands.
* @author SaltedFish
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin allows you to scroll text in selected commands.
* As a dependent library.
*/
* @plugindesc v1.0 Allows you to scroll text in selected commands.
* @author SaltedFish
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin allows you to scroll text in selected commands.
* As a dependent library.
*/
//=============================================================================
//=============================================================================
@ -35,7 +35,7 @@ Window.prototype.initialize = function () {
this.leftArrowVisible = false;
this.rightArrowVisible = false;
}
};
SF_Plugins.SF_WindowScrollCommand.Window__createAllParts = Window.prototype._createAllParts;
Window.prototype._createAllParts = function () {
@ -46,7 +46,7 @@ Window.prototype._createAllParts = function () {
this._rightArrowSprite = new Sprite();
this.addChildAt(this._leftArrowSprite, index);
this.addChildAt(this._rightArrowSprite, index);
}
};
SF_Plugins.SF_WindowScrollCommand.Window__refreshArrows = Window.prototype._refreshArrows;
Window.prototype._refreshArrows = function () {
@ -69,26 +69,26 @@ Window.prototype._refreshArrows = function () {
this._rightArrowSprite.anchor.y = 0.5;
this._rightArrowSprite.setFrame(sx + p + q, sy + q, q, p);
this._rightArrowSprite.move(w - q, h / 2);
}
};
SF_Plugins.SF_WindowScrollCommand.Window__updateArrows = Window.prototype._updateArrows;
Window.prototype._updateArrows = function () {
SF_Plugins.SF_WindowScrollCommand.Window__updateArrows.call(this);
this._leftArrowSprite.visible = this.isOpen() && this.leftArrowVisible;
this._rightArrowSprite.visible = this.isOpen() && this.rightArrowVisible;
}
};
//=============================================================================
Window_Command.prototype.commandExt = function (index) {
return this._list[index].ext;
}
};
Window_Base.prototype.isMouseInsideFrame = function () {
var x = this.canvasToLocalX(TouchInput._mouseOverX);
var y = this.canvasToLocalY(TouchInput._mouseOverY);
return x >= 0 && y >= 0 && x < this.width && y < this.height;
}
};
SF_Plugins.SF_WindowScrollCommand.Window_Selectable_processWheel = Window_Selectable.prototype.processWheel;
Window_Selectable.prototype.processWheel = function () {
@ -102,7 +102,7 @@ Window_Base.prototype.measureTextHeight = function (text) {
textState.text = this.convertEscapeCharacters(text);
this.resetFontSettings();
return this.calcTextHeight(textState, true);
}
};
Window_Base.prototype.isOpenAndActive = function () {
return this.isOpen() && this.active;
@ -115,7 +115,7 @@ Window_Base.prototype.isTouchedInsideFrame = function () {
};
/**
*
*
* Each Command Bitmap need Scroll
* -------------------------------------------------------------------------------------
* Empty Bitmap(this.contentsWidth()) | Text Bitmap | Empty Bitmap(this.contentsWidth())
@ -135,14 +135,14 @@ Window_ScrollCommand.prototype.initialize = function () {
this._commands_need_scroll = [];
this._offset_threshold = [];
Window_Command.prototype.initialize.call(this, 0, 0);
}
};
// return width of text
Window_ScrollCommand.prototype.drawItemContent = function (index) {
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
return this.drawTextEx(this.commandName(index), this.contentsWidth(), 0);
}
};
Window_ScrollCommand.prototype.drawItem = function (index) {
if (this._commands_bitmap[index] == undefined) {
@ -171,13 +171,18 @@ Window_ScrollCommand.prototype.drawItem = function (index) {
var offset_x = this._commands_bitmap_offset[index];
this.contents.blt(
this._commands_bitmap[index],
offset_x, 0, this.itemTextRectWidth(index), rect.height,
rect.x, rect.y);
offset_x,
0,
this.itemTextRectWidth(index),
rect.height,
rect.x,
rect.y
);
};
Window_ScrollCommand.prototype.itemTextRectWidth = function (index) {
return this.itemRectForText(index).width;
}
};
Window_ScrollCommand.prototype.select = function (index) {
//var old_index = this.index();
@ -187,7 +192,7 @@ Window_ScrollCommand.prototype.select = function (index) {
//this._commands_bitmap_offset[old_index] = this.contentsWidth();
//this.redrawItem(old_index);
}
}
};
Window_ScrollCommand.prototype.updateSelected = function () {
var index = this.index();
@ -205,7 +210,7 @@ Window_ScrollCommand.prototype.update = function () {
if (this.isOpenAndActive() && this._need_scroll) {
this.updateSelected();
}
}
};
Window_ScrollCommand.prototype.refresh = function () {
this._commands_bitmap = [];
@ -229,36 +234,36 @@ Window_ScrollCommand.prototype.refresh = function () {
Window_ScrollHelp.prototype.constructor = Window_ScrollHelp;
Window_ScrollHelp.prototype.initialize = function (x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._text = '';
this._text = "";
this._offset_Y = 0;
this._wheel_multiplier = 1;
this._need_scroll = false;
this.refresh();
}
};
Window_ScrollHelp.prototype.clear = function () {
this._text = '';
this._text = "";
this._wheel_multiplier = 1;
this._touching = false;
this._need_scroll_X = false;
this._need_scroll_Y = false;
this.refresh();
}
};
Window_ScrollHelp.prototype.setText = function (text) {
this._text = text;
this.refresh();
}
};
Window_ScrollHelp.prototype.measureContentHeight = function () {
return this.measureTextHeight(this._text);
}
};
Window_ScrollHelp.prototype.measureContentWidth = function () {
return this.contentsWidth();
}
};
Window_ScrollHelp.prototype.drawContent = function () {
this.drawTextEx(this._text, 1, 0);
}
};
Window_ScrollHelp.prototype.isHaveContent = function () {
return !!this._text;
}
};
Window_ScrollHelp.prototype.refresh = function () {
this.contents.clear();
this._offset_Y = 0;
@ -275,20 +280,20 @@ Window_ScrollCommand.prototype.refresh = function () {
this._windowContentsSprite.setFrame(0, 0, this.contentsWidth(), this.contentsHeight());
this._windowContentsSprite._refresh();
}
}
};
Window_ScrollHelp.prototype.update = function () {
Window_Base.prototype.update.call(this);
if (this.isOpenAndActive() && (this._need_scroll_X || this._need_scroll_Y)) {
this.updateScroll();
}
}
};
Window_ScrollHelp.prototype.updateScroll = function () {
this.updateWheel();
this.updateTouch();
}
};
Window_ScrollHelp.prototype.setWheelMultiplier = function (multiplier) {
this._wheel_multiplier = multiplier;
}
};
Window_ScrollHelp.prototype.setOriginY = function (y) {
this.origin.y = y;
if (this.origin.y < 0) {
@ -296,7 +301,7 @@ Window_ScrollCommand.prototype.refresh = function () {
} else if (this.origin.y > this._bitmap_height - this.contentsHeight()) {
this.origin.y = this._bitmap_height - this.contentsHeight();
}
}
};
Window_ScrollHelp.prototype.setOriginX = function (x) {
this.origin.x = x;
if (this.origin.x < 0) {
@ -304,14 +309,14 @@ Window_ScrollCommand.prototype.refresh = function () {
} else if (this.origin.x > this._bitmap_width - this.contentsWidth()) {
this.origin.x = this._bitmap_width - this.contentsWidth();
}
}
};
Window_ScrollHelp.prototype.updateWheel = function () {
if (Input.isPressed('shift')) { // wheel Y as scroll X
if (Input.isPressed("shift")) {
// wheel Y as scroll X
if (this._need_scroll_X && Math.abs(TouchInput.wheelY) > 0) {
if (this.isMouseInsideFrame()) {
var offset = this._wheel_multiplier * TouchInput.wheelY;
this.setOriginX(this.origin.x + offset);
}
}
} else {
@ -319,7 +324,6 @@ Window_ScrollCommand.prototype.refresh = function () {
if (this.isMouseInsideFrame()) {
var offset = this._wheel_multiplier * TouchInput.wheelY;
this.setOriginY(this.origin.y + offset);
}
}
}
@ -330,7 +334,7 @@ Window_ScrollCommand.prototype.refresh = function () {
this.setOriginX(this.origin.x + offset);
}
}
}
};
Window_ScrollHelp.prototype.updateTouch = function () {
var inFrame = this.isTouchedInsideFrame();
@ -353,10 +357,9 @@ Window_ScrollCommand.prototype.refresh = function () {
this.setOriginX(this.origin.x + offset);
}
}
}
};
})();
//=============================================================================
// Window_SFSelectable
//=============================================================================
@ -396,11 +399,11 @@ Window_SFSelectable.prototype.initialize = function (x, y, width, height) {
this._origin_height = 0;
this.deactivate();
}
};
Window_SFSelectable.prototype.index = function () {
return this._index;
}
};
Window_SFSelectable.prototype.cursorFixed = function () {
return this._cursorFixed;
@ -420,60 +423,60 @@ Window_SFSelectable.prototype.setCursorAll = function (cursorAll) {
Window_SFSelectable.prototype.maxCols = function () {
return 1;
}
};
Window_SFSelectable.prototype.maxItems = function () {
return 0;
}
};
Window_SFSelectable.prototype.maxRows = function () {
return Math.max(Math.ceil(this.maxItems() / this.maxCols()), 1);
}
};
Window_SFSelectable.prototype.spacing = function () {
return 12;
}
};
Window_SFSelectable.prototype.itemWidth = function () {
throw new Error('This method needs to be overwritten.');
}
throw new Error("This method needs to be overwritten.");
};
Window_SFSelectable.prototype.itemHeight = function () {
throw new Error('This method needs to be overwritten.');
}
throw new Error("This method needs to be overwritten.");
};
Window_SFSelectable.prototype.activate = function () {
Window_Base.prototype.activate.call(this);
this.reselect();
}
};
Window_SFSelectable.prototype.deactivate = function () {
Window_Base.prototype.deactivate.call(this);
this.reselect();
}
};
Window_SFSelectable.prototype.select = function (index) {
this._index = index;
this.ensureCursorVisible();
this.updateCursor();
this.callUpdateHelp();
}
};
Window_SFSelectable.prototype.deselect = function () {
this.select(-1);
}
};
Window_SFSelectable.prototype.reselect = function () {
this.select(this._index);
}
};
Window_SFSelectable.prototype.row = function () {
return Math.floor(this.index() / this.maxCols());
}
};
Window_SFSelectable.prototype.topRow = function () {
return Math.max(0, this._scrollY);
}
};
Window_SFSelectable.prototype.setTopRow = function (row) {
var scrollY = row.clamp(0, this.maxTopRow());
@ -482,32 +485,32 @@ Window_SFSelectable.prototype.setTopRow = function (row) {
this.refresh();
this.updateCursor();
}
}
};
Window_SFSelectable.prototype.bottomRow = function () {
return Math.max(0, this.topRow() + this.maxPageRows() - 1);
}
};
Window_SFSelectable.prototype.setBottomRow = function (row) {
this.setTopRow(row - (this.maxPageRows() - 1));
}
};
Window_SFSelectable.prototype.maxPageRows = function () {
var pageHeight = this.height - this.padding * 2;
return Math.min(Math.floor(pageHeight / this.itemHeight()) || 1, this.maxRows());
}
};
Window_SFSelectable.prototype.maxTopRow = function () {
return Math.max(0, this.maxRows() - this.maxPageRows());
}
};
Window_SFSelectable.prototype.col = function () {
return this.index() % this.maxCols();
}
};
Window_SFSelectable.prototype.leftCol = function () {
return Math.max(0, this._scrollX);
}
};
Window_SFSelectable.prototype.setLeftCol = function (col) {
var scrollX = col.clamp(0, this.maxLeftCol());
@ -516,54 +519,54 @@ Window_SFSelectable.prototype.setLeftCol = function (col) {
this.refresh();
this.updateCursor();
}
}
};
Window_SFSelectable.prototype.rightCol = function () {
return Math.max(0, this.leftCol() + this.maxPageCols() - 1);
}
};
Window_SFSelectable.prototype.setRightCol = function (col) {
this.setLeftCol(col - (this.maxPageCols() - 1));
}
};
Window_SFSelectable.prototype.maxPageCols = function () {
var pageWidth = this.width - this.padding * 2;
return Math.min(Math.floor(pageWidth / this.itemWidth()) || 1, this.maxCols());
}
};
Window_SFSelectable.prototype.maxLeftCol = function () {
return Math.max(0, this.maxCols() - this.maxPageCols());
}
};
Window_SFSelectable.prototype.resetScroll = function () {
this.setTopRow(0);
this.setLeftCol(0);
}
};
Window_SFSelectable.prototype.maxPageItems = function () {
return this.maxPageRows() * this.maxPageCols();
}
};
Window_SFSelectable.prototype.topIndex = function () {
return this.topRow() * this.maxCols() + this.leftCol();
}
};
Window_SFSelectable.prototype.itemRect = function (index) {
var rect = new Rectangle();
var maxCols = this.maxCols();
rect.width = this.itemWidth();
rect.height = this.itemHeight();
rect.x = (index % maxCols - this.leftCol()) * (rect.width + this.spacing());
rect.x = ((index % maxCols) - this.leftCol()) * (rect.width + this.spacing());
rect.y = Math.floor(index / maxCols - this.topRow()) * rect.height;
return rect;
}
};
Window_SFSelectable.prototype.itemRectForText = function (index) {
var rect = this.itemRect(index);
rect.x += this.textPadding();
rect.width -= this.textPadding() * 2;
return rect;
}
};
Window_SFSelectable.prototype.setHelpWindow = function (helpWindow) {
this._helpWindow = helpWindow;
@ -601,8 +604,7 @@ Window_SFSelectable.prototype.isOpenAndActive = function () {
};
Window_SFSelectable.prototype.isCursorMovable = function () {
return (this.isOpenAndActive() && !this._cursorFixed &&
!this._cursorAll && this.maxItems() > 0);
return this.isOpenAndActive() && !this._cursorFixed && !this._cursorAll && this.maxItems() > 0;
};
Window_SFSelectable.prototype.cursorUp = function (wrap) {
@ -661,13 +663,13 @@ Window_Selectable.prototype.scrollLeft = function () {
if (this.leftCol() > 0) {
this.setLeftCol(this.leftCol() - 1);
}
}
};
Window_SFSelectable.prototype.scrollRight = function () {
if (this.rightCol() < this.maxCols()) {
this.setRightCol(this.rightCol() + 1);
}
}
};
Window_SFSelectable.prototype.update = function () {
Window_Base.prototype.update.call(this);
@ -676,7 +678,7 @@ Window_SFSelectable.prototype.update = function () {
this.processHandling();
this.processWheel();
this.processTouch();
}
};
Window_SFSelectable.prototype.updateArrows = function () {
var topRow = this.topRow();
@ -688,28 +690,28 @@ Window_SFSelectable.prototype.updateArrows = function () {
var maxLeftCol = this.maxLeftCol();
this.rightArrowVisible = maxLeftCol > 0 && leftCol < maxLeftCol;
this.leftArrowVisible = leftCol > 0;
}
};
Window_SFSelectable.prototype.processCursorMove = function () {
if (this.isCursorMovable()) {
var lastIndex = this.index();
if (Input.isRepeated('down')) {
this.cursorDown(Input.isTriggered('down'));
if (Input.isRepeated("down")) {
this.cursorDown(Input.isTriggered("down"));
}
if (Input.isRepeated('up')) {
this.cursorUp(Input.isTriggered('up'));
if (Input.isRepeated("up")) {
this.cursorUp(Input.isTriggered("up"));
}
if (Input.isRepeated('right')) {
this.cursorRight(Input.isTriggered('right'));
if (Input.isRepeated("right")) {
this.cursorRight(Input.isTriggered("right"));
}
if (Input.isRepeated('left')) {
this.cursorLeft(Input.isTriggered('left'));
if (Input.isRepeated("left")) {
this.cursorLeft(Input.isTriggered("left"));
}
if (this.index() !== lastIndex) {
SoundManager.playCursor();
}
}
}
};
Window_SFSelectable.prototype.processHandling = function () {
if (this.isOpenAndActive()) {
@ -725,7 +727,7 @@ Window_SFSelectable.prototype.processWheel = function () {
var inFrame = this.isMouseInsideFrame();
if (inFrame && this.isOpen()) {
var threshold = 20;
var hasShift = Input.isPressed('shift');
var hasShift = Input.isPressed("shift");
if (TouchInput.wheelY >= threshold) {
if (!hasShift) {
this.scrollDown();
@ -741,7 +743,7 @@ Window_SFSelectable.prototype.processWheel = function () {
}
}
}
}
};
Window_SFSelectable.prototype.processTouch = function () {
var inFrame = this.isTouchedInsideFrame();
@ -789,8 +791,7 @@ Window_SFSelectable.prototype.processTouch = function () {
}
}
}
}
};
Window_SFSelectable.prototype.hitTest = function (x, y) {
var x2 = this.canvasToLocalX(x);
@ -814,4 +815,4 @@ Window_SFSelectable.prototype.hitTest = function (x, y) {
}
}
return -1;
}
};

@ -17,7 +17,7 @@
* @help This plugin does not provide plugin commands.
*
* By not displaying the log and only displaying the skill name,
* the speed of battle will increase slightly.
* the speed of battle will increase slightly.
*/
/*:ja
@ -37,55 +37,50 @@
* ログを表示せず技名のみを表示することで戦闘のテンポが若干高速になります
*/
(function() {
(function () {
var parameters = PluginManager.parameters("SimpleMsgSideView");
var displayAttack = Number(parameters["displayAttack"]) != 0;
var position = Number(parameters["position"] || 1);
var parameters = PluginManager.parameters('SimpleMsgSideView');
var displayAttack = Number(parameters['displayAttack']) != 0;
var position = Number(parameters['position'] || 1);
var _Window_BattleLog_addText = Window_BattleLog.prototype.addText;
Window_BattleLog.prototype.addText = function (text) {
if ($gameSystem.isSideView()) {
this.refresh();
this.wait();
return; // not display battle log
}
_Window_BattleLog_addText.call(this, text);
};
var _Window_BattleLog_addText = Window_BattleLog.prototype.addText;
Window_BattleLog.prototype.addText = function(text) {
if($gameSystem.isSideView()){
this.refresh();
this.wait();
return; // not display battle log
}
_Window_BattleLog_addText.call(this, text);
};
// for sideview battle only
Window_BattleLog.prototype.addItemNameText = function (itemName) {
this._lines.push(itemName);
this.refresh();
this.wait();
};
// for sideview battle only
Window_BattleLog.prototype.addItemNameText = function(itemName) {
this._lines.push(itemName);
this.refresh();
this.wait();
};
var _Window_BattleLog_displayAction =
Window_BattleLog.prototype.displayAction;
Window_BattleLog.prototype.displayAction = function(subject, item) {
if($gameSystem.isSideView()){
if(displayAttack ||
!(DataManager.isSkill(item) && item.id == subject.attackSkillId())) {
   this.push('addItemNameText', item.name); // display item/skill name
} else {
this.push('wait');
}
return;
}
_Window_BattleLog_displayAction.call(this, subject, item);
};
// to put skill/item name at center
var _Window_BattleLog_drawLineText = Window_BattleLog.prototype.drawLineText;
Window_BattleLog.prototype.drawLineText = function(index) {
if($gameSystem.isSideView() && position == 1){
var rect = this.itemRectForText(index);
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
this.drawText(this._lines[index], rect.x, rect.y,
rect.width, 'center');
return;
}
_Window_BattleLog_drawLineText.call(this, index);
};
var _Window_BattleLog_displayAction = Window_BattleLog.prototype.displayAction;
Window_BattleLog.prototype.displayAction = function (subject, item) {
if ($gameSystem.isSideView()) {
if (displayAttack || !(DataManager.isSkill(item) && item.id == subject.attackSkillId())) {
this.push("addItemNameText", item.name); // display item/skill name
} else {
this.push("wait");
}
return;
}
_Window_BattleLog_displayAction.call(this, subject, item);
};
// to put skill/item name at center
var _Window_BattleLog_drawLineText = Window_BattleLog.prototype.drawLineText;
Window_BattleLog.prototype.drawLineText = function (index) {
if ($gameSystem.isSideView() && position == 1) {
var rect = this.itemRectForText(index);
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
this.drawText(this._lines[index], rect.x, rect.y, rect.width, "center");
return;
}
_Window_BattleLog_drawLineText.call(this, index);
};
})();

@ -48,25 +48,22 @@
* @help このプラグインにはプラグインコマンドはありません
*/
(function() {
(function () {
var parameters = PluginManager.parameters("TitleCommandPosition");
var offsetX = Number(parameters["Offset X"] || 0);
var offsetY = Number(parameters["Offset Y"] || 0);
var width = Number(parameters["Width"] || 240);
var background = Number(parameters["Background"] || 0);
var parameters = PluginManager.parameters('TitleCommandPosition');
var offsetX = Number(parameters['Offset X'] || 0);
var offsetY = Number(parameters['Offset Y'] || 0);
var width = Number(parameters['Width'] || 240);
var background = Number(parameters['Background'] || 0);
var _Window_TitleCommand_updatePlacement =
Window_TitleCommand.prototype.updatePlacement;
Window_TitleCommand.prototype.updatePlacement = function() {
var _Window_TitleCommand_updatePlacement = Window_TitleCommand.prototype.updatePlacement;
Window_TitleCommand.prototype.updatePlacement = function () {
_Window_TitleCommand_updatePlacement.call(this);
this.x += offsetX;
this.y += offsetY;
this.setBackgroundType(background);
};
Window_TitleCommand.prototype.windowWidth = function() {
Window_TitleCommand.prototype.windowWidth = function () {
return width;
};
})();

File diff suppressed because it is too large Load Diff

@ -8,7 +8,7 @@
*
* @help This plugin does not provide plugin commands.
*
* When <skill_id:3> is written in a weapon's note field,
* When <skill_id:3> is written in a weapon's note field,
* skill id # 3 is used for the weapon's attack.
* If nothing is written, default id(=1) is used.
*
@ -22,7 +22,7 @@
* - to create all-range weapons
* - to create dual-attack or triple-attack weapons
* - If healing skill is set when actor attacks, you can choose a friend to heal.
* - It is possible to make a weapon that functions similar to a guard command.
* - It is possible to make a weapon that functions similar to a guard command.
*/
/*:ja
@ -48,36 +48,33 @@
* - 防御コマンドなどと同等になる武器も実現可能です
*/
(function() {
//
// set skill id for attack.
//
Game_Actor.prototype.attackSkillId = function() {
var normalId = Game_BattlerBase.prototype.attackSkillId.call(this);
if(this.hasNoWeapons()){
return normalId;
}
var weapon = this.weapons()[0]; // at plural weapon, one's first skill.
var id = weapon.meta.skill_id;
return id ? Number(id) : normalId;
};
//
// for command at battle
//
var _Scene_Battle_commandAttack = Scene_Battle.prototype.commandAttack;
Scene_Battle.prototype.commandAttack = function() {
BattleManager.inputtingAction().setAttack();
// normal attack weapon (or other single attack weapon)
var action = BattleManager.inputtingAction();
if(action.needsSelection() && action.isForOpponent()){
_Scene_Battle_commandAttack.call(this);
return;
}
// special skill weapon
this.onSelectAction();
};
(function () {
//
// set skill id for attack.
//
Game_Actor.prototype.attackSkillId = function () {
var normalId = Game_BattlerBase.prototype.attackSkillId.call(this);
if (this.hasNoWeapons()) {
return normalId;
}
var weapon = this.weapons()[0]; // at plural weapon, one's first skill.
var id = weapon.meta.skill_id;
return id ? Number(id) : normalId;
};
//
// for command at battle
//
var _Scene_Battle_commandAttack = Scene_Battle.prototype.commandAttack;
Scene_Battle.prototype.commandAttack = function () {
BattleManager.inputtingAction().setAttack();
// normal attack weapon (or other single attack weapon)
var action = BattleManager.inputtingAction();
if (action.needsSelection() && action.isForOpponent()) {
_Scene_Battle_commandAttack.call(this);
return;
}
// special skill weapon
this.onSelectAction();
};
})();

@ -11,7 +11,7 @@ Yanfly.APS = Yanfly.APS || {};
Yanfly.APS.version = 1.17;
//=============================================================================
/*:
/*:
* @plugindesc v1.17 This plugin allows for some states to function as
* passives for actors, enemies, skills, and equips.
* @author Yanfly Engine Plugins
@ -221,53 +221,53 @@ Yanfly.APS.version = 1.17;
// Parameter Variables
//=============================================================================
Yanfly.SetupParameters = function() {
Yanfly.Parameters = PluginManager.parameters('YEP_AutoPassiveStates');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.APSActorPas = String(Yanfly.Parameters['Actor Passives']);
Yanfly.Param.APSActorPas = Yanfly.Param.APSActorPas.split(' ');
for (var i = 0; i < Yanfly.Param.APSActorPas.length; ++i) {
Yanfly.Param.APSActorPas[i] = parseInt(Yanfly.Param.APSActorPas[i]);
Yanfly.Param.APSActorPas[i] = Yanfly.Param.APSActorPas[i] || 0;
}
var data = JSON.parse(Yanfly.Parameters['Actor Passives List']);
for (var i = 0; i < data.length; ++i) {
var stateId = parseInt(data[i]);
if (stateId <= 0) continue;
if (Yanfly.Param.APSActorPas.contains(stateId)) continue;
Yanfly.Param.APSActorPas.push(stateId);
}
Yanfly.Param.APSEnemyPas = String(Yanfly.Parameters['Enemy Passives']);
Yanfly.Param.APSEnemyPas = Yanfly.Param.APSEnemyPas.split(' ');
for (var i = 0; i < Yanfly.Param.APSEnemyPas.length; ++i) {
Yanfly.Param.APSEnemyPas[i] = parseInt(Yanfly.Param.APSEnemyPas[i]);
Yanfly.Param.APSEnemyPas[i] = Yanfly.Param.APSEnemyPas[i] || 0;
}
var data = JSON.parse(Yanfly.Parameters['Enemy Passives List']);
for (var i = 0; i < data.length; ++i) {
var stateId = parseInt(data[i]);
if (stateId <= 0) continue;
if (Yanfly.Param.APSEnemyPas.contains(stateId)) continue;
Yanfly.Param.APSEnemyPas.push(stateId);
}
Yanfly.Param.APSGlobalPas = String(Yanfly.Parameters['Global Passives']);
Yanfly.Param.APSGlobalPas = Yanfly.Param.APSGlobalPas.split(' ');
for (var i = 0; i < Yanfly.Param.APSGlobalPas.length; ++i) {
id = parseInt(Yanfly.Param.APSGlobalPas[i]);
Yanfly.Param.APSActorPas.push(id);
Yanfly.Param.APSEnemyPas.push(id);
}
var data = JSON.parse(Yanfly.Parameters['Global Passives List']);
for (var i = 0; i < data.length; ++i) {
var stateId = parseInt(data[i]);
if (stateId <= 0) continue;
if (!Yanfly.Param.APSActorPas.contains(stateId)) {
Yanfly.Param.APSActorPas.push(stateId);
Yanfly.SetupParameters = function () {
Yanfly.Parameters = PluginManager.parameters("YEP_AutoPassiveStates");
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.APSActorPas = String(Yanfly.Parameters["Actor Passives"]);
Yanfly.Param.APSActorPas = Yanfly.Param.APSActorPas.split(" ");
for (var i = 0; i < Yanfly.Param.APSActorPas.length; ++i) {
Yanfly.Param.APSActorPas[i] = parseInt(Yanfly.Param.APSActorPas[i]);
Yanfly.Param.APSActorPas[i] = Yanfly.Param.APSActorPas[i] || 0;
}
if (!Yanfly.Param.APSEnemyPas.contains(stateId)) {
Yanfly.Param.APSEnemyPas.push(stateId);
var data = JSON.parse(Yanfly.Parameters["Actor Passives List"]);
for (var i = 0; i < data.length; ++i) {
var stateId = parseInt(data[i]);
if (stateId <= 0) continue;
if (Yanfly.Param.APSActorPas.contains(stateId)) continue;
Yanfly.Param.APSActorPas.push(stateId);
}
Yanfly.Param.APSEnemyPas = String(Yanfly.Parameters["Enemy Passives"]);
Yanfly.Param.APSEnemyPas = Yanfly.Param.APSEnemyPas.split(" ");
for (var i = 0; i < Yanfly.Param.APSEnemyPas.length; ++i) {
Yanfly.Param.APSEnemyPas[i] = parseInt(Yanfly.Param.APSEnemyPas[i]);
Yanfly.Param.APSEnemyPas[i] = Yanfly.Param.APSEnemyPas[i] || 0;
}
var data = JSON.parse(Yanfly.Parameters["Enemy Passives List"]);
for (var i = 0; i < data.length; ++i) {
var stateId = parseInt(data[i]);
if (stateId <= 0) continue;
if (Yanfly.Param.APSEnemyPas.contains(stateId)) continue;
Yanfly.Param.APSEnemyPas.push(stateId);
}
Yanfly.Param.APSGlobalPas = String(Yanfly.Parameters["Global Passives"]);
Yanfly.Param.APSGlobalPas = Yanfly.Param.APSGlobalPas.split(" ");
for (var i = 0; i < Yanfly.Param.APSGlobalPas.length; ++i) {
id = parseInt(Yanfly.Param.APSGlobalPas[i]);
Yanfly.Param.APSActorPas.push(id);
Yanfly.Param.APSEnemyPas.push(id);
}
var data = JSON.parse(Yanfly.Parameters["Global Passives List"]);
for (var i = 0; i < data.length; ++i) {
var stateId = parseInt(data[i]);
if (stateId <= 0) continue;
if (!Yanfly.Param.APSActorPas.contains(stateId)) {
Yanfly.Param.APSActorPas.push(stateId);
}
if (!Yanfly.Param.APSEnemyPas.contains(stateId)) {
Yanfly.Param.APSEnemyPas.push(stateId);
}
}
}
};
Yanfly.SetupParameters();
@ -276,138 +276,155 @@ Yanfly.SetupParameters();
//=============================================================================
Yanfly.APS.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Yanfly.APS.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_AutoPassiveStates) {
this.processAPSNotetags1($dataActors, Yanfly.Param.APSActorPas);
this.processAPSNotetags1($dataClasses);
this.processAPSNotetags1($dataEnemies, Yanfly.Param.APSEnemyPas);
this.processAPSNotetags1($dataSkills);
this.processAPSNotetags1($dataWeapons);
this.processAPSNotetags1($dataArmors);
this.processAPSNotetags2($dataStates);
Yanfly._loaded_YEP_AutoPassiveStates = true;
}
return true;
DataManager.isDatabaseLoaded = function () {
if (!Yanfly.APS.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_AutoPassiveStates) {
this.processAPSNotetags1($dataActors, Yanfly.Param.APSActorPas);
this.processAPSNotetags1($dataClasses);
this.processAPSNotetags1($dataEnemies, Yanfly.Param.APSEnemyPas);
this.processAPSNotetags1($dataSkills);
this.processAPSNotetags1($dataWeapons);
this.processAPSNotetags1($dataArmors);
this.processAPSNotetags2($dataStates);
Yanfly._loaded_YEP_AutoPassiveStates = true;
}
return true;
};
DataManager.processAPSNotetags1 = function(group, inheritArray) {
var note1 = /<(?:PASSIVE STATE):[ ]*(\d+(?:\s*,\s*\d+)*)>/i;
var note2 = /<(?:PASSIVE STATE):[ ](\d+)[ ](?:THROUGH|to)[ ](\d+)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
DataManager.processAPSNotetags1 = function (group, inheritArray) {
var note1 = /<(?:PASSIVE STATE):[ ]*(\d+(?:\s*,\s*\d+)*)>/i;
var note2 = /<(?:PASSIVE STATE):[ ](\d+)[ ](?:THROUGH|to)[ ](\d+)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.passiveStates = [];
if (inheritArray) {
obj.passiveStates = obj.passiveStates.concat(inheritArray);
}
obj.passiveStates = [];
if (inheritArray) {
obj.passiveStates = obj.passiveStates.concat(inheritArray);
}
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
var array = JSON.parse('[' + RegExp.$1.match(/\d+/g) + ']');
obj.passiveStates = obj.passiveStates.concat(array);
} else if (line.match(note2)) {
var range = Yanfly.Util.getRange(parseInt(RegExp.$1),
parseInt(RegExp.$2));
obj.passiveStates = obj.passiveStates.concat(range);
}
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
var array = JSON.parse("[" + RegExp.$1.match(/\d+/g) + "]");
obj.passiveStates = obj.passiveStates.concat(array);
} else if (line.match(note2)) {
var range = Yanfly.Util.getRange(parseInt(RegExp.$1), parseInt(RegExp.$2));
obj.passiveStates = obj.passiveStates.concat(range);
}
}
}
}
};
DataManager.processAPSNotetags2 = function(group) {
var note1a = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:ABOVE)[ ](\d+)([%])>/i;
var note1b = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:BELOW)[ ](\d+)([%])>/i;
var note2a = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:ABOVE)[ ](\d+)>/i;
var note2b = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:BELOW)[ ](\d+)>/i;
var note3a = /<(?:PASSIVE CONDITION):[ ]SWITCH[ ](\d+)[ ](.*)>/i;
var notez1 = /<(?:CUSTOM PASSIVE CONDITION)>/i;
var notez2 = /<\/(?:CUSTOM PASSIVE CONDITION)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.passiveCondition = '';
obj.passiveConditionEval = '';
var evalMode = 'none';
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1a)) {
var rate = parseFloat(RegExp.$2) * 0.01;
var param = this.getPassiveConditionParamRate(String(RegExp.$1));
var pass = 'if (' + param + ' <= ' + rate + ') condition = false;';
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(note1b)) {
var rate = parseFloat(RegExp.$2) * 0.01;
var param = this.getPassiveConditionParamRate(String(RegExp.$1));
var pass = 'if (' + param + ' >= ' + rate + ') condition = false;';
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(note2a)) {
var rate = parseInt(RegExp.$2);
var param = this.getPassiveConditionParam(String(RegExp.$1));
var pass = 'if (' + param + ' <= ' + rate + ') condition = false;';
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(note2b)) {
var rate = parseInt(RegExp.$2);
var param = this.getPassiveConditionParam(String(RegExp.$1));
var pass = 'if (' + param + ' >= ' + rate + ') condition = false;';
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(note3a)) {
var id = parseInt(RegExp.$1);
var value = String(RegExp.$2).toUpperCase();
var pass = ''
if (['ON', 'TRUE', 'ENABLE', 'ENABLED'].contains(value)) {
pass = 'if (!$gameSwitches.value(' + id + ')) condition = false;'
DataManager.processAPSNotetags2 = function (group) {
var note1a = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:ABOVE)[ ](\d+)([%])>/i;
var note1b = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:BELOW)[ ](\d+)([%])>/i;
var note2a = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:ABOVE)[ ](\d+)>/i;
var note2b = /<(?:PASSIVE CONDITION):[ ](.*)[ ](?:BELOW)[ ](\d+)>/i;
var note3a = /<(?:PASSIVE CONDITION):[ ]SWITCH[ ](\d+)[ ](.*)>/i;
var notez1 = /<(?:CUSTOM PASSIVE CONDITION)>/i;
var notez2 = /<\/(?:CUSTOM PASSIVE CONDITION)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.passiveCondition = "";
obj.passiveConditionEval = "";
var evalMode = "none";
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1a)) {
var rate = parseFloat(RegExp.$2) * 0.01;
var param = this.getPassiveConditionParamRate(String(RegExp.$1));
var pass = "if (" + param + " <= " + rate + ") condition = false;";
obj.passiveCondition = obj.passiveCondition + pass + "\n";
} else if (line.match(note1b)) {
var rate = parseFloat(RegExp.$2) * 0.01;
var param = this.getPassiveConditionParamRate(String(RegExp.$1));
var pass = "if (" + param + " >= " + rate + ") condition = false;";
obj.passiveCondition = obj.passiveCondition + pass + "\n";
} else if (line.match(note2a)) {
var rate = parseInt(RegExp.$2);
var param = this.getPassiveConditionParam(String(RegExp.$1));
var pass = "if (" + param + " <= " + rate + ") condition = false;";
obj.passiveCondition = obj.passiveCondition + pass + "\n";
} else if (line.match(note2b)) {
var rate = parseInt(RegExp.$2);
var param = this.getPassiveConditionParam(String(RegExp.$1));
var pass = "if (" + param + " >= " + rate + ") condition = false;";
obj.passiveCondition = obj.passiveCondition + pass + "\n";
} else if (line.match(note3a)) {
var id = parseInt(RegExp.$1);
var value = String(RegExp.$2).toUpperCase();
var pass = "";
if (["ON", "TRUE", "ENABLE", "ENABLED"].contains(value)) {
pass = "if (!$gameSwitches.value(" + id + ")) condition = false;";
}
if (["OFF", "FALSE", "DISABLE", "DISABLED"].contains(value)) {
pass = "if ($gameSwitches.value(" + id + ")) condition = false;";
}
if (pass === "") continue;
obj.passiveCondition = obj.passiveCondition + pass + "\n";
} else if (line.match(notez1)) {
evalMode = "custom passive condition";
} else if (line.match(notez2)) {
evalMode = "none";
} else if (evalMode === "custom passive condition") {
obj.passiveConditionEval = obj.passiveConditionEval + line + "\n";
}
}
if (['OFF', 'FALSE', 'DISABLE', 'DISABLED'].contains(value)) {
pass = 'if ($gameSwitches.value(' + id + ')) condition = false;'
}
if (pass === '') continue;
obj.passiveCondition = obj.passiveCondition + pass + '\n';
} else if (line.match(notez1)) {
evalMode = 'custom passive condition';
} else if (line.match(notez2)) {
evalMode = 'none';
} else if (evalMode === 'custom passive condition') {
obj.passiveConditionEval = obj.passiveConditionEval + line + '\n';
}
}
obj.passiveCondition = new Function('condition','a','user','subject','b',
'target','s','v', obj.passiveCondition + '\nreturn condition;');
obj.passiveConditionEval = new Function('condition','a','user','subject',
'b','target','s','v', obj.passiveConditionEval + '\nreturn condition;');
}
obj.passiveCondition = new Function(
"condition",
"a",
"user",
"subject",
"b",
"target",
"s",
"v",
obj.passiveCondition + "\nreturn condition;"
);
obj.passiveConditionEval = new Function(
"condition",
"a",
"user",
"subject",
"b",
"target",
"s",
"v",
obj.passiveConditionEval + "\nreturn condition;"
);
}
};
DataManager.getPassiveConditionParam = function(string) {
DataManager.getPassiveConditionParam = function (string) {
string = string.toUpperCase();
var text = 'user.';
if (['HP'].contains(string)) text += 'hp';
if (['MP', 'SP'].contains(string)) text += 'mp';
if (['TP'].contains(string)) text += 'tp';
if (['ATK'].contains(string)) text += 'param(2)';
if (['DEF'].contains(string)) text += 'param(3)';
if (['MAT', 'INT'].contains(string)) text += 'param(4)';
if (['MDF', 'RES'].contains(string)) text += 'param(5)';
if (['AGI'].contains(string)) text += 'param(6)';
if (['LUK'].contains(string)) text += 'param(7)';
if (['MAX HP', 'MAXHP'].contains(string)) text += 'mhp';
if (['MAX MP', 'MAX SP', 'MAXMP', 'MAXSP'].contains(string)) text += 'mmp';
var text = "user.";
if (["HP"].contains(string)) text += "hp";
if (["MP", "SP"].contains(string)) text += "mp";
if (["TP"].contains(string)) text += "tp";
if (["ATK"].contains(string)) text += "param(2)";
if (["DEF"].contains(string)) text += "param(3)";
if (["MAT", "INT"].contains(string)) text += "param(4)";
if (["MDF", "RES"].contains(string)) text += "param(5)";
if (["AGI"].contains(string)) text += "param(6)";
if (["LUK"].contains(string)) text += "param(7)";
if (["MAX HP", "MAXHP"].contains(string)) text += "mhp";
if (["MAX MP", "MAX SP", "MAXMP", "MAXSP"].contains(string)) text += "mmp";
if (string.match(/VARIABLE[ ](\d+)/i)) {
text = '$gameVariables.value(' + parseInt(RegExp.$1) + ')';
text = "$gameVariables.value(" + parseInt(RegExp.$1) + ")";
}
return text;
};
DataManager.getPassiveConditionParamRate = function(string) {
DataManager.getPassiveConditionParamRate = function (string) {
string = string.toUpperCase();
var text = '0';
if (['HP'].contains(string)) return 'user.hpRate()';
if (['MP'].contains(string)) return 'user.mpRate()';
var text = "0";
if (["HP"].contains(string)) return "user.hpRate()";
if (["MP"].contains(string)) return "user.mpRate()";
return text;
};
@ -416,137 +433,134 @@ DataManager.getPassiveConditionParamRate = function(string) {
//=============================================================================
Yanfly.APS.Game_BattlerBase_refresh = Game_BattlerBase.prototype.refresh;
Game_BattlerBase.prototype.refresh = function() {
Game_BattlerBase.prototype.refresh = function () {
this._passiveStatesRaw = undefined;
Yanfly.APS.Game_BattlerBase_refresh.call(this);
};
Yanfly.APS.Game_BattlerBase_states = Game_BattlerBase.prototype.states;
Game_BattlerBase.prototype.states = function() {
Game_BattlerBase.prototype.states = function () {
var array = Yanfly.APS.Game_BattlerBase_states.call(this);
array = array.concat(this.passiveStates());
this.sortPassiveStates(array);
return array;
};
Yanfly.APS.Game_BattlerBase_isStateAffected =
Game_BattlerBase.prototype.isStateAffected;
Game_BattlerBase.prototype.isStateAffected = function(stateId) {
Yanfly.APS.Game_BattlerBase_isStateAffected = Game_BattlerBase.prototype.isStateAffected;
Game_BattlerBase.prototype.isStateAffected = function (stateId) {
if (this.isPassiveStateAffected(stateId)) return true;
return Yanfly.APS.Game_BattlerBase_isStateAffected.call(this, stateId);
};
Game_BattlerBase.prototype.passiveStates = function() {
Game_BattlerBase.prototype.passiveStates = function () {
var array = [];
var raw = this.passiveStatesRaw();
for (var i = 0; i < raw.length; ++i) {
var state = $dataStates[raw[i]];
if (state && array.contains(state)) continue;
array.push(state);
var state = $dataStates[raw[i]];
if (state && array.contains(state)) continue;
array.push(state);
}
return array;
};
Game_BattlerBase.prototype.passiveStatesRaw = function() {
Game_BattlerBase.prototype.passiveStatesRaw = function () {
var array = [];
return array.filter(Yanfly.Util.onlyUnique);
};
Game_BattlerBase.prototype.getPassiveStateData = function(obj) {
Game_BattlerBase.prototype.getPassiveStateData = function (obj) {
if (!obj) return [];
if (!obj.passiveStates) return [];
var array = [];
for (var i = 0; i < obj.passiveStates.length; ++i) {
var stateId = obj.passiveStates[i];
if (!this.meetPassiveStateCondition(stateId)) continue;
array.push(stateId);
var stateId = obj.passiveStates[i];
if (!this.meetPassiveStateCondition(stateId)) continue;
array.push(stateId);
}
var added = this.addEquipBattleTestSkillPassives(obj);
if (added.length > 0) {
for (var i = 0; i < added.length; ++i) {
var stateId = added[i];
if (!this.meetPassiveStateCondition(stateId)) continue;
array.push(stateId);
}
for (var i = 0; i < added.length; ++i) {
var stateId = added[i];
if (!this.meetPassiveStateCondition(stateId)) continue;
array.push(stateId);
}
}
return array;
};
Game_BattlerBase.prototype.addEquipBattleTestSkillPassives = function(obj) {
if (!Imported.YEP_EquipBattleSkills) return [];
if (!DataManager.isBattleTest()) return [];
if (!DataManager.isSkill(obj)) return [];
return obj.equipStates;
Game_BattlerBase.prototype.addEquipBattleTestSkillPassives = function (obj) {
if (!Imported.YEP_EquipBattleSkills) return [];
if (!DataManager.isBattleTest()) return [];
if (!DataManager.isSkill(obj)) return [];
return obj.equipStates;
};
Game_BattlerBase.prototype.meetPassiveStateCondition = function(stateId) {
Game_BattlerBase.prototype.meetPassiveStateCondition = function (stateId) {
this._checkPassiveStateCondition = this._checkPassiveStateCondition || [];
if (this._checkPassiveStateCondition.contains(stateId)) return false;
var state = $dataStates[stateId];
if (!state) return false;
if (state.passiveCondition !== '') {
if (!this.passiveStateConditions(state)) return false;
if (state.passiveCondition !== "") {
if (!this.passiveStateConditions(state)) return false;
}
if (state.passiveConditionEval === '') return true;
if (state.passiveConditionEval === "") return true;
return this.passiveStateConditionEval(state);
};
Game_BattlerBase.prototype.passiveStateConditions = function(state) {
this._checkPassiveStateCondition = this._checkPassiveStateCondition || [];
this._checkPassiveStateCondition.push(state.id);
var condition = true;
var a = this;
var user = this;
var subject = this;
var b = this;
var target = this;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var code = state.passiveCondition;
try {
condition = state.passiveCondition.call(this, condition, a, user, subject,
b, target, s, v);
} catch (e) {
Yanfly.Util.displayError(e, code, 'PASSIVE STATE CUSTOM CONDITION ERROR');
}
var index = this._checkPassiveStateCondition.indexOf(state.id);
this._checkPassiveStateCondition.splice(index, 1);
return condition;
Game_BattlerBase.prototype.passiveStateConditions = function (state) {
this._checkPassiveStateCondition = this._checkPassiveStateCondition || [];
this._checkPassiveStateCondition.push(state.id);
var condition = true;
var a = this;
var user = this;
var subject = this;
var b = this;
var target = this;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var code = state.passiveCondition;
try {
condition = state.passiveCondition.call(this, condition, a, user, subject, b, target, s, v);
} catch (e) {
Yanfly.Util.displayError(e, code, "PASSIVE STATE CUSTOM CONDITION ERROR");
}
var index = this._checkPassiveStateCondition.indexOf(state.id);
this._checkPassiveStateCondition.splice(index, 1);
return condition;
};
Game_BattlerBase.prototype.passiveStateConditionEval = function(state) {
this._checkPassiveStateCondition = this._checkPassiveStateCondition || [];
this._checkPassiveStateCondition.push(state.id);
var condition = true;
var a = this;
var user = this;
var subject = this;
var b = this;
var target = this;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var code = state.passiveConditionEval;
try {
condition = state.passiveConditionEval.call(this, condition, a, user,
subject, b, target, s, v);
} catch (e) {
Yanfly.Util.displayError(e, code, 'PASSIVE STATE CUSTOM CONDITION ERROR');
}
var index = this._checkPassiveStateCondition.indexOf(state.id);
this._checkPassiveStateCondition.splice(index, 1);
return condition;
Game_BattlerBase.prototype.passiveStateConditionEval = function (state) {
this._checkPassiveStateCondition = this._checkPassiveStateCondition || [];
this._checkPassiveStateCondition.push(state.id);
var condition = true;
var a = this;
var user = this;
var subject = this;
var b = this;
var target = this;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var code = state.passiveConditionEval;
try {
condition = state.passiveConditionEval.call(this, condition, a, user, subject, b, target, s, v);
} catch (e) {
Yanfly.Util.displayError(e, code, "PASSIVE STATE CUSTOM CONDITION ERROR");
}
var index = this._checkPassiveStateCondition.indexOf(state.id);
this._checkPassiveStateCondition.splice(index, 1);
return condition;
};
Game_BattlerBase.prototype.sortPassiveStates = function(array) {
array.sort(function(a, b) {
var p1 = a.priority;
var p2 = b.priority;
if (p1 !== p2) return p2 - p1;
return a - b;
Game_BattlerBase.prototype.sortPassiveStates = function (array) {
array.sort(function (a, b) {
var p1 = a.priority;
var p2 = b.priority;
if (p1 !== p2) return p2 - p1;
return a - b;
});
};
Game_BattlerBase.prototype.isPassiveStateAffected = function(stateId) {
Game_BattlerBase.prototype.isPassiveStateAffected = function (stateId) {
return this.passiveStatesRaw().contains(stateId);
};
@ -555,13 +569,13 @@ Game_BattlerBase.prototype.isPassiveStateAffected = function(stateId) {
//=============================================================================
Yanfly.APS.Game_Battler_isStateAddable = Game_Battler.prototype.isStateAddable;
Game_Battler.prototype.isStateAddable = function(stateId) {
Game_Battler.prototype.isStateAddable = function (stateId) {
if (this.isPassiveStateAffected(stateId)) return false;
return Yanfly.APS.Game_Battler_isStateAddable.call(this, stateId);
};
Yanfly.APS.Game_Battler_removeState = Game_Battler.prototype.removeState;
Game_Battler.prototype.removeState = function(stateId) {
Game_Battler.prototype.removeState = function (stateId) {
if (this.isPassiveStateAffected(stateId)) return;
Yanfly.APS.Game_Battler_removeState.call(this, stateId);
};
@ -570,31 +584,31 @@ Game_Battler.prototype.removeState = function(stateId) {
// Game_Actor
//=============================================================================
Game_Actor.prototype.passiveStatesRaw = function() {
Game_Actor.prototype.passiveStatesRaw = function () {
if (this._passiveStatesRaw !== undefined) return this._passiveStatesRaw;
var array = Game_BattlerBase.prototype.passiveStatesRaw.call(this);
array = array.concat(this.getPassiveStateData(this.actor()));
array = array.concat(this.getPassiveStateData(this.currentClass()));
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
array = array.concat(this.getPassiveStateData(equip));
var equip = this.equips()[i];
array = array.concat(this.getPassiveStateData(equip));
}
for (var i = 0; i < this._skills.length; ++i) {
var skill = $dataSkills[this._skills[i]];
array = array.concat(this.getPassiveStateData(skill));
var skill = $dataSkills[this._skills[i]];
array = array.concat(this.getPassiveStateData(skill));
}
this._passiveStatesRaw = array.filter(Yanfly.Util.onlyUnique)
this._passiveStatesRaw = array.filter(Yanfly.Util.onlyUnique);
return this._passiveStatesRaw;
};
Yanfly.APS.Game_Actor_learnSkill = Game_Actor.prototype.learnSkill;
Game_Actor.prototype.learnSkill = function(skillId) {
Game_Actor.prototype.learnSkill = function (skillId) {
Yanfly.APS.Game_Actor_learnSkill.call(this, skillId);
this._passiveStatesRaw = undefined;
};
Yanfly.APS.Game_Actor_forgetSkill = Game_Actor.prototype.forgetSkill;
Game_Actor.prototype.forgetSkill = function(skillId) {
Game_Actor.prototype.forgetSkill = function (skillId) {
Yanfly.APS.Game_Actor_forgetSkill.call(this, skillId);
this._passiveStatesRaw = undefined;
};
@ -603,43 +617,43 @@ Game_Actor.prototype.forgetSkill = function(skillId) {
// Game_Enemy
//=============================================================================
Game_Enemy.prototype.passiveStatesRaw = function() {
Game_Enemy.prototype.passiveStatesRaw = function () {
if (this._passiveStatesRaw !== undefined) return this._passiveStatesRaw;
var array = Game_BattlerBase.prototype.passiveStatesRaw.call(this);
array = array.concat(this.getPassiveStateData(this.enemy()));
for (var i = 0; i < this.skills().length; ++i) {
var skill = this.skills()[i];
array = array.concat(this.getPassiveStateData(skill));
var skill = this.skills()[i];
array = array.concat(this.getPassiveStateData(skill));
}
this._passiveStatesRaw = array.filter(Yanfly.Util.onlyUnique)
this._passiveStatesRaw = array.filter(Yanfly.Util.onlyUnique);
return this._passiveStatesRaw;
};
if (!Game_Enemy.prototype.skills) {
Game_Enemy.prototype.skills = function() {
var skills = []
for (var i = 0; i < this.enemy().actions.length; ++i) {
var skill = $dataSkills[this.enemy().actions[i].skillId];
if (skill) skills.push(skill);
}
return skills;
}
};
Game_Enemy.prototype.skills = function () {
var skills = [];
for (var i = 0; i < this.enemy().actions.length; ++i) {
var skill = $dataSkills[this.enemy().actions[i].skillId];
if (skill) skills.push(skill);
}
return skills;
};
}
//=============================================================================
// Game_Unit
//=============================================================================
Game_Unit.prototype.refreshMembers = function() {
Game_Unit.prototype.refreshMembers = function () {
var group = this.allMembers();
var length = group.length;
for (var i = 0; i < length; ++i) {
var member = group[i];
if (member) member.refresh();
var member = group[i];
if (member) member.refresh();
}
};
Game_Unit.prototype.allMembers = function() {
Game_Unit.prototype.allMembers = function () {
return this.members();
};
@ -648,7 +662,7 @@ Game_Unit.prototype.allMembers = function() {
//=============================================================================
Yanfly.APS.Game_Player_refresh = Game_Player.prototype.refresh;
Game_Player.prototype.refresh = function() {
Game_Player.prototype.refresh = function () {
$gameParty.refreshMembers();
Yanfly.APS.Game_Player_refresh.call(this);
};
@ -659,25 +673,25 @@ Game_Player.prototype.refresh = function() {
Yanfly.Util = Yanfly.Util || {};
Yanfly.Util.displayError = function(e, code, message) {
console.log(message);
console.log(code || 'NON-EXISTENT');
console.error(e);
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") return;
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
if (!require('nw.gui').Window.get().isDevToolsOpen()) {
require('nw.gui').Window.get().showDevTools();
Yanfly.Util.displayError = function (e, code, message) {
console.log(message);
console.log(code || "NON-EXISTENT");
console.error(e);
if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") return;
if (Utils.isNwjs() && Utils.isOptionValid("test")) {
if (!require("nw.gui").Window.get().isDevToolsOpen()) {
require("nw.gui").Window.get().showDevTools();
}
}
}
};
Yanfly.Util.getRange = function(n, m) {
Yanfly.Util.getRange = function (n, m) {
var result = [];
for (var i = n; i <= m; ++i) result.push(i);
return result;
};
Yanfly.Util.onlyUnique = function(value, index, self) {
Yanfly.Util.onlyUnique = function (value, index, self) {
return self.indexOf(value) === index;
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -11,7 +11,7 @@ Yanfly.ECP = Yanfly.ECP || {};
Yanfly.ECP.version = 1.05;
//=============================================================================
/*:
/*:
* @plugindesc v1.05 事件追逐
* @author Yanfly Engine Plugins
*
@ -104,7 +104,7 @@ Yanfly.ECP.version = 1.05;
* ============================================================================
* Changelog
* ============================================================================
*
*
* Version 1.05:
* - Optimization update.
*
@ -139,60 +139,59 @@ Yanfly.ECP.version = 1.05;
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters('YEP_EventChasePlayer');
Yanfly.Parameters = PluginManager.parameters("YEP_EventChasePlayer");
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.ECPSightLock = Number(Yanfly.Parameters['Sight Lock']);
Yanfly.Param.ECPSeePlayer = String(Yanfly.Parameters['See Player']);
Yanfly.Param.ECPSightLock = Number(Yanfly.Parameters["Sight Lock"]);
Yanfly.Param.ECPSeePlayer = String(Yanfly.Parameters["See Player"]);
Yanfly.Param.ECPSeePlayer = eval(Yanfly.Param.ECPSeePlayer);
Yanfly.Param.ECPAlertTimer = Number(Yanfly.Parameters['Alert Timer']);
Yanfly.Param.ECPAlertBalloon = Number(Yanfly.Parameters['Alert Balloon']);
Yanfly.Param.ECPAlertSound = String(Yanfly.Parameters['Alert Sound']);
Yanfly.Param.ECPAlertEvent = Number(Yanfly.Parameters['Alert Common Event']);
Yanfly.Param.ECPReturn = eval(String(Yanfly.Parameters['Return After']));
Yanfly.Param.ECPReturnWait = Number(Yanfly.Parameters['Return Wait']);
Yanfly.Param.ECPAlertTimer = Number(Yanfly.Parameters["Alert Timer"]);
Yanfly.Param.ECPAlertBalloon = Number(Yanfly.Parameters["Alert Balloon"]);
Yanfly.Param.ECPAlertSound = String(Yanfly.Parameters["Alert Sound"]);
Yanfly.Param.ECPAlertEvent = Number(Yanfly.Parameters["Alert Common Event"]);
Yanfly.Param.ECPReturn = eval(String(Yanfly.Parameters["Return After"]));
Yanfly.Param.ECPReturnWait = Number(Yanfly.Parameters["Return Wait"]);
//=============================================================================
// Main Code
//=============================================================================
Yanfly.ECP.Game_Event_setupPage = Game_Event.prototype.setupPage;
Game_Event.prototype.setupPage = function() {
Game_Event.prototype.setupPage = function () {
Yanfly.ECP.Game_Event_setupPage.call(this);
this.clearChaseSettings();
};
Game_Event.prototype.clearChaseSettings = function() {
this._alertBalloon = Yanfly.Param.ECPAlertBalloon;
this._alertCommonEvent = Yanfly.Param.ECPAlertEvent;
this._alertLock = 0;
this._alertPlayer = false;
this._alertSound = Yanfly.Param.ECPAlertSound;
this._alertSoundVol = 100;
this._alertSoundPitch = 100;
this._alertSoundPan = 0;
this._alertTimer = 0;
this._chasePlayer = false;
this._chaseRange = 0;
this._chaseSpeed = this._moveSpeed;
this._defaultSpeed = this._moveSpeed;
this._fleePlayer = false;
this._fleeRange = 0;
this._fleeSpeed = this._moveSpeed;
this._seePlayer = Yanfly.Param.ECPSeePlayer;
this._sightLock = Yanfly.Param.ECPSightLock;
this._returnAfter = Yanfly.Param.ECPReturn;
this._returnWait = Yanfly.Param.ECPReturnWait;
this._returnPhase = false;
this._returnFrames = 0;
this._startLocationX = this.x;
this._startLocationY = this.y;
this._startLocationDir = this._direction;
Game_Event.prototype.clearChaseSettings = function () {
this._alertBalloon = Yanfly.Param.ECPAlertBalloon;
this._alertCommonEvent = Yanfly.Param.ECPAlertEvent;
this._alertLock = 0;
this._alertPlayer = false;
this._alertSound = Yanfly.Param.ECPAlertSound;
this._alertSoundVol = 100;
this._alertSoundPitch = 100;
this._alertSoundPan = 0;
this._alertTimer = 0;
this._chasePlayer = false;
this._chaseRange = 0;
this._chaseSpeed = this._moveSpeed;
this._defaultSpeed = this._moveSpeed;
this._fleePlayer = false;
this._fleeRange = 0;
this._fleeSpeed = this._moveSpeed;
this._seePlayer = Yanfly.Param.ECPSeePlayer;
this._sightLock = Yanfly.Param.ECPSightLock;
this._returnAfter = Yanfly.Param.ECPReturn;
this._returnWait = Yanfly.Param.ECPReturnWait;
this._returnPhase = false;
this._returnFrames = 0;
this._startLocationX = this.x;
this._startLocationY = this.y;
this._startLocationDir = this._direction;
};
Yanfly.ECP.Game_Event_updateSelfMovement =
Game_Event.prototype.updateSelfMovement;
Game_Event.prototype.updateSelfMovement = function() {
Yanfly.ECP.Game_Event_updateSelfMovement = Game_Event.prototype.updateSelfMovement;
Game_Event.prototype.updateSelfMovement = function () {
if (Imported.YEP_StopAllMove && $gameSystem.isEventMoveStopped()) return;
this.updateChaseDistance();
this.updateFleeDistance();
@ -200,143 +199,147 @@ Game_Event.prototype.updateSelfMovement = function() {
};
Yanfly.ECP.Game_Event_update = Game_Event.prototype.update;
Game_Event.prototype.update = function() {
Game_Event.prototype.update = function () {
Yanfly.ECP.Game_Event_update.call(this);
this.updateAlert();
this.updateReturnPhase();
};
Game_Event.prototype.canSeePlayer = function() {
Game_Event.prototype.canSeePlayer = function () {
if (!this._seePlayer) return false;
var sx = this.deltaXFrom($gamePlayer.x);
var sy = this.deltaYFrom($gamePlayer.y);
if (Math.abs(sx) > Math.abs(sy)) {
var direction = (sx > 0) ? 4 : 6;
var direction = sx > 0 ? 4 : 6;
} else {
var direction = (sy > 0) ? 8 : 2;
var direction = sy > 0 ? 8 : 2;
}
if (direction === this.direction()) {
this._alertLock = this._sightLock;
return true;
this._alertLock = this._sightLock;
return true;
}
return false;
};
Game_Event.prototype.updateChaseDistance = function() {
Game_Event.prototype.updateChaseDistance = function () {
if (this._erased) return;
if (this._chaseRange <= 0) return;
var dis = Math.abs(this.deltaXFrom($gamePlayer.x));
dis += Math.abs(this.deltaYFrom($gamePlayer.y));
if (this.chaseConditions(dis)) {
this.startEventChase();
this.startEventChase();
} else if (this._chasePlayer) {
this.endEventChase();
this.endEventChase();
}
};
Game_Event.prototype.chaseConditions = function(dis) {
Game_Event.prototype.chaseConditions = function (dis) {
if (dis <= this._chaseRange && this.nonSeePlayer()) {
this._alertLock = this._sightLock;
return true;
this._alertLock = this._sightLock;
return true;
}
if (this._alertLock > 0) return true;
if (dis <= this._chaseRange && this.canSeePlayer()) return true;
return false;
};
Game_Event.prototype.nonSeePlayer = function() {
if (Imported.YEP_X_EventChaseStealth) {
if (this.meetStealthModeConditions()) {
this.stealthClearChaseSettings();
this._stopCount = 0;
return false;
Game_Event.prototype.nonSeePlayer = function () {
if (Imported.YEP_X_EventChaseStealth) {
if (this.meetStealthModeConditions()) {
this.stealthClearChaseSettings();
this._stopCount = 0;
return false;
}
}
}
return !this._seePlayer;
return !this._seePlayer;
};
Game_Event.prototype.startEventChase = function() {
Game_Event.prototype.startEventChase = function () {
this._chasePlayer = true;
this.setMoveSpeed(this._chaseSpeed);
};
Game_Event.prototype.endEventChase = function() {
Game_Event.prototype.endEventChase = function () {
this._chasePlayer = false;
this.setMoveSpeed(this._defaultSpeed);
if (this._alertTimer <= 0) this._alertPlayer = false;
this.startReturnPhase();
};
Game_Event.prototype.updateFleeDistance = function() {
Game_Event.prototype.updateFleeDistance = function () {
if (this._erased) return;
if (this._fleeRange <= 0) return;
var dis = Math.abs(this.deltaXFrom($gamePlayer.x));
dis += Math.abs(this.deltaYFrom($gamePlayer.y));
if (this.fleeConditions(dis)) {
this.startEventFlee();
this.startEventFlee();
} else if (this._fleePlayer) {
this.endEventFlee();
this.endEventFlee();
}
};
Game_Event.prototype.fleeConditions = function(dis) {
Game_Event.prototype.fleeConditions = function (dis) {
if (this._alertLock > 0) return true;
if (dis <= this._fleeRange && this.canSeePlayer()) return true;
if (dis <= this._fleeRange && !this._seePlayer) {
this._alertLock = this._sightLock;
return true;
this._alertLock = this._sightLock;
return true;
}
return false;
};
Game_Event.prototype.startEventFlee = function() {
Game_Event.prototype.startEventFlee = function () {
this._fleePlayer = true;
this.setMoveSpeed(this._fleeSpeed);
};
Game_Event.prototype.endEventFlee = function() {
Game_Event.prototype.endEventFlee = function () {
this._fleePlayer = false;
this.setMoveSpeed(this._defaultSpeed);
if (this._alertTimer <= 0) this._alertPlayer = false;
this.startReturnPhase();
};
Game_Event.prototype.updateChaseMovement = function() {
Game_Event.prototype.updateChaseMovement = function () {
if (this._stopCount > 0 && this._chasePlayer) {
var direction = this.findDirectionTo($gamePlayer.x, $gamePlayer.y);
if (direction > 0) this.moveStraight(direction);
var direction = this.findDirectionTo($gamePlayer.x, $gamePlayer.y);
if (direction > 0) this.moveStraight(direction);
} else if (this._stopCount > 0 && this._fleePlayer) {
this.updateFleeMovement();
this.updateFleeMovement();
} else if (this._returnPhase) {
this.updateMoveReturnAfter();
this.updateMoveReturnAfter();
} else {
Yanfly.ECP.Game_Event_updateSelfMovement.call(this);
Yanfly.ECP.Game_Event_updateSelfMovement.call(this);
}
};
Game_Event.prototype.updateFleeMovement = function() {
Game_Event.prototype.updateFleeMovement = function () {
switch (Math.randomInt(6)) {
case 0: case 1: case 2: case 3: case 4:
this.moveAwayFromPlayer();
break;
case 5:
this.moveRandom();
break;
case 0:
case 1:
case 2:
case 3:
case 4:
this.moveAwayFromPlayer();
break;
case 5:
this.moveRandom();
break;
}
};
Game_Event.prototype.updateAlert = function() {
Game_Event.prototype.updateAlert = function () {
if (this._erased) return;
this._alertLock--;
if (this.alertConditions()) this.activateAlert();
if (this._alertPlayer) this._alertTimer--;
};
Game_Event.prototype.alertConditions = function() {
Game_Event.prototype.alertConditions = function () {
return (this._chasePlayer || this._fleePlayer) && !this._alertPlayer;
};
Game_Event.prototype.activateAlert = function() {
Game_Event.prototype.activateAlert = function () {
if (this._alertBalloon >= 0) this.requestBalloon(this._alertBalloon);
this._alertPlayer = true;
this._alertTimer = Yanfly.Param.ECPAlertTimer;
@ -344,59 +347,59 @@ Game_Event.prototype.activateAlert = function() {
this.playAlertCommonEvent();
};
Game_Event.prototype.playAlertSound = function() {
if (this._alertSound === '') return;
Game_Event.prototype.playAlertSound = function () {
if (this._alertSound === "") return;
var sound = {
name: this._alertSound,
volume: this._alertSoundVol,
pitch: this._alertSoundPitch,
pan: this._alertSoundPan
name: this._alertSound,
volume: this._alertSoundVol,
pitch: this._alertSoundPitch,
pan: this._alertSoundPan,
};
AudioManager.playSe(sound);
};
Game_Event.prototype.playAlertCommonEvent = function() {
Game_Event.prototype.playAlertCommonEvent = function () {
if (this._alertCommonEvent <= 0) return;
$gameTemp.reserveCommonEvent(this._alertCommonEvent);
};
Game_Event.prototype.startReturnPhase = function() {
Game_Event.prototype.startReturnPhase = function () {
if (!this._returnAfter) return;
this._returnPhase = true;
this._returnFrames = this._returnWait;
};
Game_Event.prototype.updateReturnPhase = function() {
Game_Event.prototype.updateReturnPhase = function () {
if (this._returnPhase) this._returnFrames--;
};
Game_Event.prototype.updateMoveReturnAfter = function() {
Game_Event.prototype.updateMoveReturnAfter = function () {
if (this._returnFrames > 0) return;
var sx = this.deltaXFrom(this._startLocationX);
var sy = this.deltaYFrom(this._startLocationY);
if (Math.abs(sx) > Math.abs(sy)) {
if (Math.randomInt(6) <= 4) {
this.moveStraight(sx > 0 ? 4 : 6);
if (!this.isMovementSucceeded() && sy !== 0) {
this.moveStraight(sy > 0 ? 8 : 2);
if (Math.randomInt(6) <= 4) {
this.moveStraight(sx > 0 ? 4 : 6);
if (!this.isMovementSucceeded() && sy !== 0) {
this.moveStraight(sy > 0 ? 8 : 2);
}
} else {
this.moveRandom();
}
} else {
this.moveRandom();
}
} else if (sy !== 0) {
if (Math.randomInt(6) <= 4) {
this.moveStraight(sy > 0 ? 8 : 2);
if (!this.isMovementSucceeded() && sx !== 0) {
this.moveStraight(sx > 0 ? 4 : 6);
if (Math.randomInt(6) <= 4) {
this.moveStraight(sy > 0 ? 8 : 2);
if (!this.isMovementSucceeded() && sx !== 0) {
this.moveStraight(sx > 0 ? 4 : 6);
}
} else {
this.moveRandom();
}
} else {
this.moveRandom();
}
}
if (sx === 0 && sy === 0) {
this._returnPhase = false;
this._returnFrames = 0;
this._direction = this._startLocationDir;
this._returnPhase = false;
this._returnFrames = 0;
this._direction = this._startLocationDir;
}
};

@ -10,7 +10,7 @@ var Yanfly = Yanfly || {};
Yanfly.EEA = Yanfly.EEA || {};
//=============================================================================
/*:
/*:
* @plugindesc v1.00 事件遭遇助手
* @author Yanfly Engine Plugins
*
@ -75,214 +75,210 @@ Yanfly.EEA = Yanfly.EEA || {};
// DataManager
//=============================================================================
DataManager.processEEANotetags1 = function(obj) {
var notedata = obj.note.split(/[\r\n]+/);
obj.encounterDirectionLock = false;
obj.encounterFollowerTrigger = false;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<(?:ENCOUNTER LOCK|ENCOUNTER DIRECTION LOCK)>/i)) {
obj.encounterDirectionLock = true;
DataManager.processEEANotetags1 = function (obj) {
var notedata = obj.note.split(/[\r\n]+/);
obj.encounterDirectionLock = false;
obj.encounterFollowerTrigger = false;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<(?:ENCOUNTER LOCK|ENCOUNTER DIRECTION LOCK)>/i)) {
obj.encounterDirectionLock = true;
}
if (line.match(/<(?:FOLLOWER TRIGGER|FOLLOWER TOUCH)>/i)) {
obj.encounterFollowerTrigger = true;
}
}
if (line.match(/<(?:FOLLOWER TRIGGER|FOLLOWER TOUCH)>/i)) {
obj.encounterFollowerTrigger = true;
}
}
};
//=============================================================================
// Game_CharacterBase
//=============================================================================
Game_CharacterBase.prototype.debugShowDirections = function(ev) {
Game_CharacterBase.prototype.debugShowDirections = function (ev) {
return;
console.log(' This X: ' + this.x + ', This Y: ' + this.y);
console.log('Event X: ' + ev.x + ', Event Y: ' + ev.y);
console.log(" This X: " + this.x + ", This Y: " + this.y);
console.log("Event X: " + ev.x + ", Event Y: " + ev.y);
};
Game_CharacterBase.prototype.isFacingTowards = function(ev) {
Game_CharacterBase.prototype.isFacingTowards = function (ev) {
switch (this.direction()) {
case 1: // Down Left
return [8, 9, 6].contains(ev.direction());
break;
case 2: // Down
return [7, 8, 9].contains(ev.direction());
break;
case 3: // Down Right
return [4, 7, 8].contains(ev.direction());
break;
case 4: // Left
return [9, 6, 3].contains(ev.direction());
break;
case 6: // Right
return [7, 4, 1].contains(ev.direction());
break;
case 7: // Up Left
return [2, 3, 6].contains(ev.direction());
break;
case 8: // Up
return [1, 2, 3].contains(ev.direction());
break;
case 9: // Up Right
return [4, 1, 2].contains(ev.direction());
break;
case 1: // Down Left
return [8, 9, 6].contains(ev.direction());
break;
case 2: // Down
return [7, 8, 9].contains(ev.direction());
break;
case 3: // Down Right
return [4, 7, 8].contains(ev.direction());
break;
case 4: // Left
return [9, 6, 3].contains(ev.direction());
break;
case 6: // Right
return [7, 4, 1].contains(ev.direction());
break;
case 7: // Up Left
return [2, 3, 6].contains(ev.direction());
break;
case 8: // Up
return [1, 2, 3].contains(ev.direction());
break;
case 9: // Up Right
return [4, 1, 2].contains(ev.direction());
break;
}
return false;
};
Game_CharacterBase.prototype.isFacingAway = function(ev) {
Game_CharacterBase.prototype.isFacingAway = function (ev) {
switch (this.direction()) {
case 1: // Down Left
return [4, 1, 2].contains(ev.direction());
break;
case 2: // Down
return [1, 2, 3].contains(ev.direction());
break;
case 3: // Down Right
return [2, 3, 6].contains(ev.direction());
break;
case 4: // Left
return [7, 4, 1].contains(ev.direction());
break;
case 6: // Right
return [9, 6, 3].contains(ev.direction());
break;
case 7: // Up Left
return [4, 7, 8].contains(ev.direction());
break;
case 8: // Up
return [7, 8, 9].contains(ev.direction());
break;
case 9: // Up Right
return [8, 9, 6].contains(ev.direction());
break;
case 1: // Down Left
return [4, 1, 2].contains(ev.direction());
break;
case 2: // Down
return [1, 2, 3].contains(ev.direction());
break;
case 3: // Down Right
return [2, 3, 6].contains(ev.direction());
break;
case 4: // Left
return [7, 4, 1].contains(ev.direction());
break;
case 6: // Right
return [9, 6, 3].contains(ev.direction());
break;
case 7: // Up Left
return [4, 7, 8].contains(ev.direction());
break;
case 8: // Up
return [7, 8, 9].contains(ev.direction());
break;
case 9: // Up Right
return [8, 9, 6].contains(ev.direction());
break;
}
return false;
};
Game_CharacterBase.prototype.isFacingSideways = function(ev) {
Game_CharacterBase.prototype.isFacingSideways = function (ev) {
switch (this.direction()) {
case 1: // Down Left
return [4, 7, 8, 2, 3, 6].contains(ev.direction());
break;
case 2: // Down
return [7, 4, 1, 9, 6, 3].contains(ev.direction());
break;
case 3: // Down Right
return [4, 1, 2, 8, 9, 6].contains(ev.direction());
break;
case 4: // Left
return [7, 8, 9, 1, 2, 3].contains(ev.direction());
break;
case 6: // Right
return [7, 8, 9, 1, 2, 3].contains(ev.direction());
break;
case 7: // Up Left
return [4, 1, 2, 8, 9, 6].contains(ev.direction());
break;
case 8: // Up
return [7, 4, 1, 9, 6, 3].contains(ev.direction());
break;
case 9: // Up Right
return [4, 7, 8, 2, 3, 6].contains(ev.direction());
break;
case 1: // Down Left
return [4, 7, 8, 2, 3, 6].contains(ev.direction());
break;
case 2: // Down
return [7, 4, 1, 9, 6, 3].contains(ev.direction());
break;
case 3: // Down Right
return [4, 1, 2, 8, 9, 6].contains(ev.direction());
break;
case 4: // Left
return [7, 8, 9, 1, 2, 3].contains(ev.direction());
break;
case 6: // Right
return [7, 8, 9, 1, 2, 3].contains(ev.direction());
break;
case 7: // Up Left
return [4, 1, 2, 8, 9, 6].contains(ev.direction());
break;
case 8: // Up
return [7, 4, 1, 9, 6, 3].contains(ev.direction());
break;
case 9: // Up Right
return [4, 7, 8, 2, 3, 6].contains(ev.direction());
break;
}
return false;
};
Game_CharacterBase.prototype.isPositionFrontOf = function(ev) {
Game_CharacterBase.prototype.isPositionFrontOf = function (ev) {
this.debugShowDirections(ev);
switch (this.direction()) {
case 1: // Down Left
return ev.y > this.y;
break;
case 2: // Down
return ev.y > this.y;
break;
case 3: // Down Right
return ev.y > this.y;
break;
case 4: // Left
return ev.x < this.x;
break;
case 6: // Right
return ev.x > this.x;
break;
case 7: // Up Left
return ev.y < this.y;
break;
case 8: // Up
return ev.y < this.y;
break;
case 9: // Up Right
return ev.y < this.y;
break;
case 1: // Down Left
return ev.y > this.y;
break;
case 2: // Down
return ev.y > this.y;
break;
case 3: // Down Right
return ev.y > this.y;
break;
case 4: // Left
return ev.x < this.x;
break;
case 6: // Right
return ev.x > this.x;
break;
case 7: // Up Left
return ev.y < this.y;
break;
case 8: // Up
return ev.y < this.y;
break;
case 9: // Up Right
return ev.y < this.y;
break;
}
return false;
};
Game_CharacterBase.prototype.isPositionBackOf = function(ev) {
Game_CharacterBase.prototype.isPositionBackOf = function (ev) {
this.debugShowDirections(ev);
switch (this.direction()) {
case 1: // Down Left
return ev.y < this.y;
break;
case 2: // Down
return ev.y < this.y;
break;
case 3: // Down Right
return ev.y < this.y;
break;
case 4: // Left
return ev.x > this.x;
break;
case 6: // Right
return ev.x < this.x;
break;
case 7: // Up Left
return ev.y > this.y;
break;
case 8: // Up
return ev.y > this.y;
break;
case 9: // Up Right
return ev.y > this.y;
break;
case 1: // Down Left
return ev.y < this.y;
break;
case 2: // Down
return ev.y < this.y;
break;
case 3: // Down Right
return ev.y < this.y;
break;
case 4: // Left
return ev.x > this.x;
break;
case 6: // Right
return ev.x < this.x;
break;
case 7: // Up Left
return ev.y > this.y;
break;
case 8: // Up
return ev.y > this.y;
break;
case 9: // Up Right
return ev.y > this.y;
break;
}
return false;
};
Game_CharacterBase.prototype.isPositionSideOf = function(ev) {
Game_CharacterBase.prototype.isPositionSideOf = function (ev) {
this.debugShowDirections(ev);
switch (this.direction()) {
case 1: // Down Left
return (this.x < ev.x && this.y > ev.y) ||
(this.x > ev.x && this.y < ev.y)
break;
case 2: // Down
return this.x !== ev.x;
break;
case 3: // Down Right
return (this.x > ev.x && this.y > ev.y) ||
(this.x < ev.x && this.y < ev.y)
break;
case 4: // Left
return this.y !== ev.y;
break;
case 6: // Right
return this.y !== ev.y;
break;
case 7: // Up Left
return (this.x > ev.x && this.y > ev.y) ||
(this.x < ev.x && this.y < ev.y)
break;
case 8: // Up
return this.x !== ev.x;
break;
case 9: // Up Right
return (this.x < ev.x && this.y > ev.y) ||
(this.x > ev.x && this.y < ev.y)
break;
case 1: // Down Left
return (this.x < ev.x && this.y > ev.y) || (this.x > ev.x && this.y < ev.y);
break;
case 2: // Down
return this.x !== ev.x;
break;
case 3: // Down Right
return (this.x > ev.x && this.y > ev.y) || (this.x < ev.x && this.y < ev.y);
break;
case 4: // Left
return this.y !== ev.y;
break;
case 6: // Right
return this.y !== ev.y;
break;
case 7: // Up Left
return (this.x > ev.x && this.y > ev.y) || (this.x < ev.x && this.y < ev.y);
break;
case 8: // Up
return this.x !== ev.x;
break;
case 9: // Up Right
return (this.x < ev.x && this.y > ev.y) || (this.x > ev.x && this.y < ev.y);
break;
}
return false;
};
@ -292,50 +288,49 @@ Game_CharacterBase.prototype.isPositionSideOf = function(ev) {
//=============================================================================
Yanfly.EEA.Game_Event_start = Game_Event.prototype.start;
Game_Event.prototype.start = function() {
Game_Event.prototype.start = function () {
if (this.isEncounterDirectionLocked()) {
var list = this.list();
if (list && list.length > 1) {
this._starting = true;
if (this.isTriggerIn([0,1,2])) this.encounterLock();
}
var list = this.list();
if (list && list.length > 1) {
this._starting = true;
if (this.isTriggerIn([0, 1, 2])) this.encounterLock();
}
} else {
Yanfly.EEA.Game_Event_start.call(this);
Yanfly.EEA.Game_Event_start.call(this);
}
};
Game_Event.prototype.encounterLock = function() {
Game_Event.prototype.encounterLock = function () {
this._prelockDirection = this.direction();
this._locked = true;
};
Game_Event.prototype.isEncounterDirectionLocked = function() {
Game_Event.prototype.isEncounterDirectionLocked = function () {
if (this.event().encounterDirectionLock === undefined) {
DataManager.processEEANotetags1(this.event());
DataManager.processEEANotetags1(this.event());
}
return this.event().encounterDirectionLock;
};
Yanfly.EEA.Game_Event_checkEventTriggerTouch =
Game_Event.prototype.checkEventTriggerTouch;
Game_Event.prototype.checkEventTriggerTouch = function(x, y) {
Yanfly.EEA.Game_Event_checkEventTriggerTouch.call(this, x, y);
if ($gameMap.isEventRunning()) return;
if (this._trigger !== 2) return;
if (!this.isFollowerTriggerTouch()) return;
if (this.isJumping()) return;
if (!this.isNormalPriority()) return;
var followers = $gamePlayer.followers().visibleFollowers();
var length = followers.length;
for (var i = 0; i < length; ++i) {
var follower = followers[i];
if (follower && follower.pos(x, y)) this.start();
}
Yanfly.EEA.Game_Event_checkEventTriggerTouch = Game_Event.prototype.checkEventTriggerTouch;
Game_Event.prototype.checkEventTriggerTouch = function (x, y) {
Yanfly.EEA.Game_Event_checkEventTriggerTouch.call(this, x, y);
if ($gameMap.isEventRunning()) return;
if (this._trigger !== 2) return;
if (!this.isFollowerTriggerTouch()) return;
if (this.isJumping()) return;
if (!this.isNormalPriority()) return;
var followers = $gamePlayer.followers().visibleFollowers();
var length = followers.length;
for (var i = 0; i < length; ++i) {
var follower = followers[i];
if (follower && follower.pos(x, y)) this.start();
}
};
Game_Event.prototype.isFollowerTriggerTouch = function() {
Game_Event.prototype.isFollowerTriggerTouch = function () {
if (this.event().encounterFollowerTrigger === undefined) {
DataManager.processEEANotetags1(this.event());
DataManager.processEEANotetags1(this.event());
}
return this.event().encounterFollowerTrigger;
};
@ -344,42 +339,42 @@ Game_Event.prototype.isFollowerTriggerTouch = function() {
// Game_Interpreter
//=============================================================================
Game_Interpreter.prototype.checkEventFacingPlayerFront = function() {
Game_Interpreter.prototype.checkEventFacingPlayerFront = function () {
var ev = $gameMap.event(this.eventId());
if (!ev) return false;
var pl = $gamePlayer;
var pl = $gamePlayer;
return ev.isFacingTowards(pl) && pl.isPositionFrontOf(ev);
};
Game_Interpreter.prototype.checkEventFacingPlayerBack = function() {
Game_Interpreter.prototype.checkEventFacingPlayerBack = function () {
var ev = $gameMap.event(this.eventId());
if (!ev) return false;
var pl = $gamePlayer;
return ev.isFacingAway(pl) && pl.isPositionBackOf(ev);
};
Game_Interpreter.prototype.checkEventFacingPlayerSide = function() {
Game_Interpreter.prototype.checkEventFacingPlayerSide = function () {
var ev = $gameMap.event(this.eventId());
if (!ev) return false;
var pl = $gamePlayer;
return ev.isFacingSideways(pl) && pl.isPositionSideOf(ev);
};
Game_Interpreter.prototype.checkPlayerFacingEventFront = function() {
Game_Interpreter.prototype.checkPlayerFacingEventFront = function () {
var ev = $gameMap.event(this.eventId());
if (!ev) return false;
var pl = $gamePlayer;
return pl.isFacingTowards(ev) && ev.isPositionFrontOf(pl);
};
Game_Interpreter.prototype.checkPlayerFacingEventBack = function() {
Game_Interpreter.prototype.checkPlayerFacingEventBack = function () {
var ev = $gameMap.event(this.eventId());
if (!ev) return false;
var pl = $gamePlayer;
return pl.isFacingAway(ev) && ev.isPositionBackOf(pl);
};
Game_Interpreter.prototype.checkPlayerFacingEventSide = function() {
Game_Interpreter.prototype.checkPlayerFacingEventSide = function () {
var ev = $gameMap.event(this.eventId());
if (!ev) return false;
var pl = $gamePlayer;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -8,10 +8,10 @@ Imported.YEP_Taunt = true;
var Yanfly = Yanfly || {};
Yanfly.Taunt = Yanfly.Taunt || {};
Yanfly.Taunt.version = 1.02
Yanfly.Taunt.version = 1.02;
//=============================================================================
/*:
/*:
* @plugindesc v1.02 Adds a Taunt mechanic to battle. Battlers with a
* taunt property become the target of enemy focus.
* @author Yanfly Engine Plugins
@ -88,162 +88,162 @@ Yanfly.Taunt.version = 1.02
//=============================================================================
Yanfly.Taunt.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Yanfly.Taunt.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_Taunt) {
this.processTauntNotetags1($dataActors);
this.processTauntNotetags1($dataClasses);
this.processTauntNotetags1($dataWeapons);
this.processTauntNotetags1($dataArmors);
this.processTauntNotetags1($dataStates);
this.processTauntNotetags1($dataEnemies);
this.processTauntNotetags2($dataSkills);
this.processTauntNotetags2($dataEnemies);
Yanfly._loaded_YEP_Taunt = true;
}
return true;
};
DataManager.processTauntNotetags1 = function(group) {
var note1 = /<(?:PHYSICAL TAUNT)>/i;
var note2 = /<(?:MAGICAL TAUNT)>/i;
var note3 = /<(?:CERTAIN TAUNT)>/i;
var note4 = /<(?:NULL PHYSICAL TAUNT)>/i;
var note5 = /<(?:NULL MAGICAL TAUNT)>/i
var note6 = /<(?:NULL CERTAIN TAUNT)>/i
var note7 = /<(?:IGNORE PHYSICAL TAUNT)>/i
var note8 = /<(?:IGNORE MAGICAL TAUNT)>/i
var note9 = /<(?:IGNORE CERTAIN TAUNT)>/i
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.physTaunt = false;
obj.magicTaunt = false;
obj.certainTaunt = false;
obj.nullPhysTaunt = false;
obj.nullMagicTaunt = false;
obj.nullCertainTaunt = false;
obj.ignorePhysTaunt = false;
obj.ignoreMagicTaunt = false;
obj.ignoreCertainTaunt = false;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
obj.physTaunt = true;
} else if (line.match(note2)) {
obj.magicTaunt = true;
} else if (line.match(note3)) {
obj.certainTaunt = true;
} else if (line.match(note4)) {
obj.nullPhysTaunt = true;
} else if (line.match(note5)) {
obj.nullMagicTaunt = true;
} else if (line.match(note6)) {
obj.nullCertainTaunt = true;
} else if (line.match(note7)) {
obj.ignorePhysTaunt = true;
} else if (line.match(note8)) {
obj.ignoreMagicTaunt = true;
} else if (line.match(note9)) {
obj.ignoreCertainTaunt = true;
}
}
}
};
DataManager.processTauntNotetags2 = function(group) {
var note1 = /<(?:BYPASS TAUNT)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.bypassTaunt = false;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
obj.bypassTaunt = true;
}
}
}
DataManager.isDatabaseLoaded = function () {
if (!Yanfly.Taunt.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_Taunt) {
this.processTauntNotetags1($dataActors);
this.processTauntNotetags1($dataClasses);
this.processTauntNotetags1($dataWeapons);
this.processTauntNotetags1($dataArmors);
this.processTauntNotetags1($dataStates);
this.processTauntNotetags1($dataEnemies);
this.processTauntNotetags2($dataSkills);
this.processTauntNotetags2($dataEnemies);
Yanfly._loaded_YEP_Taunt = true;
}
return true;
};
DataManager.processTauntNotetags1 = function (group) {
var note1 = /<(?:PHYSICAL TAUNT)>/i;
var note2 = /<(?:MAGICAL TAUNT)>/i;
var note3 = /<(?:CERTAIN TAUNT)>/i;
var note4 = /<(?:NULL PHYSICAL TAUNT)>/i;
var note5 = /<(?:NULL MAGICAL TAUNT)>/i;
var note6 = /<(?:NULL CERTAIN TAUNT)>/i;
var note7 = /<(?:IGNORE PHYSICAL TAUNT)>/i;
var note8 = /<(?:IGNORE MAGICAL TAUNT)>/i;
var note9 = /<(?:IGNORE CERTAIN TAUNT)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.physTaunt = false;
obj.magicTaunt = false;
obj.certainTaunt = false;
obj.nullPhysTaunt = false;
obj.nullMagicTaunt = false;
obj.nullCertainTaunt = false;
obj.ignorePhysTaunt = false;
obj.ignoreMagicTaunt = false;
obj.ignoreCertainTaunt = false;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
obj.physTaunt = true;
} else if (line.match(note2)) {
obj.magicTaunt = true;
} else if (line.match(note3)) {
obj.certainTaunt = true;
} else if (line.match(note4)) {
obj.nullPhysTaunt = true;
} else if (line.match(note5)) {
obj.nullMagicTaunt = true;
} else if (line.match(note6)) {
obj.nullCertainTaunt = true;
} else if (line.match(note7)) {
obj.ignorePhysTaunt = true;
} else if (line.match(note8)) {
obj.ignoreMagicTaunt = true;
} else if (line.match(note9)) {
obj.ignoreCertainTaunt = true;
}
}
}
};
DataManager.processTauntNotetags2 = function (group) {
var note1 = /<(?:BYPASS TAUNT)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.bypassTaunt = false;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
obj.bypassTaunt = true;
}
}
}
};
//=============================================================================
// Game_BattlerBase
//=============================================================================
Game_BattlerBase.prototype.tauntPhysical = function() {
Game_BattlerBase.prototype.tauntPhysical = function () {
for (var i = 0; i < this.states().length; ++i) {
var state = this.states()[i];
if (state.physTaunt) return true;
var state = this.states()[i];
if (state.physTaunt) return true;
}
return false;
};
Game_BattlerBase.prototype.tauntMagical = function() {
Game_BattlerBase.prototype.tauntMagical = function () {
for (var i = 0; i < this.states().length; ++i) {
var state = this.states()[i];
if (state.magicTaunt) return true;
var state = this.states()[i];
if (state.magicTaunt) return true;
}
return false;
};
Game_BattlerBase.prototype.tauntCertain = function() {
Game_BattlerBase.prototype.tauntCertain = function () {
for (var i = 0; i < this.states().length; ++i) {
var state = this.states()[i];
if (state.certainTaunt) return true;
var state = this.states()[i];
if (state.certainTaunt) return true;
}
return false;
};
Game_BattlerBase.prototype.nullTauntPhysical = function() {
Game_BattlerBase.prototype.nullTauntPhysical = function () {
for (var i = 0; i < this.states().length; ++i) {
var state = this.states()[i];
if (state.nullPhysTaunt) return true;
var state = this.states()[i];
if (state.nullPhysTaunt) return true;
}
return false;
};
Game_BattlerBase.prototype.nullTauntMagical = function() {
Game_BattlerBase.prototype.nullTauntMagical = function () {
for (var i = 0; i < this.states().length; ++i) {
var state = this.states()[i];
if (state.nullMagicTaunt) return true;
var state = this.states()[i];
if (state.nullMagicTaunt) return true;
}
return false;
};
Game_BattlerBase.prototype.nullTauntCertain = function() {
Game_BattlerBase.prototype.nullTauntCertain = function () {
for (var i = 0; i < this.states().length; ++i) {
var state = this.states()[i];
if (state.nullCertainTaunt) return true;
var state = this.states()[i];
if (state.nullCertainTaunt) return true;
}
return false;
};
Game_BattlerBase.prototype.ignoreTauntPhysical = function() {
Game_BattlerBase.prototype.ignoreTauntPhysical = function () {
for (var i = 0; i < this.states().length; ++i) {
var state = this.states()[i];
if (state.ignorePhysTaunt) return true;
var state = this.states()[i];
if (state.ignorePhysTaunt) return true;
}
return false;
};
Game_BattlerBase.prototype.ignoreTauntMagical = function() {
Game_BattlerBase.prototype.ignoreTauntMagical = function () {
for (var i = 0; i < this.states().length; ++i) {
var state = this.states()[i];
if (state.ignoreMagicTaunt) return true;
var state = this.states()[i];
if (state.ignoreMagicTaunt) return true;
}
return false;
};
Game_BattlerBase.prototype.ignoreTauntCertain = function() {
Game_BattlerBase.prototype.ignoreTauntCertain = function () {
for (var i = 0; i < this.states().length; ++i) {
var state = this.states()[i];
if (state.ignoreCertainTaunt) return true;
var state = this.states()[i];
if (state.ignoreCertainTaunt) return true;
}
return false;
};
@ -252,147 +252,147 @@ Game_BattlerBase.prototype.ignoreTauntCertain = function() {
// Game_Actor
//=============================================================================
Game_Actor.prototype.tauntPhysical = function() {
Game_Actor.prototype.tauntPhysical = function () {
if (this.nullTauntPhysical()) return false;
if (this.actor().physTaunt) return true;
if (this.currentClass().physTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.physTaunt) return true;
var equip = this.equips()[i];
if (equip && equip.physTaunt) return true;
}
return Game_BattlerBase.prototype.tauntPhysical.call(this);
};
Game_Actor.prototype.tauntMagical = function() {
Game_Actor.prototype.tauntMagical = function () {
if (this.nullTauntMagical()) return false;
if (this.actor().magicTaunt) return true;
if (this.currentClass().magicTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.magicTaunt) return true;
var equip = this.equips()[i];
if (equip && equip.magicTaunt) return true;
}
return Game_BattlerBase.prototype.tauntMagical.call(this);
};
Game_Actor.prototype.tauntCertain = function() {
Game_Actor.prototype.tauntCertain = function () {
if (this.nullTauntCertain()) return false;
if (this.actor().certainTaunt) return true;
if (this.currentClass().certainTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.certainTaunt) return true;
var equip = this.equips()[i];
if (equip && equip.certainTaunt) return true;
}
return Game_BattlerBase.prototype.tauntCertain.call(this);
};
Game_Actor.prototype.nullTauntPhysical = function() {
Game_Actor.prototype.nullTauntPhysical = function () {
if (this.actor().nullPhysTaunt) return true;
if (this.currentClass().nullPhysTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.nullPhysTaunt) return true;
var equip = this.equips()[i];
if (equip && equip.nullPhysTaunt) return true;
}
return Game_BattlerBase.prototype.nullTauntPhysical.call(this);
};
Game_Actor.prototype.nullTauntMagical = function() {
Game_Actor.prototype.nullTauntMagical = function () {
if (this.actor().nullMagicTaunt) return true;
if (this.currentClass().nullMagicTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.nullMagicTaunt) return true;
var equip = this.equips()[i];
if (equip && equip.nullMagicTaunt) return true;
}
return Game_BattlerBase.prototype.nullTauntMagical.call(this);
};
Game_Actor.prototype.nullTauntCertain = function() {
Game_Actor.prototype.nullTauntCertain = function () {
if (this.actor().nullCertainTaunt) return true;
if (this.currentClass().nullCertainTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.nullCertainTaunt) return true;
var equip = this.equips()[i];
if (equip && equip.nullCertainTaunt) return true;
}
return Game_BattlerBase.prototype.nullTauntCertain.call(this);
};
Game_Actor.prototype.ignoreTauntPhysical = function() {
if (this.actor().ignorePhysTaunt) return true;
if (this.currentClass().ignorePhysTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.ignorePhysTaunt) return true;
}
return Game_BattlerBase.prototype.ignoreTauntPhysical.call(this);
Game_Actor.prototype.ignoreTauntPhysical = function () {
if (this.actor().ignorePhysTaunt) return true;
if (this.currentClass().ignorePhysTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.ignorePhysTaunt) return true;
}
return Game_BattlerBase.prototype.ignoreTauntPhysical.call(this);
};
Game_Actor.prototype.ignoreTauntMagical = function() {
if (this.actor().ignoreMagicTaunt) return true;
if (this.currentClass().ignoreMagicTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.ignoreMagicTaunt) return true;
}
return Game_BattlerBase.prototype.ignoreTauntMagical.call(this);
Game_Actor.prototype.ignoreTauntMagical = function () {
if (this.actor().ignoreMagicTaunt) return true;
if (this.currentClass().ignoreMagicTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.ignoreMagicTaunt) return true;
}
return Game_BattlerBase.prototype.ignoreTauntMagical.call(this);
};
Game_Actor.prototype.ignoreTauntCertain = function() {
if (this.actor().ignoreCertainTaunt) return true;
if (this.currentClass().ignoreCertainTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.ignoreCertainTaunt) return true;
}
return Game_BattlerBase.prototype.ignoreTauntCertain.call(this);
Game_Actor.prototype.ignoreTauntCertain = function () {
if (this.actor().ignoreCertainTaunt) return true;
if (this.currentClass().ignoreCertainTaunt) return true;
for (var i = 0; i < this.equips().length; ++i) {
var equip = this.equips()[i];
if (equip && equip.ignoreCertainTaunt) return true;
}
return Game_BattlerBase.prototype.ignoreTauntCertain.call(this);
};
//=============================================================================
// Game_Enemy
//=============================================================================
Game_Enemy.prototype.tauntPhysical = function() {
Game_Enemy.prototype.tauntPhysical = function () {
if (this.nullTauntPhysical()) return false;
if (this.enemy().physTaunt) return true;
return Game_BattlerBase.prototype.tauntPhysical.call(this);
};
Game_Enemy.prototype.tauntMagical = function() {
Game_Enemy.prototype.tauntMagical = function () {
if (this.nullTauntMagical()) return false;
if (this.enemy().magicTaunt) return true;
return Game_BattlerBase.prototype.tauntMagical.call(this);
};
Game_Enemy.prototype.tauntCertain = function() {
Game_Enemy.prototype.tauntCertain = function () {
if (this.nullTauntCertain()) return false;
if (this.enemy().certainTaunt) return true;
return Game_BattlerBase.prototype.tauntCertain.call(this);
};
Game_Enemy.prototype.nullTauntPhysical = function() {
Game_Enemy.prototype.nullTauntPhysical = function () {
if (this.enemy().nullPhysTaunt) return true;
return Game_BattlerBase.prototype.nullTauntPhysical.call(this);
};
Game_Enemy.prototype.nullTauntMagical = function() {
Game_Enemy.prototype.nullTauntMagical = function () {
if (this.enemy().nullMagicTaunt) return true;
return Game_BattlerBase.prototype.nullTauntMagical.call(this);
};
Game_Enemy.prototype.nullTauntCertain = function() {
Game_Enemy.prototype.nullTauntCertain = function () {
if (this.enemy().nullCertainTaunt) return true;
return Game_BattlerBase.prototype.nullTauntCertain.call(this);
};
Game_Enemy.prototype.ignoreTauntPhysical = function() {
Game_Enemy.prototype.ignoreTauntPhysical = function () {
if (this.enemy().ignorePhysTaunt) return true;
return Game_BattlerBase.prototype.ignoreTauntPhysical.call(this);
};
Game_Enemy.prototype.ignoreTauntMagical = function() {
Game_Enemy.prototype.ignoreTauntMagical = function () {
if (this.enemy().ignoreMagicTaunt) return true;
return Game_BattlerBase.prototype.ignoreTauntMagical.call(this);
};
Game_Enemy.prototype.ignoreTauntCertain = function() {
Game_Enemy.prototype.ignoreTauntCertain = function () {
if (this.enemy().nullCertainTaunt) return true;
return Game_BattlerBase.prototype.ignoreTauntCertain.call(this);
};
@ -402,47 +402,47 @@ Game_Enemy.prototype.ignoreTauntCertain = function() {
//=============================================================================
Yanfly.Taunt.Game_Unit_aliveMembers = Game_Unit.prototype.aliveMembers;
Game_Unit.prototype.aliveMembers = function() {
Game_Unit.prototype.aliveMembers = function () {
if (this._inBattle && $gameTemp._taunt) return this.tauntMembers();
return Yanfly.Taunt.Game_Unit_aliveMembers.call(this);
};
Game_Unit.prototype.physicalTauntMembers = function() {
return this.members().filter(function(member) {
Game_Unit.prototype.physicalTauntMembers = function () {
return this.members().filter(function (member) {
return member.isAlive() && member.tauntPhysical();
});
};
Game_Unit.prototype.magicalTauntMembers = function() {
return this.members().filter(function(member) {
Game_Unit.prototype.magicalTauntMembers = function () {
return this.members().filter(function (member) {
return member.isAlive() && member.tauntMagical();
});
};
Game_Unit.prototype.certainTauntMembers = function() {
return this.members().filter(function(member) {
Game_Unit.prototype.certainTauntMembers = function () {
return this.members().filter(function (member) {
return member.isAlive() && member.tauntCertain();
});
};
Game_Unit.prototype.tauntMembers = function() {
Game_Unit.prototype.tauntMembers = function () {
var action;
if ($gameTemp._tauntAction) {
action = $gameTemp._tauntAction;
action = $gameTemp._tauntAction;
} else if (BattleManager.inputtingAction()) {
action = BattleManager.inputtingAction();
action = BattleManager.inputtingAction();
} else {
return Yanfly.Taunt.Game_Unit_aliveMembers.call(this);
return Yanfly.Taunt.Game_Unit_aliveMembers.call(this);
}
if (!action.isTauntable()) {
return Yanfly.Taunt.Game_Unit_aliveMembers.call(this);
return Yanfly.Taunt.Game_Unit_aliveMembers.call(this);
}
if (action.isPhysical() && this.physicalTauntMembers().length > 0) {
return this.physicalTauntMembers();
return this.physicalTauntMembers();
} else if (action.isMagical() && this.magicalTauntMembers().length > 0) {
return this.magicalTauntMembers();
return this.magicalTauntMembers();
} else if (action.isCertainHit() && this.certainTauntMembers().length > 0) {
return this.certainTauntMembers();
return this.certainTauntMembers();
}
return Yanfly.Taunt.Game_Unit_aliveMembers.call(this);
};
@ -451,22 +451,21 @@ Game_Unit.prototype.tauntMembers = function() {
// Game_Action
//=============================================================================
Yanfly.Taunt.Game_Action_makeTargets =
Game_Action.prototype.makeTargets;
Game_Action.prototype.makeTargets = function() {
Yanfly.Taunt.Game_Action_makeTargets = Game_Action.prototype.makeTargets;
Game_Action.prototype.makeTargets = function () {
if (this.isValid() && this.isTauntable()) {
$gameTemp._taunt = true;
$gameTemp._tauntAction = this;
$gameTemp._taunt = true;
$gameTemp._tauntAction = this;
}
var value = Yanfly.Taunt.Game_Action_makeTargets.call(this);
if (this.isValid() && this.isTauntable()) {
$gameTemp._taunt = false;
$gameTemp._taunt = false;
}
$gameTemp._tauntAction = undefined;
return value;
};
Game_Action.prototype.isTauntable = function() {
Game_Action.prototype.isTauntable = function () {
if (!this.checkItemScope([1])) return false;
if (this.item().bypassTaunt) return false;
if (this.isPhysical() && this.subject().ignoreTauntPhysical()) return false;
@ -475,50 +474,48 @@ Game_Action.prototype.isTauntable = function() {
return true;
};
Yanfly.Taunt.Game_Action_targetsForOpponents =
Game_Action.prototype.targetsForOpponents;
Game_Action.prototype.targetsForOpponents = function() {
Yanfly.Taunt.Game_Action_targetsForOpponents = Game_Action.prototype.targetsForOpponents;
Game_Action.prototype.targetsForOpponents = function () {
var targets = Yanfly.Taunt.Game_Action_targetsForOpponents.call(this);
if (this.isValid() && this.isTauntable() && $gameTemp._taunt) {
if (this.isForOne() && this._targetIndex >= 0) {
targets = this.getTauntTarget(targets);
}
};
if (this.isValid() && this.isTauntable() && $gameTemp._taunt) {
if (this.isForOne() && this._targetIndex >= 0) {
targets = this.getTauntTarget(targets);
}
}
return targets;
};
Game_Action.prototype.getTauntTarget = function(targets) {
var unit = this.opponentsUnit();
var target = unit.smoothTarget(this._targetIndex);
if (this.isPhysical() && unit.physicalTauntMembers().length > 0) {
if (!unit.physicalTauntMembers().contains(target)) {
var group = unit.physicalTauntMembers();
target = group[Math.floor(Math.random()*group.length)];
targets = [target];
}
} else if (this.isMagical() && unit.magicalTauntMembers().length > 0) {
if (!unit.magicalTauntMembers().contains(target)) {
var group = unit.magicalTauntMembers();
target = group[Math.floor(Math.random()*group.length)];
targets = [target];
}
} else if (this.isCertainHit() && unit.certainTauntMembers().length > 0) {
if (!unit.certainTauntMembers().contains(target)) {
var group = unit.certainTauntMembers();
target = group[Math.floor(Math.random()*group.length)];
targets = [target];
}
}
return targets;
Game_Action.prototype.getTauntTarget = function (targets) {
var unit = this.opponentsUnit();
var target = unit.smoothTarget(this._targetIndex);
if (this.isPhysical() && unit.physicalTauntMembers().length > 0) {
if (!unit.physicalTauntMembers().contains(target)) {
var group = unit.physicalTauntMembers();
target = group[Math.floor(Math.random() * group.length)];
targets = [target];
}
} else if (this.isMagical() && unit.magicalTauntMembers().length > 0) {
if (!unit.magicalTauntMembers().contains(target)) {
var group = unit.magicalTauntMembers();
target = group[Math.floor(Math.random() * group.length)];
targets = [target];
}
} else if (this.isCertainHit() && unit.certainTauntMembers().length > 0) {
if (!unit.certainTauntMembers().contains(target)) {
var group = unit.certainTauntMembers();
target = group[Math.floor(Math.random() * group.length)];
targets = [target];
}
}
return targets;
};
//=============================================================================
// Scene_Battle
//=============================================================================
Yanfly.Taunt.Scene_Battle_selectEnemySelection =
Scene_Battle.prototype.selectEnemySelection;
Scene_Battle.prototype.selectEnemySelection = function() {
Yanfly.Taunt.Scene_Battle_selectEnemySelection = Scene_Battle.prototype.selectEnemySelection;
Scene_Battle.prototype.selectEnemySelection = function () {
$gameTemp._taunt = true;
Yanfly.Taunt.Scene_Battle_selectEnemySelection.call(this);
$gameTemp._taunt = false;

@ -8,10 +8,10 @@ Imported.YEP_X_Autosave = true;
var Yanfly = Yanfly || {};
Yanfly.Autosave = Yanfly.Autosave || {};
Yanfly.Autosave.version = 1.00;
Yanfly.Autosave.version = 1.0;
//=============================================================================
/*:
/*:
* @plugindesc v1.00 (Req YEP_SaveCore.js) Adds Autosave functionality to your
* RPG Maker game.
* @author Yanfly Engine Plugins
@ -114,7 +114,7 @@ Yanfly.Autosave.version = 1.00;
* ---------
* Settings:
* ---------
*
*
* Name:
* \i[231]Autosave
*
@ -137,7 +137,7 @@ Yanfly.Autosave.version = 1.00;
* ----------
* Functions:
* ----------
*
*
* Make Option Code:
* this.addCommand(name, symbol, enabled, ext);
*
@ -161,7 +161,7 @@ Yanfly.Autosave.version = 1.00;
* var symbol = this.commandSymbol(index);
* var value = this.getConfigValue(symbol);
* this.changeValue(symbol, true);
*
*
* Cursor Left Code:
* var index = this.index();
* var symbol = this.commandSymbol(index);
@ -316,329 +316,322 @@ Yanfly.Autosave.version = 1.00;
//=============================================================================
if (Imported.YEP_SaveCore) {
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters('YEP_X_Autosave');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.AutosaveOnMapLoad = eval(String(Yanfly.Parameters['OnMapLoad']));
Yanfly.Param.AutosaveOnMainMenu = eval(String(Yanfly.Parameters['OnMainMenu']));
Yanfly.Param.AutosaveShowOpt = eval(String(Yanfly.Parameters['Show Option']));
Yanfly.Param.AutosaveOptionCmd = String(Yanfly.Parameters['Option Name']);
Yanfly.Param.AutosaveDefault = eval(String(Yanfly.Parameters['Default']));
Yanfly.Param.AutosaveShowMsg = eval(String(Yanfly.Parameters['ShowAutosave']));
Yanfly.Param.AutosaveMsgSave = String(Yanfly.Parameters['AutosaveMsgSave']);
Yanfly.Param.AutosaveMsgLoad = String(Yanfly.Parameters['AutosaveMsgLoad']);
Yanfly.Param.AutosaveMsgColor1 = String(Yanfly.Parameters['MsgGradient1']);
Yanfly.Param.AutosaveMsgColor2 = String(Yanfly.Parameters['MsgGradient2']);
Yanfly.Param.AutosaveMsgCode = JSON.parse(Yanfly.Parameters['MsgGradientCode']);
Yanfly.Param.AutosaveMsgX = String(Yanfly.Parameters['MsgX']);
Yanfly.Param.AutosaveMsgY = String(Yanfly.Parameters['MsgY']);
Yanfly.Param.AutosaveMsgDur = Number(Yanfly.Parameters['MsgDuration']) || 120;
Yanfly.Param.AutosaveMsgFade = Number(Yanfly.Parameters['FadeSpeed']) || 16;
//=============================================================================
// ConfigManager
//=============================================================================
ConfigManager.autosave = Yanfly.Param.AutosaveDefault;
Yanfly.Autosave.ConfigManager_makeData = ConfigManager.makeData;
ConfigManager.makeData = function() {
var config = Yanfly.Autosave.ConfigManager_makeData.call(this);
config.autosave = this.autosave;
return config;
};
Yanfly.Autosave.ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function(config) {
Yanfly.Autosave.ConfigManager_applyData.call(this, config);
this.autosave = config['autosave'] || Yanfly.Param.AutosaveDefault;
};
//=============================================================================
// DataManager
//=============================================================================
Yanfly.Autosave.DataManager_setupNewGame = DataManager.setupNewGame;
DataManager.setupNewGame = function() {
Yanfly.Autosave.DataManager_setupNewGame.call(this);
StorageManager.setCurrentAutosaveSlot(this._lastAccessedId);
$gameTemp._autosaveNewGame = false;
$gameTemp._autosaveLoading = false;
};
Yanfly.Autosave.DataManager_saveGame = DataManager.saveGameWithoutRescue;
DataManager.saveGameWithoutRescue = function(savefileId) {
var value = Yanfly.Autosave.DataManager_saveGame.call(this, savefileId);
$gameTemp._autosaveNewGame = false;
$gameTemp._autosaveLoading = false;
StorageManager.setCurrentAutosaveSlot(savefileId);
return value;
};
Yanfly.Autosave.DataManager_loadGame = DataManager.loadGameWithoutRescue;
DataManager.loadGameWithoutRescue = function(savefileId) {
var value = Yanfly.Autosave.DataManager_loadGame.call(this, savefileId);
$gameTemp._autosaveNewGame = false;
$gameTemp._autosaveLoading = true;
StorageManager.setCurrentAutosaveSlot(savefileId);
return value;
};
//=============================================================================
// StorageManager
//=============================================================================
StorageManager.getCurrentAutosaveSlot = function() {
return this._currentAutosaveSlot;
};
StorageManager.setCurrentAutosaveSlot = function(savefileId) {
this._currentAutosaveSlot = 1;
};
StorageManager.performAutosave = function() {
if ($gameMap.mapId() <= 0) return;
if ($gameTemp._autosaveNewGame) return;
if (!$gameSystem.canAutosave()) return;
SceneManager._scene.performAutosave();
};
//=============================================================================
// Game_System
//=============================================================================
Yanfly.Autosave.Game_System_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
Yanfly.Autosave.Game_System_initialize.call(this);
this.initAutosave();
};
Game_System.prototype.initAutosave = function() {
this._allowAutosave = true;
};
Game_System.prototype.canAutosave = function() {
if (this._allowAutosave === undefined) this.initAutosave();
return this._allowAutosave;
};
Game_System.prototype.setAutosave = function(value) {
if (this._allowAutosave === undefined) this.initAutosave();
this._allowAutosave = value;
};
//=============================================================================
// Game_Interpreter
//=============================================================================
Yanfly.Autosave.Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
Yanfly.Autosave.Game_Interpreter_pluginCommand.call(this, command, args);
if (command.match(/EnableAutosave/i)) {
$gameSystem.setAutosave(true);
} else if (command.match(/DisableAutosave/i)) {
$gameSystem.setAutosave(false);
} else if (command.match(/Autosave/i)) {
StorageManager.performAutosave();
}
};
//=============================================================================
// Window_Options
//=============================================================================
Yanfly.Autosave.Window_Options_addGeneralOptions =
Window_Options.prototype.addGeneralOptions;
Window_Options.prototype.addGeneralOptions = function() {
Yanfly.Autosave.Window_Options_addGeneralOptions.call(this);
if (!Imported.YEP_OptionsCore && Yanfly.Param.AutosaveShowOpt) {
this.addCommand(Yanfly.Param.AutosaveOptionCmd, 'autosave');
}
};
//=============================================================================
// Window_Autosave
//=============================================================================
function Window_Autosave() {
this.initialize.apply(this, arguments);
}
Window_Autosave.prototype = Object.create(Window_Base.prototype);
Window_Autosave.prototype.constructor = Window_Autosave;
Window_Autosave.prototype.initialize = function() {
var width = this.windowWidth();
var height = this.windowHeight();
var x = eval(Yanfly.Param.AutosaveMsgX);
var y = eval(Yanfly.Param.AutosaveMsgY);
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.opacity = 0;
this.contentsOpacity = 0;
this._showCount = 0;
this.refresh();
if ($gameTemp._autosaveLoading) {
this.reveal();
$gameTemp._autosaveLoading = false;
}
};
Window_Autosave.prototype.standardPadding = function() {
return 0;
};
Window_Autosave.prototype.windowWidth = function() {
return Graphics.boxWidth;
};
Window_Autosave.prototype.windowHeight = function() {
return this.fittingHeight(1);
};
Window_Autosave.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (this._showCount > 0) {
this.updateFadeIn();
this._showCount--;
} else {
this.updateFadeOut();
}
};
Window_Autosave.prototype.updateFadeIn = function() {
this.contentsOpacity += Yanfly.Param.AutosaveMsgFade;
};
Window_Autosave.prototype.updateFadeOut = function() {
this.contentsOpacity -= Yanfly.Param.AutosaveMsgFade;
};
Window_Autosave.prototype.reveal = function() {
if (!Yanfly.Param.AutosaveShowMsg) return;
if (this._showCount > 0) return;
this._showCount = Yanfly.Param.AutosaveMsgDur;
this.refresh();
};
Window_Autosave.prototype.message = function() {
if ($gameTemp._autosaveLoading) {
return Yanfly.Param.AutosaveMsgLoad;
} else {
return Yanfly.Param.AutosaveMsgSave;
}
};
Window_Autosave.prototype.refresh = function() {
this.contents.clear();
this.drawGradient();
this.drawTextEx(this.message(), this.textPadding(), 0);
};
Window_Autosave.prototype.drawGradient = function() {
eval(Yanfly.Param.AutosaveMsgCode);
};
Window_Autosave.prototype.textWidthEx = function(text) {
return this.drawTextEx(text, 0, this.contents.height);
};
//=============================================================================
// Scene_Base
//=============================================================================
Scene_Base.prototype.performAutosave = function() {
};
//=============================================================================
// Scene_Map
//=============================================================================
Yanfly.Autosave.Scene_Map_createAllWindows =
Scene_Map.prototype.createAllWindows;
Scene_Map.prototype.createAllWindows = function() {
Yanfly.Autosave.Scene_Map_createAllWindows.call(this);
this.createAutosaveMessageWindow();
};
Scene_Map.prototype.createAutosaveMessageWindow = function() {
this._autosaveMsgWindow = new Window_Autosave();
this.addChild(this._autosaveMsgWindow);
};
Yanfly.Autosave.Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded;
Scene_Map.prototype.onMapLoaded = function() {
Yanfly.Autosave.Scene_Map_onMapLoaded.call(this);
if (Yanfly.Param.AutosaveOnMapLoad) StorageManager.performAutosave();
};
Yanfly.Autosave.Scene_Map_callMenu = Scene_Map.prototype.callMenu;
Scene_Map.prototype.callMenu = function() {
Yanfly.Autosave.Scene_Map_callMenu.call(this);
if (Yanfly.Param.AutosaveOnMainMenu) StorageManager.performAutosave();
};
Scene_Map.prototype.performAutosave = function() {
if ($gameMap.mapId() <= 0) return;
if ($gameTemp._autosaveNewGame) return;
if (!$gameSystem.canAutosave()) return;
$gameSystem.onBeforeSave();
DataManager.saveGameWithoutRescue(StorageManager.getCurrentAutosaveSlot());
if (this._autosaveMsgWindow) this._autosaveMsgWindow.reveal();
};
//=============================================================================
// Window_SavefileList
//=============================================================================
Yanfly.Autosave.Window_SavefileList_drawItem = Window_SavefileList.prototype.drawItem;
Window_SavefileList.prototype.drawItem = function(index) {
var id = index + 1;
var valid = DataManager.isThisGameFile(id);
var rect = this.itemRect(index);
this.resetTextColor();
//if (this._mode === 'load') this.changePaintOpacity(valid);
this.changePaintOpacity(valid);
var icon = valid ? Yanfly.Param.SaveIconSaved : Yanfly.Param.SaveIconEmpty;
this.drawIcon(icon, rect.x + 2, rect.y + 2);
if(id === 1){ //First is AutoSaved
this.drawText("自动存档",rect.x + Window_Base._iconWidth + 4, rect.y, 180);
} else {
this.drawFileId(id-1, rect.x + Window_Base._iconWidth + 4, rect.y);
}
};
//=============================================================================
// Window_SaveAction
//=============================================================================
Yanfly.Autosave.Window_SaveAction_isSaveEnabled = Window_SaveAction.prototype.isSaveEnabled;
Window_SaveAction.prototype.isSaveEnabled = function() {
if (this._mode !== 'save') return false;
if (this._currentFile === 1)return false;
return $gameSystem.isSaveEnabled();
};
//=============================================================================
// Save Core Check
//=============================================================================
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters("YEP_X_Autosave");
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.AutosaveOnMapLoad = eval(String(Yanfly.Parameters["OnMapLoad"]));
Yanfly.Param.AutosaveOnMainMenu = eval(String(Yanfly.Parameters["OnMainMenu"]));
Yanfly.Param.AutosaveShowOpt = eval(String(Yanfly.Parameters["Show Option"]));
Yanfly.Param.AutosaveOptionCmd = String(Yanfly.Parameters["Option Name"]);
Yanfly.Param.AutosaveDefault = eval(String(Yanfly.Parameters["Default"]));
Yanfly.Param.AutosaveShowMsg = eval(String(Yanfly.Parameters["ShowAutosave"]));
Yanfly.Param.AutosaveMsgSave = String(Yanfly.Parameters["AutosaveMsgSave"]);
Yanfly.Param.AutosaveMsgLoad = String(Yanfly.Parameters["AutosaveMsgLoad"]);
Yanfly.Param.AutosaveMsgColor1 = String(Yanfly.Parameters["MsgGradient1"]);
Yanfly.Param.AutosaveMsgColor2 = String(Yanfly.Parameters["MsgGradient2"]);
Yanfly.Param.AutosaveMsgCode = JSON.parse(Yanfly.Parameters["MsgGradientCode"]);
Yanfly.Param.AutosaveMsgX = String(Yanfly.Parameters["MsgX"]);
Yanfly.Param.AutosaveMsgY = String(Yanfly.Parameters["MsgY"]);
Yanfly.Param.AutosaveMsgDur = Number(Yanfly.Parameters["MsgDuration"]) || 120;
Yanfly.Param.AutosaveMsgFade = Number(Yanfly.Parameters["FadeSpeed"]) || 16;
//=============================================================================
// ConfigManager
//=============================================================================
ConfigManager.autosave = Yanfly.Param.AutosaveDefault;
Yanfly.Autosave.ConfigManager_makeData = ConfigManager.makeData;
ConfigManager.makeData = function () {
var config = Yanfly.Autosave.ConfigManager_makeData.call(this);
config.autosave = this.autosave;
return config;
};
Yanfly.Autosave.ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function (config) {
Yanfly.Autosave.ConfigManager_applyData.call(this, config);
this.autosave = config["autosave"] || Yanfly.Param.AutosaveDefault;
};
//=============================================================================
// DataManager
//=============================================================================
Yanfly.Autosave.DataManager_setupNewGame = DataManager.setupNewGame;
DataManager.setupNewGame = function () {
Yanfly.Autosave.DataManager_setupNewGame.call(this);
StorageManager.setCurrentAutosaveSlot(this._lastAccessedId);
$gameTemp._autosaveNewGame = false;
$gameTemp._autosaveLoading = false;
};
Yanfly.Autosave.DataManager_saveGame = DataManager.saveGameWithoutRescue;
DataManager.saveGameWithoutRescue = function (savefileId) {
var value = Yanfly.Autosave.DataManager_saveGame.call(this, savefileId);
$gameTemp._autosaveNewGame = false;
$gameTemp._autosaveLoading = false;
StorageManager.setCurrentAutosaveSlot(savefileId);
return value;
};
Yanfly.Autosave.DataManager_loadGame = DataManager.loadGameWithoutRescue;
DataManager.loadGameWithoutRescue = function (savefileId) {
var value = Yanfly.Autosave.DataManager_loadGame.call(this, savefileId);
$gameTemp._autosaveNewGame = false;
$gameTemp._autosaveLoading = true;
StorageManager.setCurrentAutosaveSlot(savefileId);
return value;
};
//=============================================================================
// StorageManager
//=============================================================================
StorageManager.getCurrentAutosaveSlot = function () {
return this._currentAutosaveSlot;
};
StorageManager.setCurrentAutosaveSlot = function (savefileId) {
this._currentAutosaveSlot = 1;
};
StorageManager.performAutosave = function () {
if ($gameMap.mapId() <= 0) return;
if ($gameTemp._autosaveNewGame) return;
if (!$gameSystem.canAutosave()) return;
SceneManager._scene.performAutosave();
};
//=============================================================================
// Game_System
//=============================================================================
Yanfly.Autosave.Game_System_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function () {
Yanfly.Autosave.Game_System_initialize.call(this);
this.initAutosave();
};
Game_System.prototype.initAutosave = function () {
this._allowAutosave = true;
};
Game_System.prototype.canAutosave = function () {
if (this._allowAutosave === undefined) this.initAutosave();
return this._allowAutosave;
};
Game_System.prototype.setAutosave = function (value) {
if (this._allowAutosave === undefined) this.initAutosave();
this._allowAutosave = value;
};
//=============================================================================
// Game_Interpreter
//=============================================================================
Yanfly.Autosave.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function (command, args) {
Yanfly.Autosave.Game_Interpreter_pluginCommand.call(this, command, args);
if (command.match(/EnableAutosave/i)) {
$gameSystem.setAutosave(true);
} else if (command.match(/DisableAutosave/i)) {
$gameSystem.setAutosave(false);
} else if (command.match(/Autosave/i)) {
StorageManager.performAutosave();
}
};
//=============================================================================
// Window_Options
//=============================================================================
Yanfly.Autosave.Window_Options_addGeneralOptions = Window_Options.prototype.addGeneralOptions;
Window_Options.prototype.addGeneralOptions = function () {
Yanfly.Autosave.Window_Options_addGeneralOptions.call(this);
if (!Imported.YEP_OptionsCore && Yanfly.Param.AutosaveShowOpt) {
this.addCommand(Yanfly.Param.AutosaveOptionCmd, "autosave");
}
};
//=============================================================================
// Window_Autosave
//=============================================================================
function Window_Autosave() {
this.initialize.apply(this, arguments);
}
Window_Autosave.prototype = Object.create(Window_Base.prototype);
Window_Autosave.prototype.constructor = Window_Autosave;
Window_Autosave.prototype.initialize = function () {
var width = this.windowWidth();
var height = this.windowHeight();
var x = eval(Yanfly.Param.AutosaveMsgX);
var y = eval(Yanfly.Param.AutosaveMsgY);
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.opacity = 0;
this.contentsOpacity = 0;
this._showCount = 0;
this.refresh();
if ($gameTemp._autosaveLoading) {
this.reveal();
$gameTemp._autosaveLoading = false;
}
};
Window_Autosave.prototype.standardPadding = function () {
return 0;
};
Window_Autosave.prototype.windowWidth = function () {
return Graphics.boxWidth;
};
Window_Autosave.prototype.windowHeight = function () {
return this.fittingHeight(1);
};
Window_Autosave.prototype.update = function () {
Window_Base.prototype.update.call(this);
if (this._showCount > 0) {
this.updateFadeIn();
this._showCount--;
} else {
this.updateFadeOut();
}
};
Window_Autosave.prototype.updateFadeIn = function () {
this.contentsOpacity += Yanfly.Param.AutosaveMsgFade;
};
Window_Autosave.prototype.updateFadeOut = function () {
this.contentsOpacity -= Yanfly.Param.AutosaveMsgFade;
};
Window_Autosave.prototype.reveal = function () {
if (!Yanfly.Param.AutosaveShowMsg) return;
if (this._showCount > 0) return;
this._showCount = Yanfly.Param.AutosaveMsgDur;
this.refresh();
};
Window_Autosave.prototype.message = function () {
if ($gameTemp._autosaveLoading) {
return Yanfly.Param.AutosaveMsgLoad;
} else {
return Yanfly.Param.AutosaveMsgSave;
}
};
Window_Autosave.prototype.refresh = function () {
this.contents.clear();
this.drawGradient();
this.drawTextEx(this.message(), this.textPadding(), 0);
};
Window_Autosave.prototype.drawGradient = function () {
eval(Yanfly.Param.AutosaveMsgCode);
};
Window_Autosave.prototype.textWidthEx = function (text) {
return this.drawTextEx(text, 0, this.contents.height);
};
//=============================================================================
// Scene_Base
//=============================================================================
Scene_Base.prototype.performAutosave = function () {};
//=============================================================================
// Scene_Map
//=============================================================================
Yanfly.Autosave.Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows;
Scene_Map.prototype.createAllWindows = function () {
Yanfly.Autosave.Scene_Map_createAllWindows.call(this);
this.createAutosaveMessageWindow();
};
Scene_Map.prototype.createAutosaveMessageWindow = function () {
this._autosaveMsgWindow = new Window_Autosave();
this.addChild(this._autosaveMsgWindow);
};
Yanfly.Autosave.Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded;
Scene_Map.prototype.onMapLoaded = function () {
Yanfly.Autosave.Scene_Map_onMapLoaded.call(this);
if (Yanfly.Param.AutosaveOnMapLoad) StorageManager.performAutosave();
};
Yanfly.Autosave.Scene_Map_callMenu = Scene_Map.prototype.callMenu;
Scene_Map.prototype.callMenu = function () {
Yanfly.Autosave.Scene_Map_callMenu.call(this);
if (Yanfly.Param.AutosaveOnMainMenu) StorageManager.performAutosave();
};
Scene_Map.prototype.performAutosave = function () {
if ($gameMap.mapId() <= 0) return;
if ($gameTemp._autosaveNewGame) return;
if (!$gameSystem.canAutosave()) return;
$gameSystem.onBeforeSave();
DataManager.saveGameWithoutRescue(StorageManager.getCurrentAutosaveSlot());
if (this._autosaveMsgWindow) this._autosaveMsgWindow.reveal();
};
//=============================================================================
// Window_SavefileList
//=============================================================================
Yanfly.Autosave.Window_SavefileList_drawItem = Window_SavefileList.prototype.drawItem;
Window_SavefileList.prototype.drawItem = function (index) {
var id = index + 1;
var valid = DataManager.isThisGameFile(id);
var rect = this.itemRect(index);
this.resetTextColor();
//if (this._mode === 'load') this.changePaintOpacity(valid);
this.changePaintOpacity(valid);
var icon = valid ? Yanfly.Param.SaveIconSaved : Yanfly.Param.SaveIconEmpty;
this.drawIcon(icon, rect.x + 2, rect.y + 2);
if (id === 1) {
//First is AutoSaved
this.drawText("自动存档", rect.x + Window_Base._iconWidth + 4, rect.y, 180);
} else {
this.drawFileId(id - 1, rect.x + Window_Base._iconWidth + 4, rect.y);
}
};
//=============================================================================
// Window_SaveAction
//=============================================================================
Yanfly.Autosave.Window_SaveAction_isSaveEnabled = Window_SaveAction.prototype.isSaveEnabled;
Window_SaveAction.prototype.isSaveEnabled = function () {
if (this._mode !== "save") return false;
if (this._currentFile === 1) return false;
return $gameSystem.isSaveEnabled();
};
//=============================================================================
// Save Core Check
//=============================================================================
} else {
Imported.YEP_X_Autosave = false;
var text = '';
text += 'You are getting this error because you are trying to run ';
text += 'YEP_X_Autosave without the required plugins. Please visit ';
text += 'Yanfly.moe and install the required plugins neede for this plugin ';
text += 'found in this plugin\'s help file before you can use it.';
console.log(text);
require('nw.gui').Window.get().showDevTools();
Imported.YEP_X_Autosave = false;
var text = "";
text += "You are getting this error because you are trying to run ";
text += "YEP_X_Autosave without the required plugins. Please visit ";
text += "Yanfly.moe and install the required plugins neede for this plugin ";
text += "found in this plugin's help file before you can use it.";
console.log(text);
require("nw.gui").Window.get().showDevTools();
}
//=============================================================================
// End of File

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -11,7 +11,7 @@ Yanfly.ItemCat = Yanfly.ItemCat || {};
Yanfly.ItemCat.version = 1.01;
//=============================================================================
/*:
/*:
* @plugindesc v1.01 (Requires YEP_ItemCore.js) Assign items to various
* categories under the item menu.
* @author Yanfly Engine Plugins + Sylvester Collaboration
@ -129,7 +129,7 @@ Yanfly.ItemCat.version = 1.01;
* Bodygear
* Accessory
* Herbs
*
*
* Would look like this for the plugin parameters:
*
* Items, KeyItems, WType:1, WType2, AType1, AType2, Category:Herbs
@ -186,251 +186,246 @@ Yanfly.ItemCat.version = 1.01;
//=============================================================================
if (Imported.YEP_ItemCore) {
//=============================================================================
// Parameter Variables
//=============================================================================
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters("YEP_X_ItemCategories");
Yanfly.Param = Yanfly.Param || {};
Yanfly.Parameters = PluginManager.parameters('YEP_X_ItemCategories');
Yanfly.Param = Yanfly.Param || {};
Yanfly.SetupParameters = function () {
Yanfly.Param.ItemCatOrder = String(Yanfly.Parameters["Category Order"]);
Yanfly.Param.ItemCatOrder = Yanfly.Param.ItemCatOrder.split(",");
//---
var length = Yanfly.Param.ItemCatOrder.length;
for (var i = 0; i < 0; i++) {
Yanfly.Param.ItemCatOrder[i] = Yanfly.Param.ItemCatOrder[i].trim();
}
Yanfly.Param.ItemCatNames = {
HiddenItemA: String(Yanfly.Parameters["Hidden Item A"]),
HiddenItemB: String(Yanfly.Parameters["Hidden Item B"]),
Consumable: String(Yanfly.Parameters["Consumable"]),
Nonconsumable: String(Yanfly.Parameters["Nonconsumable"]),
AlwaysUsable: String(Yanfly.Parameters["Always Usable"]),
BattleUsable: String(Yanfly.Parameters["Battle Usable"]),
FieldUsable: String(Yanfly.Parameters["Field Usable"]),
NeverUsable: String(Yanfly.Parameters["Never Usable"]),
};
};
Yanfly.SetupParameters();
Yanfly.SetupParameters = function() {
Yanfly.Param.ItemCatOrder = String(Yanfly.Parameters['Category Order']);
Yanfly.Param.ItemCatOrder = Yanfly.Param.ItemCatOrder.split(',');
//---
var length = Yanfly.Param.ItemCatOrder.length;
for (var i = 0; i < 0; i++) {
Yanfly.Param.ItemCatOrder[i] = Yanfly.Param.ItemCatOrder[i].trim();
}
Yanfly.Param.ItemCatNames = {
HiddenItemA: String(Yanfly.Parameters['Hidden Item A']),
HiddenItemB: String(Yanfly.Parameters['Hidden Item B']),
Consumable: String(Yanfly.Parameters['Consumable']),
Nonconsumable: String(Yanfly.Parameters['Nonconsumable']),
AlwaysUsable: String(Yanfly.Parameters['Always Usable']),
BattleUsable: String(Yanfly.Parameters['Battle Usable']),
FieldUsable: String(Yanfly.Parameters['Field Usable']),
NeverUsable: String(Yanfly.Parameters['Never Usable'])
}
};
Yanfly.SetupParameters();
//=============================================================================
// DataManager
// ----------------------------------------------------------------------------
// Notetags added by Yanfly
//=============================================================================
//=============================================================================
// DataManager
// ----------------------------------------------------------------------------
// Notetags added by Yanfly
//=============================================================================
Yanfly.ItemCat.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function () {
if (!Yanfly.ItemCat.DataManager_isDatabaseLoaded.call(this)) return false;
Yanfly.ItemCat.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Yanfly.ItemCat.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_X_ItemCategories) {
this.processItemCategoriesNotetags1($dataItems);
this.processItemCategoriesNotetags1($dataWeapons);
this.processItemCategoriesNotetags1($dataArmors);
Yanfly._loaded_YEP_X_ItemCategories = true;
}
if (!Yanfly._loaded_YEP_X_ItemCategories) {
this.processItemCategoriesNotetags1($dataItems);
this.processItemCategoriesNotetags1($dataWeapons);
this.processItemCategoriesNotetags1($dataArmors);
Yanfly._loaded_YEP_X_ItemCategories = true;
}
return true;
};
return true;
};
DataManager.processItemCategoriesNotetags1 = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
DataManager.processItemCategoriesNotetags1 = function (group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.itemCategory = [];
obj.itemCategory = [];
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<MENU[ ](?:CATEGORY|CATEGORIES):[ ](.*)>/i)) {
var str = String(RegExp.$1).split(',');
var length = str.length;
for (var s = 0; s < length; s++) {
obj.itemCategory.push(str[s].trim());
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<MENU[ ](?:CATEGORY|CATEGORIES):[ ](.*)>/i)) {
var str = String(RegExp.$1).split(",");
var length = str.length;
for (var s = 0; s < length; s++) {
obj.itemCategory.push(str[s].trim());
}
}
}
}
}
}
}
};
};
//=============================================================================
// Window_ItemCategory
//=============================================================================
//=============================================================================
// Window_ItemCategory
//=============================================================================
Yanfly.ItemCat.Window_ItemCategory_update =
Window_ItemCategory.prototype.update;
Window_ItemCategory.prototype.update = function() {
Yanfly.ItemCat.Window_ItemCategory_update.call(this);
if (this._itemWindow) {
this._itemWindow.setExt(this.currentExt());
}
};
Yanfly.ItemCat.Window_ItemCategory_update = Window_ItemCategory.prototype.update;
Window_ItemCategory.prototype.update = function () {
Yanfly.ItemCat.Window_ItemCategory_update.call(this);
if (this._itemWindow) {
this._itemWindow.setExt(this.currentExt());
}
};
Window_ItemCategory.prototype.makeCommandList = function() {
var data = Yanfly.Param.ItemCatOrder;
var length = data.length;
for (var i = 0; i < length; i++) {
var category = data[i].trim();
this.addItemCategory(category);
}
};
Window_ItemCategory.prototype.makeCommandList = function () {
var data = Yanfly.Param.ItemCatOrder;
var length = data.length;
for (var i = 0; i < length; i++) {
var category = data[i].trim();
this.addItemCategory(category);
}
};
Window_ItemCategory.prototype.addItemCategory = function(category) {
var text = Yanfly.Param.ItemCatNames[category];
if (category.match(/Category:(.*)/i)) {
var type = String(RegExp.$1);
return this.addCommand(type, 'Category', true, type);
}
if (category.match(/AllItems/i)) {
return this.addCommand(TextManager.item, 'AllItems');
}
if (category.match(/RegularItems/i)) {
return this.addCommand(text, 'item');
}
if (category.match(/KeyItems/i)) {
return this.addCommand(TextManager.keyItem, 'keyItem');
}
if (category.match(/HiddenItemA/i)) {
return this.addCommand(text, 'HiddenItemA');
}
if (category.match(/HiddenItemB/i)) {
return this.addCommand(text, 'HiddenItemB');
}
if (category.match(/Nonconsumable/i)) {
return this.addCommand(text, 'Nonconsumable');
}
if (category.match(/Consumable/i)) {
return this.addCommand(text, 'Consumable');
}
if (category.match(/AlwaysUsable/i)) {
return this.addCommand(text, 'AlwaysUsable');
}
if (category.match(/BattleUsable/i)) {
return this.addCommand(text, 'BattleUsable');
}
if (category.match(/FieldUsable/i)) {
return this.addCommand(text, 'FieldUsable');
}
if (category.match(/NeverUsable/i)) {
return this.addCommand(text, 'NeverUsable');
}
if (category.match(/Items/i)) {
return this.addCommand(TextManager.item, 'item');
}
if (category.match(/Weapons/i)) {
return this.addCommand(TextManager.weapon, 'weapon');
}
if (category.match(/WType:(\d+)/i)) {
var id = parseInt(RegExp.$1);
return this.addCommand($dataSystem.weaponTypes[id], 'WType', true, id);
}
if (category.match(/Armors/i)) {
return this.addCommand(TextManager.armor, 'armor');
}
if (category.match(/AType:(\d+)/i)) {
var id = parseInt(RegExp.$1);
return this.addCommand($dataSystem.armorTypes[id], 'AType', true, id);
}
if (category.match(/EType:(\d+)/i)) {
var id = parseInt(RegExp.$1);
return this.addCommand($dataSystem.equipTypes[id], 'EType', true, id);
}
};
Window_ItemCategory.prototype.addItemCategory = function (category) {
var text = Yanfly.Param.ItemCatNames[category];
if (category.match(/Category:(.*)/i)) {
var type = String(RegExp.$1);
return this.addCommand(type, "Category", true, type);
}
if (category.match(/AllItems/i)) {
return this.addCommand(TextManager.item, "AllItems");
}
if (category.match(/RegularItems/i)) {
return this.addCommand(text, "item");
}
if (category.match(/KeyItems/i)) {
return this.addCommand(TextManager.keyItem, "keyItem");
}
if (category.match(/HiddenItemA/i)) {
return this.addCommand(text, "HiddenItemA");
}
if (category.match(/HiddenItemB/i)) {
return this.addCommand(text, "HiddenItemB");
}
if (category.match(/Nonconsumable/i)) {
return this.addCommand(text, "Nonconsumable");
}
if (category.match(/Consumable/i)) {
return this.addCommand(text, "Consumable");
}
if (category.match(/AlwaysUsable/i)) {
return this.addCommand(text, "AlwaysUsable");
}
if (category.match(/BattleUsable/i)) {
return this.addCommand(text, "BattleUsable");
}
if (category.match(/FieldUsable/i)) {
return this.addCommand(text, "FieldUsable");
}
if (category.match(/NeverUsable/i)) {
return this.addCommand(text, "NeverUsable");
}
if (category.match(/Items/i)) {
return this.addCommand(TextManager.item, "item");
}
if (category.match(/Weapons/i)) {
return this.addCommand(TextManager.weapon, "weapon");
}
if (category.match(/WType:(\d+)/i)) {
var id = parseInt(RegExp.$1);
return this.addCommand($dataSystem.weaponTypes[id], "WType", true, id);
}
if (category.match(/Armors/i)) {
return this.addCommand(TextManager.armor, "armor");
}
if (category.match(/AType:(\d+)/i)) {
var id = parseInt(RegExp.$1);
return this.addCommand($dataSystem.armorTypes[id], "AType", true, id);
}
if (category.match(/EType:(\d+)/i)) {
var id = parseInt(RegExp.$1);
return this.addCommand($dataSystem.equipTypes[id], "EType", true, id);
}
};
//=============================================================================
// Window_ItemList
//=============================================================================
//=============================================================================
// Window_ItemList
//=============================================================================
Yanfly.ItemCat.Window_ItemList_initialize =
Window_ItemList.prototype.initialize;
Window_ItemList.prototype.initialize = function(x, y, width, height) {
Yanfly.ItemCat.Window_ItemList_initialize.call(this, x, y, width, height);
this._ext = 'none';
};
Yanfly.ItemCat.Window_ItemList_initialize = Window_ItemList.prototype.initialize;
Window_ItemList.prototype.initialize = function (x, y, width, height) {
Yanfly.ItemCat.Window_ItemList_initialize.call(this, x, y, width, height);
this._ext = "none";
};
Window_ItemList.prototype.setExt = function(ext) {
if (this._ext !== ext) {
this._ext = ext;
this.refresh();
this.resetScroll();
}
};
Window_ItemList.prototype.setExt = function (ext) {
if (this._ext !== ext) {
this._ext = ext;
this.refresh();
this.resetScroll();
}
};
Window_ItemList.prototype.includes = function(item) {
switch (this._category) {
case 'AllItems':
return DataManager.isItem(item);
break;
case 'item':
return DataManager.isItem(item) && item.itypeId === 1;
break;
case 'RegularItems':
return DataManager.isItem(item) && item.itypeId === 1;
break;
case 'keyItem':
return DataManager.isItem(item) && item.itypeId === 2;
break;
case 'HiddenItemA':
return DataManager.isItem(item) && item.itypeId === 3;
break;
case 'HiddenItemB':
return DataManager.isItem(item) && item.itypeId === 4;
break;
case 'Consumable':
return DataManager.isItem(item) && item.consumable;
break;
case 'Nonconsumable':
return DataManager.isItem(item) && !item.consumable;
break;
case 'AlwaysUsable':
return DataManager.isItem(item) && [0].contains(item.occasion);
break;
case 'BattleUsable':
return DataManager.isItem(item) && [0, 1].contains(item.occasion);
break;
case 'FieldUsable':
return DataManager.isItem(item) && [0, 2].contains(item.occasion);
break;
case 'NeverUsable':
return DataManager.isItem(item) && [3].contains(item.occasion);
break;
case 'weapon':
return DataManager.isWeapon(item);
break;
case 'WType':
return DataManager.isWeapon(item) && item.wtypeId === this._ext;
break;
case 'armor':
return DataManager.isArmor(item);
break;
case 'AType':
return DataManager.isArmor(item) && item.atypeId === this._ext;
break;
case 'EType':
return item && item.etypeId === this._ext;
break;
case 'Category':
return item && item.itemCategory.contains(this._ext);
break;
default:
return false;
}
};
Window_ItemList.prototype.includes = function (item) {
switch (this._category) {
case "AllItems":
return DataManager.isItem(item);
break;
case "item":
return DataManager.isItem(item) && item.itypeId === 1;
break;
case "RegularItems":
return DataManager.isItem(item) && item.itypeId === 1;
break;
case "keyItem":
return DataManager.isItem(item) && item.itypeId === 2;
break;
case "HiddenItemA":
return DataManager.isItem(item) && item.itypeId === 3;
break;
case "HiddenItemB":
return DataManager.isItem(item) && item.itypeId === 4;
break;
case "Consumable":
return DataManager.isItem(item) && item.consumable;
break;
case "Nonconsumable":
return DataManager.isItem(item) && !item.consumable;
break;
case "AlwaysUsable":
return DataManager.isItem(item) && [0].contains(item.occasion);
break;
case "BattleUsable":
return DataManager.isItem(item) && [0, 1].contains(item.occasion);
break;
case "FieldUsable":
return DataManager.isItem(item) && [0, 2].contains(item.occasion);
break;
case "NeverUsable":
return DataManager.isItem(item) && [3].contains(item.occasion);
break;
case "weapon":
return DataManager.isWeapon(item);
break;
case "WType":
return DataManager.isWeapon(item) && item.wtypeId === this._ext;
break;
case "armor":
return DataManager.isArmor(item);
break;
case "AType":
return DataManager.isArmor(item) && item.atypeId === this._ext;
break;
case "EType":
return item && item.etypeId === this._ext;
break;
case "Category":
return item && item.itemCategory.contains(this._ext);
break;
default:
return false;
}
};
//=============================================================================
// End of File
//=============================================================================
//=============================================================================
// End of File
//=============================================================================
} else {
var text = '================================================================\n';
text += 'YEP_X_ItemCategories requires YEP_ItemCore and to be at the latest '
text += 'version to run properly. '
text += '\n\nPlease go to www.yanfly.moe and update to the latest version for ';
text += 'the YEP_ItemCore plugin.\n';
text += '================================================================\n';
console.log(text);
require('nw.gui').Window.get().showDevTools();
}
var text = "================================================================\n";
text += "YEP_X_ItemCategories requires YEP_ItemCore and to be at the latest ";
text += "version to run properly. ";
text += "\n\nPlease go to www.yanfly.moe and update to the latest version for ";
text += "the YEP_ItemCore plugin.\n";
text += "================================================================\n";
console.log(text);
require("nw.gui").Window.get().showDevTools();
}

@ -11,7 +11,7 @@ Yanfly.ItemReq = Yanfly.ItemReq || {};
Yanfly.ItemReq.version = 1.01;
//=============================================================================
/*:
/*:
* @plugindesc v1.01 物品使用限制
* @author Yanfly Engine Plugins
*
@ -19,24 +19,24 @@ Yanfly.ItemReq.version = 1.01;
* ============================================================================
* 导言
* ============================================================================
*
*
* 这个插件需要YEP\u ItemCore确保此插件位于
* 是的插件列表中有ItemCore
*
*
* 在RPG Maker MV中默认情况下物品只有一些限制
* 不管他们是否能在战场上使用或者永远不会使用没有
* 您可以设置的任何其他条件这些条件将决定
* 项目可以使用也不能使用这个插件提供了更多的方法来限制项目
* 使用基于开关变量使用它们的参与者状态
* 要求等等
*
*
* ============================================================================
* 便签
* ============================================================================
*
*
* 使用以下NoteTag强制项目的要求然后才可以
* 被使用
*
*
* 项目注释标签
*
* <Enable Requirements>
@ -286,384 +286,380 @@ Yanfly.ItemReq.version = 1.01;
//=============================================================================
if (Imported.YEP_ItemCore) {
//=============================================================================
// DataManager
//=============================================================================
Yanfly.ItemReq.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Yanfly.ItemReq.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_X_ItemRequirements) {
this.processItemRequirementsNotetags1($dataItems);
Yanfly._loaded_YEP_X_ItemRequirements = true;
}
return true;
};
DataManager.processItemRequirementsNotetags1 = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.itemRequirements = [];
var evalMode = 'none';
obj.customItemRequirements = '';
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<ENABLE (?:REQUIREMENT|REQUIREMENTS)>/i)) {
evalMode = 'enable requirements';
} else if (line.match(/<\/ENABLE (?:REQUIREMENT|REQUIREMENTS)>/i)) {
evalMode = 'none';
} else if (evalMode === 'enable requirements') {
obj.itemRequirements.push(line);
} else if (line.match(/<CUSTOM ENABLE (?:REQUIREMENT|REQUIREMENTS)>/i)) {
evalMode = 'custom enable requirements';
} else if (line.match(/<\/CUSTOM ENABLE (?:REQUIREMENT|REQUIREMENTS)>/i)) {
evalMode = 'none';
} else if (evalMode === 'custom enable requirements') {
obj.customItemRequirements += line + '\n';
}
}
}
};
//=============================================================================
// Game_BattlerBase
//=============================================================================
Yanfly.ItemReq.Game_BattlerBase_mIC =
Game_BattlerBase.prototype.meetsItemConditions;
Game_BattlerBase.prototype.meetsItemConditions = function(item) {
if (!Yanfly.ItemReq.Game_BattlerBase_mIC.call(this, item)) {
return false;
}
return ItemManager.meetsUsableItemRequirements(item, this);
};
//=============================================================================
// Game_Actor
//=============================================================================
Game_Actor.prototype.isAtypeEquipped = function(atypeId) {
return this.armors().some(function(armor) {
return armor.atypeId === atypeId;
});
};
//=============================================================================
// ItemManager
//=============================================================================
ItemManager.meetsUsableItemRequirements = function(item, battler) {
if (!item) return false;
if (!item.itemRequirements) {
var baseItem = DataManager.getBaseItem(item);
item.itemRequirements = JsonEx.makeDeepCopy(baseItem.itemRequirements);
}
var length = item.itemRequirements.length;
if ($gameParty.inBattle()) var battler = this.battleSubject() || battler;
for (var i = 0; i < length; ++i) {
var line = item.itemRequirements[i];
if (!line) continue;
if (!this.checkUsableItemRequirement(line, item, battler)) return false;
}
if (item.customItemRequirements && item.customItemRequirements.length >= 1) {
if (!this.checkCustomUsableItemRequirement(item, battler)) return false;
}
return true;
};
ItemManager.battleSubject = function() {
return BattleManager.actor() || BattleManager._subject;
};
ItemManager.checkUsableItemRequirement = function(line, item, battler) {
// EVAL
if (line.match(/EVAL:(.*)/i)) {
var code = String(RegExp.$1);
return this.usableItemRequirementEval(code);
}
// NOT ACTOR
if (line.match(/NOT ACTOR:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementActor(data, battler, false);
}
// ACTOR
if (line.match(/ACTOR:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementActor(data, battler, true);
}
// NOT ARMOR TYPE
if (line.match(/NOT ARMOR TYPE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementAtype(data, battler, false);
}
// ARMOR TYPE
if (line.match(/ARMOR TYPE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementAtype(data, battler, true);
}
// NOT ARMOR
if (line.match(/NOT ARMOR:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementArmor(data, battler, false);
}
// ARMOR
if (line.match(/ARMOR:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementArmor(data, battler, true);
}
if (Imported.YEP_X_Subclass) {
// NOT SUBCLASS
if (line.match(/NOT SUBCLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementSubclass(data, battler, false);
}
// SUBCLASS
if (line.match(/SUBCLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementSubclass(data, battler, true);
}
// EITHER CLASS
if (line.match(/EITHER CLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementDuoClass(data, battler, true);
}
// NEITHER CLASS
if (line.match(/NEITHER CLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementDuoClass(data, battler, false);
}
}
// NOT CLASS
if (line.match(/NOT CLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementClass(data, battler, false);
}
// CLASS
if (line.match(/CLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementClass(data, battler, true);
}
// NOT STATE
if (line.match(/NOT STATE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementState(data, battler, false);
}
// STATE
if (line.match(/STATE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementState(data, battler, true);
}
// NOT WEAPON TYPE
if (line.match(/NOT WEAPON TYPE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementWtype(data, battler, false);
}
// WEAPON TYPE
if (line.match(/WEAPON TYPE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementWtype(data, battler, true);
}
// NOT WEAPON
if (line.match(/NOT WEAPON:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementWeapon(data, battler, false);
}
// WEAPON
if (line.match(/WEAPON:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementWeapon(data, battler, true);
}
// SWITCH OFF
if (line.match(/SWITCH OFF:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementSwitch(data, false);
}
// SWITCH ON
if (line.match(/SWITCH ON:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementSwitch(data, true);
}
// VARIABLE
if (line.match(/VARIABLE[ ](\d+)[ ](.*)/i)) {
var variableId = parseInt(RegExp.$1);
var code = String(RegExp.$2);
return this.usableItemRequirementVariable(variableId, code);
}
return true;
};
ItemManager.usableItemRequirementEval = function(code) {
var value = false;
try {
eval(code);
} catch (e) {
Yanfly.Util.displayError(e, code, 'CUSTOM ITEM USE EVAL CODE ERROR');
}
return value;
};
ItemManager.usableItemRequirementActor = function(data, battler, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var actorId = parseInt(array[i].trim());
if (battler.actorId() === actorId) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementClass = function(data, battler, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var classId = parseInt(array[i].trim());
if (battler._classId === classId) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementDuoClass = function(data, battler, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var classId = parseInt(array[i].trim());
var subclassId = parseInt(array[i].trim());
if (battler._classId === classId || battler._subclassId === subclassId) {
return condition;
}
}
return !condition;
};
ItemManager.usableItemRequirementSubclass = function(data, battler, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var subclassId = parseInt(array[i].trim());
if (battler._subclassId === subclassId) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementState = function(data, battler, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var stateId = parseInt(array[i].trim());
var state = $dataStates[stateId];
if (battler.states().contains(state)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementWtype = function(data, battler, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var id = parseInt(array[i].trim());
if (battler.isWtypeEquipped(id)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementWeapon = function(data, battler, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var id = parseInt(array[i].trim());
var equip = $dataWeapons[id];
if (battler.hasWeapon(equip)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementAtype = function(data, battler, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var id = parseInt(array[i].trim());
if (battler.isAtypeEquipped(id)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementArmor = function(data, battler, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var id = parseInt(array[i].trim());
var equip = $dataArmors[id];
if (battler.hasArmor(equip)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementSwitch = function(data, condition) {
var array = data.split(',');
var length = array.length;
for (var i = 0; i < length; ++i) {
var switchId = parseInt(array[i].trim());
if ($gameSwitches.value(switchId) !== condition) return false;
}
return true;
};
ItemManager.usableItemRequirementVariable = function(variableId, code) {
return eval('$gameVariables.value(variableId) ' + code);
};
ItemManager.checkCustomUsableItemRequirement = function(item, battler) {
var condition = false;
var user = battler;
var a = battler;
var b = battler;
var target = battler;
var subject = battler;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var code = item.customItemRequirements;
try {
eval(code);
} catch (e) {
Yanfly.Util.displayError(e, code, 'CUSTOM ITEM USE REQUIREMENT CODE ERROR');
}
return condition;
};
//=============================================================================
// Utilities
//=============================================================================
Yanfly.Util = Yanfly.Util || {};
Yanfly.Util.displayError = function(e, code, message) {
console.log(message);
console.log(code || 'NON-EXISTENT');
console.error(e);
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
if (!require('nw.gui').Window.get().isDevToolsOpen()) {
require('nw.gui').Window.get().showDevTools();
}
}
};
//=============================================================================
// End of File
//=============================================================================
//=============================================================================
// DataManager
//=============================================================================
Yanfly.ItemReq.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function () {
if (!Yanfly.ItemReq.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_X_ItemRequirements) {
this.processItemRequirementsNotetags1($dataItems);
Yanfly._loaded_YEP_X_ItemRequirements = true;
}
return true;
};
DataManager.processItemRequirementsNotetags1 = function (group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.itemRequirements = [];
var evalMode = "none";
obj.customItemRequirements = "";
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<ENABLE (?:REQUIREMENT|REQUIREMENTS)>/i)) {
evalMode = "enable requirements";
} else if (line.match(/<\/ENABLE (?:REQUIREMENT|REQUIREMENTS)>/i)) {
evalMode = "none";
} else if (evalMode === "enable requirements") {
obj.itemRequirements.push(line);
} else if (line.match(/<CUSTOM ENABLE (?:REQUIREMENT|REQUIREMENTS)>/i)) {
evalMode = "custom enable requirements";
} else if (line.match(/<\/CUSTOM ENABLE (?:REQUIREMENT|REQUIREMENTS)>/i)) {
evalMode = "none";
} else if (evalMode === "custom enable requirements") {
obj.customItemRequirements += line + "\n";
}
}
}
};
//=============================================================================
// Game_BattlerBase
//=============================================================================
Yanfly.ItemReq.Game_BattlerBase_mIC = Game_BattlerBase.prototype.meetsItemConditions;
Game_BattlerBase.prototype.meetsItemConditions = function (item) {
if (!Yanfly.ItemReq.Game_BattlerBase_mIC.call(this, item)) {
return false;
}
return ItemManager.meetsUsableItemRequirements(item, this);
};
//=============================================================================
// Game_Actor
//=============================================================================
Game_Actor.prototype.isAtypeEquipped = function (atypeId) {
return this.armors().some(function (armor) {
return armor.atypeId === atypeId;
});
};
//=============================================================================
// ItemManager
//=============================================================================
ItemManager.meetsUsableItemRequirements = function (item, battler) {
if (!item) return false;
if (!item.itemRequirements) {
var baseItem = DataManager.getBaseItem(item);
item.itemRequirements = JsonEx.makeDeepCopy(baseItem.itemRequirements);
}
var length = item.itemRequirements.length;
if ($gameParty.inBattle()) var battler = this.battleSubject() || battler;
for (var i = 0; i < length; ++i) {
var line = item.itemRequirements[i];
if (!line) continue;
if (!this.checkUsableItemRequirement(line, item, battler)) return false;
}
if (item.customItemRequirements && item.customItemRequirements.length >= 1) {
if (!this.checkCustomUsableItemRequirement(item, battler)) return false;
}
return true;
};
ItemManager.battleSubject = function () {
return BattleManager.actor() || BattleManager._subject;
};
ItemManager.checkUsableItemRequirement = function (line, item, battler) {
// EVAL
if (line.match(/EVAL:(.*)/i)) {
var code = String(RegExp.$1);
return this.usableItemRequirementEval(code);
}
// NOT ACTOR
if (line.match(/NOT ACTOR:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementActor(data, battler, false);
}
// ACTOR
if (line.match(/ACTOR:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementActor(data, battler, true);
}
// NOT ARMOR TYPE
if (line.match(/NOT ARMOR TYPE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementAtype(data, battler, false);
}
// ARMOR TYPE
if (line.match(/ARMOR TYPE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementAtype(data, battler, true);
}
// NOT ARMOR
if (line.match(/NOT ARMOR:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementArmor(data, battler, false);
}
// ARMOR
if (line.match(/ARMOR:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementArmor(data, battler, true);
}
if (Imported.YEP_X_Subclass) {
// NOT SUBCLASS
if (line.match(/NOT SUBCLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementSubclass(data, battler, false);
}
// SUBCLASS
if (line.match(/SUBCLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementSubclass(data, battler, true);
}
// EITHER CLASS
if (line.match(/EITHER CLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementDuoClass(data, battler, true);
}
// NEITHER CLASS
if (line.match(/NEITHER CLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementDuoClass(data, battler, false);
}
}
// NOT CLASS
if (line.match(/NOT CLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementClass(data, battler, false);
}
// CLASS
if (line.match(/CLASS:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementClass(data, battler, true);
}
// NOT STATE
if (line.match(/NOT STATE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementState(data, battler, false);
}
// STATE
if (line.match(/STATE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementState(data, battler, true);
}
// NOT WEAPON TYPE
if (line.match(/NOT WEAPON TYPE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementWtype(data, battler, false);
}
// WEAPON TYPE
if (line.match(/WEAPON TYPE:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementWtype(data, battler, true);
}
// NOT WEAPON
if (line.match(/NOT WEAPON:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementWeapon(data, battler, false);
}
// WEAPON
if (line.match(/WEAPON:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementWeapon(data, battler, true);
}
// SWITCH OFF
if (line.match(/SWITCH OFF:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementSwitch(data, false);
}
// SWITCH ON
if (line.match(/SWITCH ON:(.*)/i)) {
var data = String(RegExp.$1);
return this.usableItemRequirementSwitch(data, true);
}
// VARIABLE
if (line.match(/VARIABLE[ ](\d+)[ ](.*)/i)) {
var variableId = parseInt(RegExp.$1);
var code = String(RegExp.$2);
return this.usableItemRequirementVariable(variableId, code);
}
return true;
};
ItemManager.usableItemRequirementEval = function (code) {
var value = false;
try {
eval(code);
} catch (e) {
Yanfly.Util.displayError(e, code, "CUSTOM ITEM USE EVAL CODE ERROR");
}
return value;
};
ItemManager.usableItemRequirementActor = function (data, battler, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var actorId = parseInt(array[i].trim());
if (battler.actorId() === actorId) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementClass = function (data, battler, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var classId = parseInt(array[i].trim());
if (battler._classId === classId) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementDuoClass = function (data, battler, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var classId = parseInt(array[i].trim());
var subclassId = parseInt(array[i].trim());
if (battler._classId === classId || battler._subclassId === subclassId) {
return condition;
}
}
return !condition;
};
ItemManager.usableItemRequirementSubclass = function (data, battler, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var subclassId = parseInt(array[i].trim());
if (battler._subclassId === subclassId) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementState = function (data, battler, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var stateId = parseInt(array[i].trim());
var state = $dataStates[stateId];
if (battler.states().contains(state)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementWtype = function (data, battler, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var id = parseInt(array[i].trim());
if (battler.isWtypeEquipped(id)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementWeapon = function (data, battler, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var id = parseInt(array[i].trim());
var equip = $dataWeapons[id];
if (battler.hasWeapon(equip)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementAtype = function (data, battler, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var id = parseInt(array[i].trim());
if (battler.isAtypeEquipped(id)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementArmor = function (data, battler, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var id = parseInt(array[i].trim());
var equip = $dataArmors[id];
if (battler.hasArmor(equip)) return condition;
}
return !condition;
};
ItemManager.usableItemRequirementSwitch = function (data, condition) {
var array = data.split(",");
var length = array.length;
for (var i = 0; i < length; ++i) {
var switchId = parseInt(array[i].trim());
if ($gameSwitches.value(switchId) !== condition) return false;
}
return true;
};
ItemManager.usableItemRequirementVariable = function (variableId, code) {
return eval("$gameVariables.value(variableId) " + code);
};
ItemManager.checkCustomUsableItemRequirement = function (item, battler) {
var condition = false;
var user = battler;
var a = battler;
var b = battler;
var target = battler;
var subject = battler;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var code = item.customItemRequirements;
try {
eval(code);
} catch (e) {
Yanfly.Util.displayError(e, code, "CUSTOM ITEM USE REQUIREMENT CODE ERROR");
}
return condition;
};
//=============================================================================
// Utilities
//=============================================================================
Yanfly.Util = Yanfly.Util || {};
Yanfly.Util.displayError = function (e, code, message) {
console.log(message);
console.log(code || "NON-EXISTENT");
console.error(e);
if (Utils.isNwjs() && Utils.isOptionValid("test")) {
if (!require("nw.gui").Window.get().isDevToolsOpen()) {
require("nw.gui").Window.get().showDevTools();
}
}
};
//=============================================================================
// End of File
//=============================================================================
} else {
var text = '================================================================\n';
text += 'YEP_X_ItemRequirements requires YEP_ItemCore to be at the ';
text += 'latest version to run properly.\n\nPlease go to www.yanfly.moe and ';
text += 'update to the latest version for the YEP_ItemCore plugin.\n';
text += '================================================================\n';
console.log(text);
require('nw.gui').Window.get().showDevTools();
} // // Imported.YEP_ItemCore
var text = "================================================================\n";
text += "YEP_X_ItemRequirements requires YEP_ItemCore to be at the ";
text += "latest version to run properly.\n\nPlease go to www.yanfly.moe and ";
text += "update to the latest version for the YEP_ItemCore plugin.\n";
text += "================================================================\n";
console.log(text);
require("nw.gui").Window.get().showDevTools();
} // // Imported.YEP_ItemCore

File diff suppressed because it is too large Load Diff

@ -8,16 +8,16 @@ Imported.YEP_X_MoreQuests1 = true;
var Yanfly = Yanfly || {};
Yanfly.MoreQuests1 = Yanfly.MoreQuests1 || {};
Yanfly.MoreQuests1.version = 1.00;
Yanfly.MoreQuests1.version = 1.0;
//=============================================================================
/*:
/*:
* @plugindesc YEP任务扩展-任务数扩充1000
* @author Yanfly Engine Plugins 汉化硕明云书
*
* @help
* ============================================================================
* 介绍
* 介绍
* ============================================================================
*
* 此插件需要YEP_QuestJournal确保找到此插件
@ -210,7 +210,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc Modify the data used by this quest entry.
* Refer to Help for more information about each setting.
* @default
*
*
* @param Quest 120
* @parent ---Quests 101 to 200---
* @type struct<Quest>
@ -946,7 +946,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc Modify the data used by this quest entry.
* Refer to Help for more information about each setting.
* @default
*
*
* @param Quest 220
* @parent ---Quests 201 to 300---
* @type struct<Quest>
@ -1682,7 +1682,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc Modify the data used by this quest entry.
* Refer to Help for more information about each setting.
* @default
*
*
* @param Quest 320
* @parent ---Quests 301 to 400---
* @type struct<Quest>
@ -2418,7 +2418,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc Modify the data used by this quest entry.
* Refer to Help for more information about each setting.
* @default
*
*
* @param Quest 420
* @parent ---Quests 401 to 500---
* @type struct<Quest>
@ -3154,7 +3154,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc Modify the data used by this quest entry.
* Refer to Help for more information about each setting.
* @default
*
*
* @param Quest 520
* @parent ---Quests 501 to 600---
* @type struct<Quest>
@ -3890,7 +3890,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc Modify the data used by this quest entry.
* Refer to Help for more information about each setting.
* @default
*
*
* @param Quest 620
* @parent ---Quests 601 to 700---
* @type struct<Quest>
@ -4626,7 +4626,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc Modify the data used by this quest entry.
* Refer to Help for more information about each setting.
* @default
*
*
* @param Quest 720
* @parent ---Quests 701 to 800---
* @type struct<Quest>
@ -5362,7 +5362,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc Modify the data used by this quest entry.
* Refer to Help for more information about each setting.
* @default
*
*
* @param Quest 820
* @parent ---Quests 801 to 900---
* @type struct<Quest>
@ -6098,7 +6098,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc Modify the data used by this quest entry.
* Refer to Help for more information about each setting.
* @default
*
*
* @param Quest 920
* @parent ---Quests 901 to 1000---
* @type struct<Quest>
@ -6733,7 +6733,7 @@ Yanfly.MoreQuests1.version = 1.00;
* @desc The reward list for this quest.
* Text codes allowed.
* @default ["\"\\\\i[176]Potion x5\"","\"\\\\i[178]Ether x3\"","\"To make other rewards appear,\\nenable them through the \\\\c[4]'Visible\\nRewards'\\\\c[0] plugin parameter or by\\nusing a plugin command to make\\nthem appear\""]
*
*
* @param Visible Rewards
* @parent Rewards List
* @type number[]
@ -6749,57 +6749,54 @@ Yanfly.MoreQuests1.version = 1.00;
//=============================================================================
if (Imported.YEP_QuestJournal) {
//=============================================================================
// Parameter Variables
//=============================================================================
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters('YEP_X_MoreQuests1');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Parameters = PluginManager.parameters("YEP_X_MoreQuests1");
Yanfly.Param = Yanfly.Param || {};
DataManager.questDatabaseCreate = function() {
$dataQuests = $dataQuests || [null];
var index1 = [101, 201, 301, 401, 501, 601, 701, 801, 901];
var index2 = [200, 300, 400, 500, 600, 700, 800, 900, 1000];
var length = index1.length;
for (var n = 0; n < length; ++n) {
var a = index1[n];
var b = index2[n];
var str = a + ' to ' + b;
DataManager.questDatabaseCreate = function () {
$dataQuests = $dataQuests || [null];
var index1 = [101, 201, 301, 401, 501, 601, 701, 801, 901];
var index2 = [200, 300, 400, 500, 600, 700, 800, 900, 1000];
var length = index1.length;
for (var n = 0; n < length; ++n) {
var a = index1[n];
var b = index2[n];
var str = a + " to " + b;
for (var i = a; i <= b; ++i) {
var questData = JSON.parse(Yanfly.Parameters['Quest ' + i] || 'null');
if (!questData) continue;
if (questData['Type'] === '|-=AUTO=-|') {
questData['Type'] = Yanfly.Parameters['Category: ' + str];
}
if (questData['Difficulty'] === '|-=AUTO=-|') {
questData['Difficulty'] = Yanfly.Parameters['Difficulty: ' + str];
}
if (questData['From'] === '|-=AUTO=-|') {
questData['From'] = Yanfly.Parameters['From: ' + str];
}
if (questData['Location'] === '|-=AUTO=-|') {
questData['Location'] = Yanfly.Parameters['Location: ' + str];
}
this.questDatabaseAdd(i, questData);
}
}
};
for (var i = a; i <= b; ++i) {
var questData = JSON.parse(Yanfly.Parameters["Quest " + i] || "null");
if (!questData) continue;
if (questData["Type"] === "|-=AUTO=-|") {
questData["Type"] = Yanfly.Parameters["Category: " + str];
}
if (questData["Difficulty"] === "|-=AUTO=-|") {
questData["Difficulty"] = Yanfly.Parameters["Difficulty: " + str];
}
if (questData["From"] === "|-=AUTO=-|") {
questData["From"] = Yanfly.Parameters["From: " + str];
}
if (questData["Location"] === "|-=AUTO=-|") {
questData["Location"] = Yanfly.Parameters["Location: " + str];
}
this.questDatabaseAdd(i, questData);
}
}
};
DataManager.questDatabaseCreate();
DataManager.questDatabaseCreate();
//=============================================================================
// End of File
//=============================================================================
//=============================================================================
// End of File
//=============================================================================
} else {
var text = '';
text += 'You are getting this error because you are trying to run ';
text += 'YEP_X_MoreQuests1 without YEP_QuestJournal. Please visit Yanfly.moe ';
text += 'and install YEP_QuestJournal in your game project before you can use ';
text += 'this plugin.';
console.log(text);
require('nw.gui').Window.get().showDevTools();
}; // Imported.YEP_QuestJournal
var text = "";
text += "You are getting this error because you are trying to run ";
text += "YEP_X_MoreQuests1 without YEP_QuestJournal. Please visit Yanfly.moe ";
text += "and install YEP_QuestJournal in your game project before you can use ";
text += "this plugin.";
console.log(text);
require("nw.gui").Window.get().showDevTools();
} // Imported.YEP_QuestJournal

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -8,10 +8,10 @@ Imported.YEP_X_VisualATBGauge = true;
var Yanfly = Yanfly || {};
Yanfly.VATB = Yanfly.VATB || {};
Yanfly.VATB.version = 1.04
Yanfly.VATB.version = 1.04;
//=============================================================================
/*:
/*:
* @plugindesc v1.04 (Requires YEP_BattleSysATB.js) Provides a visible ATB
* gauge for your enemies!
* @author Yanfly Engine Plugins
@ -111,260 +111,254 @@ Yanfly.VATB.version = 1.04
//=============================================================================
if (Imported.YEP_BattleEngineCore && Imported.YEP_X_BattleSysATB) {
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters('YEP_X_VisualATBGauge');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.VATBShowGauge = String(Yanfly.Parameters['Show Gauges']);
Yanfly.Param.VATBMinWidth = Number(Yanfly.Parameters['Minimum Gauge Width']);
Yanfly.Param.VATBAlwaysShow = eval(String(Yanfly.Parameters['Always Show']));
Yanfly.Param.VATBGaugePOS = eval(String(Yanfly.Parameters['Gauge Position']));
Yanfly.Param.VATBYBuffer = Number(Yanfly.Parameters['Y Buffer']);
Yanfly.Param.VATBThick = eval(String(Yanfly.Parameters['Use Thick Gauges']));
//=============================================================================
// DataManager
//=============================================================================
Yanfly.VATB.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Yanfly.VATB.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_X_VisualATBGauge) {
this.processVATBNotetags1($dataEnemies);
Yanfly._loaded_YEP_X_VisualATBGauge = true;
}
return true;
};
DataManager.processVATBNotetags1 = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.showATBGauge = eval(Yanfly.Param.VATBShowGauge);
obj.atbGaugeWidth = 0;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<(?:SHOW ATB GAUGE)>/i)) {
obj.showATBGauge = true;
} else if (line.match(/<(?:HIDE ATB GAUGE)>/i)) {
obj.showATBGauge = false;
} else if (line.match(/<(?:ATB GAUGE WIDTH):[ ](\d+)>/i)) {
obj.atbGaugeWidth = parseInt(RegExp.$1);
}
}
}
};
//=============================================================================
// Game_Enemy
//=============================================================================
Game_Enemy.prototype.showATBGauge = function() {
return this.enemy().showATBGauge;
};
Game_Enemy.prototype.atbGaugeWidth = function() {
if (this.enemy().hpGaugeWidth > 0) {
var width = this.enemy().hpGaugeWidth;
} else {
var width = this.spriteWidth();
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters("YEP_X_VisualATBGauge");
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.VATBShowGauge = String(Yanfly.Parameters["Show Gauges"]);
Yanfly.Param.VATBMinWidth = Number(Yanfly.Parameters["Minimum Gauge Width"]);
Yanfly.Param.VATBAlwaysShow = eval(String(Yanfly.Parameters["Always Show"]));
Yanfly.Param.VATBGaugePOS = eval(String(Yanfly.Parameters["Gauge Position"]));
Yanfly.Param.VATBYBuffer = Number(Yanfly.Parameters["Y Buffer"]);
Yanfly.Param.VATBThick = eval(String(Yanfly.Parameters["Use Thick Gauges"]));
//=============================================================================
// DataManager
//=============================================================================
Yanfly.VATB.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function () {
if (!Yanfly.VATB.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_X_VisualATBGauge) {
this.processVATBNotetags1($dataEnemies);
Yanfly._loaded_YEP_X_VisualATBGauge = true;
}
return true;
};
DataManager.processVATBNotetags1 = function (group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.showATBGauge = eval(Yanfly.Param.VATBShowGauge);
obj.atbGaugeWidth = 0;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<(?:SHOW ATB GAUGE)>/i)) {
obj.showATBGauge = true;
} else if (line.match(/<(?:HIDE ATB GAUGE)>/i)) {
obj.showATBGauge = false;
} else if (line.match(/<(?:ATB GAUGE WIDTH):[ ](\d+)>/i)) {
obj.atbGaugeWidth = parseInt(RegExp.$1);
}
}
}
};
//=============================================================================
// Game_Enemy
//=============================================================================
Game_Enemy.prototype.showATBGauge = function () {
return this.enemy().showATBGauge;
};
Game_Enemy.prototype.atbGaugeWidth = function () {
if (this.enemy().hpGaugeWidth > 0) {
var width = this.enemy().hpGaugeWidth;
} else {
var width = this.spriteWidth();
}
width = Math.max(width, Yanfly.Param.VATBMinWidth);
return width & 1 ? width + 1 : width;
};
//=============================================================================
// Sprite_Enemy
//=============================================================================
Yanfly.VATB.Sprite_Enemy_preSpriteInitialize = Sprite_Enemy.prototype.preSpriteInitialize;
Sprite_Enemy.prototype.preSpriteInitialize = function (battler) {
Yanfly.VATB.Sprite_Enemy_preSpriteInitialize.call(this, battler);
this.createVisualATBWindow();
};
Yanfly.VATB.Sprite_Enemy_update = Sprite_Enemy.prototype.update;
Sprite_Enemy.prototype.update = function () {
Yanfly.VATB.Sprite_Enemy_update.call(this);
this.addVisualATBWindow();
};
Sprite_Enemy.prototype.addVisualATBWindow = function () {
if (!BattleManager.isATB()) return;
if (this._addedVisualATB) return;
this._addedVisualATB = true;
this.parent.parent.addChild(this._visualATBWindow);
};
Sprite_Enemy.prototype.createVisualATBWindow = function () {
if (!BattleManager.isATB()) return;
this._visualATBWindow = new Window_EnemyVisualATB();
};
Yanfly.VATB.Sprite_Enemy_setBattler = Sprite_Enemy.prototype.setBattler;
Sprite_Enemy.prototype.setBattler = function (battler) {
Yanfly.VATB.Sprite_Enemy_setBattler.call(this, battler);
if (this._visualATBWindow) this._visualATBWindow.setBattler(battler);
};
//=============================================================================
// Window_EnemyVisualATB
//=============================================================================
function Window_EnemyVisualATB() {
this.initialize.apply(this, arguments);
}
width = Math.max(width, Yanfly.Param.VATBMinWidth);
return (width & 1) ? width + 1 : width;
};
//=============================================================================
// Sprite_Enemy
//=============================================================================
Yanfly.VATB.Sprite_Enemy_preSpriteInitialize =
Sprite_Enemy.prototype.preSpriteInitialize;
Sprite_Enemy.prototype.preSpriteInitialize = function(battler) {
Yanfly.VATB.Sprite_Enemy_preSpriteInitialize.call(this, battler);
this.createVisualATBWindow();
};
Yanfly.VATB.Sprite_Enemy_update = Sprite_Enemy.prototype.update;
Sprite_Enemy.prototype.update = function() {
Yanfly.VATB.Sprite_Enemy_update.call(this);
this.addVisualATBWindow();
};
Sprite_Enemy.prototype.addVisualATBWindow = function() {
if (!BattleManager.isATB()) return;
if (this._addedVisualATB) return;
this._addedVisualATB = true;
this.parent.parent.addChild(this._visualATBWindow);
};
Sprite_Enemy.prototype.createVisualATBWindow = function() {
if (!BattleManager.isATB()) return;
this._visualATBWindow = new Window_EnemyVisualATB();
};
Yanfly.VATB.Sprite_Enemy_setBattler = Sprite_Enemy.prototype.setBattler;
Sprite_Enemy.prototype.setBattler = function(battler) {
Yanfly.VATB.Sprite_Enemy_setBattler.call(this, battler);
if (this._visualATBWindow) this._visualATBWindow.setBattler(battler);
};
//=============================================================================
// Window_EnemyVisualATB
//=============================================================================
function Window_EnemyVisualATB() {
this.initialize.apply(this, arguments);
Window_EnemyVisualATB.prototype = Object.create(Window_Base.prototype);
Window_EnemyVisualATB.prototype.constructor = Window_EnemyVisualATB;
Window_EnemyVisualATB.prototype.initialize = function () {
Window_Base.prototype.initialize.call(this, 0, 0, 1, 1);
this._battler = null;
this._requestRefresh = false;
this._currentATBSpeed = 0;
this._currentATBCharge = 0;
this.contentsOpacity = 0;
this.opacity = 0;
};
Window_EnemyVisualATB.prototype.setBattler = function (battler) {
if (this._battler === battler) return;
this._battler = battler;
};
Window_EnemyVisualATB.prototype.update = function () {
Window_Base.prototype.update.call(this);
if (!this._battler) return;
this.updateWindowAspects();
};
Window_EnemyVisualATB.prototype.updateWindowAspects = function () {
this.updateWindowSize();
this.updateWindowPosition();
this.updateOpacity();
this.updateATBPosition();
this.updateRefresh();
};
Window_EnemyVisualATB.prototype.updateWindowSize = function () {
var spriteWidth = this._battler.atbGaugeWidth();
var width = spriteWidth + this.standardPadding() * 2;
width = Math.min(width, Graphics.boxWidth + this.standardPadding() * 2);
var height = this.lineHeight() + this.standardPadding() * 2;
if (width === this.width && height === this.height) return;
this.width = width;
this.height = height;
this.createContents();
this._requestRefresh = true;
this.makeWindowBoundaries();
};
Window_EnemyVisualATB.prototype.makeWindowBoundaries = function () {
if (!this._requestRefresh) return;
this._minX = -1 * this.standardPadding();
this._maxX = Graphics.boxWidth - this.width + this.standardPadding();
this._minY = -1 * this.standardPadding();
this._maxY = Graphics.boxHeight - this.height + this.standardPadding();
this._maxY -= SceneManager._scene._statusWindow.height;
};
Window_EnemyVisualATB.prototype.updateWindowPosition = function () {
if (!this._battler) return;
var battler = this._battler;
this.x = battler.spritePosX();
this.x -= Math.ceil(this.width / 2);
this.x = this.x.clamp(this._minX, this._maxX);
this.y = battler.spritePosY();
if (Yanfly.Param.VATBGaugePOS) {
this.y -= battler.spriteHeight();
} else {
this.y -= this.standardPadding();
}
this.y = this.y.clamp(this._minY, this._maxY);
this.y += Yanfly.Param.VATBYBuffer;
};
Window_EnemyVisualATB.prototype.updateOpacity = function () {
if (this.isShowWindow()) {
this.contentsOpacity += 32;
} else {
this.contentsOpacity -= 32;
}
this.contentsOpacity = this.contentsOpacity.clamp(0, this.maxOpacity());
};
Window_EnemyVisualATB.prototype.maxOpacity = function () {
return this._battler.battler().opacity;
};
Window_EnemyVisualATB.prototype.isShowWindow = function () {
if (!this._battler.isAppeared()) return false;
if (!this._battler.showATBGauge()) return false;
if (this._battler.isDead()) return false;
if (Yanfly.Param.VATBAlwaysShow) return true;
return ["atb", "input"].contains(BattleManager._phase);
};
Window_EnemyVisualATB.prototype.updateATBPosition = function () {
if (!this._battler) return;
if (this._currentATBSpeed !== this._battler.atbSpeed()) {
this._currentATBSpeed = this._battler.atbSpeed();
this._requestRefresh = true;
}
if (this._currentATBSpeed !== this._battler.atbCharge()) {
this._currentATBSpeed = this._battler.atbCharge();
this._currentATBCharge = true;
}
};
Window_EnemyVisualATB.prototype.updateRefresh = function () {
if (this._requestRefresh) this.refresh();
};
Window_EnemyVisualATB.prototype.refresh = function () {
this.contents.clear();
if (!this._battler) return;
this._requestRefresh = false;
var wy = this.contents.height - this.lineHeight();
var ww = this.contents.width;
this.drawActorAtbGauge(this._battler, 0, wy, ww);
};
if (Imported.YEP_CoreEngine && Yanfly.Param.VATBThick) {
Window_EnemyVisualATB.prototype.drawGauge = function (dx, dy, dw, rate, color1, color2) {
var color3 = this.gaugeBackColor();
var fillW = Math.floor(dw * rate).clamp(0, dw);
var gaugeH = this.gaugeHeight();
var gaugeY = dy + this.lineHeight() - gaugeH - 2;
if (eval(Yanfly.Param.GaugeOutline)) {
color3.paintOpacity = this.translucentOpacity();
this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
dx += 2;
gaugeY += 2;
fillW = Math.max(0, fillW - 4);
gaugeH -= 4;
} else {
var fillW = Math.floor(dw * rate);
var gaugeY = dy + this.lineHeight() - gaugeH - 2;
this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
}
this.contents.gradientFillRect(dx, gaugeY, fillW, gaugeH, color1, color2);
};
} // Imported.YEP_CoreEngine
//=============================================================================
// End of File
//=============================================================================
}
Window_EnemyVisualATB.prototype = Object.create(Window_Base.prototype);
Window_EnemyVisualATB.prototype.constructor = Window_EnemyVisualATB;
Window_EnemyVisualATB.prototype.initialize = function() {
Window_Base.prototype.initialize.call(this, 0, 0, 1, 1);
this._battler = null;
this._requestRefresh = false;
this._currentATBSpeed = 0;
this._currentATBCharge = 0;
this.contentsOpacity = 0;
this.opacity = 0;
};
Window_EnemyVisualATB.prototype.setBattler = function(battler) {
if (this._battler === battler) return;
this._battler = battler;
};
Window_EnemyVisualATB.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (!this._battler) return;
this.updateWindowAspects();
};
Window_EnemyVisualATB.prototype.updateWindowAspects = function() {
this.updateWindowSize();
this.updateWindowPosition();
this.updateOpacity();
this.updateATBPosition();
this.updateRefresh();
};
Window_EnemyVisualATB.prototype.updateWindowSize = function() {
var spriteWidth = this._battler.atbGaugeWidth();
var width = spriteWidth + this.standardPadding() * 2;
width = Math.min(width, Graphics.boxWidth + this.standardPadding() * 2);
var height = this.lineHeight() + this.standardPadding() * 2;
if (width === this.width && height === this.height) return;
this.width = width;
this.height = height;
this.createContents();
this._requestRefresh = true;
this.makeWindowBoundaries();
};
Window_EnemyVisualATB.prototype.makeWindowBoundaries = function() {
if (!this._requestRefresh) return;
this._minX = -1 * this.standardPadding();
this._maxX = Graphics.boxWidth - this.width + this.standardPadding();
this._minY = -1 * this.standardPadding();
this._maxY = Graphics.boxHeight - this.height + this.standardPadding();
this._maxY -= SceneManager._scene._statusWindow.height;
};
Window_EnemyVisualATB.prototype.updateWindowPosition = function() {
if (!this._battler) return;
var battler = this._battler;
this.x = battler.spritePosX();
this.x -= Math.ceil(this.width / 2);
this.x = this.x.clamp(this._minX, this._maxX);
this.y = battler.spritePosY();
if (Yanfly.Param.VATBGaugePOS) {
this.y -= battler.spriteHeight();
} else {
this.y -= this.standardPadding();
}
this.y = this.y.clamp(this._minY, this._maxY);
this.y += Yanfly.Param.VATBYBuffer;
};
Window_EnemyVisualATB.prototype.updateOpacity = function() {
if (this.isShowWindow()) {
this.contentsOpacity += 32;
} else {
this.contentsOpacity -= 32;
}
this.contentsOpacity = this.contentsOpacity.clamp(0, this.maxOpacity());
};
Window_EnemyVisualATB.prototype.maxOpacity = function() {
return this._battler.battler().opacity;
};
Window_EnemyVisualATB.prototype.isShowWindow = function() {
if (!this._battler.isAppeared()) return false;
if (!this._battler.showATBGauge()) return false;
if (this._battler.isDead()) return false;
if (Yanfly.Param.VATBAlwaysShow) return true;
return ['atb', 'input'].contains(BattleManager._phase);
};
Window_EnemyVisualATB.prototype.updateATBPosition = function() {
if (!this._battler) return;
if (this._currentATBSpeed !== this._battler.atbSpeed()) {
this._currentATBSpeed = this._battler.atbSpeed()
this._requestRefresh = true;
}
if (this._currentATBSpeed !== this._battler.atbCharge()) {
this._currentATBSpeed = this._battler.atbCharge()
this._currentATBCharge = true;
}
};
Window_EnemyVisualATB.prototype.updateRefresh = function() {
if (this._requestRefresh) this.refresh();
};
Window_EnemyVisualATB.prototype.refresh = function() {
this.contents.clear();
if (!this._battler) return;
this._requestRefresh = false;
var wy = this.contents.height - this.lineHeight();
var ww = this.contents.width;
this.drawActorAtbGauge(this._battler, 0, wy, ww);
};
if (Imported.YEP_CoreEngine && Yanfly.Param.VATBThick) {
Window_EnemyVisualATB.prototype.drawGauge =
function(dx, dy, dw, rate, color1, color2) {
var color3 = this.gaugeBackColor();
var fillW = Math.floor(dw * rate).clamp(0, dw);
var gaugeH = this.gaugeHeight();
var gaugeY = dy + this.lineHeight() - gaugeH - 2;
if (eval(Yanfly.Param.GaugeOutline)) {
color3.paintOpacity = this.translucentOpacity();
this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
dx += 2;
gaugeY += 2;
fillW = Math.max(0, fillW - 4);
gaugeH -= 4;
} else {
var fillW = Math.floor(dw * rate);
var gaugeY = dy + this.lineHeight() - gaugeH - 2;
this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3);
}
this.contents.gradientFillRect(dx, gaugeY, fillW, gaugeH, color1, color2);
};
} // Imported.YEP_CoreEngine
//=============================================================================
// End of File
//=============================================================================
};

File diff suppressed because it is too large Load Diff

@ -8,10 +8,10 @@ Imported.YEP_Z_SkillRewards = true;
var Yanfly = Yanfly || {};
Yanfly.LunSkRew = Yanfly.LunSkRew || {};
Yanfly.LunSkRew.version = 1.00;
Yanfly.LunSkRew.version = 1.0;
//=============================================================================
/*:
/*:
* @plugindesc v1.00 行动后奖励效果
* @author Yanfly Engine Plugins
*
@ -434,511 +434,484 @@ Yanfly.LunSkRew.version = 1.00;
*/
//=============================================================================
Yanfly.PluginRequirements = function() {
return Imported.YEP_BattleEngineCore &&
Imported.YEP_SkillCore;
Yanfly.PluginRequirements = function () {
return Imported.YEP_BattleEngineCore && Imported.YEP_SkillCore;
};
if (Yanfly.PluginRequirements()) {
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters('YEP_Z_SkillRewards');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.LunSkRewEffect = JSON.parse(Yanfly.Parameters['Effect Code']);
Yanfly.Param.LunSkRewWeakness = Number(Yanfly.Parameters['Weakness Rate']);
Yanfly.Param.LunSkRewResisted = Number(Yanfly.Parameters['Resisted Rate']);
Yanfly.Param.LunSkRewAniHp =
Number(Yanfly.Parameters['HP Animation']);
Yanfly.Param.LunSkRewAniMp =
Number(Yanfly.Parameters['MP Animation']);
Yanfly.Param.LunSkRewAniTp =
Number(Yanfly.Parameters['TP Animation']);
Yanfly.Param.LunSkRewAniItem =
Number(Yanfly.Parameters['Item Animation']);
Yanfly.Param.LunSkRewAniBuff =
Number(Yanfly.Parameters['Buff Animation']);
Yanfly.Param.LunSkRewAniDebuff =
Number(Yanfly.Parameters['Debuff Animation']);
Yanfly.Param.LunSkRewAniAddState =
Number(Yanfly.Parameters['Add State Animation']);
Yanfly.Param.LunSkRewAniRemoveState =
Number(Yanfly.Parameters['Remove State Animation']);
Yanfly.Param.LunSkRewAniMisc =
Number(Yanfly.Parameters['Misc Animation']);
//=============================================================================
// DataManager
//=============================================================================
Yanfly.LunSkRew.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Yanfly.LunSkRew.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_Z_SkillRewards) {
this.processLunSkRewNotetags1($dataSkills);
this.processLunSkRewNotetags1($dataItems);
Yanfly._loaded_YEP_Z_SkillRewards = true;
}
return true;
};
DataManager.processLunSkRewNotetags1 = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.rewardAnimation = 0;
obj.criticalRewards = [];
obj.noncriticalRewards = [];
obj.defeatRewards = [];
obj.hitRewards = [];
obj.missedRewards = [];
obj.weaknessRewards = [];
obj.resistRewards = [];
obj.nulledRewards = [];
obj.absorbRewards = [];
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<REWARD[ ](?:ANI|ANIMATION):[ ](\d+)>/i)) {
obj.rewardAnimation = parseInt(RegExp.$1);
} else if (line.match(/<(.*)[ ](?:REWARD|REWARDS):[ ](.*)>/i)) {
var condition = String(RegExp.$1);
var data = String(RegExp.$2);
if (condition.match(/DEFEAT/i)) {
obj.defeatRewards.push(data);
} else if (condition.match(/NONCRITICAL/i)) {
obj.noncriticalRewards.push(data);
} else if (condition.match(/CRITICAL/i)) {
obj.criticalRewards.push(data);
} else if (condition.match(/HIT/i)) {
obj.hitRewards.push(data);
} else if (condition.match(/(?:MISSED|EVADE)/i)) {
obj.missedRewards.push(data);
} else if (condition.match(/WEAKNESS/i)) {
obj.weaknessRewards.push(data);
} else if (condition.match(/RESIST/i)) {
obj.resistRewards.push(data);
} else if (condition.match(/NULLED/i)) {
obj.nulledRewards.push(data);
} else if (condition.match(/ABSORB/i)) {
obj.absorbRewards.push(data);
//=============================================================================
// Parameter Variables
//=============================================================================
Yanfly.Parameters = PluginManager.parameters("YEP_Z_SkillRewards");
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.LunSkRewEffect = JSON.parse(Yanfly.Parameters["Effect Code"]);
Yanfly.Param.LunSkRewWeakness = Number(Yanfly.Parameters["Weakness Rate"]);
Yanfly.Param.LunSkRewResisted = Number(Yanfly.Parameters["Resisted Rate"]);
Yanfly.Param.LunSkRewAniHp = Number(Yanfly.Parameters["HP Animation"]);
Yanfly.Param.LunSkRewAniMp = Number(Yanfly.Parameters["MP Animation"]);
Yanfly.Param.LunSkRewAniTp = Number(Yanfly.Parameters["TP Animation"]);
Yanfly.Param.LunSkRewAniItem = Number(Yanfly.Parameters["Item Animation"]);
Yanfly.Param.LunSkRewAniBuff = Number(Yanfly.Parameters["Buff Animation"]);
Yanfly.Param.LunSkRewAniDebuff = Number(Yanfly.Parameters["Debuff Animation"]);
Yanfly.Param.LunSkRewAniAddState = Number(Yanfly.Parameters["Add State Animation"]);
Yanfly.Param.LunSkRewAniRemoveState = Number(Yanfly.Parameters["Remove State Animation"]);
Yanfly.Param.LunSkRewAniMisc = Number(Yanfly.Parameters["Misc Animation"]);
//=============================================================================
// DataManager
//=============================================================================
Yanfly.LunSkRew.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function () {
if (!Yanfly.LunSkRew.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Yanfly._loaded_YEP_Z_SkillRewards) {
this.processLunSkRewNotetags1($dataSkills);
this.processLunSkRewNotetags1($dataItems);
Yanfly._loaded_YEP_Z_SkillRewards = true;
}
}
}
}
};
DataManager.getParamId = function(str) {
switch (str.toUpperCase()) {
case 'HP':
case 'MAXHP':
case 'MAX HP':
return 0;
break;
case 'MP':
case 'MAXMP':
case 'MAX MP':
case 'SP':
case 'MAXSP':
case 'MAX SP':
return 1;
break;
case 'ATK':
case 'STR':
return 2;
break;
case 'DEF':
return 3;
break;
case 'MAT':
case 'INT':
case 'SPI':
return 4;
break;
case 'MDF':
case 'RES':
return 5;
break;
case 'AGI':
case 'SPD':
return 6;
break;
case 'LUK':
return 7;
break;
default:
return -1;
break;
}
};
//=============================================================================
// Game_Action
//=============================================================================
Yanfly.LunSkRew.Game_Action_apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function(target) {
var alive = target.hp > 0;
Yanfly.LunSkRew.Game_Action_apply.call(this, target);
var result = target.result();
if (alive) {
if (target.hp <= 0 || target.isDead()) {
this.processLunaticSkillReward(target, 'defeat');
}
}
if (result.isHit()) {
this.processLunaticSkillReward(target, 'hit');
if (result.critical) {
this.processLunaticSkillReward(target, 'critical');
} else {
this.processLunaticSkillReward(target, 'noncritical');
}
var rate = this.calcElementRate(target);
if (rate >= Yanfly.Param.LunSkRewWeakness) {
this.processLunaticSkillReward(target, 'weakness');
} else if (rate < 0) {
this.processLunaticSkillReward(target, 'absorb');
} else if (rate === 0) {
this.processLunaticSkillReward(target, 'nulled');
} else if (rate <= Yanfly.Param.LunSkRewResisted) {
this.processLunaticSkillReward(target, 'resist');
}
} else {
this.processLunaticSkillReward(target, 'missed');
}
};
Yanfly.LunSkRew.Game_Action_itemCri = Game_Action.prototype.itemCri;
Game_Action.prototype.itemCri = function(target) {
var cri = Yanfly.LunSkRew.Game_Action_itemCri.call(this, target);
var user = this.subject();
if (this.isSkill() && user && user._rollingCritical) {
user._rollingCritical[skill.id] = user._rollingCritical[skill.id] || 0;
cri += user._rollingCritical[skill.id];
}
return cri;
};
Game_Action.prototype.processLunaticSkillReward = function(target, type) {
switch (type) {
case 'defeat':
var dataInfo = this.item().defeatRewards;
break;
case 'noncritical':
var dataInfo = this.item().noncriticalRewards;
break;
case 'critical':
var dataInfo = this.item().criticalRewards;
break;
case 'hit':
var dataInfo = this.item().hitRewards;
break;
case 'missed':
var dataInfo = this.item().missedRewards;
break;
case 'weakness':
var dataInfo = this.item().weaknessRewards;
break;
case 'resist':
var dataInfo = this.item().resistRewards;
break;
case 'nulled':
var dataInfo = this.item().nulledRewards;
break;
case 'absorb':
var dataInfo = this.item().absorbRewards;
break;
default:
return;
}
var length = dataInfo.length;
for (var i = 0; i < length; ++i) {
var data = dataInfo[i];
this.lunaticSkillRewardEval(target, type, data);
}
};
Game_Action.prototype.lunaticSkillRewardEval = function(target, type, data) {
var item = this.item();
var skill = this.item();
var isSkill = DataManager.isSkill(skill);
var isItem = DataManager.isSkill(item);
var user = this.subject();
var a = user;
var subject = user;
var b = target;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var userPreviousResult = JsonEx.makeDeepCopy(user._result);
var targetPreviousResult = JsonEx.makeDeepCopy(target._result);
var skip = false;
var value = 0;
var rate = 1;
var hpAnimation = Yanfly.Param.LunSkRewAniHp;
var mpAnimation = Yanfly.Param.LunSkRewAniMp;
var tpAnimation = Yanfly.Param.LunSkRewAniTp;
var itemAnimation = Yanfly.Param.LunSkRewAniItem;
var buffAnimation = Yanfly.Param.LunSkRewAniBuff;
var debuffAnimation = Yanfly.Param.LunSkRewAniDebuff;
var addStateAnimation = Yanfly.Param.LunSkRewAniAddState;
var removeStateAnimation = Yanfly.Param.LunSkRewAniRemoveState;
var miscAnimation = Yanfly.Param.LunSkRewAniMisc;
var animation = this.item().rewardAnimation || 0;
var code = Yanfly.Param.LunSkRewEffect;
try {
eval(code)
} catch (e) {
Yanfly.Util.displayError(e, code, 'LUNATIC SKILL REWARDS ERROR');
}
if (!skip) {
user.startDamagePopup();
if (animation > 0) {
user.startAnimation(animation);
}
}
if (user.isDead()) user.performCollapse();
if (target.isDead()) target.performCollapse();
user._result = userPreviousResult;
target._result = targetPreviousResult;
};
//=============================================================================
// Utilities
//=============================================================================
Yanfly.Util = Yanfly.Util || {};
Yanfly.Util.displayError = function(e, code, message) {
console.log(message);
console.log(code || 'NON-EXISTENT');
console.error(e);
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
if (!require('nw.gui').Window.get().isDevToolsOpen()) {
require('nw.gui').Window.get().showDevTools();
}
}
};
//=============================================================================
// Default Effect Code
//=============================================================================
return true;
};
DataManager.processLunSkRewNotetags1 = function (group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.rewardAnimation = 0;
obj.criticalRewards = [];
obj.noncriticalRewards = [];
obj.defeatRewards = [];
obj.hitRewards = [];
obj.missedRewards = [];
obj.weaknessRewards = [];
obj.resistRewards = [];
obj.nulledRewards = [];
obj.absorbRewards = [];
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<REWARD[ ](?:ANI|ANIMATION):[ ](\d+)>/i)) {
obj.rewardAnimation = parseInt(RegExp.$1);
} else if (line.match(/<(.*)[ ](?:REWARD|REWARDS):[ ](.*)>/i)) {
var condition = String(RegExp.$1);
var data = String(RegExp.$2);
if (condition.match(/DEFEAT/i)) {
obj.defeatRewards.push(data);
} else if (condition.match(/NONCRITICAL/i)) {
obj.noncriticalRewards.push(data);
} else if (condition.match(/CRITICAL/i)) {
obj.criticalRewards.push(data);
} else if (condition.match(/HIT/i)) {
obj.hitRewards.push(data);
} else if (condition.match(/(?:MISSED|EVADE)/i)) {
obj.missedRewards.push(data);
} else if (condition.match(/WEAKNESS/i)) {
obj.weaknessRewards.push(data);
} else if (condition.match(/RESIST/i)) {
obj.resistRewards.push(data);
} else if (condition.match(/NULLED/i)) {
obj.nulledRewards.push(data);
} else if (condition.match(/ABSORB/i)) {
obj.absorbRewards.push(data);
}
}
}
}
};
DataManager.getParamId = function (str) {
switch (str.toUpperCase()) {
case "HP":
case "MAXHP":
case "MAX HP":
return 0;
break;
case "MP":
case "MAXMP":
case "MAX MP":
case "SP":
case "MAXSP":
case "MAX SP":
return 1;
break;
case "ATK":
case "STR":
return 2;
break;
case "DEF":
return 3;
break;
case "MAT":
case "INT":
case "SPI":
return 4;
break;
case "MDF":
case "RES":
return 5;
break;
case "AGI":
case "SPD":
return 6;
break;
case "LUK":
return 7;
break;
default:
return -1;
break;
}
};
//=============================================================================
// Game_Action
//=============================================================================
Yanfly.LunSkRew.Game_Action_apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function (target) {
var alive = target.hp > 0;
Yanfly.LunSkRew.Game_Action_apply.call(this, target);
var result = target.result();
if (alive) {
if (target.hp <= 0 || target.isDead()) {
this.processLunaticSkillReward(target, "defeat");
}
}
if (result.isHit()) {
this.processLunaticSkillReward(target, "hit");
if (result.critical) {
this.processLunaticSkillReward(target, "critical");
} else {
this.processLunaticSkillReward(target, "noncritical");
}
var rate = this.calcElementRate(target);
if (rate >= Yanfly.Param.LunSkRewWeakness) {
this.processLunaticSkillReward(target, "weakness");
} else if (rate < 0) {
this.processLunaticSkillReward(target, "absorb");
} else if (rate === 0) {
this.processLunaticSkillReward(target, "nulled");
} else if (rate <= Yanfly.Param.LunSkRewResisted) {
this.processLunaticSkillReward(target, "resist");
}
} else {
this.processLunaticSkillReward(target, "missed");
}
};
Yanfly.LunSkRew.Game_Action_itemCri = Game_Action.prototype.itemCri;
Game_Action.prototype.itemCri = function (target) {
var cri = Yanfly.LunSkRew.Game_Action_itemCri.call(this, target);
var user = this.subject();
if (this.isSkill() && user && user._rollingCritical) {
user._rollingCritical[skill.id] = user._rollingCritical[skill.id] || 0;
cri += user._rollingCritical[skill.id];
}
return cri;
};
Game_Action.prototype.processLunaticSkillReward = function (target, type) {
switch (type) {
case "defeat":
var dataInfo = this.item().defeatRewards;
break;
case "noncritical":
var dataInfo = this.item().noncriticalRewards;
break;
case "critical":
var dataInfo = this.item().criticalRewards;
break;
case "hit":
var dataInfo = this.item().hitRewards;
break;
case "missed":
var dataInfo = this.item().missedRewards;
break;
case "weakness":
var dataInfo = this.item().weaknessRewards;
break;
case "resist":
var dataInfo = this.item().resistRewards;
break;
case "nulled":
var dataInfo = this.item().nulledRewards;
break;
case "absorb":
var dataInfo = this.item().absorbRewards;
break;
default:
return;
}
var length = dataInfo.length;
for (var i = 0; i < length; ++i) {
var data = dataInfo[i];
this.lunaticSkillRewardEval(target, type, data);
}
};
Game_Action.prototype.lunaticSkillRewardEval = function (target, type, data) {
var item = this.item();
var skill = this.item();
var isSkill = DataManager.isSkill(skill);
var isItem = DataManager.isSkill(item);
var user = this.subject();
var a = user;
var subject = user;
var b = target;
var s = $gameSwitches._data;
var v = $gameVariables._data;
var userPreviousResult = JsonEx.makeDeepCopy(user._result);
var targetPreviousResult = JsonEx.makeDeepCopy(target._result);
var skip = false;
var value = 0;
var rate = 1;
var hpAnimation = Yanfly.Param.LunSkRewAniHp;
var mpAnimation = Yanfly.Param.LunSkRewAniMp;
var tpAnimation = Yanfly.Param.LunSkRewAniTp;
var itemAnimation = Yanfly.Param.LunSkRewAniItem;
var buffAnimation = Yanfly.Param.LunSkRewAniBuff;
var debuffAnimation = Yanfly.Param.LunSkRewAniDebuff;
var addStateAnimation = Yanfly.Param.LunSkRewAniAddState;
var removeStateAnimation = Yanfly.Param.LunSkRewAniRemoveState;
var miscAnimation = Yanfly.Param.LunSkRewAniMisc;
var animation = this.item().rewardAnimation || 0;
var code = Yanfly.Param.LunSkRewEffect;
try {
eval(code);
} catch (e) {
Yanfly.Util.displayError(e, code, "LUNATIC SKILL REWARDS ERROR");
}
if (false) {
// ----------
// Flat Gains
// ----------
if (data.match(/([\+\-]\d+)[ ]HP/i)) {
value = parseInt(RegExp.$1);
user.gainHp(value);
animation = animation || hpAnimation;
} else if (data.match(/([\+\-]\d+)[ ]MP/i)) {
value = parseInt(RegExp.$1);
user.gainMp(value);
animation = animation || mpAnimation;
} else if (data.match(/([\+\-]\d+)[ ]TP/i)) {
value = parseInt(RegExp.$1);
user.gainTp(value);
animation = animation || tpAnimation;
// ----------------
// Percentile Gains
// ----------------
} else if (data.match(/([\+\-]\d+)([%])[ ]HP/i)) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.mhp * rate);
user.gainHp(value);
animation = animation || hpAnimation;
} else if (data.match(/([\+\-]\d+)([%])[ ]MP/i)) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.mmp * rate);
user.gainMp(value);
animation = animation || mpAnimation;
} else if (data.match(/([\+\-]\d+)([%])[ ]TP/i)) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.maxTp() * rate);
user.gainTp(value);
animation = animation || tpAnimation;
// ------------------
// Refund Skill Costs
// ------------------
} else if (data.match(/([\+\-]\d+)([%])[ ]REFUND HP COST/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.skillHpCost(skill) * rate);
user.gainHp(value);
animation = animation || hpAnimation;
} else {
skip = true;
}
} else if (data.match(/([\+\-]\d+)([%])[ ]REFUND MP COST/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.skillMpCost(skill) * rate);
user.gainMp(value);
animation = animation || mpAnimation;
} else {
skip = true;
}
} else if (data.match(/([\+\-]\d+)([%])[ ]REFUND TP COST/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.skillTpCost(skill) * rate);
user.gainTp(value);
animation = animation || tpAnimation;
} else {
skip = true;
}
// -----------
// Refund Item
// -----------
} else if (data.match(/(\d+)([%])[ ]REFUND ITEM/i)) {
rate = parseFloat(RegExp.$1) * 0.01;
if (isItem && Math.random() < chance) {
$gameParty.gainItem(item, 1);
SoundManager.playUseItem();
animation = animation || itemAnimation;
} else {
skip = true;
}
// ------------------------
// Add/Remove Buffs/Debuffs
// ------------------------
} else if (data.match(/ADD[ ](.*)[ ]BUFF,[ ](\d+)[ ]TURN/i)) {
var str = String(RegExp.$1).toUpperCase();
var turns = parseInt(RegExp.$2);
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.addBuff(paramId, turns);
} else {
skip = true;
}
animation = animation || buffAnimation;
} else if (data.match(/ADD[ ](.*)[ ]BUFF/i)) {
var str = String(RegExp.$1).toUpperCase();
var turns = 5;
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.addBuff(paramId, turns);
} else {
skip = true;
}
animation = animation || buffAnimation;
} else if (data.match(/ADD[ ](.*)[ ]DEBUFF,[ ](\d+)[ ]TURN/i)) {
var str = String(RegExp.$1).toUpperCase();
var turns = parseInt(RegExp.$2);
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.addDebuff(paramId, turns);
} else {
skip = true;
}
animation = animation || debuffAnimation;
} else if (data.match(/ADD[ ](.*)[ ]DEBUFF/i)) {
var str = String(RegExp.$1).toUpperCase();
var turns = 5;
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.addDebuff(paramId, turns);
} else {
skip = true;
}
animation = animation || debuffAnimation;
} else if (data.match(/REMOVE[ ](.*)[ ](?:BUFF|DEBUFF)/i)) {
var str = String(RegExp.$1).toUpperCase();
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.removeBuff(paramId);
} else {
skip = true;
}
animation = animation || miscAnimation;
// -----------------
// Add/Remove States
// -----------------
} else if (data.match(/ADD STATE[ ](\d+)/i)) {
var stateId = parseInt(RegExp.$1);
user.addState(stateId);
animation = animation || addStateAnimation;
} else if (data.match(/REMOVE STATE[ ](\d+)/i)) {
var stateId = parseInt(RegExp.$1);
if (user.isStateAffected(stateId)) {
user.removeState(stateId);
animation = animation || removeStateAnimation;
} else {
skip = true;
}
// ----------------
// Rolling Critical
// ----------------
} else if (data.match(/ROLLING CRITICAL[ ]([\+\-]\d+)([%])/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
user._rollingCritical = user._rollingCritical || {};
user._rollingCritical[skill.id] = user._rollingCritical[skill.id] || 0;
user._rollingCritical[skill.id] += rate;
} else {
skip = true;
}
} else if (data.match(/ROLLING CRITICAL[ ](\d+)([%])/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
user._rollingCritical = user._rollingCritical || {};
user._rollingCritical[skill.id] = user._rollingCritical[skill.id] || 0;
user._rollingCritical[skill.id] = rate;
} else {
skip = true;
}
// -------------------------------
// Add new effects above this line
// -------------------------------
} else {
skip = true;
}
if (!skip) {
user.startDamagePopup();
if (animation > 0) {
user.startAnimation(animation);
}
}
}; // Default Effect Code
if (user.isDead()) user.performCollapse();
if (target.isDead()) target.performCollapse();
user._result = userPreviousResult;
target._result = targetPreviousResult;
};
//=============================================================================
// Utilities
//=============================================================================
Yanfly.Util = Yanfly.Util || {};
Yanfly.Util.displayError = function (e, code, message) {
console.log(message);
console.log(code || "NON-EXISTENT");
console.error(e);
if (Utils.isNwjs() && Utils.isOptionValid("test")) {
if (!require("nw.gui").Window.get().isDevToolsOpen()) {
require("nw.gui").Window.get().showDevTools();
}
}
};
//=============================================================================
// Default Effect Code
//=============================================================================
if (false) {
// ----------
// Flat Gains
// ----------
if (data.match(/([\+\-]\d+)[ ]HP/i)) {
value = parseInt(RegExp.$1);
user.gainHp(value);
animation = animation || hpAnimation;
} else if (data.match(/([\+\-]\d+)[ ]MP/i)) {
value = parseInt(RegExp.$1);
user.gainMp(value);
animation = animation || mpAnimation;
} else if (data.match(/([\+\-]\d+)[ ]TP/i)) {
value = parseInt(RegExp.$1);
user.gainTp(value);
animation = animation || tpAnimation;
// ----------------
// Percentile Gains
// ----------------
} else if (data.match(/([\+\-]\d+)([%])[ ]HP/i)) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.mhp * rate);
user.gainHp(value);
animation = animation || hpAnimation;
} else if (data.match(/([\+\-]\d+)([%])[ ]MP/i)) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.mmp * rate);
user.gainMp(value);
animation = animation || mpAnimation;
} else if (data.match(/([\+\-]\d+)([%])[ ]TP/i)) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.maxTp() * rate);
user.gainTp(value);
animation = animation || tpAnimation;
// ------------------
// Refund Skill Costs
// ------------------
} else if (data.match(/([\+\-]\d+)([%])[ ]REFUND HP COST/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.skillHpCost(skill) * rate);
user.gainHp(value);
animation = animation || hpAnimation;
} else {
skip = true;
}
} else if (data.match(/([\+\-]\d+)([%])[ ]REFUND MP COST/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.skillMpCost(skill) * rate);
user.gainMp(value);
animation = animation || mpAnimation;
} else {
skip = true;
}
} else if (data.match(/([\+\-]\d+)([%])[ ]REFUND TP COST/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
value = Math.round(user.skillTpCost(skill) * rate);
user.gainTp(value);
animation = animation || tpAnimation;
} else {
skip = true;
}
// -----------
// Refund Item
// -----------
} else if (data.match(/(\d+)([%])[ ]REFUND ITEM/i)) {
rate = parseFloat(RegExp.$1) * 0.01;
if (isItem && Math.random() < chance) {
$gameParty.gainItem(item, 1);
SoundManager.playUseItem();
animation = animation || itemAnimation;
} else {
skip = true;
}
// ------------------------
// Add/Remove Buffs/Debuffs
// ------------------------
} else if (data.match(/ADD[ ](.*)[ ]BUFF,[ ](\d+)[ ]TURN/i)) {
var str = String(RegExp.$1).toUpperCase();
var turns = parseInt(RegExp.$2);
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.addBuff(paramId, turns);
} else {
skip = true;
}
animation = animation || buffAnimation;
} else if (data.match(/ADD[ ](.*)[ ]BUFF/i)) {
var str = String(RegExp.$1).toUpperCase();
var turns = 5;
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.addBuff(paramId, turns);
} else {
skip = true;
}
animation = animation || buffAnimation;
} else if (data.match(/ADD[ ](.*)[ ]DEBUFF,[ ](\d+)[ ]TURN/i)) {
var str = String(RegExp.$1).toUpperCase();
var turns = parseInt(RegExp.$2);
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.addDebuff(paramId, turns);
} else {
skip = true;
}
animation = animation || debuffAnimation;
} else if (data.match(/ADD[ ](.*)[ ]DEBUFF/i)) {
var str = String(RegExp.$1).toUpperCase();
var turns = 5;
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.addDebuff(paramId, turns);
} else {
skip = true;
}
animation = animation || debuffAnimation;
} else if (data.match(/REMOVE[ ](.*)[ ](?:BUFF|DEBUFF)/i)) {
var str = String(RegExp.$1).toUpperCase();
var paramId = DataManager.getParamId(str);
if (paramId >= 0) {
user.removeBuff(paramId);
} else {
skip = true;
}
animation = animation || miscAnimation;
// -----------------
// Add/Remove States
// -----------------
} else if (data.match(/ADD STATE[ ](\d+)/i)) {
var stateId = parseInt(RegExp.$1);
user.addState(stateId);
animation = animation || addStateAnimation;
} else if (data.match(/REMOVE STATE[ ](\d+)/i)) {
var stateId = parseInt(RegExp.$1);
if (user.isStateAffected(stateId)) {
user.removeState(stateId);
animation = animation || removeStateAnimation;
} else {
skip = true;
}
// ----------------
// Rolling Critical
// ----------------
} else if (data.match(/ROLLING CRITICAL[ ]([\+\-]\d+)([%])/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
user._rollingCritical = user._rollingCritical || {};
user._rollingCritical[skill.id] = user._rollingCritical[skill.id] || 0;
user._rollingCritical[skill.id] += rate;
} else {
skip = true;
}
} else if (data.match(/ROLLING CRITICAL[ ](\d+)([%])/i)) {
if (isSkill) {
rate = parseFloat(RegExp.$1) * 0.01;
user._rollingCritical = user._rollingCritical || {};
user._rollingCritical[skill.id] = user._rollingCritical[skill.id] || 0;
user._rollingCritical[skill.id] = rate;
} else {
skip = true;
}
// -------------------------------
// Add new effects above this line
// -------------------------------
} else {
skip = true;
}
} // Default Effect Code
//=============================================================================
// End of File
//=============================================================================
//=============================================================================
// End of File
//=============================================================================
} else {
var text = '';
text += 'You are getting this error because you are trying to run ';
text += 'YEP_Z_SkillRewards without the required plugins. Please visit ';
text += 'Yanfly.moe and install the required plugins neede for this plugin ';
text += 'found in this plugin\'s help file before you can use it.';
console.log(text);
require('nw.gui').Window.get().showDevTools();
}; // Yanfly.PluginRequirements
var text = "";
text += "You are getting this error because you are trying to run ";
text += "YEP_Z_SkillRewards without the required plugins. Please visit ";
text += "Yanfly.moe and install the required plugins neede for this plugin ";
text += "found in this plugin's help file before you can use it.";
console.log(text);
require("nw.gui").Window.get().showDevTools();
} // Yanfly.PluginRequirements

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save