Пример #1
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static string keywords_lookup( string msg = null ) {
			ByTable adminhelp_ignored_words = null;
			ByTable msglist = null;
			ByTable surnames = null;
			ByTable forenames = null;
			ByTable ckeys = null;
			dynamic M = null;
			ByTable indexing = null;
			dynamic _string = null;
			ByTable L = null;
			int? surname_found = null;
			int? i = null;
			string word = null;
			int? i2 = null;
			string word2 = null;
			bool ai_found = false;
			ByTable mobs_found = null;
			dynamic original_word = null;
			string word3 = null;
			dynamic found = null;
			adminhelp_ignored_words = new ByTable(new object [] { "unknown", "the", "a", "an", "of", "monkey", "alien", "as", "i" });
			msglist = GlobalFuncs.text2list( msg, " " );
			surnames = new ByTable();
			forenames = new ByTable();
			ckeys = new ByTable();
			M = null;
			foreach (dynamic _b in GlobalVars.mob_list ) {
				M = _b;
				indexing = new ByTable(new object [] { M.real_name, M.name });
				if ( Lang13.Bool( M.mind ) ) {
					indexing += M.mind.name;
				}
				_string = null;
				foreach (dynamic _a in indexing ) {
					_string = _a;
					L = GlobalFuncs.text2list( _string, " " );
					surname_found = 0;
					i = null;
					i = L.len;
					while (( i ??0) >= 1) {
						word = String13.ckey( L[i] );
						if ( Lang13.Bool( word ) ) {
							surnames[word] = M;
							surname_found = i;
							break;
						}
						i--;
					}
					i2 = null;
					i2 = 1;
					while (( i2 ??0) < ( surname_found ??0)) {
						word2 = String13.ckey( L[i2] );
						if ( Lang13.Bool( word2 ) ) {
							forenames[word2] = M;
						}
						i2++;
					}
					ckeys[M.ckey] = M;
				};
			};
			ai_found = false;
			msg = "";
			mobs_found = new ByTable();
			original_word = null;
			foreach (dynamic _c in msglist ) {
				original_word = _c;
				word3 = String13.ckey( original_word );
				if ( Lang13.Bool( word3 ) ) {
					if ( !adminhelp_ignored_words.contains( word3 ) ) {
						if ( word3 == "ai" ) {
							ai_found = true;
						} else {
							found = ckeys[word3];
							if ( !Lang13.Bool( found ) ) {
								found = surnames[word3];
								if ( !Lang13.Bool( found ) ) {
									found = forenames[word3];
								}
							}
							if ( Lang13.Bool( found ) ) {
								if ( !mobs_found.contains( found ) ) {
									mobs_found += found;
									if ( !ai_found && found is Mob_Living_Silicon_Ai ) {
										ai_found = true;
									}
									msg += ((dynamic)new Txt()).item( original_word ).str( "<font size='1' color='black'>(<A HREF='?_src_=holder;adminmoreinfo=" ).Ref( found ).str( "'>?</A>|<A HREF='?_src_=holder;adminplayerobservefollow=" ).Ref( found ).str( "'>F</A>)</font> " );
									continue;
								}
							}
						}
					}
				}
				msg += "" + original_word + " ";
			};
			return msg;
		}
Пример #2
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static dynamic listgetindex( ByTable L = null, dynamic index = null ) {
			if ( L is ByTable ) {
				if ( Lang13.isNumber( index ) ) {
					if ( GlobalFuncs.IsInRange( index, 1, L.len ) ) {
						return L[index];
					}
				} else if ( L.contains( index ) ) {
					return L[index];
				}
			}
			return null;
		}
