Merge branch 'map' of https://gitea.mota.press/Dove/Eustia into map
This commit is contained in:
		
						commit
						18e4f13a54
					
				| @ -128,6 +128,12 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { | |||||||
| 				"_type": "textarea", | 				"_type": "textarea", | ||||||
| 				"_range": "typeof(thiseval)=='string' || thiseval==null", | 				"_range": "typeof(thiseval)=='string' || thiseval==null", | ||||||
| 				"_data": "背景音乐拼接" | 				"_data": "背景音乐拼接" | ||||||
|  | 			}, | ||||||
|  | 			"scrollingText": { | ||||||
|  | 				"_leaf": true, | ||||||
|  | 				"_type": "textarea", | ||||||
|  | 				"_range": "typeof(thiseval)=='string' || thiseval==null", | ||||||
|  | 				"_data": "接收&发送在线留言" | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		if (obj[key]) return obj[key]; | 		if (obj[key]) return obj[key]; | ||||||
|  | |||||||
| @ -1521,7 +1521,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = | |||||||
| 	}, | 	}, | ||||||
| 	"firstData": { | 	"firstData": { | ||||||
| 		"title": "秽翼的尤斯蒂娅", | 		"title": "秽翼的尤斯蒂娅", | ||||||
| 		"name": "Eustia", | 		"name": "Eustia_text", | ||||||
| 		"version": "鸽子窝造塔小队", | 		"version": "鸽子窝造塔小队", | ||||||
| 		"floorId": "jiaocheng01", | 		"floorId": "jiaocheng01", | ||||||
| 		"hero": { | 		"hero": { | ||||||
| @ -1936,7 +1936,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = | |||||||
| 			}, | 			}, | ||||||
| 			{ | 			{ | ||||||
| 				"type": "function", | 				"type": "function", | ||||||
| 				"function": "function(){\ncore.getItem('book', 1);\ncore.getItem('fly', 1);\n}" | 				"function": "function(){\ncore.getItem('book', 1);\ncore.getItem('fly', 1);\ncore.getItem('postman', 1);\ncore.getItem('I369', 1);\n}" | ||||||
| 			}, | 			}, | ||||||
| 			{ | 			{ | ||||||
| 				"type": "insert", | 				"type": "insert", | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| main.floors.jiaocheng01= | main.floors.jiaocheng01= | ||||||
| { | { | ||||||
|     "floorId": "jiaocheng01", |     "floorId": "jiaocheng01", | ||||||
|     "title": "广场", |     "title": "教程1", | ||||||
|     "name": "1", |     "name": "1", | ||||||
|     "width": 13, |     "width": 13, | ||||||
|     "height": 13, |     "height": 13, | ||||||
| @ -142,7 +142,7 @@ main.floors.jiaocheng01= | |||||||
|     [129,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,129], |     [129,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,129], | ||||||
|     [  1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1] |     [  1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1] | ||||||
| ], | ], | ||||||
|     "areas": "牢狱", |     "areas": "教程", | ||||||
|     "bgmap": [ |     "bgmap": [ | ||||||
| 
 | 
 | ||||||
| ], | ], | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| main.floors.jiaocheng02= | main.floors.jiaocheng02= | ||||||
| { | { | ||||||
|     "floorId": "jiaocheng02", |     "floorId": "jiaocheng02", | ||||||
|     "title": "广场", |     "title": "教程2", | ||||||
|     "name": "1", |     "name": "1", | ||||||
|     "width": 13, |     "width": 13, | ||||||
|     "height": 13, |     "height": 13, | ||||||
| @ -118,7 +118,7 @@ main.floors.jiaocheng02= | |||||||
|     [  0, 81,  0,  1,217,  1,  0,  1,  1, 81,  1,  1, 21], |     [  0, 81,  0,  1,217,  1,  0,  1,  1, 81,  1,  1, 21], | ||||||
|     [216,  0,  0, 21,  0,  1, 93,  1, 27,  0, 27,  1, 21] |     [216,  0,  0, 21,  0,  1, 93,  1, 27,  0, 27,  1, 21] | ||||||
| ], | ], | ||||||
|     "areas": "牢狱", |     "areas": "教程", | ||||||
|     "bgmap": [ |     "bgmap": [ | ||||||
| 
 | 
 | ||||||
| ], | ], | ||||||
|  | |||||||
| @ -192,6 +192,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 			core.plugin.bfs(); | 			core.plugin.bfs(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	if (!core.isReplaying()) core.plugin.drawCommentSign() | ||||||
| }, | }, | ||||||
|         "flyTo": function (toId, callback) { |         "flyTo": function (toId, callback) { | ||||||
| 	// 楼层传送器的使用,从当前楼层飞往toId
 | 	// 楼层传送器的使用,从当前楼层飞往toId
 | ||||||
| @ -2022,6 +2023,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 		nowy = core.getHeroLoc("y"); | 		nowy = core.getHeroLoc("y"); | ||||||
| 	var block = core.getBlock(nowx, nowy); | 	var block = core.getBlock(nowx, nowy); | ||||||
| 	var hasTrigger = false; | 	var hasTrigger = false; | ||||||
|  | 	core.showComment(nowx, nowy) | ||||||
| 	if ( | 	if ( | ||||||
| 		block != null && | 		block != null && | ||||||
| 		block.event.trigger == "getItem" && | 		block.event.trigger == "getItem" && | ||||||
| @ -2061,7 +2063,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 			core.status.hero.statistics.poisonDamage += damage; | 			core.status.hero.statistics.poisonDamage += damage; | ||||||
| 			core.status.hero.hp -= damage; | 			core.status.hero.hp -= damage; | ||||||
| 		} | 		} | ||||||
| 
 | 		core.showComment(x, y) | ||||||
| 		core.clearMap("hero"); | 		core.clearMap("hero"); | ||||||
| 		if ( | 		if ( | ||||||
| 			core.bigmap.width * 32 === core.bigmap.height * 32 && | 			core.bigmap.width * 32 === core.bigmap.height * 32 && | ||||||
|  | |||||||
| @ -326,7 +326,8 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = | |||||||
| 		"I373": 36, | 		"I373": 36, | ||||||
| 		"I374": 37, | 		"I374": 37, | ||||||
| 		"I375": 38, | 		"I375": 38, | ||||||
| 		"I396": 39 | 		"I396": 39, | ||||||
|  | 		"postman": 62 | ||||||
| 	}, | 	}, | ||||||
| 	"autotile": { | 	"autotile": { | ||||||
| 		"autotile": 0, | 		"autotile": 0, | ||||||
|  | |||||||
| @ -529,9 +529,31 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = | |||||||
| 		"canUseItemEffect": "true" | 		"canUseItemEffect": "true" | ||||||
| 	}, | 	}, | ||||||
| 	"I369": { | 	"I369": { | ||||||
| 		"cls": "items", | 		"cls": "constants", | ||||||
| 		"name": "新物品", | 		"name": "动画开关", | ||||||
| 		"canUseItemEffect": "true" | 		"canUseItemEffect": "true", | ||||||
|  | 		"hideInToolbox": true, | ||||||
|  | 		"hideInReplay": true, | ||||||
|  | 		"useItemEvent": [ | ||||||
|  | 			{ | ||||||
|  | 				"type": "confirm", | ||||||
|  | 				"text": "是否开启战斗动画", | ||||||
|  | 				"yes": [ | ||||||
|  | 					{ | ||||||
|  | 						"type": "setValue", | ||||||
|  | 						"name": "flag:noAnimate", | ||||||
|  | 						"value": "false" | ||||||
|  | 					} | ||||||
|  | 				], | ||||||
|  | 				"no": [ | ||||||
|  | 					{ | ||||||
|  | 						"type": "setValue", | ||||||
|  | 						"name": "flag:noAnimate", | ||||||
|  | 						"value": "true" | ||||||
|  | 					} | ||||||
|  | 				] | ||||||
|  | 			} | ||||||
|  | 		] | ||||||
| 	}, | 	}, | ||||||
| 	"I370": { | 	"I370": { | ||||||
| 		"cls": "items", | 		"cls": "items", | ||||||
| @ -576,5 +598,67 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = | |||||||
| 		"cls": "items", | 		"cls": "items", | ||||||
| 		"name": "新物品", | 		"name": "新物品", | ||||||
| 		"canUseItemEffect": "true" | 		"canUseItemEffect": "true" | ||||||
|  | 	}, | ||||||
|  | 	"postman": { | ||||||
|  | 		"cls": "constants", | ||||||
|  | 		"name": "言灵", | ||||||
|  | 		"canUseItemEffect": "true", | ||||||
|  | 		"text": "可以发送和接收在线留言。", | ||||||
|  | 		"hideInToolbox": true, | ||||||
|  | 		"hideInReplay": true, | ||||||
|  | 		"useItemEvent": [ | ||||||
|  | 			{ | ||||||
|  | 				"type": "while", | ||||||
|  | 				"condition": "true", | ||||||
|  | 				"data": [ | ||||||
|  | 					{ | ||||||
|  | 						"type": "choices", | ||||||
|  | 						"text": "本功能需要您在h5mota.com在线游玩并处于登录状态时使用,可以发送和接受留言。\n发言后需要选择\"获取最新留言\"才能看到自己新发的留言。", | ||||||
|  | 						"choices": [ | ||||||
|  | 							{ | ||||||
|  | 								"text": "地图上显示在线留言:${flag:comment?'开':'关'}", | ||||||
|  | 								"icon": "postman", | ||||||
|  | 								"action": [ | ||||||
|  | 									{ | ||||||
|  | 										"type": "function", | ||||||
|  | 										"function": "function(){\nif (core.hasFlag('comment')) {\n\tcore.setFlag('comment', false);\n\tcore.plugin.clearCommentSign();\n} else {\n\tcore.setFlag('comment', true);\n\tcore.plugin.drawCommentSign();\n}\n}" | ||||||
|  | 									} | ||||||
|  | 								] | ||||||
|  | 							}, | ||||||
|  | 							{ | ||||||
|  | 								"text": "写留言", | ||||||
|  | 								"action": [ | ||||||
|  | 									{ | ||||||
|  | 										"type": "input2", | ||||||
|  | 										"text": "请输入要发送的评论,文明友善发言,拒绝放假、剧透。" | ||||||
|  | 									}, | ||||||
|  | 									{ | ||||||
|  | 										"type": "function", | ||||||
|  | 										"function": "function(){\nconst input = core.getFlag('input', '');\nconst tags = [core.status.floorId,\n\tcore.getHeroLoc().x.toString(), core.getHeroLoc().y.toString()\n]\nif (!core.isReplaying()) {\n\tcore.plugin.postComment(input, tags);\n}\n}" | ||||||
|  | 									} | ||||||
|  | 								] | ||||||
|  | 							}, | ||||||
|  | 							{ | ||||||
|  | 								"text": "获取最新留言", | ||||||
|  | 								"action": [ | ||||||
|  | 									{ | ||||||
|  | 										"type": "function", | ||||||
|  | 										"function": "function(){\nif (!core.isReplaying()) {\n\tcore.plugin.getComment();\n\tsetTimeout(core.plugin.drawCommentSign, 1000);\n}\n}" | ||||||
|  | 									} | ||||||
|  | 								] | ||||||
|  | 							}, | ||||||
|  | 							{ | ||||||
|  | 								"text": "退出", | ||||||
|  | 								"action": [ | ||||||
|  | 									{ | ||||||
|  | 										"type": "exit" | ||||||
|  | 									} | ||||||
|  | 								] | ||||||
|  | 							} | ||||||
|  | 						] | ||||||
|  | 					} | ||||||
|  | 				] | ||||||
|  | 			} | ||||||
|  | 		] | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @ -295,6 +295,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e = | |||||||
| 	"394": {"cls":"terrains","id":"T394"}, | 	"394": {"cls":"terrains","id":"T394"}, | ||||||
| 	"395": {"cls":"terrains","id":"T395"}, | 	"395": {"cls":"terrains","id":"T395"}, | ||||||
| 	"396": {"cls":"items","id":"I396"}, | 	"396": {"cls":"items","id":"I396"}, | ||||||
|  | 	"397": {"cls":"items","id":"postman"}, | ||||||
| 	"20034": {"cls":"tileset","id":"X20034","canPass":true}, | 	"20034": {"cls":"tileset","id":"X20034","canPass":true}, | ||||||
| 	"20154": {"cls":"tileset","id":"X20154","canPass":true}, | 	"20154": {"cls":"tileset","id":"X20154","canPass":true}, | ||||||
| 	"20216": {"cls":"tileset","id":"X20216","canPass":true}, | 	"20216": {"cls":"tileset","id":"X20216","canPass":true}, | ||||||
|  | |||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 22 KiB | 
| @ -2912,7 +2912,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 			//道具栏列表
 | 			//道具栏列表
 | ||||||
| 			this.itemMx = [ | 			this.itemMx = [ | ||||||
| 				//空位用‘none’填充,当前ui至多4列6行
 | 				//空位用‘none’填充,当前ui至多4列6行
 | ||||||
| 				["book", "wand", "none", "fly"], | 				["book", "postman", "I369", "fly"], | ||||||
| 				["cross", "superPotion", "pickaxe"], | 				["cross", "superPotion", "pickaxe"], | ||||||
| 				["bomb", "centerFly", "upFly"], | 				["bomb", "centerFly", "upFly"], | ||||||
| 				["none", "none", "none"], | 				["none", "none", "none"], | ||||||
| @ -2929,7 +2929,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 					core.openToolbox, | 					core.openToolbox, | ||||||
| 					core.doSL, | 					core.doSL, | ||||||
| 				], | 				], | ||||||
| 				[main.core.openSettings, main.core.save, main.core.load, core.doSL], | 				[main.core.save, main.core.load, main.core.openSettings, core.doSL], | ||||||
| 			]; | 			]; | ||||||
| 			this.replayAction = [ | 			this.replayAction = [ | ||||||
| 				[core.triggerReplay, core.stopReplay, core.rewindReplay], | 				[core.triggerReplay, core.stopReplay, core.rewindReplay], | ||||||
| @ -3561,7 +3561,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 				["speedDown", "speedUp", "save"], | 				["speedDown", "speedUp", "save"], | ||||||
| 			] : [ | 			] : [ | ||||||
| 				["keyboard", "shop", "pack", "T332"], | 				["keyboard", "shop", "pack", "T332"], | ||||||
| 				["settings", "save", "load", "T331"], | 				["save", "load", "settings", "T331"], | ||||||
| 			]; | 			]; | ||||||
| 			if (core.domStyle.isVertical) { | 			if (core.domStyle.isVertical) { | ||||||
| 				core.clearMap( | 				core.clearMap( | ||||||
| @ -3630,15 +3630,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 					case "book": | 					case "book": | ||||||
| 						core.openBook(true); | 						core.openBook(true); | ||||||
| 						break; | 						break; | ||||||
| 					case "wand": |  | ||||||
| 						core.insertAction({ |  | ||||||
| 							type: "useItem", |  | ||||||
| 							id: itemId, |  | ||||||
| 						}); |  | ||||||
| 						break; |  | ||||||
| 					case "fly": |  | ||||||
| 						core.useItem(itemId); |  | ||||||
| 						break; |  | ||||||
| 					default: | 					default: | ||||||
| 						core.useItem(itemId); | 						core.useItem(itemId); | ||||||
| 					} | 					} | ||||||
| @ -4499,6 +4490,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 		core.actions._sys_ondown_lockControl, | 		core.actions._sys_ondown_lockControl, | ||||||
| 		30 | 		30 | ||||||
| 	); | 	); | ||||||
|  | 	////// 绘制提示同时播放错误音效 //////
 | ||||||
|  | 	ui.prototype.drawFailTip = function (text, id, frame) { | ||||||
|  | 		this.drawTip(text, id, frame); | ||||||
|  | 		core.playSound('error.mp3'); | ||||||
|  | 	} | ||||||
| }, | }, | ||||||
|     "额外信息": function () { |     "额外信息": function () { | ||||||
|     /* 宝石血瓶左下角显示数值 |     /* 宝石血瓶左下角显示数值 | ||||||
| @ -5712,9 +5708,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 
 | 
 | ||||||
| 		var itembar_right = rightArrow_right; | 		var itembar_right = rightArrow_right; | ||||||
| 		var boxName = | 		var boxName = | ||||||
|         core.status.event.id == "toolbox" | 			core.status.event.id == "toolbox" ? | ||||||
|           ? "\r[yellow]道具栏\r | 装备栏" | 			"\r[yellow]道具栏\r | 装备栏" : | ||||||
|           : "道具栏 | \r[yellow]装备栏\r"; | 			"道具栏 | \r[yellow]装备栏\r"; | ||||||
| 		core.drawArrow( | 		core.drawArrow( | ||||||
| 			ctx, | 			ctx, | ||||||
| 			arrow_x + arrow_width, | 			arrow_x + arrow_width, | ||||||
| @ -6106,8 +6102,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 				color: "white", | 				color: "white", | ||||||
| 				align: "left", | 				align: "left", | ||||||
| 				fontSize: itemTextFontSize, | 				fontSize: itemTextFontSize, | ||||||
|           maxWidth: | 				maxWidth: rightbar_width - | ||||||
|             rightbar_width - |  | ||||||
| 					(itemText_x - rightbar_x) * 2 + | 					(itemText_x - rightbar_x) * 2 + | ||||||
| 					itemTextFontSize / 2, | 					itemTextFontSize / 2, | ||||||
| 			}); | 			}); | ||||||
| @ -6119,8 +6114,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 				color: "white", | 				color: "white", | ||||||
| 				align: "left", | 				align: "left", | ||||||
| 				fontSize: itemTextFontSize, | 				fontSize: itemTextFontSize, | ||||||
|           maxWidth: | 				maxWidth: rightbar_width - | ||||||
|             rightbar_width - |  | ||||||
| 					(itemText_x - rightbar_x) * 2 + | 					(itemText_x - rightbar_x) * 2 + | ||||||
| 					itemTextFontSize / 2, | 					itemTextFontSize / 2, | ||||||
| 			}); | 			}); | ||||||
| @ -6260,9 +6254,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 			if (i === 1) name = "副手"; | 			if (i === 1) name = "副手"; | ||||||
| 			var selectBorder = false; | 			var selectBorder = false; | ||||||
| 			if (core.status.thisUIEventInfo.select.type == i) selectBorder = true; | 			if (core.status.thisUIEventInfo.select.type == i) selectBorder = true; | ||||||
|         var borderStyle = selectBorder | 			var borderStyle = selectBorder ? | ||||||
|           ? box_selectBorderStyle | 				box_selectBorderStyle : | ||||||
|           : box_borderStyle; | 				box_borderStyle; | ||||||
| 			drawEquipbox_drawOne( | 			drawEquipbox_drawOne( | ||||||
| 				ctx, | 				ctx, | ||||||
| 				name, | 				name, | ||||||
| @ -6352,9 +6346,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 				name = toDrawList[i]; | 				name = toDrawList[i]; | ||||||
| 			var selectBorder = false; | 			var selectBorder = false; | ||||||
| 			if (core.status.thisUIEventInfo.select.type == i) selectBorder = true; | 			if (core.status.thisUIEventInfo.select.type == i) selectBorder = true; | ||||||
|         var borderStyle = selectBorder | 			var borderStyle = selectBorder ? | ||||||
|           ? box_selectBorderStyle | 				box_selectBorderStyle : | ||||||
|           : box_borderStyle; | 				box_borderStyle; | ||||||
| 			drawEquipbox_drawOne( | 			drawEquipbox_drawOne( | ||||||
| 				ctx, | 				ctx, | ||||||
| 				name, | 				name, | ||||||
| @ -6586,11 +6580,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 		if ( | 		if ( | ||||||
| 			!( | 			!( | ||||||
| 				info && | 				info && | ||||||
|           info.select.id && | 				info.select.id && ["toolbox", "equipbox"].includes(core.status.event.id) | ||||||
|           ["toolbox", "equipbox"].includes(core.status.event.id) |  | ||||||
| 			) | 			) | ||||||
| 		) { | 		) { | ||||||
|         core.drawFailTip("发生了未知错误!"); | 			core.drawTip("发生了未知错误!"); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		return info.select.id; | 		return info.select.id; | ||||||
| @ -6607,7 +6600,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 			} | 			} | ||||||
| 		} catch (e) { | 		} catch (e) { | ||||||
| 			console.error(e); | 			console.error(e); | ||||||
|         core.drawFailTip("批量使用时出现未知错误!"); | 			core.drawTip("批量使用时出现未知错误!"); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -6636,11 +6629,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 				const id = getSelectedItem(); | 				const id = getSelectedItem(); | ||||||
| 
 | 
 | ||||||
| 				if (Number.isNaN(value) || value < 0 || value > 99) { | 				if (Number.isNaN(value) || value < 0 || value > 99) { | ||||||
|             core.drawFailTip("输入不合法!"); | 					core.drawTip("输入不合法!"); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| 				if (!core.canUseItem(id)) { | 				if (!core.canUseItem(id)) { | ||||||
|             core.drawFailTip("当前无法使用该道具!"); | 					core.drawTip("当前无法使用该道具!"); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| 				core.closePanel(); | 				core.closePanel(); | ||||||
| @ -7281,7 +7274,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 	core.registerReplayAction("item", core.control._replayAction_item); | 	core.registerReplayAction("item", core.control._replayAction_item); | ||||||
| 	core.registerReplayAction("equip", core.control._replayAction_equip); | 	core.registerReplayAction("equip", core.control._replayAction_equip); | ||||||
| 	core.registerReplayAction("unEquip", core.control._replayAction_unEquip); | 	core.registerReplayAction("unEquip", core.control._replayAction_unEquip); | ||||||
|   }, | }, | ||||||
|     "技能树": function () { |     "技能树": function () { | ||||||
|     // 在此增加新插件
 |     // 在此增加新插件
 | ||||||
|     //
 |     //
 | ||||||
| @ -14788,7 +14781,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 		actions.prototype._sys_onmousewheel, | 		actions.prototype._sys_onmousewheel, | ||||||
| 		0 | 		0 | ||||||
| 	); | 	); | ||||||
|   }, | }, | ||||||
|     "CG回廊": function () { |     "CG回廊": function () { | ||||||
| 	// 在此增加新插件
 | 	// 在此增加新插件
 | ||||||
| 	const CGUI = document.createElement("canvas"); //CGui画布设置
 | 	const CGUI = document.createElement("canvas"); //CGui画布设置
 | ||||||
| @ -15623,7 +15616,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 			block?.event && | 			block?.event && | ||||||
| 			!main.replayChecking && | 			!main.replayChecking && | ||||||
| 			!core.isReplaying() && | 			!core.isReplaying() && | ||||||
|         !core.getFlag("__isFlying__", false) | 			!core.hasFlag("__isFlying__") && !core.hasFlag("__fromLoad__") | ||||||
| 		) { | 		) { | ||||||
| 			const dirEntries = allChangeEntries.find( | 			const dirEntries = allChangeEntries.find( | ||||||
| 				(v) => v[1] === block.event.id | 				(v) => v[1] === block.event.id | ||||||
| @ -15720,9 +15713,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 									_run(); | 									_run(); | ||||||
| 								} | 								} | ||||||
| 							}, | 							}, | ||||||
|                 core.status.replay.speed == 24 | 							core.status.replay.speed == 24 ? | ||||||
|                   ? 1 | 							1 : | ||||||
|                   : 10 / core.status.replay.speed | 							10 / core.status.replay.speed | ||||||
| 						); | 						); | ||||||
| 
 | 
 | ||||||
| 						core.animateFrame.lastAsyncId = animate; | 						core.animateFrame.lastAsyncId = animate; | ||||||
| @ -15746,7 +15739,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 				); | 				); | ||||||
| 		}, 25); | 		}, 25); | ||||||
| 	}; | 	}; | ||||||
|   }, | }, | ||||||
|     "剧情cg": function () { |     "剧情cg": function () { | ||||||
| 	// 在此增加新插件
 | 	// 在此增加新插件
 | ||||||
| 	// 在此增加新插件
 | 	// 在此增加新插件
 | ||||||
| @ -23679,5 +23672,242 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 
 | 
 | ||||||
| 		ctx.restore(); //恢复变换前的坐标,否则将连续转置
 | 		ctx.restore(); //恢复变换前的坐标,否则将连续转置
 | ||||||
| 	} | 	} | ||||||
|  | }, | ||||||
|  |     "scrollingText": function () { | ||||||
|  | 	// 本插件用于绘制在线留言
 | ||||||
|  | 	// 说明:https://h5mota.com/bbs/thread/?tid=1017
 | ||||||
|  | 	// 目前使用core.http代替帖子中提到的axios
 | ||||||
|  | 	////// 绘制提示同时播放成功音效 //////
 | ||||||
|  | 	ui.prototype.drawSuccessTip = function (text, id, frame) { | ||||||
|  | 		this.drawTip(text, id, frame); | ||||||
|  | 		core.playSound('gem.mp3'); | ||||||
|  | 	} | ||||||
|  | 	core.plugin.aniMap = new Map() | ||||||
|  | 	////// 绘制提示同时播放错误音效 //////
 | ||||||
|  | 	ui.prototype.drawFailTip = function (text, id, frame) { | ||||||
|  | 		this.drawTip(text, id, frame); | ||||||
|  | 		core.playSound('error.mp3'); | ||||||
|  | 	} | ||||||
|  | 	/** 塔的英文名 */ | ||||||
|  | 	const towerName = core.firstData.name; | ||||||
|  | 
 | ||||||
|  | 	let [W, H] = [core.__SIZE__, core.__SIZE__]; | ||||||
|  | 	let [WIDTH, HEIGHT] = [core.__PIXELS__, core.__PIXELS__]; | ||||||
|  | 
 | ||||||
|  | 	//#region 弹幕的收发
 | ||||||
|  | 	this.getComment = function () { | ||||||
|  | 		if (core.isReplaying()) return; | ||||||
|  | 		let form = new FormData(); | ||||||
|  | 		form.append('type', 1); | ||||||
|  | 		form.append('towername', towerName); | ||||||
|  | 		utils.prototype.http( | ||||||
|  | 			'POST', | ||||||
|  | 			'https://h5mota.com/backend/tower/barrage.php', | ||||||
|  | 			form, | ||||||
|  | 			function (res) { | ||||||
|  | 				try { | ||||||
|  | 					res = JSON.parse(res); | ||||||
|  | 					console.log(res); | ||||||
|  | 					core.drawTip('接收成功!') | ||||||
|  | 					core.playSound('item.mp3'); | ||||||
|  | 					let commentCollection = {}; | ||||||
|  | 					const commentList = res?.list; | ||||||
|  | 					const isEmpty = /^\s*$/; | ||||||
|  | 					for (let i = 0, l = commentList.length; i <= l - 1; i++) { | ||||||
|  | 						if (isEmpty.test(commentList[i]?.comment)) continue; | ||||||
|  | 						const commentTagsList = commentList[i].tags.split(','); | ||||||
|  | 						const [cFloorId, cX, cY] = commentTagsList; | ||||||
|  | 						if (0 <= cX && cX <= W - 1 && 0 <= cY && cY <= H - 1 && core.floorIds.includes(cFloorId)) { | ||||||
|  | 							if (!commentCollection.hasOwnProperty(cFloorId)) { commentCollection[cFloorId] = {}; } | ||||||
|  | 							const str = cX + ',' + cY; | ||||||
|  | 							if (!commentCollection[cFloorId].hasOwnProperty(str)) { commentCollection[cFloorId][str] = []; } | ||||||
|  | 							commentCollection[cFloorId][str].push(commentList[i]?.comment); | ||||||
|  | 						} | ||||||
|  | 					} | ||||||
|  | 					core.setFlag('commentCollection', commentCollection); | ||||||
|  | 				} catch (err) { | ||||||
|  | 					core.drawFailTip('接收失败!' + err.message); | ||||||
|  | 				} | ||||||
|  | 			}, | ||||||
|  | 			function (err) { | ||||||
|  | 				err = JSON.parse(err); | ||||||
|  | 				console.error(err); | ||||||
|  | 				core.drawFailTip('接收失败' + err?.message); | ||||||
|  | 			}, | ||||||
|  | 			null, null, null, 1000 | ||||||
|  | 		); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	this.postComment = function (comment, tags) { | ||||||
|  | 		if (core.isReplaying()) return; | ||||||
|  | 		const isEmpty = /^\s*$/; | ||||||
|  | 		if (isEmpty.test(comment)) { | ||||||
|  | 			core.drawFailTip('您输入的消息为空,请重发!'); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		let form = new FormData(); | ||||||
|  | 		form.append('type', 2); | ||||||
|  | 		form.append('towername', towerName); | ||||||
|  | 		form.append('comment', comment); | ||||||
|  | 		form.append('tags', tags); | ||||||
|  | 		form.append('userid', 2324); | ||||||
|  | 		form.append('password', '77c8fd5ff49c370342e4472ebdda5903'); | ||||||
|  | 		utils.prototype.http( | ||||||
|  | 			'POST', | ||||||
|  | 			'https://h5mota.com/backend/tower/barrage.php', | ||||||
|  | 			form, | ||||||
|  | 			function (res) { | ||||||
|  | 				try { | ||||||
|  | 					res = JSON.parse(res); | ||||||
|  | 					console.log(res); | ||||||
|  | 					if (res?.code === 0) { | ||||||
|  | 						core.drawTip('提交成功!') | ||||||
|  | 					} else { | ||||||
|  | 						core.drawTip('提交失败!' + res?.message); | ||||||
|  | 					} | ||||||
|  | 				} catch (err) { | ||||||
|  | 					core.drawFailTip('提交失败!' + err.message); | ||||||
|  | 				} | ||||||
|  | 			}, | ||||||
|  | 			function (err) { | ||||||
|  | 				err = JSON.parse(err); | ||||||
|  | 				console.error(err); | ||||||
|  | 				core.drawFailTip('提交失败!' + err?.message); | ||||||
|  | 			}, | ||||||
|  | 			null, null, null, 1000 | ||||||
|  | 		); | ||||||
|  | 	} | ||||||
|  | 	//#endregion
 | ||||||
|  | 
 | ||||||
|  | 	/** 若变量comment为真,在每层切换时在地上有弹幕的地方显示相应图标。 */ | ||||||
|  | 	this.drawCommentSign = function () { | ||||||
|  | 		if (!core.hasFlag('comment') || core.isReplaying()) return; | ||||||
|  | 		let commentCollection = core.getFlag('commentCollection', {}), | ||||||
|  | 			floorId = core.status.floorId; | ||||||
|  | 		core.createCanvas('sign', 0, 0, WIDTH, HEIGHT, 61); | ||||||
|  | 		core.setOpacity('sign', 0.6); | ||||||
|  | 		if (commentCollection.hasOwnProperty(floorId)) { | ||||||
|  | 			for (let pos in commentCollection[floorId]) { | ||||||
|  | 				const l = commentCollection[floorId][pos].length; | ||||||
|  | 				for (let i = 0; i <= l - 1; i++) { | ||||||
|  | 					const [x, y] = pos.split(','); | ||||||
|  | 					core.drawIcon('sign', 'postman', 32 * x, 32 * y); | ||||||
|  | 					break; | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	/** 立即清除楼层的弹幕图标。关闭弹幕相关设置时调用。 */ | ||||||
|  | 	this.clearCommentSign = function () { | ||||||
|  | 		core.deleteCanvas('sign'); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	/** 默认一次显示的弹幕数 */ | ||||||
|  | 	const showNum = 5; | ||||||
|  | 
 | ||||||
|  | 	// 每走一步或瞬移,调用该函数,若目标点有弹幕,显示之
 | ||||||
|  | 	this.showComment = function (x, y) { | ||||||
|  | 		if (!core.getFlag('comment') || core.isReplaying()) return; | ||||||
|  | 		const commentCollection = core.getFlag('commentCollection', {}); | ||||||
|  | 		const floorId = core.status.floorId, | ||||||
|  | 			str = x + ',' + y; | ||||||
|  | 		if (commentCollection.hasOwnProperty(floorId) && | ||||||
|  | 			commentCollection[floorId].hasOwnProperty(str)) { | ||||||
|  | 			let commentArr = commentCollection[floorId][str].concat(); | ||||||
|  | 			const commentArrPicked = pickComment(commentArr, showNum); | ||||||
|  | 			drawComment(commentArrPicked); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	/** 返回从commentArr中挑选showNum个comment组成的数组*/ | ||||||
|  | 	function pickComment(commentArr, showNum) { | ||||||
|  | 		let showList = []; | ||||||
|  | 		if (commentArr.length <= showNum) { | ||||||
|  | 			showList = commentArr; | ||||||
|  | 		} else { | ||||||
|  | 			for (let i = 0; i <= showNum - 1; i++) { | ||||||
|  | 				const l = commentArr.length, | ||||||
|  | 					n = core.plugin.dice(l - 1); | ||||||
|  | 				showList.push(commentArr[n]); | ||||||
|  | 				commentArr.splice(n, 1); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		return showList; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	function drawComment(commentArr) { | ||||||
|  | 		const l = commentArr.length; | ||||||
|  | 		let yList = generateCommentYList(20, HEIGHT - 20, showNum); | ||||||
|  | 		if (l < showNum) yList = getRandomElements(yList, l); | ||||||
|  | 		for (let i = 0; i <= l - 1; i++) { | ||||||
|  | 			drawCommentStr(commentArr[i], WIDTH + 20 * Math.random(), | ||||||
|  | 				yList[i], Math.random() * 0.1 + 0.1); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	/** 生成count个随机数,范围从min到max,作为弹幕的y坐标*/ | ||||||
|  | 	function generateCommentYList(min, max, count) { | ||||||
|  | 		let yList = Array(count).fill(0); | ||||||
|  | 		const distance = (max - min) / (count + 1); | ||||||
|  | 		for (let i = 0; i < count; i++) { | ||||||
|  | 			yList[i] = min + distance * (i + 1) + (Math.random() - 0.5) * (distance / 2); | ||||||
|  | 		} | ||||||
|  | 		return yList; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	function getRandomElements(arr, count) { | ||||||
|  | 		let result = [...arr]; | ||||||
|  | 		let len = result.length; | ||||||
|  | 		count = Math.min(len, count); | ||||||
|  | 
 | ||||||
|  | 		for (let i = len - 1; i > len - 1 - count; i--) { | ||||||
|  | 			let j = Math.floor(Math.random() * (i + 1)); | ||||||
|  | 			[result[i], result[j]] = [result[j], result[i]]; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		return result.slice(len - count); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	//#region 弹幕绘制部分
 | ||||||
|  | 	const { Animation, linear, Ticker } = core.plugin.animate ?? {}; | ||||||
|  | 	const ctxName = 'scrollingText'; | ||||||
|  | 
 | ||||||
|  | 	if (Ticker) { | ||||||
|  | 		const ticker = new Ticker(); | ||||||
|  | 		ticker.add(() => { | ||||||
|  | 			if (core.isReplaying()) return; | ||||||
|  | 			core.createCanvas(ctxName, 0, 0, core.__PIXELS__, core.__PIXELS__, 136); //每帧重绘该画布
 | ||||||
|  | 		}); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * 绘制弹幕  | ||||||
|  | 	 * @example   | ||||||
|  | 	 * drawCommentStr('OK', 450, 200, 0.1); | ||||||
|  | 	 * @param {string} content 弹幕的内容 | ||||||
|  | 	 * @param {number} x 弹幕的初始x坐标 | ||||||
|  | 	 * @param {number} y 弹幕的初始y坐标 | ||||||
|  | 	 * @param {number} vx 弹幕的横向滚动速度 | ||||||
|  | 	 */ | ||||||
|  | 	function drawCommentStr(content, x, y, vx) { | ||||||
|  | 		if (core.isReplaying() || !Animation) return; | ||||||
|  | 		const ani = new Animation(); | ||||||
|  | 		core.plugin.aniMap.set(ani, (ani) => ani.ticker.destroy()); | ||||||
|  | 		ani.ticker.add(() => { | ||||||
|  | 			core.fillText(ctxName, content, x + ani.x, y, 'white', '16px Verdana'); | ||||||
|  | 		}) | ||||||
|  | 		// 弹幕的最大长度5600,再长属于异常数据
 | ||||||
|  | 		const aim = 600 + Math.min(core.calWidth(ctxName, content, '16px Verdana'), 5000); | ||||||
|  | 		ani.mode(linear()) | ||||||
|  | 			.time(aim / vx) | ||||||
|  | 			.absolute() | ||||||
|  | 			.move(-aim, 0) | ||||||
|  | 		ani.all().then(() => { | ||||||
|  | 			ani.ticker.destroy(); | ||||||
|  | 		}); | ||||||
|  | 	} | ||||||
|  | 	//#endregion 
 | ||||||
|  | 
 | ||||||
| } | } | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user