mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Compare commits
	
		
			32 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 31921838cd | ||
|  | a707587182 | ||
|  | bc482af999 | ||
|  | 6818744dae | ||
|  | 607185ac61 | ||
|  | 81b7a412c3 | ||
|  | 09b9a8b441 | ||
|  | 85479cc2de | ||
|  | 3ad4eb2b59 | ||
|  | 878fe95ec3 | ||
|  | 701e720ab8 | ||
|  | e709ce7d56 | ||
|  | 32c89a5405 | ||
|  | 1735982a73 | ||
|  | 625e0aa1af | ||
|  | 00e1a3f8fd | ||
|  | 539256b08e | ||
|  | ff791f5a39 | ||
|  | 304fc344a1 | ||
|  | 9d940755e7 | ||
|  | bc04232f87 | ||
|  | e17ebec098 | ||
|  | 7cd23036a7 | ||
|  | 44c5413abf | ||
|  | 50ab58e91f | ||
|  | 1fd0732390 | ||
|  | ed1b9ee899 | ||
|  | d3c04d6310 | ||
|  | f66ffe305f | ||
|  | 2a9ff0083c | ||
|  | 9ae0bdbb43 | ||
|  | 5fb6f34d8a | 
| @@ -13,10 +13,10 @@ Gem::Specification.new do |s| | ||||
|   s.files = Dir['lib/**/*'] | ||||
|   s.executables << 'linguist' | ||||
|  | ||||
|   s.add_dependency 'charlock_holmes', '~> 0.7.2' | ||||
|   s.add_dependency 'charlock_holmes', '~> 0.7.3' | ||||
|   s.add_dependency 'escape_utils',    '~> 1.0.1' | ||||
|   s.add_dependency 'mime-types',      '~> 1.19' | ||||
|   s.add_dependency 'pygments.rb',     '~> 0.5.4' | ||||
|   s.add_dependency 'pygments.rb',     '~> 0.6.0' | ||||
|  | ||||
|   s.add_development_dependency 'json' | ||||
|   s.add_development_dependency 'mocha' | ||||
|   | ||||
| @@ -1903,6 +1903,13 @@ SQL: | ||||
|   - .udf | ||||
|   - .viw | ||||
|  | ||||
| STON: | ||||
|   type: data | ||||
|   group: Smalltalk | ||||
|   lexer: JSON | ||||
|   extensions: | ||||
|   - .ston | ||||
|  | ||||
| Sage: | ||||
|   type: programming | ||||
|   lexer: Python | ||||
| @@ -1995,6 +2002,14 @@ Slash: | ||||
|   extensions: | ||||
|   - .sl | ||||
|  | ||||
| Slim: | ||||
|   group: HTML | ||||
|   type: markup | ||||
|   lexer: Slim | ||||
|   color: "#ff8877" | ||||
|   extensions: | ||||
|   - .slim | ||||
|  | ||||
| Smalltalk: | ||||
|   type: programming | ||||
|   color: "#596706" | ||||
| @@ -2057,8 +2072,8 @@ SuperCollider: | ||||
|  | ||||
| Swift: | ||||
|   type: programming | ||||
|   lexer: Swift | ||||
|   color: "#ffac45" | ||||
|   lexer: Text only | ||||
|   extensions: | ||||
|   - .swift | ||||
|  | ||||
| @@ -2170,6 +2185,14 @@ UnrealScript: | ||||
|   extensions: | ||||
|   - .uc | ||||
|  | ||||
| VCL: | ||||
|   type: programming | ||||
|   lexer: Perl | ||||
|   ace_mode: perl | ||||
|   color: "#0298c3" | ||||
|   extensions: | ||||
|   - .vcl | ||||
|  | ||||
| VHDL: | ||||
|   type: programming | ||||
|   lexer: vhdl | ||||
| @@ -2396,6 +2419,7 @@ mupad: | ||||
| nesC: | ||||
|   type: programming | ||||
|   color: "#ffce3b" | ||||
|   lexer: nesC | ||||
|   extensions: | ||||
|   - .nc | ||||
|  | ||||
|   | ||||
| @@ -549,6 +549,9 @@ | ||||
|     "Slash": [ | ||||
|       ".sl" | ||||
|     ], | ||||
|     "Slim": [ | ||||
|       ".slim" | ||||
|     ], | ||||
|     "Smalltalk": [ | ||||
|       ".st" | ||||
|     ], | ||||
| @@ -580,6 +583,9 @@ | ||||
|       ".matah", | ||||
|       ".sthlp" | ||||
|     ], | ||||
|     "STON": [ | ||||
|       ".ston" | ||||
|     ], | ||||
|     "Stylus": [ | ||||
|       ".styl" | ||||
|     ], | ||||
| @@ -615,6 +621,9 @@ | ||||
|     "UnrealScript": [ | ||||
|       ".uc" | ||||
|     ], | ||||
|     "VCL": [ | ||||
|       ".vcl" | ||||
|     ], | ||||
|     "Verilog": [ | ||||
|       ".v" | ||||
|     ], | ||||
| @@ -734,8 +743,8 @@ | ||||
|       ".gemrc" | ||||
|     ] | ||||
|   }, | ||||
|   "tokens_total": 613712, | ||||
|   "languages_total": 802, | ||||
|   "tokens_total": 614434, | ||||
|   "languages_total": 812, | ||||
|   "tokens": { | ||||
|     "ABAP": { | ||||
|       "*/**": 1, | ||||
| @@ -60164,6 +60173,70 @@ | ||||
|       "ast.eval": 1, | ||||
|       "Env.new": 1 | ||||
|     }, | ||||
|     "Slim": { | ||||
|       "doctype": 1, | ||||
|       "html": 2, | ||||
|       "head": 1, | ||||
|       "title": 1, | ||||
|       "Slim": 2, | ||||
|       "Examples": 1, | ||||
|       "meta": 2, | ||||
|       "name": 2, | ||||
|       "content": 2, | ||||
|       "author": 2, | ||||
|       "javascript": 1, | ||||
|       "alert": 1, | ||||
|       "(": 1, | ||||
|       ")": 1, | ||||
|       "body": 1, | ||||
|       "h1": 1, | ||||
|       "Markup": 1, | ||||
|       "examples": 1, | ||||
|       "#content": 1, | ||||
|       "p": 2, | ||||
|       "This": 1, | ||||
|       "example": 1, | ||||
|       "shows": 1, | ||||
|       "you": 2, | ||||
|       "how": 1, | ||||
|       "a": 1, | ||||
|       "basic": 1, | ||||
|       "file": 1, | ||||
|       "looks": 1, | ||||
|       "like.": 1, | ||||
|       "yield": 1, | ||||
|       "-": 3, | ||||
|       "unless": 1, | ||||
|       "items.empty": 1, | ||||
|       "table": 1, | ||||
|       "for": 1, | ||||
|       "item": 1, | ||||
|       "in": 1, | ||||
|       "items": 2, | ||||
|       "do": 1, | ||||
|       "tr": 1, | ||||
|       "td.name": 1, | ||||
|       "item.name": 1, | ||||
|       "td.price": 1, | ||||
|       "item.price": 1, | ||||
|       "else": 1, | ||||
|       "|": 2, | ||||
|       "No": 1, | ||||
|       "found.": 1, | ||||
|       "Please": 1, | ||||
|       "add": 1, | ||||
|       "some": 1, | ||||
|       "inventory.": 1, | ||||
|       "Thank": 1, | ||||
|       "div": 1, | ||||
|       "id": 1, | ||||
|       "render": 1, | ||||
|       "Copyright": 1, | ||||
|       "#": 2, | ||||
|       "{": 2, | ||||
|       "year": 1, | ||||
|       "}": 2 | ||||
|     }, | ||||
|     "Smalltalk": { | ||||
|       "Object": 1, | ||||
|       "subclass": 2, | ||||
| @@ -61978,6 +62051,56 @@ | ||||
|       "return": 1, | ||||
|       "/": 1 | ||||
|     }, | ||||
|     "STON": { | ||||
|       "[": 11, | ||||
|       "]": 11, | ||||
|       "{": 15, | ||||
|       "#a": 1, | ||||
|       "#b": 1, | ||||
|       "}": 15, | ||||
|       "Rectangle": 1, | ||||
|       "#origin": 1, | ||||
|       "Point": 2, | ||||
|       "-": 2, | ||||
|       "#corner": 1, | ||||
|       "TestDomainObject": 1, | ||||
|       "#created": 1, | ||||
|       "DateAndTime": 2, | ||||
|       "#modified": 1, | ||||
|       "#integer": 1, | ||||
|       "#float": 1, | ||||
|       "#description": 1, | ||||
|       "#color": 1, | ||||
|       "#green": 1, | ||||
|       "#tags": 1, | ||||
|       "#two": 1, | ||||
|       "#beta": 1, | ||||
|       "#medium": 1, | ||||
|       "#bytes": 1, | ||||
|       "ByteArray": 1, | ||||
|       "#boolean": 1, | ||||
|       "false": 1, | ||||
|       "ZnResponse": 1, | ||||
|       "#headers": 2, | ||||
|       "ZnHeaders": 1, | ||||
|       "ZnMultiValueDictionary": 1, | ||||
|       "#entity": 1, | ||||
|       "ZnStringEntity": 1, | ||||
|       "#contentType": 1, | ||||
|       "ZnMimeType": 1, | ||||
|       "#main": 1, | ||||
|       "#sub": 1, | ||||
|       "#parameters": 1, | ||||
|       "#contentLength": 1, | ||||
|       "#string": 1, | ||||
|       "#encoder": 1, | ||||
|       "ZnUTF8Encoder": 1, | ||||
|       "#statusLine": 1, | ||||
|       "ZnStatusLine": 1, | ||||
|       "#version": 1, | ||||
|       "#code": 1, | ||||
|       "#reason": 1 | ||||
|     }, | ||||
|     "Stylus": { | ||||
|       "border": 6, | ||||
|       "-": 10, | ||||
| @@ -63723,6 +63846,87 @@ | ||||
|       "log": 1, | ||||
|       "defaultproperties": 1 | ||||
|     }, | ||||
|     "VCL": { | ||||
|       "sub": 23, | ||||
|       "vcl_recv": 2, | ||||
|       "{": 50, | ||||
|       "if": 14, | ||||
|       "(": 50, | ||||
|       "req.request": 18, | ||||
|       "&&": 14, | ||||
|       ")": 50, | ||||
|       "return": 33, | ||||
|       "pipe": 4, | ||||
|       ";": 48, | ||||
|       "}": 50, | ||||
|       "pass": 9, | ||||
|       "req.http.Authorization": 2, | ||||
|       "||": 4, | ||||
|       "req.http.Cookie": 2, | ||||
|       "lookup": 2, | ||||
|       "vcl_pipe": 2, | ||||
|       "vcl_pass": 2, | ||||
|       "vcl_hash": 2, | ||||
|       "set": 10, | ||||
|       "req.hash": 3, | ||||
|       "+": 17, | ||||
|       "req.url": 2, | ||||
|       "req.http.host": 4, | ||||
|       "else": 3, | ||||
|       "server.ip": 2, | ||||
|       "hash": 2, | ||||
|       "vcl_hit": 2, | ||||
|       "obj.cacheable": 2, | ||||
|       "deliver": 8, | ||||
|       "vcl_miss": 2, | ||||
|       "fetch": 3, | ||||
|       "vcl_fetch": 2, | ||||
|       "obj.http.Set": 1, | ||||
|       "-": 21, | ||||
|       "Cookie": 2, | ||||
|       "obj.prefetch": 1, | ||||
|       "s": 3, | ||||
|       "vcl_deliver": 2, | ||||
|       "vcl_discard": 1, | ||||
|       "discard": 2, | ||||
|       "vcl_prefetch": 1, | ||||
|       "vcl_timeout": 1, | ||||
|       "vcl_error": 2, | ||||
|       "obj.http.Content": 2, | ||||
|       "Type": 2, | ||||
|       "synthetic": 2, | ||||
|       "utf": 2, | ||||
|       "//W3C//DTD": 2, | ||||
|       "XHTML": 2, | ||||
|       "Strict//EN": 2, | ||||
|       "http": 3, | ||||
|       "//www.w3.org/TR/xhtml1/DTD/xhtml1": 2, | ||||
|       "strict.dtd": 2, | ||||
|       "obj.status": 4, | ||||
|       "obj.response": 6, | ||||
|       "req.xid": 2, | ||||
|       "//www.varnish": 1, | ||||
|       "cache.org/": 1, | ||||
|       "req.restarts": 1, | ||||
|       "req.http.x": 1, | ||||
|       "forwarded": 1, | ||||
|       "for": 1, | ||||
|       "req.http.X": 3, | ||||
|       "Forwarded": 3, | ||||
|       "For": 3, | ||||
|       "client.ip": 2, | ||||
|       "hash_data": 3, | ||||
|       "beresp.ttl": 2, | ||||
|       "<": 1, | ||||
|       "beresp.http.Set": 1, | ||||
|       "beresp.http.Vary": 1, | ||||
|       "hit_for_pass": 1, | ||||
|       "obj.http.Retry": 1, | ||||
|       "After": 1, | ||||
|       "vcl_init": 1, | ||||
|       "ok": 2, | ||||
|       "vcl_fini": 1 | ||||
|     }, | ||||
|     "Verilog": { | ||||
|       "////////////////////////////////////////////////////////////////////////////////": 14, | ||||
|       "//": 117, | ||||
| @@ -66952,12 +67156,14 @@ | ||||
|     "ShellSession": 233, | ||||
|     "Shen": 3472, | ||||
|     "Slash": 187, | ||||
|     "Slim": 77, | ||||
|     "Smalltalk": 423, | ||||
|     "SourcePawn": 2080, | ||||
|     "SQL": 1485, | ||||
|     "Squirrel": 130, | ||||
|     "Standard ML": 6567, | ||||
|     "Stata": 3133, | ||||
|     "STON": 100, | ||||
|     "Stylus": 76, | ||||
|     "SuperCollider": 133, | ||||
|     "Swift": 1128, | ||||
| @@ -66969,6 +67175,7 @@ | ||||
|     "TXL": 213, | ||||
|     "TypeScript": 109, | ||||
|     "UnrealScript": 2873, | ||||
|     "VCL": 545, | ||||
|     "Verilog": 3778, | ||||
|     "VHDL": 42, | ||||
|     "VimL": 20, | ||||
| @@ -67140,12 +67347,14 @@ | ||||
|     "ShellSession": 3, | ||||
|     "Shen": 3, | ||||
|     "Slash": 1, | ||||
|     "Slim": 1, | ||||
|     "Smalltalk": 3, | ||||
|     "SourcePawn": 1, | ||||
|     "SQL": 5, | ||||
|     "Squirrel": 1, | ||||
|     "Standard ML": 5, | ||||
|     "Stata": 7, | ||||
|     "STON": 7, | ||||
|     "Stylus": 1, | ||||
|     "SuperCollider": 1, | ||||
|     "Swift": 43, | ||||
| @@ -67157,6 +67366,7 @@ | ||||
|     "TXL": 1, | ||||
|     "TypeScript": 3, | ||||
|     "UnrealScript": 2, | ||||
|     "VCL": 2, | ||||
|     "Verilog": 13, | ||||
|     "VHDL": 1, | ||||
|     "VimL": 2, | ||||
| @@ -67173,5 +67383,5 @@ | ||||
|     "Zephir": 2, | ||||
|     "Zimpl": 1 | ||||
|   }, | ||||
|   "md5": "4754c31a712c5e22354851fd14d4d4fa" | ||||
|   "md5": "3e0901633ee5729c6dac371442522f33" | ||||
| } | ||||
| @@ -199,3 +199,8 @@ | ||||
|  | ||||
| # Mercury --use-subdirs | ||||
| - Mercury/ | ||||
|  | ||||
| # R packages | ||||
| - ^vignettes/ | ||||
| - ^inst/extdata/ | ||||
|  | ||||
|   | ||||
| @@ -1,3 +1,3 @@ | ||||
| module Linguist | ||||
|   VERSION = "2.11.4" | ||||
|   VERSION = "2.12.0" | ||||
| end | ||||
|   | ||||
							
								
								
									
										1
									
								
								samples/STON/Array.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								samples/STON/Array.ston
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| [1, 2, 3] | ||||
							
								
								
									
										1
									
								
								samples/STON/Dictionary.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								samples/STON/Dictionary.ston
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {#a : 1, #b : 2} | ||||
							
								
								
									
										4
									
								
								samples/STON/Rectangle.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								samples/STON/Rectangle.ston
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| Rectangle { | ||||
|    #origin : Point [ -40, -15 ], | ||||
|    #corner : Point [ 60, 35 ] | ||||
|  } | ||||
							
								
								
									
										15
									
								
								samples/STON/TestDomainObject.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								samples/STON/TestDomainObject.ston
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| TestDomainObject { | ||||
|   #created : DateAndTime [ '2012-02-14T16:40:15+01:00' ], | ||||
|   #modified : DateAndTime [ '2012-02-14T16:40:18+01:00' ], | ||||
|   #integer : 39581, | ||||
|   #float : 73.84789359463944, | ||||
|   #description : 'This is a test', | ||||
|   #color : #green, | ||||
|   #tags : [ | ||||
|     #two, | ||||
|     #beta, | ||||
|     #medium | ||||
|   ], | ||||
|   #bytes : ByteArray [ 'afabfdf61d030f43eb67960c0ae9f39f' ], | ||||
|   #boolean : false | ||||
| } | ||||
							
								
								
									
										30
									
								
								samples/STON/ZNResponse.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								samples/STON/ZNResponse.ston
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| ZnResponse { | ||||
|    #headers : ZnHeaders { | ||||
|      #headers : ZnMultiValueDictionary { | ||||
|         'Date' : 'Fri, 04 May 2012 20:09:23 GMT', | ||||
|         'Modification-Date' : 'Thu, 10 Feb 2011 08:32:30 GMT', | ||||
|         'Content-Length' : '113', | ||||
|         'Server' : 'Zinc HTTP Components 1.0', | ||||
|         'Vary' : 'Accept-Encoding', | ||||
|         'Connection' : 'close', | ||||
|         'Content-Type' : 'text/html;charset=utf-8' | ||||
|      } | ||||
|    }, | ||||
|    #entity : ZnStringEntity { | ||||
|      #contentType : ZnMimeType { | ||||
|         #main : 'text', | ||||
|         #sub : 'html', | ||||
|         #parameters : { | ||||
|             'charset' : 'utf-8' | ||||
|         } | ||||
|      }, | ||||
|      #contentLength : 113, | ||||
|      #string : '<html>\n<head><title>Small</title></head>\n<body><h1>Small</h1><p>This is a small HTML document</p></body>\n</html>\n', | ||||
|      #encoder : ZnUTF8Encoder { } | ||||
|    }, | ||||
|    #statusLine : ZnStatusLine { | ||||
|      #version : 'HTTP/1.1', | ||||
|      #code : 200, | ||||
|      #reason : 'OK' | ||||
|    } | ||||
|  } | ||||
							
								
								
									
										24
									
								
								samples/STON/methodProperties.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								samples/STON/methodProperties.ston
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| { | ||||
| 	"class" : { | ||||
| 		 }, | ||||
| 	"instance" : { | ||||
| 		"clientList:listElement:" : "dkh 03/20/2014 16:27", | ||||
| 		"copyObjectMenuAction:selectionIndex:" : "dkh 10/13/2013 10:20", | ||||
| 		"definitionForSelection:" : "dkh 10/13/2013 10:15", | ||||
| 		"editMenuActionSpec" : "dkh 10/13/2013 10:19", | ||||
| 		"itemSelected:listElement:selectedIndex:shiftPressed:" : "dkh 10/20/2013 11:06", | ||||
| 		"menuActionSpec:" : "dkh 10/19/2013 17:12", | ||||
| 		"repository:" : "dkh 10/19/2013 17:36", | ||||
| 		"theList" : "dkh 10/12/2013 15:51", | ||||
| 		"versionInfoBlock:" : "dkh 10/19/2013 17:08", | ||||
| 		"versionInfoDiffVsSelection:selectedIndex:" : "dkh 10/19/2013 17:48", | ||||
| 		"versionInfoDiffVsWorkingCopy:selectedIndex:" : "dkh 10/20/2013 12:36", | ||||
| 		"versionInfoSelect:selectedIndex:" : "dkh 10/12/2013 17:04", | ||||
| 		"versionInfos" : "dkh 10/19/2013 17:13", | ||||
| 		"versionSummaryIsClosing" : "dkh 10/20/2013 10:19", | ||||
| 		"windowIsClosing:" : "dkh 10/20/2013 10:39", | ||||
| 		"windowLabel" : "dkh 05/20/2014 11:00", | ||||
| 		"windowLocation" : "dkh 05/23/2014 10:17", | ||||
| 		"windowName" : "dkh 10/12/2013 16:00", | ||||
| 		"workingCopy" : "dkh 10/12/2013 16:16", | ||||
| 		"workingCopy:" : "dkh 10/12/2013 16:17" } } | ||||
							
								
								
									
										19
									
								
								samples/STON/properties.ston
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								samples/STON/properties.ston
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| { | ||||
| 	"category" : "Topez-Server-Core", | ||||
| 	"classinstvars" : [ | ||||
| 		 ], | ||||
| 	"classvars" : [ | ||||
| 		 ], | ||||
| 	"commentStamp" : "", | ||||
| 	"instvars" : [ | ||||
| 		"workingCopy", | ||||
| 		"repository", | ||||
| 		"versionInfos", | ||||
| 		"versionInfoBlock", | ||||
| 		"selectedVersionInfo", | ||||
| 		"versionInfoSummaryWindowId" ], | ||||
| 	"name" : "TDVersionInfoBrowser", | ||||
| 	"pools" : [ | ||||
| 		 ], | ||||
| 	"super" : "TDAbstractMonticelloToolBuilder", | ||||
| 	"type" : "normal" } | ||||
							
								
								
									
										31
									
								
								samples/Slim/sample.slim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								samples/Slim/sample.slim
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| doctype html | ||||
| html | ||||
|   head | ||||
|     title Slim Examples | ||||
|     meta name="keywords" content="template language" | ||||
|     meta name="author" content=author | ||||
|     javascript: | ||||
|       alert('Slim supports embedded javascript!') | ||||
|  | ||||
|   body | ||||
|     h1 Markup examples | ||||
|  | ||||
|     #content | ||||
|       p This example shows you how a basic Slim file looks like. | ||||
|  | ||||
|       == yield | ||||
|  | ||||
|       - unless items.empty? | ||||
|         table | ||||
|           - for item in items do | ||||
|             tr | ||||
|               td.name = item.name | ||||
|               td.price = item.price | ||||
|       - else | ||||
|         p | ||||
|          | No items found.  Please add some inventory. | ||||
|            Thank you! | ||||
|  | ||||
|     div id="footer" | ||||
|       = render 'footer' | ||||
|       | Copyright © #{year} #{author} | ||||
							
								
								
									
										703
									
								
								samples/Text/Visual_Battlers.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										703
									
								
								samples/Text/Visual_Battlers.rb
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,703 @@ | ||||
| #============================================================================== | ||||
| #  | ||||
| # <20><> Yanfly Engine Ace - Visual Battlers v1.01 | ||||
| # -- Last Updated: 2012.07.24 | ||||
| # -- Level: Easy | ||||
| # -- Requires: n/a | ||||
| # | ||||
| # <20><> Modified by: | ||||
| # -- Yami | ||||
| # -- Kread-Ex | ||||
| # -- Archeia_Nessiah | ||||
| #============================================================================== | ||||
|  | ||||
| $imported = {} if $imported.nil? | ||||
| $imported["YEA-VisualBattlers"] = true | ||||
|  | ||||
| #============================================================================== | ||||
| # <20><> Updates | ||||
| # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||||
| # 2012.12.18 - Added preset views and able to change direction in-game. | ||||
| # 2012.07.24 - Finished Script. | ||||
| # 2012.01.05 - Started Script. | ||||
| #  | ||||
| #============================================================================== | ||||
| # <20><> Introduction | ||||
| # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||||
| # This script provides a visual for all actors by default charsets. The actions | ||||
| # and movements are alike Final Fantasy 1, only move forward and backward when  | ||||
| # start and finish actions. | ||||
| #  | ||||
| #============================================================================== | ||||
| # <20><> Instructions | ||||
| # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||||
| # To change the player direction in-game, use the snippet below in a script  | ||||
| # call:  | ||||
| #  | ||||
| # $game_system.party_direction = n | ||||
| # | ||||
| # To install this script, open up your script editor and copy/paste this script | ||||
| # to an open slot below <20><> Materials but above <20><> Main. Remember to save. | ||||
| #  | ||||
| #============================================================================== | ||||
| # <20><> Compatibility | ||||
| # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||||
| # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that | ||||
| # it will run with RPG Maker VX without adjusting. | ||||
| #  | ||||
| #============================================================================== | ||||
|  | ||||
| module YEA | ||||
|   module VISUAL_BATTLERS | ||||
|      | ||||
|     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||||
|     # - Party Location Setting - | ||||
|     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||||
|     # These settings are adjusted for Party Location. Each Actor will have | ||||
|     # coordinates calculated by below formula. There are two samples coordinates | ||||
|     # below, change PARTY_DIRECTION to the base index you want to use. | ||||
|     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||||
|     PARTY_DIRECTION = 6 # This direction is opposite from actual direction. | ||||
|      | ||||
|     PARTY_LOCATION_BASE_COORDINATES ={ | ||||
|     # Index => [base_x, base_y, mod_x, mod_y], | ||||
|           2 => [   250,    290,    40,     0], #UP | ||||
|           4 => [   150,    280,    20,   -20], #LEFT | ||||
|           3 => [   460,    280,    30,   -10], #RIGHT | ||||
|           6 => [   460,    230,    20,    20], #DEFAULT RIGHT | ||||
|           8 => [   260,    230,    40,     0], #DOWN | ||||
|     } # Do not remove this. | ||||
|      | ||||
|     PARTY_LOCATION_FORMULA_X = "base_x + index * mod_x" | ||||
|     PARTY_LOCATION_FORMULA_Y = "base_y + index * mod_y" | ||||
|      | ||||
|   end # VISUAL_BATTLERS | ||||
| end # YEA | ||||
|  | ||||
| #============================================================================== | ||||
| #  <20><>  Editting anything past this point may potentially result in causing | ||||
| # computer damage, incontinence, explosion of user's head, coma, death, and/or | ||||
| # halitosis so edit at your own risk. | ||||
| #============================================================================== | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Direction | ||||
| #============================================================================== | ||||
|  | ||||
| module Direction | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # self.correct | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def self.correct(direction) | ||||
|     case direction | ||||
|     when 1; return 4 | ||||
|     when 3; return 6 | ||||
|     when 7; return 4 | ||||
|     when 9; return 6 | ||||
|     else; return direction | ||||
|     end | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # self.opposite | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def self.opposite(direction) | ||||
|     case direction | ||||
|     when 1; return 6 | ||||
|     when 2; return 8 | ||||
|     when 3; return 4 | ||||
|     when 4; return 6 | ||||
|     when 6; return 4 | ||||
|     when 7; return 6 | ||||
|     when 8; return 2 | ||||
|     when 9; return 4 | ||||
|     else; return direction | ||||
|     end | ||||
|   end | ||||
|    | ||||
| end # Direction | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Game_System | ||||
| #============================================================================== | ||||
|  | ||||
| class Game_System; attr_accessor :party_direction; end | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Game_BattleCharacter | ||||
| #============================================================================== | ||||
|  | ||||
| class Game_BattleCharacter < Game_Character | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # initialize | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def initialize(actor) | ||||
|     super() | ||||
|     setup_actor(actor) | ||||
|     @move_x_rate = 0 | ||||
|     @move_y_rate = 0 | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # setup_actor | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def setup_actor(actor) | ||||
|     @actor = actor | ||||
|     @step_anime = true | ||||
|     set_graphic(@actor.character_name, @actor.character_index) | ||||
|     setup_coordinates | ||||
|     dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION | ||||
|     direction = Direction.opposite(dr) | ||||
|     set_direction(Direction.correct(direction)) | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # sprite= | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def sprite=(sprite) | ||||
|     @sprite = sprite | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # setup_coordinates | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def setup_coordinates | ||||
|     location = ($game_system.party_direction || | ||||
|     YEA::VISUAL_BATTLERS::PARTY_DIRECTION) | ||||
|     base_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][0] | ||||
|     base_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][1] | ||||
|     mod_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][2] | ||||
|     mod_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][3] | ||||
|     @actor.screen_x = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_X) | ||||
|     @actor.screen_y = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_Y) | ||||
|     @actor.origin_x = @actor.screen_x | ||||
|     @actor.origin_y = @actor.screen_y | ||||
|     @actor.create_move_to(screen_x, screen_y, 1) | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # index | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def index | ||||
|     return @actor.index | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # screen_x | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def screen_x | ||||
|     return @actor.screen_x | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # screen_y | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def screen_y | ||||
|     return @actor.screen_y | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # screen_z | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def screen_z | ||||
|     return @actor.screen_z | ||||
|   end | ||||
|    | ||||
| end # Game_BattleCharacter | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Game_Battler | ||||
| #============================================================================== | ||||
|  | ||||
| class Game_Battler < Game_BattlerBase | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # public instance variables | ||||
|   #-------------------------------------------------------------------------- | ||||
|   attr_accessor :moved_back | ||||
|   attr_accessor :origin_x | ||||
|   attr_accessor :origin_y | ||||
|   attr_accessor :screen_x | ||||
|   attr_accessor :screen_y | ||||
|   attr_accessor :started_turn | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # alias method: execute_damage | ||||
|   #-------------------------------------------------------------------------- | ||||
|   alias game_battler_execute_damage_vb execute_damage | ||||
|   def execute_damage(user) | ||||
|     game_battler_execute_damage_vb(user) | ||||
|     if @result.hp_damage > 0 | ||||
|       move_backward(24, 6) unless @moved_back | ||||
|       @moved_back = true | ||||
|     end | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # face_opposing_party | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def face_opposing_party | ||||
|     direction = ($game_system.party_direction || | ||||
|     YEA::VISUAL_BATTLERS::PARTY_DIRECTION) | ||||
|     character.set_direction(Direction.correct(direction)) rescue 0 | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: face_coordinate | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def face_coordinate(destination_x, destination_y) | ||||
|     x1 = Integer(@screen_x) | ||||
|     x2 = Integer(destination_x) | ||||
|     y1 = Graphics.height - Integer(@screen_y) | ||||
|     y2 = Graphics.height - Integer(destination_y) | ||||
|     return if x1 == x2 and y1 == y2 | ||||
|     #--- | ||||
|     angle = Integer(Math.atan2((y2-y1),(x2-x1)) * 1800 / Math::PI) | ||||
|     if (0..225) === angle or (-225..0) === angle | ||||
|       direction = 6 | ||||
|     elsif (226..675) === angle | ||||
|       direction = 9 | ||||
|     elsif (676..1125) === angle | ||||
|       direction = 8 | ||||
|     elsif (1126..1575) === angle | ||||
|       direction = 7 | ||||
|     elsif (1576..1800) === angle or (-1800..-1576) === angle | ||||
|       direction = 4 | ||||
|     elsif (-1575..-1126) === angle | ||||
|       direction = 1 | ||||
|     elsif (-1125..-676) === angle | ||||
|       direction = 2 | ||||
|     elsif (-675..-226) === angle | ||||
|       direction = 3 | ||||
|     end | ||||
|     #--- | ||||
|     character.set_direction(Direction.correct(direction)) rescue 0 | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # create_move_to | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def create_move_to(destination_x, destination_y, frames = 12) | ||||
|     @destination_x = destination_x | ||||
|     @destination_y = destination_y | ||||
|     frames = [frames, 1].max | ||||
|     @move_x_rate = [(@screen_x - @destination_x).abs / frames, 2].max | ||||
|     @move_y_rate = [(@screen_y - @destination_y).abs / frames, 2].max | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # update_move_to | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def update_move_to | ||||
|     @move_x_rate = 0 if @screen_x == @destination_x || @move_x_rate.nil? | ||||
|     @move_y_rate = 0 if @screen_y == @destination_y || @move_y_rate.nil? | ||||
|     value = [(@screen_x - @destination_x).abs, @move_x_rate].min | ||||
|     @screen_x += (@destination_x > @screen_x) ? value : -value | ||||
|     value = [(@screen_y - @destination_y).abs, @move_y_rate].min | ||||
|     @screen_y += (@destination_y > @screen_y) ? value : -value | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # move_forward | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def move_forward(distance = 24, frames = 12) | ||||
|     direction = forward_direction | ||||
|     move_direction(direction, distance, frames) | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # move_backward | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def move_backward(distance = 24, frames = 12) | ||||
|     direction = Direction.opposite(forward_direction) | ||||
|     move_direction(direction, distance, frames) | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # move_direction | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def move_direction(direction, distance = 24, frames = 12) | ||||
|     case direction | ||||
|     when 1; move_x = distance / -2; move_y = distance /  2 | ||||
|     when 2; move_x = distance *  0; move_y = distance *  1 | ||||
|     when 3; move_x = distance / -2; move_y = distance /  2 | ||||
|     when 4; move_x = distance * -1; move_y = distance *  0 | ||||
|     when 6; move_x = distance *  1; move_y = distance *  0 | ||||
|     when 7; move_x = distance / -2; move_y = distance / -2 | ||||
|     when 8; move_x = distance *  0; move_y = distance * -1 | ||||
|     when 9; move_x = distance /  2; move_y = distance / -2 | ||||
|     else; return | ||||
|     end | ||||
|     destination_x = @screen_x + move_x | ||||
|     destination_y = @screen_y + move_y | ||||
|     create_move_to(destination_x, destination_y, frames) | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # forward_direction | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def forward_direction | ||||
|     return ($game_system.party_direction || | ||||
|     YEA::VISUAL_BATTLERS::PARTY_DIRECTION) | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # move_origin | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def move_origin | ||||
|     create_move_to(@origin_x, @origin_y) | ||||
|     face_coordinate(@origin_x, @origin_y) | ||||
|     @moved_back = false | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # moving? | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def moving? | ||||
|     return false if dead? || !exist? | ||||
|     return @move_x_rate != 0 || @move_y_rate != 0 | ||||
|   end | ||||
|    | ||||
| end # Game_Battler | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Game_Actor | ||||
| #============================================================================== | ||||
|  | ||||
| class Game_Actor < Game_Battler | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # overwrite method: use_sprite? | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def use_sprite? | ||||
|     return true | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: screen_x | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def screen_x | ||||
|     return @screen_x rescue 0 | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: screen_y | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def screen_y | ||||
|     return @screen_y rescue 0 | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: screen_z | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def screen_z | ||||
|     return 100 | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: sprite | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def sprite | ||||
|     index = $game_party.battle_members.index(self) | ||||
|     return SceneManager.scene.spriteset.actor_sprites[index] | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: character | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def character | ||||
|     return sprite.character_base | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # face_opposing_party | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def face_opposing_party | ||||
|     dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION | ||||
|     direction = Direction.opposite(dr) | ||||
|     character.set_direction(Direction.correct(direction)) rescue 0 | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # forward_direction | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def forward_direction | ||||
|     return Direction.opposite(($game_system.party_direction || | ||||
|     YEA::VISUAL_BATTLERS::PARTY_DIRECTION)) | ||||
|   end | ||||
|    | ||||
| end # Game_Actor | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Game_Enemy | ||||
| #============================================================================== | ||||
|  | ||||
| class Game_Enemy < Game_Battler | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: sprite | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def sprite | ||||
|     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index] | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: character | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def character | ||||
|     return sprite | ||||
|   end | ||||
|    | ||||
| end # Game_Enemy | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Game_Troop | ||||
| #============================================================================== | ||||
|  | ||||
| class Game_Troop < Game_Unit | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # alias method: setup | ||||
|   #-------------------------------------------------------------------------- | ||||
|   alias game_troop_setup_vb setup | ||||
|   def setup(troop_id) | ||||
|     game_troop_setup_vb(troop_id) | ||||
|     set_coordinates | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: set_coordinates | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def set_coordinates | ||||
|     for member in members | ||||
|       member.origin_x = member.screen_x | ||||
|       member.origin_y = member.screen_y | ||||
|       member.create_move_to(member.screen_x, member.screen_y, 1) | ||||
|     end | ||||
|   end | ||||
|    | ||||
| end # Game_Troop | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Sprite_Battler | ||||
| #============================================================================== | ||||
|  | ||||
| class Sprite_Battler < Sprite_Base | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # public instance_variable | ||||
|   #-------------------------------------------------------------------------- | ||||
|   attr_accessor :character_base | ||||
|   attr_accessor :character_sprite | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # alias method: dispose | ||||
|   #-------------------------------------------------------------------------- | ||||
|   alias sprite_battler_dispose_vb dispose | ||||
|   def dispose | ||||
|     dispose_character_sprite | ||||
|     sprite_battler_dispose_vb | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: dispose_character_sprite | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def dispose_character_sprite | ||||
|     @character_sprite.dispose unless @character_sprite.nil? | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # alias method: update | ||||
|   #-------------------------------------------------------------------------- | ||||
|   alias sprite_battler_update_vb update | ||||
|   def update | ||||
|     sprite_battler_update_vb | ||||
|     return if @battler.nil? | ||||
|     update_move_to | ||||
|     update_character_base | ||||
|     update_character_sprite | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: update_character_base | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def update_character_base | ||||
|     return if @character_base.nil? | ||||
|     @character_base.update | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: update_character_sprite | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def update_character_sprite | ||||
|     return if @character_sprite.nil? | ||||
|     @character_sprite.update | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: update_move_to | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def update_move_to | ||||
|     @battler.update_move_to | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: moving? | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def moving? | ||||
|     return false if @battler.nil? | ||||
|     return @battler.moving? | ||||
|   end | ||||
|    | ||||
| end # Sprite_Battler | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Sprite_BattleCharacter | ||||
| #============================================================================== | ||||
|  | ||||
| class Sprite_BattleCharacter < Sprite_Character | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # initialize | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def initialize(viewport, character = nil) | ||||
|     super(viewport, character) | ||||
|     character.sprite = self | ||||
|   end | ||||
|    | ||||
| end # Sprite_BattleCharacter | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Spriteset_Battle | ||||
| #============================================================================== | ||||
|  | ||||
| class Spriteset_Battle | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # public instance_variable | ||||
|   #-------------------------------------------------------------------------- | ||||
|   attr_accessor :actor_sprites | ||||
|   attr_accessor :enemy_sprites | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # overwrite method: create_actors | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def create_actors | ||||
|     total = $game_party.max_battle_members | ||||
|     @current_party = $game_party.battle_members.clone | ||||
|     @actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) } | ||||
|     for actor in $game_party.battle_members | ||||
|       @actor_sprites[actor.index].battler = actor | ||||
|       create_actor_sprite(actor) | ||||
|     end | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: create_actor_sprite | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def create_actor_sprite(actor) | ||||
|     character = Game_BattleCharacter.new(actor) | ||||
|     character_sprite = Sprite_BattleCharacter.new(@viewport1, character) | ||||
|     @actor_sprites[actor.index].character_base = character | ||||
|     @actor_sprites[actor.index].character_sprite = character_sprite | ||||
|     actor.face_opposing_party | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # alias method: update_actors | ||||
|   #-------------------------------------------------------------------------- | ||||
|   alias spriteset_battle_update_actors_vb update_actors | ||||
|   def update_actors | ||||
|     if @current_party != $game_party.battle_members | ||||
|       dispose_actors | ||||
|       create_actors | ||||
|     end | ||||
|     spriteset_battle_update_actors_vb | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: moving? | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def moving? | ||||
|     return battler_sprites.any? {|sprite| sprite.moving? } | ||||
|   end | ||||
|    | ||||
| end # Spriteset_Battle | ||||
|  | ||||
| #============================================================================== | ||||
| # ? <20><>  Scene_Battle | ||||
| #============================================================================== | ||||
|  | ||||
| class Scene_Battle < Scene_Base | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # public instance variables | ||||
|   #-------------------------------------------------------------------------- | ||||
|   attr_accessor :spriteset | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # alias method: process_action_end | ||||
|   #-------------------------------------------------------------------------- | ||||
|   alias scene_battle_process_action_end_vb process_action_end | ||||
|   def process_action_end | ||||
|     start_battler_move_origin | ||||
|     scene_battle_process_action_end_vb | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # alias method: execute_action | ||||
|   #-------------------------------------------------------------------------- | ||||
|   alias scene_battle_execute_action_vb execute_action | ||||
|   def execute_action | ||||
|     start_battler_move_forward | ||||
|     scene_battle_execute_action_vb | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: start_battler_move_forward | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def start_battler_move_forward | ||||
|     return if @subject.started_turn | ||||
|     @subject.started_turn = true | ||||
|     @subject.move_forward | ||||
|     wait_for_moving | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: start_battler_move_origin | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def start_battler_move_origin | ||||
|     @subject.started_turn = nil | ||||
|     move_battlers_origin | ||||
|     wait_for_moving | ||||
|     @subject.face_opposing_party rescue 0 | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: move_battlers_origin | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def move_battlers_origin | ||||
|     for member in all_battle_members | ||||
|       next if member.dead? | ||||
|       next unless member.exist? | ||||
|       member.move_origin | ||||
|     end | ||||
|   end | ||||
|    | ||||
|   #-------------------------------------------------------------------------- | ||||
|   # new method: wait_for_moving | ||||
|   #-------------------------------------------------------------------------- | ||||
|   def wait_for_moving | ||||
|     update_for_wait | ||||
|     update_for_wait while @spriteset.moving? | ||||
|   end | ||||
|    | ||||
| end # Scene_Battle | ||||
|  | ||||
| #============================================================================== | ||||
| #  | ||||
| #  <20><>  End of File | ||||
| #  | ||||
| #============================================================================== | ||||
							
								
								
									
										152
									
								
								samples/VCL/varnish2_default.vcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								samples/VCL/varnish2_default.vcl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,152 @@ | ||||