Пример #3
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static dynamic AStar( dynamic start = null, dynamic end = null, Mob_Living_SimpleAnimal atom = null, System.Reflection.MethodInfo dist = null, dynamic maxnodes = null, dynamic maxnodedepth = null, dynamic mintargetdist = null, System.Reflection.MethodInfo adjacent = null, Ent_Item_Weapon_Card_Id id = null, dynamic exclude = null, bool? simulated_only = null ) {
			Heap open = null;
			ByTable closed = null;
			ByTable path = null;
			dynamic cur = null;
			bool? closeenough = null;
			dynamic L = null;
			dynamic T = null;
			dynamic newg = null;
			PathNode PN = null;
			dynamic T2 = null;
			double? i = null;
			if ( maxnodedepth == null ) {
				maxnodedepth = 30;
			}
			if ( adjacent == null ) {
				adjacent = typeof(Tile).GetMethod( "reachableAdjacentTurfs" );
			}
			if ( id == null ) {
				id = null;
			}
			if ( exclude == null ) {
				exclude = null;
			}
			if ( simulated_only == null ) {
				simulated_only = true;
			}
			if ( Lang13.Bool( maxnodes ) ) {
				if ( Lang13.Double( Lang13.call( Lang13.bindf( start, dist ), end ) ) > Lang13.Double( maxnodes ) ) {
					return 0;
				}
				maxnodedepth = maxnodes;
			}
			open = new Heap( typeof(GlobalFuncs).GetMethod( "HeapPathWeightCompare" ) );
			closed = new ByTable();
			path = null;
			start = GlobalFuncs.get_turf( start );
			if ( !Lang13.Bool( start ) ) {
				return 0;
			}
			open.Insert( new PathNode( start, null, false, Lang13.call( Lang13.bindf( start, dist ), end ), false ) );
			while (!open.IsEmpty() && !( path != null )) {
				cur = open.Pop();
				closed.Add( cur.source );
				closeenough = null;
				if ( Lang13.Bool( mintargetdist ) ) {
					closeenough = Lang13.Double( Lang13.call( Lang13.bindf( cur.source, dist ), end ) ) <= Lang13.Double( mintargetdist );
				}
				if ( Lang13.Bool( maxnodedepth ) && Lang13.Double( cur.nt ) > Lang13.Double( maxnodedepth ) ) {
					continue;
				}
				if ( cur.source == end || closeenough == true ) {
					path = new ByTable();
					path.Add( cur.source );
					while (Lang13.Bool( cur.prevNode )) {
						cur = cur.prevNode;
						path.Add( cur.source );
					}
					break;
				}
				L = Lang13.call( Lang13.bindf( cur.source, adjacent ), atom, id, simulated_only );
				T = null;
				foreach (dynamic _a in L ) {
					T = _a;
					if ( T == exclude || closed.contains( T ) ) {
						continue;
					}
					newg = cur.g + Lang13.call( Lang13.bindf( cur.source, dist ), T );
					if ( !Lang13.Bool( T.PNode ) ) {
						open.Insert( new PathNode( T, cur, Lang13.Bool( newg ), Lang13.call( Lang13.bindf( T, dist ), end ), Lang13.Bool( cur.nt + 1 ) ) );
					} else if ( Lang13.Double( newg ) < Lang13.Double( T.PNode.g ) ) {
						T.PNode.prevNode = cur;
						T.PNode.g = newg;
						((dynamic)T.PNode).calc_f();
						T.PNode.nt = cur.nt + 1;
						open.ReSort( T.PNode );
					}
				};
			}
			PN = null;
			foreach (dynamic _b in open.L ) {
				if ( !( _b is PathNode ) ) {
					continue;
				}
				PN = _b;
				PN.source.PNode = null;
			};
			T2 = null;
			foreach (dynamic _c in closed ) {
				T2 = _c;
				T2.PNode = null;
			};
			if ( path != null ) {
				i = null;
				i = 1;
				while (( i ??0) <= path.len / 2) {
					path.Swap( ((int)( i )), ((int)( path.len - ( i ??0) + 1 )) );
					i++;
				}
			}
			return path;
		}
