decompiled panorama scripts, lets try it out
This commit is contained in:
0
english_localization_set/copy_localization_lines.py
Normal file
0
english_localization_set/copy_localization_lines.py
Normal file
BIN
english_localization_set/panorama_decompile/Decompiler
Executable file
BIN
english_localization_set/panorama_decompile/Decompiler
Executable file
Binary file not shown.
BIN
english_localization_set/panorama_decompile/Decompiler-linux.zip
Normal file
BIN
english_localization_set/panorama_decompile/Decompiler-linux.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
panorama/scripts/custom_game/display_error.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/display_error.js
Executable file → Normal file
BIN
panorama/scripts/custom_game/display_error.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/display_error.js
Executable file → Normal file
Binary file not shown.
BIN
panorama/scripts/custom_game/dps_panel.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/dps_panel.js
Executable file → Normal file
BIN
panorama/scripts/custom_game/dps_panel.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/dps_panel.js
Executable file → Normal file
Binary file not shown.
BIN
panorama/scripts/custom_game/end_screen.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/end_screen.js
Executable file → Normal file
BIN
panorama/scripts/custom_game/end_screen.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/end_screen.js
Executable file → Normal file
Binary file not shown.
BIN
panorama/scripts/custom_game/info.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/info.js
Executable file → Normal file
BIN
panorama/scripts/custom_game/info.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/info.js
Executable file → Normal file
Binary file not shown.
BIN
panorama/scripts/custom_game/power.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/power.js
Executable file → Normal file
BIN
panorama/scripts/custom_game/power.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/power.js
Executable file → Normal file
Binary file not shown.
BIN
panorama/scripts/custom_game/shop.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/shop.js
Executable file → Normal file
BIN
panorama/scripts/custom_game/shop.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/shop.js
Executable file → Normal file
Binary file not shown.
BIN
panorama/scripts/custom_game/team_select.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/team_select.js
Executable file → Normal file
BIN
panorama/scripts/custom_game/team_select.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/team_select.js
Executable file → Normal file
Binary file not shown.
BIN
panorama/scripts/custom_game/team_select_card.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/team_select_card.js
Executable file → Normal file
BIN
panorama/scripts/custom_game/team_select_card.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/team_select_card.js
Executable file → Normal file
Binary file not shown.
BIN
panorama/scripts/custom_game/util.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/util.js
Executable file → Normal file
BIN
panorama/scripts/custom_game/util.vjs_c → english_localization_set/panorama_decompile/decompiled_scrips/util.js
Executable file → Normal file
Binary file not shown.
BIN
english_localization_set/panorama_decompile/libSkiaSharp.so
Normal file
BIN
english_localization_set/panorama_decompile/libSkiaSharp.so
Normal file
Binary file not shown.
380
panorama/scripts/custom_game/custom_loading_screen.js
Normal file
380
panorama/scripts/custom_game/custom_loading_screen.js
Normal file
@@ -0,0 +1,380 @@
|
||||
|
||||
//Base64字符串编码解码,UTF8,支持汉字。
|
||||
//编码后字符包括+/=,仍然会因为特殊字符被某些应用拒绝,本应用即不行
|
||||
var Base64 = {
|
||||
|
||||
// private property
|
||||
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||
|
||||
// public method for encoding
|
||||
encode: function(input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
input = Base64._utf8_encode(input);
|
||||
|
||||
while (i < input.length) {
|
||||
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
||||
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
// public method for decoding
|
||||
decode: function(input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
while (i < input.length) {
|
||||
|
||||
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
output = Base64._utf8_decode(output);
|
||||
|
||||
return output;
|
||||
|
||||
},
|
||||
|
||||
// private method for UTF-8 encoding
|
||||
_utf8_encode: function(string) {
|
||||
string = string.replace(/\r\n/g, "\n");
|
||||
var utftext = "";
|
||||
|
||||
for (var n = 0; n < string.length; n++) {
|
||||
|
||||
var c = string.charCodeAt(n);
|
||||
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
} else if ((c > 127) && (c < 2048)) {
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
} else {
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return utftext;
|
||||
},
|
||||
|
||||
// private method for UTF-8 decoding
|
||||
_utf8_decode: function(utftext) {
|
||||
var string = "";
|
||||
var i = 0;
|
||||
var c = c1 = c2 = 0;
|
||||
|
||||
while (i < utftext.length) {
|
||||
|
||||
c = utftext.charCodeAt(i);
|
||||
|
||||
if (c < 128) {
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
} else if ((c > 191) && (c < 224)) {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
} else {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
c3 = utftext.charCodeAt(i + 2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//字符串与十六进制字符串相互转换,UTF8,支持汉字
|
||||
//防止特殊符号被应用拒绝
|
||||
var StringHex = {
|
||||
|
||||
// public method, Hex字符串编码
|
||||
encode: function(str){
|
||||
var charBuf = StringHex.writeUTF(str, true);
|
||||
var re = '';
|
||||
for(var i = 0; i < charBuf.length; i ++){
|
||||
var x = (charBuf[i] & 0xFF).toString(16);
|
||||
if(x.length === 1){
|
||||
x = '0' + x;
|
||||
}
|
||||
re += x;
|
||||
}
|
||||
return re;
|
||||
},
|
||||
|
||||
// public method,Hex字符串解码
|
||||
decode: function (hexStr) {
|
||||
var buf = [];
|
||||
for(var i = 0; i < hexStr.length; i += 2){
|
||||
buf.push(parseInt(hexStr.substring(i, i+2), 16));
|
||||
}
|
||||
return StringHex.readUTF(buf);
|
||||
},
|
||||
|
||||
// private method
|
||||
writeUTF: function (str, isGetBytes) {
|
||||
var back = [];
|
||||
var byteSize = 0;
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var code = str.charCodeAt(i);
|
||||
if (0x00 <= code && code <= 0x7f) {
|
||||
byteSize += 1;
|
||||
back.push(code);
|
||||
} else if (0x80 <= code && code <= 0x7ff) {
|
||||
byteSize += 2;
|
||||
back.push((192 | (31 & (code >> 6))));
|
||||
back.push((128 | (63 & code)))
|
||||
} else if ((0x800 <= code && code <= 0xd7ff)
|
||||
|| (0xe000 <= code && code <= 0xffff)) {
|
||||
byteSize += 3;
|
||||
back.push((224 | (15 & (code >> 12))));
|
||||
back.push((128 | (63 & (code >> 6))));
|
||||
back.push((128 | (63 & code)))
|
||||
}
|
||||
}
|
||||
for (i = 0; i < back.length; i++) {
|
||||
back[i] &= 0xff;
|
||||
}
|
||||
if (isGetBytes) {
|
||||
return back
|
||||
}
|
||||
if (byteSize <= 0xff) {
|
||||
return [0, byteSize].concat(back);
|
||||
} else {
|
||||
return [byteSize >> 8, byteSize & 0xff].concat(back);
|
||||
}
|
||||
},
|
||||
|
||||
// private method
|
||||
readUTF: function (arr) {
|
||||
if (typeof arr === 'string') {
|
||||
return arr;
|
||||
}
|
||||
var UTF = '', _arr = arr;
|
||||
for (var i = 0; i < _arr.length; i++) {
|
||||
var one = _arr[i].toString(2),
|
||||
v = one.match(/^1+?(?=0)/);
|
||||
if (v && one.length == 8) {
|
||||
var bytesLength = v[0].length;
|
||||
var store = _arr[i].toString(2).slice(7 - bytesLength);
|
||||
for (var st = 1; st < bytesLength; st++) {
|
||||
if (st + i < _arr.length) store += _arr[st + i].toString(2).slice(2);
|
||||
}
|
||||
UTF += String.fromCharCode(parseInt(store, 2));
|
||||
i += bytesLength - 1
|
||||
} else {
|
||||
UTF += String.fromCharCode(_arr[i])
|
||||
}
|
||||
}
|
||||
return UTF
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 需要 Base64 支持
|
||||
var StringCode = {
|
||||
encrypt: function(str, pwd) {
|
||||
str = Base64.encode(str);//Base64加密
|
||||
var prand = "";
|
||||
for(var i=0; i<pwd.length; i++) {
|
||||
prand += pwd.charCodeAt(i).toString();
|
||||
}
|
||||
var sPos = Math.floor(prand.length / 5);
|
||||
var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
|
||||
var incr = Math.ceil(pwd.length / 2);
|
||||
var modu = Math.pow(2, 31) - 1;
|
||||
if(mult < 2) {
|
||||
$.Msg("------ Please choose a more complex or longer password.");
|
||||
return null;
|
||||
}
|
||||
var salt = Math.round(Math.random() * 1000000000) % 100000000;
|
||||
prand += salt;
|
||||
while(prand.length > 10) {
|
||||
prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
|
||||
}
|
||||
prand = (mult * prand + incr) % modu;
|
||||
var enc_chr = "";
|
||||
var enc_str = "";
|
||||
for(var i=0; i<str.length; i++) {
|
||||
enc_chr = parseInt(str.charCodeAt(i) ^ Math.floor((prand / modu) * 255));
|
||||
if(enc_chr < 16) {
|
||||
enc_str += "0" + enc_chr.toString(16);
|
||||
} else enc_str += enc_chr.toString(16);
|
||||
prand = (mult * prand + incr) % modu;
|
||||
}
|
||||
salt = salt.toString(16);
|
||||
while(salt.length < 8)salt = "0" + salt;
|
||||
enc_str += salt;
|
||||
return enc_str;
|
||||
},
|
||||
|
||||
decrypt: function(str, pwd) {
|
||||
var prand = "";
|
||||
for(var i=0; i<pwd.length; i++) {
|
||||
prand += pwd.charCodeAt(i).toString();
|
||||
}
|
||||
var sPos = Math.floor(prand.length / 5);
|
||||
var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
|
||||
var incr = Math.round(pwd.length / 2);
|
||||
var modu = Math.pow(2, 31) - 1;
|
||||
var salt = parseInt(str.substring(str.length - 8, str.length), 16);
|
||||
str = str.substring(0, str.length - 8);
|
||||
prand += salt;
|
||||
while(prand.length > 10) {
|
||||
prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
|
||||
}
|
||||
prand = (mult * prand + incr) % modu;
|
||||
var enc_chr = "";
|
||||
var enc_str = "";
|
||||
for(var i=0; i<str.length; i+=2) {
|
||||
enc_chr = parseInt(parseInt(str.substring(i, i+2), 16) ^ Math.floor((prand / modu) * 255));
|
||||
enc_str += String.fromCharCode(enc_chr);
|
||||
prand = (mult * prand + incr) % modu;
|
||||
}
|
||||
//return enc_str;
|
||||
return Base64.decode(enc_str);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
GameUI.Base64 = Base64;
|
||||
GameUI.StringHex = StringHex;
|
||||
GameUI.StringCode = StringCode;
|
||||
|
||||
GameUI.Cheated = false;
|
||||
|
||||
// 创建网页
|
||||
function script() {
|
||||
var fn = arguments[0];
|
||||
var text = fn.toString().split('\n').slice(1,-1).join('\n') + '\n';
|
||||
var len = arguments.length;
|
||||
|
||||
for (var i = 1; i < len; i++) {
|
||||
text = text.replace(new RegExp('\\{'+i+'\\}', 'g'), arguments[i].toString());
|
||||
}
|
||||
return text;
|
||||
}
|
||||
GameUI.CreateHtml = script;
|
||||
|
||||
|
||||
//播放视频,所在页定义一个Panel即可,如 <Panel id="MoviePanel" /> //BLoadLayoutFromString已失效,此方法废弃
|
||||
var moviePage = script(function(){/*
|
||||
<root>
|
||||
<styles>
|
||||
<include src="s2r://panorama/styles/dotastyles.vcss_c" />
|
||||
<include src="s2r://panorama/styles/custom_game/movie.vcss_c" />
|
||||
</styles>
|
||||
<script>
|
||||
var closeHandle = null;
|
||||
function Close() {
|
||||
if (closeHandle) {
|
||||
closeHandle();
|
||||
}
|
||||
}
|
||||
(function() {
|
||||
$.GetContextPanel().OnClose = function (f) { closeHandle = f };
|
||||
$.GetContextPanel().ShowClose = function (isShowClose) { $("#CloseButtonBig").SetHasClass("Hide", isShowClose !== true) };
|
||||
})();
|
||||
</script>
|
||||
<Panel class="MovieRootPanel">
|
||||
<MoviePanel class="Movie" src="file://{resources}/videos/{movie}.webm" repeat="true" autoplay="onload" />
|
||||
<Button id="CloseMoviePlayButton" onactivate="MovieClose()" />
|
||||
</Panel>
|
||||
</root>
|
||||
*/});
|
||||
|
||||
// 刀塔2021.09.18更新后官方移除BLoadLayoutFromString,改造后需要配合xml
|
||||
GameUI.PlayMovie = function (panel, movie, duration, isShowClose) {
|
||||
if (!panel) return;
|
||||
if (!movie) return;
|
||||
panel.RemoveAndDeleteChildren();
|
||||
$.CreatePanelWithProperties( "MoviePanel", panel, "MovieContentPanel", {class:"Movie", src: "file://{resources}/videos/" + movie + ".webm", repeat: "true", autoplay: "onload"} );
|
||||
if (isShowClose === true) {
|
||||
$.CreatePanelWithProperties( "Button", panel, "CloseMoviePlayButton", {onactivate: "$.GetContextPanel().ToggleClass('Hide')"} );
|
||||
}
|
||||
if (duration) {
|
||||
$.Schedule(duration, function () {
|
||||
panel.RemoveAndDeleteChildren();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//将系统API获取的颜色转化为html格式,如 i = Players.GetPlayerColor(id)
|
||||
GameUI.DotaColorToHtml = function (i) {
|
||||
return "#" + ('00' + ( i & 0xFF).toString( 16 ) ).substr( -2 ) +
|
||||
('00' + ( ( i >> 8 ) & 0xFF ).toString( 16 ) ).substr( -2 ) +
|
||||
('00' + ( ( i >> 16 ) & 0xFF ).toString( 16 ) ).substr( -2 ) +
|
||||
('00' + ( ( i >> 24 ) & 0xFF ).toString( 16 ) ).substr( -2 );
|
||||
};
|
||||
|
||||
|
||||
//打印消息
|
||||
GameUI.Print = function (msg) {
|
||||
$.Msg("-------- " + Math.floor(Game.GetGameTime() * 100 + 0.5) / 100 + " : " + msg);
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Loading
|
||||
function Loading() {
|
||||
if (Game.GameStateIs(DOTA_GameState.DOTA_GAMERULES_STATE_CUSTOM_GAME_SETUP)) {
|
||||
$("#loading_png").visible = false;
|
||||
$("#loading_text").visible = false;
|
||||
return;
|
||||
}
|
||||
$.Schedule(0.5, Loading);
|
||||
}
|
||||
|
||||
;(function() {
|
||||
GameUI.PlayMovie($("#MoviePlayPanel"), "promo/outlanders_bg");
|
||||
Loading();
|
||||
})();
|
||||
53
panorama/scripts/custom_game/display_error.js
Normal file
53
panorama/scripts/custom_game/display_error.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// steamid至accountid(Dota2数字账户)的转换,字符串
|
||||
function GetAccountID () {
|
||||
var playerInfo = Game.GetPlayerInfo(Game.GetLocalPlayerID());
|
||||
var steamID64 = playerInfo.player_steamid,
|
||||
steamIDPart = Number(steamID64.substring(3)),
|
||||
steamID32 = String(steamIDPart - 61197960265728);
|
||||
return steamID32;
|
||||
}
|
||||
|
||||
// 只能使用kv本地化文件中定义的标签
|
||||
function Errors(data)
|
||||
{
|
||||
GameEvents.SendEventClientSide("dota_hud_error_message", {
|
||||
"splitscreenplayer": 0,
|
||||
"reason": 80,
|
||||
"message": data.msg
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 在聊天频道显示,队友可见
|
||||
function Chat(data)
|
||||
{
|
||||
// 注意 $.Localize 首次使用时必须带第二个参数,之后不需要。
|
||||
// var text = $.Localize(, $.GetContextPanel());
|
||||
var params = data.params;
|
||||
|
||||
var msgPanel = $.CreatePanel("Panel", $.GetContextPanel(), "");
|
||||
msgPanel.visible = false;
|
||||
|
||||
var label = $.CreatePanel("Label", msgPanel, "");
|
||||
|
||||
if (params) {
|
||||
for(var i in params) {
|
||||
var v = params[i];
|
||||
if (typeof v === 'number') {
|
||||
label.SetDialogVariableInt(i, v);
|
||||
} else {
|
||||
label.SetDialogVariable(i, $.Localize(String(v)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label.text = $.Localize(data.msg, label).replace(/%%/g,"%");
|
||||
GameEvents.SendCustomGameEventToServer("custom_game_chat_msg", {'msg':label.text});
|
||||
msgPanel.DeleteAsync(0);
|
||||
}
|
||||
|
||||
(function()
|
||||
{
|
||||
GameEvents.Subscribe("display_custom_error", Errors);
|
||||
GameEvents.Subscribe("display_chat_msg", Chat);
|
||||
})();
|
||||
157
panorama/scripts/custom_game/dps_panel.js
Normal file
157
panorama/scripts/custom_game/dps_panel.js
Normal file
@@ -0,0 +1,157 @@
|
||||
"use strict";
|
||||
|
||||
// 获取steamid
|
||||
var m_SteamID = null;
|
||||
function GetSteamID() {
|
||||
if (!m_SteamID) {
|
||||
m_SteamID = Game.GetLocalPlayerInfo().player_steamid.toString();
|
||||
}
|
||||
return m_SteamID;
|
||||
}
|
||||
|
||||
var TowerList = CustomNetTables.GetTableValue("CustomGameInfo", "thtd_tower_list");
|
||||
|
||||
GameUI.SetGamePoint = function (point) {
|
||||
var panel = $("#KillCount");
|
||||
if (panel) panel.SetDialogVariableInt("point", point);
|
||||
};
|
||||
|
||||
function FindItemName( unitname ) {
|
||||
for(var itemname in TowerList) {
|
||||
if (TowerList[itemname]["cardname"] === unitname) {
|
||||
return itemname;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function SetTowerTooltip( panel ) {
|
||||
panel.SetPanelEvent("onmouseover", function () {
|
||||
var text = $.Localize(panel.GetAttributeString("UnitName", ""));
|
||||
$.DispatchEvent("DOTAShowTextTooltip", panel, text)
|
||||
});
|
||||
panel.SetPanelEvent("onmouseout", function () {
|
||||
$.DispatchEvent("DOTAHideTextTooltip")
|
||||
});
|
||||
panel.SetPanelEvent("onactivate", function () {
|
||||
var ent = panel.GetAttributeInt("Ent", 0);
|
||||
GameEvents.SendCustomGameEventToServer("custom_game_show_dps_card", {"ent": ent});
|
||||
});
|
||||
}
|
||||
|
||||
function UpdateTowerList( list , dps_max ) {
|
||||
var len = list.length;
|
||||
var TowerList = $("#TowerList");
|
||||
var index = 1;
|
||||
var dps_highest = 0;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var data = list[i];
|
||||
var panel = TowerList.GetChild(index++);
|
||||
if (!panel) {
|
||||
panel = $.CreatePanel("Panel", TowerList, "");
|
||||
panel.BLoadLayoutSnippet("Tower");
|
||||
SetTowerTooltip(panel);
|
||||
}
|
||||
if (index==2) {
|
||||
dps_highest = data.damage;
|
||||
}
|
||||
|
||||
panel.FindChild("Item").itemname = data.itemname;
|
||||
var dpstext = "";
|
||||
var dpsfixed = GameUI.DpsFix(data.damage, GameUI.Wave);
|
||||
if (dpsfixed < 100) {
|
||||
dpstext = dpsfixed * 100;
|
||||
} else {
|
||||
var wan = Math.floor(dpsfixed / 100 + 0.5);
|
||||
if (wan < 10000) {
|
||||
dpstext = wan + "万";
|
||||
} else {
|
||||
dpstext = Math.floor(wan/10000) + "亿" + wan%10000 + "万";
|
||||
}
|
||||
}
|
||||
panel.FindChildTraverse("DPS").text = dpstext;
|
||||
var dps_bar_pct = ( (data.damage/dps_highest)*100 || 0);
|
||||
panel.FindChildTraverse("DPS_bar").style.width = dps_bar_pct + "%";
|
||||
var dps_pct = ( (data.damage/dps_max)*100 || 0);
|
||||
panel.FindChildTraverse("DPS_pct").text = dps_pct.toFixed(1) + "%";
|
||||
panel.SetAttributeString("UnitName", data.unitname);
|
||||
panel.SetAttributeInt("Ent", data.ent);
|
||||
panel.visible = true;
|
||||
}
|
||||
var max = TowerList.GetChildCount();
|
||||
for (var i = index; i < max; i++) {
|
||||
TowerList.GetChild(i).visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
function Update(damagelist) {
|
||||
if (!$.GetContextPanel().BHasClass("ShowTime")) return;
|
||||
if (!damagelist) return;
|
||||
|
||||
var list = [];
|
||||
var dps_max = 0;
|
||||
|
||||
var keys = Object.keys(damagelist); //for (var i in data) 取不到值
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var damage = damagelist[keys[i]];
|
||||
var ent = parseInt(keys[i]);
|
||||
var unitname = Entities.GetUnitName(ent);
|
||||
if (unitname == null || unitname == "") continue;
|
||||
var itemname = FindItemName(unitname);
|
||||
list.push({'itemname':itemname, 'damage':Math.floor(damage), 'unitname': unitname, 'ent': ent});
|
||||
dps_max = dps_max + Math.floor(damage);
|
||||
}
|
||||
|
||||
list.sort(function (a, b) {
|
||||
if (a.damage < b.damage) return 1;
|
||||
if (a.damage == b.damage) return 0;
|
||||
if (a.damage > b.damage) return -1;
|
||||
})
|
||||
|
||||
UpdateTowerList( list, dps_max);
|
||||
}
|
||||
|
||||
// {"creature_kill_count":0,"creep_count":0,"food_count":0}
|
||||
function UpdateInfo(table) {
|
||||
if (!table) return;
|
||||
|
||||
var FoodCount = $("#FoodCount");
|
||||
FoodCount.SetDialogVariableInt("count", table["food_count"]);
|
||||
FoodCount.SetDialogVariableInt("max_count", GameUI.GameData.max_food);
|
||||
$("#KillCount").SetDialogVariableInt("count", table["creature_kill_count"]);
|
||||
}
|
||||
|
||||
;(function(){
|
||||
$("#FoodCount").SetDialogVariableInt("count", 0);
|
||||
$("#FoodCount").SetDialogVariableInt("max_count", 12);
|
||||
$("#KillCount").SetDialogVariableInt("count", 0);
|
||||
$("#KillCount").SetDialogVariableInt("point", 0);
|
||||
|
||||
if (Players.IsSpectator(Players.GetLocalPlayer())) {
|
||||
$("#TowerList").visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
GameUI.SetGamePoint(GameUI.PlayerData.point);
|
||||
|
||||
CustomNetTables.SubscribeNetTableListener("TowerListInfo", OnNetTableTowerListInfo);
|
||||
CustomNetTables.SubscribeNetTableListener("CustomGameInfo", OnNetTableCustomGameInfo);
|
||||
})();
|
||||
|
||||
function OnNetTableTowerListInfo(table_name, key, data) {
|
||||
// $.Msg( "---------- Table: ", table_name, ", changed: '", key, "' = ", data );
|
||||
|
||||
if (key === "damagelist" + GetSteamID()) {
|
||||
Update(data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function OnNetTableCustomGameInfo(table_name, key, data) {
|
||||
// $.Msg( "---------- Table: ", table_name, ", changed: '", key, "' = ", data );
|
||||
|
||||
if (key === "game_info" + GetSteamID()) {
|
||||
UpdateInfo(data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
34
panorama/scripts/custom_game/end_screen.js
Normal file
34
panorama/scripts/custom_game/end_screen.js
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
(function(){
|
||||
GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_ENDGAME, false );
|
||||
|
||||
var playerIDs = Game.GetPlayerIDsOnTeam(DOTATeam_t.DOTA_TEAM_GOODGUYS);
|
||||
for (var i = 0; i < playerIDs.length; i++) {
|
||||
var id = playerIDs[i];
|
||||
var info = Game.GetPlayerInfo(id);
|
||||
var panel = $.CreatePanel("Panel", $("#PlayersPanel"), "");
|
||||
panel.BLoadLayoutSnippet("player");
|
||||
|
||||
panel.FindChild("PlayerColor").style.backgroundColor = GameUI.DotaColorToHtml(Players.GetPlayerColor(id));
|
||||
|
||||
panel.FindChild("AvatarImage").steamid = info.player_steamid;
|
||||
panel.FindChild("PlayerAndHeroNameContainer").FindChild("PlayerNameLabel").text = info.player_name;
|
||||
panel.FindChild("PlayerAndHeroNameContainer").FindChild("HeroNameLabel").text = $.Localize(info.player_selected_hero);
|
||||
|
||||
var table = CustomNetTables.GetTableValue("CustomGameInfo", "game_info" + info.player_steamid);
|
||||
var KillCount = panel.FindChild("KillCount");
|
||||
KillCount.text = table["creature_kill_count"];
|
||||
}
|
||||
|
||||
if (Game.GetGameWinner() === DOTATeam_t.DOTA_TEAM_GOODGUYS) {
|
||||
$("#WinText").text = $.Localize("#dota_match_history_win");
|
||||
} else {
|
||||
$("#WinText").AddClass("fail");
|
||||
$("#WinText").text = $.Localize("#dota_match_history_loss");
|
||||
}
|
||||
|
||||
$.Schedule(5, function () {
|
||||
$("#ContinueButton").RemoveClass('Hide');
|
||||
})
|
||||
})();
|
||||
1361
panorama/scripts/custom_game/info.js
Normal file
1361
panorama/scripts/custom_game/info.js
Normal file
File diff suppressed because it is too large
Load Diff
268
panorama/scripts/custom_game/power.js
Normal file
268
panorama/scripts/custom_game/power.js
Normal file
@@ -0,0 +1,268 @@
|
||||
var PowerLabelModifier;
|
||||
var CritDamageLabelModifier;
|
||||
var CritChanceLabelModifier;
|
||||
var itemList = [];
|
||||
|
||||
function CustomPowerPanelRefresh() {
|
||||
var mainSelected = Players.GetLocalPlayerPortraitUnit();
|
||||
if(mainSelected != null && mainSelected != -1) {
|
||||
if (Entities.GetTeamNumber(mainSelected) == DOTATeam_t.DOTA_TEAM_GOODGUYS) {
|
||||
var basePower = Entities.GetDayTimeVisionRange(mainSelected) - 800;
|
||||
var percentage = Entities.GetNightTimeVisionRange(mainSelected) - 800;
|
||||
var bonusPower = Math.floor(basePower * percentage/100);
|
||||
if (!Entities.IsRooted(mainSelected)) {
|
||||
basePower = 0;
|
||||
bonusPower = 0;
|
||||
}
|
||||
if (bonusPower > 0) {
|
||||
PowerLabelModifier.text = basePower.toString() + "<font color='#2dc03a'>+" + bonusPower.toString() + "</font>";
|
||||
} else if (bonusPower == 0) {
|
||||
PowerLabelModifier.text = basePower.toString();
|
||||
} else {
|
||||
PowerLabelModifier.text = basePower.toString() + "<font color='red'>-" + Math.abs(bonusPower).toString() + "</font>";
|
||||
}
|
||||
|
||||
var buffs = Entities.GetNumBuffs(mainSelected);
|
||||
var isCritZero = true;
|
||||
var isChanceZero = true;
|
||||
var isCritFind = false;
|
||||
var isChanceFind = false;
|
||||
for (var i = 0; i < buffs; i++) {
|
||||
var buff = Entities.GetBuff(mainSelected, i);
|
||||
var buffname = Buffs.GetName( mainSelected, buff);
|
||||
if (!isCritFind && buffname === "modifier_touhoutd_crit_damage") {
|
||||
CritDamageLabelModifier.text = "<font color='yellow'>" + Buffs.GetStackCount(mainSelected, buff) + "%</font>";
|
||||
isCritZero = false;
|
||||
isCritFind = true;
|
||||
if (isChanceFind) break;
|
||||
} else if (!isChanceFind && buffname === "modifier_touhoutd_crit_chance") {
|
||||
CritChanceLabelModifier.text = "<font color='#c9520d'>" + Buffs.GetStackCount(mainSelected, buff) + "%</font>";
|
||||
isChanceZero = false;
|
||||
isChanceFind = true;
|
||||
if (isCritFind) break;
|
||||
}
|
||||
}
|
||||
if (isCritZero) CritDamageLabelModifier.text = "<font color='yellow'>0%</font>";
|
||||
if (isChanceZero) CritChanceLabelModifier.text = "<font color='#c9520d'>0%</font>";
|
||||
} else {
|
||||
PowerLabelModifier.text = "0";
|
||||
CritDamageLabelModifier.text = "<font color='yellow'>0%</font>";
|
||||
CritChanceLabelModifier.text = "<font color='#c9520d'>0%</font>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CustomStarPanelRefresh() {
|
||||
var mainSelected = Players.GetLocalPlayerPortraitUnit();
|
||||
if(mainSelected != null && mainSelected != -1) {
|
||||
for (var i = 0; i <= 5; i++ ) {
|
||||
var ent = Entities.GetItemInSlot(mainSelected, i);
|
||||
if (ent != "-1" && ent != "32767") {
|
||||
var star = 0;
|
||||
var level = 0;
|
||||
var itemName = Abilities.GetAbilityName(ent);
|
||||
if (itemName.substr(0,6) === "item_0") {
|
||||
var itemLevel = Abilities.GetLevel(ent);
|
||||
star = Math.floor((itemLevel-1)/10) + 1;
|
||||
level = itemLevel - (star-1) * 10;
|
||||
} else {
|
||||
if (itemName == "item_1003" || itemName == "item_1011") {
|
||||
star = 1;
|
||||
level = 10;
|
||||
} else if (itemName == "item_1004" || itemName == "item_1012") {
|
||||
star = 2;
|
||||
level = 10;
|
||||
} else if (itemName == "item_1005" || itemName == "item_1013") {
|
||||
star = 3;
|
||||
level = 10;
|
||||
} else if (itemName == "item_1006" || itemName == "item_1014") {
|
||||
star = 4;
|
||||
level = 10;
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 1; j <= 5; j++) {
|
||||
itemList[i][j].visible = j <= star;
|
||||
}
|
||||
itemList[i][6].visible = level > 0;
|
||||
itemList[i][6].text = level > 0 ? level.toString() : "";
|
||||
} else {
|
||||
for ( var j = 1; j <= 6; j++ ) {
|
||||
itemList[i][j].visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CustomPanelRefresh () {
|
||||
CustomPowerPanelRefresh();
|
||||
CustomStarPanelRefresh();
|
||||
return $.Schedule(0.15, CustomPanelRefresh);
|
||||
}
|
||||
|
||||
|
||||
;(function(){
|
||||
// 能量显示
|
||||
var root = $.GetContextPanel().GetParent().GetParent().GetParent();
|
||||
var stats = root.FindChild("HUDElements").FindChild("lower_hud").FindChild("center_with_stats").FindChild("center_block").FindChild("stats_container");
|
||||
stats.FindChildTraverse("stats").style["height"] = "110px";
|
||||
stats.FindChildTraverse("stragiint").visible = false;
|
||||
var statContainer = stats.FindChildTraverse("stats").FindChild("Aligner").FindChild("StatContainer");
|
||||
if(statContainer.FindChildTraverse("power") == null)
|
||||
{
|
||||
var power = $.CreatePanel("Panel", statContainer, "power");
|
||||
power.AddClass("StatIconLabel");
|
||||
var column = $.CreatePanel("Panel", power, "column");
|
||||
column.AddClass("LabelColumn");
|
||||
var container = $.CreatePanel("Panel", column, "container");
|
||||
container.AddClass("DamageLabelContainer");
|
||||
var labelmodifier = $.CreatePanel("Label", container, "labelmodifier");
|
||||
labelmodifier.AddClass("MonoNumbersFont");
|
||||
labelmodifier.AddClass("StatRegionLabel");
|
||||
labelmodifier.AddClass("StatModifier");
|
||||
labelmodifier.style["margin-top"] = "1px";
|
||||
labelmodifier.html = true;
|
||||
labelmodifier.text = "0";
|
||||
PowerLabelModifier = labelmodifier;
|
||||
var icon = $.CreatePanel("Panel", power, "DamageIcon");
|
||||
icon.AddClass("StatIcon");
|
||||
}
|
||||
if(statContainer.FindChildTraverse("crit_damage") == null)
|
||||
{
|
||||
var power = $.CreatePanel("Panel", statContainer, "crit_damage");
|
||||
power.AddClass("StatIconLabel");
|
||||
var column = $.CreatePanel("Panel", power, "column");
|
||||
column.AddClass("LabelColumn");
|
||||
var container = $.CreatePanel("Panel", column, "container");
|
||||
container.AddClass("DamageLabelContainer");
|
||||
var labelmodifier = $.CreatePanel("Label", container, "labelmodifier");
|
||||
labelmodifier.AddClass("MonoNumbersFont");
|
||||
labelmodifier.AddClass("StatRegionLabel");
|
||||
labelmodifier.AddClass("StatModifier");
|
||||
// labelmodifier.style["margin-top"] = "1px";
|
||||
labelmodifier.html = true;
|
||||
labelmodifier.text = "<font color='yellow'>0%</font>";
|
||||
CritDamageLabelModifier = labelmodifier;
|
||||
var icon = $.CreatePanel("Panel", power, "DamageIcon");
|
||||
icon.AddClass("StatIcon");
|
||||
}
|
||||
if(statContainer.FindChildTraverse("crit_chance") == null)
|
||||
{
|
||||
var power = $.CreatePanel("Panel", statContainer, "crit_chance");
|
||||
power.AddClass("StatIconLabel");
|
||||
var column = $.CreatePanel("Panel", power, "column");
|
||||
column.AddClass("LabelColumn");
|
||||
var container = $.CreatePanel("Panel", column, "container");
|
||||
container.AddClass("DamageLabelContainer");
|
||||
var labelmodifier = $.CreatePanel("Label", container, "labelmodifier");
|
||||
labelmodifier.AddClass("MonoNumbersFont");
|
||||
labelmodifier.AddClass("StatRegionLabel");
|
||||
labelmodifier.AddClass("StatModifier");
|
||||
// labelmodifier.style["margin-top"] = "1px";
|
||||
labelmodifier.html = true;
|
||||
labelmodifier.text = "<font color='#c9520d'>0%</font>";
|
||||
CritChanceLabelModifier = labelmodifier;
|
||||
var icon = $.CreatePanel("Panel", power, "DamageIcon");
|
||||
icon.AddClass("StatIcon");
|
||||
}
|
||||
|
||||
|
||||
// 背包物品星级和等级
|
||||
var centerBlock = root.FindChild("HUDElements").FindChild("lower_hud").FindChild("center_with_stats").FindChild("center_block");
|
||||
var inventory = centerBlock.FindChild("inventory");
|
||||
|
||||
var list = inventory.FindChildTraverse("inventory_list");
|
||||
for ( var i = 0; i <= 2; i++ ) {
|
||||
var slot = list.FindChildTraverse("inventory_slot_" + i.toString());
|
||||
var item = slot.FindChildTraverse("AbilityButton");
|
||||
|
||||
itemList[i] = item;
|
||||
|
||||
var labelmodifier = $.CreatePanel("Label", item, "labellevel");
|
||||
itemList[i][6] = labelmodifier;
|
||||
labelmodifier.style.width = "16px";
|
||||
labelmodifier.style.height = "16px";
|
||||
labelmodifier.style.color = "#FFCC33";
|
||||
labelmodifier.style["horizontal-align"] = "right";
|
||||
labelmodifier.style["vertical-align"] = "top";
|
||||
labelmodifier.style["font-size"] = "16px";
|
||||
labelmodifier.style["text-shadow"] = "0px 0px 4px 4 #000000";
|
||||
labelmodifier.style["letter-spacing"] = "0 px";
|
||||
labelmodifier.text = "";
|
||||
|
||||
for ( var j = 1; j <= 5; j++ )
|
||||
{
|
||||
var img = $.CreatePanel("Image", item, "Image_" + j.toString());
|
||||
var imgNum = "Image_"+j.toString();
|
||||
img.SetImage("s2r://panorama/images/custom_game/star_png.vtex");
|
||||
img.style.width = "12px";
|
||||
img.style.height = "12px";
|
||||
img.style.x = (12* (j-1)).toString() + "px";
|
||||
img.style["horizontal-align"] = "left";
|
||||
img.style["vertical-align"] = "bottom";
|
||||
itemList[i][j] = img;
|
||||
img.visible = false;
|
||||
}
|
||||
}
|
||||
list = inventory.FindChildTraverse("inventory_list2");
|
||||
for ( var i = 3; i <= 5; i++ ) {
|
||||
var slot = list.FindChildTraverse("inventory_slot_" + i.toString());
|
||||
var item = slot.FindChildTraverse("AbilityButton");
|
||||
|
||||
itemList[i] = item;
|
||||
|
||||
var labelmodifier = $.CreatePanel("Label", item, "labellevel");
|
||||
itemList[i][6] = labelmodifier;
|
||||
labelmodifier.style.width = "16px";
|
||||
labelmodifier.style.height = "16px";
|
||||
labelmodifier.style.color = "#FFCC33";
|
||||
labelmodifier.style["horizontal-align"] = "right";
|
||||
labelmodifier.style["vertical-align"] = "top";
|
||||
labelmodifier.style["font-size"] = "16px";
|
||||
labelmodifier.style["text-shadow"] = "0px 0px 4px 4 #000000";
|
||||
labelmodifier.style["letter-spacing"] = "0 px";
|
||||
labelmodifier.text = "";
|
||||
|
||||
|
||||
for ( var j = 1; j <= 5; j++ )
|
||||
{
|
||||
var img = $.CreatePanel("Image", item, "Image_" + j.toString());
|
||||
var imgNum = "Image_"+j.toString();
|
||||
img.SetImage("s2r://panorama/images/custom_game/star_png.vtex");
|
||||
img.style.width = "12px";
|
||||
img.style.height = "12px";
|
||||
img.style.x = (12* (j-1)).toString() + "px";
|
||||
img.style["horizontal-align"] = "left";
|
||||
img.style["vertical-align"] = "bottom";
|
||||
itemList[i][j] = img;
|
||||
img.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
CustomPanelRefresh();
|
||||
|
||||
GameEvents.Subscribe("dota_inventory_changed", OnDotaInventoryChanged);
|
||||
GameEvents.Subscribe("dota_inventory_item_changed", OnDotaInventoryChanged);
|
||||
// GameEvents.Subscribe("dota_player_update_selected_unit", OnDotaPlayerUpdateSelectedUnit);
|
||||
// GameEvents.Subscribe("dota_player_update_query_unit", OnDotaPlayerUpdateSelectedUnit); //点击单位
|
||||
// GameEvents.Subscribe("thtd_power_update", CustomPowerPanelRefresh);
|
||||
// GameEvents.Subscribe("dota_portrait_unit_modifiers_changed", OnDotaPortraitUnitModifiersChanged);
|
||||
})();
|
||||
|
||||
|
||||
function OnDotaInventoryChanged(data) {
|
||||
// 背包有物品称动、入、出均可触发
|
||||
CustomStarPanelRefresh();
|
||||
}
|
||||
|
||||
// function OnDotaPlayerUpdateSelectedUnit(data) {
|
||||
// CustomPowerPanelRefresh();
|
||||
// CustomStarPanelRefresh();
|
||||
// }
|
||||
|
||||
// function OnDotaPortraitUnitModifiersChanged(data) {
|
||||
// CustomPowerPanelRefresh();
|
||||
// }
|
||||
|
||||
|
||||
75
panorama/scripts/custom_game/shop.js
Normal file
75
panorama/scripts/custom_game/shop.js
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
|
||||
var ShopUnit = -1;
|
||||
|
||||
function Update() {
|
||||
var gold = Players.GetGold(Players.GetLocalPlayer()) + Players.GetLastBuybackTime(Players.GetLocalPlayer());
|
||||
$("#GoldText").text = gold;
|
||||
|
||||
var AbilityList = $("#AbilityList");
|
||||
var max = AbilityList.GetChildCount();
|
||||
for (var i = 0; i < max; i++) {
|
||||
var panel = AbilityList.GetChild(i);
|
||||
panel.SetHasClass("CanBuy", gold >= panel.GetAttributeInt("Gold", 0));
|
||||
}
|
||||
|
||||
$.Schedule(0.2, Update);
|
||||
}
|
||||
|
||||
if (!Players.IsSpectator(Players.GetLocalPlayer())) {
|
||||
Update();
|
||||
} else {
|
||||
$("#ShopContent").DeleteAsync(0.0);
|
||||
$("#BottomBar").DeleteAsync(0.0);
|
||||
}
|
||||
|
||||
// 获取商店单位
|
||||
$.Schedule(5, function () {
|
||||
if (Players.IsSpectator(Players.GetLocalPlayer())) {
|
||||
return;
|
||||
}
|
||||
var unitList = Entities.GetAllEntitiesByClassname("npc_dota_creature");
|
||||
for (var i = 0; i < unitList.length; i++) {
|
||||
if (Entities.GetUnitName(unitList[i]) === "minoriko_shop" &&
|
||||
Entities.IsControllableByPlayer(unitList[i], Players.GetLocalPlayer())) {
|
||||
ShopUnit = unitList[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function setAbilityEvent( panel ) {
|
||||
panel.SetDraggable(true);
|
||||
panel.SetPanelEvent("onmouseover", function () {
|
||||
$.DispatchEvent("DOTAShowAbilityTooltip", panel, panel.abilityname);
|
||||
});
|
||||
panel.SetPanelEvent("onmouseout", function () {
|
||||
$.DispatchEvent("DOTAHideAbilityTooltip");
|
||||
});
|
||||
panel.SetPanelEvent("oncontextmenu", function () {
|
||||
Game.PrepareUnitOrders({
|
||||
OrderType: dotaunitorder_t.DOTA_UNIT_ORDER_CAST_NO_TARGET,
|
||||
UnitIndex: ShopUnit,
|
||||
AbilityIndex: panel.contextEntityIndex,
|
||||
OrderIssuer: PlayerOrderIssuer_t.DOTA_ORDER_ISSUER_PASSED_UNIT_ONLY,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var AbilityList = $("#AbilityList");
|
||||
for (var i = 0; i < 7; i++) {
|
||||
var ability = Entities.GetAbility( ShopUnit, i )
|
||||
if (ability > 0) {
|
||||
// var abilityname = Abilities.GetAbilityName(ability);
|
||||
if (Abilities.IsHidden(ability) || Abilities.IsAutocast(ability)) continue;
|
||||
var panel = $.CreatePanel("DOTAAbilityImage", AbilityList, "");
|
||||
var gold = Abilities.GetSpecialValueFor(ability, "cost") || 0;
|
||||
panel.contextEntityIndex = ability;
|
||||
panel.SetAttributeInt("Gold", gold);
|
||||
setAbilityEvent( panel );
|
||||
|
||||
var label = $.CreatePanel("Label", panel, "");
|
||||
label.text = gold
|
||||
label.AddClass("Gold");
|
||||
}
|
||||
}
|
||||
})
|
||||
1070
panorama/scripts/custom_game/team_select.js
Normal file
1070
panorama/scripts/custom_game/team_select.js
Normal file
File diff suppressed because it is too large
Load Diff
259
panorama/scripts/custom_game/team_select_card.js
Normal file
259
panorama/scripts/custom_game/team_select_card.js
Normal file
@@ -0,0 +1,259 @@
|
||||
|
||||
|
||||
// 卡池中的卡片事件
|
||||
function setCardPoolEvent(panel, card) {
|
||||
panel.SetPanelEvent("oncontextmenu", function () {
|
||||
if (card.IsDisabled() || ShowingCardGroup) return;
|
||||
card.Select();
|
||||
})
|
||||
panel.SetPanelEvent("ondblclick", function () {
|
||||
if (card.IsDisabled() || ShowingCardGroup) return;
|
||||
card.Select();
|
||||
})
|
||||
panel.SetPanelEvent("onactivate", function () {
|
||||
card.ShowInfo();
|
||||
Game.EmitSound("UI.ClickCard");
|
||||
})
|
||||
}
|
||||
|
||||
function TouhouCard( parent, itemName, itemData, isPreview ) {
|
||||
var panel = $.CreatePanel("Panel", parent, "");
|
||||
panel.BLoadLayoutSnippet("CardPoolCard");
|
||||
setCardPoolEvent(panel, this);
|
||||
|
||||
panel.SetDialogVariable("remaining_count", "0");
|
||||
panel.SetDialogVariable("level", "0");
|
||||
panel.SetAttributeString("itemname", itemName);
|
||||
panel.SetHasClass(GetQualityText(itemData.quality), true);
|
||||
panel.FindChild("CardBackGround").SetImage("s2r://panorama/images/custom_game/cards/item_" + GetQualityText(itemData.quality) + "_png.vtex");
|
||||
panel.FindChild("CardImage").SetImage("s2r://panorama/images/custom_game/cards/" + itemData.cardname + "_png.vtex");
|
||||
|
||||
this.hPanel = panel;
|
||||
this.szItemName = itemName;
|
||||
this.hItemData = itemData;
|
||||
this.bIsItem = itemData.cardname.indexOf("item_") === 0;
|
||||
this.nSelectedCount = 0;
|
||||
if (itemName === "item_2021" || itemName === "item_2022")
|
||||
this.nMaxCount = 1;
|
||||
else if (isPreview)
|
||||
this.nMaxCount = 0;
|
||||
else
|
||||
this.nMaxCount = GetSingleCardMaxCount(itemData.quality, this.bIsItem);
|
||||
|
||||
if (this.bIsItem) {
|
||||
panel.GetChild(panel.GetChildCount() - 1).visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 物品名称
|
||||
TouhouCard.prototype.GetItemName = function() {
|
||||
return this.szItemName
|
||||
};
|
||||
|
||||
//
|
||||
TouhouCard.prototype.GetItemData = function() {
|
||||
return this.hItemData
|
||||
};
|
||||
|
||||
// 获取已选数量
|
||||
TouhouCard.prototype.GetSelectedCount = function() {
|
||||
return this.nSelectedCount
|
||||
};
|
||||
|
||||
// 获取品质
|
||||
TouhouCard.prototype.GetQuality = function() {
|
||||
return this.hItemData.quality
|
||||
};
|
||||
|
||||
// 更新卡牌
|
||||
TouhouCard.prototype.Update = function() {
|
||||
var itemname = this.szItemName;
|
||||
var isItem = this.bIsItem;
|
||||
var quality = this.hItemData.quality;
|
||||
var singleCount = this.nSelectedCount;
|
||||
var maxCount = this.nMaxCount;
|
||||
var remainingCount = maxCount - singleCount;
|
||||
var panel = this.hPanel;
|
||||
|
||||
// 设置剩余数量
|
||||
if (ShowingCardGroup) {
|
||||
this.nSelectedCount = 0;
|
||||
panel.SetDialogVariable("remaining_count", maxCount.toString());
|
||||
} else {
|
||||
panel.SetDialogVariable("remaining_count", remainingCount.toString());
|
||||
}
|
||||
|
||||
if (!isItem) {
|
||||
var level = GameUI.PowerLevel && GameUI.PowerLevel[itemname] ? GameUI.PowerLevel[itemname] : 0;
|
||||
panel.SetDialogVariable("level", level.toString());
|
||||
panel.GetChild(panel.GetChildCount() - 1).visible = level > 0;
|
||||
}
|
||||
|
||||
if (quality === 4) Current_SSR_Count = FindCardCount(4);
|
||||
else if (quality === 3) Current_SR_Count = FindCardCount(3);
|
||||
else if (quality === 2) Current_R_Count = FindCardCount(2);
|
||||
else if (quality === 1) Current_N_Count = FindCardCount(1);
|
||||
|
||||
// 设置禁用状态
|
||||
if (ShowingCardGroup) {
|
||||
panel.SetHasClass("disable", true);
|
||||
|
||||
} else if (remainingCount <= 0) {
|
||||
panel.SetHasClass("disable", true);
|
||||
|
||||
} else if (quality === 4) {
|
||||
panel.SetHasClass("disable", (Current_SSR_Count === CardCount_SSR) || singleCount >= maxCount);
|
||||
|
||||
} else if (quality === 3) {
|
||||
panel.SetHasClass("disable", (Current_SR_Count === CardCount_SR) || singleCount >= maxCount);
|
||||
|
||||
} else if (quality === 2) {
|
||||
panel.SetHasClass("disable", (Current_R_Count === CardCount_R) || singleCount >= maxCount);
|
||||
|
||||
} else if (quality === 1) {
|
||||
panel.SetHasClass("disable", (Current_N_Count >= MaxCardCount_N) || singleCount >= maxCount);
|
||||
}
|
||||
};
|
||||
|
||||
// 是否为禁用状态
|
||||
TouhouCard.prototype.IsDisabled = function() {
|
||||
return this.hPanel.BHasClass("disable");
|
||||
};
|
||||
|
||||
// 选择卡牌
|
||||
TouhouCard.prototype.Select = function() {
|
||||
var count = FindCardCount(quality);
|
||||
if (count >= GetQualityMaxCount(quality)) return;
|
||||
|
||||
var data = this.hItemData;
|
||||
var quality = data.quality;
|
||||
var itemname = this.szItemName;
|
||||
var singleCount = this.nSelectedCount;
|
||||
var maxCount = this.nMaxCount;
|
||||
var isItem = this.bIsItem;
|
||||
|
||||
if (singleCount >= maxCount) {
|
||||
this.Update();
|
||||
return;
|
||||
}
|
||||
|
||||
this.nSelectedCount++;
|
||||
|
||||
UpdateSelectedCards(itemname);
|
||||
UpdateCardPool();
|
||||
|
||||
Game.EmitSound('UI.SelectCard');
|
||||
};
|
||||
|
||||
// 移除卡牌
|
||||
TouhouCard.prototype.Remove = function() {
|
||||
this.nSelectedCount--;
|
||||
if (this.nSelectedCount < 0) this.nSelectedCount = 0;
|
||||
UpdateCardPool();
|
||||
};
|
||||
|
||||
// 显示查看卡牌信息
|
||||
TouhouCard.prototype.ShowInfo = function() {
|
||||
if (LastShowInfoCard) {
|
||||
LastShowInfoCard.hPanel.SetHasClass("ShowInfo", false);
|
||||
}
|
||||
this.hPanel.SetHasClass("ShowInfo", true);
|
||||
LastShowInfoCard = this;
|
||||
|
||||
var data = this.hItemData;
|
||||
var isItem = this.bIsItem;
|
||||
var quality = data.quality;
|
||||
if ( isItem ) {
|
||||
$("#CardInfoName").text = $.Localize("DOTA_Tooltip_ability_" + data.cardname);
|
||||
} else {
|
||||
$("#CardInfoName").text = $.Localize(data.cardname);
|
||||
}
|
||||
|
||||
var CardInfoContent = $("#CardInfoContent");
|
||||
var Card = CardInfoContent.GetChild(0);
|
||||
Card.SetHasClass("SwapCard", false);
|
||||
Card.SetHasClass("SwapCard", true);
|
||||
Card.SetHasClass("SSR", false);
|
||||
Card.SetHasClass("SR", false);
|
||||
Card.SetHasClass("R", false);
|
||||
Card.SetHasClass("N", false);
|
||||
Card.SetHasClass(GetQualityText(quality), true);
|
||||
if (data.cardname.indexOf("item_") === 0) {
|
||||
Card.FindChildTraverse("CardImage").SetImage("s2r://panorama/images/custom_game/cards/" + data.cardname + "_png.vtex");
|
||||
} else {
|
||||
Card.FindChildTraverse("CardImage").SetImage("s2r://panorama/images/custom_game/cards/" + data.cardname + "_big_png.vtex");
|
||||
}
|
||||
|
||||
if (GameUI.LuckCardCrit > 0 && (data.cardname === GameUI.LuckCardName || GameUI.LuckCardName === "all")) {
|
||||
Card.FindChildTraverse("CardName").SetImage("s2r://panorama/images/custom_game/cards/luck_png.vtex");
|
||||
} else {
|
||||
Card.FindChildTraverse("CardName").SetImage("s2r://panorama/images/custom_game/cards/" + data.cardname + "_name_png.vtex");
|
||||
}
|
||||
|
||||
Card.FindChildTraverse("CardBackGround").SetImage("s2r://panorama/images/custom_game/cards/item_" + GetQualityText(quality) + "_png.vtex");
|
||||
|
||||
// 特效
|
||||
var CardEffect = Card.FindChildTraverse("CardEffect");
|
||||
CardEffect.FireEntityInput("SSR", "StopPlayEndCap", "1");
|
||||
CardEffect.FireEntityInput("SR", "StopPlayEndCap", "1");
|
||||
CardEffect.FireEntityInput(GetQualityText(quality), "Start", "1");
|
||||
|
||||
// 显示培养按钮
|
||||
|
||||
var decomposeValue = 0;
|
||||
if (quality === 1)
|
||||
decomposeValue = 5;
|
||||
else
|
||||
decomposeValue = 10;
|
||||
|
||||
var DecomposeCardButton = $("#DecomposeCardButton");
|
||||
DecomposeCardButton.enabled = !isItem && decomposeValue > 0;
|
||||
DecomposeCardButton.SetDialogVariableInt("amount", decomposeValue);
|
||||
|
||||
// 显示技能
|
||||
var CardAbilities = $("#CardAbilities");
|
||||
var index = 0;
|
||||
if (isItem) {
|
||||
$("#CardInfoItem").visible = true;
|
||||
$("#CardInfoItem").itemname = data.cardname;
|
||||
} else {
|
||||
$("#CardInfoItem").visible = false;
|
||||
|
||||
// 显示技能
|
||||
for (var i = 0; i < 8; i++) {
|
||||
var abilityname = "thtd_" + data.cardname + "_0" + i;
|
||||
var key = "DOTA_Tooltip_ability_" + abilityname;
|
||||
var nameText = $.Localize(key);
|
||||
if (nameText !== key) {
|
||||
if (nameText.substr(0, 5) === "link_") {
|
||||
key = nameText.substr(5, nameText.length - 5);
|
||||
abilityname = key.substr("DOTA_Tooltip_ability_".length, key.length - "DOTA_Tooltip_ability_".length);
|
||||
nameText = $.Localize(key);
|
||||
}
|
||||
var panel = CardAbilities.GetChild(index++);
|
||||
if (!panel) {
|
||||
var panel = $.CreatePanel("Panel", CardAbilities, "");
|
||||
panel.BLoadLayoutSnippet("CardAbility");
|
||||
(function (main) {
|
||||
main.SetPanelEvent("onmouseover", function () {
|
||||
var name = main.GetAttributeString("abilityname", "");
|
||||
$.DispatchEvent("DOTAShowAbilityTooltip", main, name);
|
||||
});
|
||||
main.SetPanelEvent("onmouseout", function () {
|
||||
$.DispatchEvent("DOTAHideAbilityTooltip");
|
||||
});
|
||||
})(panel)
|
||||
}
|
||||
panel.SetAttributeString("abilityname", abilityname);
|
||||
panel.FindChildTraverse("AbilityImage").abilityname = abilityname;
|
||||
panel.FindChildTraverse("AbilityName").text = nameText;
|
||||
panel.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var max = CardAbilities.GetChildCount();
|
||||
for (var i = index; i < max; i++) {
|
||||
CardAbilities.GetChild(i).visible = false;
|
||||
}
|
||||
};
|
||||
67
panorama/scripts/custom_game/util.js
Normal file
67
panorama/scripts/custom_game/util.js
Normal file
@@ -0,0 +1,67 @@
|
||||
var DOTA_TEAM_SPECTATOR = 1;
|
||||
|
||||
function GetDotaHud() {
|
||||
var p = $.GetContextPanel();
|
||||
while (p !== null && p.id !== 'Hud') {
|
||||
p = p.GetParent();
|
||||
}
|
||||
if (p === null) {
|
||||
throw new HudNotFoundException('Could not find Hud root as parent of panel with id: ' + $.GetContextPanel().id);
|
||||
} else {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
function SubscribeToNetTableKey(tableName, key, callback) {
|
||||
var immediateValue = CustomNetTables.GetTableValue(tableName, key) || {};
|
||||
if (immediateValue != null) callback(immediateValue);
|
||||
CustomNetTables.SubscribeNetTableListener(tableName, function (_tableName, currentKey, value) {
|
||||
if (currentKey === key && value != null) callback(value);
|
||||
});
|
||||
}
|
||||
|
||||
function FindDotaHudElement(id) {
|
||||
return GetDotaHud().FindChildTraverse(id);
|
||||
}
|
||||
|
||||
function GetHEXPlayerColor(playerId) {
|
||||
var playerColor = Players.GetPlayerColor(playerId).toString(16);
|
||||
return playerColor == null ? '#000000' : ('#' + playerColor.substring(6, 8) + playerColor.substring(4, 6) + playerColor.substring(2, 4) + playerColor.substring(0, 2));
|
||||
}
|
||||
|
||||
function secondsToMS(seconds, bTwoChars) {
|
||||
var sec_num = parseInt(seconds, 10);
|
||||
var minutes = Math.floor(sec_num / 60);
|
||||
var seconds = Math.floor(sec_num - minutes * 60);
|
||||
|
||||
if (bTwoChars && minutes < 10)
|
||||
minutes = '0' + minutes;
|
||||
if (seconds < 10)
|
||||
seconds = '0' + seconds;
|
||||
return minutes + ':' + seconds;
|
||||
}
|
||||
|
||||
function dynamicSort(property) {
|
||||
var sortOrder = 1;
|
||||
if (property[0] === "-") {
|
||||
sortOrder = -1;
|
||||
property = property.substr(1);
|
||||
}
|
||||
return function(a, b) {
|
||||
var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;
|
||||
return result * sortOrder;
|
||||
}
|
||||
}
|
||||
|
||||
function SortPanelChildren(panel, sortFunc, compareFunc) {
|
||||
var tlc = panel.Children().sort(sortFunc)
|
||||
$.Each(tlc, function(child) {
|
||||
for (var k in tlc) {
|
||||
var child2 = tlc[k]
|
||||
if (child != child2 && compareFunc(child, child2)) {
|
||||
panel.MoveChildBefore(child, child2)
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -586,7 +586,7 @@
|
||||
"DOTA_Tooltip_ability_item_2010" "Reaper's Scythe"
|
||||
"DOTA_Tooltip_ability_item_2010_Description" "[Single Item Effect]+10 POWER POINT +5%% Physical Damage\n\n[Set of 2] +25 POWER POINT 15%% Physical Damage\n\n[Set of 4]Deals 2x Damage to enemy under 30%% health"
|
||||
"DOTA_Tooltip_ability_item_2011" "Moon Rabbit Smashing Blade"
|
||||
"DOTA_Tooltip_ability_item_2011_Description" "[Single Item Effect]PROMOTE 20 ATTACK DAMAGE, 10 POWER POINTS\n\n[Double Item Effect]PROMOTE 50 ATTACK DAMAGE 25 POWER POINT\n\n[Quadruple Item Effect]PROMOTE 150%% AND SPLASH ATTACK IN 400 RANGE"
|
||||
"DOTA_Tooltip_ability_item_2011_Description" "[Single Item Effect]PROMOTE 20 ATTACK DAMAGE, 10 POWER POINTS\n\n[Double Item Effect]PROMOTE 50 ATTACK DAMAGE 25 POWER POINT\n\n[Quadruple Item Effect]PROMOTE 150%% CRIT DAMAGE AND SPLASH ATTACK IN 400 RANGE"
|
||||
"DOTA_Tooltip_ability_item_2012" "Mini-Hakkero"
|
||||
"DOTA_Tooltip_ability_item_2012_Description" "[Single Item Effect]PROMOTE 10%% MAGIC SKILL DAMAGE\n\n[Double Item Effect]PROMOTE 25%% MAGIC SKILL DAMAGE\n\n[Quadruple Item Effect]ENEMIES IN 1000 DISTANCES GET 120% MAGIC SKILL DAMAGES"
|
||||
"DOTA_Tooltip_ability_item_2013" "L?vateinn"
|
||||
|
||||
Reference in New Issue
Block a user