| /*- | ||||
|  * Copyright (c) 2006 Verdens Gang AS | ||||
|  * Copyright (c) 2006-2008 Linpro AS | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * Author: Poul-Henning Kamp <phk@phk.freebsd.dk> | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the following conditions | ||||
|  * are met: | ||||
|  * 1. Redistributions of source code must retain the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer. | ||||
|  * 2. Redistributions in binary form must reproduce the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer in the | ||||
|  *    documentation and/or other materials provided with the distribution. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||||
|  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||||
|  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE | ||||
|  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
|  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
|  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  | ||||
|  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||||
|  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||||
|  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||||
|  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  * $Id$ | ||||
|  * | ||||
|  * The default VCL code. | ||||
|  * | ||||
|  * NB! You do NOT need to copy & paste all of these functions into your | ||||
|  * own vcl code, if you do not provide a definition of one of these | ||||
|  * functions, the compiler will automatically fall back to the default | ||||
|  * code from this file. | ||||
|  * | ||||
|  * This code will be prefixed with a backend declaration built from the | ||||
|  * -b argument. | ||||
|  */ | ||||
|  | ||||
| sub vcl_recv { | ||||
|     if (req.request != "GET" && | ||||
|       req.request != "HEAD" && | ||||
|       req.request != "PUT" && | ||||
|       req.request != "POST" && | ||||
|       req.request != "TRACE" && | ||||
|       req.request != "OPTIONS" && | ||||
|       req.request != "DELETE") { | ||||
|         /* Non-RFC2616 or CONNECT which is weird. */ | ||||
|         return (pipe); | ||||
|     } | ||||
|     if (req.request != "GET" && req.request != "HEAD") { | ||||
|         /* We only deal with GET and HEAD by default */ | ||||
|         return (pass); | ||||
|     } | ||||
|     if (req.http.Authorization || req.http.Cookie) { | ||||
|         /* Not cacheable by default */ | ||||
|         return (pass); | ||||
|     } | ||||
|     return (lookup); | ||||
| } | ||||
|  | ||||
| sub vcl_pipe { | ||||
|     # Note that only the first request to the backend will have | ||||
|     # X-Forwarded-For set.  If you use X-Forwarded-For and want to | ||||
|     # have it set for all requests, make sure to have: | ||||
|     # set req.http.connection = "close"; | ||||
|     # here.  It is not set by default as it might break some broken web | ||||
|     # applications, like IIS with NTLM authentication. | ||||
|     return (pipe); | ||||
| } | ||||
|  | ||||
| sub vcl_pass { | ||||
|     return (pass); | ||||
| } | ||||
|  | ||||
| sub vcl_hash { | ||||
|     set req.hash += req.url; | ||||
|     if (req.http.host) { | ||||
|         set req.hash += req.http.host; | ||||
|     } else { | ||||
|         set req.hash += server.ip; | ||||
|     } | ||||
|     return (hash); | ||||
| } | ||||
|  | ||||
| sub vcl_hit { | ||||
|     if (!obj.cacheable) { | ||||
|         return (pass); | ||||
|     } | ||||
|     return (deliver); | ||||
| } | ||||
|  | ||||
| sub vcl_miss { | ||||
|     return (fetch); | ||||
| } | ||||
|  | ||||
| sub vcl_fetch { | ||||
|     if (!obj.cacheable) { | ||||
|         return (pass); | ||||
|     } | ||||
|     if (obj.http.Set-Cookie) { | ||||
|         return (pass); | ||||
|     } | ||||
|     set obj.prefetch =  -30s; | ||||
|     return (deliver); | ||||
| } | ||||
|  | ||||
| sub vcl_deliver { | ||||
|     return (deliver); | ||||
| } | ||||
|  | ||||
| sub vcl_discard { | ||||
|     /* XXX: Do not redefine vcl_discard{}, it is not yet supported */ | ||||
|     return (discard); | ||||
| } | ||||
|  | ||||
| sub vcl_prefetch { | ||||
|     /* XXX: Do not redefine vcl_prefetch{}, it is not yet supported */ | ||||
|     return (fetch); | ||||
| } | ||||
|  | ||||
| sub vcl_timeout { | ||||
|     /* XXX: Do not redefine vcl_timeout{}, it is not yet supported */ | ||||
|     return (discard); | ||||
| } | ||||
|  | ||||
| sub vcl_error { | ||||
|     set obj.http.Content-Type = "text/html; charset=utf-8"; | ||||
|     synthetic {" | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||||
|  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||||
| <html> | ||||
|   <head> | ||||
|     <title>"} obj.status " " obj.response {"</title> | ||||
|   </head> | ||||
|   <body> | ||||
|     <h1>Error "} obj.status " " obj.response {"</h1> | ||||
|     <p>"} obj.response {"</p> | ||||
|     <h3>Guru Meditation:</h3> | ||||
|     <p>XID: "} req.xid {"</p> | ||||
|     <hr> | ||||
|     <address> | ||||
|        <a href="http://www.varnish-cache.org/">Varnish cache server</a> | ||||
|     </address> | ||||
|   </body> | ||||
| </html> | ||||
| "}; | ||||
|     return (deliver); | ||||
| } | ||||
							
								
								
									
										149
									
								
								samples/VCL/varnish3_default.vcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										149
									
								
								samples/VCL/varnish3_default.vcl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,149 @@ | ||||
| /*- | ||||
|  * Copyright (c) 2006 Verdens Gang AS | ||||
|  * Copyright (c) 2006-2011 Varnish Software AS | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * Author: Poul-Henning Kamp <phk@phk.freebsd.dk> | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the following conditions | ||||
|  * are met: | ||||
|  * 1. Redistributions of source code must retain the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer. | ||||
|  * 2. Redistributions in binary form must reproduce the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer in the | ||||
|  *    documentation and/or other materials provided with the distribution. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||||
|  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||||
|  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE | ||||
|  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
|  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
|  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  | ||||
|  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||||
|  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||||
|  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||||
|  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  * The default VCL code. | ||||
|  * | ||||
|  * NB! You do NOT need to copy & paste all of these functions into your | ||||
|  * own vcl code, if you do not provide a definition of one of these | ||||
|  * functions, the compiler will automatically fall back to the default | ||||
|  * code from this file. | ||||
|  * | ||||
|  * This code will be prefixed with a backend declaration built from the | ||||
|  * -b argument. | ||||
|  */ | ||||
|  | ||||
| sub vcl_recv { | ||||
|     if (req.restarts == 0) { | ||||
| 	if (req.http.x-forwarded-for) { | ||||
| 	    set req.http.X-Forwarded-For = | ||||
| 		req.http.X-Forwarded-For + ", " + client.ip; | ||||
| 	} else { | ||||
| 	    set req.http.X-Forwarded-For = client.ip; | ||||
| 	} | ||||
|     } | ||||
|     if (req.request != "GET" && | ||||
|       req.request != "HEAD" && | ||||
|       req.request != "PUT" && | ||||
|       req.request != "POST" && | ||||
|       req.request != "TRACE" && | ||||
|       req.request != "OPTIONS" && | ||||
|       req.request != "DELETE") { | ||||
|         /* Non-RFC2616 or CONNECT which is weird. */ | ||||
|         return (pipe); | ||||
|     } | ||||
|     if (req.request != "GET" && req.request != "HEAD") { | ||||
|         /* We only deal with GET and HEAD by default */ | ||||
|         return (pass); | ||||
|     } | ||||
|     if (req.http.Authorization || req.http.Cookie) { | ||||
|         /* Not cacheable by default */ | ||||
|         return (pass); | ||||
|     } | ||||
|     return (lookup); | ||||
| } | ||||
|  | ||||
| sub vcl_pipe { | ||||
|     # Note that only the first request to the backend will have | ||||
|     # X-Forwarded-For set.  If you use X-Forwarded-For and want to | ||||
|     # have it set for all requests, make sure to have: | ||||
|     # set bereq.http.connection = "close"; | ||||
|     # here.  It is not set by default as it might break some broken web | ||||
|     # applications, like IIS with NTLM authentication. | ||||
|     return (pipe); | ||||
| } | ||||
|  | ||||
| sub vcl_pass { | ||||
|     return (pass); | ||||
| } | ||||
|  | ||||
| sub vcl_hash { | ||||
|     hash_data(req.url); | ||||
|     if (req.http.host) { | ||||
|         hash_data(req.http.host); | ||||
|     } else { | ||||
|         hash_data(server.ip); | ||||
|     } | ||||
|     return (hash); | ||||
| } | ||||
|  | ||||
| sub vcl_hit { | ||||
|     return (deliver); | ||||
| } | ||||
|  | ||||
| sub vcl_miss { | ||||
|     return (fetch); | ||||
| } | ||||
|  | ||||
| sub vcl_fetch { | ||||
|     if (beresp.ttl <= 0s || | ||||
|         beresp.http.Set-Cookie || | ||||
|         beresp.http.Vary == "*") { | ||||
| 		/* | ||||
| 		 * Mark as "Hit-For-Pass" for the next 2 minutes | ||||
| 		 */ | ||||
| 		set beresp.ttl = 120 s; | ||||
| 		return (hit_for_pass); | ||||
|     } | ||||
|     return (deliver); | ||||
| } | ||||
|  | ||||
| sub vcl_deliver { | ||||
|     return (deliver); | ||||
| } | ||||
|  | ||||
| sub vcl_error { | ||||
|     set obj.http.Content-Type = "text/html; charset=utf-8"; | ||||
|     set obj.http.Retry-After = "5"; | ||||
|     synthetic {" | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||||
|  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||||
| <html> | ||||
|   <head> | ||||
|     <title>"} + obj.status + " " + obj.response + {"</title> | ||||
|   </head> | ||||
|   <body> | ||||
|     <h1>Error "} + obj.status + " " + obj.response + {"</h1> | ||||
|     <p>"} + obj.response + {"</p> | ||||
|     <h3>Guru Meditation:</h3> | ||||
|     <p>XID: "} + req.xid + {"</p> | ||||
|     <hr> | ||||
|     <p>Varnish cache server</p> | ||||
|   </body> | ||||
| </html> | ||||
| "}; | ||||
|     return (deliver); | ||||
| } | ||||
|  | ||||
| sub vcl_init { | ||||
| 	return (ok); | ||||
| } | ||||
|  | ||||
| sub vcl_fini { | ||||
| 	return (ok); | ||||
| } | ||||
| @@ -114,6 +114,9 @@ class TestBlob < Test::Unit::TestCase | ||||
|     assert_equal "ISO-2022-KR", blob("Text/ISO-2022-KR.txt").encoding | ||||
|     assert_equal "binary", blob("Text/ISO-2022-KR.txt").ruby_encoding | ||||
|     assert_nil blob("Binary/dog.o").encoding | ||||
|  | ||||
|     assert_equal "windows-1252", blob("Text/Visual_Battlers.rb").encoding | ||||
|     assert_equal "Windows-1252", blob("Text/Visual_Battlers.rb").ruby_encoding | ||||
|   end | ||||
|  | ||||
|   def test_binary | ||||
|   | ||||
		Reference in New Issue
	
	Block a user