Пример #4
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable getpois( bool? mobs_only = null, bool? skip_mindless = null ) {
			ByTable mobs = null;
			ByTable names = null;
			ByTable pois = null;
			ByTable namecounts = null;
			dynamic M = null;
			string name = null;
			BaseStatic A = null;
			string name2 = null;
			if ( mobs_only == null ) {
				mobs_only = false;
			}
			if ( skip_mindless == null ) {
				skip_mindless = false;
			}
			mobs = GlobalFuncs.sortmobs();
			names = new ByTable();
			pois = new ByTable();
			namecounts = new ByTable();
			M = null;
			foreach (dynamic _a in mobs ) {
				M = _a;
				if ( skip_mindless == true && !Lang13.Bool( M.mind ) && !Lang13.Bool( M.ckey ) ) {
					if ( !( M is Mob_Living_SimpleAnimal_Bot ) && !( M is Mob_Camera ) ) {
						continue;
					}
				}
				if ( Lang13.Bool( M.client ) && Lang13.Bool( M.client.holder ) && Lang13.Bool( M.client.holder.fakekey ) ) {
					continue;
				}
				name = M.name;
				if ( names.contains( name ) ) {
					namecounts[name]++;
					name = "" + name + " (" + namecounts[name] + ")";
				} else {
					names.Add( name );
					namecounts[name] = 1;
				}
				if ( Lang13.Bool( M.real_name ) && M.real_name != M.name ) {
					name += " [" + M.real_name + "]";
				}
				if ( Lang13.Int( M.stat ) == 2 ) {
					if ( M is Mob_Dead_Observer ) {
						name += " [ghost]";
					} else {
						name += " [dead]";
					}
				}
				pois[name] = M;
			};
			if ( !( mobs_only == true ) ) {
				A = null;
				foreach (dynamic _b in GlobalVars.poi_list ) {
					if ( !( _b is BaseStatic ) ) {
						continue;
					}
					A = _b;
					if ( !( A != null ) || !Lang13.Bool( ((dynamic)A).loc ) ) {
						continue;
					}
					name2 = ((dynamic)A).name;
					if ( names.Find( name2 ) != 0 ) {
						namecounts[name2]++;
						name2 = "" + name2 + " (" + namecounts[name2] + ")";
					} else {
						names.Add( name2 );
						namecounts[name2] = 1;
					}
					pois[name2] = A;
				};
			}
			return pois;
		}
Пример #5
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static string generate_code_phrase(  ) {
			string code_phrase = null;
			int words = 0;
			ByTable safety = null;
			ByTable nouns = null;
			ByTable drinks = null;
			ByTable locations = null;
			ByTable names = null;
			Data_Record t = null;
			int maxwords = 0;
			code_phrase = "";
			words = Lang13.Int( Rand13.pickWeighted(new object [] { 10082, 2, 50411, 3, 60493, 4, 65535, 5 }) );
			safety = new ByTable(new object [] { 1, 2, 3 });
			nouns = new ByTable(new object [] { 
				"love", 
				"hate", 
				"anger", 
				"peace", 
				"pride", 
				"sympathy", 
				"bravery", 
				"loyalty", 
				"honesty", 
				"integrity", 
				"compassion", 
				"charity", 
				"success", 
				"courage", 
				"deceit", 
				"skill", 
				"beauty", 
				"brilliance", 
				"pain", 
				"misery", 
				"beliefs", 
				"dreams", 
				"justice", 
				"truth", 
				"faith", 
				"liberty", 
				"knowledge", 
				"thought", 
				"information", 
				"culture", 
				"trust", 
				"dedication", 
				"progress", 
				"education", 
				"hospitality", 
				"leisure", 
				"trouble", 
				"friendships", 
				"relaxation"
			 });
			drinks = new ByTable(new object [] { 
				"vodka and tonic", 
				"gin fizz", 
				"bahama mama", 
				"manhattan", 
				"black Russian", 
				"whiskey soda", 
				"long island tea", 
				"margarita", 
				"Irish coffee", 
				" manly dwarf", 
				"Irish cream", 
				"doctor's delight", 
				"Beepksy Smash", 
				"tequila sunrise", 
				"brave bull", 
				"gargle blaster", 
				"bloody mary", 
				"whiskey cola", 
				"white Russian", 
				"vodka martini", 
				"martini", 
				"Cuba libre", 
				"kahlua", 
				"vodka", 
				"wine", 
				"moonshine"
			 });
			locations = ( GlobalVars.teleportlocs.len != 0 ? GlobalVars.teleportlocs : drinks );
			names = new ByTable();
			t = null;
			foreach (dynamic _a in GlobalVars.data_core.general ) {
				if ( !( _a is Data_Record ) ) {
					continue;
				}
				t = _a;
				names += t.fields["name"];
			};
			maxwords = words;
			while (words > 0) {
				if ( words == 1 && safety.contains( 1 ) && safety.contains( 2 ) ) {
					safety = new ByTable(new object [] { Rand13.pick(new object [] { 1, 2 }) });
				} else if ( words == 1 && maxwords == 2 ) {
					safety = new ByTable(new object [] { 3 });
				}
				dynamic _e = Rand13.pick( safety ); // Was a switch-case, sorry for the mess.
				if ( _e==1 ) {
					dynamic _b = Rand13.Int( 1, 2 ); // Was a switch-case, sorry for the mess.
					if ( _b==1 ) {
						if ( names.len != 0 && Rand13.percentChance( 70 ) ) {
							code_phrase += Rand13.pick( names );
						} else if ( Rand13.percentChance( 10 ) ) {
							code_phrase += Rand13.pick(new object [] { GlobalFuncs.lizard_name( GlobalVars.MALE ), GlobalFuncs.lizard_name( GlobalVars.FEMALE ) });
						} else {
							code_phrase += Rand13.pick( Rand13.pick(new object [] { GlobalVars.first_names_male, GlobalVars.first_names_female }) );
							code_phrase += " ";
							code_phrase += Rand13.pick( GlobalVars.last_names );
						}
					} else if ( _b==2 ) {
						code_phrase += Rand13.pick( GlobalFuncs.get_all_jobs() );
					};
					safety -= 1;
				} else if ( _e==2 ) {
					dynamic _c = Rand13.Int( 1, 2 ); // Was a switch-case, sorry for the mess.
					if ( _c==1 ) {
						code_phrase += Rand13.pick( drinks );
					} else if ( _c==2 ) {
						code_phrase += Rand13.pick( locations );
					};
					safety -= 2;
				} else if ( _e==3 ) {
					dynamic _d = Rand13.Int( 1, 3 ); // Was a switch-case, sorry for the mess.
					if ( _d==1 ) {
						code_phrase += Rand13.pick( nouns );
					} else if ( _d==2 ) {
						code_phrase += Rand13.pick( GlobalVars.adjectives );
					} else if ( _d==3 ) {
						code_phrase += Rand13.pick( GlobalVars.verbs );
					};
				};
				if ( words == 1 ) {
					code_phrase += ".";
				} else {
					code_phrase += ", ";
				}
				words--;
			}
			return code_phrase;
		}
Пример #6
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable SDQL2_tokenize( dynamic query_text = null ) {
			ByTable whitespace = null;
			ByTable single = null;
			ByTable multi = null;
			string word = null;
			ByTable query_list = null;
			int? len = null;
			int? i = null;
			string _char = null;
			string char2 = null;
			whitespace = new ByTable(new object [] { " ", "\n", "	" });
			single = new ByTable(new object [] { "(", ")", ",", "+", "-", ".", ";" });
			multi = new ByTable()
				.set( "=", new ByTable(new object [] { "", "=" }) )
				.set( "<", new ByTable(new object [] { "", "=", ">" }) )
				.set( ">", new ByTable(new object [] { "", "=" }) )
				.set( "!", new ByTable(new object [] { "", "=" }) )
			;
			word = "";
			query_list = new ByTable();
			len = Lang13.IntNullable( query_text.Length );
			i = null;
			i = 1;
			while (( i ??0) <= ( len ??0)) {
				_char = String13.substr( query_text, i ??0, ( i ??0) + 1 );
				if ( whitespace.contains( _char ) ) {
					if ( word != "" ) {
						query_list += word;
						word = "";
					}
				} else if ( single.contains( _char ) ) {
					if ( word != "" ) {
						query_list += word;
						word = "";
					}
					query_list += _char;
				} else if ( multi.contains( _char ) ) {
					if ( word != "" ) {
						query_list += word;
						word = "";
					}
					char2 = String13.substr( query_text, ( i ??0) + 1, ( i ??0) + 2 );
					if ( Lang13.Bool( ((dynamic)multi[_char]).contains( char2 ) ) ) {
						query_list += "" + _char + char2;
						i++;
					} else {
						query_list += _char;
					}
				} else if ( _char == "'" ) {
					if ( word != "" ) {
						((dynamic)Task13.user).write( ((dynamic)new Txt()).red().str( "SDQL2: You have an error in your SDQL syntax, unexpected ' in query: \"<font color=gray>" ).item( query_text ).str( "</font>\" following \"<font color=gray>" ).item( word ).str( "</font>\". Please check your syntax, and try again." ) );
						return null;
					}
					word = "'";
					i++;
					while (( i ??0) <= ( len ??0)) {
						_char = String13.substr( query_text, i ??0, ( i ??0) + 1 );
						if ( _char == "'" ) {
							if ( String13.substr( query_text, ( i ??0) + 1, ( i ??0) + 2 ) == "'" ) {
								word += "'";
								i++;
							} else {
								break;
							}
						} else {
							word += _char;
						}
						i++;
					}
					if ( ( i ??0) > ( len ??0) ) {
						((dynamic)Task13.user).write( ((dynamic)new Txt()).red().str( "SDQL2: You have an error in your SDQL syntax, unmatched ' in query: \"<font color=gray>" ).item( query_text ).str( "</font>\". Please check your syntax, and try again." ) );
						return null;
					}
					query_list += "" + word + "'";
					word = "";
				} else if ( _char == "\"" ) {
					if ( word != "" ) {
						((dynamic)Task13.user).write( ((dynamic)new Txt()).red().str( "SDQL2: You have an error in your SDQL syntax, unexpected \" in query: \"<font color=gray>" ).item( query_text ).str( "</font>\" following \"<font color=gray>" ).item( word ).str( "</font>\". Please check your syntax, and try again." ) );
						return null;
					}
					word = "\"";
					i++;
					while (( i ??0) <= ( len ??0)) {
						_char = String13.substr( query_text, i ??0, ( i ??0) + 1 );
						if ( _char == "\"" ) {
							if ( String13.substr( query_text, ( i ??0) + 1, ( i ??0) + 2 ) == "'" ) {
								word += "\"";
								i++;
							} else {
								break;
							}
						} else {
							word += _char;
						}
						i++;
					}
					if ( ( i ??0) > ( len ??0) ) {
						((dynamic)Task13.user).write( ((dynamic)new Txt()).red().str( "SDQL2: You have an error in your SDQL syntax, unmatched \" in query: \"<font color=gray>" ).item( query_text ).str( "</font>\". Please check your syntax, and try again." ) );
						return null;
					}
					query_list += "" + word + "\"";
					word = "";
				} else {
					word += _char;
				}
				i++;
			}
			if ( word != "" ) {
				query_list += word;
			}
			return query_list;
		}
Пример #7
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static dynamic sanitize_inlist( dynamic value = null, ByTable List = null, string __default = null ) {
			if ( List.contains( value ) ) {
				return value;
			}
			if ( Lang13.Bool( __default ) ) {
				return __default;
			}
			if ( List != null && List.len != 0 ) {
				return Rand13.pick( List );
			}
			return null;
		}